[WebAssembly] Add Wasm SjLj support
authorHeejin Ahn <aheejin@gmail.com>
Mon, 2 Aug 2021 03:03:45 +0000 (20:03 -0700)
committerHeejin Ahn <aheejin@gmail.com>
Thu, 2 Sep 2021 17:51:02 +0000 (10:51 -0700)
commit28780e59f61537c4315581475697e96d94d73d48
treebb2f48507d45f4e54e24f35960870af644f9f434
parent6860b136b9e14e7c5771b710bea7370d5020a94b
[WebAssembly] Add Wasm SjLj support

This add support for SjLj using Wasm exception handling instructions:
https://github.com/WebAssembly/exception-handling/blob/master/proposals/exception-handling/Exceptions.md

This does not yet support the mixed use of EH and SjLj within a
function. It will be added in a follow-up CL.

This currently passes all SjLj Emscripten tests for wasm0/1/2/3/s,
except for the below:
- `test_longjmp_standalone`: Uses Node
- `test_dlfcn_longjmp`: Uses NodeRAWFS
- `test_longjmp_throw`: Mixes EH and SjLj
- `test_exceptions_longjmp1`: Mixes EH and SjLj
- `test_exceptions_longjmp2`: Mixes EH and SjLj
- `test_exceptions_longjmp3`: Mixes EH and SjLj

Reviewed By: dschuff, tlively

Differential Revision: https://reviews.llvm.org/D108960
llvm/lib/CodeGen/AsmPrinter/WasmException.cpp
llvm/lib/CodeGen/SelectionDAG/SelectionDAGISel.cpp
llvm/lib/MC/WasmObjectWriter.cpp
llvm/lib/Target/WebAssembly/WebAssemblyAsmPrinter.cpp
llvm/lib/Target/WebAssembly/WebAssemblyISelDAGToDAG.cpp
llvm/lib/Target/WebAssembly/WebAssemblyLowerEmscriptenEHSjLj.cpp
llvm/test/CodeGen/WebAssembly/lower-em-sjlj.ll
llvm/test/CodeGen/WebAssembly/lower-wasm-sjlj.ll [new file with mode: 0644]