LLVM API Documentation

Main Page | Namespace List | Class Hierarchy | Alphabetical List | Class List | Directories | File List | Namespace Members | Class Members | File Members | Related Pages

llvm::SwitchInst Class Reference

#include <Instructions.h>

Inheritance diagram for llvm::SwitchInst:

Inheritance graph
[legend]
Collaboration diagram for llvm::SwitchInst:

Collaboration graph
[legend]
List of all members.

Public Member Functions

 SwitchInst (Value *Value, BasicBlock *Default, Instruction *InsertBefore=0)
 SwitchInst (Value *Value, BasicBlock *Default, BasicBlock *InsertAtEnd)
virtual SwitchInstclone () const
 Terminators must implement the methods required by Instruction...
const ValuegetCondition () const
ValuegetCondition ()
const BasicBlockgetDefaultDest () const
BasicBlockgetDefaultDest ()
unsigned getNumCases () const
ConstantgetCaseValue (unsigned i)
const ConstantgetCaseValue (unsigned i) const
unsigned findCaseValue (const Constant *C) const
void addCase (Constant *OnVal, BasicBlock *Dest)
void removeCase (unsigned idx)
virtual const BasicBlockgetSuccessor (unsigned idx) const
BasicBlockgetSuccessor (unsigned idx)
virtual void setSuccessor (unsigned idx, BasicBlock *NewSucc)
 Set a successor at a given index.
const ConstantgetSuccessorValue (unsigned idx) const
ConstantgetSuccessorValue (unsigned idx)
virtual unsigned getNumSuccessors () const

Static Public Member Functions

static bool classof (const SwitchInst *)
static bool classof (const Instruction *I)
 Methods for support type inquiry through isa, cast, and dyn_cast:.
static bool classof (const Value *V)

Detailed Description

SwitchInst - Multiway switch

Definition at line 961 of file Instructions.h.


Constructor & Destructor Documentation

llvm::SwitchInst::SwitchInst Value Value,
BasicBlock Default,
Instruction InsertBefore = 0
[inline]
 

Definition at line 970 of file Instructions.h.

llvm::SwitchInst::SwitchInst Value Value,
BasicBlock Default,
BasicBlock InsertAtEnd
[inline]
 

Definition at line 974 of file Instructions.h.


Member Function Documentation

void SwitchInst::addCase Constant OnVal,
BasicBlock Dest
 

addCase - Add an entry to the switch instruction...

Definition at line 778 of file Instructions.cpp.

References llvm::User::Operands.

Referenced by FoldValueComparisonIntoPredecessors(), llvm::BytecodeReader::ParseInstruction(), and llvm::SimplifyCFG().

static bool llvm::SwitchInst::classof const Value V  )  [inline, static]
 

Reimplemented from llvm::TerminatorInst.

Definition at line 1063 of file Instructions.h.

References classof().

static bool llvm::SwitchInst::classof const Instruction I  )  [inline, static]
 

Methods for support type inquiry through isa, cast, and dyn_cast:.

Reimplemented from llvm::TerminatorInst.

Definition at line 1060 of file Instructions.h.

References llvm::Instruction::getOpcode(), and llvm::ISD::Switch.

static bool llvm::SwitchInst::classof const SwitchInst  )  [inline, static]
 

Definition at line 1059 of file Instructions.h.

Referenced by classof().

SwitchInst * SwitchInst::clone  )  const [virtual]
 

Terminators must implement the methods required by Instruction...

Implements llvm::TerminatorInst.

Definition at line 819 of file Instructions.cpp.

unsigned llvm::SwitchInst::findCaseValue const Constant C  )  const [inline]
 

findCaseValue - Search all of the case values for the specified constant. If it is explicitly handled, return the case number of it, otherwise return 0 to indicate that it is handled by the default handler.

Definition at line 1015 of file Instructions.h.

References getCaseValue(), and getNumCases().

const Constant* llvm::SwitchInst::getCaseValue unsigned  i  )  const [inline]
 

getCaseValue - Return the specified case value. Note that case #0, the default destination, does not have a case value.

Definition at line 1007 of file Instructions.h.

References getNumCases(), and getSuccessorValue().

Constant* llvm::SwitchInst::getCaseValue unsigned  i  )  [inline]
 

getCaseValue - Return the specified case value. Note that case #0, the default destination, does not have a case value.

Definition at line 1000 of file Instructions.h.

References getNumCases(), and getSuccessorValue().

Referenced by findCaseValue().

Value* llvm::SwitchInst::getCondition  )  [inline]
 

Definition at line 984 of file Instructions.h.

References llvm::User::Operands.

const Value* llvm::SwitchInst::getCondition  )  const [inline]
 

Definition at line 983 of file Instructions.h.

References llvm::User::Operands.

BasicBlock* llvm::SwitchInst::getDefaultDest  )  [inline]
 

Definition at line 988 of file Instructions.h.

References llvm::User::Operands.

const BasicBlock* llvm::SwitchInst::getDefaultDest  )  const [inline]
 

Definition at line 985 of file Instructions.h.

References llvm::User::Operands.

Referenced by llvm::Interpreter::visitSwitchInst().

unsigned llvm::SwitchInst::getNumCases  )  const [inline]
 

getNumCases - return the number of 'cases' in this switch instruction. Note that case #0 is always the default case.

Definition at line 994 of file Instructions.h.

References llvm::User::Operands.

Referenced by findCaseValue(), and getCaseValue().

virtual unsigned llvm::SwitchInst::getNumSuccessors  )  const [inline, virtual]
 

Implements llvm::TerminatorInst.

Definition at line 1056 of file Instructions.h.

References llvm::User::Operands.

Referenced by FoldValueComparisonIntoPredecessors(), getSuccessor(), getSuccessorValue(), and setSuccessor().

BasicBlock* llvm::SwitchInst::getSuccessor unsigned  idx  )  [inline]
 

Reimplemented from llvm::TerminatorInst.

Definition at line 1036 of file Instructions.h.

References getNumSuccessors(), and llvm::User::Operands.

virtual const BasicBlock* llvm::SwitchInst::getSuccessor unsigned  idx  )  const [inline, virtual]
 

Additionally, they must provide a method to get at the successors of this terminator instruction. 'idx' may not be >= the number of successors returned by getNumSuccessors()!

Implements llvm::TerminatorInst.

Definition at line 1032 of file Instructions.h.

References getNumSuccessors(), and llvm::User::Operands.

Referenced by FoldValueComparisonIntoPredecessors().

Constant* llvm::SwitchInst::getSuccessorValue unsigned  idx  )  [inline]
 

Definition at line 1052 of file Instructions.h.

References getNumSuccessors(), and llvm::User::Operands.

const Constant* llvm::SwitchInst::getSuccessorValue unsigned  idx  )  const [inline]
 

Definition at line 1048 of file Instructions.h.

References getNumSuccessors(), and llvm::User::Operands.

Referenced by getCaseValue().

void SwitchInst::removeCase unsigned  idx  ) 
 

removeCase - This method removes the specified successor from the switch instruction. Note that this cannot be used to remove the default destination (successor #0).

Definition at line 787 of file Instructions.cpp.

References llvm::User::Operands.

virtual void llvm::SwitchInst::setSuccessor unsigned  idx,
BasicBlock NewSucc
[inline, virtual]
 

Set a successor at a given index.

Implements llvm::TerminatorInst.

Definition at line 1041 of file Instructions.h.

References getNumSuccessors(), and llvm::User::Operands.

Referenced by FoldValueComparisonIntoPredecessors().


The documentation for this class was generated from the following files: