[RegBankSelect] Improve debug output.

Add verbose information when checking if the current and the desired
register banks match.
Detail what happens when we assign a register bank.

llvm-svn: 265804
This commit is contained in:
Quentin Colombet 2016-04-08 16:48:16 +00:00
parent 3ba84ca62d
commit 6d6d6af226
1 changed files with 10 additions and 1 deletions

View File

@ -45,7 +45,14 @@ bool RegBankSelect::assignmentMatch(
if (ValMapping.BreakDown.size() > 1) if (ValMapping.BreakDown.size() > 1)
return false; return false;
return RBI->getRegBank(Reg, *MRI, *TRI) == ValMapping.BreakDown[0].RegBank; const RegisterBank *CurRegBank = RBI->getRegBank(Reg, *MRI, *TRI);
const RegisterBank *DesiredRegBrank = ValMapping.BreakDown[0].RegBank;
DEBUG(dbgs() << "Does assignment already match: ";
if (CurRegBank) dbgs() << *CurRegBank; else dbgs() << "none";
dbgs() << " against ";
assert(DesiredRegBrank && "The mapping must be valid");
dbgs() << *DesiredRegBrank << '\n';);
return CurRegBank == DesiredRegBrank;
} }
unsigned unsigned
@ -116,6 +123,8 @@ void RegBankSelect::assignInstr(MachineInstr &MI) {
// If that is not the case, this means the code was broken before // If that is not the case, this means the code was broken before
// hands because we should have found that the assignment match. // hands because we should have found that the assignment match.
// This will not hold when we will consider alternative mappings. // This will not hold when we will consider alternative mappings.
DEBUG(dbgs() << "Assign: " << *ValMapping.BreakDown[0].RegBank << " to "
<< PrintReg(Reg) << '\n');
MRI->setRegBank(Reg, *ValMapping.BreakDown[0].RegBank); MRI->setRegBank(Reg, *ValMapping.BreakDown[0].RegBank);
MO.setReg(Reg); MO.setReg(Reg);
} }