[llvm-commits] CVS: llvm/include/llvm/CodeGen/SelectionDAG.h SelectionDAGNodes.h
Chris Lattner
lattner at cs.uiuc.edu
Mon Aug 7 18:09:47 PDT 2006
Changes in directory llvm/include/llvm/CodeGen:
SelectionDAG.h updated: 1.109 -> 1.110
SelectionDAGNodes.h updated: 1.138 -> 1.139
---
Log message:
Eliminate some malloc traffic by allocating vectors on the stack. Change some
method that took std::vector<SDOperand> to take a pointer to a first operand
and #operands.
This speeds up isel on kc++ by about 3%.
---
Diffs of the changes: (+18 -19)
SelectionDAG.h | 29 ++++++++++++++---------------
SelectionDAGNodes.h | 8 ++++----
2 files changed, 18 insertions(+), 19 deletions(-)
Index: llvm/include/llvm/CodeGen/SelectionDAG.h
diff -u llvm/include/llvm/CodeGen/SelectionDAG.h:1.109 llvm/include/llvm/CodeGen/SelectionDAG.h:1.110
--- llvm/include/llvm/CodeGen/SelectionDAG.h:1.109 Mon Aug 7 18:03:03 2006
+++ llvm/include/llvm/CodeGen/SelectionDAG.h Mon Aug 7 20:09:31 2006
@@ -171,10 +171,8 @@
std::vector<MVT::ValueType> ResultTys;
ResultTys.push_back(VT);
ResultTys.push_back(MVT::Other);
- std::vector<SDOperand> Ops;
- Ops.push_back(Chain);
- Ops.push_back(getRegister(Reg, VT));
- return getNode(ISD::CopyFromReg, ResultTys, Ops);
+ SDOperand Ops[] = { Chain, getRegister(Reg, VT) };
+ return getNode(ISD::CopyFromReg, ResultTys, Ops, 2);
}
// This version of the getCopyFromReg method takes an extra operand, which
@@ -186,11 +184,8 @@
ResultTys.push_back(VT);
ResultTys.push_back(MVT::Other);
ResultTys.push_back(MVT::Flag);
- std::vector<SDOperand> Ops;
- Ops.push_back(Chain);
- Ops.push_back(getRegister(Reg, VT));
- if (Flag.Val) Ops.push_back(Flag);
- return getNode(ISD::CopyFromReg, ResultTys, Ops);
+ SDOperand Ops[] = { Chain, getRegister(Reg, VT), Flag };
+ return getNode(ISD::CopyFromReg, ResultTys, Ops, Flag.Val ? 3 : 2);
}
SDOperand getCondCode(ISD::CondCode Cond);
@@ -205,10 +200,8 @@
std::vector<MVT::ValueType> ResultTys;
ResultTys.push_back(MVT::Other);
ResultTys.push_back(MVT::Flag);
- std::vector<SDOperand> Ops;
- Ops.push_back(Chain);
- Ops.push_back(Op);
- return getNode(ISD::CALLSEQ_START, ResultTys, Ops);
+ SDOperand Ops[] = { Chain, Op };
+ return getNode(ISD::CALLSEQ_START, ResultTys, Ops, 2);
}
/// getNode - Gets or creates the specified node.
@@ -229,6 +222,12 @@
SDOperand getNode(unsigned Opcode, std::vector<MVT::ValueType> &ResultTys,
std::vector<SDOperand> &Ops);
+ SDOperand getNode(unsigned Opcode, MVT::ValueType VT,
+ const SDOperand *Ops, unsigned NumOps);
+ SDOperand getNode(unsigned Opcode, std::vector<MVT::ValueType> &ResultTys,
+ const SDOperand *Ops, unsigned NumOps);
+
+
/// getSetCC - Helper function to make it easier to build SetCC's if you just
/// have an ISD::CondCode instead of an SDOperand.
///
@@ -278,7 +277,7 @@
SDOperand Op3, SDOperand Op4);
SDOperand UpdateNodeOperands(SDOperand N, SDOperand Op1, SDOperand Op2,
SDOperand Op3, SDOperand Op4, SDOperand Op5);
- SDOperand UpdateNodeOperands(SDOperand N, const std::vector<SDOperand> &Op);
+ SDOperand UpdateNodeOperands(SDOperand N, SDOperand *Ops, unsigned NumOps);
/// SelectNodeTo - These are used for target selectors to *mutate* the
/// specified node to have the specified return type, Target opcode, and
@@ -445,7 +444,7 @@
SDNode *FindModifiedNodeSlot(SDNode *N, SDOperand Op, void *&InsertPos);
SDNode *FindModifiedNodeSlot(SDNode *N, SDOperand Op1, SDOperand Op2,
void *&InsertPos);
- SDNode *FindModifiedNodeSlot(SDNode *N, const std::vector<SDOperand> &Ops,
+ SDNode *FindModifiedNodeSlot(SDNode *N, const SDOperand *Ops, unsigned NumOps,
void *&InsertPos);
void DeleteNodeNotInCSEMaps(SDNode *N);
Index: llvm/include/llvm/CodeGen/SelectionDAGNodes.h
diff -u llvm/include/llvm/CodeGen/SelectionDAGNodes.h:1.138 llvm/include/llvm/CodeGen/SelectionDAGNodes.h:1.139
--- llvm/include/llvm/CodeGen/SelectionDAGNodes.h:1.138 Mon Aug 7 18:03:03 2006
+++ llvm/include/llvm/CodeGen/SelectionDAGNodes.h Mon Aug 7 20:09:31 2006
@@ -865,13 +865,13 @@
Prev = 0; Next = 0;
NextInBucket = 0;
}
- SDNode(unsigned Opc, const std::vector<SDOperand> &Nodes)
+ SDNode(unsigned Opc, const SDOperand *Ops, unsigned NumOps)
: NodeType(Opc), NodeId(-1) {
- NumOperands = Nodes.size();
+ NumOperands = NumOps;
OperandList = new SDOperand[NumOperands];
- for (unsigned i = 0, e = Nodes.size(); i != e; ++i) {
- OperandList[i] = Nodes[i];
+ for (unsigned i = 0, e = NumOps; i != e; ++i) {
+ OperandList[i] = Ops[i];
SDNode *N = OperandList[i].Val;
N->Uses.push_back(this);
}
More information about the llvm-commits
mailing list