summaryrefslogtreecommitdiff
path: root/src/passes/Directize.cpp
diff options
context:
space:
mode:
authorAlon Zakai <azakai@google.com>2023-09-26 15:03:07 -0700
committerGitHub <noreply@github.com>2023-09-26 15:03:07 -0700
commitd294627af51d7ca4f0d50ccdbd194b60651a76e6 (patch)
tree636460d4b200bdfac99cfa0cb2e067301e44b439 /src/passes/Directize.cpp
parent87bcf76c33356d3603e0e2721d54f6e450762627 (diff)
downloadbinaryen-d294627af51d7ca4f0d50ccdbd194b60651a76e6.tar.gz
binaryen-d294627af51d7ca4f0d50ccdbd194b60651a76e6.tar.bz2
binaryen-d294627af51d7ca4f0d50ccdbd194b60651a76e6.zip
Handle table.fill in Directize (#5974)
Like table.set, it can modify a table.
Diffstat (limited to 'src/passes/Directize.cpp')
-rw-r--r--src/passes/Directize.cpp18
1 files changed, 15 insertions, 3 deletions
diff --git a/src/passes/Directize.cpp b/src/passes/Directize.cpp
index 0bb5aebd9..34930d127 100644
--- a/src/passes/Directize.cpp
+++ b/src/passes/Directize.cpp
@@ -251,9 +251,21 @@ struct Directize : public Pass {
if (func->imported()) {
return;
}
- for (auto* set : FindAll<TableSet>(func->body).list) {
- tablesWithSet.insert(set->table);
- }
+
+ struct Finder : public PostWalker<Finder> {
+ TablesWithSet& tablesWithSet;
+
+ Finder(TablesWithSet& tablesWithSet) : tablesWithSet(tablesWithSet) {}
+
+ void visitTableSet(TableSet* curr) {
+ tablesWithSet.insert(curr->table);
+ }
+ void visitTableFill(TableFill* curr) {
+ tablesWithSet.insert(curr->table);
+ }
+ };
+
+ Finder(tablesWithSet).walkFunction(func);
});
for (auto& [_, names] : analysis.map) {