Movatterモバイル変換


[0]ホーム

URL:


LLVM 20.0.0git
Public Member Functions |Friends |List of all members
llvm::SSAUpdater Class Reference

Helper class for SSA formation on a set of values defined in multiple blocks.More...

#include "llvm/Transforms/Utils/SSAUpdater.h"

Public Member Functions

 SSAUpdater (SmallVectorImpl<PHINode * > *InsertedPHIs=nullptr)
 If InsertedPHIs is specified, it will be filled in with all PHI Nodes created by rewriting.
 
 SSAUpdater (constSSAUpdater &)=delete
 
SSAUpdateroperator= (constSSAUpdater &)=delete
 
 ~SSAUpdater ()
 
void Initialize (Type *Ty,StringRefName)
 Reset this object to get ready for a new set of SSA updates with type 'Ty'.
 
void AddAvailableValue (BasicBlock *BB,Value *V)
 Indicate that a rewritten value is available in the specified block with the specified value.
 
bool HasValueForBlock (BasicBlock *BB)const
 Return true if theSSAUpdater already has a value for the specified block.
 
ValueFindValueForBlock (BasicBlock *BB)const
 Return the value for the specified block if theSSAUpdater has one, otherwise return nullptr.
 
ValueGetValueAtEndOfBlock (BasicBlock *BB)
 Construct SSA form, materializing a value that is live at the end of the specified block.
 
ValueGetValueInMiddleOfBlock (BasicBlock *BB)
 Construct SSA form, materializing a value that is live in the middle of the specified block.
 
void RewriteUse (Use &U)
 Rewrite a use of the symbolic value.
 
void UpdateDebugValues (Instruction *I)
 Rewrite debug value intrinsics to conform to a new SSA form.
 
void UpdateDebugValues (Instruction *I,SmallVectorImpl<DbgValueInst * > &DbgValues)
 
void UpdateDebugValues (Instruction *I,SmallVectorImpl<DbgVariableRecord * > &DbgValues)
 
void RewriteUseAfterInsertions (Use &U)
 Rewrite a use likeRewriteUse but handling in-block definitions.
 

Friends

class SSAUpdaterTraits< SSAUpdater >
 

Detailed Description

Helper class for SSA formation on a set of values defined in multiple blocks.

This is used when code duplication or another unstructured transformation wants to rewrite a set of uses of one value with uses of a set of values.

Definition at line40 of fileSSAUpdater.h.

Constructor & Destructor Documentation

◆ SSAUpdater()[1/2]

SSAUpdater::SSAUpdater(SmallVectorImpl<PHINode * > * InsertedPHIs =nullptr)
explicit

If InsertedPHIs is specified, it will be filled in with all PHI Nodes created by rewriting.

Definition at line45 of fileSSAUpdater.cpp.

◆ SSAUpdater()[2/2]

llvm::SSAUpdater::SSAUpdater(constSSAUpdater)
delete

◆ ~SSAUpdater()

SSAUpdater::~SSAUpdater()

Definition at line48 of fileSSAUpdater.cpp.

Member Function Documentation

◆ AddAvailableValue()

void SSAUpdater::AddAvailableValue(BasicBlockBB,
ValueV 
)

Indicate that a rewritten value is available in the specified block with the specified value.

Definition at line69 of fileSSAUpdater.cpp.

Referencesassert(), andgetAvailableVals().

Referenced byConstructSSAForLoadSet(),formLCSSAForInstructionsImpl(),InsertIntrinsicCalls(),llvm::PhiLoweringHelper::lowerPhis(),llvm::LoadAndStorePromoter::run(), andllvm::JumpThreadingPass::updateSSA().

◆ FindValueForBlock()

Value * SSAUpdater::FindValueForBlock(BasicBlockBB) const

Return the value for the specified block if theSSAUpdater has one, otherwise return nullptr.

Definition at line65 of fileSSAUpdater.cpp.

ReferencesgetAvailableVals(), andllvm::DenseMapBase< DerivedT, KeyT, ValueT, KeyInfoT, BucketT >::lookup().

Referenced byformLCSSAForInstructionsImpl().

◆ GetValueAtEndOfBlock()

Value * SSAUpdater::GetValueAtEndOfBlock(BasicBlockBB)

Construct SSA form, materializing a value that is live at the end of the specified block.

Definition at line92 of fileSSAUpdater.cpp.

Referenced byGetValueInMiddleOfBlock(),RewriteUse(), andRewriteUseAfterInsertions().

◆ GetValueInMiddleOfBlock()

Value * SSAUpdater::GetValueInMiddleOfBlock(BasicBlockBB)

Construct SSA form, materializing a value that is live in the middle of the specified block.

GetValueInMiddleOfBlock is the same asGetValueAtEndOfBlock except in one important case: if there is a definition of the rewritten value after the 'use' in BB. Consider code like this:

X1 = ...
SomeBB:
use(X)
X2 = ...
brCond, SomeBB, OutBB
static GCMetadataPrinterRegistry::Add< ErlangGCPrinter > X("erlang", "erlang-compatible garbage collector")
Move duplicate certain instructions close to their use
Definition:Localizer.cpp:33
const SmallVectorImpl< MachineOperand > & Cond

In this case, there are two values (X1 and X2) added to the AvailableVals set by the client of the rewriter, and those values are both live out of their respective blocks. However, the use of X happens in themiddle of a block. Because of this, we need to insert a new PHI node in SomeBB to merge the appropriate values, and this value isn't live out of the block.

Definition at line97 of fileSSAUpdater.cpp.

Referencesllvm::PHINode::addIncoming(),llvm::SmallVectorTemplateCommon< T, typename >::begin(),llvm::BasicBlock::begin(),llvm::PHINode::Create(),llvm::dbgs(),DL,llvm::SmallVectorBase< Size_T >::empty(),llvm::SmallVectorTemplateCommon< T, typename >::end(),llvm::BasicBlock::end(),llvm::Instruction::eraseFromParent(),llvm::PoisonValue::get(),llvm::BasicBlock::getDataLayout(),llvm::BasicBlock::getFirstNonPHIIt(),GetValueAtEndOfBlock(),HasValueForBlock(),llvm::Instruction::insertBefore(),IsEquivalentPHI(),LLVM_DEBUG,llvm::BasicBlock::phis(),llvm::predecessors(),llvm::SmallVectorTemplateBase< T, bool >::push_back(),llvm::Instruction::setDebugLoc(),llvm::simplifyInstruction(), andllvm::SmallVectorBase< Size_T >::size().

Referenced byConstructSSAForLoadSet(),llvm::PhiLoweringHelper::lowerPhis(),RewriteUse(), andllvm::LoadAndStorePromoter::run().

◆ HasValueForBlock()

bool SSAUpdater::HasValueForBlock(BasicBlockBB) const

Return true if theSSAUpdater already has a value for the specified block.

Definition at line61 of fileSSAUpdater.cpp.

Referencesllvm::DenseMapBase< DerivedT, KeyT, ValueT, KeyInfoT, BucketT >::count(), andgetAvailableVals().

Referenced byConstructSSAForLoadSet(),formLCSSAForInstructionsImpl(), andGetValueInMiddleOfBlock().

◆ Initialize()

void SSAUpdater::Initialize(TypeTy,
StringRef Name 
)

Reset this object to get ready for a new set of SSA updates with type 'Ty'.

PHI nodes get a name based on 'Name'.

Definition at line52 of fileSSAUpdater.cpp.

Referencesllvm::DenseMapBase< DerivedT, KeyT, ValueT, KeyInfoT, BucketT >::clear(),getAvailableVals(), andName.

Referenced byConstructSSAForLoadSet(),formLCSSAForInstructionsImpl(),InsertIntrinsicCalls(),llvm::LoadAndStorePromoter::LoadAndStorePromoter(),llvm::PhiLoweringHelper::lowerPhis(), andllvm::JumpThreadingPass::updateSSA().

◆ operator=()

SSAUpdater & llvm::SSAUpdater::operator=(constSSAUpdater)
delete

◆ RewriteUse()

void SSAUpdater::RewriteUse(UseU)

Rewrite a use of the symbolic value.

This handles PHI nodes, which use their value in the corresponding predecessor. Note that this will not work if the use is supposed to be rewritten to a value defined in the same block as the use, but above it.Any 'AddAvailableValue's added for the use's block will be considered to be below it.

Definition at line187 of fileSSAUpdater.cpp.

ReferencesGetValueAtEndOfBlock(), andGetValueInMiddleOfBlock().

Referenced byformLCSSAForInstructionsImpl(),llvm::JumpThreadingPass::updateSSA(), andUpdateSSA().

◆ RewriteUseAfterInsertions()

void SSAUpdater::RewriteUseAfterInsertions(UseU)

Rewrite a use likeRewriteUse but handling in-block definitions.

This version of the method can rewrite uses in the same block as a definition, because it assumes that all uses of a value are below any inserted values.

Definition at line247 of fileSSAUpdater.cpp.

ReferencesGetValueAtEndOfBlock().

◆ UpdateDebugValues()[1/3]

void SSAUpdater::UpdateDebugValues(InstructionI)

Rewrite debug value intrinsics to conform to a new SSA form.

This will scout out all the debug value intrinsics associated with the instruction. Anything outside of its block will have its value set to the new SSA value if available, and undef if not.

Definition at line199 of fileSSAUpdater.cpp.

Referencesllvm::findDbgValues(), andI.

Referenced byllvm::JumpThreadingPass::updateSSA().

◆ UpdateDebugValues()[2/3]

void SSAUpdater::UpdateDebugValues(InstructionI,
SmallVectorImpl<DbgValueInst * > & DbgValues 
)

Definition at line215 of fileSSAUpdater.cpp.

ReferencesI.

◆ UpdateDebugValues()[3/3]

void SSAUpdater::UpdateDebugValues(InstructionI,
SmallVectorImpl<DbgVariableRecord * > & DbgValues 
)

Definition at line222 of fileSSAUpdater.cpp.

ReferencesI.

Friends And Related Function Documentation

◆ SSAUpdaterTraits< SSAUpdater >

friend classSSAUpdaterTraits<SSAUpdater >
friend

Definition at line1 of fileSSAUpdater.h.


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

Generated on Sun Jul 20 2025 19:53:46 for LLVM by doxygen 1.9.6
[8]ページ先頭

©2009-2025 Movatter.jp