[PATCH] D84114: [Debuginfo] (2/8) [DW_OP_implicit_pointer/second strategy] Support for DW_OP_LLVM_explicit_pointer.

Alok Kumar Sharma via Phabricator via llvm-commits llvm-commits at lists.llvm.org
Thu Nov 12 01:30:19 PST 2020


alok added a comment.
Herald added a subscriber: dexonsmith.

In D84114#2355465 <https://reviews.llvm.org/D84114#2355465>, @dblaikie wrote:

> In D84114#2343689 <https://reviews.llvm.org/D84114#2343689>, @alok wrote:
>
>> In D84114#2336165 <https://reviews.llvm.org/D84114#2336165>, @dblaikie wrote:
>>
>>> Where's the name "explicit" pointer come from? I'm not sure how to read/understand the naming distinction between the names "implicit pointer" and "explicit pointer". Maybe the name should be "LLVM_implicit_pointer" as distinct from the DWARF "implicit_pointer" - that they're roughly the same concept, but the LLVM one is a generalization of it? Or is there something in the implicit/explicit distinction that helps clarify the semantic distinction between the two?
>>
>> We are using three operators DW_OP_LLVM_explicit_pointer, DW_OP_LLVM_implicit_pointer, DW_OP_implicit_pointer.
>> Last operator DW_OP_implicit_pointer is dumped to object file and is exact syntax as in DWARF document (DW_OP_implicit_pointer <DIE_reference> <offset_in_DIE>)
>> Second operator DW_OP_LLVM_implicit_pointer is little variation of DW_OP_implicit_pointer for use till the time the DIE reference is not available with the different syntax (DW_OP_LLVM_implicit_pointer <offset>), where one argument is implicit (first argument of dbg.value intrinsic).
>
> OK, I'm with you so far, that sounds reasonable to me.
>
>> While last two operators refer to another variable (Metadata in DW_OP_LLVM_implicit_pointer and DIE reference in DW_OP_implicit_pointer), So this is the variable where we can get the value pointed to by pointer variable (implicit way of getting the value). 
>> The first operator DW_OP_LLVM_explicit_pointer is different than other two operators. This operator is to represent the constant value itself than the other variable and it has the direct way of getting the value pointed to by pointer variable, so the name "explicit" is used.
>
> Sorry, I don't think I'm understanding "This operator is to represent the constant value itself than the other variable and it has the direct way of getting the value pointed to by pointer variable"
>
> Oh, this is for a case where, say, I wrote code like this:
>
>   const int *f1() {
>     static const int x = 3;
>     return x;
>   }
>   void f2() {
>     const int *y = f1();
>     ...
>   }
>
> Why does that need a different DW_OP compared to DW_OP_LLVM_implicit_pointer? Presumably we use dbg.values for variables with constant values without needing extra operators? (so a variable with the constant value 3 is `call void @llvm.dbg.value(metadata i32 3, metadata !11, metadata !DIExpression())` and a variable that /points to/ the constant value 3 would, I would've thought, be `call void @llvm.dbg.value(metadata i32 3, metadata !11, metadata !DIExpression(DW_OP_LLVM_implicit_pointer))`
>
>> though I am open to use any other name.

Thanks for this. It makes sense. I shall keep the same name for initial two usage. For this I shall abort the current patch (D84114 <https://reviews.llvm.org/D84114>) and make the necessary changes in first one D84113 <https://reviews.llvm.org/D84113> .


Repository:
  rG LLVM Github Monorepo

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

https://reviews.llvm.org/D84114



More information about the llvm-commits mailing list