class BranchInst

Declaration

class BranchInst : public Instruction { /* full declaration omitted */ };

Description

Conditional or Unconditional Branch instruction.

Declared at: llvm/include/llvm/IR/Instructions.h:3099

Inherits from: Instruction

Member Variables

Inherited from Value:

protected SubclassOptionalData
protected NumUserOperands
protected IsUsedByMD
protected HasName
protected HasMetadata
protected HasHungOffUses
protected HasDescriptor
public static MaxAlignmentExponent = 32
public static MaximumAlignment = 1ULL << MaxAlignmentExponent

Method Overview

  • private void AssertOK()
  • private BranchInst(llvm::BasicBlock * IfTrue, llvm::Instruction * InsertBefore = nullptr)
  • private BranchInst(llvm::BasicBlock * IfTrue, llvm::BasicBlock * IfFalse, llvm::Value * Cond, llvm::Instruction * InsertBefore = nullptr)
  • private BranchInst(llvm::BasicBlock * IfTrue, llvm::BasicBlock * InsertAtEnd)
  • private BranchInst(llvm::BasicBlock * IfTrue, llvm::BasicBlock * IfFalse, llvm::Value * Cond, llvm::BasicBlock * InsertAtEnd)
  • private BranchInst(const llvm::BranchInst & BI)
  • public static llvm::BranchInst * Create(llvm::BasicBlock * IfTrue, llvm::Instruction * InsertBefore = nullptr)
  • public static llvm::BranchInst * Create(llvm::BasicBlock * IfTrue, llvm::BasicBlock * IfFalse, llvm::Value * Cond, llvm::Instruction * InsertBefore = nullptr)
  • public static llvm::BranchInst * Create(llvm::BasicBlock * IfTrue, llvm::BasicBlock * InsertAtEnd)
  • public static llvm::BranchInst * Create(llvm::BasicBlock * IfTrue, llvm::BasicBlock * IfFalse, llvm::Value * Cond, llvm::BasicBlock * InsertAtEnd)
  • public static bool classof(const llvm::Value * V)
  • public static bool classof(const llvm::Instruction * I)
  • protected llvm::BranchInst * cloneImpl() const
  • public llvm::Value * getCondition() const
  • public unsigned int getNumSuccessors() const
  • public llvm::BasicBlock * getSuccessor(unsigned int i) const
  • public bool isConditional() const
  • public bool isUnconditional() const
  • public void setCondition(llvm::Value * V)
  • public void setSuccessor(unsigned int idx, llvm::BasicBlock * NewSucc)
  • public iterator_range<llvm::BranchInst::succ_op_iterator> successors()
  • public iterator_range<llvm::BranchInst::const_succ_op_iterator> successors() const
  • public void swapSuccessors()

Inherited from Instruction:

Inherited from User:

Inherited from Value:

Methods

void AssertOK()

Declared at: llvm/include/llvm/IR/Instructions.h:3119

BranchInst(
    llvm::BasicBlock* IfTrue,
    llvm::Instruction* InsertBefore = nullptr)

Declared at: llvm/include/llvm/IR/Instructions.h:3112

Parameters

llvm::BasicBlock* IfTrue
llvm::Instruction* InsertBefore = nullptr

BranchInst(
    llvm::BasicBlock* IfTrue,
    llvm::BasicBlock* IfFalse,
    llvm::Value* Cond,
    llvm::Instruction* InsertBefore = nullptr)

Declared at: llvm/include/llvm/IR/Instructions.h:3113

Parameters

llvm::BasicBlock* IfTrue
llvm::BasicBlock* IfFalse
llvm::Value* Cond
llvm::Instruction* InsertBefore = nullptr

BranchInst(llvm::BasicBlock* IfTrue,
           llvm::BasicBlock* InsertAtEnd)

Declared at: llvm/include/llvm/IR/Instructions.h:3115

Parameters

llvm::BasicBlock* IfTrue
llvm::BasicBlock* InsertAtEnd

BranchInst(llvm::BasicBlock* IfTrue,
           llvm::BasicBlock* IfFalse,
           llvm::Value* Cond,
           llvm::BasicBlock* InsertAtEnd)

Declared at: llvm/include/llvm/IR/Instructions.h:3116

Parameters

llvm::BasicBlock* IfTrue
llvm::BasicBlock* IfFalse
llvm::Value* Cond
llvm::BasicBlock* InsertAtEnd

BranchInst(const llvm::BranchInst& BI)

Description

Ops list - Branches are strange. The operands are ordered: [Cond, FalseDest,] TrueDest. This makes some accessors faster because they don't have to check for cond/uncond branchness. These are mostly accessed relative from op_end().

Declared at: llvm/include/llvm/IR/Instructions.h:3104

Parameters

const llvm::BranchInst& BI

static llvm::BranchInst* Create(
    llvm::BasicBlock* IfTrue,
    llvm::Instruction* InsertBefore = nullptr)

Declared at: llvm/include/llvm/IR/Instructions.h:3155

Parameters

llvm::BasicBlock* IfTrue
llvm::Instruction* InsertBefore = nullptr

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

Declared at: llvm/include/llvm/IR/Instructions.h:3160

Parameters

llvm::BasicBlock* IfTrue
llvm::BasicBlock* IfFalse
llvm::Value* Cond
llvm::Instruction* InsertBefore = nullptr

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

Declared at: llvm/include/llvm/IR/Instructions.h:3165

Parameters

llvm::BasicBlock* IfTrue
llvm::BasicBlock* InsertAtEnd

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

Declared at: llvm/include/llvm/IR/Instructions.h:3169

Parameters

llvm::BasicBlock* IfTrue
llvm::BasicBlock* IfFalse
llvm::Value* Cond
llvm::BasicBlock* InsertAtEnd

static bool classof(const llvm::Value* V)

Declared at: llvm/include/llvm/IR/Instructions.h:3225

Parameters

const llvm::Value* V

static bool classof(const llvm::Instruction* I)

Declared at: llvm/include/llvm/IR/Instructions.h:3222

Parameters

const llvm::Instruction* I

llvm::BranchInst* cloneImpl() const

Declared at: llvm/include/llvm/IR/Instructions.h:3125

llvm::Value* getCondition() const

Declared at: llvm/include/llvm/IR/Instructions.h:3180

unsigned int getNumSuccessors() const

Declared at: llvm/include/llvm/IR/Instructions.h:3190

llvm::BasicBlock* getSuccessor(
    unsigned int i) const

Declared at: llvm/include/llvm/IR/Instructions.h:3192

Parameters

unsigned int i

bool isConditional() const

Declared at: llvm/include/llvm/IR/Instructions.h:3178

bool isUnconditional() const

Declared at: llvm/include/llvm/IR/Instructions.h:3177

void setCondition(llvm::Value* V)

Declared at: llvm/include/llvm/IR/Instructions.h:3185

Parameters

llvm::Value* V

void setSuccessor(unsigned int idx,
                  llvm::BasicBlock* NewSucc)

Declared at: llvm/include/llvm/IR/Instructions.h:3197

Parameters

unsigned int idx
llvm::BasicBlock* NewSucc

iterator_range<llvm::BranchInst::succ_op_iterator>
successors()

Declared at: llvm/include/llvm/IR/Instructions.h:3209

iterator_range<
    llvm::BranchInst::const_succ_op_iterator>
successors() const

Declared at: llvm/include/llvm/IR/Instructions.h:3215

void swapSuccessors()

Description

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.

Declared at: llvm/include/llvm/IR/Instructions.h:3207