LLVM
8.0.1
|
Helper class for SSA formation on a set of values defined in multiple blocks. More...
#include "llvm/Transforms/Utils/SSAUpdaterBulk.h"
Public Member Functions | |
SSAUpdaterBulk () | |
SSAUpdaterBulk (const SSAUpdaterBulk &)=delete | |
SSAUpdaterBulk & | operator= (const SSAUpdaterBulk &)=delete |
~SSAUpdaterBulk () | |
unsigned | AddVariable (StringRef Name, Type *Ty) |
Add a new variable to the SSA rewriter. More... | |
void | AddAvailableValue (unsigned Var, BasicBlock *BB, Value *V) |
Indicate that a rewritten value is available in the specified block with the specified value. More... | |
void | AddUse (unsigned Var, Use *U) |
Record a use of the symbolic value. More... | |
bool | HasValueForBlock (unsigned Var, BasicBlock *BB) |
Return true if the SSAUpdater already has a value for the specified variable in the specified block. More... | |
void | RewriteAllUses (DominatorTree *DT, SmallVectorImpl< PHINode *> *InsertedPHIs=nullptr) |
Perform all the necessary updates, including new PHI-nodes insertion and the requested uses update. More... | |
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. The update is done only when RewriteAllUses is called, all other methods are used for book-keeping. That helps to share some common computations between updates of different uses (which is not the case when traditional SSAUpdater is used).
Definition at line 41 of file SSAUpdaterBulk.h.
|
inlineexplicit |
Definition at line 57 of file SSAUpdaterBulk.h.
References operator=().
|
delete |
|
inline |
Definition at line 60 of file SSAUpdaterBulk.h.
References AddAvailableValue(), AddUse(), AddVariable(), HasValueForBlock(), Name, and RewriteAllUses().
void SSAUpdaterBulk::AddAvailableValue | ( | unsigned | Var, |
BasicBlock * | BB, | ||
Value * | V | ||
) |
Indicate that a rewritten value is available in the specified block with the specified value.
Definition at line 52 of file SSAUpdaterBulk.cpp.
References assert(), llvm::dbgs(), llvm::Value::getName(), LLVM_DEBUG, and llvm::SmallVectorBase::size().
Referenced by ~SSAUpdaterBulk().
Record a use of the symbolic value.
This use will be updated with a rewritten value when RewriteAllUses is called.
Definition at line 62 of file SSAUpdaterBulk.cpp.
References assert(), llvm::dbgs(), llvm::Value::getName(), getUserBB(), LLVM_DEBUG, llvm::SmallVectorTemplateBase< T, bool >::push_back(), and llvm::SmallVectorBase::size().
Referenced by ~SSAUpdaterBulk().
Add a new variable to the SSA rewriter.
This needs to be called before AddAvailableValue or AddUse calls. The return value is the variable ID, which needs to be passed to AddAvailableValue and AddUse.
This needs to be called before AddAvailableValue or AddUse calls.
Definition at line 41 of file SSAUpdaterBulk.cpp.
References llvm::dbgs(), LLVM_DEBUG, llvm::SmallVectorTemplateBase< T, bool >::push_back(), and llvm::SmallVectorBase::size().
Referenced by ~SSAUpdaterBulk().
bool SSAUpdaterBulk::HasValueForBlock | ( | unsigned | Var, |
BasicBlock * | BB | ||
) |
Return true if the SSAUpdater already has a value for the specified variable in the specified block.
Definition at line 71 of file SSAUpdaterBulk.cpp.
References llvm::PredIteratorCache::get(), llvm::UndefValue::get(), llvm::DomTreeNodeBase< NodeT >::getBlock(), llvm::DomTreeNodeBase< NodeT >::getIDom(), llvm::DominatorTreeBase< NodeT, IsPostDom >::getNode(), llvm::DominatorTree::isReachableFromEntry(), and llvm::SmallVectorBase::size().
Referenced by ~SSAUpdaterBulk().
|
delete |
Referenced by SSAUpdaterBulk().
void SSAUpdaterBulk::RewriteAllUses | ( | DominatorTree * | DT, |
SmallVectorImpl< PHINode *> * | InsertedPHIs = nullptr |
||
) |
Perform all the necessary updates, including new PHI-nodes insertion and the requested uses update.
The function requires dominator tree DT, which is used for computing locations for new phi-nodes insertions. If a nonnull pointer to a vector InsertedPHIs is passed, all the new phi-nodes will be added to this vector.
Definition at line 129 of file SSAUpdaterBulk.cpp.
References assert(), B, llvm::IDFCalculator< NodeTy, IsPostDom >::calculate(), ComputeLiveInBlocks(), llvm::dbgs(), llvm::tgtok::Def, llvm::PredIteratorCache::get(), llvm::BasicBlock::getParent(), getUserBB(), llvm::Value::hasValueHandle(), llvm::SmallPtrSetImpl< PtrType >::insert(), LLVM_DEBUG, llvm::SmallVectorTemplateBase< T >::push_back(), llvm::IDFCalculator< NodeTy, IsPostDom >::resetLiveInBlocks(), llvm::IDFCalculator< NodeTy, IsPostDom >::setDefiningBlocks(), llvm::IDFCalculator< NodeTy, IsPostDom >::setLiveInBlocks(), and llvm::ValueHandleBase::ValueIsRAUWd().
Referenced by ~SSAUpdaterBulk().