LLVM API Documentation
#include <Instructions.h>
Public Member Functions | |
DECLARE_TRANSPARENT_OPERAND_ACCESSORS (Value) | |
Transparently provide more efficient getOperand methods. | |
bool | isUnconditional () const |
bool | isConditional () const |
Value * | getCondition () const |
void | setCondition (Value *V) |
unsigned | getNumSuccessors () const |
Return the number of successors that this terminator has. | |
BasicBlock * | getSuccessor (unsigned i) const |
Return the specified successor. | |
void | setSuccessor (unsigned idx, BasicBlock *NewSucc) |
Update the specified successor to point at the provided block. | |
void | swapSuccessors () |
Swap the successors of this branch instruction. | |
Static Public Member Functions | |
static BranchInst * | Create (BasicBlock *IfTrue, Instruction *InsertBefore=nullptr) |
static BranchInst * | Create (BasicBlock *IfTrue, BasicBlock *IfFalse, Value *Cond, Instruction *InsertBefore=nullptr) |
static BranchInst * | Create (BasicBlock *IfTrue, BasicBlock *InsertAtEnd) |
static BranchInst * | Create (BasicBlock *IfTrue, BasicBlock *IfFalse, Value *Cond, 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: | |
Protected Member Functions | |
BranchInst * | clone_impl () const override |
BranchInst - Conditional or Unconditional Branch instruction.
Definition at line 2464 of file Instructions.h.
static bool llvm::BranchInst::classof | ( | const Instruction * | I | ) | [inline, static] |
Reimplemented from llvm::TerminatorInst.
Definition at line 2539 of file Instructions.h.
References llvm::Instruction::getOpcode().
static bool llvm::BranchInst::classof | ( | const Value * | V | ) | [inline, static] |
Methods for support type inquiry through isa, cast, and dyn_cast:
Reimplemented from llvm::TerminatorInst.
Definition at line 2542 of file Instructions.h.
BranchInst * BranchInst::clone_impl | ( | ) | const [override, protected, virtual] |
Implements llvm::TerminatorInst.
Definition at line 3765 of file Instructions.cpp.
References llvm::User::getNumOperands().
static BranchInst* llvm::BranchInst::Create | ( | BasicBlock * | IfTrue, |
Instruction * | InsertBefore = nullptr |
||
) | [inline, static] |
Definition at line 2487 of file Instructions.h.
Referenced by changeToCall(), CloneLoopBlocks(), ConnectProlog(), llvm::IRBuilder< true, TargetFolder >::CreateBr(), llvm::IRBuilder< true, TargetFolder >::CreateCondBr(), llvm::CodeExtractor::extractCodeRegion(), llvm::FoldBranchToCommonDest(), FoldCondBranchOnPHI(), llvm::InlineFunction(), insertUniqueBackedgeBlock(), markAliveBlocks(), mergeEmptyReturnBlocks(), PerformHeapAllocSRoA(), llvm::UnifyFunctionExitNodes::runOnFunction(), SimplifyCondBranchToCondBranch(), llvm::SplitBlockAndInsertIfThen(), llvm::SplitBlockAndInsertIfThenElse(), llvm::SplitBlockPredecessors(), llvm::SplitCriticalEdge(), llvm::SplitLandingPadPredecessors(), llvm::UnrollLoop(), and llvm::UnrollRuntimeLoopProlog().
static BranchInst* llvm::BranchInst::Create | ( | BasicBlock * | IfTrue, |
BasicBlock * | IfFalse, | ||
Value * | Cond, | ||
Instruction * | InsertBefore = nullptr |
||
) | [inline, static] |
Definition at line 2491 of file Instructions.h.
static BranchInst* llvm::BranchInst::Create | ( | BasicBlock * | IfTrue, |
BasicBlock * | InsertAtEnd | ||
) | [inline, static] |
Definition at line 2495 of file Instructions.h.
static BranchInst* llvm::BranchInst::Create | ( | BasicBlock * | IfTrue, |
BasicBlock * | IfFalse, | ||
Value * | Cond, | ||
BasicBlock * | InsertAtEnd | ||
) | [inline, static] |
Definition at line 2498 of file Instructions.h.
Transparently provide more efficient getOperand methods.
Value* llvm::BranchInst::getCondition | ( | ) | const [inline] |
Definition at line 2509 of file Instructions.h.
Referenced by AddReachableCodeToWorklist(), llvm::FoldBranchToCommonDest(), FoldCondBranchOnPHI(), GetBranchWeights(), llvm::GetIfCondition(), getLoopTest(), HoistThenElseCodeToIf(), isHighCostExpansion(), llvm::ScalarEvolution::isLoopBackedgeGuardedByCond(), llvm::ScalarEvolution::isLoopEntryGuardedByCond(), isProfitableToFoldUnconditional(), llvm::AssemblyWriter::printInstruction(), SimplifyBranchOnICmpChain(), SimplifyCondBranchToCondBranch(), SimplifyCondBranchToTwoReturns(), simplifyOneLoop(), SpeculativelyExecuteBB(), llvm::Interpreter::visitBranchInst(), llvm::InstCombiner::visitBranchInst(), and WriteInstruction().
unsigned llvm::BranchInst::getNumSuccessors | ( | ) | const [inline] |
Return the number of successors that this terminator has.
Reimplemented from llvm::TerminatorInst.
Definition at line 2519 of file Instructions.h.
BasicBlock* llvm::BranchInst::getSuccessor | ( | unsigned | idx | ) | const [inline] |
Return the specified successor.
Reimplemented from llvm::TerminatorInst.
Definition at line 2521 of file Instructions.h.
Referenced by AddReachableCodeToWorklist(), llvm::CloneAndPruneFunctionInto(), DominatesMergePoint(), FindPHIForConditionForwarding(), llvm::FoldBranchToCommonDest(), FoldCondBranchOnPHI(), llvm::GetIfCondition(), HoistThenElseCodeToIf(), llvm::ScalarEvolution::isLoopBackedgeGuardedByCond(), llvm::ScalarEvolution::isLoopEntryGuardedByCond(), llvm::AssemblyWriter::printInstruction(), removeUndefIntroducingPredecessor(), llvm::FastISel::selectOperator(), SimplifyBranchOnICmpChain(), SimplifyCondBranchToCondBranch(), SimplifyCondBranchToTwoReturns(), simplifyOneLoop(), SinkThenElseCodeToEnd(), SpeculativelyExecuteBB(), llvm::UnrollLoop(), llvm::Interpreter::visitBranchInst(), and WriteInstruction().
bool llvm::BranchInst::isConditional | ( | ) | const [inline] |
Definition at line 2507 of file Instructions.h.
Referenced by AddReachableCodeToWorklist(), llvm::CloneAndPruneFunctionInto(), DominatesMergePoint(), ExtractBranchMetadata(), llvm::FoldBranchToCommonDest(), llvm::GetIfCondition(), llvm::ScalarEvolution::isLoopBackedgeGuardedByCond(), isProfitableToFoldUnconditional(), SimplifyCondBranchToCondBranch(), SimplifyCondBranchToTwoReturns(), simplifyOneLoop(), swapSuccessors(), and WriteInstruction().
bool llvm::BranchInst::isUnconditional | ( | ) | const [inline] |
Definition at line 2506 of file Instructions.h.
Referenced by FindPHIForConditionForwarding(), llvm::FoldBranchToCommonDest(), llvm::ScalarEvolution::isLoopEntryGuardedByCond(), isProfitableToFoldUnconditional(), removeUndefIntroducingPredecessor(), llvm::FastISel::selectOperator(), SinkThenElseCodeToEnd(), llvm::UnrollLoop(), and llvm::Interpreter::visitBranchInst().
void llvm::BranchInst::setCondition | ( | Value * | V | ) | [inline] |
Definition at line 2514 of file Instructions.h.
Referenced by llvm::FoldBranchToCommonDest(), SimplifyCondBranchToCondBranch(), and llvm::InstCombiner::visitBranchInst().
void llvm::BranchInst::setSuccessor | ( | unsigned | idx, |
BasicBlock * | B | ||
) | [inline] |
Update the specified successor to point at the provided block.
Reimplemented from llvm::TerminatorInst.
Definition at line 2526 of file Instructions.h.
Referenced by llvm::FoldBranchToCommonDest(), SimplifyCondBranchToCondBranch(), and llvm::UnrollLoop().
void BranchInst::swapSuccessors | ( | ) |
Swap the successors of this branch instruction.
Swaps the successors of the branch instruction. This also swaps any branch weight metadata associated with the instruction so that it continues to map correctly to each operand.
Definition at line 787 of file Instructions.cpp.
References llvm::MDNode::get(), llvm::Instruction::getMetadata(), isConditional(), llvm::LLVMContext::MD_prof, llvm::User::Op(), llvm::Instruction::setMetadata(), and std::swap().
Referenced by llvm::FoldBranchToCommonDest(), and llvm::InstCombiner::visitBranchInst().