[PATCH] D50980: [WebAssembly] Restore __stack_pointer after catch instructions

Derek Schuff via Phabricator via llvm-commits llvm-commits at lists.llvm.org
Mon Aug 20 15:36:41 PDT 2018


dschuff added inline comments.


================
Comment at: lib/Target/WebAssembly/WebAssemblyEHRestoreStackPointer.cpp:73
+    // instructions. We hoist them to the top of EH pads in LateEHPrepare, so
+    // here we just insert instructions after a catch if it stays at the top.
+    auto InsertPos = MBB.begin();
----------------
This comment is a little confusing. Looking at the code, I guess it means we just always insert the fixup at the top of the BB, (but after the catch if it hasn't been moved)?
What prevents the SP restoration from being moved after a call in the catch block?


================
Comment at: lib/Target/WebAssembly/WebAssemblyFrameLowering.h:49
+  /// Write SP back to __stack_pointer global.
+  void writeSPToMemory(unsigned SrcReg, MachineFunction &MF,
+                       MachineBasicBlock &MBB,
----------------
Since SP is now a global and not a memory address anymore, we should change this function name. I realize that's pre-existing for this change, so it can be in a different CL (either before or after this one, whatever is convenient).


Repository:
  rL LLVM

https://reviews.llvm.org/D50980





More information about the llvm-commits mailing list