Skip to content

Commit ec7e878

Browse files
committed
[EH] Change translator option name
The previous name feels too verbose and unwieldy.
1 parent 8b85d5d commit ec7e878

File tree

6 files changed

+15
-18
lines changed

6 files changed

+15
-18
lines changed

src/passes/TranslateEH.cpp

Lines changed: 9 additions & 12 deletions
Original file line numberDiff line numberDiff line change
@@ -15,7 +15,7 @@
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
@@ -25,7 +25,7 @@
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

src/passes/pass.cpp

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -491,9 +491,9 @@ void PassRegistry::registerPasses() {
491491
registerPass("strip-target-features",
492492
"strip the wasm target features section",
493493
createStripTargetFeaturesPass);
494-
registerPass("translate-eh-old-to-new",
494+
registerPass("translate-to-new-eh",
495495
"translate old EH instructions to new ones",
496-
createTranslateEHOldToNewPass);
496+
createTranslateToNewEHPass);
497497
registerPass("trap-mode-clamp",
498498
"replace trapping operations with clamping semantics",
499499
createTrapModeClamp);

src/passes/passes.h

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -164,7 +164,7 @@ Pass* createStripEHPass();
164164
Pass* createStubUnsupportedJSOpsPass();
165165
Pass* createSSAifyPass();
166166
Pass* createSSAifyNoMergePass();
167-
Pass* createTranslateEHOldToNewPass();
167+
Pass* createTranslateToNewEHPass();
168168
Pass* createTrapModeClamp();
169169
Pass* createTrapModeJS();
170170
Pass* createTupleOptimizationPass();

test/lit/help/wasm-opt.test

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -486,7 +486,7 @@
486486
;; CHECK-NEXT:
487487
;; CHECK-NEXT: --symbolmap (alias for print-function-map)
488488
;; CHECK-NEXT:
489-
;; CHECK-NEXT: --translate-eh-old-to-new translate old EH instructions to
489+
;; CHECK-NEXT: --translate-to-new-eh translate old EH instructions to
490490
;; CHECK-NEXT: new ones
491491
;; CHECK-NEXT:
492492
;; CHECK-NEXT: --trap-mode-clamp replace trapping operations with

test/lit/help/wasm2js.test

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -445,7 +445,7 @@
445445
;; CHECK-NEXT:
446446
;; CHECK-NEXT: --symbolmap (alias for print-function-map)
447447
;; CHECK-NEXT:
448-
;; CHECK-NEXT: --translate-eh-old-to-new translate old EH instructions to
448+
;; CHECK-NEXT: --translate-to-new-eh translate old EH instructions to
449449
;; CHECK-NEXT: new ones
450450
;; CHECK-NEXT:
451451
;; CHECK-NEXT: --trap-mode-clamp replace trapping operations with

test/lit/passes/translate-eh-old-to-new.wast renamed to test/lit/passes/translate-to-new-eh.wast

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,5 +1,5 @@
11
;; NOTE: Assertions have been generated by update_lit_checks.py --all-items and should not be edited.
2-
;; RUN: wasm-opt %s -all --translate-eh-old-to-new -S -o - | filecheck %s
2+
;; RUN: wasm-opt %s -all --translate-to-new-eh -S -o - | filecheck %s
33

44
(module
55
;; CHECK: (type $0 (func (result i32 i64)))

0 commit comments

Comments
 (0)