LLVM API Documentation
#include <Instructions.h>
SwitchInst - Multiway switch
Definition at line 2564 of file Instructions.h.
typedef CaseIteratorT<const SwitchInst, const ConstantInt, const BasicBlock> llvm::SwitchInst::ConstCaseIt |
Definition at line 2690 of file Instructions.h.
Definition at line 3439 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 3446 of file Instructions.cpp.
References getNumCases(), llvm::User::NumOperands, llvm::SwitchInst::CaseIt::setSuccessor(), and llvm::SwitchInst::CaseIt::setValue().
Referenced by SimplifyBranchOnICmpChain(), and TryToSimplifyUncondBranchWithICmpInIt().
CaseIt llvm::SwitchInst::case_begin | ( | ) | [inline] |
Returns a read/write iterator that points to the first case in SwitchInst.
Definition at line 2748 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 2753 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 2783 of file Instructions.h.
Referenced by EliminateDeadSwitchCases(), and TryToSimplifyUncondBranchWithICmpInIt().
ConstCaseIt llvm::SwitchInst::case_default | ( | ) | const [inline] |
Definition at line 2786 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 2759 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 2764 of file Instructions.h.
iterator_range<CaseIt> llvm::SwitchInst::cases | ( | ) | [inline] |
cases - iteration adapter for range-for loops.
Definition at line 2769 of file Instructions.h.
iterator_range<ConstCaseIt> llvm::SwitchInst::cases | ( | ) | const [inline] |
cases - iteration adapter for range-for loops.
Definition at line 2774 of file Instructions.h.
static bool llvm::SwitchInst::classof | ( | const Instruction * | I | ) | [inline, static] |
Reimplemented from llvm::TerminatorInst.
Definition at line 2847 of file Instructions.h.
References llvm::Instruction::getOpcode().
static bool llvm::SwitchInst::classof | ( | const Value * | V | ) | [inline, static] |
Methods for support type inquiry through isa, cast, and dyn_cast:
Reimplemented from llvm::TerminatorInst.
Definition at line 2850 of file Instructions.h.
SwitchInst * SwitchInst::clone_impl | ( | ) | const [override, protected, virtual] |
Implements llvm::TerminatorInst.
Definition at line 3769 of file Instructions.cpp.
static SwitchInst* llvm::SwitchInst::Create | ( | Value * | Value, |
BasicBlock * | Default, | ||
unsigned | NumCases, | ||
Instruction * | InsertBefore = nullptr |
||
) | [inline, static] |
Definition at line 2713 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 2718 of file Instructions.h.
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 2809 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 2794 of file Instructions.h.
References llvm::CallingConv::C.
Referenced by EliminateDeadSwitchCases(), SimplifySwitchOnSelect(), and TryToSimplifyUncondBranchWithICmpInIt().
ConstCaseIt llvm::SwitchInst::findCaseValue | ( | const ConstantInt * | C | ) | const [inline] |
Definition at line 2800 of file Instructions.h.
References llvm::CallingConv::C.
Value* llvm::SwitchInst::getCondition | ( | ) | const [inline] |
Definition at line 2729 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 2732 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 2742 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().
unsigned llvm::SwitchInst::getNumSuccessors | ( | ) | const [inline] |
Return the number of successors that this terminator has.
Reimplemented from llvm::TerminatorInst.
Definition at line 2836 of file Instructions.h.
Referenced by SwitchToLookupTable().
BasicBlock* llvm::SwitchInst::getSuccessor | ( | unsigned | idx | ) | const [inline] |
Return the specified successor.
Reimplemented from llvm::TerminatorInst.
Definition at line 2837 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 3461 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().
void llvm::SwitchInst::setCondition | ( | Value * | V | ) | [inline] |
Definition at line 2730 of file Instructions.h.
Referenced by llvm::InstCombiner::visitSwitchInst().
void llvm::SwitchInst::setDefaultDest | ( | BasicBlock * | DefaultCase | ) | [inline] |
Definition at line 2736 of file Instructions.h.
void llvm::SwitchInst::setSuccessor | ( | unsigned | idx, |
BasicBlock * | B | ||
) | [inline] |
Update the specified successor to point at the provided block.
Reimplemented from llvm::TerminatorInst.
Definition at line 2841 of file Instructions.h.
Referenced by llvm::SwitchInst::CaseIt::setSuccessor().
const unsigned llvm::SwitchInst::DefaultPseudoIndex = static_cast<unsigned>(~0L-1) [static] |
Definition at line 2596 of file Instructions.h.