[PATCH] D44090: [WebAssembly] Support instruction selection for catching exceptions

Heejin Ahn via Phabricator via llvm-commits llvm-commits at lists.llvm.org
Thu May 10 18:40:54 PDT 2018


aheejin added inline comments.


================
Comment at: lib/CodeGen/SelectionDAG/SelectionDAGBuilder.cpp:1367
   MachineBasicBlock *CatchPadMBB = FuncInfo.MBB;
   // In MSVC C++ and CoreCLR, catchblocks are funclets and need prologues.
+  if (IsMSVCCXX || IsCoreCLR || IsWasmCXX)
----------------
dschuff wrote:
> Based on this comment  I assume we are marking 'IsEHFuncletEntry' for a different purpose than MSVC (since we don't need a function prologue)? In that case I guess this comment should be updated. Likewise below. (what do we use it for?)
Here the funclet means "BB structure starting from catchpad/cleanuppad and ending with catchret/cleanupret".

While I'm not very sure what that comment really means, I guess it's related to [[ https://github.com/llvm-mirror/llvm/blob/dcf0b3b7b3e0f1f73a03e346d36a3daca33892d0/lib/CodeGen/PrologEpilogInserter.cpp#L324 | this code ]]. I'm not very familiar with PrologEpilogInserter, but I guess that's the part wasm does not use, because we don't need to do caller-save and calle-save things.

OTOH, `MachineBasicBlock::isEHFuncletEntry()` method is used in several other places, and wasm needs at least a few of them, in which the method is used with the same meaning as `isEHPad()`. For example, [[ https://github.com/llvm-mirror/llvm/blob/dcf0b3b7b3e0f1f73a03e346d36a3daca33892d0/lib/CodeGen/Analysis.cpp#L679 | here ]] in `getFuncletMembership`, the method that computes funclet membership in order to problematic merges between funclets.

I think I should update the comment, but not very sure how. So apparently that method is used in PrologEpilogInserter but not only there and even wasm needs that at some point.


Repository:
  rL LLVM

https://reviews.llvm.org/D44090





More information about the llvm-commits mailing list