Merge DenseMapKeyInfo & DenseMapValueInfo into DenseMapInfo

Add a new DenseMapInfo::isEqual method to allow clients to redefine
the equality predicate used when probing the hash table.


git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@42042 91177308-0d34-0410-b5e6-96231b3b80d8
This commit is contained in:
Chris Lattner
2007-09-17 18:34:04 +00:00
parent 430817ba18
commit 76c1b97e40
10 changed files with 57 additions and 39 deletions

View File

@@ -35,7 +35,7 @@ class GlobalValue;
class MachineBasicBlock;
class MachineConstantPoolValue;
class SDNode;
template <typename T> struct DenseMapKeyInfo;
template <typename T> struct DenseMapInfo;
template <typename T> struct simplify_type;
template <typename T> struct ilist_traits;
template<typename NodeTy, typename Traits> class iplist;
@@ -773,13 +773,16 @@ public:
};
template<> struct DenseMapKeyInfo<SDOperand> {
template<> struct DenseMapInfo<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 isEqual(const SDOperand &LHS, const SDOperand &RHS) {
return LHS == RHS;
}
static bool isPod() { return true; }
};