LLVM API Documentation

llvm::PHINode Class Reference

#include <Instructions.h>

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

List of all members.

Public Member Functions

 ~PHINode ()
void reserveOperandSpace (unsigned NumValues)
virtual PHINode * clone () const
 DECLARE_TRANSPARENT_OPERAND_ACCESSORS (Value)
 Provide fast operand accessors.
unsigned getNumIncomingValues () const
Value * getIncomingValue (unsigned i) const
void setIncomingValue (unsigned i, Value *V)
unsigned getOperandNumForIncomingValue (unsigned i)
template<typename U>
BasicBlock * getIncomingBlock (value_use_iterator< U > I) const
BasicBlock * getIncomingBlock (unsigned i) const
void setIncomingBlock (unsigned i, BasicBlock *BB)
unsigned getOperandNumForIncomingBlock (unsigned i)
void addIncoming (Value *V, BasicBlock *BB)
Value * removeIncomingValue (unsigned Idx, bool DeletePHIIfEmpty=true)
Value * removeIncomingValue (const BasicBlock *BB, bool DeletePHIIfEmpty=true)
int getBasicBlockIndex (const BasicBlock *BB) const
Value * getIncomingValueForBlock (const BasicBlock *BB) const
Value * hasConstantValue (bool AllowNonDominatingInstruction=false) const

Static Public Member Functions

static PHINode * Create (const Type *Ty, const std::string &NameStr="", Instruction *InsertBefore=0)
static PHINode * Create (const Type *Ty, const std::string &NameStr, BasicBlock *InsertAtEnd)
static bool classof (const PHINode *)
 Methods for support type inquiry through isa, cast, and dyn_cast:.
static bool classof (const Instruction *I)
 Methods for support type inquiry through isa, cast, and dyn_cast:.
static bool classof (const Value *V)


Detailed Description

Definition at line 1882 of file Instructions.h.


Constructor & Destructor Documentation

PHINode::~PHINode (  ) 

Definition at line 157 of file Instructions.cpp.

References llvm::User::dropHungoffUses(), and llvm::User::OperandList.


Member Function Documentation

static PHINode* llvm::PHINode::Create ( const Type *  Ty,
const std::string &  NameStr = "",
Instruction *  InsertBefore = 0 
) [inline, static]

static PHINode* llvm::PHINode::Create ( const Type *  Ty,
const std::string &  NameStr,
BasicBlock *  InsertAtEnd 
) [inline, static]

Definition at line 1909 of file Instructions.h.

void llvm::PHINode::reserveOperandSpace ( unsigned  NumValues  )  [inline]

reserveOperandSpace - This method can be used to avoid repeated reallocation of PHI operand lists by reserving space for the correct number of operands before adding them. Unlike normal vector reserves, this method can also be used to trim the operand space.

Definition at line 1919 of file Instructions.h.

Referenced by LowerPartSelect(), and LowerPartSet().

PHINode * PHINode::clone (  )  const [virtual]

clone() - Create a copy of 'this' instruction that is identical in all ways except the following: The instruction has no parent The instruction has no name

Implements llvm::Instruction.

Definition at line 2919 of file Instructions.cpp.

llvm::PHINode::DECLARE_TRANSPARENT_OPERAND_ACCESSORS ( Value   ) 

Provide fast operand accessors.

unsigned llvm::PHINode::getNumIncomingValues (  )  const [inline]

Value* llvm::PHINode::getIncomingValue ( unsigned  i  )  const [inline]

void llvm::PHINode::setIncomingValue ( unsigned  i,
Value *  V 
) [inline]

unsigned llvm::PHINode::getOperandNumForIncomingValue ( unsigned  i  )  [inline]

Definition at line 1942 of file Instructions.h.

template<typename U>
BasicBlock* llvm::PHINode::getIncomingBlock ( value_use_iterator< U >  I  )  const [inline]

BasicBlock* llvm::PHINode::getIncomingBlock ( unsigned  i  )  const [inline]

getIncomingBlock - Return incoming basic block number x

Definition at line 1956 of file Instructions.h.

void llvm::PHINode::setIncomingBlock ( unsigned  i,
BasicBlock *  BB 
) [inline]

unsigned llvm::PHINode::getOperandNumForIncomingBlock ( unsigned  i  )  [inline]

Definition at line 1962 of file Instructions.h.

void llvm::PHINode::addIncoming ( Value *  V,
BasicBlock *  BB 
) [inline]

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

References llvm::Instruction::eraseFromParent(), llvm::UndefValue::get(), llvm::User::getNumOperands(), llvm::Value::getType(), llvm::User::NumOperands, llvm::User::OperandList, llvm::Value::replaceAllUsesWith(), and llvm::Use::set().

Referenced by llvm::CloneAndPruneFunctionInto(), llvm::BasicBlock::removePredecessor(), llvm::SplitBlockPredecessors(), TryToSimplifyUncondBranchFromEmptyBlock(), and llvm::UnrollLoop().

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

Definition at line 1992 of file Instructions.h.

References Idx.

int llvm::PHINode::getBasicBlockIndex ( const BasicBlock *  BB  )  const [inline]

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

Definition at line 2001 of file Instructions.h.

Referenced by SimplifyCondBranchToCondBranch(), llvm::BasicBlock::splitBasicBlock(), and llvm::SplitCriticalEdge().

Value* llvm::PHINode::getIncomingValueForBlock ( const BasicBlock *  BB  )  const [inline]

Value * PHINode::hasConstantValue ( bool  AllowNonDominatingInstruction = false  )  const

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

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

Definition at line 226 of file Instructions.cpp.

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

Referenced by FindPHIToPartitionLoops(), llvm::BasicBlock::removePredecessor(), and llvm::SplitBlockPredecessors().

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

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

Definition at line 2018 of file Instructions.h.

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

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

Reimplemented from llvm::Instruction.

Definition at line 2019 of file Instructions.h.

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

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

Reimplemented from llvm::Instruction.

Definition at line 2022 of file Instructions.h.


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