From: Evan Cheng Date: Tue, 10 Jul 2007 06:59:55 +0000 (+0000) Subject: Move DenseMapKeyInfo from LegalizeDAG.cpp to SelectionDAGNodes.h X-Git-Url: http://plrg.eecs.uci.edu/git/?a=commitdiff_plain;ds=sidebyside;h=c63d391c9a886d58c6a53a7f565fbd544b076d9f;p=oota-llvm.git Move DenseMapKeyInfo from LegalizeDAG.cpp to SelectionDAGNodes.h git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@38484 91177308-0d34-0410-b5e6-96231b3b80d8 --- diff --git a/include/llvm/CodeGen/SelectionDAGNodes.h b/include/llvm/CodeGen/SelectionDAGNodes.h index c370b50b3e5..316b02af39e 100644 --- a/include/llvm/CodeGen/SelectionDAGNodes.h +++ b/include/llvm/CodeGen/SelectionDAGNodes.h @@ -34,6 +34,7 @@ class GlobalValue; class MachineBasicBlock; class MachineConstantPoolValue; class SDNode; +template struct DenseMapKeyInfo; template struct simplify_type; template struct ilist_traits; template class iplist; @@ -728,6 +729,16 @@ public: }; +template<> struct DenseMapKeyInfo { + 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 { diff --git a/lib/CodeGen/SelectionDAG/LegalizeDAG.cpp b/lib/CodeGen/SelectionDAG/LegalizeDAG.cpp index 27340f19923..63f58c20968 100644 --- a/lib/CodeGen/SelectionDAG/LegalizeDAG.cpp +++ b/lib/CodeGen/SelectionDAG/LegalizeDAG.cpp @@ -39,18 +39,6 @@ ViewLegalizeDAGs("view-legalize-dags", cl::Hidden, static const bool ViewLegalizeDAGs = 0; #endif -namespace llvm { -template<> -struct DenseMapKeyInfo { - 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::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