mirror of
https://github.com/c64scene-ar/llvm-6502.git
synced 2024-12-28 04:33:05 +00:00
Only update LiveVariables if it is available. addIntervalsForSpills
runs after the initial run of the live interval analysis. git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@16075 91177308-0d34-0410-b5e6-96231b3b80d8
This commit is contained in:
parent
ccdf21af1f
commit
d8d26b3268
@ -186,6 +186,10 @@ std::vector<LiveInterval*> LiveIntervals::addIntervalsForSpills(
|
|||||||
VirtRegMap& vrm,
|
VirtRegMap& vrm,
|
||||||
int slot)
|
int slot)
|
||||||
{
|
{
|
||||||
|
// since this is called after the analysis is done we don't know if
|
||||||
|
// LiveVariables is available
|
||||||
|
lv_ = getAnalysisToUpdate<LiveVariables>();
|
||||||
|
|
||||||
std::vector<LiveInterval*> added;
|
std::vector<LiveInterval*> added;
|
||||||
|
|
||||||
assert(li.weight != HUGE_VAL &&
|
assert(li.weight != HUGE_VAL &&
|
||||||
@ -212,8 +216,8 @@ std::vector<LiveInterval*> LiveIntervals::addIntervalsForSpills(
|
|||||||
for (unsigned i = 0; i != mi->getNumOperands(); ++i) {
|
for (unsigned i = 0; i != mi->getNumOperands(); ++i) {
|
||||||
MachineOperand& mop = mi->getOperand(i);
|
MachineOperand& mop = mi->getOperand(i);
|
||||||
if (mop.isRegister() && mop.getReg() == li.reg) {
|
if (mop.isRegister() && mop.getReg() == li.reg) {
|
||||||
if (MachineInstr* fmi =
|
if (MachineInstr* fmi = mri_->foldMemoryOperand(mi, i, slot)) {
|
||||||
mri_->foldMemoryOperand(mi, i, slot)) {
|
if (lv_)
|
||||||
lv_->instructionChanged(mi, fmi);
|
lv_->instructionChanged(mi, fmi);
|
||||||
vrm.virtFolded(li.reg, mi, fmi);
|
vrm.virtFolded(li.reg, mi, fmi);
|
||||||
mi2iMap_.erase(mi);
|
mi2iMap_.erase(mi);
|
||||||
@ -244,8 +248,7 @@ std::vector<LiveInterval*> LiveIntervals::addIntervalsForSpills(
|
|||||||
getUseIndex(index));
|
getUseIndex(index));
|
||||||
|
|
||||||
// create a new register for this spill
|
// create a new register for this spill
|
||||||
unsigned nReg =
|
unsigned nReg = mf_->getSSARegMap()->createVirtualRegister(rc);
|
||||||
mf_->getSSARegMap()->createVirtualRegister(rc);
|
|
||||||
mi->SetMachineOperandReg(i, nReg);
|
mi->SetMachineOperandReg(i, nReg);
|
||||||
vrm.grow();
|
vrm.grow();
|
||||||
vrm.assignVirt2StackSlot(nReg, slot);
|
vrm.assignVirt2StackSlot(nReg, slot);
|
||||||
@ -258,10 +261,10 @@ std::vector<LiveInterval*> LiveIntervals::addIntervalsForSpills(
|
|||||||
DEBUG(std::cerr << " +" << LR);
|
DEBUG(std::cerr << " +" << LR);
|
||||||
nI.addRange(LR);
|
nI.addRange(LR);
|
||||||
added.push_back(&nI);
|
added.push_back(&nI);
|
||||||
// update live variables
|
// update live variables if it is available
|
||||||
|
if (lv_)
|
||||||
lv_->addVirtualRegisterKilled(nReg, mi);
|
lv_->addVirtualRegisterKilled(nReg, mi);
|
||||||
DEBUG(std::cerr << "\t\t\t\tadded new interval: "
|
DEBUG(std::cerr << "\t\t\t\tadded new interval: " << nI << '\n');
|
||||||
<< nI << '\n');
|
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
Loading…
Reference in New Issue
Block a user