[PATCH] D52634: [WebAssembly] Add DBG_VALUE with local operands location in WebAssemblyExplicitLocals pass

Yury Delendik via Phabricator via llvm-commits llvm-commits at lists.llvm.org
Tue Dec 18 09:02:08 PST 2018


yurydelendik added a comment.

In D52634#1334701 <https://reviews.llvm.org/D52634#1334701>, @aprantl wrote:

> In D52634#1334438 <https://reviews.llvm.org/D52634#1334438>, @yurydelendik wrote:
>
> > In D52634#1293526 <https://reviews.llvm.org/D52634#1293526>, @aprantl wrote:
> >
> > > Can you explain how this new operation is meant to work?
> >
> >
> > @aprantl, here is some description of what we are trying to achieve: https://github.com/WebAssembly/debugging/issues/1#issuecomment-448237641
> >
> > In the nutshell, the WebAssembly extensions for the DWARF expression will allow us to express WebAssembly specific locations such as for locals <http://webassembly.github.io/spec/core/syntax/modules.html#syntax-func>, globals <http://webassembly.github.io/spec/core/syntax/modules.html#globals> and operands stack <http://webassembly.github.io/spec/core/syntax/instructions.html#syntax-expr>. The consumers of this information will be limited to LLVM tools, web browser debuggers and AOT/JIT WebAssembly compilers.
>
>
> Does WebAssembly have a concept of registers? You could just define three additional register numbers for WebAssembly and address a stack slot as `DW_OP_breg [wasm_stack_register] + 3` etc.. This would need less support in all the involved tools. The link says that it was considered, but rejected, but there is no mention as to why.


There is no registers in wasm. There are (somewhat) unlimited numbers of locals and  stack depth per function, globals per module. Maybe there will be more types of elements, e.g.table items? Yes, I entertained idea of complex encoding scheme as <register number> = <type>*3 + <index>. IHMO it is to brittle and does not carry any value, except to be decodable by tools that do not know how to handle it, and at the same time adds a burden to the tools that will know how to deal with and decode that. That's just my opinion. I also found that the tools (e.g. LLVM or LLDB) are eager to know about number of registers (which we cannot determine) to allocate internal structures.


Repository:
  rL LLVM

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

https://reviews.llvm.org/D52634





More information about the llvm-commits mailing list