Move DenseMapKeyInfo<SDOperand> from LegalizeDAG.cpp to SelectionDAGNodes.h

git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@38484 91177308-0d34-0410-b5e6-96231b3b80d8
This commit is contained in:
Evan Cheng 2007-07-10 06:59:55 +00:00
parent 6e8eb7f075
commit c63d391c9a
2 changed files with 11 additions and 12 deletions

View File

@ -34,6 +34,7 @@ class GlobalValue;
class MachineBasicBlock; class MachineBasicBlock;
class MachineConstantPoolValue; class MachineConstantPoolValue;
class SDNode; class SDNode;
template <typename T> struct DenseMapKeyInfo;
template <typename T> struct simplify_type; template <typename T> struct simplify_type;
template <typename T> struct ilist_traits; template <typename T> struct ilist_traits;
template<typename NodeTy, typename Traits> class iplist; 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 /// simplify_type specializations - Allow casting operators to work directly on
/// SDOperands as if they were SDNode*'s. /// SDOperands as if they were SDNode*'s.
template<> struct simplify_type<SDOperand> { template<> struct simplify_type<SDOperand> {

View File

@ -39,18 +39,6 @@ ViewLegalizeDAGs("view-legalize-dags", cl::Hidden,
static const bool ViewLegalizeDAGs = 0; static const bool ViewLegalizeDAGs = 0;
#endif #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 /// SelectionDAGLegalize - This takes an arbitrary SelectionDAG as input and
/// hacks on it until the target machine can handle it. This involves /// hacks on it until the target machine can handle it. This involves