LLVM: llvm::SSAUpdater Class Reference (original) (raw)
Helper class for SSA formation on a set of values defined in multiple blocks. More...
#include "[llvm/Transforms/Utils/SSAUpdater.h](SSAUpdater%5F8h%5Fsource.html)"
| 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 (const SSAUpdater &)=delete | |
| SSAUpdater & | operator= (const SSAUpdater &)=delete |
| ~SSAUpdater () | |
| void | Initialize (Type *Ty, StringRef Name) |
| 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 the SSAUpdater already has a value for the specified block. | |
| Value * | FindValueForBlock (BasicBlock *BB) const |
| Return the value for the specified block if the SSAUpdater has one, otherwise return nullptr. | |
| Value * | GetValueAtEndOfBlock (BasicBlock *BB) |
| Construct SSA form, materializing a value that is live at the end of the specified block. | |
| Value * | GetValueInMiddleOfBlock (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< DbgVariableRecord * > &DbgValues) |
| void | RewriteUseAfterInsertions (Use &U) |
| Rewrite a use like RewriteUse but handling in-block definitions. |
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 line 39 of file SSAUpdater.h.
If InsertedPHIs is specified, it will be filled in with all PHI Nodes created by rewriting.
Definition at line 45 of file SSAUpdater.cpp.
Referenced by operator=(), and SSAUpdater().
◆ SSAUpdater() [2/2]
◆ ~SSAUpdater()
| SSAUpdater::~SSAUpdater | ( | ) |
|---|
◆ AddAvailableValue()
◆ FindValueForBlock()
◆ GetValueAtEndOfBlock()
◆ GetValueInMiddleOfBlock()
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:
X2 = ...
br Cond, SomeBB, OutBB
Move duplicate certain instructions close to their use
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 97 of file SSAUpdater.cpp.
References llvm::PHINode::addIncoming(), llvm::BasicBlock::begin(), llvm::SmallVectorTemplateCommon< T, typename >::begin(), llvm::PHINode::Create(), llvm::dbgs(), DL, llvm::dyn_cast(), llvm::SmallVectorTemplateCommon< T, typename >::empty(), llvm::BasicBlock::end(), llvm::SmallVectorTemplateCommon< T, typename >::end(), llvm::Instruction::eraseFromParent(), llvm::PoisonValue::get(), llvm::BasicBlock::getDataLayout(), llvm::BasicBlock::getFirstNonPHIIt(), GetValueAtEndOfBlock(), HasValueForBlock(), llvm::Instruction::insertBefore(), llvm::isa(), IsEquivalentPHI(), LLVM_DEBUG, llvm::BasicBlock::phis(), llvm::predecessors(), llvm::SmallVectorTemplateBase< T, bool >::push_back(), llvm::Instruction::setDebugLoc(), llvm::simplifyInstruction(), and llvm::SmallVectorTemplateCommon< T, typename >::size().
Referenced by ConstructSSAForLoadSet(), llvm::PhiLoweringHelper::lowerPhis(), and RewriteUse().
◆ HasValueForBlock()
◆ Initialize()
◆ operator=()
◆ RewriteUse()
| void SSAUpdater::RewriteUse | ( | Use & | U | ) |
|---|
◆ RewriteUseAfterInsertions()
| void SSAUpdater::RewriteUseAfterInsertions | ( | Use & | U | ) |
|---|
Rewrite a use like RewriteUse 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 line 225 of file SSAUpdater.cpp.
References llvm::cast(), llvm::dyn_cast(), and GetValueAtEndOfBlock().
◆ UpdateDebugValues() [1/2]
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 line 199 of file SSAUpdater.cpp.
References llvm::findDbgValues(), and I.
Referenced by llvm::JumpThreadingPass::updateSSA().
◆ UpdateDebugValues() [2/2]
◆ SSAUpdaterTraits< SSAUpdater >
The documentation for this class was generated from the following files:
- include/llvm/Transforms/Utils/SSAUpdater.h
- lib/Transforms/Utils/SSAUpdater.cpp