[llvm-commits] CVS: llvm/include/llvm/CodeGen/MachineConstantPool.h SelectionDAG.h SelectionDAGNodes.h SelectionDAGCSEMap.h

Jim Laskey jlaskey at apple.com
Fri Oct 27 16:46:22 PDT 2006



Changes in directory llvm/include/llvm/CodeGen:

MachineConstantPool.h updated: 1.20 -> 1.21
SelectionDAG.h updated: 1.140 -> 1.141
SelectionDAGNodes.h updated: 1.156 -> 1.157
SelectionDAGCSEMap.h (r1.8) removed
---
Log message:

Switch over from SelectionNodeCSEMap to FoldingSet.

---
Diffs of the changes:  (+13 -20)

 MachineConstantPool.h |    5 +++--
 SelectionDAG.h        |    6 ++++--
 SelectionDAGNodes.h   |   22 ++++++----------------
 3 files changed, 13 insertions(+), 20 deletions(-)


Index: llvm/include/llvm/CodeGen/MachineConstantPool.h
diff -u llvm/include/llvm/CodeGen/MachineConstantPool.h:1.20 llvm/include/llvm/CodeGen/MachineConstantPool.h:1.21
--- llvm/include/llvm/CodeGen/MachineConstantPool.h:1.20	Thu Sep 14 02:32:32 2006
+++ llvm/include/llvm/CodeGen/MachineConstantPool.h	Fri Oct 27 18:46:08 2006
@@ -15,7 +15,8 @@
 #ifndef LLVM_CODEGEN_MACHINECONSTANTPOOL_H
 #define LLVM_CODEGEN_MACHINECONSTANTPOOL_H
 
-#include "llvm/CodeGen/SelectionDAGCSEMap.h"
+#include "llvm/ADT/FoldingSet.h"
+#include "llvm/CodeGen/SelectionDAGNodes.h"
 #include <vector>
 #include <iosfwd>
 
@@ -43,7 +44,7 @@
   virtual int getExistingMachineCPValue(MachineConstantPool *CP,
                                         unsigned Alignment) = 0;
 
-  virtual void AddSelectionDAGCSEId(SelectionDAGCSEMap::NodeID *Id) = 0;
+  virtual void AddSelectionDAGCSEId(FoldingSetNodeID &ID) = 0;
 
   /// print - Implement operator<<...
   ///


Index: llvm/include/llvm/CodeGen/SelectionDAG.h
diff -u llvm/include/llvm/CodeGen/SelectionDAG.h:1.140 llvm/include/llvm/CodeGen/SelectionDAG.h:1.141
--- llvm/include/llvm/CodeGen/SelectionDAG.h:1.140	Thu Oct 26 16:52:23 2006
+++ llvm/include/llvm/CodeGen/SelectionDAG.h	Fri Oct 27 18:46:08 2006
@@ -15,8 +15,9 @@
 #ifndef LLVM_CODEGEN_SELECTIONDAG_H
 #define LLVM_CODEGEN_SELECTIONDAG_H
 
-#include "llvm/CodeGen/SelectionDAGCSEMap.h"
+#include "llvm/ADT/FoldingSet.h"
 #include "llvm/ADT/ilist"
+#include "llvm/CodeGen/SelectionDAGNodes.h"
 
 #include <list>
 #include <vector>
@@ -31,6 +32,7 @@
   class MachineDebugInfo;
   class MachineFunction;
   class MachineConstantPoolValue;
+  class SDOperand;
 
 /// SelectionDAG class - This is used to represent a portion of an LLVM function
 /// in a low-level Data Dependence DAG representation suitable for instruction
@@ -56,7 +58,7 @@
 
   /// CSEMap - This structure is used to memoize nodes, automatically performing
   /// CSE with existing nodes with a duplicate is requested.
-  SelectionDAGCSEMap CSEMap;
+  FoldingSet<SDNode> CSEMap;
 
 public:
   SelectionDAG(TargetLowering &tli, MachineFunction &mf, MachineDebugInfo *di)


Index: llvm/include/llvm/CodeGen/SelectionDAGNodes.h
diff -u llvm/include/llvm/CodeGen/SelectionDAGNodes.h:1.156 llvm/include/llvm/CodeGen/SelectionDAGNodes.h:1.157
--- llvm/include/llvm/CodeGen/SelectionDAGNodes.h:1.156	Thu Oct 26 16:52:24 2006
+++ llvm/include/llvm/CodeGen/SelectionDAGNodes.h	Fri Oct 27 18:46:08 2006
@@ -20,6 +20,7 @@
 #define LLVM_CODEGEN_SELECTIONDAGNODES_H
 
 #include "llvm/Value.h"
+#include "llvm/ADT/FoldingSet.h"
 #include "llvm/ADT/GraphTraits.h"
 #include "llvm/ADT/iterator"
 #include "llvm/ADT/SmallVector.h"
@@ -742,7 +743,7 @@
 
 /// SDNode - Represents one node in the SelectionDAG.
 ///
-class SDNode {
+class SDNode : public FoldingSetNode {
   /// NodeType - The operation that this node performs.
   ///
   unsigned short NodeType;
@@ -766,9 +767,6 @@
   SDNode *Prev, *Next;
   friend struct ilist_traits<SDNode>;
 
-  /// NextInBucket - This is used by the SelectionDAGCSEMap.
-  void *NextInBucket;
-  
   /// Uses - These are all of the SDNode's that use a value produced by this
   /// node.
   SmallVector<SDNode*,3> Uses;
@@ -778,7 +776,6 @@
 public:
   virtual ~SDNode() {
     assert(NumOperands == 0 && "Operand list not cleared before deletion");
-    assert(NextInBucket == 0 && "Still in CSEMap?");
     NodeType = ISD::DELETED_NODE;
   }
   
@@ -863,11 +860,10 @@
 
   static bool classof(const SDNode *) { return true; }
 
-  
-  /// NextInBucket accessors, these are private to SelectionDAGCSEMap.
-  void *getNextInBucket() const { return NextInBucket; }
-  void SetNextInBucket(void *N) { NextInBucket = N; }
-  
+  /// Profile - Gather unique data for the node.
+  ///
+  void Profile(FoldingSetNodeID &ID);
+
 protected:
   friend class SelectionDAG;
   
@@ -880,7 +876,6 @@
     ValueList = getValueTypeList(VT);
     NumValues = 1;
     Prev = 0; Next = 0;
-    NextInBucket = 0;
   }
   SDNode(unsigned NT, SDOperand Op)
     : NodeType(NT), NodeId(-1) {
@@ -891,7 +886,6 @@
     ValueList = 0;
     NumValues = 0;
     Prev = 0; Next = 0;
-    NextInBucket = 0;
   }
   SDNode(unsigned NT, SDOperand N1, SDOperand N2)
     : NodeType(NT), NodeId(-1) {
@@ -903,7 +897,6 @@
     ValueList = 0;
     NumValues = 0;
     Prev = 0; Next = 0;
-    NextInBucket = 0;
   }
   SDNode(unsigned NT, SDOperand N1, SDOperand N2, SDOperand N3)
     : NodeType(NT), NodeId(-1) {
@@ -918,7 +911,6 @@
     ValueList = 0;
     NumValues = 0;
     Prev = 0; Next = 0;
-    NextInBucket = 0;
   }
   SDNode(unsigned NT, SDOperand N1, SDOperand N2, SDOperand N3, SDOperand N4)
     : NodeType(NT), NodeId(-1) {
@@ -934,7 +926,6 @@
     ValueList = 0;
     NumValues = 0;
     Prev = 0; Next = 0;
-    NextInBucket = 0;
   }
   SDNode(unsigned Opc, const SDOperand *Ops, unsigned NumOps)
     : NodeType(Opc), NodeId(-1) {
@@ -949,7 +940,6 @@
     ValueList = 0;
     NumValues = 0;
     Prev = 0; Next = 0;
-    NextInBucket = 0;
   }
 
   /// MorphNodeTo - This clears the return value and operands list, and sets the






More information about the llvm-commits mailing list