[PATCH] D41697: [DebugInfo][Metadata] Add support for a DIExpression as 'count' field of DISubrange.

Adrian Prantl via Phabricator via llvm-commits llvm-commits at lists.llvm.org
Thu Jan 4 10:33:36 PST 2018


aprantl added a comment.

In https://reviews.llvm.org/D41697#967348, @sdesmalen wrote:

> > First the easy part: Extending DISubrange to support DIExpressions is fine, if we do this, I think that it would be better to also use a DIExpression for constants so we can avoid having two ways of representing the same thing. Writing an autoupgrade for the metadata loader should be trivial. This part LGTM, thanks!
>
> If we allow various Metadata nodes as values to 'count', I don't yet see the immediate benefit of encoding constants into DIExpression (although I'm fine either way), although the case becomes more compelling when we extend DIExpression as well and use only that.


My motivation for disallowing constants after introducing DIExpressions is that I want to avoid having more than one way to represent the same thing, since it complicates the code and brings potential for bugs.

>> How are you planning to reference the pseudo-register? By generating a pseudo-DIVariable and putting it into the DISubrange(count: ), or were you intending to hard-code a DW_OP_reg46 in the DIExpression?
> 
> Yes, we can reference reg46 directly (assuming the provided debugger correctly interprets it) and can hard-code that register into the expression.

Were you thinking of generating the DW_OP_breg46 right in the frontend? That would be certainly doable, but it is a departure from how we currently deal with DIExpressions, where DW_OP_reg operands are only generated in the backend.

I guess I'm still slightly confused about what your actual use-cases are. One thing I know is that you need to generate subranges that contain expressions referencing the pseudo-register 46. But will these expressions consist of a single DW_OP_reg46 or do you need to generate more complex expressions? If you use DIExpressions for the pseudo-register, why do you still need to reference other metadata nodes in DISubranges, is that orthogonal? I think it would help me wrap my head around your requirements if you could post some examples of DWARF you want to generate and you that would map into LLVM IR.

thanks!


https://reviews.llvm.org/D41697





More information about the llvm-commits mailing list