summaryrefslogtreecommitdiff
path: root/src/tools
diff options
context:
space:
mode:
Diffstat (limited to 'src/tools')
-rw-r--r--src/tools/wasm-metadce.cpp4
-rw-r--r--src/tools/wasm-split/instrumenter.cpp3
-rw-r--r--src/tools/wasm-split/instrumenter.h3
-rw-r--r--src/tools/wasm-split/wasm-split.cpp6
-rw-r--r--src/tools/wasm2js.cpp4
5 files changed, 12 insertions, 8 deletions
diff --git a/src/tools/wasm-metadce.cpp b/src/tools/wasm-metadce.cpp
index 741afb22f..5699b40f2 100644
--- a/src/tools/wasm-metadce.cpp
+++ b/src/tools/wasm-metadce.cpp
@@ -244,7 +244,9 @@ struct MetaDCEGraph {
Scanner(MetaDCEGraph* parent) : parent(parent) {}
- Scanner* create() override { return new Scanner(parent); }
+ std::unique_ptr<Pass> create() override {
+ return std::make_unique<Scanner>(parent);
+ }
void visitCall(Call* curr) {
if (!getModule()->getFunction(curr->target)->imported()) {
diff --git a/src/tools/wasm-split/instrumenter.cpp b/src/tools/wasm-split/instrumenter.cpp
index 7f9ff9c75..86a52688e 100644
--- a/src/tools/wasm-split/instrumenter.cpp
+++ b/src/tools/wasm-split/instrumenter.cpp
@@ -26,8 +26,7 @@ Instrumenter::Instrumenter(const InstrumenterConfig& config,
uint64_t moduleHash)
: config(config), moduleHash(moduleHash) {}
-void Instrumenter::run(PassRunner* runner, Module* wasm) {
- this->runner = runner;
+void Instrumenter::run(Module* wasm) {
this->wasm = wasm;
size_t numFuncs = 0;
diff --git a/src/tools/wasm-split/instrumenter.h b/src/tools/wasm-split/instrumenter.h
index f4f2f2119..135d2b74f 100644
--- a/src/tools/wasm-split/instrumenter.h
+++ b/src/tools/wasm-split/instrumenter.h
@@ -41,7 +41,6 @@ struct InstrumenterConfig {
// at the beginning of each function to set its timestamp, and a new exported
// function for dumping the profile data.
struct Instrumenter : public Pass {
- PassRunner* runner = nullptr;
Module* wasm = nullptr;
const InstrumenterConfig& config;
@@ -54,7 +53,7 @@ struct Instrumenter : public Pass {
Instrumenter(const InstrumenterConfig& config, uint64_t moduleHash);
- void run(PassRunner* runner, Module* wasm) override;
+ void run(Module* wasm) override;
private:
void addGlobals(size_t numFuncs);
diff --git a/src/tools/wasm-split/wasm-split.cpp b/src/tools/wasm-split/wasm-split.cpp
index ec1f5555c..49a15e934 100644
--- a/src/tools/wasm-split/wasm-split.cpp
+++ b/src/tools/wasm-split/wasm-split.cpp
@@ -110,7 +110,6 @@ void instrumentModule(const WasmSplitOptions& options) {
}
uint64_t moduleHash = hashFile(options.inputFiles[0]);
- PassRunner runner(&wasm, options.passOptions);
InstrumenterConfig config;
if (options.importNamespace.size()) {
config.importNamespace = options.importNamespace;
@@ -120,7 +119,10 @@ void instrumentModule(const WasmSplitOptions& options) {
}
config.storageKind = options.storageKind;
config.profileExport = options.profileExport;
- Instrumenter(config, moduleHash).run(&runner, &wasm);
+
+ PassRunner runner(&wasm, options.passOptions);
+ runner.add(std::make_unique<Instrumenter>(config, moduleHash));
+ runner.run();
adjustTableSize(wasm, options.initialTableSize);
diff --git a/src/tools/wasm2js.cpp b/src/tools/wasm2js.cpp
index 061cd386f..7cecb5f6d 100644
--- a/src/tools/wasm2js.cpp
+++ b/src/tools/wasm2js.cpp
@@ -39,7 +39,9 @@ static void optimizeWasm(Module& wasm, PassOptions options) {
struct OptimizeForJS : public WalkerPass<PostWalker<OptimizeForJS>> {
bool isFunctionParallel() override { return true; }
- Pass* create() override { return new OptimizeForJS; }
+ std::unique_ptr<Pass> create() override {
+ return std::make_unique<OptimizeForJS>();
+ }
void visitBinary(Binary* curr) {
// x - -c (where c is a constant) is larger than x + c, in js (but not