LLVM  mainline
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

 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
op_range incoming_values ()
const_op_range incoming_values () const
unsigned getNumIncomingValues () const
 getNumIncomingValues - Return the number of incoming edges
ValuegetIncomingValue (unsigned i) const
 getIncomingValue - Return incoming value number x
void setIncomingValue (unsigned i, Value *V)
BasicBlockgetIncomingBlock (unsigned i) const
 getIncomingBlock - Return incoming basic block number i.
BasicBlockgetIncomingBlock (const Use &U) const
 getIncomingBlock - Return incoming basic block corresponding to an operand of the PHI.
BasicBlockgetIncomingBlock (Value::const_user_iterator I) const
 getIncomingBlock - Return incoming basic block corresponding to value use iterator.
void setIncomingBlock (unsigned i, BasicBlock *BB)
void addIncoming (Value *V, BasicBlock *BB)
 addIncoming - Add an incoming value to the end of the PHI list
ValueremoveIncomingValue (unsigned Idx, bool DeletePHIIfEmpty=true)
 removeIncomingValue - Remove an incoming value.
ValueremoveIncomingValue (const BasicBlock *BB, bool DeletePHIIfEmpty=true)
int getBasicBlockIndex (const BasicBlock *BB) const
 getBasicBlockIndex - Return the first index of the specified basic block in the value list for this PHI.
ValuegetIncomingValueForBlock (const BasicBlock *BB) const
ValuehasConstantValue () const
 hasConstantValue - If the specified PHI node always merges together the same value, return the value, otherwise return null.

Static Public Member Functions

static PHINodeCreate (Type *Ty, unsigned NumReservedValues, const Twine &NameStr="", Instruction *InsertBefore=nullptr)
 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).
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

void allocHungoffUses (unsigned N)
PHINodeclone_impl () const override

Detailed Description

Definition at line 2221 of file Instructions.h.


Member Typedef Documentation

Definition at line 2275 of file Instructions.h.

Definition at line 2276 of file Instructions.h.


Member Function Documentation

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

Definition at line 2251 of file Instructions.h.

References llvm::User::allocHungoffUses().

Definition at line 2284 of file Instructions.h.

Definition at line 2290 of file Instructions.h.

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

Definition at line 2294 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 2398 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 2401 of file Instructions.h.

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

Implements llvm::Instruction.

Definition at line 3597 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 2264 of file Instructions.h.

Provide fast operand accessors.

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

Definition at line 2330 of file Instructions.h.

References llvm::Use::getUser().

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

Definition at line 2338 of file Instructions.h.

Definition at line 2317 of file Instructions.h.

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

Definition at line 2314 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 137 of file Instructions.cpp.

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

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

Definition at line 2300 of file Instructions.h.

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 98 of file Instructions.cpp.

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

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

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

Definition at line 2371 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: