[PATCH] D46803: [WebAssembly] Add WebAssemblyExceptionPrepare pass

Derek Schuff via Phabricator via llvm-commits llvm-commits at lists.llvm.org
Tue Jun 19 14:03:53 PDT 2018


dschuff added inline comments.


================
Comment at: lib/Target/WebAssembly/WebAssemblyExceptionPrepare.cpp:27
 namespace {
 class WebAssemblyExceptionPrepare final : public MachineFunctionPass {
   StringRef getPassName() const override {
----------------
I didn't think about the confusing-ness of this name when we put it in originally; maybe we could call it 'WebAssemblyMachineEHPrepare' or 'WebAssemblyLateEHPrepare'


================
Comment at: lib/Target/WebAssembly/WebAssemblyExceptionPrepare.cpp:110
+  Changed |= addRethrows(MF);
   if (!MF.getFunction().hasPersonalityFn())
+    return Changed;
----------------
So a function can rethrow but not have a personality function?


================
Comment at: lib/Target/WebAssembly/WebAssemblyExceptionPrepare.cpp:168
+//   %exn = catch 0
+// (2) catch instructionis in a non-EH pad BB. For example,
+// ehpad:
----------------
'instruction is'


================
Comment at: lib/Target/WebAssembly/WebAssemblyExceptionPrepare.cpp:212
+// Add a 'rethrow' instruction after __cxa_rethrow() call
+bool WebAssemblyExceptionPrepare::addRethrows(MachineFunction &MF) {
+  bool Changed = false;
----------------
Would it make more sense to just have the rethrow inside of cxa_rethrow (at least if the destination is the caller)? It might save some on code size? I guess we would just have to put an 'unreachable' after the call and it wouldn't matter; or is there some other reason?


Repository:
  rL LLVM

https://reviews.llvm.org/D46803





More information about the llvm-commits mailing list