[llvm-commits] CVS: llvm/lib/CodeGen/SelectionDAG/LegalizeDAG.cpp
Chris Lattner
sabre at nondot.org
Sat Feb 3 16:50:18 PST 2007
Changes in directory llvm/lib/CodeGen/SelectionDAG:
LegalizeDAG.cpp updated: 1.468 -> 1.469
---
Log message:
switch LegalizedNodes from std::map to a DenseMap. This speeds up isel
time as a whole on kc++ by 11%.
---
Diffs of the changes: (+15 -3)
LegalizeDAG.cpp | 18 +++++++++++++++---
1 files changed, 15 insertions(+), 3 deletions(-)
Index: llvm/lib/CodeGen/SelectionDAG/LegalizeDAG.cpp
diff -u llvm/lib/CodeGen/SelectionDAG/LegalizeDAG.cpp:1.468 llvm/lib/CodeGen/SelectionDAG/LegalizeDAG.cpp:1.469
--- llvm/lib/CodeGen/SelectionDAG/LegalizeDAG.cpp:1.468 Sat Feb 3 18:27:56 2007
+++ llvm/lib/CodeGen/SelectionDAG/LegalizeDAG.cpp Sat Feb 3 18:50:02 2007
@@ -39,6 +39,18 @@
static const bool ViewLegalizeDAGs = 0;
#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
/// hacks on it until the target machine can handle it. This involves
@@ -82,7 +94,7 @@
/// LegalizedNodes - For nodes that are of legal width, and that have more
/// than one use, this map indicates what regularized operand to use. This
/// allows us to avoid legalizing the same thing more than once.
- std::map<SDOperand, SDOperand> LegalizedNodes;
+ DenseMap<SDOperand, SDOperand> LegalizedNodes;
/// PromotedNodes - For nodes that are below legal width, and that have more
/// than one use, this map indicates what promoted value to use. This allows
@@ -592,7 +604,7 @@
// Note that LegalizeOp may be reentered even from single-use nodes, which
// means that we always must cache transformed nodes.
- std::map<SDOperand, SDOperand>::iterator I = LegalizedNodes.find(Op);
+ DenseMap<SDOperand, SDOperand>::iterator I = LegalizedNodes.find(Op);
if (I != LegalizedNodes.end()) return I->second;
SDOperand Tmp1, Tmp2, Tmp3, Tmp4;
@@ -1169,7 +1181,7 @@
// will cause this node to be legalized as well as handling libcalls right.
if (LastCALLSEQ_END.Val != Node) {
LegalizeOp(SDOperand(FindCallStartFromCallEnd(Node), 0));
- std::map<SDOperand, SDOperand>::iterator I = LegalizedNodes.find(Op);
+ DenseMap<SDOperand, SDOperand>::iterator I = LegalizedNodes.find(Op);
assert(I != LegalizedNodes.end() &&
"Legalizing the call start should have legalized this node!");
return I->second;
More information about the llvm-commits
mailing list