mirror of
https://github.com/c64scene-ar/llvm-6502.git
synced 2025-09-25 17:20:48 +00:00
Teach TargetRegisterInfo how to cram stack slot indexes in with the virtual and
physical register numbers. This makes the hack used in LiveInterval official, and lets LiveInterval be oblivious of stack slots. The isPhysicalRegister() and isVirtualRegister() predicates don't know about this, so when a variable may contain a stack slot, isStackSlot() should always be tested first. git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@123128 91177308-0d34-0410-b5e6-96231b3b80d8
This commit is contained in:
@@ -218,7 +218,7 @@ void StackSlotColoring::InitializeSlots() {
|
||||
for (LiveStacks::iterator i = LS->begin(), e = LS->end(); i != e; ++i) {
|
||||
LiveInterval &li = i->second;
|
||||
DEBUG(li.dump());
|
||||
int FI = li.getStackSlotIndex();
|
||||
int FI = TargetRegisterInfo::stackSlot2Index(li.reg);
|
||||
if (MFI->isDeadObjectIndex(FI))
|
||||
continue;
|
||||
SSIntervals.push_back(&li);
|
||||
@@ -261,7 +261,7 @@ StackSlotColoring::ColorSlotsWithFreeRegs(SmallVector<int, 16> &SlotMapping,
|
||||
DEBUG(dbgs() << "Assigning unused registers to spill slots:\n");
|
||||
for (unsigned i = 0, e = SSIntervals.size(); i != e; ++i) {
|
||||
LiveInterval *li = SSIntervals[i];
|
||||
int SS = li->getStackSlotIndex();
|
||||
int SS = TargetRegisterInfo::stackSlot2Index(li->reg);
|
||||
if (!UsedColors[SS] || li->weight < 20)
|
||||
// If the weight is < 20, i.e. two references in a loop with depth 1,
|
||||
// don't bother with it.
|
||||
@@ -350,7 +350,7 @@ int StackSlotColoring::ColorSlot(LiveInterval *li) {
|
||||
|
||||
// Record the assignment.
|
||||
Assignments[Color].push_back(li);
|
||||
int FI = li->getStackSlotIndex();
|
||||
int FI = TargetRegisterInfo::stackSlot2Index(li->reg);
|
||||
DEBUG(dbgs() << "Assigning fi#" << FI << " to fi#" << Color << "\n");
|
||||
|
||||
// Change size and alignment of the allocated slot. If there are multiple
|
||||
@@ -379,7 +379,7 @@ bool StackSlotColoring::ColorSlots(MachineFunction &MF) {
|
||||
bool Changed = false;
|
||||
for (unsigned i = 0, e = SSIntervals.size(); i != e; ++i) {
|
||||
LiveInterval *li = SSIntervals[i];
|
||||
int SS = li->getStackSlotIndex();
|
||||
int SS = TargetRegisterInfo::stackSlot2Index(li->reg);
|
||||
int NewSS = ColorSlot(li);
|
||||
assert(NewSS >= 0 && "Stack coloring failed?");
|
||||
SlotMapping[SS] = NewSS;
|
||||
@@ -392,7 +392,7 @@ bool StackSlotColoring::ColorSlots(MachineFunction &MF) {
|
||||
DEBUG(dbgs() << "\nSpill slots after coloring:\n");
|
||||
for (unsigned i = 0, e = SSIntervals.size(); i != e; ++i) {
|
||||
LiveInterval *li = SSIntervals[i];
|
||||
int SS = li->getStackSlotIndex();
|
||||
int SS = TargetRegisterInfo::stackSlot2Index(li->reg);
|
||||
li->weight = SlotWeights[SS];
|
||||
}
|
||||
// Sort them by new weight.
|
||||
|
Reference in New Issue
Block a user