]> granicus.if.org Git - llvm/commit
[WebAssembly] Revise the strategy for inline asm.
authorDan Gohman <dan433584@gmail.com>
Wed, 8 Nov 2017 19:18:08 +0000 (19:18 +0000)
committerDan Gohman <dan433584@gmail.com>
Wed, 8 Nov 2017 19:18:08 +0000 (19:18 +0000)
commit8e0d3d4cd77c3ffee70cb68ccc1a5d9f636d19ff
treef6027e1c71f347f0106172a496f4f7df32138193
parentcf89e1c2fe829eab7b7b62d2a88b9cbf30e1f5d6
[WebAssembly] Revise the strategy for inline asm.

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).

git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@317707 91177308-0d34-0410-b5e6-96231b3b80d8
lib/Target/WebAssembly/WebAssemblyAsmPrinter.cpp
lib/Target/WebAssembly/WebAssemblyExplicitLocals.cpp
test/CodeGen/WebAssembly/inline-asm.ll