[PATCH] D101985: [WebAssembly] Support Emscripten EH/SjLj in Wasm64

Heejin Ahn via Phabricator via llvm-commits llvm-commits at lists.llvm.org
Thu May 6 03:42:49 PDT 2021


aheejin created this revision.
aheejin added reviewers: aardappel, sbc100.
Herald added subscribers: wingo, ecnelises, sunfish, hiraditya, jgravelle-google, dschuff.
aheejin requested review of this revision.
Herald added a project: LLVM.
Herald added a subscriber: llvm-commits.

In wasm64, the signatures of some library functions and global variables
defined in Emscripten change:

- `emscripten_longjmp`: `(i32, i32) -> ()` -> `(i64, i32) -> ()` This changes because the first argument is the address of a memory buffer. This in turn causes more changes below.
- `setThrew`: `(i32, i32) -> ()` -> `(i64, i32) -> ()` `emscripten_longjmp` calls `setThrew` with the i64 buffer argument as the first parameter.
- `__THREW__` (global var): `i32` to `i64` `setThrew`'s first argument is set to this `__THREW__` variable, so it should change to i64 as well.
- `testSetjmp`: `(i32, i32*, i32) -> (i32)` -> `(i64, i32*, i32) ->

(i32)`

  In the code transformation done in this pass, the value of `__THREW__`
  is passed as the first parameter of `testSetjmp`.

This patch creates some helper functions to easily get types that become
different depending on the wasm32/wasm64, and uses them to change
various function signatures and code transformations. Also updates the
tests with WASM32/WASM64 check lines.


Repository:
  rG LLVM Github Monorepo

https://reviews.llvm.org/D101985

Files:
  llvm/lib/Target/WebAssembly/WebAssemblyLowerEmscriptenEHSjLj.cpp
  llvm/test/CodeGen/WebAssembly/lower-em-ehsjlj-options.ll
  llvm/test/CodeGen/WebAssembly/lower-em-exceptions.ll
  llvm/test/CodeGen/WebAssembly/lower-em-sjlj.ll

-------------- next part --------------
A non-text attachment was scrubbed...
Name: D101985.343345.patch
Type: text/x-patch
Size: 29419 bytes
Desc: not available
URL: <http://lists.llvm.org/pipermail/llvm-commits/attachments/20210506/3f2a5413/attachment.bin>


More information about the llvm-commits mailing list