class PHINode

Declaration

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

Description

LLVM Value Representation This is a very important LLVM class. It is the base class of all values computed by a program that may be used as operands to other values. Value is the super class of other important classes such as Instruction and Function. All Values have a Type. Type is not a subclass of Value. Some values can have a name and they belong to some Module. Setting the name on the Value automatically updates the module's symbol table. Every value has a "use list" that keeps track of which other Values are using this Value. A Value can also have an arbitrary number of ValueHandle objects that watch it and listen to RAUW and Destroy events. See llvm/IR/ValueHandle.h for details.

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

Inherits from: Instruction

Member Variables

private unsigned int ReservedSpace
The number of operands actually allocated. NumOperands is the number actually in use.

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

Inherited from Instruction:

Inherited from User:

Inherited from Value:

Methods

static llvm::PHINode* Create(
    llvm::Type* Ty,
    unsigned int NumReservedValues,
    const llvm::Twine& NameStr,
    llvm::BasicBlock* InsertAtEnd)

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

Parameters

llvm::Type* Ty
unsigned int NumReservedValues
const llvm::Twine& NameStr
llvm::BasicBlock* InsertAtEnd

static llvm::PHINode* Create(
    llvm::Type* Ty,
    unsigned int NumReservedValues,
    const llvm::Twine& NameStr = "",
    llvm::Instruction* InsertBefore = nullptr)

Description

Constructors - NumReservedValues is a hint for the number of incoming edges that this phi node will have (use 0 if you really have no idea).

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

Parameters

llvm::Type* Ty
unsigned int NumReservedValues
const llvm::Twine& NameStr = ""
llvm::Instruction* InsertBefore = nullptr

PHINode(llvm::Type* Ty,
        unsigned int NumReservedValues,
        const llvm::Twine& NameStr = "",
        llvm::Instruction* InsertBefore = nullptr)

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

Parameters

llvm::Type* Ty
unsigned int NumReservedValues
const llvm::Twine& NameStr = ""
llvm::Instruction* InsertBefore = nullptr

PHINode(llvm::Type* Ty,
        unsigned int NumReservedValues,
        const llvm::Twine& NameStr,
        llvm::BasicBlock* InsertAtEnd)

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

Parameters

llvm::Type* Ty
unsigned int NumReservedValues
const llvm::Twine& NameStr
llvm::BasicBlock* InsertAtEnd

PHINode(const llvm::PHINode& PN)

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

Parameters

const llvm::PHINode& PN

void addIncoming(llvm::Value* V,
                 llvm::BasicBlock* BB)

Description

Add an incoming value to the end of the PHI list

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

Parameters

llvm::Value* V
llvm::BasicBlock* BB

void allocHungoffUses(unsigned int N)

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

Parameters

unsigned int N

llvm::PHINode::block_iterator block_begin()

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

llvm::PHINode::const_block_iterator block_begin()
    const

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

llvm::PHINode::block_iterator block_end()

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

llvm::PHINode::const_block_iterator block_end()
    const

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

iterator_range<llvm::PHINode::block_iterator>
blocks()

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

iterator_range<
    llvm::PHINode::const_block_iterator>
blocks() const

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

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

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

Parameters

const llvm::Value* V

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

Description

Methods for support type inquiry through isa, cast, and dyn_cast:

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

Parameters

const llvm::Instruction* I

llvm::PHINode* cloneImpl() const

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

int getBasicBlockIndex(
    const llvm::BasicBlock* BB) const

Description

Return the first index of the specified basic block in the value list for this PHI. Returns -1 if no instance.

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

Parameters

const llvm::BasicBlock* BB

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

Description

Return incoming basic block number @p i.

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

Parameters

unsigned int i

llvm::BasicBlock* getIncomingBlock(
    const llvm::Use& U) const

Description

Return incoming basic block corresponding to an operand of the PHI.

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

Parameters

const llvm::Use& U

llvm::BasicBlock* getIncomingBlock(
    Value::const_user_iterator I) const

Description

Return incoming basic block corresponding to value use iterator.

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

Parameters

Value::const_user_iterator I

llvm::Value* getIncomingValue(
    unsigned int i) const

Description

Return incoming value number x

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

Parameters

unsigned int i

llvm::Value* getIncomingValueForBlock(
    const llvm::BasicBlock* BB) const

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

Parameters

const llvm::BasicBlock* BB

static unsigned int getIncomingValueNumForOperand(
    unsigned int i)

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

Parameters

unsigned int i

unsigned int getNumIncomingValues() const

Description

Return the number of incoming edges

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

static unsigned int getOperandNumForIncomingValue(
    unsigned int i)

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

Parameters

unsigned int i

void growOperands()

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

bool hasConstantOrUndefValue() const

Description

Whether the specified PHI node always merges together the same value, assuming undefs are equal to a unique non-undef value.

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

llvm::Value* hasConstantValue() const

Description

If the specified PHI node always merges together the same value, return the value, otherwise return null.

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

llvm::User::const_op_range incoming_values() const

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

llvm::User::op_range incoming_values()

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

bool isComplete() const

Description

If the PHI node is complete which means all of its parent's predecessors have incoming value in this PHI, return true, otherwise return false.

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

llvm::Value* removeIncomingValue(
    unsigned int Idx,
    bool DeletePHIIfEmpty = true)

Description

Remove an incoming value. This is useful if a predecessor basic block is deleted. The value removed is returned. If the last incoming value for a PHI node is removed (and DeletePHIIfEmpty is true), the PHI node is destroyed and any uses of it are replaced with dummy values. The only time there should be zero incoming values to a PHI node is when the block is dead, so this strategy is sound.

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

Parameters

unsigned int Idx
bool DeletePHIIfEmpty = true

llvm::Value* removeIncomingValue(
    const llvm::BasicBlock* BB,
    bool DeletePHIIfEmpty = true)

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

Parameters

const llvm::BasicBlock* BB
bool DeletePHIIfEmpty = true

void replaceIncomingBlockWith(
    const llvm::BasicBlock* Old,
    llvm::BasicBlock* New)

Description

Replace every incoming basic block \p Old to basic block \p New.

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

Parameters

const llvm::BasicBlock* Old
llvm::BasicBlock* New

void setIncomingBlock(unsigned int i,
                      llvm::BasicBlock* BB)

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

Parameters

unsigned int i
llvm::BasicBlock* BB

void setIncomingValue(unsigned int i,
                      llvm::Value* V)

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

Parameters

unsigned int i
llvm::Value* V

void setIncomingValueForBlock(
    const llvm::BasicBlock* BB,
    llvm::Value* V)

Description

Set every incoming value(s) for block \p BB to \p V.

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

Parameters

const llvm::BasicBlock* BB
llvm::Value* V