[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
Wed Jan 10 08:34:52 PST 2018


sdesmalen added a comment.

In https://reviews.llvm.org/D41697#968586, @aprantl wrote:

> I just had an idea:
>
> We could represent Reg46 like this:
>
>   call @llvm.dbg.declare(undef, !0, !DIExpression(DW_OP_uconst, 2, DW_OP_mul, DW_OP_stack_value))
>   ...
>   !0 = !DIVariable(name: "$LLVM_ARM_GRANULE_REG_EXPR1")
>   !1 = !DISubrange(count: !0)
>   
>
> and the backend recognized name.startsWith("$LLVM_ARM_GRANULE_REG_") and replaces its location with DW_OP_breg46. This way we don't need to allow DIExpressions in DISubrange and keep the representation a little simpler. Let me know what you think!


@aprantl I think you convinced me that specifying the Dwarf register explicitly in the front-end is not the right way to go. We have some patches downstream to represent the size of a scalable vector with an intrinsic. We could reference that intrinsic with a dbg.value() and then match the intrinsic in the backend, similar to matching a specific name like you suggest. If we do that, the benefit of not allowing a DIExpression for the 'count' field is that a constant can only be expressed in a single way and there is no need for the auto-upgrade to DIExpression and the corresponding encoding/decoding of the constant value.

So, I think I can abandon this change...


https://reviews.llvm.org/D41697





More information about the llvm-commits mailing list