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
Collaboration diagram for llvm::PHINode:
Collaboration graph

List of all members.

Public Types

typedef BasicBlock ** block_iterator
typedef BasicBlock *constconst_block_iterator

Public Member Functions

 ~PHINode () override
 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 ()
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 2179 of file Instructions.h.

Member Typedef Documentation

Definition at line 2232 of file Instructions.h.

Definition at line 2233 of file Instructions.h.

Constructor & Destructor Documentation

PHINode::~PHINode ( ) [override]

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(), and size.

Definition at line 2241 of file Instructions.h.

Definition at line 2247 of file Instructions.h.

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

Definition at line 2251 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 2353 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 2356 of file Instructions.h.

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

Implements llvm::Instruction.

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

Provide fast operand accessors.

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

Definition at line 2285 of file Instructions.h.

References llvm::Use::getUser().

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

Definition at line 2293 of file Instructions.h.

Definition at line 2272 of file Instructions.h.

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

getNumIncomingValues - Return the number of incoming edges

Definition at line 2259 of file Instructions.h.

Referenced by llvm::ReductionDescriptor::AddReductionVar(), CanEvaluateSExtd(), CanEvaluateShifted(), CanEvaluateTruncated(), CanEvaluateZExtd(), canIfConvertPHINodes(), CanPropagatePredecessorsForPHIs(), llvm::CloneAndPruneIntoFromInst(), CloneInstructionInExitBlock(), computeKnownBits(), ComputeNumSignBits(), llvm::FunctionLoweringInfo::ComputePHILiveOutRegInfo(), ConstructSSAForLoadSet(), containsSafePHI(), llvm::DemotePHIToStack(), llvm::CodeExtractor::extractCodeRegion(), findBasePointer(), findPHIToPartitionLoops(), fixPhis(), FoldCondBranchOnPHI(), gatherIncomingValuesToPhi(), GetHeapSROAValue(), llvm::GetIfCondition(), getInsertPointForUses(), GetShiftedValue(), hasConstantValue(), HoistThenElseCodeToIf(), insertUniqueBackedgeBlock(), IsEquivalentPHI(), isSafePHIToSpeculate(), isSameUnderlyingObjectInLoop(), isTriviallyReplacablePHI(), IVUseShouldUsePostIncValue(), PerformHeapAllocSRoA(), PHIsEqualValue(), processInstruction(), redirectValuesFromPredecessorsToPhi(), relocationViaAlloca(), llvm::BasicBlock::removePredecessor(), removeUndefIntroducingPredecessor(), replaceUndefValuesInPhi(), SimplifyPHINode(), llvm::InstCombiner::SliceUpIllegalIntegerPHI(), speculatePHINodeLoads(), SplitCriticalSideEffectEdges(), ThreadBinOpOverPHI(), ThreadCmpOverPHI(), tryToMakeAllocaBePromotable(), UpdatePHINodes(), llvm::SSAUpdaterTraits< SSAUpdater >::ValueIsNewPHI(), llvm::ObjectSizeOffsetEvaluator::visitPHINode(), llvm::InstCombiner::visitPHINode(), and WriteInstruction().

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

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

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

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 2326 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: