diff options
| author | Jakob Stoklund Olesen <stoklund@2pi.dk> | 2011-07-02 07:17:37 +0000 |
|---|---|---|
| committer | Jakob Stoklund Olesen <stoklund@2pi.dk> | 2011-07-02 07:17:37 +0000 |
| commit | 54f7c59c1ab4e9b8116d86df9f5a401f62b44f8c (patch) | |
| tree | 495084998f5f22139e70f796f0deb42596fac0ea /llvm/lib/CodeGen/RegAllocBasic.cpp | |
| parent | 36e11ff81935beb783b93e6c556dffd181c83a26 (diff) | |
| download | bcm5719-llvm-54f7c59c1ab4e9b8116d86df9f5a401f62b44f8c.tar.gz bcm5719-llvm-54f7c59c1ab4e9b8116d86df9f5a401f62b44f8c.zip | |
Better diagnostics when inline asm fails to allocate.
asm.c:2:7: error: ran out of registers during register allocation
asm(""::"r"(0), "r"(1), "r"(2), "r"(3), "r"(4), "r"(5), "r"(6), "r"(7), "r"(8), "r"(9));
^
llvm-svn: 134310
Diffstat (limited to 'llvm/lib/CodeGen/RegAllocBasic.cpp')
| -rw-r--r-- | llvm/lib/CodeGen/RegAllocBasic.cpp | 26 |
1 files changed, 14 insertions, 12 deletions
diff --git a/llvm/lib/CodeGen/RegAllocBasic.cpp b/llvm/lib/CodeGen/RegAllocBasic.cpp index bcb38d7c35a..5ea26adc764 100644 --- a/llvm/lib/CodeGen/RegAllocBasic.cpp +++ b/llvm/lib/CodeGen/RegAllocBasic.cpp @@ -324,19 +324,21 @@ void RegAllocBase::allocatePhysRegs() { if (AvailablePhysReg == ~0u) { // selectOrSplit failed to find a register! - std::string msg; - raw_string_ostream Msg(msg); - Msg << "Ran out of registers during register allocation!" - "\nCannot allocate: " << *VirtReg; + 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); - MachineInstr *MI = I.skipInstruction();) { - if (!MI->isInlineAsm()) - continue; - Msg << "\nPlease check your inline asm statement for " - "invalid constraints:\n"; - MI->print(Msg, &VRM->getMachineFunction().getTarget()); - } - report_fatal_error(Msg.str()); + (MI = I.skipInstruction());) + if (MI->isInlineAsm()) + break; + if (MI) + MI->emitError(Msg); + else + report_fatal_error(Msg); + // Keep going after reporting the error. + VRM->assignVirt2Phys(VirtReg->reg, + RegClassInfo.getOrder(MRI->getRegClass(VirtReg->reg)).front()); + continue; } if (AvailablePhysReg) |

