LLVM
8.0.1
|
Helper class for promoting a collection of loads and stores into SSA Form using the SSAUpdater. More...
#include "llvm/Transforms/Utils/SSAUpdater.h"
Public Member Functions | |
LoadAndStorePromoter (ArrayRef< const Instruction *> Insts, SSAUpdater &S, StringRef Name=StringRef()) | |
virtual | ~LoadAndStorePromoter ()=default |
void | run (const SmallVectorImpl< Instruction *> &Insts) const |
This does the promotion. More... | |
virtual bool | isInstInList (Instruction *I, const SmallVectorImpl< Instruction *> &Insts) const |
Return true if the specified instruction is in the Inst list. More... | |
virtual void | doExtraRewritesBeforeFinalDeletion () const |
This hook is invoked after all the stores are found and inserted as available values. More... | |
virtual void | replaceLoadWithValue (LoadInst *LI, Value *V) const |
Clients can choose to implement this to get notified right before a load is RAUW'd another value. More... | |
virtual void | instructionDeleted (Instruction *I) const |
Called before each instruction is deleted. More... | |
virtual void | updateDebugInfo (Instruction *I) const |
Called to update debug info associated with the instruction. More... | |
Protected Attributes | |
SSAUpdater & | SSA |
Helper class for promoting a collection of loads and stores into SSA Form using the SSAUpdater.
This handles complexities that SSAUpdater doesn't, such as multiple loads and stores in one block.
Clients of this class are expected to subclass this and implement the virtual methods.
Definition at line 137 of file SSAUpdater.h.
LoadAndStorePromoter::LoadAndStorePromoter | ( | ArrayRef< const Instruction *> | Insts, |
SSAUpdater & | S, | ||
StringRef | Name = StringRef() |
||
) |
Definition at line 338 of file SSAUpdater.cpp.
References llvm::StringRef::empty(), llvm::ArrayRef< T >::empty(), llvm::Value::getName(), llvm::Value::getType(), llvm::SSAUpdater::Initialize(), run(), and SSA.
Referenced by llvm::SSAUpdaterTraits< SSAUpdater >::GetPHIValue().
|
virtualdefault |
|
inlinevirtual |
This hook is invoked after all the stores are found and inserted as available values.
Definition at line 162 of file SSAUpdater.h.
Referenced by run().
|
inlinevirtual |
Called before each instruction is deleted.
Definition at line 169 of file SSAUpdater.h.
Referenced by run().
|
virtual |
Return true if the specified instruction is in the Inst list.
The Insts list is the one passed into the constructor. Clients should implement this with a more efficient version if possible.
Definition at line 493 of file SSAUpdater.cpp.
References llvm::is_contained().
Referenced by run().
|
inlinevirtual |
Clients can choose to implement this to get notified right before a load is RAUW'd another value.
Definition at line 166 of file SSAUpdater.h.
Referenced by run().
void LoadAndStorePromoter::run | ( | const SmallVectorImpl< Instruction *> & | Insts | ) | const |
This does the promotion.
Insts is a list of loads and stores to promote, and Name is the basename for the PHIs to insert. After this is complete, the loads and stores are removed from the code.
Definition at line 354 of file SSAUpdater.cpp.
References llvm::SSAUpdater::AddAvailableValue(), assert(), llvm::TinyPtrVector< EltTy >::clear(), doExtraRewritesBeforeFinalDeletion(), llvm::TinyPtrVector< EltTy >::empty(), llvm::DenseMapBase< DenseMap< KeyT, ValueT, KeyInfoT, BucketT >, KeyT, ValueT, KeyInfoT, BucketT >::end(), llvm::DenseMapBase< DenseMap< KeyT, ValueT, KeyInfoT, BucketT >, KeyT, ValueT, KeyInfoT, BucketT >::find(), llvm::UndefValue::get(), llvm::Value::getType(), llvm::SSAUpdater::GetValueInMiddleOfBlock(), I, instructionDeleted(), isInstInList(), llvm::SmallVectorTemplateBase< T >::push_back(), llvm::Value::replaceAllUsesWith(), replaceLoadWithValue(), SI, llvm::TinyPtrVector< EltTy >::size(), SSA, updateDebugInfo(), and llvm::Value::use_empty().
Referenced by LoadAndStorePromoter().
|
inlinevirtual |
Called to update debug info associated with the instruction.
Definition at line 172 of file SSAUpdater.h.
Referenced by run().
|
protected |
Definition at line 139 of file SSAUpdater.h.
Referenced by LoadAndStorePromoter(), and run().