diff options
author | Thomas Lively <7121787+tlively@users.noreply.github.com> | 2018-12-03 18:26:16 -0800 |
---|---|---|
committer | GitHub <noreply@github.com> | 2018-12-03 18:26:16 -0800 |
commit | 6b6e89d0c8feeead83d6d83fa94e17fc9f75e0f8 (patch) | |
tree | 5b343da66f58c7fff1fbcd401dcec3e913ea49ff /src/tools/wasm-opt.cpp | |
parent | 99cad87cea463fc3b978850a1d1416d9b338a14c (diff) | |
download | binaryen-6b6e89d0c8feeead83d6d83fa94e17fc9f75e0f8.tar.gz binaryen-6b6e89d0c8feeead83d6d83fa94e17fc9f75e0f8.tar.bz2 binaryen-6b6e89d0c8feeead83d6d83fa94e17fc9f75e0f8.zip |
Feature options (#1797)
Add feature flags and struct interface. Default feature set has all feature enabled.
Diffstat (limited to 'src/tools/wasm-opt.cpp')
-rw-r--r-- | src/tools/wasm-opt.cpp | 19 |
1 files changed, 5 insertions, 14 deletions
diff --git a/src/tools/wasm-opt.cpp b/src/tools/wasm-opt.cpp index 421bcca59..3e04fc644 100644 --- a/src/tools/wasm-opt.cpp +++ b/src/tools/wasm-opt.cpp @@ -69,7 +69,6 @@ int main(int argc, const char* argv[]) { bool fuzzBinary = false; std::string extraFuzzCommand; bool translateToFuzz = false; - bool fuzzAtomics = true; bool fuzzPasses = false; std::string emitJSWrapper; std::string emitSpecWrapper; @@ -106,9 +105,6 @@ int main(int argc, const char* argv[]) { .add("--translate-to-fuzz", "-ttf", "Translate the input into a valid wasm module *somehow*, useful for fuzzing", Options::Arguments::Zero, [&](Options *o, const std::string& arguments) { translateToFuzz = true; }) - .add("--no-fuzz-atomics", "-nfa", "Disable generation of atomic opcodes with translate-to-fuzz (on by default)", - Options::Arguments::Zero, - [&](Options *o, const std::string& arguments) { fuzzAtomics = false; }) .add("--fuzz-passes", "-fp", "Pick a random set of passes to run, useful for fuzzing. this depends on translate-to-fuzz (it picks the passes from the input)", Options::Arguments::Zero, [&](Options *o, const std::string& arguments) { fuzzPasses = true; }) @@ -134,11 +130,6 @@ int main(int argc, const char* argv[]) { options.parse(argc, argv); Module wasm; - // It should be safe to just always enable atomics in wasm-opt, because we - // don't expect any passes to accidentally generate atomic ops - FeatureSet features = Feature::Atomics; - // Same for MutableGlobals - features |= Feature::MutableGlobals; if (options.debug) std::cerr << "reading...\n"; @@ -160,7 +151,7 @@ int main(int argc, const char* argv[]) { } if (options.passOptions.validate) { - if (!WasmValidator().validate(wasm, features)) { + if (!WasmValidator().validate(wasm, options.getFeatures())) { WasmPrinter::printModule(&wasm); Fatal() << "error in validating input"; } @@ -171,9 +162,9 @@ int main(int argc, const char* argv[]) { if (fuzzPasses) { reader.pickPasses(options); } - reader.build(fuzzAtomics); + reader.build(options.getFeatures()); if (options.passOptions.validate) { - if (!WasmValidator().validate(wasm, features)) { + if (!WasmValidator().validate(wasm, options.getFeatures())) { WasmPrinter::printModule(&wasm); std::cerr << "translate-to-fuzz must always generate a valid module"; abort(); @@ -226,7 +217,7 @@ int main(int argc, const char* argv[]) { WasmBinaryBuilder parser(other, input, false); parser.read(); if (options.passOptions.validate) { - bool valid = WasmValidator().validate(other, features); + bool valid = WasmValidator().validate(other, options.getFeatures()); if (!valid) { WasmPrinter::printModule(&other); } @@ -240,7 +231,7 @@ int main(int argc, const char* argv[]) { auto runPasses = [&]() { options.runPasses(*curr); if (options.passOptions.validate) { - bool valid = WasmValidator().validate(*curr, features); + bool valid = WasmValidator().validate(*curr, options.getFeatures()); if (!valid) { WasmPrinter::printModule(&*curr); } |