summaryrefslogtreecommitdiffstats
path: root/llvm/lib/CodeGen
diff options
context:
space:
mode:
Diffstat (limited to 'llvm/lib/CodeGen')
-rw-r--r--llvm/lib/CodeGen/AsmPrinter/DwarfExpression.cpp4
-rw-r--r--llvm/lib/CodeGen/MIRParser/MIParser.cpp5
-rw-r--r--llvm/lib/CodeGen/PrologEpilogInserter.cpp16
3 files changed, 22 insertions, 3 deletions
diff --git a/llvm/lib/CodeGen/AsmPrinter/DwarfExpression.cpp b/llvm/lib/CodeGen/AsmPrinter/DwarfExpression.cpp
index 41fa45f2507..48f8addd031 100644
--- a/llvm/lib/CodeGen/AsmPrinter/DwarfExpression.cpp
+++ b/llvm/lib/CodeGen/AsmPrinter/DwarfExpression.cpp
@@ -434,6 +434,10 @@ void DwarfExpression::addExpression(DIExpressionCursor &&ExprCursor,
assert(LocationKind != Register);
emitOp(dwarf::DW_OP_xderef);
break;
+ case dwarf::DW_OP_deref_size:
+ emitOp(dwarf::DW_OP_deref_size);
+ emitUnsigned(Op->getArg(0));
+ break;
default:
llvm_unreachable("unhandled opcode found in expression");
}
diff --git a/llvm/lib/CodeGen/MIRParser/MIParser.cpp b/llvm/lib/CodeGen/MIRParser/MIParser.cpp
index 971944be2f9..d414b6a0b4b 100644
--- a/llvm/lib/CodeGen/MIRParser/MIParser.cpp
+++ b/llvm/lib/CodeGen/MIRParser/MIParser.cpp
@@ -1854,6 +1854,11 @@ bool MIParser::parseDIExpression(MDNode *&Expr) {
Elements.push_back(Op);
continue;
}
+ if (unsigned Enc = dwarf::getAttributeEncoding(Token.stringValue())) {
+ lex();
+ Elements.push_back(Enc);
+ continue;
+ }
return error(Twine("invalid DWARF op '") + Token.stringValue() + "'");
}
diff --git a/llvm/lib/CodeGen/PrologEpilogInserter.cpp b/llvm/lib/CodeGen/PrologEpilogInserter.cpp
index 67834c8c352..31f962eba42 100644
--- a/llvm/lib/CodeGen/PrologEpilogInserter.cpp
+++ b/llvm/lib/CodeGen/PrologEpilogInserter.cpp
@@ -1172,12 +1172,22 @@ void PEI::replaceFrameIndices(MachineBasicBlock *BB, MachineFunction &MF,
assert(i == 0 && "Frame indices can only appear as the first "
"operand of a DBG_VALUE machine instruction");
unsigned Reg;
+ unsigned FrameIdx = MI.getOperand(0).getIndex();
+ unsigned Size = MF.getFrameInfo().getObjectSize(FrameIdx);
+
int64_t Offset =
- TFI->getFrameIndexReference(MF, MI.getOperand(0).getIndex(), Reg);
+ TFI->getFrameIndexReference(MF, FrameIdx, Reg);
MI.getOperand(0).ChangeToRegister(Reg, false /*isDef*/);
MI.getOperand(0).setIsDebug();
- auto *DIExpr = DIExpression::prepend(MI.getDebugExpression(),
- DIExpression::NoDeref, Offset);
+
+ const DIExpression *DIExpr = MI.getDebugExpression();
+ // If we already have a Implicit location expression we need to insert
+ // a deref before prepending a Memory location expression.
+ if (DIExpr->isImplicit()) {
+ SmallVector<uint64_t, 2> Ops = {dwarf::DW_OP_deref_size, Size};
+ DIExpr = DIExpression::prependOpcodes(DIExpr, Ops, DIExpression::WithStackValue);
+ }
+ DIExpr = DIExpression::prepend(DIExpr, DIExpression::NoDeref, Offset);
MI.getOperand(3).setMetadata(DIExpr);
continue;
}
OpenPOWER on IntegriCloud