mirror of
https://github.com/c64scene-ar/llvm-6502.git
synced 2025-06-26 07:24:25 +00:00
Convert DOUT to DEBUG(errs()...).
git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@79758 91177308-0d34-0410-b5e6-96231b3b80d8
This commit is contained in:
@ -294,11 +294,11 @@ void RALocal::spillVirtReg(MachineBasicBlock &MBB,
|
|||||||
assert(VirtReg && "Spilling a physical register is illegal!"
|
assert(VirtReg && "Spilling a physical register is illegal!"
|
||||||
" Must not have appropriate kill for the register or use exists beyond"
|
" Must not have appropriate kill for the register or use exists beyond"
|
||||||
" the intended one.");
|
" the intended one.");
|
||||||
DOUT << " Spilling register " << TRI->getName(PhysReg)
|
DEBUG(errs() << " Spilling register " << TRI->getName(PhysReg)
|
||||||
<< " containing %reg" << VirtReg;
|
<< " containing %reg" << VirtReg);
|
||||||
|
|
||||||
if (!isVirtRegModified(VirtReg)) {
|
if (!isVirtRegModified(VirtReg)) {
|
||||||
DOUT << " which has not been modified, so no store necessary!";
|
DEBUG(errs() << " which has not been modified, so no store necessary!");
|
||||||
std::pair<MachineInstr*, unsigned> &LastUse = getVirtRegLastUse(VirtReg);
|
std::pair<MachineInstr*, unsigned> &LastUse = getVirtRegLastUse(VirtReg);
|
||||||
if (LastUse.first)
|
if (LastUse.first)
|
||||||
LastUse.first->getOperand(LastUse.second).setIsKill();
|
LastUse.first->getOperand(LastUse.second).setIsKill();
|
||||||
@ -308,7 +308,7 @@ void RALocal::spillVirtReg(MachineBasicBlock &MBB,
|
|||||||
// modified.
|
// modified.
|
||||||
const TargetRegisterClass *RC = MF->getRegInfo().getRegClass(VirtReg);
|
const TargetRegisterClass *RC = MF->getRegInfo().getRegClass(VirtReg);
|
||||||
int FrameIndex = getStackSpaceFor(VirtReg, RC);
|
int FrameIndex = getStackSpaceFor(VirtReg, RC);
|
||||||
DOUT << " to stack slot #" << FrameIndex;
|
DEBUG(errs() << " to stack slot #" << FrameIndex);
|
||||||
// If the instruction reads the register that's spilled, (e.g. this can
|
// If the instruction reads the register that's spilled, (e.g. this can
|
||||||
// happen if it is a move to a physical register), then the spill
|
// happen if it is a move to a physical register), then the spill
|
||||||
// instruction is not a kill.
|
// instruction is not a kill.
|
||||||
@ -319,7 +319,7 @@ void RALocal::spillVirtReg(MachineBasicBlock &MBB,
|
|||||||
|
|
||||||
getVirt2PhysRegMapSlot(VirtReg) = 0; // VirtReg no longer available
|
getVirt2PhysRegMapSlot(VirtReg) = 0; // VirtReg no longer available
|
||||||
|
|
||||||
DOUT << "\n";
|
DEBUG(errs() << '\n');
|
||||||
removePhysReg(PhysReg);
|
removePhysReg(PhysReg);
|
||||||
}
|
}
|
||||||
|
|
||||||
@ -508,8 +508,8 @@ MachineInstr *RALocal::reloadVirtReg(MachineBasicBlock &MBB, MachineInstr *MI,
|
|||||||
|
|
||||||
markVirtRegModified(VirtReg, false); // Note that this reg was just reloaded
|
markVirtRegModified(VirtReg, false); // Note that this reg was just reloaded
|
||||||
|
|
||||||
DOUT << " Reloading %reg" << VirtReg << " into "
|
DEBUG(errs() << " Reloading %reg" << VirtReg << " into "
|
||||||
<< TRI->getName(PhysReg) << "\n";
|
<< TRI->getName(PhysReg) << "\n");
|
||||||
|
|
||||||
// Add move instruction(s)
|
// Add move instruction(s)
|
||||||
TII->loadRegFromStackSlot(MBB, MI, PhysReg, FrameIndex, RC);
|
TII->loadRegFromStackSlot(MBB, MI, PhysReg, FrameIndex, RC);
|
||||||
@ -714,8 +714,11 @@ void RALocal::AllocateBasicBlock(MachineBasicBlock &MBB) {
|
|||||||
// loop over each instruction
|
// loop over each instruction
|
||||||
MachineBasicBlock::iterator MII = MBB.begin();
|
MachineBasicBlock::iterator MII = MBB.begin();
|
||||||
|
|
||||||
DEBUG(const BasicBlock *LBB = MBB.getBasicBlock();
|
DEBUG({
|
||||||
if (LBB) errs() << "\nStarting RegAlloc of BB: " << LBB->getName());
|
const BasicBlock *LBB = MBB.getBasicBlock();
|
||||||
|
if (LBB)
|
||||||
|
errs() << "\nStarting RegAlloc of BB: " << LBB->getName();
|
||||||
|
});
|
||||||
|
|
||||||
// Add live-in registers as active.
|
// Add live-in registers as active.
|
||||||
for (MachineBasicBlock::livein_iterator I = MBB.livein_begin(),
|
for (MachineBasicBlock::livein_iterator I = MBB.livein_begin(),
|
||||||
@ -740,13 +743,15 @@ void RALocal::AllocateBasicBlock(MachineBasicBlock &MBB) {
|
|||||||
while (MII != MBB.end()) {
|
while (MII != MBB.end()) {
|
||||||
MachineInstr *MI = MII++;
|
MachineInstr *MI = MII++;
|
||||||
const TargetInstrDesc &TID = MI->getDesc();
|
const TargetInstrDesc &TID = MI->getDesc();
|
||||||
DEBUG(DOUT << "\nStarting RegAlloc of: " << *MI;
|
DEBUG({
|
||||||
DOUT << " Regs have values: ";
|
errs() << "\nStarting RegAlloc of: " << *MI;
|
||||||
|
errs() << " Regs have values: ";
|
||||||
for (unsigned i = 0; i != TRI->getNumRegs(); ++i)
|
for (unsigned i = 0; i != TRI->getNumRegs(); ++i)
|
||||||
if (PhysRegsUsed[i] != -1 && PhysRegsUsed[i] != -2)
|
if (PhysRegsUsed[i] != -1 && PhysRegsUsed[i] != -2)
|
||||||
DOUT << "[" << TRI->getName(i)
|
errs() << "[" << TRI->getName(i)
|
||||||
<< ",%reg" << PhysRegsUsed[i] << "] ";
|
<< ",%reg" << PhysRegsUsed[i] << "] ";
|
||||||
DOUT << "\n");
|
errs() << '\n';
|
||||||
|
});
|
||||||
|
|
||||||
// Loop over the implicit uses, making sure that they are at the head of the
|
// Loop over the implicit uses, making sure that they are at the head of the
|
||||||
// use order list, so they don't get reallocated.
|
// use order list, so they don't get reallocated.
|
||||||
@ -790,8 +795,8 @@ void RALocal::AllocateBasicBlock(MachineBasicBlock &MBB) {
|
|||||||
markVirtRegModified(DestVirtReg);
|
markVirtRegModified(DestVirtReg);
|
||||||
getVirtRegLastUse(DestVirtReg) =
|
getVirtRegLastUse(DestVirtReg) =
|
||||||
std::make_pair((MachineInstr*)0, 0);
|
std::make_pair((MachineInstr*)0, 0);
|
||||||
DOUT << " Assigning " << TRI->getName(DestPhysReg)
|
DEBUG(errs() << " Assigning " << TRI->getName(DestPhysReg)
|
||||||
<< " to %reg" << DestVirtReg << "\n";
|
<< " to %reg" << DestVirtReg << "\n");
|
||||||
MO.setReg(DestPhysReg); // Assign the earlyclobber register
|
MO.setReg(DestPhysReg); // Assign the earlyclobber register
|
||||||
} else {
|
} else {
|
||||||
unsigned Reg = MO.getReg();
|
unsigned Reg = MO.getReg();
|
||||||
@ -856,15 +861,15 @@ void RALocal::AllocateBasicBlock(MachineBasicBlock &MBB) {
|
|||||||
}
|
}
|
||||||
|
|
||||||
if (PhysReg) {
|
if (PhysReg) {
|
||||||
DOUT << " Last use of " << TRI->getName(PhysReg)
|
DEBUG(errs() << " Last use of " << TRI->getName(PhysReg)
|
||||||
<< "[%reg" << VirtReg <<"], removing it from live set\n";
|
<< "[%reg" << VirtReg <<"], removing it from live set\n");
|
||||||
removePhysReg(PhysReg);
|
removePhysReg(PhysReg);
|
||||||
for (const unsigned *SubRegs = TRI->getSubRegisters(PhysReg);
|
for (const unsigned *SubRegs = TRI->getSubRegisters(PhysReg);
|
||||||
*SubRegs; ++SubRegs) {
|
*SubRegs; ++SubRegs) {
|
||||||
if (PhysRegsUsed[*SubRegs] != -2) {
|
if (PhysRegsUsed[*SubRegs] != -2) {
|
||||||
DOUT << " Last use of "
|
DEBUG(errs() << " Last use of "
|
||||||
<< TRI->getName(*SubRegs)
|
<< TRI->getName(*SubRegs) << "[%reg" << VirtReg
|
||||||
<< "[%reg" << VirtReg <<"], removing it from live set\n";
|
<<"], removing it from live set\n");
|
||||||
removePhysReg(*SubRegs);
|
removePhysReg(*SubRegs);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
@ -949,8 +954,8 @@ void RALocal::AllocateBasicBlock(MachineBasicBlock &MBB) {
|
|||||||
MF->getRegInfo().setPhysRegUsed(DestPhysReg);
|
MF->getRegInfo().setPhysRegUsed(DestPhysReg);
|
||||||
markVirtRegModified(DestVirtReg);
|
markVirtRegModified(DestVirtReg);
|
||||||
getVirtRegLastUse(DestVirtReg) = std::make_pair((MachineInstr*)0, 0);
|
getVirtRegLastUse(DestVirtReg) = std::make_pair((MachineInstr*)0, 0);
|
||||||
DOUT << " Assigning " << TRI->getName(DestPhysReg)
|
DEBUG(errs() << " Assigning " << TRI->getName(DestPhysReg)
|
||||||
<< " to %reg" << DestVirtReg << "\n";
|
<< " to %reg" << DestVirtReg << "\n");
|
||||||
MO.setReg(DestPhysReg); // Assign the output register
|
MO.setReg(DestPhysReg); // Assign the output register
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
@ -972,16 +977,16 @@ void RALocal::AllocateBasicBlock(MachineBasicBlock &MBB) {
|
|||||||
}
|
}
|
||||||
|
|
||||||
if (PhysReg) {
|
if (PhysReg) {
|
||||||
DOUT << " Register " << TRI->getName(PhysReg)
|
DEBUG(errs() << " Register " << TRI->getName(PhysReg)
|
||||||
<< " [%reg" << VirtReg
|
<< " [%reg" << VirtReg
|
||||||
<< "] is never used, removing it from live set\n";
|
<< "] is never used, removing it from live set\n");
|
||||||
removePhysReg(PhysReg);
|
removePhysReg(PhysReg);
|
||||||
for (const unsigned *AliasSet = TRI->getAliasSet(PhysReg);
|
for (const unsigned *AliasSet = TRI->getAliasSet(PhysReg);
|
||||||
*AliasSet; ++AliasSet) {
|
*AliasSet; ++AliasSet) {
|
||||||
if (PhysRegsUsed[*AliasSet] != -2) {
|
if (PhysRegsUsed[*AliasSet] != -2) {
|
||||||
DOUT << " Register " << TRI->getName(*AliasSet)
|
DEBUG(errs() << " Register " << TRI->getName(*AliasSet)
|
||||||
<< " [%reg" << *AliasSet
|
<< " [%reg" << *AliasSet
|
||||||
<< "] is never used, removing it from live set\n";
|
<< "] is never used, removing it from live set\n");
|
||||||
removePhysReg(*AliasSet);
|
removePhysReg(*AliasSet);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
@ -1029,7 +1034,7 @@ void RALocal::AllocateBasicBlock(MachineBasicBlock &MBB) {
|
|||||||
/// runOnMachineFunction - Register allocate the whole function
|
/// runOnMachineFunction - Register allocate the whole function
|
||||||
///
|
///
|
||||||
bool RALocal::runOnMachineFunction(MachineFunction &Fn) {
|
bool RALocal::runOnMachineFunction(MachineFunction &Fn) {
|
||||||
DOUT << "Machine Function " << "\n";
|
DEBUG(errs() << "Machine Function\n");
|
||||||
MF = &Fn;
|
MF = &Fn;
|
||||||
TM = &Fn.getTarget();
|
TM = &Fn.getTarget();
|
||||||
TRI = TM->getRegisterInfo();
|
TRI = TM->getRegisterInfo();
|
||||||
|
Reference in New Issue
Block a user