mirror of
https://github.com/c64scene-ar/llvm-6502.git
synced 2024-07-18 12:29:27 +00:00
Simplify some code
git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@25924 91177308-0d34-0410-b5e6-96231b3b80d8
This commit is contained in:
parent
018c02dd11
commit
84e752a812
@ -593,7 +593,6 @@ void LocalSpiller::RewriteMBB(MachineBasicBlock &MBB, const VirtRegMap &VRM) {
|
|||||||
if (MO.isRegister() && MO.getReg() && MO.isDef()) {
|
if (MO.isRegister() && MO.getReg() && MO.isDef()) {
|
||||||
unsigned VirtReg = MO.getReg();
|
unsigned VirtReg = MO.getReg();
|
||||||
|
|
||||||
bool TakenCareOf = false;
|
|
||||||
if (!MRegisterInfo::isVirtualRegister(VirtReg)) {
|
if (!MRegisterInfo::isVirtualRegister(VirtReg)) {
|
||||||
// Check to see if this is a def-and-use vreg operand that we do need
|
// Check to see if this is a def-and-use vreg operand that we do need
|
||||||
// to insert a store for.
|
// to insert a store for.
|
||||||
@ -609,54 +608,50 @@ void LocalSpiller::RewriteMBB(MachineBasicBlock &MBB, const VirtRegMap &VRM) {
|
|||||||
|
|
||||||
if (!OpTakenCareOf) {
|
if (!OpTakenCareOf) {
|
||||||
ClobberPhysReg(VirtReg, SpillSlotsAvailable, PhysRegsAvailable);
|
ClobberPhysReg(VirtReg, SpillSlotsAvailable, PhysRegsAvailable);
|
||||||
TakenCareOf = true;
|
continue;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
if (!TakenCareOf) {
|
// The only vregs left are stack slot definitions.
|
||||||
// The only vregs left are stack slot definitions.
|
int StackSlot = VRM.getStackSlot(VirtReg);
|
||||||
int StackSlot = VRM.getStackSlot(VirtReg);
|
const TargetRegisterClass *RC =
|
||||||
const TargetRegisterClass *RC =
|
MBB.getParent()->getSSARegMap()->getRegClass(VirtReg);
|
||||||
MBB.getParent()->getSSARegMap()->getRegClass(VirtReg);
|
unsigned PhysReg;
|
||||||
unsigned PhysReg;
|
|
||||||
|
|
||||||
// If this is a def&use operand, and we used a different physreg for
|
// If this is a def&use operand, and we used a different physreg for
|
||||||
// it than the one assigned, make sure to execute the store from the
|
// it than the one assigned, make sure to execute the store from the
|
||||||
// correct physical register.
|
// correct physical register.
|
||||||
if (MO.getReg() == VirtReg)
|
if (MO.getReg() == VirtReg)
|
||||||
PhysReg = VRM.getPhys(VirtReg);
|
PhysReg = VRM.getPhys(VirtReg);
|
||||||
else
|
else
|
||||||
PhysReg = MO.getReg();
|
PhysReg = MO.getReg();
|
||||||
|
|
||||||
PhysRegsUsed[PhysReg] = true;
|
PhysRegsUsed[PhysReg] = true;
|
||||||
MRI->storeRegToStackSlot(MBB, next(MII), PhysReg, StackSlot, RC);
|
MRI->storeRegToStackSlot(MBB, next(MII), PhysReg, StackSlot, RC);
|
||||||
DEBUG(std::cerr << "Store:\t" << *next(MII));
|
DEBUG(std::cerr << "Store:\t" << *next(MII));
|
||||||
MI.SetMachineOperandReg(i, PhysReg);
|
MI.SetMachineOperandReg(i, PhysReg);
|
||||||
|
|
||||||
// If there is a dead store to this stack slot, nuke it now.
|
// If there is a dead store to this stack slot, nuke it now.
|
||||||
MachineInstr *&LastStore = MaybeDeadStores[StackSlot];
|
MachineInstr *&LastStore = MaybeDeadStores[StackSlot];
|
||||||
if (LastStore) {
|
if (LastStore) {
|
||||||
DEBUG(std::cerr << " Killed store:\t" << *LastStore);
|
DEBUG(std::cerr << " Killed store:\t" << *LastStore);
|
||||||
++NumDSE;
|
++NumDSE;
|
||||||
MBB.erase(LastStore);
|
MBB.erase(LastStore);
|
||||||
}
|
|
||||||
LastStore = next(MII);
|
|
||||||
|
|
||||||
// If the stack slot value was previously available in some other
|
|
||||||
// register, change it now. Otherwise, make the register available,
|
|
||||||
// in PhysReg.
|
|
||||||
ModifyStackSlot(StackSlot, SpillSlotsAvailable, PhysRegsAvailable);
|
|
||||||
ClobberPhysReg(PhysReg, SpillSlotsAvailable, PhysRegsAvailable);
|
|
||||||
|
|
||||||
PhysRegsAvailable.insert(std::make_pair(PhysReg, StackSlot));
|
|
||||||
SpillSlotsAvailable[StackSlot] = PhysReg;
|
|
||||||
DEBUG(std::cerr << "Updating SS#" << StackSlot <<" in physreg "
|
|
||||||
<< MRI->getName(PhysReg) << " for virtreg #"
|
|
||||||
<< VirtReg << "\n");
|
|
||||||
|
|
||||||
++NumStores;
|
|
||||||
VirtReg = PhysReg;
|
|
||||||
}
|
}
|
||||||
|
LastStore = next(MII);
|
||||||
|
|
||||||
|
// If the stack slot value was previously available in some other
|
||||||
|
// register, change it now. Otherwise, make the register available,
|
||||||
|
// in PhysReg.
|
||||||
|
ModifyStackSlot(StackSlot, SpillSlotsAvailable, PhysRegsAvailable);
|
||||||
|
ClobberPhysReg(PhysReg, SpillSlotsAvailable, PhysRegsAvailable);
|
||||||
|
|
||||||
|
PhysRegsAvailable.insert(std::make_pair(PhysReg, StackSlot));
|
||||||
|
SpillSlotsAvailable[StackSlot] = PhysReg;
|
||||||
|
DEBUG(std::cerr << "Updating SS#" << StackSlot <<" in physreg "
|
||||||
|
<< MRI->getName(PhysReg) << " for virtreg #"
|
||||||
|
<< VirtReg << "\n");
|
||||||
|
++NumStores;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
Loading…
Reference in New Issue
Block a user