diff options
author | Chris Lattner <sabre@nondot.org> | 2007-09-17 18:34:04 +0000 |
---|---|---|
committer | Chris Lattner <sabre@nondot.org> | 2007-09-17 18:34:04 +0000 |
commit | 76c1b97e4020faace8c95a127f1eab66c278fb58 (patch) | |
tree | 9fbf93a4ca6637674eaffdef7af40539b80d9f4e /lib/Transforms/Utils/PromoteMemoryToRegister.cpp | |
parent | 430817ba181071d20f5c7c3ec4dcd5d8b8e318f4 (diff) |
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
Diffstat (limited to 'lib/Transforms/Utils/PromoteMemoryToRegister.cpp')
-rw-r--r-- | lib/Transforms/Utils/PromoteMemoryToRegister.cpp | 18 |
1 files changed, 11 insertions, 7 deletions
diff --git a/lib/Transforms/Utils/PromoteMemoryToRegister.cpp b/lib/Transforms/Utils/PromoteMemoryToRegister.cpp index 3348971138..c32457d670 100644 --- a/lib/Transforms/Utils/PromoteMemoryToRegister.cpp +++ b/lib/Transforms/Utils/PromoteMemoryToRegister.cpp @@ -39,18 +39,22 @@ STATISTIC(NumSingleStore, "Number of alloca's promoted with a single store"); STATISTIC(NumDeadAlloca, "Number of dead alloca's removed"); STATISTIC(NumPHIInsert, "Number of PHI nodes inserted"); -// Provide DenseMapKeyInfo for all pointers. +// Provide DenseMapInfo for all pointers. namespace llvm { template<> -struct DenseMapKeyInfo<std::pair<BasicBlock*, unsigned> > { - static inline std::pair<BasicBlock*, unsigned> getEmptyKey() { - return std::make_pair((BasicBlock*)-1, ~0U); +struct DenseMapInfo<std::pair<BasicBlock*, unsigned> > { + typedef std::pair<BasicBlock*, unsigned> EltTy; + static inline EltTy getEmptyKey() { + return EltTy(reinterpret_cast<BasicBlock*>(-1), ~0U); } - static inline std::pair<BasicBlock*, unsigned> getTombstoneKey() { - return std::make_pair((BasicBlock*)-2, 0U); + static inline EltTy getTombstoneKey() { + return EltTy(reinterpret_cast<BasicBlock*>(-2), 0U); } static unsigned getHashValue(const std::pair<BasicBlock*, unsigned> &Val) { - return DenseMapKeyInfo<void*>::getHashValue(Val.first) + Val.second*2; + return DenseMapInfo<void*>::getHashValue(Val.first) + Val.second*2; + } + static bool isEqual(const EltTy &LHS, const EltTy &RHS) { + return LHS == RHS; } static bool isPod() { return true; } }; |