LLVM API Documentation

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 Member Functions

 PHINode (const Type *Ty, const std::string &Name="", Instruction *InsertBefore=0)
 PHINode (const Type *Ty, const std::string &Name, BasicBlock *InsertAtEnd)
 ~PHINode ()
void reserveOperandSpace (unsigned NumValues)
virtual PHINodeclone () const
unsigned getNumIncomingValues () const
ValuegetIncomingValue (unsigned i) const
void setIncomingValue (unsigned i, Value *V)
unsigned getOperandNumForIncomingValue (unsigned i)
BasicBlockgetIncomingBlock (unsigned i) const
void setIncomingBlock (unsigned i, BasicBlock *BB)
unsigned getOperandNumForIncomingBlock (unsigned i)
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 (bool AllowNonDominatingInstruction=false) const

Static Public Member Functions

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 898 of file Instructions.h.


Constructor & Destructor Documentation

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

Definition at line 904 of file Instructions.h.

References Name.

llvm::PHINode::PHINode ( const Type Ty,
const std::string &  Name,
BasicBlock InsertAtEnd 
) [inline]

Definition at line 910 of file Instructions.h.

PHINode::~PHINode (  ) 

Definition at line 77 of file Instructions.cpp.

References llvm::User::OperandList.


Member Function Documentation

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 921 of file Instructions.h.

Referenced by llvm::BytecodeReader::ParseInstruction().

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

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

getNumIncomingValues - Return the number of incoming edges

Definition at line 929 of file Instructions.h.

References llvm::UnaryInstruction::getNumOperands().

Referenced by llvm::CloneAndPruneFunctionInto(), llvm::ExpressionConvertibleToType(), FoldCondBranchOnPHI(), hasConstantValue(), IVUseShouldUsePostIncValue(), OperandConvertibleToType(), llvm::BasicBlock::removePredecessor(), and TryToSimplifyUncondBranchFromEmptyBlock().

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

getIncomingValue - Return incoming value number x

Definition at line 933 of file Instructions.h.

References llvm::UnaryInstruction::getNumOperands(), and llvm::UnaryInstruction::getOperand().

Referenced by llvm::CloneAndPruneFunctionInto(), llvm::ConvertExpressionToType(), ConvertOperandToType(), llvm::ExpressionConvertibleToType(), FoldCondBranchOnPHI(), FoldTwoEntryPHINode(), hasConstantValue(), IVUseShouldUsePostIncValue(), OperandConvertibleToType(), llvm::SimplifyCFG(), and TryToSimplifyUncondBranchFromEmptyBlock().

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

Definition at line 937 of file Instructions.h.

References llvm::UnaryInstruction::getNumOperands(), llvm::UnaryInstruction::setOperand(), and V.

Referenced by llvm::CloneAndPruneFunctionInto(), and llvm::SimplifyCFG().

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

Definition at line 941 of file Instructions.h.

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

getIncomingBlock - Return incoming basic block number x

Definition at line 947 of file Instructions.h.

References llvm::UnaryInstruction::getOperand().

Referenced by llvm::CloneAndPruneFunctionInto(), llvm::ConvertExpressionToType(), ConvertOperandToType(), FoldCondBranchOnPHI(), FoldTwoEntryPHINode(), llvm::Loop::getTripCount(), IVUseShouldUsePostIncValue(), llvm::BasicBlock::removePredecessor(), and TryToSimplifyUncondBranchFromEmptyBlock().

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

Definition at line 950 of file Instructions.h.

References BB, and llvm::UnaryInstruction::setOperand().

Referenced by llvm::CloneAndPruneFunctionInto(), and llvm::BasicBlock::splitBasicBlock().

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

Definition at line 953 of file Instructions.h.

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

addIncoming - Add an incoming value to the end of the PHI list

Definition at line 959 of file Instructions.h.

References BB, llvm::Value::getType(), llvm::Use::init(), llvm::User::NumOperands, llvm::User::OperandList, and V.

Referenced by FoldCondBranchOnPHI(), llvm::BytecodeReader::ParseInstruction(), llvm::SimplifyCFG(), and llvm::SCEVExpander::visitAddRecExpr().

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 83 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::ConvertExpressionToType(), ConvertOperandToType(), and llvm::BasicBlock::removePredecessor().

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

Definition at line 981 of file Instructions.h.

References BB, and 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 990 of file Instructions.h.

References BB, llvm::UnaryInstruction::getNumOperands(), and llvm::User::OperandList.

Referenced by llvm::SimplifyCFG(), and llvm::BasicBlock::splitBasicBlock().

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

Definition at line 997 of file Instructions.h.

References BB.

Referenced by EvaluateFunction(), FoldCondBranchOnPHI(), and llvm::SimplifyCFG().

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.

Definition at line 147 of file Instructions.cpp.

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

Referenced by llvm::BasicBlock::removePredecessor().

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

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

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

Reimplemented from llvm::Instruction.

Definition at line 1008 of file Instructions.h.

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

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

Reimplemented from llvm::Instruction.

Definition at line 1011 of file Instructions.h.

References llvm::CastInst::classof(), and V.


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