[PATCH] D106525: [WebAssembly] Make Emscripten EH work with Emscripten SjLj

Heejin Ahn via Phabricator via llvm-commits llvm-commits at lists.llvm.org
Wed Jul 21 22:59:50 PDT 2021


aheejin added inline comments.


================
Comment at: llvm/lib/Target/WebAssembly/WebAssembly.h:28-29
 // LLVM IR passes.
-ModulePass *createWebAssemblyLowerEmscriptenEHSjLj(bool DoEH, bool DoSjLj);
+ModulePass *createWebAssemblyLowerEmscriptenEHSjLj(bool EnableEH,
+                                                   bool EnableSjLj);
 ModulePass *createWebAssemblyLowerGlobalDtors();
----------------
We are using `DoSjLj` and `EnableSjLj` for different meanings in the pass. `EnableSjLj` is `true` by default in Emscripten setting, but `DoSjLj` is `true` only when `setjmp` or `longjmp` is really used. This was confusing so I changed it to `Enable`.


================
Comment at: llvm/lib/Target/WebAssembly/WebAssemblyLowerEmscriptenEHSjLj.cpp:219
   bool EnableSjLj; // Enable setjmp/longjmp handling
+  bool DoSjLj;     // Whether we actually perform setjmp/longjmp handling
 
----------------
This was a local variable; I needed to access this from multiple functions so I hoisted it here.


================
Comment at: llvm/lib/Target/WebAssembly/WebAssemblyLowerEmscriptenEHSjLj.cpp:238-239
   std::set<std::string> EHAllowlistSet;
+  // Functions that contains calls to setjmp
+  SmallPtrSet<Function *, 8> SetjmpUsers;
 
----------------
This was a local variable too. It was computed right before we run `runSjLjOnFunction`, but now we precompute this because we need to access this also within `runEHOnFunction`.


Repository:
  rG LLVM Github Monorepo

CHANGES SINCE LAST ACTION
  https://reviews.llvm.org/D106525/new/

https://reviews.llvm.org/D106525



More information about the llvm-commits mailing list