Emit a better error when running out of registers on inline asm.

The most likely case where this error happens is when the user specifies
too many register operands. Don't make it look like an internal LLVM bug
when we can see that the error is coming from an inline asm instruction.
For other instructions we keep the "ran out of registers" error.

llvm-svn: 192041
This commit is contained in:
Benjamin Kramer
2013-10-05 19:33:37 +00:00
parent 9a9468ee02
commit 7200a46c17
3 changed files with 7 additions and 5 deletions

View File

@@ -106,7 +106,6 @@ void RegAllocBase::allocatePhysRegs() {
if (AvailablePhysReg == ~0u) {
// selectOrSplit failed to find a register!
const char *Msg = "ran out of registers during register allocation";
// Probably caused by an inline asm.
MachineInstr *MI;
for (MachineRegisterInfo::reg_iterator I = MRI->reg_begin(VirtReg->reg);
@@ -114,9 +113,9 @@ void RegAllocBase::allocatePhysRegs() {
if (MI->isInlineAsm())
break;
if (MI)
MI->emitError(Msg);
MI->emitError("inline assembly requires more registers than available");
else
report_fatal_error(Msg);
report_fatal_error("ran out of registers during register allocation");
// Keep going after reporting the error.
VRM->assignVirt2Phys(VirtReg->reg,
RegClassInfo.getOrder(MRI->getRegClass(VirtReg->reg)).front());