diff options
Diffstat (limited to 'src/tools/wasm-metadce.cpp')
-rw-r--r-- | src/tools/wasm-metadce.cpp | 14 |
1 files changed, 12 insertions, 2 deletions
diff --git a/src/tools/wasm-metadce.cpp b/src/tools/wasm-metadce.cpp index 91dbe2d21..1bdb18db2 100644 --- a/src/tools/wasm-metadce.cpp +++ b/src/tools/wasm-metadce.cpp @@ -29,11 +29,12 @@ #include "ir/module-utils.h" #include "pass.h" #include "support/colors.h" -#include "support/command-line.h" #include "support/file.h" #include "support/json.h" +#include "tool-options.h" #include "wasm-builder.h" #include "wasm-io.h" +#include "wasm-validator.h" using namespace wasm; @@ -403,7 +404,7 @@ int main(int argc, const char* argv[]) { std::string graphFile; bool dump = false; - Options options( + ToolOptions options( "wasm-metadce", "This tool performs dead code elimination (DCE) on a larger space " "that the wasm module is just a part of. For example, if you have " @@ -508,6 +509,15 @@ int main(int argc, const char* argv[]) { } } + options.applyFeatures(wasm); + + if (options.passOptions.validate) { + if (!WasmValidator().validate(wasm)) { + WasmPrinter::printModule(&wasm); + Fatal() << "error in validating input"; + } + } + auto graphInput( read_file<std::string>(graphFile, Flags::Text, Flags::Release)); auto* copy = strdup(graphInput.c_str()); |