Changes in directory llvm/lib/Target/PowerPC:

PPCISelDAGToDAG.cpp updated: 1.200 -> 1.201
---
Log message:

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.



---
Diffs of the changes:  (+11 -7)

 PPCISelDAGToDAG.cpp |   18 +++++++++++-------
 1 files changed, 11 insertions(+), 7 deletions(-)


Index: llvm/lib/Target/PowerPC/PPCISelDAGToDAG.cpp
diff -u llvm/lib/Target/PowerPC/PPCISelDAGToDAG.cpp:1.200 
llvm/lib/Target/PowerPC/PPCISelDAGToDAG.cpp:1.201
--- llvm/lib/Target/PowerPC/PPCISelDAGToDAG.cpp:1.200   Mon Aug  7 17:23:56 2006
+++ llvm/lib/Target/PowerPC/PPCISelDAGToDAG.cpp Mon Aug  7 21:23:41 2006
@@ -1152,7 +1152,7 @@
   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 @@
     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 @@
   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 @@
       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 @@
   // 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 @@
       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 @@
       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);



_______________________________________________
llvm-commits mailing list
llvm-commits@cs.uiuc.edu
http://lists.cs.uiuc.edu/mailman/listinfo/llvm-commits

Reply via email to