[PATCH] D79306: llvm rejects DWARF operator DW_OP_push_object_address.

Adrian Prantl via Phabricator via llvm-commits llvm-commits at lists.llvm.org
Fri May 8 09:05:33 PDT 2020


aprantl added a comment.

In D79306#2023359 <https://reviews.llvm.org/D79306#2023359>, @alok wrote:

> In D79306#2020789 <https://reviews.llvm.org/D79306#2020789>, @aprantl wrote:
>
> > Thanks a lot for the example!
> >
> > If `DW_OP_push_object` address is *only* going to be used inside a DISubrange and if it *always* appears at the beginning of a DIExpression bound there, we could make it implicit, the same way the first operator of a "normal" DIExpression in a dbg.value is implicitly specified by the dbg.value.
> >
> > My motivation behind this is to keep the surface area of DIExpression small. We don't necessarily want to include all DWARF operators in DIExpression, because it would make it harder to emit other debug info formats from it, transform the expression during optimizations, and generally reason about them.
> >
> > Would changing the backend to emit an automatic DW_OP_push_object before each DIExpression that represents a bound in a DISubrange work for flang, or are there other kinds of bound expressions / reasons why that would be a bad idea?
>
>
> I understand the concerns for keeping DIExpression small. But considering the DW_OP_push_object_address implicit would prevent the freedom to use expression which don't use this (DW_OP_push_object_address) DWARF operator. If it is big a 'no' for adding DW_OP_push_object_address to DIExpression, then as you suggested I would need DW_OP_LLVM_arg0 from https://reviews.llvm.org/D70642 .


My goal is to find the most consistent and useful design for LLVM IR.

Currently (without D70642 <https://reviews.llvm.org/D70642>) DIExpressions modify a location specified by the context in which they appear. A DIExpression bound to a dbg.value() might modify a DW_OP_reg, a DIExpression bound by a DIGlobalVariableExpression a DW_OP_addr, etc. Based on that prior art, it would seem logical to say that a DIExpressions inside a DISubrange implicitly starts with a DW_OP_push_object_address.

Here are a couple of questions to help decide whether that argument makes sense:

1. Can there be expressions in a DISubrange that don't contain a DW_OP_push_object_address?
2. Can there be expressions in a DISubrange where DW_OP_push_object_address is not the first operator?
3. Can DW_OP_push_object_address appear outside of a DISubrange?

If the answer to all questions in no, then I argue we should make it implicit. If the answer to any is yes, I would like to see the counterexample, to decide what the best course of action is. (For example, if the primary concern is (2), the more general DW_OP_LLVM_arg0 seems like a superior solution over adding the very DWARF-specific DW_OP_push_object_address).


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

https://reviews.llvm.org/D79306





More information about the llvm-commits mailing list