Implicitly defined registers can clobber callee saved registers too!

This fixes the return-address-not-being-saved problem in the Alpha backend.


git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@19741 91177308-0d34-0410-b5e6-96231b3b80d8
This commit is contained in:
Chris Lattner 2005-01-22 00:49:16 +00:00
parent 2202bfa5a3
commit 5037a15910

View File

@ -96,6 +96,7 @@ FunctionPass *llvm::createPrologEpilogCodeInserter() { return new PEI(); }
void PEI::calculateCallerSavedRegisters(MachineFunction &Fn) { void PEI::calculateCallerSavedRegisters(MachineFunction &Fn) {
const MRegisterInfo *RegInfo = Fn.getTarget().getRegisterInfo(); const MRegisterInfo *RegInfo = Fn.getTarget().getRegisterInfo();
const TargetFrameInfo *TFI = Fn.getTarget().getFrameInfo(); const TargetFrameInfo *TFI = Fn.getTarget().getFrameInfo();
const TargetInstrInfo &TII = *Fn.getTarget().getInstrInfo();
// Get the callee saved register list... // Get the callee saved register list...
const unsigned *CSRegs = RegInfo->getCalleeSaveRegs(); const unsigned *CSRegs = RegInfo->getCalleeSaveRegs();
@ -133,6 +134,11 @@ void PEI::calculateCallerSavedRegisters(MachineFunction &Fn) {
"Register allocation must be performed!"); "Register allocation must be performed!");
ModifiedRegs[MO.getReg()] = true; // Register is modified 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;
} }