[llvm] [CodeGen] Port WasmEHPrepare to new pass manager (PR #74435)
via llvm-commits
llvm-commits at lists.llvm.org
Tue Dec 5 17:00:09 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();
----------------
paperchalice wrote:
Using an analysis pass to fetch information about module may be an option, or convert it to module pass. If it is a machine function pass, the machine function pass provides [`doInitialization/doFinalization`](https://llvm.org/doxygen/classllvm_1_1MachineFunctionPassManager.html).
https://github.com/llvm/llvm-project/pull/74435
More information about the llvm-commits
mailing list