[PATCH] D94347: [WebAssembly] locals can now be indirect in DWARF

Wouter van Oortmerssen via Phabricator via llvm-commits llvm-commits at lists.llvm.org
Thu Feb 4 11:08:10 PST 2021


aardappel added inline comments.


================
Comment at: llvm/lib/CodeGen/AsmPrinter/DwarfExpression.cpp:671
+  if (Index == 4 /*TI_LOCAL_INDIRECT*/) {
+    emitOp(dwarf::DW_OP_deref);
+    assert(LocationKind == Unknown);
----------------
pfaffe wrote:
> If I understand correctly what TI_LOCAL_INDIRECT refers to then this leads to a double dereference.
> 
> Say you have a function `void foo(T t)` where t needs to be passed in memory as per ABI. Does TI_LOCAL_INDIRECT mean that when foo is lowered as  `.functype foo (i32) -> ()`, the value of that i32 TI_LOCAL_INDIRECT local holds the address of t?
> 
> The `DW_OP_deref` is superfluous then. DWARF expressions by default compute addresses. So once you've loaded that local's value via `DW_OP_WASM_location 0x0` onto the DWARF stack, you're done! Top-stack now contains the local's value, which is the address of the variable `t`.
The `TI_LOCAL_INDIRECT` is turned back into a `TI_LOCAL` at this point, so how is then still a double deref?

Previous conversations had indicated that the indirectness of these `byval` args is best indicated with a `DW_OP_deref`, not with `TI_LOCAL_INDIRECT`, are you saying you'd prefer the reverse?


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

https://reviews.llvm.org/D94347



More information about the llvm-commits mailing list