diff options
author | Chris Lattner <sabre@nondot.org> | 2006-08-11 17:56:38 +0000 |
---|---|---|
committer | Chris Lattner <sabre@nondot.org> | 2006-08-11 17:56:38 +0000 |
commit | 3577e38c2b34c7978b8a1b6047eed3e421559d28 (patch) | |
tree | 7ead39f49d3b527864a40fdc4c0c04634aa16255 /lib | |
parent | 8a842cf8287ee957e15b95ceeb6ee5f189caba3d (diff) | |
download | external_llvm-3577e38c2b34c7978b8a1b6047eed3e421559d28.zip external_llvm-3577e38c2b34c7978b8a1b6047eed3e421559d28.tar.gz external_llvm-3577e38c2b34c7978b8a1b6047eed3e421559d28.tar.bz2 |
change internal impl of dag combiner so that calls to CombineTo never have to
make a temporary vector.
git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@29618 91177308-0d34-0410-b5e6-96231b3b80d8
Diffstat (limited to 'lib')
-rw-r--r-- | lib/CodeGen/SelectionDAG/DAGCombiner.cpp | 21 |
1 files changed, 9 insertions, 12 deletions
diff --git a/lib/CodeGen/SelectionDAG/DAGCombiner.cpp b/lib/CodeGen/SelectionDAG/DAGCombiner.cpp index 0e7cc2e..c7e520f 100644 --- a/lib/CodeGen/SelectionDAG/DAGCombiner.cpp +++ b/lib/CodeGen/SelectionDAG/DAGCombiner.cpp @@ -75,16 +75,17 @@ namespace { WorkList.push_back(N); } - SDOperand CombineTo(SDNode *N, const std::vector<SDOperand> &To) { + SDOperand CombineTo(SDNode *N, const SDOperand *To, unsigned NumTo) { + assert(N->getNumValues() == NumTo && "Broken CombineTo call!"); ++NodesCombined; DEBUG(std::cerr << "\nReplacing "; N->dump(); std::cerr << "\nWith: "; To[0].Val->dump(&DAG); - std::cerr << " and " << To.size()-1 << " other values\n"); + std::cerr << " and " << NumTo-1 << " other values\n"); std::vector<SDNode*> NowDead; - DAG.ReplaceAllUsesWith(N, &To[0], &NowDead); + DAG.ReplaceAllUsesWith(N, To, &NowDead); // Push the new nodes and any users onto the worklist - for (unsigned i = 0, e = To.size(); i != e; ++i) { + for (unsigned i = 0, e = NumTo; i != e; ++i) { WorkList.push_back(To[i].Val); AddUsersToWorkList(To[i].Val); } @@ -101,16 +102,12 @@ namespace { } SDOperand CombineTo(SDNode *N, SDOperand Res) { - std::vector<SDOperand> To; - To.push_back(Res); - return CombineTo(N, To); + return CombineTo(N, &Res, 1); } SDOperand CombineTo(SDNode *N, SDOperand Res0, SDOperand Res1) { - std::vector<SDOperand> To; - To.push_back(Res0); - To.push_back(Res1); - return CombineTo(N, To); + SDOperand To[] = { Res0, Res1 }; + return CombineTo(N, To, 2); } private: @@ -253,7 +250,7 @@ void TargetLowering::DAGCombinerInfo::AddToWorklist(SDNode *N) { SDOperand TargetLowering::DAGCombinerInfo:: CombineTo(SDNode *N, const std::vector<SDOperand> &To) { - return ((DAGCombiner*)DC)->CombineTo(N, To); + return ((DAGCombiner*)DC)->CombineTo(N, &To[0], To.size()); } SDOperand TargetLowering::DAGCombinerInfo:: |