summaryrefslogtreecommitdiff
path: root/src/ir/branch-utils.h
diff options
context:
space:
mode:
authorFrank Emrich <git@emrich.io>2024-01-11 21:22:43 +0000
committerGitHub <noreply@github.com>2024-01-11 13:22:43 -0800
commitb4dee3dc05834ada8bf94e3e925186bc8b430c30 (patch)
tree19d3150e7438803274c1dfc03be56dff83309fe7 /src/ir/branch-utils.h
parente5948a939eb6610f1cb7742df8c54f6d17389b83 (diff)
downloadbinaryen-b4dee3dc05834ada8bf94e3e925186bc8b430c30.tar.gz
binaryen-b4dee3dc05834ada8bf94e3e925186bc8b430c30.tar.bz2
binaryen-b4dee3dc05834ada8bf94e3e925186bc8b430c30.zip
Typed continuations: resume instructions (#6083)
This PR is part of a series that adds basic support for the [typed continuations proposal](https://github.com/wasmfx/specfx). This particular PR adds support for the `resume` instruction. The most notable missing feature is validation, which is not implemented, yet.
Diffstat (limited to 'src/ir/branch-utils.h')
-rw-r--r--src/ir/branch-utils.h11
1 files changed, 11 insertions, 0 deletions
diff --git a/src/ir/branch-utils.h b/src/ir/branch-utils.h
index 3c0275701..28e29ede4 100644
--- a/src/ir/branch-utils.h
+++ b/src/ir/branch-utils.h
@@ -82,6 +82,13 @@ void operateOnScopeNameUsesAndSentTypes(Expression* expr, T func) {
func(name, tt->sentTypes[i]);
}
}
+ } else if (auto* r = expr->dynCast<Resume>()) {
+ for (Index i = 0; i < r->handlerTags.size(); i++) {
+ auto dest = r->handlerTags[i];
+ if (dest == name) {
+ func(name, r->sentTypes[i]);
+ }
+ }
} else {
assert(expr->is<Try>() || expr->is<Rethrow>()); // delegate or rethrow
}
@@ -106,6 +113,10 @@ void operateOnScopeNameUsesAndSentValues(Expression* expr, T func) {
// The values are supplied by throwing instructions, so we are unable to
// know what they will be here.
func(name, nullptr);
+ } else if (auto* res = expr->dynCast<Resume>()) {
+ // The values are supplied by suspend instructions executed while running
+ // the continuation, so we are unable to know what they will be here.
+ func(name, nullptr);
} else {
assert(expr->is<Try>() || expr->is<Rethrow>()); // delegate or rethrow
}