You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
WebAssembly's local variables are not in SSA form; one can use set_local to reassign them new values at any time. SSA-based compilers can lower into non-SSA form when targeting WebAssembly. Many existing SSA-based compilers that target machine code will already have the ability to do this.
WebAssembly's expression trees do effectively provide a form of SSA, but they are limited to values that are only used once.
@sunfishcode I guess my question is: does WASM has all needed opcodes to store SSA formed code, if someone need to? And will it be beneficial to have such option?
@drom WebAssembly does not have phi functions. Compilers will need to lower these as part of lowering into non-SSA form. As I mentioned above, compilers built to target machine code will usually have support for doing this already, so there isn't a strong producer-side motivation to add phi functions to WebAssembly.
WebAssembly does have all the operators needed to support code lowered from SSA form though. I am building a WebAssembly backend for an SSA-based compiler, for example. It relies on the compiler's existing platform-independent support for lowering SSA form, including phi functions, into non-SSA form.
Activity
sunfishcode commentedon Oct 24, 2015
WebAssembly's local variables are not in SSA form; one can use
set_localto reassign them new values at any time. SSA-based compilers can lower into non-SSA form when targeting WebAssembly. Many existing SSA-based compilers that target machine code will already have the ability to do this.WebAssembly's expression trees do effectively provide a form of SSA, but they are limited to values that are only used once.
drom commentedon Oct 24, 2015
@sunfishcode I guess my question is: does WASM has all needed
opcodesto store SSA formed code, if someone need to? And will it be beneficial to have such option?sunfishcode commentedon Oct 24, 2015
@drom WebAssembly does not have phi functions. Compilers will need to lower these as part of lowering into non-SSA form. As I mentioned above, compilers built to target machine code will usually have support for doing this already, so there isn't a strong producer-side motivation to add phi functions to WebAssembly.
WebAssembly does have all the operators needed to support code lowered from SSA form though. I am building a WebAssembly backend for an SSA-based compiler, for example. It relies on the compiler's existing platform-independent support for lowering SSA form, including phi functions, into non-SSA form.
Truncate extra bits of too-large parameters to splat; closes WebAssem…
[interpreter] Add event section (WebAssembly#151)