LLVM API Documentation

Public Types | Public Member Functions | Static Public Member Functions | Protected Member Functions
llvm::PHINode Class Reference

#include <Instructions.h>

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

List of all members.

Public Types

typedef BasicBlock ** block_iterator
typedef BasicBlock *constconst_block_iterator

Public Member Functions

 ~PHINode ()
 DECLARE_TRANSPARENT_OPERAND_ACCESSORS (Value)
 Provide fast operand accessors.
block_iterator block_begin ()
const_block_iterator block_begin () const
block_iterator block_end ()
const_block_iterator block_end () const
unsigned getNumIncomingValues () const
ValuegetIncomingValue (unsigned i) const
void setIncomingValue (unsigned i, Value *V)
BasicBlockgetIncomingBlock (unsigned i) const
BasicBlockgetIncomingBlock (const Use &U) const
BasicBlockgetIncomingBlock (Value::const_user_iterator I) const
void setIncomingBlock (unsigned i, BasicBlock *BB)
void addIncoming (Value *V, BasicBlock *BB)
ValueremoveIncomingValue (unsigned Idx, bool DeletePHIIfEmpty=true)
ValueremoveIncomingValue (const BasicBlock *BB, bool DeletePHIIfEmpty=true)
int getBasicBlockIndex (const BasicBlock *BB) const
ValuegetIncomingValueForBlock (const BasicBlock *BB) const
ValuehasConstantValue () const

Static Public Member Functions

static PHINodeCreate (Type *Ty, unsigned NumReservedValues, const Twine &NameStr="", Instruction *InsertBefore=nullptr)
static PHINodeCreate (Type *Ty, unsigned NumReservedValues, const Twine &NameStr, BasicBlock *InsertAtEnd)
static unsigned getOperandNumForIncomingValue (unsigned i)
static unsigned getIncomingValueNumForOperand (unsigned i)
static bool classof (const Instruction *I)
 Methods for support type inquiry through isa, cast, and dyn_cast:
static bool classof (const Value *V)
 Methods for support type inquiry through isa, cast, and dyn_cast:

Protected Member Functions

UseallocHungoffUses (unsigned) const
PHINodeclone_impl () const override

Detailed Description

Definition at line 2090 of file Instructions.h.


Member Typedef Documentation

Definition at line 2143 of file Instructions.h.

Definition at line 2144 of file Instructions.h.


Constructor & Destructor Documentation

Definition at line 96 of file Instructions.cpp.

References llvm::User::dropHungoffUses().


Member Function Documentation

void llvm::PHINode::addIncoming ( Value V,
BasicBlock BB 
) [inline]
Use * PHINode::allocHungoffUses ( unsigned  N) const [protected]

Reimplemented from llvm::User.

Definition at line 100 of file Instructions.cpp.

References llvm::Use::initTags().

Definition at line 2152 of file Instructions.h.

Definition at line 2158 of file Instructions.h.

Referenced by llvm::EliminateDuplicatePHINodes(), and removeIncomingValue().

Definition at line 2162 of file Instructions.h.

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

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

Definition at line 2262 of file Instructions.h.

References llvm::Instruction::getOpcode(), and llvm::TargetOpcode::PHI.

static bool llvm::PHINode::classof ( const Value V) [inline, static]

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

Reimplemented from llvm::Instruction.

Definition at line 2265 of file Instructions.h.

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

Implements llvm::Instruction.

Definition at line 3753 of file Instructions.cpp.

static PHINode* llvm::PHINode::Create ( Type Ty,
unsigned  NumReservedValues,
const Twine NameStr = "",
Instruction InsertBefore = nullptr 
) [inline, static]
static PHINode* llvm::PHINode::Create ( Type Ty,
unsigned  NumReservedValues,
const Twine NameStr,
BasicBlock InsertAtEnd 
) [inline, static]

Definition at line 2131 of file Instructions.h.

Provide fast operand accessors.

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

Definition at line 2194 of file Instructions.h.

References llvm::Use::getUser().

getIncomingBlock - Return incoming basic block corresponding to value use iterator.

Definition at line 2202 of file Instructions.h.

Definition at line 2181 of file Instructions.h.

Referenced by llvm::IVUsers::AddUsersImpl().

Definition at line 2178 of file Instructions.h.

Referenced by ConstructSSAForLoadSet(), and processInstruction().

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

Definition at line 161 of file Instructions.cpp.

References llvm::UndefValue::get(), getIncomingValue(), getNumIncomingValues(), and llvm::Value::getType().

Referenced by computeKnownBits(), llvm::BasicBlock::removePredecessor(), and llvm::ObjectSizeOffsetEvaluator::visitPHINode().

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

removeIncomingValue - 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.

Definition at line 114 of file Instructions.cpp.

References block_begin(), block_end(), llvm::Instruction::eraseFromParent(), llvm::UndefValue::get(), getIncomingValue(), llvm::User::getNumOperands(), llvm::Value::getType(), llvm::User::NumOperands, llvm::User::Op(), llvm::User::op_begin(), llvm::User::op_end(), and llvm::Value::replaceAllUsesWith().

Referenced by llvm::CloneAndPruneFunctionInto(), llvm::CodeExtractor::extractCodeRegion(), insertUniqueBackedgeBlock(), redirectValuesFromPredecessorsToPhi(), llvm::BasicBlock::removePredecessor(), RewriteUsesOfClonedInstructions(), llvm::UnrollLoop(), and UpdatePHINodes().

Value* llvm::PHINode::removeIncomingValue ( const BasicBlock BB,
bool  DeletePHIIfEmpty = true 
) [inline]

Definition at line 2235 of file Instructions.h.

void llvm::PHINode::setIncomingBlock ( unsigned  i,
BasicBlock BB 
) [inline]
void llvm::PHINode::setIncomingValue ( unsigned  i,
Value V 
) [inline]

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