diff options
author | Adrian Prantl <aprantl@apple.com> | 2017-08-02 17:19:13 +0000 |
---|---|---|
committer | Adrian Prantl <aprantl@apple.com> | 2017-08-02 17:19:13 +0000 |
commit | bd6d291c5955c974c1c50ffe0247760454fe13a1 (patch) | |
tree | 1a8d77a10bd015c989a1111d181147e44b602bde /llvm/lib/CodeGen | |
parent | 7a2274aaed02779acda5bc4505d603b9cb5b498b (diff) | |
download | bcm5719-llvm-bd6d291c5955c974c1c50ffe0247760454fe13a1.tar.gz bcm5719-llvm-bd6d291c5955c974c1c50ffe0247760454fe13a1.zip |
Assert that the offset of a DBG_VALUE is always 0. (NFC)
llvm-svn: 309834
Diffstat (limited to 'llvm/lib/CodeGen')
-rw-r--r-- | llvm/lib/CodeGen/AsmPrinter/DwarfCompileUnit.cpp | 6 | ||||
-rw-r--r-- | llvm/lib/CodeGen/AsmPrinter/DwarfDebug.cpp | 6 |
2 files changed, 8 insertions, 4 deletions
diff --git a/llvm/lib/CodeGen/AsmPrinter/DwarfCompileUnit.cpp b/llvm/lib/CodeGen/AsmPrinter/DwarfCompileUnit.cpp index 8820d21dd14..3b73c2a07b0 100644 --- a/llvm/lib/CodeGen/AsmPrinter/DwarfCompileUnit.cpp +++ b/llvm/lib/CodeGen/AsmPrinter/DwarfCompileUnit.cpp @@ -481,9 +481,11 @@ DIE *DwarfCompileUnit::constructVariableDIEImpl(const DbgVariable &DV, if (const MachineInstr *DVInsn = DV.getMInsn()) { assert(DVInsn->getNumOperands() == 4); if (DVInsn->getOperand(0).isReg()) { - const MachineOperand RegOp = DVInsn->getOperand(0); + auto RegOp = DVInsn->getOperand(0); + auto Op1 = DVInsn->getOperand(1); // If the second operand is an immediate, this is an indirect value. - MachineLocation Location(RegOp.getReg(), DVInsn->getOperand(1).isImm()); + assert((!Op1.isImm() || (Op1.getImm() == 0)) && "unexpected offset"); + MachineLocation Location(RegOp.getReg(), Op1.isImm()); addVariableAddress(DV, *VariableDie, Location); } else if (DVInsn->getOperand(0).isImm()) { // This variable is described by a single constant. diff --git a/llvm/lib/CodeGen/AsmPrinter/DwarfDebug.cpp b/llvm/lib/CodeGen/AsmPrinter/DwarfDebug.cpp index b4bd470fe85..e44af1978a6 100644 --- a/llvm/lib/CodeGen/AsmPrinter/DwarfDebug.cpp +++ b/llvm/lib/CodeGen/AsmPrinter/DwarfDebug.cpp @@ -828,12 +828,14 @@ void DwarfDebug::collectVariableInfoFromMFTable( // Get .debug_loc entry for the instruction range starting at MI. static DebugLocEntry::Value getDebugLocValue(const MachineInstr *MI) { const DIExpression *Expr = MI->getDebugExpression(); - assert(MI->getNumOperands() == 4); if (MI->getOperand(0).isReg()) { + auto RegOp = MI->getOperand(0); + auto Op1 = MI->getOperand(1); // If the second operand is an immediate, this is a // register-indirect address. - MachineLocation MLoc(MI->getOperand(0).getReg(), MI->getOperand(1).isImm()); + assert((!Op1.isImm() || (Op1.getImm() == 0)) && "unexpected offset"); + MachineLocation MLoc(RegOp.getReg(), Op1.isImm()); return DebugLocEntry::Value(Expr, MLoc); } if (MI->getOperand(0).isImm()) |