mirror of
https://github.com/c64scene-ar/llvm-6502.git
synced 2025-04-09 01:38:03 +00:00
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:
parent
471f09090d
commit
3563015b0d
@ -111,8 +111,6 @@ void PEI::calculateCallerSavedRegisters(MachineFunction &Fn) {
|
||||
FrameSetupOpcode == -1 && FrameDestroyOpcode == -1)
|
||||
return;
|
||||
|
||||
// This bitset contains an entry for each physical register for the target...
|
||||
std::vector<char> ModifiedRegs(RegInfo->getNumRegs());
|
||||
unsigned MaxCallFrameSize = 0;
|
||||
bool HasCalls = false;
|
||||
|
||||
@ -127,19 +125,6 @@ void PEI::calculateCallerSavedRegisters(MachineFunction &Fn) {
|
||||
HasCalls = true;
|
||||
RegInfo->eliminateCallFramePseudoInstr(Fn, *BB, I++);
|
||||
} 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;
|
||||
}
|
||||
|
||||
@ -150,14 +135,15 @@ void PEI::calculateCallerSavedRegisters(MachineFunction &Fn) {
|
||||
// Now figure out which *callee saved* registers are modified by the current
|
||||
// function, thus needing to be saved and restored in the prolog/epilog.
|
||||
//
|
||||
const bool *PhysRegsUsed = Fn.getUsedPhysregs();
|
||||
for (unsigned i = 0; CSRegs[i]; ++i) {
|
||||
unsigned Reg = CSRegs[i];
|
||||
if (ModifiedRegs[Reg]) {
|
||||
RegsToSave.push_back(Reg); // If modified register...
|
||||
if (PhysRegsUsed[Reg]) {
|
||||
RegsToSave.push_back(Reg); // If the reg is modified, save it!
|
||||
} else {
|
||||
for (const unsigned *AliasSet = RegInfo->getAliasSet(Reg);
|
||||
*AliasSet; ++AliasSet) { // Check alias registers too...
|
||||
if (ModifiedRegs[*AliasSet]) {
|
||||
*AliasSet; ++AliasSet) { // Check alias registers too.
|
||||
if (PhysRegsUsed[*AliasSet]) {
|
||||
RegsToSave.push_back(Reg);
|
||||
break;
|
||||
}
|
||||
|
Loading…
x
Reference in New Issue
Block a user