summaryrefslogtreecommitdiff
path: root/src/passes/PrintFeatures.cpp
diff options
context:
space:
mode:
authorThomas Lively <7121787+tlively@users.noreply.github.com>2019-04-16 16:47:50 -0700
committerGitHub <noreply@github.com>2019-04-16 16:47:50 -0700
commit4d81752204fede13d6513def4195aabe66c5586f (patch)
treef6322eaa40e0fc38beaa7ca68dc3b55b8629f473 /src/passes/PrintFeatures.cpp
parent698fddca4e598cb4f72fe61557c9f91ed879a289 (diff)
downloadbinaryen-4d81752204fede13d6513def4195aabe66c5586f.tar.gz
binaryen-4d81752204fede13d6513def4195aabe66c5586f.tar.bz2
binaryen-4d81752204fede13d6513def4195aabe66c5586f.zip
Change default feature set to MVP (#1993)
In the absence of the target features section or command line flags. When there are command line flags, it is an error if they do not exactly match the target features section, except if --detect-features has been provided. Also adds a --print-features pass to print the command line flags for all enabled options and uses it to make the feature tests more rigorous.
Diffstat (limited to 'src/passes/PrintFeatures.cpp')
-rw-r--r--src/passes/PrintFeatures.cpp39
1 files changed, 39 insertions, 0 deletions
diff --git a/src/passes/PrintFeatures.cpp b/src/passes/PrintFeatures.cpp
new file mode 100644
index 000000000..9c7172eee
--- /dev/null
+++ b/src/passes/PrintFeatures.cpp
@@ -0,0 +1,39 @@
+/*
+ * Copyright 2019 WebAssembly Community Group participants
+ *
+ * Licensed under the Apache License, Version 2.0 (the "License");
+ * you may not use this file except in compliance with the License.
+ * You may obtain a copy of the License at
+ *
+ * http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing, software
+ * distributed under the License is distributed on an "AS IS" BASIS,
+ * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+ * See the License for the specific language governing permissions and
+ * limitations under the License.
+ */
+
+//
+// Print out the feature options corresponding to enabled features
+//
+
+#include "wasm.h"
+#include "wasm-features.h"
+#include "pass.h"
+
+namespace wasm {
+
+struct PrintFeatures : public Pass {
+ void run(PassRunner* runner, Module* module) override {
+ module->features.iterFeatures([](FeatureSet::Feature f) {
+ std::cout << "--enable-" << FeatureSet::toString(f) << std::endl;
+ });
+ }
+};
+
+Pass* createPrintFeaturesPass() {
+ return new PrintFeatures();
+}
+
+} // namespace wasm