llvm-project/mlir
River Riddle ea64828a10 [mlir:PDL] Expand how native constraint/rewrite functions can be defined
This commit refactors the expected form of native constraint and rewrite
functions, and greatly reduces the necessary user complexity required when
defining a native function. Namely, this commit adds in automatic processing
of the necessary PDLValue glue code, and allows for users to define
constraint/rewrite functions using the C++ types that they actually want to
use.

As an example, lets see a simple example rewrite defined today:

```
static void rewriteFn(PatternRewriter &rewriter, PDLResultList &results,
                      ArrayRef<PDLValue> args) {
  ValueRange operandValues = args[0].cast<ValueRange>();
  TypeRange typeValues = args[1].cast<TypeRange>();
  ...
  // Create an operation at some point and pass it back to PDL.
  Operation *op = rewriter.create<SomeOp>(...);
  results.push_back(op);
}
```

After this commit, that same rewrite could be defined as:

```
static Operation *rewriteFn(PatternRewriter &rewriter ValueRange operandValues,
                            TypeRange typeValues) {
  ...
  // Create an operation at some point and pass it back to PDL.
  return rewriter.create<SomeOp>(...);
}
```

Differential Revision: https://reviews.llvm.org/D122086
2022-04-06 17:41:59 -07:00
..
benchmark/python [mlir] Move the Builtin FuncOp to the Func dialect 2022-03-16 17:07:03 -07:00
cmake/modules Remove include_directories() from cmake `mlir_tablegen()` function (NFC) 2022-03-14 04:36:24 +00:00
docs [mlir:PDL] Expand how native constraint/rewrite functions can be defined 2022-04-06 17:41:59 -07:00
examples [mlir] Rework the implementation of TypeID 2022-04-04 13:52:26 -07:00
include [mlir:PDL] Expand how native constraint/rewrite functions can be defined 2022-04-06 17:41:59 -07:00
lib [mlir:PDL] Expand how native constraint/rewrite functions can be defined 2022-04-06 17:41:59 -07:00
python Revert "Added an empty __init__.py file to the MLIR Python bindings" 2022-03-31 20:03:52 +02:00
test [mlir:PDL] Expand how native constraint/rewrite functions can be defined 2022-04-06 17:41:59 -07:00
tools [mlir][ods] Add description to Attr and ensure doc generation 2022-04-05 10:40:15 +02:00
unittests [MLIR][Affine][Analysis] Merge FAC and FACV 2022-04-06 03:02:32 +05:30
utils [mlir-vscode] Add better support for multiple workspace folders 2022-04-05 13:41:40 -07:00
.clang-format
.clang-tidy Enable readability-redundant-smartptr-get in MLIR local clang-tidy config 2022-01-08 20:07:11 +00:00
CMakeLists.txt mlir: set CMAKE_INCLUDE_CURRENT_DIR to fix out-of-tree builds 2022-03-19 18:22:09 -05:00
LICENSE.TXT
README.md

README.md

Multi-Level Intermediate Representation

See https://mlir.llvm.org/ for more information.