LLVM API Documentation
Helper class for promoting a collection of loads and stores into SSA Form using the SSAUpdater. More...
#include <SSAUpdater.h>
Public Member Functions | |
LoadAndStorePromoter (const SmallVectorImpl< Instruction * > &Insts, SSAUpdater &S, StringRef Name=StringRef()) | |
virtual | ~LoadAndStorePromoter () |
void | run (const SmallVectorImpl< Instruction * > &Insts) const |
This does the promotion. | |
virtual bool | isInstInList (Instruction *I, const SmallVectorImpl< Instruction * > &Insts) const |
Return true if the specified instruction is in the Inst list. | |
virtual void | doExtraRewritesBeforeFinalDeletion () const |
This hook is invoked after all the stores are found and inserted as available values. | |
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. | |
virtual void | instructionDeleted (Instruction *I) const |
Called before each instruction is deleted. | |
virtual void | updateDebugInfo (Instruction *I) const |
Called to update debug info associated with the instruction. | |
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 133 of file SSAUpdater.h.
LoadAndStorePromoter::LoadAndStorePromoter | ( | const SmallVectorImpl< Instruction * > & | Insts, |
SSAUpdater & | S, | ||
StringRef | Name = StringRef() |
||
) |
Definition at line 324 of file SSAUpdater.cpp.
References llvm::SmallVectorBase::empty(), llvm::StringRef::empty(), llvm::Value::getName(), llvm::Value::getType(), llvm::SSAUpdater::Initialize(), LI, and SSA.
virtual llvm::LoadAndStorePromoter::~LoadAndStorePromoter | ( | ) | [inline, virtual] |
Definition at line 140 of file SSAUpdater.h.
virtual void llvm::LoadAndStorePromoter::doExtraRewritesBeforeFinalDeletion | ( | ) | const [inline, virtual] |
This hook is invoked after all the stores are found and inserted as available values.
Definition at line 158 of file SSAUpdater.h.
Referenced by run().
virtual void llvm::LoadAndStorePromoter::instructionDeleted | ( | Instruction * | I | ) | const [inline, virtual] |
Called before each instruction is deleted.
Definition at line 167 of file SSAUpdater.h.
Referenced by run().
bool LoadAndStorePromoter::isInstInList | ( | Instruction * | I, |
const SmallVectorImpl< Instruction * > & | Insts | ||
) | const [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 487 of file SSAUpdater.cpp.
References llvm::SmallVectorTemplateCommon< T, typename >::begin(), llvm::SmallVectorTemplateCommon< T, typename >::end(), and I.
Referenced by run().
virtual void llvm::LoadAndStorePromoter::replaceLoadWithValue | ( | LoadInst * | LI, |
Value * | V | ||
) | const [inline, virtual] |
Clients can choose to implement this to get notified right before a load is RAUW'd another value.
Definition at line 163 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 341 of file SSAUpdater.cpp.
References llvm::SSAUpdater::AddAvailableValue(), llvm::BasicBlock::begin(), llvm::TinyPtrVector< EltTy >::clear(), doExtraRewritesBeforeFinalDeletion(), llvm::TinyPtrVector< EltTy >::empty(), llvm::DenseMapBase< DenseMap< KeyT, ValueT, KeyInfoT >, KeyT, ValueT, KeyInfoT >::end(), llvm::BasicBlock::end(), llvm::Instruction::eraseFromParent(), llvm::DenseMapBase< DenseMap< KeyT, ValueT, KeyInfoT >, KeyT, ValueT, KeyInfoT >::find(), llvm::UndefValue::get(), llvm::Instruction::getParent(), llvm::Value::getType(), llvm::SSAUpdater::GetValueInMiddleOfBlock(), instructionDeleted(), isInstInList(), llvm::SmallVectorTemplateBase< T, isPodLike< T >::value >::push_back(), llvm::Value::replaceAllUsesWith(), replaceLoadWithValue(), llvm::TinyPtrVector< EltTy >::size(), llvm::SmallVectorTemplateCommon< T >::size(), llvm::SmallVectorTemplateCommon< T, typename >::size(), SSA, updateDebugInfo(), and llvm::Value::use_empty().
virtual void llvm::LoadAndStorePromoter::updateDebugInfo | ( | Instruction * | I | ) | const [inline, virtual] |
Called to update debug info associated with the instruction.
Definition at line 171 of file SSAUpdater.h.
Referenced by run().
SSAUpdater& llvm::LoadAndStorePromoter::SSA [protected] |
Definition at line 135 of file SSAUpdater.h.
Referenced by LoadAndStorePromoter(), and run().