Skip to content

Commit 8e0385e

Browse files
Replace existing pass
1 parent 42f8b46 commit 8e0385e

11 files changed

Lines changed: 8 additions & 3128 deletions

src/passes/CMakeLists.txt

Lines changed: 0 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -91,7 +91,6 @@ set(passes_SOURCES
9191
Precompute.cpp
9292
Print.cpp
9393
PrintBoundary.cpp
94-
PrintCallGraph.cpp
9594
PrintFeatures.cpp
9695
PrintFunctionMap.cpp
9796
RoundTrip.cpp

src/passes/GlobalEffects.cpp

Lines changed: 6 additions & 9 deletions
Original file line numberDiff line numberDiff line change
@@ -372,7 +372,7 @@ struct DiscardGlobalEffects : public Pass {
372372
}
373373
};
374374

375-
struct GenerateCallGraph : public Pass {
375+
struct PrintCallGraph : public Pass {
376376
bool modifiesBinaryenIR() override { return false; }
377377

378378
void run(Module* module) override {
@@ -385,7 +385,7 @@ struct GenerateCallGraph : public Pass {
385385
printCallGraph(callGraph, std::cout);
386386
}
387387

388-
private:
388+
private:
389389
std::string nodeToString(const CallGraphNode& node) {
390390
return std::visit(
391391
overloaded{[](Function* func) { return func->name.toString(); },
@@ -443,23 +443,20 @@ struct GenerateCallGraph : public Pass {
443443
}
444444
for (const auto& [callerName, callees] : sortedGraph) {
445445
for (const auto& [calleeName, style] : callees) {
446-
o << " \"" << callerName << "\" -> \"" << calleeName << "\""
447-
<< style << ";\n";
446+
o << " \"" << callerName << "\" -> \"" << calleeName << "\"" << style
447+
<< ";\n";
448448
}
449449
}
450450
o << "}\n";
451451
}
452-
453452
};
454453

455454
} // namespace
456455

456+
Pass* createPrintCallGraphPass() { return new PrintCallGraph(); }
457+
457458
Pass* createGenerateGlobalEffectsPass() { return new GenerateGlobalEffects(); }
458459

459460
Pass* createDiscardGlobalEffectsPass() { return new DiscardGlobalEffects(); }
460461

461-
Pass* createGenerateCallGraphPass() { return new GenerateCallGraph(); }
462-
463-
Pass* createPrintCallGraphPass() { return new GenerateCallGraph(); }
464-
465462
} // namespace wasm

src/passes/PrintCallGraph.cpp

Lines changed: 0 additions & 110 deletions
This file was deleted.

src/passes/pass.cpp

Lines changed: 0 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -189,8 +189,6 @@ void PassRegistry::registerPasses() {
189189
registerPass("generate-global-effects",
190190
"generate global effect info (helps later passes)",
191191
createGenerateGlobalEffectsPass);
192-
registerPass(
193-
"generate-call-graph", "print call graph", createGenerateCallGraphPass);
194192
registerPass(
195193
"global-refining", "refine the types of globals", createGlobalRefiningPass);
196194
registerPass(

src/passes/passes.h

Lines changed: 0 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -59,7 +59,6 @@ Pass* createFunctionMetricsPass();
5959
Pass* createGenerateDynCallsPass();
6060
Pass* createGenerateI64DynCallsPass();
6161
Pass* createGenerateGlobalEffectsPass();
62-
Pass* createGenerateCallGraphPass();
6362
Pass* createGlobalRefiningPass();
6463
Pass* createGlobalStructInferencePass();
6564
Pass* createGlobalStructInferenceDescCastPass();

test/lit/help/wasm-metadce.test

Lines changed: 0 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -163,8 +163,6 @@
163163
;; CHECK-NEXT:
164164
;; CHECK-NEXT: --func-metrics reports function metrics
165165
;; CHECK-NEXT:
166-
;; CHECK-NEXT: --generate-call-graph print call graph
167-
;; CHECK-NEXT:
168166
;; CHECK-NEXT: --generate-dyncalls generate dynCall functions used
169167
;; CHECK-NEXT: by emscripten ABI
170168
;; CHECK-NEXT:

test/lit/help/wasm-opt.test

Lines changed: 0 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -199,8 +199,6 @@
199199
;; CHECK-NEXT:
200200
;; CHECK-NEXT: --func-metrics reports function metrics
201201
;; CHECK-NEXT:
202-
;; CHECK-NEXT: --generate-call-graph print call graph
203-
;; CHECK-NEXT:
204202
;; CHECK-NEXT: --generate-dyncalls generate dynCall functions used
205203
;; CHECK-NEXT: by emscripten ABI
206204
;; CHECK-NEXT:

test/lit/help/wasm2js.test

Lines changed: 0 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -127,8 +127,6 @@
127127
;; CHECK-NEXT:
128128
;; CHECK-NEXT: --func-metrics reports function metrics
129129
;; CHECK-NEXT:
130-
;; CHECK-NEXT: --generate-call-graph print call graph
131-
;; CHECK-NEXT:
132130
;; CHECK-NEXT: --generate-dyncalls generate dynCall functions used
133131
;; CHECK-NEXT: by emscripten ABI
134132
;; CHECK-NEXT:

test/lit/passes/generate-call-graph.wast

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -1,5 +1,5 @@
1-
;; RUN: foreach %s %t wasm-opt --generate-call-graph | filecheck %s
2-
;; RUN: foreach %s %t wasm-opt --generate-call-graph --closed-world | filecheck %s --check-prefix CLOSED
1+
;; RUN: foreach %s %t wasm-opt --print-call-graph | filecheck %s
2+
;; RUN: foreach %s %t wasm-opt --print-call-graph --closed-world | filecheck %s --check-prefix CLOSED
33

44
(module
55
(type $sig (func))

0 commit comments

Comments
 (0)