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

virtual BranchInstclone_impl () const

Detailed Description

BranchInst - Conditional or Unconditional Branch instruction.

Definition at line 2344 of file Instructions.h.


Member Function Documentation

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().

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 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]
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]
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]
bool llvm::BranchInst::isConditional ( ) const [inline]
bool llvm::BranchInst::isUnconditional ( ) const [inline]
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 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().


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