LLVM API Documentation
#include <SSAUpdater.h>
Public Member Functions | |
| SSAUpdater (SmallVectorImpl< PHINode * > *InsertedPHIs=0) | |
| ~SSAUpdater () | |
| void | Initialize (Type *Ty, StringRef Name) |
| void | AddAvailableValue (BasicBlock *BB, Value *V) |
| bool | HasValueForBlock (BasicBlock *BB) const |
| Value * | GetValueAtEndOfBlock (BasicBlock *BB) |
| Value * | GetValueInMiddleOfBlock (BasicBlock *BB) |
| void | RewriteUse (Use &U) |
| void | RewriteUseAfterInsertions (Use &U) |
Friends | |
| class | SSAUpdaterTraits< SSAUpdater > |
SSAUpdater - This class updates SSA form for 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 35 of file SSAUpdater.h.
| SSAUpdater::SSAUpdater | ( | SmallVectorImpl< PHINode * > * | InsertedPHIs = 0 | ) | [explicit] |
SSAUpdater constructor. If InsertedPHIs is specified, it will be filled in with all PHI Nodes created by rewriting.
Definition at line 38 of file SSAUpdater.cpp.
| SSAUpdater::~SSAUpdater | ( | ) |
Definition at line 41 of file SSAUpdater.cpp.
| void SSAUpdater::AddAvailableValue | ( | BasicBlock * | BB, |
| Value * | V | ||
| ) |
AddAvailableValue - Indicate that a rewritten value is available at the end of the specified block with the specified value.
AddAvailableValue - Indicate that a rewritten value is available in the specified block with the specified value.
Definition at line 64 of file SSAUpdater.cpp.
References getAvailableVals(), and llvm::Value::getType().
Referenced by ConstructSSAForLoadSet(), RewriteUsesOfClonedInstructions(), and llvm::LoadAndStorePromoter::run().
| Value * SSAUpdater::GetValueAtEndOfBlock | ( | BasicBlock * | BB | ) |
GetValueAtEndOfBlock - Construct SSA form, materializing a value that is live at the end of the specified block.
Definition at line 91 of file SSAUpdater.cpp.
Referenced by GetValueInMiddleOfBlock(), RewriteUse(), and RewriteUseAfterInsertions().
| Value * SSAUpdater::GetValueInMiddleOfBlock | ( | BasicBlock * | BB | ) |
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: use(X) X2 = ... br Cond, SomeBB, OutBB
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 115 of file SSAUpdater.cpp.
References llvm::PHINode::addIncoming(), llvm::SmallVectorTemplateCommon< T >::begin(), llvm::BasicBlock::begin(), llvm::PHINode::Create(), llvm::dbgs(), DEBUG, llvm::dyn_cast(), llvm::SmallVectorBase::empty(), llvm::SmallVectorTemplateCommon< T >::end(), llvm::Instruction::eraseFromParent(), llvm::BasicBlock::front(), llvm::UndefValue::get(), llvm::BasicBlock::getFirstNonPHI(), GetValueAtEndOfBlock(), HasValueForBlock(), llvm::ARM_PROC::I, IsEquivalentPHI(), llvm::pred_begin(), llvm::pred_end(), llvm::SmallVectorTemplateBase< T, isPodLike< T >::value >::push_back(), llvm::SmallVectorTemplateBase< T, isPodLike >::push_back(), llvm::Instruction::setDebugLoc(), llvm::SimplifyInstruction(), and llvm::SmallVectorTemplateCommon< T >::size().
Referenced by ConstructSSAForLoadSet(), RewriteUse(), and llvm::LoadAndStorePromoter::run().
| bool SSAUpdater::HasValueForBlock | ( | BasicBlock * | BB | ) | const |
HasValueForBlock - Return true if the SSAUpdater already has a value for the specified block.
Definition at line 58 of file SSAUpdater.cpp.
References llvm::DenseMapBase< DerivedT, KeyT, ValueT, KeyInfoT >::count(), and getAvailableVals().
Referenced by ConstructSSAForLoadSet(), and GetValueInMiddleOfBlock().
Initialize - 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 line 47 of file SSAUpdater.cpp.
References llvm::DenseMapBase< DerivedT, KeyT, ValueT, KeyInfoT >::clear(), and getAvailableVals().
Referenced by ConstructSSAForLoadSet(), llvm::LoadAndStorePromoter::LoadAndStorePromoter(), and RewriteUsesOfClonedInstructions().
| void SSAUpdater::RewriteUse | ( | Use & | U | ) |
RewriteUse - 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.
RewriteUse - Rewrite a use of the symbolic value. This handles PHI nodes, which use their value in the corresponding predecessor.
Definition at line 208 of file SSAUpdater.cpp.
References llvm::Use::get(), llvm::Instruction::getParent(), llvm::Use::getUser(), GetValueAtEndOfBlock(), GetValueInMiddleOfBlock(), llvm::Use::set(), and llvm::ValueHandleBase::ValueIsRAUWd().
Referenced by RewriteUsesOfClonedInstructions().
| void SSAUpdater::RewriteUseAfterInsertions | ( | Use & | U | ) |
RewriteUseAfterInsertions - Rewrite a use, just like RewriteUse. However, 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 229 of file SSAUpdater.cpp.
References llvm::Instruction::getParent(), llvm::Use::getUser(), GetValueAtEndOfBlock(), and llvm::Use::set().
friend class SSAUpdaterTraits< SSAUpdater > [friend] |
Definition at line 36 of file SSAUpdater.h.