[PATCH] D38365: [WebAssembly] Revise the strategy for inline asm.

Dan Gohman via Phabricator via llvm-commits llvm-commits at lists.llvm.org
Thu Sep 28 09:01:55 PDT 2017


sunfish created this revision.
Herald added subscribers: aheejin, eraman, jfb.

Previously, an "r" constraint would mean the compiler provides a value on WebAssembly's operand stack. This was tricky to use properly, particularly since it isn't possible to declare a new local from within an inline asm string.

      

With this patch, "r" provides the value in a WebAssembly local, and the local index is provided to the inline asm string. This requires inline asm to use get_local and set_local to read the register. This does potentially result in larger code size, however inline asm should hopefully be quite rare in WebAssembly.

      

This also means that the "m" constraint can no longer be supported, as WebAssembly has nothing like a "memory operand" that includes an implicit get_local.

      

This fixes PR34599 for the wasm32-unknown-unknown-wasm target (though not for the ELF target).


Repository:
  rL LLVM

https://reviews.llvm.org/D38365

Files:
  lib/Target/WebAssembly/WebAssemblyAsmPrinter.cpp
  lib/Target/WebAssembly/WebAssemblyExplicitLocals.cpp
  test/CodeGen/WebAssembly/inline-asm-m.ll
  test/CodeGen/WebAssembly/inline-asm.ll

-------------- next part --------------
A non-text attachment was scrubbed...
Name: D38365.117003.patch
Type: text/x-patch
Size: 7021 bytes
Desc: not available
URL: <http://lists.llvm.org/pipermail/llvm-commits/attachments/20170928/661907d8/attachment.bin>


More information about the llvm-commits mailing list