diff options
author | Chris Lattner <sabre@nondot.org> | 2006-08-08 02:23:42 +0000 |
---|---|---|
committer | Chris Lattner <sabre@nondot.org> | 2006-08-08 02:23:42 +0000 |
commit | bd564bfc63163e31f320c3da9749db70992dc35e (patch) | |
tree | 77b5cd90a35a31a43cec09750d0dcd45a72f62a7 /lib/Target/PowerPC/PPCISelDAGToDAG.cpp | |
parent | 4257ccb1a703db6acaa4626e81c56182a7c11c38 (diff) |
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 'lib/Target/PowerPC/PPCISelDAGToDAG.cpp')
-rw-r--r-- | lib/Target/PowerPC/PPCISelDAGToDAG.cpp | 18 |
1 files changed, 11 insertions, 7 deletions
diff --git a/lib/Target/PowerPC/PPCISelDAGToDAG.cpp b/lib/Target/PowerPC/PPCISelDAGToDAG.cpp index 4346c5e21d..106243a68f 100644 --- a/lib/Target/PowerPC/PPCISelDAGToDAG.cpp +++ b/lib/Target/PowerPC/PPCISelDAGToDAG.cpp @@ -1152,7 +1152,7 @@ void PPCDAGToDAGISel::MySelect_PPCbctrl(SDOperand &Result, SDOperand N) { bool hasFlag = N.getOperand(N.getNumOperands()-1).getValueType() == MVT::Flag; - std::vector<SDOperand> Ops; + SmallVector<SDOperand, 8> Ops; // Push varargs arguments, including optional flag. for (unsigned i = 1, e = N.getNumOperands()-hasFlag; i != e; ++i) { AddToQueue(Chain, N.getOperand(i)); @@ -1167,7 +1167,8 @@ void PPCDAGToDAGISel::MySelect_PPCbctrl(SDOperand &Result, SDOperand N) { Ops.push_back(Chain); } - ResNode = CurDAG->getTargetNode(PPC::BCTRL, MVT::Other, MVT::Flag, Ops); + ResNode = CurDAG->getTargetNode(PPC::BCTRL, MVT::Other, MVT::Flag, + &Ops[0], Ops.size()); Chain = SDOperand(ResNode, 0); InFlag = SDOperand(ResNode, 1); ReplaceUses(SDOperand(N.Val, 0), Chain); @@ -1193,7 +1194,7 @@ void PPCDAGToDAGISel::MySelect_PPCcall(SDOperand &Result, SDOperand N) { if (N1.getOpcode() == ISD::Constant) { unsigned Tmp0C = (unsigned)cast<ConstantSDNode>(N1)->getValue(); - std::vector<SDOperand> Ops; + SmallVector<SDOperand, 8> Ops; Ops.push_back(CurDAG->getTargetConstant(Tmp0C, MVT::i32)); bool hasFlag = @@ -1210,7 +1211,8 @@ void PPCDAGToDAGISel::MySelect_PPCcall(SDOperand &Result, SDOperand N) { AddToQueue(Chain, N.getOperand(N.getNumOperands()-1)); Ops.push_back(Chain); } - ResNode = CurDAG->getTargetNode(PPC::BLA, MVT::Other, MVT::Flag, Ops); + ResNode = CurDAG->getTargetNode(PPC::BLA, MVT::Other, MVT::Flag, + &Ops[0], Ops.size()); Chain = SDOperand(ResNode, 0); InFlag = SDOperand(ResNode, 1); @@ -1224,7 +1226,7 @@ void PPCDAGToDAGISel::MySelect_PPCcall(SDOperand &Result, SDOperand N) { // Emits: (BL:void (tglobaladdr:i32):$dst) // Pattern complexity = 4 cost = 1 if (N1.getOpcode() == ISD::TargetGlobalAddress) { - std::vector<SDOperand> Ops; + SmallVector<SDOperand, 8> Ops; Ops.push_back(N1); bool hasFlag = @@ -1242,7 +1244,8 @@ void PPCDAGToDAGISel::MySelect_PPCcall(SDOperand &Result, SDOperand N) { Ops.push_back(Chain); } - ResNode = CurDAG->getTargetNode(PPC::BL, MVT::Other, MVT::Flag, Ops); + ResNode = CurDAG->getTargetNode(PPC::BL, MVT::Other, MVT::Flag, + &Ops[0], Ops.size()); Chain = SDOperand(ResNode, 0); InFlag = SDOperand(ResNode, 1); @@ -1274,7 +1277,8 @@ void PPCDAGToDAGISel::MySelect_PPCcall(SDOperand &Result, SDOperand N) { Ops.push_back(Chain); } - ResNode = CurDAG->getTargetNode(PPC::BL, MVT::Other, MVT::Flag, Ops); + ResNode = CurDAG->getTargetNode(PPC::BL, MVT::Other, MVT::Flag, + &Ops[0], Ops.size()); Chain = SDOperand(ResNode, 0); InFlag = SDOperand(ResNode, 1); |