mirror of
https://github.com/c64scene-ar/llvm-6502.git
synced 2024-07-19 03:29:22 +00:00
Change a variable from being an iterator to a raw MachineInstr*, to make
GDB use tolerable git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@25064 91177308-0d34-0410-b5e6-96231b3b80d8
This commit is contained in:
parent
505b0701dd
commit
3b9db830f7
@ -247,7 +247,7 @@ addIntervalsForSpills(const LiveInterval &li, VirtRegMap &vrm, int slot) {
|
|||||||
index += InstrSlots::NUM;
|
index += InstrSlots::NUM;
|
||||||
if (index == end) break;
|
if (index == end) break;
|
||||||
|
|
||||||
MachineBasicBlock::iterator mi = getInstructionFromIndex(index);
|
MachineInstr *MI = getInstructionFromIndex(index);
|
||||||
|
|
||||||
// NewRegLiveIn - This instruction might have multiple uses of the spilled
|
// NewRegLiveIn - This instruction might have multiple uses of the spilled
|
||||||
// register. In this case, for the first use, keep track of the new vreg
|
// register. In this case, for the first use, keep track of the new vreg
|
||||||
@ -256,26 +256,26 @@ addIntervalsForSpills(const LiveInterval &li, VirtRegMap &vrm, int slot) {
|
|||||||
unsigned NewRegLiveIn = 0;
|
unsigned NewRegLiveIn = 0;
|
||||||
|
|
||||||
for_operand:
|
for_operand:
|
||||||
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 (NewRegLiveIn && mop.isUse()) {
|
if (NewRegLiveIn && mop.isUse()) {
|
||||||
// We already emitted a reload of this value, reuse it for
|
// We already emitted a reload of this value, reuse it for
|
||||||
// subsequent operands.
|
// subsequent operands.
|
||||||
mi->SetMachineOperandReg(i, NewRegLiveIn);
|
MI->SetMachineOperandReg(i, NewRegLiveIn);
|
||||||
DEBUG(std::cerr << "\t\t\t\treused reload into reg" << NewRegLiveIn
|
DEBUG(std::cerr << "\t\t\t\treused reload into reg" << NewRegLiveIn
|
||||||
<< " for operand #" << i << '\n');
|
<< " for operand #" << i << '\n');
|
||||||
} else if (MachineInstr* fmi = mri_->foldMemoryOperand(mi, i, slot)) {
|
} else if (MachineInstr* fmi = mri_->foldMemoryOperand(MI, i, slot)) {
|
||||||
// Attempt to fold the memory reference into the instruction. If we
|
// Attempt to fold the memory reference into the instruction. If we
|
||||||
// can do this, we don't need to insert spill code.
|
// can do this, we don't need to insert spill code.
|
||||||
if (lv_)
|
if (lv_)
|
||||||
lv_->instructionChanged(mi, fmi);
|
lv_->instructionChanged(MI, fmi);
|
||||||
vrm.virtFolded(li.reg, mi, i, fmi);
|
vrm.virtFolded(li.reg, MI, i, fmi);
|
||||||
mi2iMap_.erase(mi);
|
mi2iMap_.erase(MI);
|
||||||
i2miMap_[index/InstrSlots::NUM] = fmi;
|
i2miMap_[index/InstrSlots::NUM] = fmi;
|
||||||
mi2iMap_[fmi] = index;
|
mi2iMap_[fmi] = index;
|
||||||
MachineBasicBlock &MBB = *mi->getParent();
|
MachineBasicBlock &MBB = *MI->getParent();
|
||||||
mi = MBB.insert(MBB.erase(mi), fmi);
|
MI = MBB.insert(MBB.erase(MI), fmi);
|
||||||
++numFolded;
|
++numFolded;
|
||||||
|
|
||||||
// Folding the load/store can completely change the instruction in
|
// Folding the load/store can completely change the instruction in
|
||||||
@ -300,7 +300,7 @@ addIntervalsForSpills(const LiveInterval &li, VirtRegMap &vrm, int slot) {
|
|||||||
|
|
||||||
// create a new register for this spill
|
// create a new register for this spill
|
||||||
NewRegLiveIn = mf_->getSSARegMap()->createVirtualRegister(rc);
|
NewRegLiveIn = mf_->getSSARegMap()->createVirtualRegister(rc);
|
||||||
mi->SetMachineOperandReg(i, NewRegLiveIn);
|
MI->SetMachineOperandReg(i, NewRegLiveIn);
|
||||||
vrm.grow();
|
vrm.grow();
|
||||||
vrm.assignVirt2StackSlot(NewRegLiveIn, slot);
|
vrm.assignVirt2StackSlot(NewRegLiveIn, slot);
|
||||||
LiveInterval& nI = getOrCreateInterval(NewRegLiveIn);
|
LiveInterval& nI = getOrCreateInterval(NewRegLiveIn);
|
||||||
@ -316,7 +316,7 @@ addIntervalsForSpills(const LiveInterval &li, VirtRegMap &vrm, int slot) {
|
|||||||
|
|
||||||
// update live variables if it is available
|
// update live variables if it is available
|
||||||
if (lv_)
|
if (lv_)
|
||||||
lv_->addVirtualRegisterKilled(NewRegLiveIn, mi);
|
lv_->addVirtualRegisterKilled(NewRegLiveIn, MI);
|
||||||
|
|
||||||
// If this is a live in, reuse it for subsequent live-ins. If it's
|
// If this is a live in, reuse it for subsequent live-ins. If it's
|
||||||
// a def, we can't do this.
|
// a def, we can't do this.
|
||||||
|
Loading…
Reference in New Issue
Block a user