[PATCH] D56587: Fix sign/zero extension in Dwarf expressions.

Markus Lavin via Phabricator via llvm-commits llvm-commits at lists.llvm.org
Tue Jan 15 04:02:38 PST 2019


markus added a comment.

In D56587#1356721 <https://reviews.llvm.org/D56587#1356721>, @aprantl wrote:

> You wouldn't hardcode the offset in IR, you'd refer to the DIType as an MDNode reference and then teach the backend to resolve the reference, similar to how DIE references are resolved in the entire DIType class hierarchy.
>
> In LLVM Assembly this could look like:
>
>   !1 = !DIBasicType(name: "short", ...)
>   !2 = !DIExpression(DW_OP_convert, !1)
>
>
> but the actual implementation would be as I outlined in my previous reply.


Right, I got that part. I have a somewhat temporary solution in place for that which brings me to `DwarfExpression::addExpression` where I can pickup the corresponding `DIBasicType` when I see a `dwarf::DW_OP_convert`. Proceeding from that point seems much more difficult though since the `.debug_info` section has not been emitted yet and no DIE offsets are available. The code here expects me to emit directly into a 'ByteStreamer' object.. Maybe it is possible to implement some parallel data structure inside `DebugLocDwarfExpression` to keep track of the convert ops and allow us to insert the DIE offset at a later point when it is available.


Repository:
  rL LLVM

CHANGES SINCE LAST ACTION
  https://reviews.llvm.org/D56587/new/

https://reviews.llvm.org/D56587





More information about the llvm-commits mailing list