<div dir="ltr"><br><br><div class="gmail_quote"><div dir="ltr">On Mon, Sep 11, 2017 at 12:35 PM Reid Kleckner <<a href="mailto:rnk@google.com">rnk@google.com</a>> wrote:<br></div><blockquote class="gmail_quote" style="margin:0 0 0 .8ex;border-left:1px #ccc solid;padding-left:1ex"><div dir="ltr"><div class="gmail_extra"><div class="gmail_quote">On Fri, Sep 8, 2017 at 10:32 AM, Adrian Prantl <span dir="ltr"><<a href="mailto:aprantl@apple.com" target="_blank">aprantl@apple.com</a>></span> wrote:<br><blockquote class="gmail_quote" style="margin:0 0 0 .8ex;border-left:1px #ccc solid;padding-left:1ex"><div><div class="m_1967867475951192242h5">> On Sep 7, 2017, at 2:18 PM, Reid Kleckner <<a href="mailto:rnk@google.com" target="_blank">rnk@google.com</a>> wrote:<br>
><br>
> On Thu, Sep 7, 2017 at 11:11 AM, Robinson, Paul <<a href="mailto:paul.robinson@sony.com" target="_blank">paul.robinson@sony.com</a>> wrote:<br>
>> Different intrinsics sounds like a good solution to me. J<br>
>><br>
>> So what happens with the case where a variable is registerized but later we decide to spill it?  Presumably we'd have a dbg.addr to point to the spill slot.  In past compilers I've used, spill slots were treated analogous to register allocation, i.e. some effort was made to minimize the number of spill slots and a variable might be spilled to different slots at different points.  If LLVM does that, then dbg.addr will have to be allowed to associated different addresses with the variable.  On the other hand, if LLVM allocates a unique memory "home" for each spilled variable, then dbg.addr can retain the property you suggest, that the address expression is always the same.<br>
><br>
> dbg.addr is really IR only. Machine DBG_VALUE instructions can already represent addresses or values depending on their second argument. At this point, I don't see any reason to change that.<br>
<br>
</div></div>If we can write a verifier to check the validity of a dbg.addr's address, why do we need the separate intrinsic? I guess the answer is that while every address must be a pointer value, not every pointer value is an address. Is this correct?<br></blockquote><div><br></div></div></div></div><div dir="ltr"><div class="gmail_extra"><div class="gmail_quote"><div>Mainly just for readability. We're encoding one bit of information: is the result of DWARF expression on the LLVM value argument the variable's address or value? The DW_OP_LLVM_memory proposal encodes that bit as a special opcode in the expression. The dbg.addr proposal makes it more first class: it's part of the IR, the intrinsic, not some possibly semantically unimportant metadata. People seem to prefer that.</div></div></div></div></blockquote><div><br>People do? I'd actually lean the other way myself (closer to DWARF, fewer first class constructs in the IR/more orthogonality, etc) - FWIW, or in case my other rambling emails were confusing. (well, maybe the intermediate state/mismatch between LLVM IR and DWARF is enough that it can't be close enough to DWARF to be sensible/tidy, so taking it further away as you're suggesting here might be better).</div></div></div>