[llvm-commits] CVS: llvm/include/llvm/Analysis/DSGraph.h DSNode.h DSSupport.h DataStructure.h

Chris Lattner lattner at cs.uiuc.edu
Sun Nov 2 16:28:08 PST 2003


Changes in directory llvm/include/llvm/Analysis:

DSGraph.h updated: 1.60 -> 1.61
DSNode.h updated: 1.31 -> 1.32
DSSupport.h updated: 1.24 -> 1.25
DataStructure.h updated: 1.73 -> 1.74

---
Log message:

All DSGraphs keep a reference to the targetdata they are created with.  This is
used to eliminate the hard coded, hacked in, sparc specific, global TargetData.
Changing the TargetData used to actually match the code fixes problems, and 
eliminates a crash.


---
Diffs of the changes:  (+25 -6)

Index: llvm/include/llvm/Analysis/DSGraph.h
diff -u llvm/include/llvm/Analysis/DSGraph.h:1.60 llvm/include/llvm/Analysis/DSGraph.h:1.61
--- llvm/include/llvm/Analysis/DSGraph.h:1.60	Mon Oct 20 15:19:17 2003
+++ llvm/include/llvm/Analysis/DSGraph.h	Sun Nov  2 16:27:15 2003
@@ -62,12 +62,19 @@
   // 
   GlobalSetTy InlinedGlobals;
 
+  /// TD - This is the target data object for the machine this graph is
+  /// constructed for.
+  const TargetData &TD;
+
   void operator=(const DSGraph &); // DO NOT IMPLEMENT
 
 public:
   // Create a new, empty, DSGraph.
-  DSGraph() : GlobalsGraph(0), PrintAuxCalls(false) {}
-  DSGraph(Function &F, DSGraph *GlobalsGraph); // Compute the local DSGraph
+  DSGraph(const TargetData &td)
+    : GlobalsGraph(0), PrintAuxCalls(false), TD(td) {}
+
+  // Compute the local DSGraph
+  DSGraph(const TargetData &td, Function &F, DSGraph *GlobalsGraph);
 
   // Copy ctor - If you want to capture the node mapping between the source and
   // destination graph, you may optionally do this by specifying a map to record
@@ -84,9 +91,13 @@
   DSGraph *getGlobalsGraph() const { return GlobalsGraph; }
   void setGlobalsGraph(DSGraph *G) { GlobalsGraph = G; }
 
-  // setPrintAuxCalls - If you call this method, the auxillary call vector will
-  // be printed instead of the standard call vector to the dot file.
-  //
+  /// getTargetData - Return the TargetData object for the current target.
+  ///
+  const TargetData &getTargetData() const { return TD; }
+
+  /// setPrintAuxCalls - If you call this method, the auxillary call vector will
+  /// be printed instead of the standard call vector to the dot file.
+  ///
   void setPrintAuxCalls() { PrintAuxCalls = true; }
   bool shouldPrintAuxCalls() const { return PrintAuxCalls; }
 


Index: llvm/include/llvm/Analysis/DSNode.h
diff -u llvm/include/llvm/Analysis/DSNode.h:1.31 llvm/include/llvm/Analysis/DSNode.h:1.32
--- llvm/include/llvm/Analysis/DSNode.h:1.31	Mon Oct 20 15:19:17 2003
+++ llvm/include/llvm/Analysis/DSNode.h	Sun Nov  2 16:27:15 2003
@@ -18,6 +18,7 @@
 
 template<typename BaseType>
 class DSNodeIterator;          // Data structure graph traversal iterator
+class TargetData;
 
 //===----------------------------------------------------------------------===//
 /// DSNode - Data structure node class
@@ -133,6 +134,11 @@
 
   DSGraph *getParentGraph() const { return ParentGraph; }
   void setParentGraph(DSGraph *G) { ParentGraph = G; }
+
+
+  /// getTargetData - Get the target data object used to construct this node.
+  ///
+  const TargetData &getTargetData() const;
 
   /// getForwardNode - This method returns the node that this node is forwarded
   /// to, if any.


Index: llvm/include/llvm/Analysis/DSSupport.h
diff -u llvm/include/llvm/Analysis/DSSupport.h:1.24 llvm/include/llvm/Analysis/DSSupport.h:1.25
--- llvm/include/llvm/Analysis/DSSupport.h:1.24	Mon Oct 20 15:19:17 2003
+++ llvm/include/llvm/Analysis/DSSupport.h	Sun Nov  2 16:27:15 2003
@@ -28,7 +28,7 @@
 class DSGraph;                 // A graph for a function
 
 namespace DS { // FIXME: After the paper, this should get cleaned up
-  enum { PointerShift = 3,     // 64bit ptrs = 3, 32 bit ptrs = 2
+  enum { PointerShift = 2,     // 64bit ptrs = 3, 32 bit ptrs = 2
          PointerSize = 1 << PointerShift
   };
 


Index: llvm/include/llvm/Analysis/DataStructure.h
diff -u llvm/include/llvm/Analysis/DataStructure.h:1.73 llvm/include/llvm/Analysis/DataStructure.h:1.74
--- llvm/include/llvm/Analysis/DataStructure.h:1.73	Mon Oct 20 15:19:17 2003
+++ llvm/include/llvm/Analysis/DataStructure.h	Sun Nov  2 16:27:15 2003
@@ -15,6 +15,7 @@
 #define LLVM_ANALYSIS_DATA_STRUCTURE_H
 
 #include "llvm/Pass.h"
+#include "llvm/Target/TargetData.h"
 #include "Support/hash_set"
 
 class Type;
@@ -69,6 +70,7 @@
   // getAnalysisUsage - This obviously provides a data structure graph.
   virtual void getAnalysisUsage(AnalysisUsage &AU) const {
     AU.setPreservesAll();
+    AU.addRequired<TargetData>();
   }
 };
 





More information about the llvm-commits mailing list