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
This commit is contained in:
Vikram S. Adve 2002-05-19 15:31:08 +00:00
parent 7e684a956a
commit 629b70f274
2 changed files with 40 additions and 32 deletions

View File

@ -207,26 +207,30 @@ InsertCode4AllPhisInMeth(Function *F, TargetMachine &target)
// for each incoming value of the phi, insert phi elimination // for each incoming value of the phi, insert phi elimination
// //
for (unsigned i = 0; i < PN->getNumIncomingValues(); ++i) { for (unsigned i = 0; i < PN->getNumIncomingValues(); ++i)
// insert the copy instruction to the predecessor BB { // insert the copy instruction to the predecessor BB
MachineInstr *CpMI = vector<MachineInstr*> mvec, CpVec;
target.getRegInfo().cpValue2Value(PN->getIncomingValue(i), target.getRegInfo().cpValue2Value(PN->getIncomingValue(i), PhiCpRes,
PhiCpRes); mvec);
for (vector<MachineInstr*>::iterator MI=mvec.begin();
vector<MachineInstr*> CpVec = FixConstantOperandsForInstr(PN, CpMI, MI != mvec.end(); ++MI)
target); {
CpVec.push_back(CpMI); vector<MachineInstr*> CpVec2 =
FixConstantOperandsForInstr(PN, *MI, target);
InsertPhiElimInstructions(PN->getIncomingBlock(i), CpVec); 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 // get an iterator to machine instructions in the BB
MachineCodeForBasicBlock& bbMvec = BB->getMachineInstrVec(); 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 else break; // since PHI nodes can only be at the top

View File

@ -207,26 +207,30 @@ InsertCode4AllPhisInMeth(Function *F, TargetMachine &target)
// for each incoming value of the phi, insert phi elimination // for each incoming value of the phi, insert phi elimination
// //
for (unsigned i = 0; i < PN->getNumIncomingValues(); ++i) { for (unsigned i = 0; i < PN->getNumIncomingValues(); ++i)
// insert the copy instruction to the predecessor BB { // insert the copy instruction to the predecessor BB
MachineInstr *CpMI = vector<MachineInstr*> mvec, CpVec;
target.getRegInfo().cpValue2Value(PN->getIncomingValue(i), target.getRegInfo().cpValue2Value(PN->getIncomingValue(i), PhiCpRes,
PhiCpRes); mvec);
for (vector<MachineInstr*>::iterator MI=mvec.begin();
vector<MachineInstr*> CpVec = FixConstantOperandsForInstr(PN, CpMI, MI != mvec.end(); ++MI)
target); {
CpVec.push_back(CpMI); vector<MachineInstr*> CpVec2 =
FixConstantOperandsForInstr(PN, *MI, target);
InsertPhiElimInstructions(PN->getIncomingBlock(i), CpVec); 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 // get an iterator to machine instructions in the BB
MachineCodeForBasicBlock& bbMvec = BB->getMachineInstrVec(); 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 else break; // since PHI nodes can only be at the top