summaryrefslogtreecommitdiff
path: root/src
diff options
context:
space:
mode:
authorAlon Zakai <azakai@google.com>2020-10-08 12:37:17 -0700
committerGitHub <noreply@github.com>2020-10-08 12:37:17 -0700
commitb326a3e84de1125ea0cd11162eea822f7e7e927e (patch)
tree7130604c4f09ce5c82bf15bb308c63d7085326da /src
parent6fbf158b04f6ba2771f4856e41d070086b5b0d96 (diff)
downloadbinaryen-b326a3e84de1125ea0cd11162eea822f7e7e927e.tar.gz
binaryen-b326a3e84de1125ea0cd11162eea822f7e7e927e.tar.bz2
binaryen-b326a3e84de1125ea0cd11162eea822f7e7e927e.zip
Remove old attempted DSL beginnings from OptimizeInstructions (#3200)
Wasm turned out to not be that good for a DSL for such peephole optimizations, so that never made progress. Meanwhile we have the new matcher stuff which works well.
Diffstat (limited to 'src')
-rw-r--r--src/passes/OptimizeInstructions.cpp23
-rw-r--r--src/passes/OptimizeInstructions.wat25
-rw-r--r--src/passes/OptimizeInstructions.wat.processed25
3 files changed, 0 insertions, 73 deletions
diff --git a/src/passes/OptimizeInstructions.cpp b/src/passes/OptimizeInstructions.cpp
index 59a38eeaa..85f777eb5 100644
--- a/src/passes/OptimizeInstructions.cpp
+++ b/src/passes/OptimizeInstructions.cpp
@@ -155,12 +155,6 @@ struct OptimizeInstructions
Pass* create() override { return new OptimizeInstructions; }
- void prepareToRun(PassRunner* runner, Module* module) override {
-#if 0
- static DatabaseEnsurer ensurer;
-#endif
- }
-
bool fastMath;
void doWalkFunction(Function* func) {
@@ -185,24 +179,7 @@ struct OptimizeInstructions
replaceCurrent(curr);
continue;
}
-#if 0
- auto iter = database->patternMap.find(curr->_id);
- if (iter == database->patternMap.end()) return;
- auto& patterns = iter->second;
- bool more = false;
- for (auto& pattern : patterns) {
- Match match(*getModule(), pattern);
- if (match.check(curr)) {
- curr = match.apply();
- replaceCurrent(curr);
- more = true;
- break; // exit pattern for loop, return to main while loop
- }
- }
- if (!more) break;
-#else
break;
-#endif
}
}
diff --git a/src/passes/OptimizeInstructions.wat b/src/passes/OptimizeInstructions.wat
deleted file mode 100644
index d690e9365..000000000
--- a/src/passes/OptimizeInstructions.wat
+++ /dev/null
@@ -1,25 +0,0 @@
-;; This file contains patterns for OptimizeInstructions. Basically, we use a DSL for the patterns,
-;; and the DSL is just wasm itself, plus some functions with special meanings
-;;
-;; This file is converted into OptimizeInstructions.wat.processed by
-;; scripts/process_optimize_instructions.py
-;; which makes it importable by C++. Then we just #include it there, avoiding the need to ship
-;; a data file on the side.
-
-(module
- ;; "expr" represents an arbitrary expression. The input is an id, so the same expression
- ;; can appear more than once. The type (i32 in i32.expr, etc.) is the return type, as this
- ;; needs to have the right type for where it is placed.
- (import $i32.expr "dsl" "i32.expr" (param i32) (result i32))
- (import $i64.expr "dsl" "i64.expr" (param i32) (result i64))
- (import $f32.expr "dsl" "f32.expr" (param i32) (result f32))
- (import $f64.expr "dsl" "f64.expr" (param i32) (result f64))
- (import $any.expr "dsl" "any.expr" (param i32) (result i32)) ;; ignorable return type
-
- ;; TODO for now wasm is not that convenient for a DSL like this. Needs rethinking.
-
- (func $patterns
- (block
- )
- )
-)
diff --git a/src/passes/OptimizeInstructions.wat.processed b/src/passes/OptimizeInstructions.wat.processed
deleted file mode 100644
index b0be5de36..000000000
--- a/src/passes/OptimizeInstructions.wat.processed
+++ /dev/null
@@ -1,25 +0,0 @@
-";; This file contains patterns for OptimizeInstructions. Basically, we use a DSL for the patterns,\n"
-";; and the DSL is just wasm itself, plus some functions with special meanings\n"
-";;\n"
-";; This file is converted into OptimizeInstructions.wat.processed by\n"
-";; scripts/process_optimize_instructions.py\n"
-";; which makes it importable by C++. Then we just #include it there, avoiding the need to ship\n"
-";; a data file on the side.\n"
-"\n"
-"(module\n"
-";; \"expr\" represents an arbitrary expression. The input is an id, so the same expression\n"
-";; can appear more than once. The type (i32 in i32.expr, etc.) is the return type, as this\n"
-";; needs to have the right type for where it is placed.\n"
-"(import $i32.expr \"dsl\" \"i32.expr\" (param i32) (result i32))\n"
-"(import $i64.expr \"dsl\" \"i64.expr\" (param i32) (result i64))\n"
-"(import $f32.expr \"dsl\" \"f32.expr\" (param i32) (result f32))\n"
-"(import $f64.expr \"dsl\" \"f64.expr\" (param i32) (result f64))\n"
-"(import $any.expr \"dsl\" \"any.expr\" (param i32) (result i32)) ;; ignorable return type\n"
-"\n"
-";; TODO for now wasm is not that convenient for a DSL like this. Needs rethinking.\n"
-"\n"
-"(func $patterns\n"
-"(block\n"
-")\n"
-")\n"
-")\n"