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
 Return the number of successors that this terminator has.
BasicBlockgetSuccessor (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 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 2464 of file Instructions.h.


Member Function Documentation

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::Instruction.

Definition at line 3765 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 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.

Return the number of successors that this terminator has.

Reimplemented from llvm::TerminatorInst.

Definition at line 2519 of file Instructions.h.

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

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


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