[all-commits] [llvm/llvm-project] cb8c30: [DRR] Explicit Return Types in Rewrites

Jeff Niu via All-commits all-commits at lists.llvm.org
Wed Sep 15 14:26:00 PDT 2021


  Branch: refs/heads/main
  Home:   https://github.com/llvm/llvm-project
  Commit: cb8c30d35dc9eedca4b8073e96f06e9ce8f12192
      https://github.com/llvm/llvm-project/commit/cb8c30d35dc9eedca4b8073e96f06e9ce8f12192
  Author: Mogball <jeffniu22 at gmail.com>
  Date:   2021-09-15 (Wed, 15 Sep 2021)

  Changed paths:
    M mlir/include/mlir/IR/OpBase.td
    M mlir/include/mlir/TableGen/Pattern.h
    M mlir/lib/TableGen/Pattern.cpp
    M mlir/test/lib/Dialect/Test/TestOps.td
    M mlir/test/mlir-tblgen/pattern.mlir
    M mlir/test/mlir-tblgen/rewriter-errors.td
    M mlir/test/mlir-tblgen/rewriter-indexing.td
    M mlir/tools/mlir-tblgen/RewriterGen.cpp

  Log Message:
  -----------
  [DRR] Explicit Return Types in Rewrites

Adds a new rewrite directive returnType that can be added at the end of an op's
argument list to explicitly specify return types.

```
(OpX $v0, $v1, (returnType "$_builder.getI32Type()"))
```

Pass in a bound value to copy its return type, or pass a native code call to
dynamically create new types.

```
(OpX $v0, $v1, (returnType $v0, (NativeCodeCall<"..."> $v1)))
```

Reviewed By: jpienaar

Differential Revision: https://reviews.llvm.org/D109472




More information about the All-commits mailing list