From 069d51612ff18c02aeb82e7126835811105627f4 Mon Sep 17 00:00:00 2001 From: "Vikram S. Adve" Date: Sun, 19 May 2002 15:31:08 +0000 Subject: cpValue2Value now needs a vector of MachineInstr to store return values. llvm-svn: 2644 --- llvm/lib/CodeGen/InstrSelection/InstrSelection.cpp | 36 ++++++++++++---------- 1 file changed, 20 insertions(+), 16 deletions(-) (limited to 'llvm/lib/CodeGen') diff --git a/llvm/lib/CodeGen/InstrSelection/InstrSelection.cpp b/llvm/lib/CodeGen/InstrSelection/InstrSelection.cpp index 1724ce44896..0776b159747 100644 --- a/llvm/lib/CodeGen/InstrSelection/InstrSelection.cpp +++ b/llvm/lib/CodeGen/InstrSelection/InstrSelection.cpp @@ -207,26 +207,30 @@ InsertCode4AllPhisInMeth(Function *F, TargetMachine &target) // for each incoming value of the phi, insert phi elimination // - for (unsigned i = 0; i < PN->getNumIncomingValues(); ++i) { - // insert the copy instruction to the predecessor BB - MachineInstr *CpMI = - target.getRegInfo().cpValue2Value(PN->getIncomingValue(i), - PhiCpRes); - - vector CpVec = FixConstantOperandsForInstr(PN, CpMI, - target); - CpVec.push_back(CpMI); - - InsertPhiElimInstructions(PN->getIncomingBlock(i), CpVec); - } + for (unsigned i = 0; i < PN->getNumIncomingValues(); ++i) + { // insert the copy instruction to the predecessor BB + vector mvec, CpVec; + target.getRegInfo().cpValue2Value(PN->getIncomingValue(i), PhiCpRes, + mvec); + for (vector::iterator MI=mvec.begin(); + MI != mvec.end(); ++MI) + { + vector CpVec2 = + FixConstantOperandsForInstr(PN, *MI, target); + CpVec2.push_back(*MI); + CpVec.insert(CpVec.end(), CpVec2.begin(), CpVec2.end()); + } + + InsertPhiElimInstructions(PN->getIncomingBlock(i), CpVec); + } + + vector mvec; + target.getRegInfo().cpValue2Value(PhiCpRes, PN, mvec); - MachineInstr *CpMI2 = - target.getRegInfo().cpValue2Value(PhiCpRes, PN); - // get an iterator to machine instructions in the BB MachineCodeForBasicBlock& bbMvec = BB->getMachineInstrVec(); - bbMvec.insert( bbMvec.begin(), CpMI2); + bbMvec.insert( bbMvec.begin(), mvec.begin(), mvec.end()); } else break; // since PHI nodes can only be at the top -- cgit v1.2.3