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


Constructor & Destructor Documentation

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

Definition at line 889 of file Instructions.h.

References Name.

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

Definition at line 895 of file Instructions.h.

PHINode::~PHINode (  ) 

Definition at line 68 of file Instructions.cpp.

References llvm::User::OperandList.


Member Function Documentation

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

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

Definition at line 944 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().

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

Reimplemented from llvm::Instruction.

Definition at line 996 of file Instructions.h.

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

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

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

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

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

Definition at line 992 of file Instructions.h.

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

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

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

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

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

getIncomingBlock - Return incoming basic block x

Definition at line 932 of file Instructions.h.

References llvm::UnaryInstruction::getOperand().

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

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

getIncomingValue - Return incoming value x

Definition at line 918 of file Instructions.h.

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

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

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

Definition at line 982 of file Instructions.h.

References BB.

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

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

getNumIncomingValues - Return the number of incoming edges

Definition at line 914 of file Instructions.h.

References llvm::UnaryInstruction::getNumOperands().

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

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

Definition at line 938 of file Instructions.h.

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

Definition at line 926 of file Instructions.h.

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

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

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

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

Definition at line 966 of file Instructions.h.

References BB, and Idx.

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

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

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

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

Definition at line 935 of file Instructions.h.

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

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

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

Definition at line 922 of file Instructions.h.

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

Referenced by llvm::SimplifyCFG().


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