[PATCH] D70643: [DebugInfo] Support for DW_OP_implicit_pointer (DW_OP_LLVM_implicit_pointer)
Alok Kumar Sharma via Phabricator via llvm-commits
llvm-commits at lists.llvm.org
Sun Nov 24 09:51:39 PST 2019
alok created this revision.
alok added reviewers: aprantl, probinson, dblaikie, jmorse, jini.susan.george, SouraVX, awpandey.
alok added projects: LLVM, debug-info.
Herald added subscribers: llvm-commits, hiraditya.
This patch (2/N) stems from D69787 <https://reviews.llvm.org/D69787>
It is suggested by @aprantl
Summary:
New dwarf operator DW_OP_LLVM_implicit_pointer is introduced (present only in LLVM IR)
This is needed because representation and specification (types of operands) of it a bit different that actual dwarf exp
ression DW_OP_LLVM_implicit_pointer. while creating actual dwarf info it will be converted to DW_OP_LLVM_implicit_pointer.
Repository:
rG LLVM Github Monorepo
https://reviews.llvm.org/D70643
Files:
llvm/docs/LangRef.rst
llvm/include/llvm/BinaryFormat/Dwarf.h
llvm/lib/BinaryFormat/Dwarf.cpp
llvm/lib/IR/AsmWriter.cpp
llvm/lib/IR/DebugInfoMetadata.cpp
Index: llvm/lib/IR/DebugInfoMetadata.cpp
===================================================================
--- llvm/lib/IR/DebugInfoMetadata.cpp
+++ llvm/lib/IR/DebugInfoMetadata.cpp
@@ -837,6 +837,7 @@
case dwarf::DW_OP_LLVM_convert:
case dwarf::DW_OP_LLVM_fragment:
case dwarf::DW_OP_bregx:
+ case dwarf::DW_OP_LLVM_implicit_pointer:
return 3;
case dwarf::DW_OP_constu:
case dwarf::DW_OP_consts:
@@ -899,6 +900,10 @@
return I->get() == expr_op_begin()->get() && I->getArg(0) == 1 &&
getNumElements() == 2;
}
+ case dwarf::DW_OP_LLVM_implicit_pointer: {
+ // A DW_OP_LLVM_implicit_pointer operator must appear at the beginning
+ return I == expr_op_begin();
+ }
case dwarf::DW_OP_LLVM_convert:
case dwarf::DW_OP_LLVM_tag_offset:
case dwarf::DW_OP_constu:
Index: llvm/lib/IR/AsmWriter.cpp
===================================================================
--- llvm/lib/IR/AsmWriter.cpp
+++ llvm/lib/IR/AsmWriter.cpp
@@ -2150,6 +2150,9 @@
if (I->getOp() == dwarf::DW_OP_LLVM_convert) {
Out << FS << I->getArg(0);
Out << FS << dwarf::AttributeEncodingString(I->getArg(1));
+ } else if (I->getOp() == dwarf::DW_OP_LLVM_implicit_pointer) {
+ Out << FS << dwarf::OperationEncodingString(I->getArg(0));
+ Out << FS << I->getArg(1);
} else {
for (unsigned A = 0, AE = I->getNumArgs(); A != AE; ++A)
Out << FS << I->getArg(A);
Index: llvm/lib/BinaryFormat/Dwarf.cpp
===================================================================
--- llvm/lib/BinaryFormat/Dwarf.cpp
+++ llvm/lib/BinaryFormat/Dwarf.cpp
@@ -151,6 +151,8 @@
return "DW_OP_LLVM_tag_offset";
case DW_OP_LLVM_entry_value:
return "DW_OP_LLVM_entry_value";
+ case DW_OP_LLVM_implicit_pointer:
+ return "DW_OP_LLVM_implicit_pointer";
}
}
@@ -163,6 +165,7 @@
.Case("DW_OP_LLVM_fragment", DW_OP_LLVM_fragment)
.Case("DW_OP_LLVM_tag_offset", DW_OP_LLVM_tag_offset)
.Case("DW_OP_LLVM_entry_value", DW_OP_LLVM_entry_value)
+ .Case("DW_OP_LLVM_implicit_pointer", DW_OP_LLVM_implicit_pointer)
.Default(0);
}
Index: llvm/include/llvm/BinaryFormat/Dwarf.h
===================================================================
--- llvm/include/llvm/BinaryFormat/Dwarf.h
+++ llvm/include/llvm/BinaryFormat/Dwarf.h
@@ -121,6 +121,7 @@
DW_OP_LLVM_convert = 0x1001, ///< Only used in LLVM metadata.
DW_OP_LLVM_tag_offset = 0x1002, ///< Only used in LLVM metadata.
DW_OP_LLVM_entry_value = 0x1003, ///< Only used in LLVM metadata.
+ DW_OP_LLVM_implicit_pointer = 0x1004, ///< Only used in LLVM metadata.
};
enum TypeKind : uint8_t {
Index: llvm/docs/LangRef.rst
===================================================================
--- llvm/docs/LangRef.rst
+++ llvm/docs/LangRef.rst
@@ -4821,6 +4821,9 @@
metadata !DIExpression(DW_OP_LLVM_arg0, DW_OP_LLVM_arg1, DW_OP_plus))``
``DW_OP_LLVM_arg0`` represents ``DILocalVariable("x")`` and
``DW_OP_LLVM_arg1`` represents ``DILocalVariable("y")``.
+- ``DW_OP_LLVM_implicit_pointer, DW_OP_LLVM_arg0 N`` can only appear at the
+ beginning of a ``DIExpression``, and it specifies the value of variable
+ represented by first operand at offset N.
DWARF specifies three kinds of simple location descriptions: Register, memory,
and implicit location descriptions. Note that a location description is
-------------- next part --------------
A non-text attachment was scrubbed...
Name: D70643.230799.patch
Type: text/x-patch
Size: 3422 bytes
Desc: not available
URL: <http://lists.llvm.org/pipermail/llvm-commits/attachments/20191124/e0160f16/attachment.bin>
More information about the llvm-commits
mailing list