[PATCH] D41697: [DebugInfo][Metadata] Add support for a DIExpression as 'count' field of DISubrange.
Sander de Smalen via Phabricator via llvm-commits
llvm-commits at lists.llvm.org
Thu Jan 4 08:41:55 PST 2018
sdesmalen added a comment.
In https://reviews.llvm.org/D41697#967079, @aprantl wrote:
> 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.
> The use-case I had in mind was for describing generic Swift type metadata in optimized code where it might be useful to combine two variables in the same expression.
Right, if there are more than one uses for this it may be worth putting in the extra effort. My only concern is how to generate DWARF code for a generic expression with multiple references, as I don't think there is an easy way to reference a DIE in a DWARF expression. This would require generating an instance of the expression for each possible location of either value, basically propagating the locations of each variable into the expression along with a DW_OP_stack_value, and wrapping that into a location list for each live range. Is that what you had in mind?
If we decide to go that route, I do wonder if the current approach could be an intermediate step until we have further extended DIExpression?
> 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.
More information about the llvm-commits