Simplify/speedup the PEI by not having to scan for uses of the callee saved

registers.  This information is computed directly by the register allocator
now.


git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@19795 91177308-0d34-0410-b5e6-96231b3b80d8
This commit is contained in:
Chris Lattner 2005-01-23 23:13:12 +00:00
parent 471f09090d
commit 3563015b0d

View File

@ -111,8 +111,6 @@ void PEI::calculateCallerSavedRegisters(MachineFunction &Fn) {
FrameSetupOpcode == -1 && FrameDestroyOpcode == -1) FrameSetupOpcode == -1 && FrameDestroyOpcode == -1)
return; return;
// This bitset contains an entry for each physical register for the target...
std::vector<char> ModifiedRegs(RegInfo->getNumRegs());
unsigned MaxCallFrameSize = 0; unsigned MaxCallFrameSize = 0;
bool HasCalls = false; bool HasCalls = false;
@ -127,19 +125,6 @@ void PEI::calculateCallerSavedRegisters(MachineFunction &Fn) {
HasCalls = true; HasCalls = true;
RegInfo->eliminateCallFramePseudoInstr(Fn, *BB, I++); RegInfo->eliminateCallFramePseudoInstr(Fn, *BB, I++);
} else { } else {
for (unsigned i = 0, e = I->getNumOperands(); i != e; ++i) {
MachineOperand &MO = I->getOperand(i);
if (MO.isRegister() && MO.isDef()) {
assert(MRegisterInfo::isPhysicalRegister(MO.getReg()) &&
"Register allocation must be performed!");
ModifiedRegs[MO.getReg()] = true; // Register is modified
}
// Mark any implicitly defined registers as being modified.
for (const unsigned *ImpDefs = TII.getImplicitDefs(I->getOpcode());
*ImpDefs; ++ImpDefs)
ModifiedRegs[*ImpDefs] = true;
}
++I; ++I;
} }
@ -150,14 +135,15 @@ void PEI::calculateCallerSavedRegisters(MachineFunction &Fn) {
// Now figure out which *callee saved* registers are modified by the current // Now figure out which *callee saved* registers are modified by the current
// function, thus needing to be saved and restored in the prolog/epilog. // function, thus needing to be saved and restored in the prolog/epilog.
// //
const bool *PhysRegsUsed = Fn.getUsedPhysregs();
for (unsigned i = 0; CSRegs[i]; ++i) { for (unsigned i = 0; CSRegs[i]; ++i) {
unsigned Reg = CSRegs[i]; unsigned Reg = CSRegs[i];
if (ModifiedRegs[Reg]) { if (PhysRegsUsed[Reg]) {
RegsToSave.push_back(Reg); // If modified register... RegsToSave.push_back(Reg); // If the reg is modified, save it!
} else { } else {
for (const unsigned *AliasSet = RegInfo->getAliasSet(Reg); for (const unsigned *AliasSet = RegInfo->getAliasSet(Reg);
*AliasSet; ++AliasSet) { // Check alias registers too... *AliasSet; ++AliasSet) { // Check alias registers too.
if (ModifiedRegs[*AliasSet]) { if (PhysRegsUsed[*AliasSet]) {
RegsToSave.push_back(Reg); RegsToSave.push_back(Reg);
break; break;
} }