adopt getAdjustedAnalysisPointer in a few more passes.
authorChris Lattner <sabre@nondot.org>
Wed, 20 Jan 2010 20:09:02 +0000 (20:09 +0000)
committerChris Lattner <sabre@nondot.org>
Wed, 20 Jan 2010 20:09:02 +0000 (20:09 +0000)
git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@94018 91177308-0d34-0410-b5e6-96231b3b80d8

lib/Analysis/AliasAnalysisCounter.cpp
lib/Analysis/AliasDebugger.cpp
lib/Analysis/ProfileEstimatorPass.cpp
lib/Analysis/ProfileInfo.cpp
lib/Analysis/ProfileInfoLoaderPass.cpp
lib/Analysis/ScalarEvolutionAliasAnalysis.cpp

index ae28b55959c62c8b49beffe03b7dd8c64bcf14d6..cfb354915b6b0e7277b56660175961909d561b8b 100644 (file)
@@ -85,6 +85,16 @@ namespace {
       AU.setPreservesAll();
     }
 
+    /// getAdjustedAnalysisPointer - This method is used when a pass implements
+    /// an analysis interface through multiple inheritance.  If needed, it
+    /// should override this to adjust the this pointer as needed for the
+    /// specified pass info.
+    virtual void *getAdjustedAnalysisPointer(const PassInfo *PI) {
+      if (PI->isPassID(&AliasAnalysis::ID))
+        return (AliasAnalysis*)this;
+      return this;
+    }
+    
     // FIXME: We could count these too...
     bool pointsToConstantMemory(const Value *P) {
       return getAnalysis<AliasAnalysis>().pointsToConstantMemory(P);
index 6868e3f2cef26d76e85733eab47715aa9a254720..88c2875e83758572d55c2baa890b9294099b9424 100644 (file)
@@ -71,6 +71,16 @@ namespace {
       AU.setPreservesAll();                         // Does not transform code
     }
 
+    /// getAdjustedAnalysisPointer - This method is used when a pass implements
+    /// an analysis interface through multiple inheritance.  If needed, it
+    /// should override this to adjust the this pointer as needed for the
+    /// specified pass info.
+    virtual void *getAdjustedAnalysisPointer(const PassInfo *PI) {
+      if (PI->isPassID(&AliasAnalysis::ID))
+        return (AliasAnalysis*)this;
+      return this;
+    }
+    
     //------------------------------------------------
     // Implement the AliasAnalysis API
     //
index cf9311aead52095c6ac90bf7d64621512a8922c9..bce6b310ce0672ba36155d101ef7ddd88f7773b2 100644 (file)
@@ -55,6 +55,16 @@ namespace {
     /// run - Estimate the profile information from the specified file.
     virtual bool runOnFunction(Function &F);
 
+    /// getAdjustedAnalysisPointer - This method is used when a pass implements
+    /// an analysis interface through multiple inheritance.  If needed, it
+    /// should override this to adjust the this pointer as needed for the
+    /// specified pass info.
+    virtual void *getAdjustedAnalysisPointer(const PassInfo *PI) {
+      if (PI->isPassID(&ProfileInfo::ID))
+        return (ProfileInfo*)this;
+      return this;
+    }
+    
     virtual void recurseBasicBlock(BasicBlock *BB);
 
     void inline printEdgeWeight(Edge);
index afd86b156b29bc07a4d1c158087418381c76282d..85531be76add0b2e0e1650e18afc0535a5560f9d 100644 (file)
@@ -1079,6 +1079,20 @@ namespace {
   struct NoProfileInfo : public ImmutablePass, public ProfileInfo {
     static char ID; // Class identification, replacement for typeinfo
     NoProfileInfo() : ImmutablePass(&ID) {}
+    
+    /// getAdjustedAnalysisPointer - This method is used when a pass implements
+    /// an analysis interface through multiple inheritance.  If needed, it
+    /// should override this to adjust the this pointer as needed for the
+    /// specified pass info.
+    virtual void *getAdjustedAnalysisPointer(const PassInfo *PI) {
+      if (PI->isPassID(&ProfileInfo::ID))
+        return (ProfileInfo*)this;
+      return this;
+    }
+    
+    virtual const char *getPassName() const {
+      return "NoProfileInfo";
+    }
   };
 }  // End of anonymous namespace
 
index d8c511f344d542fde3a737d2398784751d3cd61d..ac9ed524deefa6dc1c20deeba8537a67d5484745 100644 (file)
@@ -63,6 +63,16 @@ namespace {
     virtual void readEdgeOrRemember(Edge, Edge&, unsigned &, double &);
     virtual void readEdge(ProfileInfo::Edge, std::vector<unsigned>&);
 
+    /// getAdjustedAnalysisPointer - This method is used when a pass implements
+    /// an analysis interface through multiple inheritance.  If needed, it
+    /// should override this to adjust the this pointer as needed for the
+    /// specified pass info.
+    virtual void *getAdjustedAnalysisPointer(const PassInfo *PI) {
+      if (PI->isPassID(&ProfileInfo::ID))
+        return (ProfileInfo*)this;
+      return this;
+    }
+    
     /// run - Load the profile information from the specified file.
     virtual bool runOnModule(Module &M);
   };
index ef0e97b6e10ebdc4a4562b6c27af58442ad5268d..498c4a876c9807eced75f9c19898ccdbff929eb2 100644 (file)
@@ -32,6 +32,16 @@ namespace {
     static char ID; // Class identification, replacement for typeinfo
     ScalarEvolutionAliasAnalysis() : FunctionPass(&ID), SE(0) {}
 
+    /// getAdjustedAnalysisPointer - This method is used when a pass implements
+    /// an analysis interface through multiple inheritance.  If needed, it
+    /// should override this to adjust the this pointer as needed for the
+    /// specified pass info.
+    virtual void *getAdjustedAnalysisPointer(const PassInfo *PI) {
+      if (PI->isPassID(&AliasAnalysis::ID))
+        return (AliasAnalysis*)this;
+      return this;
+    }
+                                         
   private:
     virtual void getAnalysisUsage(AnalysisUsage &AU) const;
     virtual bool runOnFunction(Function &F);