diff options
author | Benjamin Maxwell <benjamin.maxwell@arm.com> | 2023-10-19 17:00:02 +0100 |
---|---|---|
committer | GitHub <noreply@github.com> | 2023-10-19 17:00:02 +0100 |
commit | 03d1c99d99d7918115b993f14dcb6fc39cf09f72 (patch) | |
tree | dde2361ebd3a86cffc07c8cc8e52497b41769825 /lldb/packages/Python/lldbsuite/test | |
parent | e880e8aedbc17ba04c969c9426d1f2567af72e7b (diff) | |
download | llvm-03d1c99d99d7918115b993f14dcb6fc39cf09f72.zip llvm-03d1c99d99d7918115b993f14dcb6fc39cf09f72.tar.gz llvm-03d1c99d99d7918115b993f14dcb6fc39cf09f72.tar.bz2 |
[mlir][ODS] Add `OptionalTypesMatchWith` and remove a custom assemblyFormat (#68876)
This is just a slight specialization of `TypesMatchWith` that returns
success if an optional parameter is missing.
There may be other places this could help e.g.:
https://github.com/llvm/llvm-project/blob/eb21049b4b904b072679ece60e73c6b0dc0d1ebf/mlir/include/mlir/Dialect/X86Vector/X86Vector.td#L58-L59
...but I'm leaving those to avoid some churn.
This constraint will be handy for us in some later patches, it's a
formalization of a short circuiting trick with the `comparator` of the
`TypesMatchWith` constraint (devised for #69195).
```
TypesMatchWith<
"padding type matches element type of result (if present)",
"result", "padding",
"::llvm::cast<VectorType>($_self).getElementType()",
// This returns true if no padding is present, or it's present with a type that matches the element type of `result`.
"!getPadding() || std::equal_to<>()">
```
This is a little non-obvious, so after this patch you can instead do:
```
OptionalTypesMatchWith<
"padding type matches element type of result (if present)",
"result", "padding",
"::llvm::cast<VectorType>($_self).getElementType()">
```
Diffstat (limited to 'lldb/packages/Python/lldbsuite/test')
0 files changed, 0 insertions, 0 deletions