LLVM API Documentation

Public Member Functions | Static Public Member Functions | Protected Member Functions
llvm::BranchInst Class Reference

#include <Instructions.h>

Inheritance diagram for llvm::BranchInst:
Inheritance graph
[legend]
Collaboration diagram for llvm::BranchInst:
Collaboration graph
[legend]

List of all members.

Public Member Functions

 DECLARE_TRANSPARENT_OPERAND_ACCESSORS (Value)
 Transparently provide more efficient getOperand methods.
bool isUnconditional () const
bool isConditional () const
ValuegetCondition () const
void setCondition (Value *V)
unsigned getNumSuccessors () const
BasicBlockgetSuccessor (unsigned i) const
void setSuccessor (unsigned idx, BasicBlock *NewSucc)
void swapSuccessors ()
 Swap the successors of this branch instruction.

Static Public Member Functions

static BranchInstCreate (BasicBlock *IfTrue, Instruction *InsertBefore=nullptr)
static BranchInstCreate (BasicBlock *IfTrue, BasicBlock *IfFalse, Value *Cond, Instruction *InsertBefore=nullptr)
static BranchInstCreate (BasicBlock *IfTrue, BasicBlock *InsertAtEnd)
static BranchInstCreate (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

BranchInstclone_impl () const override

Detailed Description

BranchInst - Conditional or Unconditional Branch instruction.

Definition at line 2466 of file Instructions.h.


Member Function Documentation

static bool llvm::BranchInst::classof ( const Instruction I) [inline, static]

Reimplemented from llvm::TerminatorInst.

Definition at line 2541 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 2544 of file Instructions.h.

BranchInst * BranchInst::clone_impl ( ) const [override, protected, virtual]

Implements llvm::TerminatorInst.

Definition at line 3731 of file Instructions.cpp.

References llvm::User::getNumOperands().

static BranchInst* llvm::BranchInst::Create ( BasicBlock IfTrue,
Instruction InsertBefore = nullptr 
) [inline, static]
static BranchInst* llvm::BranchInst::Create ( BasicBlock IfTrue,
BasicBlock IfFalse,
Value Cond,
Instruction InsertBefore = nullptr 
) [inline, static]

Definition at line 2493 of file Instructions.h.

static BranchInst* llvm::BranchInst::Create ( BasicBlock IfTrue,
BasicBlock InsertAtEnd 
) [inline, static]

Definition at line 2497 of file Instructions.h.

static BranchInst* llvm::BranchInst::Create ( BasicBlock IfTrue,
BasicBlock IfFalse,
Value Cond,
BasicBlock InsertAtEnd 
) [inline, static]

Definition at line 2500 of file Instructions.h.

Transparently provide more efficient getOperand methods.

getNumSuccessors - Return the number of successors that this terminator has.

Reimplemented from llvm::TerminatorInst.

Definition at line 2521 of file Instructions.h.

void llvm::BranchInst::setCondition ( Value V) [inline]
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 2528 of file Instructions.h.

Referenced by llvm::FoldBranchToCommonDest(), SimplifyCondBranchToCondBranch(), and llvm::UnrollLoop().

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 std::swap().

Referenced by llvm::FoldBranchToCommonDest(), and llvm::InstCombiner::visitBranchInst().


The documentation for this class was generated from the following files: