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 |
| BasicBlock * | getSuccessor (unsigned i) const |
| void | setSuccessor (unsigned idx, BasicBlock *NewSucc) |
| void | swapSuccessors () |
| Swap the successors of this branch instruction. | |
Static Public Member Functions | |
| static BranchInst * | Create (BasicBlock *IfTrue, Instruction *InsertBefore=0) |
| static BranchInst * | Create (BasicBlock *IfTrue, BasicBlock *IfFalse, Value *Cond, Instruction *InsertBefore=0) |
| 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 | |
| virtual BranchInst * | clone_impl () const |
BranchInst - Conditional or Unconditional Branch instruction.
Definition at line 2344 of file Instructions.h.
| static bool llvm::BranchInst::classof | ( | const Instruction * | I | ) | [inline, static] |
Reimplemented from llvm::TerminatorInst.
Definition at line 2418 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 2421 of file Instructions.h.
| BranchInst * BranchInst::clone_impl | ( | ) | const [protected, virtual] |
Implements llvm::TerminatorInst.
Definition at line 3529 of file Instructions.cpp.
References llvm::User::getNumOperands().
| static BranchInst* llvm::BranchInst::Create | ( | BasicBlock * | IfTrue, |
| Instruction * | InsertBefore = 0 |
||
| ) | [inline, static] |
Definition at line 2367 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(), markAliveBlocks(), mergeEmptyReturnBlocks(), PerformHeapAllocSRoA(), llvm::UnifyFunctionExitNodes::runOnFunction(), SimplifyCondBranchToCondBranch(), llvm::SplitBlockAndInsertIfThen(), llvm::SplitBlockPredecessors(), llvm::SplitCriticalEdge(), llvm::SplitLandingPadPredecessors(), llvm::UnrollLoop(), and llvm::UnrollRuntimeLoopProlog().
| static BranchInst* llvm::BranchInst::Create | ( | BasicBlock * | IfTrue, |
| BasicBlock * | IfFalse, | ||
| Value * | Cond, | ||
| Instruction * | InsertBefore = 0 |
||
| ) | [inline, static] |
Definition at line 2370 of file Instructions.h.
| static BranchInst* llvm::BranchInst::Create | ( | BasicBlock * | IfTrue, |
| BasicBlock * | InsertAtEnd | ||
| ) | [inline, static] |
Definition at line 2374 of file Instructions.h.
| static BranchInst* llvm::BranchInst::Create | ( | BasicBlock * | IfTrue, |
| BasicBlock * | IfFalse, | ||
| Value * | Cond, | ||
| BasicBlock * | InsertAtEnd | ||
| ) | [inline, static] |
Definition at line 2377 of file Instructions.h.
| llvm::BranchInst::DECLARE_TRANSPARENT_OPERAND_ACCESSORS | ( | Value | ) |
Transparently provide more efficient getOperand methods.
| Value* llvm::BranchInst::getCondition | ( | ) | const [inline] |
Definition at line 2388 of file Instructions.h.
Referenced by AddReachableCodeToWorklist(), llvm::FoldBranchToCommonDest(), FoldCondBranchOnPHI(), GetBranchWeights(), GetIfCondition(), getLoopTest(), HoistThenElseCodeToIf(), isHighCostExpansion(), llvm::ScalarEvolution::isLoopBackedgeGuardedByCond(), llvm::ScalarEvolution::isLoopEntryGuardedByCond(), isProfitableToFoldUnconditional(), llvm::AssemblyWriter::printInstruction(), SimplifyBranchOnICmpChain(), SimplifyCondBranchToCondBranch(), SimplifyCondBranchToTwoReturns(), SpeculativelyExecuteBB(), llvm::Interpreter::visitBranchInst(), llvm::InstCombiner::visitBranchInst(), and WriteInstruction().
| unsigned llvm::BranchInst::getNumSuccessors | ( | ) | const [inline] |
getNumSuccessors - Return the number of successors that this terminator has.
Reimplemented from llvm::TerminatorInst.
Definition at line 2398 of file Instructions.h.
| BasicBlock* llvm::BranchInst::getSuccessor | ( | unsigned | idx | ) | const [inline] |
getSuccessor - Return the specified successor.
Reimplemented from llvm::TerminatorInst.
Definition at line 2400 of file Instructions.h.
Referenced by AddReachableCodeToWorklist(), llvm::CloneAndPruneFunctionInto(), DominatesMergePoint(), FindPHIForConditionForwarding(), llvm::FoldBranchToCommonDest(), FoldCondBranchOnPHI(), GetIfCondition(), HoistThenElseCodeToIf(), llvm::ScalarEvolution::isLoopBackedgeGuardedByCond(), llvm::ScalarEvolution::isLoopEntryGuardedByCond(), llvm::AssemblyWriter::printInstruction(), removeUndefIntroducingPredecessor(), llvm::FastISel::SelectOperator(), SimplifyBranchOnICmpChain(), SimplifyCondBranchToCondBranch(), SimplifyCondBranchToTwoReturns(), SinkThenElseCodeToEnd(), SpeculativelyExecuteBB(), llvm::UnrollLoop(), llvm::Interpreter::visitBranchInst(), and WriteInstruction().
| bool llvm::BranchInst::isConditional | ( | ) | const [inline] |
Definition at line 2386 of file Instructions.h.
Referenced by AddReachableCodeToWorklist(), llvm::CloneAndPruneFunctionInto(), DominatesMergePoint(), ExtractBranchMetadata(), llvm::FoldBranchToCommonDest(), GetIfCondition(), isProfitableToFoldUnconditional(), SimplifyCondBranchToCondBranch(), SimplifyCondBranchToTwoReturns(), swapSuccessors(), and WriteInstruction().
| bool llvm::BranchInst::isUnconditional | ( | ) | const [inline] |
Definition at line 2385 of file Instructions.h.
Referenced by FindPHIForConditionForwarding(), llvm::FoldBranchToCommonDest(), llvm::ScalarEvolution::isLoopBackedgeGuardedByCond(), 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 2393 of file Instructions.h.
Referenced by llvm::FoldBranchToCommonDest(), SimplifyCondBranchToCondBranch(), and llvm::InstCombiner::visitBranchInst().
| void llvm::BranchInst::setSuccessor | ( | unsigned | idx, |
| BasicBlock * | B | ||
| ) | [inline] |
setSuccessor - Update the specified successor to point at the provided block.
Reimplemented from llvm::TerminatorInst.
Definition at line 2405 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 786 of file Instructions.cpp.
References llvm::MDNode::get(), llvm::Instruction::getMetadata(), isConditional(), llvm::LLVMContext::MD_prof, llvm::User::Op(), llvm::Instruction::setMetadata(), and llvm::swap().
Referenced by llvm::FoldBranchToCommonDest(), and llvm::InstCombiner::visitBranchInst().