[PATCH] D52748: [WebAssembly] LSDA info generation

Reid Kleckner via Phabricator via llvm-commits llvm-commits at lists.llvm.org
Thu Oct 11 14:11:04 PDT 2018


rnk accepted this revision.
rnk added a comment.

Looks good, I had one style comment. Glad to see this coming together. :)



================
Comment at: lib/CodeGen/SelectionDAG/SelectionDAGISel.cpp:1170-1171
 
-  // Mark exception register as live in.
-  if (unsigned Reg = TLI->getExceptionPointerRegister(PersonalityFn))
-    FuncInfo->ExceptionPointerVirtReg = MBB->addLiveIn(Reg, PtrRC);
+  if (Pers == EHPersonality::Wasm_CXX) {
+    if (const auto *CPI = dyn_cast<CatchPadInst>(LLVMBB->getFirstNonPHI())) {
+      // In case of single catch (...), we don't emit LSDA, so we don't need
----------------
I think this code would be more readable if you factor out the body of this `if` into a helper and give it some name, like `mapWasmLandingPadIndex(MBB, CPI)`. The loop to iterate over all uses is a bit complicated, but the overall effect is pretty simple.


================
Comment at: lib/CodeGen/SelectionDAG/SelectionDAGISel.cpp:1186
+              int Index = cast<ConstantInt>(IndexArg)->getZExtValue();
+              MF->setWasmLandingPadIndex(MBB, Index);
+              IntrFound = true;
----------------
I see, so this intrinsic only exists to associate this landing pad index number with the catchpad. If we had some other way to staple the number onto catchpad, that would be nicer. This seems like an OK way to do this.


Repository:
  rL LLVM

https://reviews.llvm.org/D52748





More information about the llvm-commits mailing list