summaryrefslogtreecommitdiffstats
path: root/llvm/lib/Transforms
diff options
context:
space:
mode:
authorChris Lattner <sabre@nondot.org>2007-09-17 18:34:04 +0000
committerChris Lattner <sabre@nondot.org>2007-09-17 18:34:04 +0000
commit0625bd6472cde014f76bb91c1a0c925d4b6e0eda (patch)
tree6a7e4763370238242736ff6e67657607afb37b42 /llvm/lib/Transforms
parent6f0751475a773cbbb3a6aa1b83eaad93f6ab8a09 (diff)
downloadbcm5719-llvm-0625bd6472cde014f76bb91c1a0c925d4b6e0eda.tar.gz
bcm5719-llvm-0625bd6472cde014f76bb91c1a0c925d4b6e0eda.zip
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. llvm-svn: 42042
Diffstat (limited to 'llvm/lib/Transforms')
-rw-r--r--llvm/lib/Transforms/Scalar/GVN.cpp5
-rw-r--r--llvm/lib/Transforms/Scalar/GVNPRE.cpp5
-rw-r--r--llvm/lib/Transforms/Utils/PromoteMemoryToRegister.cpp18
3 files changed, 19 insertions, 9 deletions
diff --git a/llvm/lib/Transforms/Scalar/GVN.cpp b/llvm/lib/Transforms/Scalar/GVN.cpp
index 7f809e73978..c6b50a4002d 100644
--- a/llvm/lib/Transforms/Scalar/GVN.cpp
+++ b/llvm/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/llvm/lib/Transforms/Scalar/GVNPRE.cpp b/llvm/lib/Transforms/Scalar/GVNPRE.cpp
index d362f54b493..b3d2fe2d5af 100644
--- a/llvm/lib/Transforms/Scalar/GVNPRE.cpp
+++ b/llvm/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/llvm/lib/Transforms/Utils/PromoteMemoryToRegister.cpp b/llvm/lib/Transforms/Utils/PromoteMemoryToRegister.cpp
index 33489711388..c32457d6704 100644
--- a/llvm/lib/Transforms/Utils/PromoteMemoryToRegister.cpp
+++ b/llvm/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; }
};
OpenPOWER on IntegriCloud