| "\n" |
| ";; 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.wast.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" |
| "\n" |