From 8e8284e6464d524bd9091f21a62982ed54df0093 Mon Sep 17 00:00:00 2001 From: Thomas Lively <7121787+tlively@users.noreply.github.com> Date: Fri, 14 Jan 2022 11:50:52 -0800 Subject: 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. --- src/passes/Print.cpp | 8 ++++---- 1 file changed, 4 insertions(+), 4 deletions(-) (limited to 'src/passes/Print.cpp') 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 { printName(curr->name, o); } incIndent(); - std::vector types; - std::unordered_map 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") << ' '; -- cgit v1.2.3