aboutsummaryrefslogtreecommitdiffstats
path: root/include/llvm/Transforms/Utils/SSAUpdater.h
diff options
context:
space:
mode:
authorChris Lattner <sabre@nondot.org>2011-01-15 00:12:35 +0000
committerChris Lattner <sabre@nondot.org>2011-01-15 00:12:35 +0000
commitdeaf55f69865bbc997a569c2a689ec5b0fbdefef (patch)
treec7f3f96edd91421c205f0f1ed42427ec2934a995 /include/llvm/Transforms/Utils/SSAUpdater.h
parentca3f06963c21ee34c7454be807c4d72af3b0f3ad (diff)
downloadexternal_llvm-deaf55f69865bbc997a569c2a689ec5b0fbdefef.zip
external_llvm-deaf55f69865bbc997a569c2a689ec5b0fbdefef.tar.gz
external_llvm-deaf55f69865bbc997a569c2a689ec5b0fbdefef.tar.bz2
Generalize LoadAndStorePromoter a bit and switch LICM
to use it. git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@123501 91177308-0d34-0410-b5e6-96231b3b80d8
Diffstat (limited to 'include/llvm/Transforms/Utils/SSAUpdater.h')
-rw-r--r--include/llvm/Transforms/Utils/SSAUpdater.h23
1 files changed, 20 insertions, 3 deletions
diff --git a/include/llvm/Transforms/Utils/SSAUpdater.h b/include/llvm/Transforms/Utils/SSAUpdater.h
index 9e79aca..b4048b9 100644
--- a/include/llvm/Transforms/Utils/SSAUpdater.h
+++ b/include/llvm/Transforms/Utils/SSAUpdater.h
@@ -118,15 +118,17 @@ private:
/// virtual methods.
///
class LoadAndStorePromoter {
+protected:
+ SSAUpdater &SSA;
public:
- LoadAndStorePromoter() {}
+ LoadAndStorePromoter(const SmallVectorImpl<Instruction*> &Insts,
+ SSAUpdater &S, StringRef Name = StringRef());
virtual ~LoadAndStorePromoter() {}
/// run - 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.
- void run(StringRef Name, const SmallVectorImpl<Instruction*> &Insts,
- SSAUpdater *SSA = 0);
+ void run(const SmallVectorImpl<Instruction*> &Insts) const;
/// Return true if the specified instruction is in the Inst list (which was
@@ -139,6 +141,21 @@ public:
return true;
return false;
}
+
+ /// doExtraRewritesBeforeFinalDeletion - This hook is invoked after all the
+ /// stores are found and inserted as available values, but
+ virtual void doExtraRewritesBeforeFinalDeletion() const {
+ }
+
+ /// replaceLoadWithValue - Clients can choose to implement this to get
+ /// notified right before a load is RAUW'd another value.
+ virtual void replaceLoadWithValue(LoadInst *LI, Value *V) const {
+ }
+
+ /// This is called before each instruction is deleted.
+ virtual void instructionDeleted(Instruction *I) const {
+ }
+
};
} // End llvm namespace