aboutsummaryrefslogtreecommitdiffstats
path: root/include
diff options
context:
space:
mode:
authorChris Lattner <sabre@nondot.org>2006-08-08 02:23:42 +0000
committerChris Lattner <sabre@nondot.org>2006-08-08 02:23:42 +0000
commitbd564bfc63163e31f320c3da9749db70992dc35e (patch)
tree77b5cd90a35a31a43cec09750d0dcd45a72f62a7 /include
parent4257ccb1a703db6acaa4626e81c56182a7c11c38 (diff)
downloadexternal_llvm-bd564bfc63163e31f320c3da9749db70992dc35e.zip
external_llvm-bd564bfc63163e31f320c3da9749db70992dc35e.tar.gz
external_llvm-bd564bfc63163e31f320c3da9749db70992dc35e.tar.bz2
Start eliminating temporary vectors used to create DAG nodes. Instead, pass
in the start of an array and a count of operands where applicable. In many cases, the number of operands is known, so this static array can be allocated on the stack, avoiding the heap. In many other cases, a SmallVector can be used, which has the same benefit in the common cases. I updated a lot of code calling getNode that takes a vector, but ran out of time. The rest of the code should be updated, and these methods should be removed. We should also do the same thing to eliminate the methods that take a vector of MVT::ValueTypes. It would be extra nice to convert the dagiselemitter to avoid creating vectors for operands when calling getTargetNode. git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@29566 91177308-0d34-0410-b5e6-96231b3b80d8
Diffstat (limited to 'include')
-rw-r--r--include/llvm/CodeGen/SelectionDAG.h34
1 files changed, 15 insertions, 19 deletions
diff --git a/include/llvm/CodeGen/SelectionDAG.h b/include/llvm/CodeGen/SelectionDAG.h
index 6ba236c..204b2eb 100644
--- a/include/llvm/CodeGen/SelectionDAG.h
+++ b/include/llvm/CodeGen/SelectionDAG.h
@@ -145,12 +145,8 @@ public:
std::vector<MVT::ValueType> VTs;
VTs.push_back(MVT::Other);
VTs.push_back(MVT::Flag);
- std::vector<SDOperand> Ops;
- Ops.push_back(Chain);
- Ops.push_back(getRegister(Reg, N.getValueType()));
- Ops.push_back(N);
- if (Flag.Val) Ops.push_back(Flag);
- return getNode(ISD::CopyToReg, VTs, Ops);
+ SDOperand Ops[] = { Chain, getRegister(Reg, N.getValueType()), N, Flag };
+ return getNode(ISD::CopyToReg, VTs, Ops, Flag.Val ? 4 : 3);
}
// Similar to last getCopyToReg() except parameter Reg is a SDOperand
@@ -159,12 +155,8 @@ public:
std::vector<MVT::ValueType> VTs;
VTs.push_back(MVT::Other);
VTs.push_back(MVT::Flag);
- std::vector<SDOperand> Ops;
- Ops.push_back(Chain);
- Ops.push_back(Reg);
- Ops.push_back(N);
- if (Flag.Val) Ops.push_back(Flag);
- return getNode(ISD::CopyToReg, VTs, Ops);
+ SDOperand Ops[] = { Chain, Reg, N, Flag };
+ return getNode(ISD::CopyToReg, VTs, Ops, Flag.Val ? 4 : 3);
}
SDOperand getCopyFromReg(SDOperand Chain, unsigned Reg, MVT::ValueType VT) {
@@ -218,14 +210,17 @@ public:
SDOperand N1, SDOperand N2, SDOperand N3, SDOperand N4,
SDOperand N5);
SDOperand getNode(unsigned Opcode, MVT::ValueType VT,
- std::vector<SDOperand> &Children);
- 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, MVT::ValueType VT,
+ const std::vector<SDOperand> &Ops) {
+ return getNode(Opcode, VT, &Ops[0], Ops.size());
+ }
SDOperand getNode(unsigned Opcode, std::vector<MVT::ValueType> &ResultTys,
const SDOperand *Ops, unsigned NumOps);
+ SDOperand getNode(unsigned Opcode, std::vector<MVT::ValueType> &ResultTys,
+ const std::vector<SDOperand> &Ops) {
+ return getNode(Opcode, ResultTys, &Ops[0], Ops.size());
+ }
/// getSetCC - Helper function to make it easier to build SetCC's if you just
@@ -351,7 +346,7 @@ public:
SDOperand Op4, SDOperand Op5, SDOperand Op6,
SDOperand Op7, SDOperand Op8);
SDNode *getTargetNode(unsigned Opcode, MVT::ValueType VT,
- std::vector<SDOperand> &Ops);
+ const SDOperand *Ops, unsigned NumOps);
SDNode *getTargetNode(unsigned Opcode, MVT::ValueType VT1,
MVT::ValueType VT2, SDOperand Op1);
SDNode *getTargetNode(unsigned Opcode, MVT::ValueType VT1,
@@ -391,7 +386,8 @@ public:
SDOperand Op3, SDOperand Op4, SDOperand Op5,
SDOperand Op6, SDOperand Op7);
SDNode *getTargetNode(unsigned Opcode, MVT::ValueType VT1,
- MVT::ValueType VT2, std::vector<SDOperand> &Ops);
+ MVT::ValueType VT2,
+ const SDOperand *Ops, unsigned NumOps);
/// ReplaceAllUsesWith - Modify anything using 'From' to use 'To' instead.
/// This can cause recursive merging of nodes in the DAG. Use the first