summaryrefslogtreecommitdiff
path: root/src/ir/LocalStructuralDominance.cpp
diff options
context:
space:
mode:
authorHeejin Ahn <aheejin@gmail.com>2023-12-19 11:10:27 -0800
committerGitHub <noreply@github.com>2023-12-19 11:10:27 -0800
commit4c53361b205ad30acc05136388b789296a4180f7 (patch)
treea5802be899e365b733efacba4364027b0af9c2e0 /src/ir/LocalStructuralDominance.cpp
parentcad983c975a05bc262437a6d7ed3a61020ef4e8d (diff)
downloadbinaryen-4c53361b205ad30acc05136388b789296a4180f7.tar.gz
binaryen-4c53361b205ad30acc05136388b789296a4180f7.tar.bz2
binaryen-4c53361b205ad30acc05136388b789296a4180f7.zip
[EH] Add instructions for new proposal (#6181)
This adds basic support for the new instructions in the new EH proposal passed at the Oct CG hybrid CG meeting: https://github.com/WebAssembly/meetings/blob/main/main/2023/CG-10.md https://github.com/WebAssembly/exception-handling/blob/main/proposals/exception-handling/Exceptions.md This mainly adds two instructions: `try_table` and `throw_ref`. This is the bare minimum required to read and write text and binary format, and does not include analyses or optimizations. (It includes some analysis required for validation of existing instructions.) Validation for the new instructions is not yet included. `try_table` faces the same problem with the `resume` instruction in #6083 that without the module-level tag info, we are unable to know the 'sent types' of `try_table`. This solves it with a similar approach taken in #6083: this adds `Module*` parameter to `finalize` methods, which defaults to `nullptr` when not given. The `Module*` parameter is given when called from the binary and text parser, and we cache those tag types in `sentTypes` array within `TryTable` class. In later optimization passes, as long as they don't touch tags, it is fine to call `finalize` without the `Module*`. Refer to https://github.com/WebAssembly/binaryen/pull/6083#issuecomment-1854634679 and #6096 for related discussions when `resume` was added.
Diffstat (limited to 'src/ir/LocalStructuralDominance.cpp')
-rw-r--r--src/ir/LocalStructuralDominance.cpp8
1 files changed, 8 insertions, 0 deletions
diff --git a/src/ir/LocalStructuralDominance.cpp b/src/ir/LocalStructuralDominance.cpp
index 183ca7b3f..37cd7f4ba 100644
--- a/src/ir/LocalStructuralDominance.cpp
+++ b/src/ir/LocalStructuralDominance.cpp
@@ -207,6 +207,14 @@ LocalStructuralDominance::LocalStructuralDominance(Function* func,
currp = &curr->cast<Try>()->body;
continue;
}
+ case Expression::Id::TryTableId: {
+ self->pushTask(Scanner::doEndScope, currp);
+ // Just call the task immediately.
+ doBeginScope(self, currp);
+ // Immediately continue in the try_table.
+ currp = &curr->cast<TryTable>()->body;
+ continue;
+ }
default: {
// Control flow structures have been handled. This is an expression,