LLVM 22.0.0git
|
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) |
This does the promotion. | |
virtual void | doExtraRewritesBeforeFinalDeletion () |
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. | |
virtual bool | shouldDelete (Instruction *I) const |
Return false if a sub-class wants to keep one of the loads/stores after the SSA construction. | |
virtual Value * | getValueToUseForAlloca (Instruction *AI) const |
Return the value to use for the point in the code that the alloca is positioned. |
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 147 of file SSAUpdater.h.
LoadAndStorePromoter::LoadAndStorePromoter | ( | ArrayRef< const Instruction * > | Insts, |
SSAUpdater & | S, | ||
StringRef | Name = StringRef() ) |
Definition at line 353 of file SSAUpdater.cpp.
References llvm::cast(), llvm::dyn_cast(), llvm::ArrayRef< T >::empty(), llvm::StringRef::empty(), if(), and SSA.
Referenced by BasicLoadAndStorePromoter::BasicLoadAndStorePromoter().
|
virtualdefault |
|
inlinevirtual |
This hook is invoked after all the stores are found and inserted as available values.
Definition at line 165 of file SSAUpdater.h.
Referenced by run().
|
inlinevirtual |
Return the value to use for the point in the code that the alloca is positioned.
This will only be used if an Alloca is included in Insts, otherwise the value of a uninitialized load will be assumed to be poison.
Reimplemented in BasicLoadAndStorePromoter.
Definition at line 184 of file SSAUpdater.h.
Referenced by run().
|
inlinevirtual |
Called before each instruction is deleted.
Definition at line 172 of file SSAUpdater.h.
References I.
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 169 of file SSAUpdater.h.
Referenced by run().
void LoadAndStorePromoter::run | ( | const SmallVectorImpl< Instruction * > & | Insts | ) |
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 369 of file SSAUpdater.cpp.
References A(), assert(), B(), llvm::TinyPtrVector< EltTy >::begin(), llvm::cast(), llvm::TinyPtrVector< EltTy >::clear(), doExtraRewritesBeforeFinalDeletion(), llvm::dyn_cast(), llvm::TinyPtrVector< EltTy >::empty(), llvm::DenseMapBase< DerivedT, KeyT, ValueT, KeyInfoT, BucketT >::end(), llvm::TinyPtrVector< EltTy >::end(), llvm::DenseMapBase< DerivedT, KeyT, ValueT, KeyInfoT, BucketT >::find(), llvm::PoisonValue::get(), llvm::Value::getType(), getValueToUseForAlloca(), I, instructionDeleted(), llvm::isa(), llvm::SmallVectorTemplateBase< T, bool >::push_back(), llvm::Value::replaceAllUsesWith(), replaceLoadWithValue(), shouldDelete(), llvm::TinyPtrVector< EltTy >::size(), llvm::sort(), SSA, updateDebugInfo(), and llvm::Value::use_empty().
|
inlinevirtual |
Return false if a sub-class wants to keep one of the loads/stores after the SSA construction.
Reimplemented in BasicLoadAndStorePromoter.
Definition at line 179 of file SSAUpdater.h.
References I.
Referenced by run().
|
inlinevirtual |
Called to update debug info associated with the instruction.
Definition at line 175 of file SSAUpdater.h.
References I.
Referenced by run().
|
protected |
Definition at line 149 of file SSAUpdater.h.
Referenced by LoadAndStorePromoter(), and run().