[llvm] [CodeGen] Port WasmEHPrepare to new pass manager (PR #74435)

Matt Arsenault via llvm-commits llvm-commits at lists.llvm.org
Tue Dec 5 19:37:29 PST 2023


================
@@ -113,19 +116,41 @@ class WasmEHPrepare : public FunctionPass {
   bool prepareEHPads(Function &F);
   void prepareEHPad(BasicBlock *BB, bool NeedPersonality, unsigned Index = 0);
 
+public:
+  WasmEHPrepareImpl() = default;
+  WasmEHPrepareImpl(Type *LPadContextTy_) : LPadContextTy(LPadContextTy_) {}
+  bool runOnFunction(Function &F);
+};
+
+class WasmEHPrepare : public FunctionPass {
+  WasmEHPrepareImpl P;
+
 public:
   static char ID; // Pass identification, replacement for typeid
 
   WasmEHPrepare() : FunctionPass(ID) {}
   bool doInitialization(Module &M) override;
-  bool runOnFunction(Function &F) override;
+  bool runOnFunction(Function &F) override { return P.runOnFunction(F); }
 
   StringRef getPassName() const override {
     return "WebAssembly Exception handling preparation";
   }
 };
+
 } // end anonymous namespace
 
+PreservedAnalyses WasmEHPreparePass::run(Function &F,
+                                         FunctionAnalysisManager &) {
+  auto &Context = F.getContext();
+  auto *I32Ty = Type::getInt32Ty(Context);
+  auto *PtrTy = PointerType::get(Context, F.getAddressSpace());
----------------
arsenm wrote:

If you're being precise about the address space, it should probably come from LSDA instead of the calling function 

https://github.com/llvm/llvm-project/pull/74435


More information about the llvm-commits mailing list