[llvm-commits] CVS: llvm/lib/CodeGen/SelectionDAG/SelectionDAG.cpp
Chris Lattner
sabre at nondot.org
Sun Feb 4 00:35:40 PST 2007
Changes in directory llvm/lib/CodeGen/SelectionDAG:
SelectionDAG.cpp updated: 1.388 -> 1.389
---
Log message:
Introduce new UnarySDNode/BinarySDNode/TernarySDNode nodes, which coallocate
their operands with the node itself. This reduces malloc traffic for operand
lists. This reduces isel time on kc++ from 2.6164 to 2.5570s, about 2.3%.
---
Diffs of the changes: (+29 -12)
SelectionDAG.cpp | 41 +++++++++++++++++++++++++++++------------
1 files changed, 29 insertions(+), 12 deletions(-)
Index: llvm/lib/CodeGen/SelectionDAG/SelectionDAG.cpp
diff -u llvm/lib/CodeGen/SelectionDAG/SelectionDAG.cpp:1.388 llvm/lib/CodeGen/SelectionDAG/SelectionDAG.cpp:1.389
--- llvm/lib/CodeGen/SelectionDAG/SelectionDAG.cpp:1.388 Sun Feb 4 01:37:24 2007
+++ llvm/lib/CodeGen/SelectionDAG/SelectionDAG.cpp Sun Feb 4 02:35:21 2007
@@ -939,7 +939,7 @@
void *IP = 0;
if (SDNode *E = CSEMap.FindNodeOrInsertPos(ID, IP))
return SDOperand(E, 0);
- SDNode *N = new SDNode(Opcode, SDNode::getSDVTList(VT), 0, 0);
+ SDNode *N = new SDNode(Opcode, SDNode::getSDVTList(VT));
CSEMap.InsertNode(N, IP);
AllNodes.push_back(N);
@@ -1113,17 +1113,17 @@
SDNode *N;
SDVTList VTs = getVTList(VT);
- SDOperand Ops[1] = { Operand };
if (VT != MVT::Flag) { // Don't CSE flag producing nodes
FoldingSetNodeID ID;
+ SDOperand Ops[1] = { Operand };
AddNodeIDNode(ID, Opcode, VTs, Ops, 1);
void *IP = 0;
if (SDNode *E = CSEMap.FindNodeOrInsertPos(ID, IP))
return SDOperand(E, 0);
- N = new SDNode(Opcode, VTs, Ops, 1);
+ N = new UnarySDNode(Opcode, VTs, Operand);
CSEMap.InsertNode(N, IP);
} else {
- N = new SDNode(Opcode, VTs, Ops, 1);
+ N = new UnarySDNode(Opcode, VTs, Operand);
}
AllNodes.push_back(N);
return SDOperand(N, 0);
@@ -1413,17 +1413,17 @@
// Memoize this node if possible.
SDNode *N;
SDVTList VTs = getVTList(VT);
- SDOperand Ops[] = { N1, N2 };
if (VT != MVT::Flag) {
+ SDOperand Ops[] = { N1, N2 };
FoldingSetNodeID ID;
AddNodeIDNode(ID, Opcode, VTs, Ops, 2);
void *IP = 0;
if (SDNode *E = CSEMap.FindNodeOrInsertPos(ID, IP))
return SDOperand(E, 0);
- N = new SDNode(Opcode, VTs, Ops, 2);
+ N = new BinarySDNode(Opcode, VTs, N1, N2);
CSEMap.InsertNode(N, IP);
} else {
- N = new SDNode(Opcode, VTs, Ops, 2);
+ N = new BinarySDNode(Opcode, VTs, N1, N2);
}
AllNodes.push_back(N);
@@ -1470,17 +1470,17 @@
// Memoize node if it doesn't produce a flag.
SDNode *N;
SDVTList VTs = getVTList(VT);
- SDOperand Ops[] = { N1, N2, N3 };
if (VT != MVT::Flag) {
+ SDOperand Ops[] = { N1, N2, N3 };
FoldingSetNodeID ID;
AddNodeIDNode(ID, Opcode, VTs, Ops, 3);
void *IP = 0;
if (SDNode *E = CSEMap.FindNodeOrInsertPos(ID, IP))
return SDOperand(E, 0);
- N = new SDNode(Opcode, VTs, Ops, 3);
+ N = new TernarySDNode(Opcode, VTs, N1, N2, N3);
CSEMap.InsertNode(N, IP);
} else {
- N = new SDNode(Opcode, VTs, Ops, 3);
+ N = new TernarySDNode(Opcode, VTs, N1, N2, N3);
}
AllNodes.push_back(N);
return SDOperand(N, 0);
@@ -1809,10 +1809,24 @@
void *IP = 0;
if (SDNode *E = CSEMap.FindNodeOrInsertPos(ID, IP))
return SDOperand(E, 0);
- N = new SDNode(Opcode, VTList, Ops, NumOps);
+ if (NumOps == 1)
+ N = new UnarySDNode(Opcode, VTList, Ops[0]);
+ else if (NumOps == 2)
+ N = new BinarySDNode(Opcode, VTList, Ops[0], Ops[1]);
+ else if (NumOps == 3)
+ N = new TernarySDNode(Opcode, VTList, Ops[0], Ops[1], Ops[2]);
+ else
+ N = new SDNode(Opcode, VTList, Ops, NumOps);
CSEMap.InsertNode(N, IP);
} else {
- N = new SDNode(Opcode, VTList, Ops, NumOps);
+ if (NumOps == 1)
+ N = new UnarySDNode(Opcode, VTList, Ops[0]);
+ else if (NumOps == 2)
+ N = new BinarySDNode(Opcode, VTList, Ops[0], Ops[1]);
+ else if (NumOps == 3)
+ N = new TernarySDNode(Opcode, VTList, Ops[0], Ops[1], Ops[2]);
+ else
+ N = new SDNode(Opcode, VTList, Ops, NumOps);
}
AllNodes.push_back(N);
return SDOperand(N, 0);
@@ -2490,6 +2504,9 @@
// Out-of-line virtual method to give class a home.
void SDNode::ANCHOR() {}
+void UnarySDNode::ANCHOR() {}
+void BinarySDNode::ANCHOR() {}
+void TernarySDNode::ANCHOR() {}
void HandleSDNode::ANCHOR() {}
void StringSDNode::ANCHOR() {}
void ConstantSDNode::ANCHOR() {}
More information about the llvm-commits
mailing list