llvm-project/mlir
River Riddle 6d6fe9ccc4 [mlir][OpAsmFormat] Add support for an "else" group on optional elements
The "else" group of an optional element is a collection of elements that get parsed/printed when the anchor of the main element group is *not* present. This is useful when there is a special syntax when an element is not present. The new syntax for an optional element is shown below:

```
optional-group: `(` elements `)` (`:` `(` else-elements `)`)? `?`
```

An example of how this might be used is shown below:

```tablegen
def FooOp : ... {
  let arguments = (ins UnitAttr:$foo);

  let assemblyFormat = "attr-dict (`foo_is_present` $foo^):(`foo_is_absent`)?";
}
```

would be formatted as such:

```mlir
// When the `foo` attribute is present:
foo.op foo_is_present

// When the `foo` attribute is not present:
foo.op foo_is_absent
```

Differential Revision: https://reviews.llvm.org/D99129
2021-03-22 18:19:23 -07:00
..
cmake/modules [mlir][python] Reorganize MLIR python into namespace packages. 2021-03-08 23:01:34 -08:00
docs [mlir][OpAsmFormat] Add support for an "else" group on optional elements 2021-03-22 18:19:23 -07:00
examples [PatternMatch] Big mechanical rename OwningRewritePatternList -> RewritePatternSet and insert -> add. NFC 2021-03-22 17:20:50 -07:00
include Rename FrozenRewritePatternList -> FrozenRewritePatternSet; NFC. 2021-03-22 17:40:45 -07:00
lib [mlir] Tune error message for assertion. 2021-03-22 18:10:18 -07:00
test [mlir][OpAsmFormat] Add support for an "else" group on optional elements 2021-03-22 18:19:23 -07:00
tools [mlir][OpAsmFormat] Add support for an "else" group on optional elements 2021-03-22 18:19:23 -07:00
unittests Rename FrozenRewritePatternList -> FrozenRewritePatternSet; NFC. 2021-03-22 17:40:45 -07:00
utils [mlir] Add simple jupyter kernel 2021-02-21 18:16:06 -08:00
.clang-format
.clang-tidy Fix MLIR clang-tidy: when tweaking it does not inherit from the parent 2020-03-07 17:44:21 +00:00
CMakeLists.txt [CMake] Require python 3.6 if enabling LLVM test targets 2021-03-15 09:50:39 -07:00
LICENSE.TXT Add the Apache2 with LLVM exceptions license to MLIR 2019-12-24 00:58:06 -08:00
README.md mlir README.md: Fix the syntax 2019-12-24 13:31:07 +01:00

README.md

Multi-Level Intermediate Representation

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