[llvm-commits] CVS: llvm/include/llvm/Analysis/IPModRef.h

Chris Lattner lattner at cs.uiuc.edu
Wed Nov 6 12:39:01 PST 2002


Changes in directory llvm/include/llvm/Analysis:

IPModRef.h updated: 1.1 -> 1.2

---
Log message:

Remove a couple of #includes, move some code to .cpp file


---
Diffs of the changes:

Index: llvm/include/llvm/Analysis/IPModRef.h
diff -u llvm/include/llvm/Analysis/IPModRef.h:1.1 llvm/include/llvm/Analysis/IPModRef.h:1.2
--- llvm/include/llvm/Analysis/IPModRef.h:1.1	Wed Nov  6 11:01:46 2002
+++ llvm/include/llvm/Analysis/IPModRef.h	Wed Nov  6 12:38:10 2002
@@ -33,15 +33,12 @@
 // class IPModRef is primarily meant for other analysis passes that need to
 // use Mod/Ref information efficiently for more complicated purposes;
 // the bit-vector representations make propagation very efficient.
+//
 //===----------------------------------------------------------------------===//
 
-
 #ifndef LLVM_ANALYSIS_IPMODREF_H
 #define LLVM_ANALYSIS_IPMODREF_H
 
-
-#include "llvm/Analysis/DataStructure.h"
-#include "llvm/Analysis/DSGraph.h"
 #include "llvm/Pass.h"
 #include "Support/BitSetVector.h"
 #include "Support/NonCopyable.h"
@@ -49,12 +46,12 @@
 class Module;
 class Function;
 class CallInst;
+class DSNode;
 class DSGraph;
 class ModRefInfo;               // Result of IP Mod/Ref for one entity
 class FunctionModRefInfo;       // ModRefInfo for a func and all calls in it
 class IPModRef;                 // Pass that computes IP Mod/Ref info
 
-
 //---------------------------------------------------------------------------
 // class ModRefInfo 
 // 
@@ -67,7 +64,7 @@
 class ModRefInfo {
   BitSetVector   modNodeSet;            // set of modified nodes
   BitSetVector   refNodeSet;            // set of referenced nodes
-
+  
 public:
   // 
   // Methods to construct ModRefInfo objects.
@@ -76,6 +73,12 @@
     : modNodeSet(numNodes),
       refNodeSet(numNodes) { }
 
+  unsigned getSize() const {
+    assert(modNodeSet.size() == refNodeSet.size() &&
+           "Mod & Ref different size?");
+    return modNodeSet.size();
+  }
+
   void setNodeIsMod (unsigned nodeId)   { modNodeSet[nodeId] = true; }
   void setNodeIsRef (unsigned nodeId)   { refNodeSet[nodeId] = true; }
 
@@ -148,14 +151,12 @@
   //
   unsigned              getNodeId       (const DSNode* node) const {
     std::map<const DSNode*, unsigned>::const_iterator iter = NodeIds.find(node);
-    assert(iter == NodeIds.end() || iter->second < funcTDGraph.getGraphSize());
-    return (iter == NodeIds.end())? funcTDGraph.getGraphSize() : iter->second;
-  }
-  unsigned              getNodeId       (const Value* value) const {
-    return getNodeId(funcTDGraph.getNodeForValue(const_cast<Value*>(value))
-                     .getNode());
+    assert(iter == NodeIds.end() || iter->second < funcModRefInfo.getSize());
+    return (iter == NodeIds.end())? funcModRefInfo.getSize() : iter->second;
   }
 
+  unsigned              getNodeId       (const Value* value) const;
+
   // Debugging support methods
   void print(std::ostream &O) const;
   void dump() const;
@@ -181,20 +182,7 @@
   Module* M;
 
   FunctionModRefInfo& getFuncInfo(const Function& func,
-                                  bool computeIfMissing = false)
-  {
-    FunctionModRefInfo*& funcInfo = funcToModRefInfoMap[&func];
-    assert (funcInfo != NULL || computeIfMissing);
-    if (funcInfo == NULL && computeIfMissing)
-      { // Create a new FunctionModRefInfo object
-        funcInfo = new FunctionModRefInfo(func,  // inserts into map
-                          getAnalysis<TDDataStructures>().getDSGraph(func),
-                          getAnalysis<LocalDataStructures>().getDSGraph(func));
-        funcInfo->computeModRef(func);            // computes the mod/ref info
-      }
-    return *funcInfo;
-  }
-
+                                  bool computeIfMissing = false);
 public:
   IPModRef() : M(NULL)  { }
   ~IPModRef()           { }
@@ -223,11 +211,7 @@
   // getAnalysisUsage - This pass requires top-down data structure graphs.
   // It modifies nothing.
   // 
-  virtual void getAnalysisUsage(AnalysisUsage &AU) const {
-    AU.setPreservesAll();
-    AU.addRequired<LocalDataStructures>();
-    AU.addRequired<TDDataStructures>();
-  }
+  virtual void getAnalysisUsage(AnalysisUsage &AU) const;
 };
 
 //===----------------------------------------------------------------------===//





More information about the llvm-commits mailing list