1515 */
1616
1717//
18- // TranslateEHOldToNew translates the old Phase 3 EH instructions, which include
18+ // TranslateToNewEH translates the old Phase 3 EH instructions, which include
1919// try, catch, catch_all, delegate, and rethrow, into the new EH instructions,
2020// which include try_table (with catch / catch_ref / catch_all / catch_all_ref)
2121// and throw_ref, passed at the Oct 2023 CG meeting. This translator can be used
2525// end-to-end toolchain implementation for the new spec is in progress.
2626//
2727// TODO
28- // TranslateEHNewToOld translates the new EH instructions to the old ones. This
28+ // TranslateToOldEH translates the new EH instructions to the old ones. This
2929// can be used as a stopgap tool while Binaryen implementation for the whole
3030// optimization pipeline is not complete but we need to test our LLVM
3131// implementation for the new spec. This has not been implemented yet.
@@ -45,8 +45,8 @@ namespace {
4545// Translates the old EH instructions (try / catch / catch_all / delegate /
4646// rethrow) into the new ones (try_table (+ catch / catch_ref / catch_all /
4747// catch_all_ref) / throw_ref).
48- struct TranslateEHOldToNew
49- : public WalkerPass<PostWalker<TranslateEHOldToNew >> {
48+ struct TranslateToNewEH
49+ : public WalkerPass<PostWalker<TranslateToNewEH >> {
5050 bool isFunctionParallel () override { return true ; }
5151
5252 // Scans and records which try labels are targeted by delegates and rethrows.
@@ -201,10 +201,8 @@ struct TranslateEHOldToNew
201201 // exnref) tuples for a short time.
202202 std::unordered_map<Type, Index> typeToScratchLocal;
203203
204- bool refinalize = false ;
205-
206204 std::unique_ptr<Pass> create () override {
207- return std::make_unique<TranslateEHOldToNew >();
205+ return std::make_unique<TranslateToNewEH >();
208206 }
209207
210208 // Get a scratch local for a given type. These locals are used to contain
@@ -680,7 +678,6 @@ struct TranslateEHOldToNew
680678 }
681679
682680 void visitTry (Try* curr) {
683- refinalize = true ;
684681 Builder builder (*getModule ());
685682 Block* outerBlock = nullptr ;
686683 auto it = delegateTargetToBrTarget.find (curr->name );
@@ -807,15 +804,15 @@ struct TranslateEHOldToNew
807804 }
808805};
809806
810- struct TranslateEHNewToOld
811- : public WalkerPass<PostWalker<TranslateEHNewToOld >> {
807+ struct TranslateToOldEH
808+ : public WalkerPass<PostWalker<TranslateToOldEH >> {
812809 // TODO
813810};
814811
815812} // namespace
816813
817- Pass* createTranslateEHOldToNewPass () { return new TranslateEHOldToNew (); }
814+ Pass* createTranslateToNewEHPass () { return new TranslateToNewEH (); }
818815
819- Pass* createTranslateEHNewToOldPass () { return new TranslateEHNewToOld (); }
816+ Pass* createTranslateToOldEHPass () { return new TranslateToOldEH (); }
820817
821818} // namespace wasm
0 commit comments