LLVM API Documentation
#include <Instructions.h>


Classes | |
| class | CaseIt |
| class | CaseIteratorT |
Public Types | |
| typedef CaseIteratorT< const SwitchInst, const ConstantInt, SubsetsConstIt, const BasicBlock > | ConstCaseIt |
Public Member Functions | |
| ~SwitchInst () | |
| DECLARE_TRANSPARENT_OPERAND_ACCESSORS (Value) | |
| Provide fast operand accessors. | |
| 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 | addCase (IntegersSubset &OnVal, BasicBlock *Dest) |
| void | removeCase (CaseIt &i) |
| unsigned | getNumSuccessors () const |
| BasicBlock * | getSuccessor (unsigned idx) const |
| void | setSuccessor (unsigned idx, BasicBlock *NewSucc) |
| uint16_t | hash () const |
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) |
| Methods for support type inquiry through isa, cast, and dyn_cast: | |
Static Public Attributes | |
| static const unsigned | DefaultPseudoIndex = static_cast<unsigned>(~0L-1) |
Protected Member Functions | |
| virtual SwitchInst * | clone_impl () const |
SwitchInst - Multiway switch
Definition at line 2443 of file Instructions.h.
| typedef CaseIteratorT<const SwitchInst, const ConstantInt, SubsetsConstIt, const BasicBlock> llvm::SwitchInst::ConstCaseIt |
Definition at line 2505 of file Instructions.h.
| SwitchInst::~SwitchInst | ( | ) |
Definition at line 3187 of file Instructions.cpp.
References llvm::User::dropHungoffUses().
| void SwitchInst::addCase | ( | ConstantInt * | OnVal, |
| BasicBlock * | Dest | ||
| ) |
addCase - Add an entry to the switch instruction...
addCase - Add an entry to the switch instruction...
Definition at line 3194 of file Instructions.cpp.
References llvm::IntegersSubsetMapping< SuccessorClass, IntegersSubsetTy, IntTy >::add(), llvm::IntItem::fromConstantInt(), and llvm::IntegersSubsetMapping< SuccessorClass, IntegersSubsetTy, IntTy >::getCase().
Referenced by SimplifyBranchOnICmpChain(), and TryToSimplifyUncondBranchWithICmpInIt().
| void SwitchInst::addCase | ( | IntegersSubset & | 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.
Definition at line 3204 of file Instructions.cpp.
References getNumCases(), llvm::User::NumOperands, llvm::SwitchInst::CaseIt::setSuccessor(), and llvm::SwitchInst::CaseIt::updateCaseValueOperand().
| CaseIt llvm::SwitchInst::case_begin | ( | ) | [inline] |
Returns a read/write iterator that points to the first case in SwitchInst.
Definition at line 2548 of file Instructions.h.
Referenced by EliminateDeadSwitchCases(), ForwardSwitchConditionToPHI(), llvm::AssemblyWriter::printInstruction(), SwitchToLookupTable(), TurnSwitchRangeIntoICmp(), llvm::Interpreter::visitSwitchInst(), llvm::InstCombiner::visitSwitchInst(), and WriteInstruction().
| ConstCaseIt llvm::SwitchInst::case_begin | ( | ) | const [inline] |
Returns a read-only iterator that points to the first case in the SwitchInst.
Definition at line 2553 of file Instructions.h.
| CaseIt llvm::SwitchInst::case_default | ( | ) | [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 2572 of file Instructions.h.
Referenced by EliminateDeadSwitchCases(), and TryToSimplifyUncondBranchWithICmpInIt().
| ConstCaseIt llvm::SwitchInst::case_default | ( | ) | const [inline] |
Definition at line 2575 of file Instructions.h.
| CaseIt llvm::SwitchInst::case_end | ( | ) | [inline] |
Returns a read/write iterator that points one past the last in the SwitchInst.
Definition at line 2559 of file Instructions.h.
Referenced by EliminateDeadSwitchCases(), ForwardSwitchConditionToPHI(), llvm::AssemblyWriter::printInstruction(), SwitchToLookupTable(), TurnSwitchRangeIntoICmp(), llvm::Interpreter::visitSwitchInst(), llvm::InstCombiner::visitSwitchInst(), and WriteInstruction().
| ConstCaseIt llvm::SwitchInst::case_end | ( | ) | const [inline] |
Returns a read-only iterator that points one past the last in the SwitchInst.
Definition at line 2564 of file Instructions.h.
| static bool llvm::SwitchInst::classof | ( | const Instruction * | I | ) | [inline, static] |
Reimplemented from llvm::TerminatorInst.
Definition at line 2828 of file Instructions.h.
References llvm::Instruction::getOpcode().
Methods for support type inquiry through isa, cast, and dyn_cast:
Reimplemented from llvm::TerminatorInst.
Definition at line 2831 of file Instructions.h.
| SwitchInst * SwitchInst::clone_impl | ( | ) | const [protected, virtual] |
Implements llvm::TerminatorInst.
Definition at line 3533 of file Instructions.cpp.
| static SwitchInst* llvm::SwitchInst::Create | ( | Value * | Value, |
| BasicBlock * | Default, | ||
| unsigned | NumCases, | ||
| Instruction * | InsertBefore = 0 |
||
| ) | [inline, static] |
Definition at line 2514 of file Instructions.h.
Referenced by llvm::IRBuilder< true, TargetFolder >::CreateSwitch().
| static SwitchInst* llvm::SwitchInst::Create | ( | Value * | Value, |
| BasicBlock * | Default, | ||
| unsigned | NumCases, | ||
| BasicBlock * | InsertAtEnd | ||
| ) | [inline, static] |
Definition at line 2518 of file Instructions.h.
| llvm::SwitchInst::DECLARE_TRANSPARENT_OPERAND_ACCESSORS | ( | Value | ) |
Provide fast operand accessors.
| ConstantInt* llvm::SwitchInst::findCaseDest | ( | BasicBlock * | BB | ) | [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 2598 of file Instructions.h.
Referenced by TryToSimplifyUncondBranchWithICmpInIt().
| CaseIt llvm::SwitchInst::findCaseValue | ( | const ConstantInt * | C | ) | [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 2583 of file Instructions.h.
References llvm::IntItem::fromConstantInt().
Referenced by EliminateDeadSwitchCases(), SimplifySwitchOnSelect(), and TryToSimplifyUncondBranchWithICmpInIt().
| ConstCaseIt llvm::SwitchInst::findCaseValue | ( | const ConstantInt * | C | ) | const [inline] |
Definition at line 2589 of file Instructions.h.
References llvm::IntItem::fromConstantInt().
| Value* llvm::SwitchInst::getCondition | ( | ) | const [inline] |
Definition at line 2529 of file Instructions.h.
Referenced by EliminateDeadSwitchCases(), ForwardSwitchConditionToPHI(), GetCaseResults(), llvm::AssemblyWriter::printInstruction(), SwitchToLookupTable(), TryToSimplifyUncondBranchWithICmpInIt(), TurnSwitchRangeIntoICmp(), llvm::Interpreter::visitSwitchInst(), llvm::InstCombiner::visitSwitchInst(), and WriteInstruction().
| BasicBlock* llvm::SwitchInst::getDefaultDest | ( | ) | const [inline] |
Definition at line 2532 of file Instructions.h.
Referenced by llvm::AssemblyWriter::printInstruction(), SwitchToLookupTable(), TryToSimplifyUncondBranchWithICmpInIt(), TurnSwitchRangeIntoICmp(), llvm::Interpreter::visitSwitchInst(), and WriteInstruction().
| unsigned llvm::SwitchInst::getNumCases | ( | ) | const [inline] |
getNumCases - return the number of 'cases' in this switch instruction, except the default case
Definition at line 2542 of file Instructions.h.
Referenced by addCase(), EliminateDeadSwitchCases(), llvm::SwitchInst::CaseIteratorT< SwitchInst, ConstantInt, SubsetsIt, BasicBlock >::operator++(), llvm::SwitchInst::CaseIteratorT< SwitchInst, ConstantInt, SubsetsIt, BasicBlock >::operator--(), ShouldBuildLookupTable(), SimplifySwitchOnSelect(), SwitchToLookupTable(), TryToSimplifyUncondBranchWithICmpInIt(), TurnSwitchRangeIntoICmp(), and WriteInstruction().
| unsigned llvm::SwitchInst::getNumSuccessors | ( | ) | const [inline] |
getNumSuccessors - Return the number of successors that this terminator has.
Reimplemented from llvm::TerminatorInst.
Definition at line 2632 of file Instructions.h.
Referenced by SwitchToLookupTable().
| BasicBlock* llvm::SwitchInst::getSuccessor | ( | unsigned | idx | ) | const [inline] |
getSuccessor - Return the specified successor.
Reimplemented from llvm::TerminatorInst.
Definition at line 2633 of file Instructions.h.
Referenced by llvm::SwitchInst::CaseIteratorT< SwitchInst, ConstantInt, SubsetsIt, BasicBlock >::getCaseSuccessor(), and SwitchToLookupTable().
| uint16_t llvm::SwitchInst::hash | ( | ) | const [inline] |
Definition at line 2642 of file Instructions.h.
Referenced by WriteInstruction().
| 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 3222 of file Instructions.cpp.
References llvm::SwitchInst::CaseIteratorT< SwitchInstTy, ConstantIntTy, SubsetsItTy, BasicBlockTy >::getCaseIndex(), llvm::User::getNumOperands(), llvm::User::OperandList, llvm::Use::set(), and llvm::SwitchInst::CaseIteratorT< SwitchInstTy, ConstantIntTy, SubsetsItTy, BasicBlockTy >::SubsetIt.
Referenced by EliminateDeadSwitchCases().
| void llvm::SwitchInst::setCondition | ( | Value * | V | ) | [inline] |
Definition at line 2530 of file Instructions.h.
Referenced by llvm::InstCombiner::visitSwitchInst().
| void llvm::SwitchInst::setDefaultDest | ( | BasicBlock * | DefaultCase | ) | [inline] |
Definition at line 2536 of file Instructions.h.
| void llvm::SwitchInst::setSuccessor | ( | unsigned | idx, |
| BasicBlock * | B | ||
| ) | [inline] |
setSuccessor - Update the specified successor to point at the provided block.
Reimplemented from llvm::TerminatorInst.
Definition at line 2637 of file Instructions.h.
Referenced by llvm::SwitchInst::CaseIt::setSuccessor().
const unsigned llvm::SwitchInst::DefaultPseudoIndex = static_cast<unsigned>(~0L-1) [static] |
Definition at line 2512 of file Instructions.h.