mirror of
https://github.com/c64scene-ar/llvm-6502.git
synced 2025-01-13 09:33:50 +00:00
adjust to new live variables interface
git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@22992 91177308-0d34-0410-b5e6-96231b3b80d8
This commit is contained in:
parent
d177579860
commit
44b94c2185
@ -125,9 +125,9 @@ void LiveVariables::HandlePhysRegDef(unsigned Reg, MachineInstr *MI) {
|
||||
// Does this kill a previous version of this register?
|
||||
if (MachineInstr *LastUse = PhysRegInfo[Reg]) {
|
||||
if (PhysRegUsed[Reg])
|
||||
RegistersKilled.insert(std::make_pair(LastUse, Reg));
|
||||
RegistersKilled[LastUse].push_back(Reg);
|
||||
else
|
||||
RegistersDead.insert(std::make_pair(LastUse, Reg));
|
||||
RegistersDead[LastUse].push_back(Reg);
|
||||
}
|
||||
PhysRegInfo[Reg] = MI;
|
||||
PhysRegUsed[Reg] = false;
|
||||
@ -136,9 +136,9 @@ void LiveVariables::HandlePhysRegDef(unsigned Reg, MachineInstr *MI) {
|
||||
unsigned Alias = *AliasSet; ++AliasSet) {
|
||||
if (MachineInstr *LastUse = PhysRegInfo[Alias]) {
|
||||
if (PhysRegUsed[Alias])
|
||||
RegistersKilled.insert(std::make_pair(LastUse, Alias));
|
||||
RegistersKilled[LastUse].push_back(Alias);
|
||||
else
|
||||
RegistersDead.insert(std::make_pair(LastUse, Alias));
|
||||
RegistersDead[LastUse].push_back(Alias);
|
||||
}
|
||||
PhysRegInfo[Alias] = MI;
|
||||
PhysRegUsed[Alias] = false;
|
||||
@ -293,12 +293,12 @@ bool LiveVariables::runOnMachineFunction(MachineFunction &MF) {
|
||||
for (unsigned i = 0, e = VirtRegInfo.size(); i != e; ++i)
|
||||
for (unsigned j = 0, e = VirtRegInfo[i].Kills.size(); j != e; ++j) {
|
||||
if (VirtRegInfo[i].Kills[j] == VirtRegInfo[i].DefInst)
|
||||
RegistersDead.insert(std::make_pair(VirtRegInfo[i].Kills[j],
|
||||
i + MRegisterInfo::FirstVirtualRegister));
|
||||
RegistersDead[VirtRegInfo[i].Kills[j]].push_back(
|
||||
i + MRegisterInfo::FirstVirtualRegister);
|
||||
|
||||
else
|
||||
RegistersKilled.insert(std::make_pair(VirtRegInfo[i].Kills[j],
|
||||
i + MRegisterInfo::FirstVirtualRegister));
|
||||
RegistersKilled[VirtRegInfo[i].Kills[j]].push_back(
|
||||
i + MRegisterInfo::FirstVirtualRegister);
|
||||
}
|
||||
|
||||
// Check to make sure there are no unreachable blocks in the MC CFG for the
|
||||
@ -342,21 +342,23 @@ void LiveVariables::instructionChanged(MachineInstr *OldMI,
|
||||
// Move the killed information over...
|
||||
killed_iterator I, E;
|
||||
tie(I, E) = killed_range(OldMI);
|
||||
std::vector<unsigned> Regs;
|
||||
for (killed_iterator A = I; A != E; ++A)
|
||||
Regs.push_back(A->second);
|
||||
RegistersKilled.erase(I, E);
|
||||
|
||||
for (unsigned i = 0, e = Regs.size(); i != e; ++i)
|
||||
RegistersKilled.insert(std::make_pair(NewMI, Regs[i]));
|
||||
Regs.clear();
|
||||
if (I != E) {
|
||||
std::vector<unsigned> &V = RegistersKilled[NewMI];
|
||||
bool WasEmpty = V.empty();
|
||||
V.insert(V.end(), I, E);
|
||||
if (!WasEmpty)
|
||||
std::sort(V.begin(), V.end()); // Keep the reg list sorted.
|
||||
RegistersKilled.erase(OldMI);
|
||||
}
|
||||
|
||||
// Move the dead information over...
|
||||
tie(I, E) = dead_range(OldMI);
|
||||
for (killed_iterator A = I; A != E; ++A)
|
||||
Regs.push_back(A->second);
|
||||
RegistersDead.erase(I, E);
|
||||
|
||||
for (unsigned i = 0, e = Regs.size(); i != e; ++i)
|
||||
RegistersDead.insert(std::make_pair(NewMI, Regs[i]));
|
||||
if (I != E) {
|
||||
std::vector<unsigned> &V = RegistersDead[NewMI];
|
||||
bool WasEmpty = V.empty();
|
||||
V.insert(V.end(), I, E);
|
||||
if (!WasEmpty)
|
||||
std::sort(V.begin(), V.end()); // Keep the reg list sorted.
|
||||
RegistersDead.erase(OldMI);
|
||||
}
|
||||
}
|
||||
|
@ -125,19 +125,14 @@ bool PNE::EliminatePHINodes(MachineFunction &MF, MachineBasicBlock &MBB) {
|
||||
// of any registers, or if the value itself is dead, we need to move this
|
||||
// information over to the new copy we just inserted.
|
||||
//
|
||||
std::pair<LiveVariables::killed_iterator, LiveVariables::killed_iterator>
|
||||
RKs = LV->killed_range(MPhi);
|
||||
std::vector<std::pair<MachineInstr*, unsigned> > Range;
|
||||
if (RKs.first != RKs.second) // Delete the range.
|
||||
LV->removeVirtualRegistersKilled(RKs.first, RKs.second);
|
||||
LV->removeVirtualRegistersKilled(MPhi);
|
||||
|
||||
RKs = LV->dead_range(MPhi);
|
||||
std::pair<LiveVariables::killed_iterator, LiveVariables::killed_iterator>
|
||||
RKs = LV->dead_range(MPhi);
|
||||
if (RKs.first != RKs.second) {
|
||||
// Works as above...
|
||||
Range.assign(RKs.first, RKs.second);
|
||||
LV->removeVirtualRegistersDead(RKs.first, RKs.second);
|
||||
for (unsigned i = 0, e = Range.size(); i != e; ++i)
|
||||
LV->addVirtualRegisterDead(Range[i].second, PHICopy);
|
||||
for (LiveVariables::killed_iterator I = RKs.first; I != RKs.second; ++I)
|
||||
LV->addVirtualRegisterDead(*I, PHICopy);
|
||||
LV->removeVirtualRegistersDead(MPhi);
|
||||
}
|
||||
}
|
||||
|
||||
|
@ -525,7 +525,7 @@ void RA::AllocateBasicBlock(MachineBasicBlock &MBB) {
|
||||
//
|
||||
for (LiveVariables::killed_iterator KI = LV->killed_begin(MI),
|
||||
KE = LV->killed_end(MI); KI != KE; ++KI) {
|
||||
unsigned VirtReg = KI->second;
|
||||
unsigned VirtReg = *KI;
|
||||
unsigned PhysReg = VirtReg;
|
||||
if (MRegisterInfo::isVirtualRegister(VirtReg)) {
|
||||
// If the virtual register was never materialized into a register, it
|
||||
@ -605,7 +605,7 @@ void RA::AllocateBasicBlock(MachineBasicBlock &MBB) {
|
||||
//
|
||||
for (LiveVariables::killed_iterator KI = LV->dead_begin(MI),
|
||||
KE = LV->dead_end(MI); KI != KE; ++KI) {
|
||||
unsigned VirtReg = KI->second;
|
||||
unsigned VirtReg = *KI;
|
||||
unsigned PhysReg = VirtReg;
|
||||
if (MRegisterInfo::isVirtualRegister(VirtReg)) {
|
||||
unsigned &PhysRegSlot = getVirt2PhysRegMapSlot(VirtReg);
|
||||
|
Loading…
x
Reference in New Issue
Block a user