LLVM API Documentation
#include <Instructions.h>
Classes | |
class | CaseIt |
class | CaseIteratorT |
Public Member Functions | |
~SwitchInst () | |
DECLARE_TRANSPARENT_OPERAND_ACCESSORS (Value) | |
Provide fast operand accessors. More... | |
Value * | getCondition () const |
void | setCondition (Value *V) |
BasicBlock * | getDefaultDest () const |
void | setDefaultDest (BasicBlock *DefaultCase) |
unsigned | getNumCases () const |
CaseIt | case_begin () |
ConstCaseIt | case_begin () const |
CaseIt | case_end () |
ConstCaseIt | case_end () const |
CaseIt | case_default () |
ConstCaseIt | case_default () const |
CaseIt | findCaseValue (const ConstantInt *C) |
ConstCaseIt | findCaseValue (const ConstantInt *C) const |
ConstantInt * | findCaseDest (BasicBlock *BB) |
void | addCase (ConstantInt *OnVal, BasicBlock *Dest) |
void | removeCase (CaseIt i) |
unsigned | getNumSuccessors () const |
BasicBlock * | getSuccessor (unsigned idx) const |
void | setSuccessor (unsigned idx, BasicBlock *NewSucc) |
![]() | |
unsigned | getNumSuccessors () const |
BasicBlock * | getSuccessor (unsigned idx) const |
void | setSuccessor (unsigned idx, BasicBlock *B) |
![]() | |
~Instruction () | |
Instruction * | use_back () |
const Instruction * | use_back () const |
const BasicBlock * | getParent () const |
BasicBlock * | getParent () |
void | removeFromParent () |
void | eraseFromParent () |
void | insertBefore (Instruction *InsertPos) |
void | insertAfter (Instruction *InsertPos) |
void | moveBefore (Instruction *MovePos) |
unsigned | getOpcode () const |
getOpcode() returns a member of one of the enums like Instruction::Add. More... | |
const char * | getOpcodeName () const |
bool | isTerminator () const |
bool | isBinaryOp () const |
bool | isShift () |
bool | isCast () const |
bool | isLogicalShift () const |
bool | isArithmeticShift () const |
isArithmeticShift - Return true if this is an arithmetic shift right. More... | |
bool | hasMetadata () const |
bool | hasMetadataOtherThanDebugLoc () const |
MDNode * | getMetadata (unsigned KindID) const |
MDNode * | getMetadata (StringRef Kind) const |
void | getAllMetadata (SmallVectorImpl< std::pair< unsigned, MDNode * > > &MDs) const |
void | getAllMetadataOtherThanDebugLoc (SmallVectorImpl< std::pair< unsigned, MDNode * > > &MDs) const |
void | setMetadata (unsigned KindID, MDNode *Node) |
void | setMetadata (StringRef Kind, MDNode *Node) |
void | setDebugLoc (const DebugLoc &Loc) |
setDebugLoc - Set the debug location information for this instruction. More... | |
const DebugLoc & | getDebugLoc () const |
getDebugLoc - Return the debug location for this node as a DebugLoc. More... | |
void | setHasUnsafeAlgebra (bool B) |
void | setHasNoNaNs (bool B) |
void | setHasNoInfs (bool B) |
void | setHasNoSignedZeros (bool B) |
void | setHasAllowReciprocal (bool B) |
void | setFastMathFlags (FastMathFlags FMF) |
bool | hasUnsafeAlgebra () const |
Determine whether the unsafe-algebra flag is set. More... | |
bool | hasNoNaNs () const |
Determine whether the no-NaNs flag is set. More... | |
bool | hasNoInfs () const |
Determine whether the no-infs flag is set. More... | |
bool | hasNoSignedZeros () const |
Determine whether the no-signed-zeros flag is set. More... | |
bool | hasAllowReciprocal () const |
Determine whether the allow-reciprocal flag is set. More... | |
FastMathFlags | getFastMathFlags () const |
void | copyFastMathFlags (const Instruction *I) |
Copy I's fast-math flags. More... | |
bool | isAssociative () const |
bool | isCommutative () const |
bool | isIdempotent () const |
bool | isNilpotent () const |
bool | mayWriteToMemory () const |
bool | mayReadFromMemory () const |
bool | mayReadOrWriteMemory () const |
bool | mayThrow () const |
bool | mayReturn () const |
bool | mayHaveSideEffects () const |
Instruction * | clone () const |
bool | isIdenticalTo (const Instruction *I) const |
bool | isIdenticalToWhenDefined (const Instruction *I) const |
bool | isSameOperationAs (const Instruction *I, unsigned flags=0) const |
Determine if one instruction is the same operation as another. More... | |
bool | isUsedOutsideOfBlock (const BasicBlock *BB) const |
![]() | |
~User () | |
void | operator delete (void *Usr) |
operator delete - free memory allocated for User and Use objects More... | |
void | operator delete (void *, unsigned) |
placement delete - required by std, but never called. More... | |
void | operator delete (void *, unsigned, bool) |
placement delete - required by std, but never called. More... | |
Value * | getOperand (unsigned i) const |
void | setOperand (unsigned i, Value *Val) |
const Use & | getOperandUse (unsigned i) const |
Use & | getOperandUse (unsigned i) |
unsigned | getNumOperands () const |
op_iterator | op_begin () |
const_op_iterator | op_begin () const |
op_iterator | op_end () |
const_op_iterator | op_end () const |
value_op_iterator | value_op_begin () |
value_op_iterator | value_op_end () |
void | dropAllReferences () |
void | replaceUsesOfWith (Value *From, Value *To) |
![]() | |
virtual | ~Value () |
void | dump () const |
dump - Support for debugging, callable in GDB: V->dump() More... | |
void | print (raw_ostream &O, AssemblyAnnotationWriter *AAW=0) const |
Type * | getType () const |
LLVMContext & | getContext () const |
All values hold a context through their type. More... | |
bool | hasName () const |
ValueName * | getValueName () const |
void | setValueName (ValueName *VN) |
StringRef | getName () const |
void | setName (const Twine &Name) |
void | takeName (Value *V) |
void | replaceAllUsesWith (Value *V) |
bool | use_empty () const |
use_iterator | use_begin () |
const_use_iterator | use_begin () const |
use_iterator | use_end () |
const_use_iterator | use_end () const |
User * | use_back () |
const User * | use_back () const |
bool | hasOneUse () const |
bool | hasNUses (unsigned N) const |
bool | hasNUsesOrMore (unsigned N) const |
bool | isUsedInBasicBlock (const BasicBlock *BB) const |
unsigned | getNumUses () const |
void | addUse (Use &U) |
unsigned | getValueID () const |
unsigned | getRawSubclassOptionalData () const |
void | clearSubclassOptionalData () |
bool | hasSameSubclassOptionalData (const Value *V) const |
void | intersectOptionalDataWith (const Value *V) |
bool | hasValueHandle () const |
Value * | stripPointerCasts () |
Strips off any unneeded pointer casts, all-zero GEPs and aliases from the specified value, returning the original uncasted value. More... | |
const Value * | stripPointerCasts () const |
Value * | stripPointerCastsNoFollowAliases () |
Strips off any unneeded pointer casts and all-zero GEPs from the specified value, returning the original uncasted value. More... | |
const Value * | stripPointerCastsNoFollowAliases () const |
Value * | stripInBoundsConstantOffsets () |
Strips off unneeded pointer casts and all-constant GEPs from the specified value, returning the original pointer value. More... | |
const Value * | stripInBoundsConstantOffsets () const |
Value * | stripAndAccumulateInBoundsConstantOffsets (const DataLayout &DL, APInt &Offset) |
Strips like stripInBoundsConstantOffsets but also accumulates the constant offset stripped. More... | |
const Value * | stripAndAccumulateInBoundsConstantOffsets (const DataLayout &DL, APInt &Offset) const |
Value * | stripInBoundsOffsets () |
Strips off unneeded pointer casts and any in-bounds offsets from the specified value, returning the original pointer value. More... | |
const Value * | stripInBoundsOffsets () const |
bool | isDereferenceablePointer () const |
Value * | DoPHITranslation (const BasicBlock *CurBB, const BasicBlock *PredBB) |
const Value * | DoPHITranslation (const BasicBlock *CurBB, const BasicBlock *PredBB) const |
void | mutateType (Type *Ty) |
![]() | |
Instruction * | getPrevNode () |
Get the previous node, or 0 for the list head. More... | |
const Instruction * | getPrevNode () const |
Get the previous node, or 0 for the list head. More... | |
Instruction * | getNextNode () |
Get the next node, or 0 for the list tail. More... | |
const Instruction * | getNextNode () const |
Get the next node, or 0 for the list tail. More... | |
Static Public Member Functions | |
static SwitchInst * | Create (Value *Value, BasicBlock *Default, unsigned NumCases, Instruction *InsertBefore=0) |
static SwitchInst * | Create (Value *Value, BasicBlock *Default, unsigned NumCases, BasicBlock *InsertAtEnd) |
static bool | classof (const Instruction *I) |
static bool | classof (const Value *V) |
![]() | |
static bool | classof (const Instruction *I) |
static bool | classof (const Value *V) |
![]() | |
static const char * | getOpcodeName (unsigned OpCode) |
static bool | isTerminator (unsigned OpCode) |
static bool | isBinaryOp (unsigned Opcode) |
static bool | isShift (unsigned Opcode) |
Determine if the Opcode is one of the shift instructions. More... | |
static bool | isCast (unsigned OpCode) |
Determine if the OpCode is one of the CastInst instructions. More... | |
static bool | isAssociative (unsigned op) |
static bool | isCommutative (unsigned op) |
static bool | isIdempotent (unsigned op) |
static bool | isNilpotent (unsigned op) |
static bool | classof (const Value *V) |
Methods for support type inquiry through isa, cast, and dyn_cast: More... | |
![]() | |
static bool | classof (const Value *V) |
Static Public Attributes | |
static const unsigned | DefaultPseudoIndex = static_cast<unsigned>(~0L-1) |
![]() | |
static const unsigned | MaximumAlignment = 1u << 29 |
Protected Member Functions | |
virtual SwitchInst * | clone_impl () const |
![]() | |
TerminatorInst (Type *Ty, Instruction::TermOps iType, Use *Ops, unsigned NumOps, Instruction *InsertBefore=0) | |
TerminatorInst (Type *Ty, Instruction::TermOps iType, Use *Ops, unsigned NumOps, BasicBlock *InsertAtEnd) | |
~TerminatorInst () | |
![]() | |
void | setInstructionSubclassData (unsigned short D) |
unsigned | getSubclassDataFromInstruction () const |
Instruction (Type *Ty, unsigned iType, Use *Ops, unsigned NumOps, Instruction *InsertBefore=0) | |
Instruction (Type *Ty, unsigned iType, Use *Ops, unsigned NumOps, BasicBlock *InsertAtEnd) | |
![]() | |
void * | operator new (size_t s, unsigned Us) |
User (Type *ty, unsigned vty, Use *OpList, unsigned NumOps) | |
Use * | allocHungoffUses (unsigned) const |
void | dropHungoffUses () |
template<int Idx> | |
Use & | Op () |
template<int Idx> | |
const Use & | Op () const |
![]() | |
virtual void | printCustom (raw_ostream &O) const |
Value (Type *Ty, unsigned scid) | |
unsigned short | getSubclassDataFromValue () const |
void | setValueSubclassData (unsigned short D) |
![]() | |
ilist_node () | |
Additional Inherited Members | |
![]() | |
template<int Idx, typename U > | |
static Use & | OpFrom (const U *that) |
![]() | |
Use * | OperandList |
unsigned | NumOperands |
![]() | |
unsigned char | SubclassOptionalData: 7 |
SwitchInst - Multiway switch
Definition at line 2449 of file Instructions.h.
typedef CaseIteratorT<const SwitchInst, const ConstantInt, const BasicBlock> llvm::SwitchInst::ConstCaseIt |
Definition at line 2572 of file Instructions.h.
SwitchInst::~SwitchInst | ( | ) |
Definition at line 3337 of file Instructions.cpp.
References llvm::User::dropHungoffUses().
void SwitchInst::addCase | ( | ConstantInt * | OnVal, |
BasicBlock * | Dest | ||
) |
addCase - Add an entry to the switch instruction... Note: This action invalidates case_end(). Old case_end() iterator will point to the added case.
addCase - Add an entry to the switch instruction...
Definition at line 3344 of file Instructions.cpp.
References getNumCases(), llvm::User::NumOperands, llvm::SwitchInst::CaseIt::setSuccessor(), and llvm::SwitchInst::CaseIt::setValue().
Referenced by SimplifyBranchOnICmpChain(), and TryToSimplifyUncondBranchWithICmpInIt().
|
inline |
Returns a read/write iterator that points to the first case in SwitchInst.
Definition at line 2629 of file Instructions.h.
Referenced by EliminateDeadSwitchCases(), ForwardSwitchConditionToPHI(), llvm::AssemblyWriter::printInstruction(), SwitchToLookupTable(), TurnSwitchRangeIntoICmp(), llvm::Interpreter::visitSwitchInst(), llvm::InstCombiner::visitSwitchInst(), and WriteInstruction().
|
inline |
Returns a read-only iterator that points to the first case in the SwitchInst.
Definition at line 2634 of file Instructions.h.
|
inline |
Returns an iterator that points to the default case. Note: this iterator allows to resolve successor only. Attempt to resolve case value causes an assertion. Also note, that increment and decrement also causes an assertion and makes iterator invalid.
Definition at line 2653 of file Instructions.h.
Referenced by EliminateDeadSwitchCases(), and TryToSimplifyUncondBranchWithICmpInIt().
|
inline |
Definition at line 2656 of file Instructions.h.
|
inline |
Returns a read/write iterator that points one past the last in the SwitchInst.
Definition at line 2640 of file Instructions.h.
Referenced by EliminateDeadSwitchCases(), ForwardSwitchConditionToPHI(), llvm::AssemblyWriter::printInstruction(), SwitchToLookupTable(), TurnSwitchRangeIntoICmp(), llvm::Interpreter::visitSwitchInst(), llvm::InstCombiner::visitSwitchInst(), and WriteInstruction().
|
inline |
Returns a read-only iterator that points one past the last in the SwitchInst.
Definition at line 2645 of file Instructions.h.
|
inlinestatic |
Definition at line 2717 of file Instructions.h.
References llvm::Instruction::getOpcode().
Definition at line 2720 of file Instructions.h.
|
protectedvirtual |
Implements llvm::TerminatorInst.
Definition at line 3664 of file Instructions.cpp.
|
inlinestatic |
Definition at line 2595 of file Instructions.h.
Referenced by llvm::IRBuilder< true, TargetFolder >::CreateSwitch().
|
inlinestatic |
Definition at line 2599 of file Instructions.h.
llvm::SwitchInst::DECLARE_TRANSPARENT_OPERAND_ACCESSORS | ( | Value | ) |
Provide fast operand accessors.
|
inline |
findCaseDest - Finds the unique case value for a given successor. Returns null if the successor is not found, not unique, or is the default case.
Definition at line 2679 of file Instructions.h.
Referenced by TryToSimplifyUncondBranchWithICmpInIt().
|
inline |
findCaseValue - Search all of the case values for the specified constant. If it is explicitly handled, return the case iterator of it, otherwise return default case iterator to indicate that it is handled by the default handler.
Definition at line 2664 of file Instructions.h.
References llvm::CallingConv::C.
Referenced by EliminateDeadSwitchCases(), SimplifySwitchOnSelect(), and TryToSimplifyUncondBranchWithICmpInIt().
|
inline |
Definition at line 2670 of file Instructions.h.
References llvm::CallingConv::C.
|
inline |
Definition at line 2610 of file Instructions.h.
Referenced by EliminateDeadSwitchCases(), ForwardSwitchConditionToPHI(), GetCaseResults(), llvm::AssemblyWriter::printInstruction(), SwitchToLookupTable(), TryToSimplifyUncondBranchWithICmpInIt(), TurnSwitchRangeIntoICmp(), llvm::Interpreter::visitSwitchInst(), llvm::InstCombiner::visitSwitchInst(), and WriteInstruction().
|
inline |
Definition at line 2613 of file Instructions.h.
Referenced by llvm::AssemblyWriter::printInstruction(), SwitchToLookupTable(), TryToSimplifyUncondBranchWithICmpInIt(), TurnSwitchRangeIntoICmp(), llvm::Interpreter::visitSwitchInst(), and WriteInstruction().
|
inline |
getNumCases - return the number of 'cases' in this switch instruction, except the default case
Definition at line 2623 of file Instructions.h.
Referenced by addCase(), EliminateDeadSwitchCases(), llvm::SwitchInst::CaseIteratorT< SwitchInst, ConstantInt, BasicBlock >::operator++(), llvm::SwitchInst::CaseIteratorT< SwitchInst, ConstantInt, BasicBlock >::operator--(), ShouldBuildLookupTable(), SimplifySwitchOnSelect(), SwitchToLookupTable(), TryToSimplifyUncondBranchWithICmpInIt(), and TurnSwitchRangeIntoICmp().
|
inline |
Definition at line 2706 of file Instructions.h.
Referenced by SwitchToLookupTable().
|
inline |
Definition at line 2707 of file Instructions.h.
Referenced by llvm::SwitchInst::CaseIteratorT< SwitchInst, ConstantInt, BasicBlock >::getCaseSuccessor(), and SwitchToLookupTable().
void SwitchInst::removeCase | ( | CaseIt | i | ) |
removeCase - This method removes the specified case and its successor from the switch instruction. Note that this operation may reorder the remaining cases at index idx and above. Note: This action invalidates iterators for all cases following the one removed, including the case_end() iterator.
removeCase - This method removes the specified case and its successor from the switch instruction.
Definition at line 3359 of file Instructions.cpp.
References llvm::SwitchInst::CaseIteratorT< SwitchInstTy, ConstantIntTy, BasicBlockTy >::getCaseIndex(), llvm::User::getNumOperands(), llvm::User::OperandList, and llvm::Use::set().
Referenced by EliminateDeadSwitchCases().
|
inline |
Definition at line 2611 of file Instructions.h.
Referenced by llvm::InstCombiner::visitSwitchInst().
|
inline |
Definition at line 2617 of file Instructions.h.
|
inline |
Definition at line 2711 of file Instructions.h.
Referenced by llvm::SwitchInst::CaseIt::setSuccessor().
Definition at line 2481 of file Instructions.h.