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

Philip Pfaffe via Phabricator via llvm-commits llvm-commits at lists.llvm.org
Tue Feb 2 09:05:48 PST 2021


pfaffe 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);
----------------
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`.


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

https://reviews.llvm.org/D94347



More information about the llvm-commits mailing list