diff options
author | Ashley Nelson <nashley@google.com> | 2023-10-17 17:12:26 -0700 |
---|---|---|
committer | GitHub <noreply@github.com> | 2023-10-18 00:12:26 +0000 |
commit | f45207e02f3f703ef96b23957538a935856cf874 (patch) | |
tree | c4820119a1e6fc1588c92a405753c40f8eec7ed0 /src/passes/stringify-walker.h | |
parent | 1be114f36d6a4d48dec69a070de0d66a729918e6 (diff) | |
download | binaryen-f45207e02f3f703ef96b23957538a935856cf874.tar.gz binaryen-f45207e02f3f703ef96b23957538a935856cf874.tar.bz2 binaryen-f45207e02f3f703ef96b23957538a935856cf874.zip |
[Outlining] Filter Local Set (#6018)
Adds a general purpose walker named FilterStringifyWalker, intended to walk control flow and take note of whether any of the expressions satisfy the condition.
Also includes an << overload for SuffixTree::RepeatedSubstring to make debugging easier.
Diffstat (limited to 'src/passes/stringify-walker.h')
-rw-r--r-- | src/passes/stringify-walker.h | 8 |
1 files changed, 6 insertions, 2 deletions
diff --git a/src/passes/stringify-walker.h b/src/passes/stringify-walker.h index 129021bc4..55aa26940 100644 --- a/src/passes/stringify-walker.h +++ b/src/passes/stringify-walker.h @@ -178,7 +178,6 @@ struct StringifyWalker void doWalkModule(Module* module); void doWalkFunction(Function* func); - void walk(Expression* curr); static void scan(SubType* self, Expression** currp); static void doVisitExpression(SubType* self, Expression** currp); @@ -226,6 +225,7 @@ struct HashStringifyWalker : public StringifyWalker<HashStringifyWalker> { // when evaluating if expressions. std::unordered_map<Expression*, uint32_t, StringifyHasher, StringifyEquator> exprToCounter; + std::vector<Expression*> exprs; void addUniqueSymbol(SeparatorReason reason); void visitExpression(Expression* curr); @@ -234,7 +234,11 @@ struct HashStringifyWalker : public StringifyWalker<HashStringifyWalker> { // Functions that filter vectors of SuffixTree::RepeatedSubstring struct StringifyProcessor { static std::vector<SuffixTree::RepeatedSubstring> - dedupe(const std::vector<SuffixTree::RepeatedSubstring>); + dedupe(const std::vector<SuffixTree::RepeatedSubstring>&& substrings); + static std::vector<SuffixTree::RepeatedSubstring> + filter(const std::vector<SuffixTree::RepeatedSubstring>&& substrings, + const std::vector<Expression*> exprs, + std::function<bool(const Expression*)> condition); }; } // namespace wasm |