LLVM 22.0.0git
llvm::DebugSSAUpdater Class Reference

Class used to determine the live ranges of debug variables in IR using SSA construction (via the SSAUpdaterImpl class), used for analysis purposes. More...

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

Public Member Functions

 DebugSSAUpdater (SmallVectorImpl< DbgSSAPhi * > *InsertedPHIs=nullptr)
 If InsertedPHIs is specified, it will be filled in with all PHI Nodes created by rewriting.
 DebugSSAUpdater (const DebugSSAUpdater &)=delete
DebugSSAUpdateroperator= (const DebugSSAUpdater &)=delete
 ~DebugSSAUpdater ()
void reset ()
void initialize ()
DbgSSABlockgetDbgSSABlock (BasicBlock *BB)
 For a given BB, create a wrapper block for it.
void addAvailableValue (DbgSSABlock *BB, DbgValueDef DV)
 Indicate that a rewritten value is available in the specified block with the specified value.
bool hasValueForBlock (DbgSSABlock *BB) const
 Return true if the DebugSSAUpdater already has a value for the specified block.
DbgValueDef findValueForBlock (DbgSSABlock *BB) const
 Return the value for the specified block if the DebugSSAUpdater has one, otherwise return nullptr.
DbgValueDef getValueAtEndOfBlock (DbgSSABlock *BB)
 Construct SSA form, materializing a value that is live at the end of the specified block.
DbgValueDef getValueInMiddleOfBlock (DbgSSABlock *BB)
 Construct SSA form, materializing a value that is live in the middle of the specified block.

Friends

class SSAUpdaterTraits< DebugSSAUpdater >

Detailed Description

Class used to determine the live ranges of debug variables in IR using SSA construction (via the SSAUpdaterImpl class), used for analysis purposes.

Definition at line 215 of file DebugSSAUpdater.h.

Constructor & Destructor Documentation

◆ DebugSSAUpdater() [1/2]

DebugSSAUpdater::DebugSSAUpdater ( SmallVectorImpl< DbgSSAPhi * > * InsertedPHIs = nullptr)
explicit

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

Definition at line 45 of file DebugSSAUpdater.cpp.

Referenced by DebugSSAUpdater(), and operator=().

◆ DebugSSAUpdater() [2/2]

llvm::DebugSSAUpdater::DebugSSAUpdater ( const DebugSSAUpdater & )
delete

References DebugSSAUpdater().

◆ ~DebugSSAUpdater()

llvm::DebugSSAUpdater::~DebugSSAUpdater ( )
inline

Definition at line 238 of file DebugSSAUpdater.h.

References llvm::Block.

Member Function Documentation

◆ addAvailableValue()

void DebugSSAUpdater::addAvailableValue ( DbgSSABlock * BB,
DbgValueDef DV )

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

Definition at line 58 of file DebugSSAUpdater.cpp.

◆ findValueForBlock()

DbgValueDef DebugSSAUpdater::findValueForBlock ( DbgSSABlock * BB) const

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

Definition at line 54 of file DebugSSAUpdater.cpp.

◆ getDbgSSABlock()

DbgSSABlock * llvm::DebugSSAUpdater::getDbgSSABlock ( BasicBlock * BB)
inline

For a given BB, create a wrapper block for it.

Stores it in the DebugSSAUpdater block map.

Definition at line 256 of file DebugSSAUpdater.h.

◆ getValueAtEndOfBlock()

DbgValueDef DebugSSAUpdater::getValueAtEndOfBlock ( DbgSSABlock * BB)

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

Definition at line 62 of file DebugSSAUpdater.cpp.

Referenced by getValueInMiddleOfBlock().

◆ getValueInMiddleOfBlock()

DbgValueDef DebugSSAUpdater::getValueInMiddleOfBlock ( DbgSSABlock * BB)

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

getValueInMiddleOfBlock is the same as GetValueAtEndOfBlock 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 = ...
br Cond, SomeBB, OutBB
Move duplicate certain instructions close to their use
Definition Localizer.cpp:33
const SmallVectorImpl< MachineOperand > & Cond
static TableGen::Emitter::OptClass< SkeletonEmitter > X("gen-skeleton-class", "Generate example skeleton class")

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 the middle 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 line 67 of file DebugSSAUpdater.cpp.

References llvm::DbgSSAPhi::addIncoming(), llvm::DbgValueDef::agreesWith(), llvm::dbgs(), llvm::SmallVectorTemplateCommon< T, typename >::empty(), getValueAtEndOfBlock(), hasValueForBlock(), llvm::DbgValueDef::IsUndef, LLVM_DEBUG, llvm::DbgSSABlock::newPHI(), llvm::DbgSSABlock::predecessors(), and llvm::SmallVectorTemplateBase< T, bool >::push_back().

◆ hasValueForBlock()

bool DebugSSAUpdater::hasValueForBlock ( DbgSSABlock * BB) const

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

Definition at line 50 of file DebugSSAUpdater.cpp.

Referenced by getValueInMiddleOfBlock().

◆ initialize()

void DebugSSAUpdater::initialize ( )

Definition at line 48 of file DebugSSAUpdater.cpp.

◆ operator=()

DebugSSAUpdater & llvm::DebugSSAUpdater::operator= ( const DebugSSAUpdater & )
delete

References DebugSSAUpdater().

◆ reset()

void llvm::DebugSSAUpdater::reset ( )
inline

Definition at line 243 of file DebugSSAUpdater.h.

References llvm::Block.

◆ SSAUpdaterTraits< DebugSSAUpdater >

friend class SSAUpdaterTraits< DebugSSAUpdater >
friend

Definition at line 210 of file DebugSSAUpdater.h.


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