diff options
author | Thomas Lively <7121787+tlively@users.noreply.github.com> | 2022-01-14 11:50:52 -0800 |
---|---|---|
committer | GitHub <noreply@github.com> | 2022-01-14 11:50:52 -0800 |
commit | 8e8284e6464d524bd9091f21a62982ed54df0093 (patch) | |
tree | 13b88033d4e5d2f8d53289807efdd6b88055e0be /src/passes/Print.cpp | |
parent | 80329023c30ca108b0a8ce1b3939f5e9a96250bb (diff) | |
download | binaryen-8e8284e6464d524bd9091f21a62982ed54df0093.tar.gz binaryen-8e8284e6464d524bd9091f21a62982ed54df0093.tar.bz2 binaryen-8e8284e6464d524bd9091f21a62982ed54df0093.zip |
Refactor ModuleUtils::collectHeapTypes (#4455)
Update the API to make both the type indices and optimized sorting optional.
It will become more important to avoid unnecessary sorting once isorecursive
types have been implemented because they will make the sorting more complicated.
Diffstat (limited to 'src/passes/Print.cpp')
-rw-r--r-- | src/passes/Print.cpp | 8 |
1 files changed, 4 insertions, 4 deletions
diff --git a/src/passes/Print.cpp b/src/passes/Print.cpp index 33d817326..7bcf23b8e 100644 --- a/src/passes/Print.cpp +++ b/src/passes/Print.cpp @@ -3064,10 +3064,10 @@ struct PrintSExpression : public UnifiedExpressionVisitor<PrintSExpression> { printName(curr->name, o); } incIndent(); - std::vector<HeapType> types; - std::unordered_map<HeapType, Index> indices; - ModuleUtils::collectHeapTypes(*curr, types, indices); - for (auto type : types) { + // Use the same type order as the binary output would even though there is + // no code size benefit in the text format. + auto indexedTypes = ModuleUtils::getOptimizedIndexedHeapTypes(*curr); + for (auto type : indexedTypes.types) { doIndent(o, indent); o << '('; printMedium(o, "type") << ' '; |