Add rudimentary pattern rewrite matching generation.
authorJacques Pienaar <jpienaar@google.com>
Wed, 12 Dec 2018 11:09:11 +0000 (03:09 -0800)
committerjpienaar <jpienaar@google.com>
Fri, 29 Mar 2019 21:26:07 +0000 (14:26 -0700)
commita2222a94489ceb6ed3055a951b6693b8fce422b9
tree540c3173765f37e94cb2bd323191cc67f0d6ed37
parentc86c414765c1534f5989303c308989f39ff64810
Add rudimentary pattern rewrite matching generation.

* Start very basic (about as basic as possible) with the pattern rewrite generation by only
  - Matching single node dags,
  - Single output, single result,
  - No constraints on inputs/outputs.
  - No attributes (only operands)
* The matcher generates C++ code akin to what is currently manually written.
  - This is very much not the final end state, and only intended for the short term;
* Always generate the default builder method to make it easier to generate calls;
  - Also add additional builder method for TFL::Add as attributes are not yet supported;
* Replace TF Add -> TFL Add matching using this generation;
* Introduce a conceptual textual namespace in the op registry
  - Will allow importing multiple dialect's op registry
  - Avoids needing to do anything special with tablegen or define a custom DSL;
    = I really want to do a custom DSL but this urge could just be as its fun :) So defer for now. From this structure we can dump out another structured form if needed;
  - Add a mapping from <namespace>_<op> in the op_gen and pattern rewrite gen
    = This allows placing ops in different namespaces from the same op registry which is convenient, esp. if we want to consider subnamespaces in future;
* Update tfl namespace to TFL to match TF and XLA;

PiperOrigin-RevId: 225155164
mlir/tools/mlir-op-gen/mlir-op-gen.cpp
mlir/tools/mlir-rewriter-gen/mlir-rewriter-gen.cpp [new file with mode: 0644]