Move DenseMapKeyInfo<SDOperand> from LegalizeDAG.cpp to SelectionDAGNodes.h
authorEvan Cheng <evan.cheng@apple.com>
Tue, 10 Jul 2007 06:59:55 +0000 (06:59 +0000)
committerEvan Cheng <evan.cheng@apple.com>
Tue, 10 Jul 2007 06:59:55 +0000 (06:59 +0000)
git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@38484 91177308-0d34-0410-b5e6-96231b3b80d8

include/llvm/CodeGen/SelectionDAGNodes.h
lib/CodeGen/SelectionDAG/LegalizeDAG.cpp

index c370b50b3e54c234d3ccbee22d0fcfd5d1fab0bb..316b02af39ecd723f9173e0f4388aaf1e288ada8 100644 (file)
@@ -34,6 +34,7 @@ class GlobalValue;
 class MachineBasicBlock;
 class MachineConstantPoolValue;
 class SDNode;
+template <typename T> struct DenseMapKeyInfo;
 template <typename T> struct simplify_type;
 template <typename T> struct ilist_traits;
 template<typename NodeTy, typename Traits> class iplist;
@@ -728,6 +729,16 @@ public:
 };
 
 
+template<> struct DenseMapKeyInfo<SDOperand> {
+  static inline SDOperand getEmptyKey() { return SDOperand((SDNode*)-1, -1U); }
+  static inline SDOperand getTombstoneKey() { return SDOperand((SDNode*)-1, 0);}
+  static unsigned getHashValue(const SDOperand &Val) {
+    return (unsigned)((uintptr_t)Val.Val >> 4) ^
+           (unsigned)((uintptr_t)Val.Val >> 9) + Val.ResNo;
+  }
+  static bool isPod() { return true; }
+};
+
 /// simplify_type specializations - Allow casting operators to work directly on
 /// SDOperands as if they were SDNode*'s.
 template<> struct simplify_type<SDOperand> {
index 27340f19923f1bed47fa9d7d0767e63d6dfc8cd0..63f58c20968f5bf7c93d6ee6e5708f4cf9e4363c 100644 (file)
@@ -39,18 +39,6 @@ ViewLegalizeDAGs("view-legalize-dags", cl::Hidden,
 static const bool ViewLegalizeDAGs = 0;
 #endif
 
-namespace llvm {
-template<>
-struct DenseMapKeyInfo<SDOperand> {
-  static inline SDOperand getEmptyKey() { return SDOperand((SDNode*)-1, -1U); }
-  static inline SDOperand getTombstoneKey() { return SDOperand((SDNode*)-1, 0);}
-  static unsigned getHashValue(const SDOperand &Val) {
-    return DenseMapKeyInfo<void*>::getHashValue(Val.Val) + Val.ResNo;
-  }
-  static bool isPod() { return true; }
-};
-}
-
 //===----------------------------------------------------------------------===//
 /// SelectionDAGLegalize - This takes an arbitrary SelectionDAG as input and
 /// hacks on it until the target machine can handle it.  This involves