diff options
author | Reid Kleckner <rnk@google.com> | 2016-02-16 21:49:26 +0000 |
---|---|---|
committer | Reid Kleckner <rnk@google.com> | 2016-02-16 21:49:26 +0000 |
commit | 9a593ee7d2455d65d4bab038174b00dde5714289 (patch) | |
tree | a2e8e79365eb7fc558260486add6723d575b9b4e | |
parent | f8f8f093aa8ba0ded2ff102d3681df11b8e68c67 (diff) | |
download | bcm5719-llvm-9a593ee7d2455d65d4bab038174b00dde5714289.tar.gz bcm5719-llvm-9a593ee7d2455d65d4bab038174b00dde5714289.zip |
[codeview] Bail on a DBG_VALUE register operand with no register
This apparently comes up when the register allocator decides that a
variable will become undef along a certain path.
Also improve the error message we emit when we can't map from LLVM
register number to CV register number.
llvm-svn: 261016
-rw-r--r-- | llvm/lib/CodeGen/AsmPrinter/CodeViewDebug.cpp | 12 | ||||
-rw-r--r-- | llvm/lib/MC/MCRegisterInfo.cpp | 4 |
2 files changed, 10 insertions, 6 deletions
diff --git a/llvm/lib/CodeGen/AsmPrinter/CodeViewDebug.cpp b/llvm/lib/CodeGen/AsmPrinter/CodeViewDebug.cpp index 5cbc8592fdf..9749d1cff35 100644 --- a/llvm/lib/CodeGen/AsmPrinter/CodeViewDebug.cpp +++ b/llvm/lib/CodeGen/AsmPrinter/CodeViewDebug.cpp @@ -594,11 +594,13 @@ void CodeViewDebug::collectVariableInfo(const DISubprogram *SP) { if (DIExpr && DIExpr->getNumElements() > 0) continue; - // Bail if the value is not indirect in memory or in a register. In these - // cases, operand 0 will not be a register. - // FIXME: CodeView does not have an obvious representation for a variable - // that has been optimized to be a constant. - if (!DVInst->getOperand(0).isReg()) + // Bail if operand 0 is not a valid register. This means the variable is a + // simple constant, or is described by a complex expression. + // FIXME: Find a way to represent constant variables, since they are + // relatively common. + unsigned Reg = + DVInst->getOperand(0).isReg() ? DVInst->getOperand(0).getReg() : 0; + if (Reg == 0) continue; // Handle the two cases we can handle: indirect in memory and in register. diff --git a/llvm/lib/MC/MCRegisterInfo.cpp b/llvm/lib/MC/MCRegisterInfo.cpp index 7af81fc7913..c76bb646c12 100644 --- a/llvm/lib/MC/MCRegisterInfo.cpp +++ b/llvm/lib/MC/MCRegisterInfo.cpp @@ -86,8 +86,10 @@ int MCRegisterInfo::getSEHRegNum(unsigned RegNum) const { } int MCRegisterInfo::getCodeViewRegNum(unsigned RegNum) const { + if (L2CVRegs.empty()) + report_fatal_error("target does not implement codeview register mapping"); const DenseMap<unsigned, int>::const_iterator I = L2CVRegs.find(RegNum); if (I == L2CVRegs.end()) - report_fatal_error("target does not implement codeview register mapping"); + report_fatal_error("unknown codeview register"); return I->second; } |