diff options
Diffstat (limited to 'src/passes')
-rw-r--r-- | src/passes/Metrics.cpp | 2 | ||||
-rw-r--r-- | src/passes/Print.cpp | 36 | ||||
-rw-r--r-- | src/passes/RemoveUnusedModuleElements.cpp | 18 |
3 files changed, 27 insertions, 29 deletions
diff --git a/src/passes/Metrics.cpp b/src/passes/Metrics.cpp index 231ad928c..2209bcfbb 100644 --- a/src/passes/Metrics.cpp +++ b/src/passes/Metrics.cpp @@ -61,7 +61,7 @@ struct Metrics counts["[imports]"] = imports.getNumImports(); counts["[funcs]"] = imports.getNumDefinedFunctions(); counts["[globals]"] = imports.getNumDefinedGlobals(); - counts["[events]"] = imports.getNumDefinedEvents(); + counts["[tags]"] = imports.getNumDefinedTags(); counts["[exports]"] = module->exports.size(); counts["[tables]"] = imports.getNumDefinedTables(); // add memory and table diff --git a/src/passes/Print.cpp b/src/passes/Print.cpp index 18c10ac8e..750bfbb38 100644 --- a/src/passes/Print.cpp +++ b/src/passes/Print.cpp @@ -1849,7 +1849,7 @@ struct PrintExpressionContents } void visitThrow(Throw* curr) { printMedium(o, "throw "); - printName(curr->event, o); + printName(curr->tag, o); } void visitRethrow(Rethrow* curr) { printMedium(o, "rethrow "); @@ -2345,12 +2345,12 @@ struct PrintSExpression : public UnifiedExpressionVisitor<PrintSExpression> { maybePrintImplicitBlock(curr->body, true); decIndent(); o << "\n"; - for (size_t i = 0; i < curr->catchEvents.size(); i++) { + for (size_t i = 0; i < curr->catchTags.size(); i++) { doIndent(o, indent); printDebugDelimiterLocation(curr, i); o << '('; printMedium(o, "catch "); - printName(curr->catchEvents[i], o); + printName(curr->catchTags[i], o); incIndent(); maybePrintImplicitBlock(curr->catchBodies[i], true); decIndent(); @@ -2358,7 +2358,7 @@ struct PrintSExpression : public UnifiedExpressionVisitor<PrintSExpression> { } if (curr->hasCatchAll()) { doIndent(o, indent); - printDebugDelimiterLocation(curr, curr->catchEvents.size()); + printDebugDelimiterLocation(curr, curr->catchTags.size()); o << '('; printMedium(o, "catch_all"); incIndent(); @@ -2534,8 +2534,8 @@ struct PrintSExpression : public UnifiedExpressionVisitor<PrintSExpression> { case ExternalKind::Global: o << "global"; break; - case ExternalKind::Event: - o << "event"; + case ExternalKind::Tag: + o << "tag"; break; case ExternalKind::Invalid: WASM_UNREACHABLE("invalid ExternalKind"); @@ -2672,28 +2672,28 @@ struct PrintSExpression : public UnifiedExpressionVisitor<PrintSExpression> { } o << maybeNewLine; } - void visitEvent(Event* curr) { + void visitTag(Tag* curr) { if (curr->imported()) { - visitImportedEvent(curr); + visitImportedTag(curr); } else { - visitDefinedEvent(curr); + visitDefinedTag(curr); } } - void visitImportedEvent(Event* curr) { + void visitImportedTag(Tag* curr) { doIndent(o, indent); o << '('; emitImportHeader(curr); - o << "(event "; + o << "(tag "; printName(curr->name, o); o << maybeSpace << "(attr " << curr->attribute << ')' << maybeSpace; printParamType(o, curr->sig.params, currModule); o << "))"; o << maybeNewLine; } - void visitDefinedEvent(Event* curr) { + void visitDefinedTag(Tag* curr) { doIndent(o, indent); o << '('; - printMedium(o, "event "); + printMedium(o, "tag "); printName(curr->name, o); o << maybeSpace << "(attr " << curr->attribute << ')' << maybeSpace; printParamType(o, curr->sig.params, currModule); @@ -2910,8 +2910,7 @@ struct PrintSExpression : public UnifiedExpressionVisitor<PrintSExpression> { *curr, [&](Global* global) { visitGlobal(global); }); ModuleUtils::iterImportedFunctions( *curr, [&](Function* func) { visitFunction(func); }); - ModuleUtils::iterImportedEvents(*curr, - [&](Event* event) { visitEvent(event); }); + ModuleUtils::iterImportedTags(*curr, [&](Tag* tag) { visitTag(tag); }); ModuleUtils::iterDefinedGlobals( *curr, [&](Global* global) { visitGlobal(global); }); ModuleUtils::iterDefinedMemories( @@ -2931,8 +2930,7 @@ struct PrintSExpression : public UnifiedExpressionVisitor<PrintSExpression> { } o << ')' << maybeNewLine; } - ModuleUtils::iterDefinedEvents(*curr, - [&](Event* event) { visitEvent(event); }); + ModuleUtils::iterDefinedTags(*curr, [&](Tag* tag) { visitTag(tag); }); for (auto& child : curr->exports) { doIndent(o, indent); visitExport(child.get()); @@ -3102,7 +3100,7 @@ printStackInst(StackInst* inst, std::ostream& o, Function* func) { } case StackInst::Catch: { // Because StackInst does not have info on which catch within a try this - // is, we can't print the event name. + // is, we can't print the tag name. printMedium(o, "catch"); break; } @@ -3186,7 +3184,7 @@ printStackIR(StackIR* ir, std::ostream& o, Function* func) { doIndent(); printMedium(o, "catch "); Try* curr = inst->origin->cast<Try>(); - printName(curr->catchEvents[catchIndexStack.back()++], o); + printName(curr->catchTags[catchIndexStack.back()++], o); indent++; break; } diff --git a/src/passes/RemoveUnusedModuleElements.cpp b/src/passes/RemoveUnusedModuleElements.cpp index a26fd5d45..2b460a0fd 100644 --- a/src/passes/RemoveUnusedModuleElements.cpp +++ b/src/passes/RemoveUnusedModuleElements.cpp @@ -16,7 +16,7 @@ // // Removes module elements that are are never used: functions, globals, and -// events, which may be imported or not, and function types (which we merge and +// tags, which may be imported or not, and function types (which we merge and // remove if unneeded) // @@ -30,7 +30,7 @@ namespace wasm { -enum class ModuleElementKind { Function, Global, Event, Table, ElementSegment }; +enum class ModuleElementKind { Function, Global, Tag, Table, ElementSegment }; typedef std::pair<ModuleElementKind, Name> ModuleElement; @@ -129,11 +129,11 @@ struct ReachabilityAnalyzer : public PostWalker<ReachabilityAnalyzer> { maybeAdd(ModuleElement(ModuleElementKind::Function, curr->func)); } void visitThrow(Throw* curr) { - maybeAdd(ModuleElement(ModuleElementKind::Event, curr->event)); + maybeAdd(ModuleElement(ModuleElementKind::Tag, curr->tag)); } void visitTry(Try* curr) { - for (auto event : curr->catchEvents) { - maybeAdd(ModuleElement(ModuleElementKind::Event, event)); + for (auto tag : curr->catchTags) { + maybeAdd(ModuleElement(ModuleElementKind::Tag, tag)); } } }; @@ -176,8 +176,8 @@ struct RemoveUnusedModuleElements : public Pass { roots.emplace_back(ModuleElementKind::Function, curr->value); } else if (curr->kind == ExternalKind::Global) { roots.emplace_back(ModuleElementKind::Global, curr->value); - } else if (curr->kind == ExternalKind::Event) { - roots.emplace_back(ModuleElementKind::Event, curr->value); + } else if (curr->kind == ExternalKind::Tag) { + roots.emplace_back(ModuleElementKind::Tag, curr->value); } else if (curr->kind == ExternalKind::Table) { roots.emplace_back(ModuleElementKind::Table, curr->value); ModuleUtils::iterTableSegments( @@ -209,9 +209,9 @@ struct RemoveUnusedModuleElements : public Pass { return analyzer.reachable.count( ModuleElement(ModuleElementKind::Global, curr->name)) == 0; }); - module->removeEvents([&](Event* curr) { + module->removeTags([&](Tag* curr) { return analyzer.reachable.count( - ModuleElement(ModuleElementKind::Event, curr->name)) == 0; + ModuleElement(ModuleElementKind::Tag, curr->name)) == 0; }); module->removeElementSegments([&](ElementSegment* curr) { return curr->data.empty() || |