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 | |
parent | 430817ba181071d20f5c7c3ec4dcd5d8b8e318f4 (diff) | |
download | external_llvm-76c1b97e4020faace8c95a127f1eab66c278fb58.zip external_llvm-76c1b97e4020faace8c95a127f1eab66c278fb58.tar.gz external_llvm-76c1b97e4020faace8c95a127f1eab66c278fb58.tar.bz2 |
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')
-rw-r--r-- | lib/Transforms/Scalar/GVN.cpp | 5 | ||||
-rw-r--r-- | lib/Transforms/Scalar/GVNPRE.cpp | 5 | ||||
-rw-r--r-- | lib/Transforms/Utils/PromoteMemoryToRegister.cpp | 18 |
3 files changed, 19 insertions, 9 deletions
diff --git a/lib/Transforms/Scalar/GVN.cpp b/lib/Transforms/Scalar/GVN.cpp index 7f809e7..c6b50a4 100644 --- a/lib/Transforms/Scalar/GVN.cpp +++ b/lib/Transforms/Scalar/GVN.cpp @@ -145,7 +145,7 @@ namespace { } namespace llvm { -template <> struct DenseMapKeyInfo<Expression> { +template <> struct DenseMapInfo<Expression> { static inline Expression getEmptyKey() { return Expression(Expression::EMPTY); } @@ -171,6 +171,9 @@ template <> struct DenseMapKeyInfo<Expression> { return hash; } + static bool isEqual(const Expression &LHS, const Expression &RHS) { + return LHS == RHS; + } static bool isPod() { return true; } }; } diff --git a/lib/Transforms/Scalar/GVNPRE.cpp b/lib/Transforms/Scalar/GVNPRE.cpp index d362f54..b3d2fe2 100644 --- a/lib/Transforms/Scalar/GVNPRE.cpp +++ b/lib/Transforms/Scalar/GVNPRE.cpp @@ -155,7 +155,7 @@ namespace { } namespace llvm { -template <> struct DenseMapKeyInfo<Expression> { +template <> struct DenseMapInfo<Expression> { static inline Expression getEmptyKey() { return Expression(Expression::EMPTY); } @@ -181,6 +181,9 @@ template <> struct DenseMapKeyInfo<Expression> { return hash; } + static bool isEqual(const Expression &LHS, const Expression &RHS) { + return LHS == RHS; + } static bool isPod() { return true; } }; } diff --git a/lib/Transforms/Utils/PromoteMemoryToRegister.cpp b/lib/Transforms/Utils/PromoteMemoryToRegister.cpp index 3348971..c32457d 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; } }; |