diff options
author | Vikram S. Adve <vadve@cs.uiuc.edu> | 2002-05-19 15:31:08 +0000 |
---|---|---|
committer | Vikram S. Adve <vadve@cs.uiuc.edu> | 2002-05-19 15:31:08 +0000 |
commit | 629b70f274deb5d8ff19d7046b10df0fe1c84dc3 (patch) | |
tree | 9adb479055118b6a8e1116ea62afa676c94cd4a9 | |
parent | 7e684a956a70980160ff038047fd5f6696461db4 (diff) |
cpValue2Value now needs a vector of MachineInstr to store return values.
git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@2644 91177308-0d34-0410-b5e6-96231b3b80d8
-rw-r--r-- | lib/CodeGen/InstrSelection/InstrSelection.cpp | 36 | ||||
-rw-r--r-- | lib/Target/SparcV9/InstrSelection/InstrSelection.cpp | 36 |
2 files changed, 40 insertions, 32 deletions
diff --git a/lib/CodeGen/InstrSelection/InstrSelection.cpp b/lib/CodeGen/InstrSelection/InstrSelection.cpp index 1724ce4489..0776b15974 100644 --- a/lib/CodeGen/InstrSelection/InstrSelection.cpp +++ b/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<MachineInstr*> 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<MachineInstr*> mvec, CpVec; + target.getRegInfo().cpValue2Value(PN->getIncomingValue(i), PhiCpRes, + mvec); + for (vector<MachineInstr*>::iterator MI=mvec.begin(); + MI != mvec.end(); ++MI) + { + vector<MachineInstr*> CpVec2 = + FixConstantOperandsForInstr(PN, *MI, target); + CpVec2.push_back(*MI); + CpVec.insert(CpVec.end(), CpVec2.begin(), CpVec2.end()); + } + + InsertPhiElimInstructions(PN->getIncomingBlock(i), CpVec); + } + + vector<MachineInstr*> 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 diff --git a/lib/Target/SparcV9/InstrSelection/InstrSelection.cpp b/lib/Target/SparcV9/InstrSelection/InstrSelection.cpp index 1724ce4489..0776b15974 100644 --- a/lib/Target/SparcV9/InstrSelection/InstrSelection.cpp +++ b/lib/Target/SparcV9/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<MachineInstr*> 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<MachineInstr*> mvec, CpVec; + target.getRegInfo().cpValue2Value(PN->getIncomingValue(i), PhiCpRes, + mvec); + for (vector<MachineInstr*>::iterator MI=mvec.begin(); + MI != mvec.end(); ++MI) + { + vector<MachineInstr*> CpVec2 = + FixConstantOperandsForInstr(PN, *MI, target); + CpVec2.push_back(*MI); + CpVec.insert(CpVec.end(), CpVec2.begin(), CpVec2.end()); + } + + InsertPhiElimInstructions(PN->getIncomingBlock(i), CpVec); + } + + vector<MachineInstr*> 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 |