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

Adrian Prantl via Phabricator via llvm-commits llvm-commits at lists.llvm.org
Mon Feb 4 09:41:46 PST 2019


aprantl added a comment.

In D56587#1383048 <https://reviews.llvm.org/D56587#1383048>, @markus wrote:

> > the type reference should be a metadata operand. Otherwise you'll need to implement support in llvm-link etc, too.
> >  I would just implement the type reference as normal metadata operands in DIExpression and bake the knowledge that DW_OP_convert consumes one of the metadata operands into the DIExpression operand iterator.
>
> That makes sense. I am working on that right now.


If you choose this path, one way to solve the issue of what to do with the dangling types that are produced by the conversion operations would be to create them in a separate DICompileUnit with a compiler-generated name and location. This way the types should get uniqued automatically during LTO, and you don't need to worry about llvm-link & friends.

> 
> 
>> On the other extreme, the only thing we really need from the basic types used by DW_OP_convert is the size and signedness. We could just encode that directly in the expression as DW_OP_LLVM_convert, 1, 32 for a signed int32_t or something like that. That doesn't solve the problem for how to determine which types we need to emit into the debug info, but it would be a very straightforward self-contained encoding up until AsmPrinter.
> 
> I'd much prefer a generic solution that makes it easy (at least wrt this) to use other typed DW5 ops as well down the road.

What other DWARF5 operations do you have in mind that would need pointers into the debug type hierarchy?


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

https://reviews.llvm.org/D56587





More information about the llvm-commits mailing list