Adjust to implement new AA interface
authorChris Lattner <sabre@nondot.org>
Wed, 26 Feb 2003 19:29:36 +0000 (19:29 +0000)
committerChris Lattner <sabre@nondot.org>
Wed, 26 Feb 2003 19:29:36 +0000 (19:29 +0000)
git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@5638 91177308-0d34-0410-b5e6-96231b3b80d8

lib/Analysis/DataStructure/DataStructureAA.cpp
lib/Analysis/DataStructure/Steensgaard.cpp

index 1778574f46ed2b0fde2d9864f4c08888395b53a9..5c3d946478a474738dd4897dad47b3266fd1f2a5 100644 (file)
@@ -24,11 +24,13 @@ namespace {
     // program.
     //
     bool run(Module &M) {
+      InitializeAliasAnalysis(this);
       TD = &getAnalysis<TDDataStructures>();
       return false;
     }
 
     virtual void getAnalysisUsage(AnalysisUsage &AU) const {
+      AliasAnalysis::getAnalysisUsage(AU);
       AU.setPreservesAll();                    // Does not transform code...
       AU.addRequired<TDDataStructures>();      // Uses TD Datastructures
       AU.addRequired<AliasAnalysis>();         // Chains to another AA impl...
@@ -39,19 +41,8 @@ namespace {
     //  
 
     // alias - This is the only method here that does anything interesting...
-    Result alias(const Value *V1, const Value *V2);
-    
-    /// canCallModify - Not implemented yet: FIXME
-    ///
-    Result canCallModify(const CallInst &CI, const Value *Ptr) {
-      return MayAlias;
-    }
-    
-    /// canInvokeModify - Not implemented yet: FIXME
-    ///
-    Result canInvokeModify(const InvokeInst &I, const Value *Ptr) {
-      return MayAlias;
-    }
+    AliasResult alias(const Value *V1, unsigned V1Size,
+                      const Value *V2, unsigned V2Size);
   };
 
   // Register the pass...
@@ -75,7 +66,9 @@ static const Function *getValueFunction(const Value *V) {
 }
 
 // alias - This is the only method here that does anything interesting...
-AliasAnalysis::Result DSAA::alias(const Value *V1, const Value *V2) {
+AliasAnalysis::AliasResult DSAA::alias(const Value *V1, unsigned V1Size,
+                                       const Value *V2, unsigned V2Size) {
+  // FIXME: This should handle the Size argument as well!
   const Function *F1 = getValueFunction(V1);
   const Function *F2 = getValueFunction(V2);
   assert((!F1 || !F2 || F1 == F2) && "Alias query for 2 different functions?");
@@ -113,5 +106,5 @@ AliasAnalysis::Result DSAA::alias(const Value *V1, const Value *V2) {
 
   // FIXME: we could improve on this by checking the globals graph for aliased
   // global queries...
-  return getAnalysis<AliasAnalysis>().alias(V1, V2);
+  return getAnalysis<AliasAnalysis>().alias(V1, V1Size, V2, V2Size);
 }
index 94b63d77a6158d85427d53d6194f9d7a1121b390..2f370258ff766af93c18c6580dcf530fafcf8bd8 100644 (file)
@@ -18,7 +18,7 @@ namespace {
     DSGraph *ResultGraph;
     DSGraph *GlobalsGraph;  // FIXME: Eliminate globals graph stuff from DNE
   public:
-    Steens() : ResultGraph(0) {}
+    Steens() : ResultGraph(0), GlobalsGraph(0) {}
     ~Steens() {
       releaseMyMemory();
       assert(ResultGraph == 0 && "releaseMemory not called?");
@@ -36,6 +36,7 @@ namespace {
     virtual void releaseMyMemory() { delete ResultGraph; ResultGraph = 0; }
 
     virtual void getAnalysisUsage(AnalysisUsage &AU) const {
+      AliasAnalysis::getAnalysisUsage(AU);
       AU.setPreservesAll();                    // Does not transform code...
       AU.addRequired<LocalDataStructures>();   // Uses local dsgraph
       AU.addRequired<AliasAnalysis>();         // Chains to another AA impl...
@@ -52,20 +53,9 @@ namespace {
     //  
 
     // alias - This is the only method here that does anything interesting...
-    Result alias(const Value *V1, const Value *V2);
+    AliasResult alias(const Value *V1, unsigned V1Size,
+                      const Value *V2, unsigned V2Size);
     
-    /// canCallModify - Not implemented yet: FIXME
-    ///
-    Result canCallModify(const CallInst &CI, const Value *Ptr) {
-      return MayAlias;
-    }
-    
-    /// canInvokeModify - Not implemented yet: FIXME
-    ///
-    Result canInvokeModify(const InvokeInst &I, const Value *Ptr) {
-      return MayAlias;
-    }
-
   private:
     void ResolveFunctionCall(Function *F, const DSCallSite &Call,
                              DSNodeHandle &RetVal);
@@ -108,6 +98,7 @@ void Steens::ResolveFunctionCall(Function *F, const DSCallSite &Call,
 /// program.
 ///
 bool Steens::run(Module &M) {
+  InitializeAliasAnalysis(this);
   assert(ResultGraph == 0 && "Result graph already allocated!");
   LocalDataStructures &LDS = getAnalysis<LocalDataStructures>();
 
@@ -212,7 +203,9 @@ bool Steens::run(Module &M) {
 }
 
 // alias - This is the only method here that does anything interesting...
-AliasAnalysis::Result Steens::alias(const Value *V1, const Value *V2) {
+AliasAnalysis::AliasResult Steens::alias(const Value *V1, unsigned V1Size,
+                                         const Value *V2, unsigned V2Size) {
+  // FIXME: HANDLE Size argument!
   assert(ResultGraph && "Result graph has not been computed yet!");
 
   hash_map<Value*, DSNodeHandle> &GSM = ResultGraph->getScalarMap();
@@ -239,5 +232,5 @@ AliasAnalysis::Result Steens::alias(const Value *V1, const Value *V2) {
   // If we cannot determine alias properties based on our graph, fall back on
   // some other AA implementation.
   //
-  return getAnalysis<AliasAnalysis>().alias(V1, V2);
+  return getAnalysis<AliasAnalysis>().alias(V1, V1Size, V2, V2Size);
 }