summaryrefslogtreecommitdiff
path: root/src/passes/pass.cpp
diff options
context:
space:
mode:
authorThomas Lively <tlively@google.com>2024-08-16 22:14:06 -0400
committerGitHub <noreply@github.com>2024-08-17 02:14:06 +0000
commite058bfbdf31c7b59df8ab62a9ebaedac45521c12 (patch)
treeffdb01a6e5f76057a6f654c2df29f0c6e551d276 /src/passes/pass.cpp
parent95a4d5de6f65b35a64caf014c2f7febb8a799542 (diff)
downloadbinaryen-e058bfbdf31c7b59df8ab62a9ebaedac45521c12.tar.gz
binaryen-e058bfbdf31c7b59df8ab62a9ebaedac45521c12.tar.bz2
binaryen-e058bfbdf31c7b59df8ab62a9ebaedac45521c12.zip
Add a pass for minimizing recursion groups (#6832)
Most of our type optimization passes emit all non-public types as a single large rec group, which trivially ensures that different types remain different, even if they are optimized to have the same structure. Usually emitting a single large rec group is fine, but it also means that if the module is split, all of the types will need to be repeated in all of the split modules. To better support this use case, add a pass that can split the large rec group back into minimal rec groups, taking care to preserve separate type identities by emitting different permutations of the same group where possible or by inserting unused brand types to differentiate them.
Diffstat (limited to 'src/passes/pass.cpp')
-rw-r--r--src/passes/pass.cpp3
1 files changed, 3 insertions, 0 deletions
diff --git a/src/passes/pass.cpp b/src/passes/pass.cpp
index 3f84ee604..ccfc7b728 100644
--- a/src/passes/pass.cpp
+++ b/src/passes/pass.cpp
@@ -290,6 +290,9 @@ void PassRegistry::registerPasses() {
"minifies both import and export names, and emits a mapping to "
"the minified ones, and minifies the modules as well",
createMinifyImportsAndExportsAndModulesPass);
+ registerPass("minimize-rec-groups",
+ "Split types into minimal recursion groups",
+ createMinimizeRecGroupsPass);
registerPass("mod-asyncify-always-and-only-unwind",
"apply the assumption that asyncify imports always unwind, "
"and we never rewind",