Skip to content

Commit 3e8a41f

Browse files
committed
Update documentation after changes to OpenMP_Clause
1 parent 47e8403 commit 3e8a41f

File tree

1 file changed

+20
-16
lines changed

1 file changed

+20
-16
lines changed

mlir/docs/Dialects/OpenMPDialect/_index.md

Lines changed: 20 additions & 16 deletions
Original file line numberDiff line numberDiff line change
@@ -64,10 +64,10 @@ OpenMP clause definitions are located in
6464
[OpenMPClauses.td](https://github.com/llvm/llvm-project/blob/main/mlir/include/mlir/Dialect/OpenMP/OpenMPClauses.td).
6565
For each clause, an `OpenMP_Clause` subclass and a definition based on it must
6666
be created. The subclass must take a `bit` template argument for each of the
67-
properties it may define, listed below, which is forwarded to the base class.
68-
The definition must be an instantiation of the base class where all these
69-
template arguments are set to `false`. The definition's name must be
70-
`OpenMP_<Name>Clause`, whereas its base class' must be
67+
properties it can populate on associated `OpenMP_Op`s. These must be forwarded
68+
to the base class. The definition must be an instantiation of the base class
69+
where all these template arguments are set to `false`. The definition's name
70+
must be `OpenMP_<Name>Clause`, whereas its base class' must be
7171
`OpenMP_<Name>ClauseSkip`. Following this pattern makes it possible to
7272
optionally skip the inheritance of some properties when defining operations:
7373
[more info](#overriding-clause-inherited-properties).
@@ -79,11 +79,10 @@ implies some op trait, like the `map` clause and the `MapClauseOwningInterface`.
7979
used to represent the clause. Argument names use snake_case and should contain
8080
the clause name to avoid name clashes between clauses. Variadic arguments
8181
(non-attributes) must contain the "_vars" suffix.
82-
- `string assemblyFormat`: Optional formatting string to produce custom
83-
human-friendly printers and parsers for arguments associated with the clause.
84-
It will be combined with assembly formats for other clauses depending on the
85-
`isRequired` template argument passed to the parent `OpenMP_Clause` class, as
86-
explained [below](#adding-an-operation).
82+
- `string {req,opt}AssemblyFormat`: Optional formatting strings to produce
83+
custom human-friendly printers and parsers for arguments associated with the
84+
clause. It will be combined with assembly formats for other clauses as explained
85+
[below](#adding-an-operation).
8786
- `string description`: Optional description text to describe the clause and
8887
its representation.
8988
- `string extraClassDeclaration`: Optional C++ declarations to be added to
@@ -95,13 +94,13 @@ For example:
9594
class OpenMP_ExampleClauseSkip<
9695
bit traits = false, bit arguments = false, bit assemblyFormat = false,
9796
bit description = false, bit extraClassDeclaration = false
98-
> : OpenMP_Clause</*isRequired=*/false, traits, arguments, assemblyFormat,
99-
description, extraClassDeclaration> {
97+
> : OpenMP_Clause<traits, arguments, assemblyFormat, description,
98+
extraClassDeclaration> {
10099
let arguments = (ins
101100
Optional<AnyType>:$example_var
102101
);
103102
104-
let assemblyFormat = [{
103+
let optAssemblyFormat = [{
105104
`example` `(` $example_var `:` type($example_var) `)`
106105
}];
107106
@@ -156,9 +155,13 @@ def ExampleOp : OpenMP_Op<"example", traits = [
156155
This is possible because the `arguments`, `assemblyFormat` and
157156
`extraClassDeclaration` properties of the operation are by default
158157
populated by concatenating the corresponding properties of the clauses on the
159-
list. In the case of the `assemblyFormat`, this also involves splitting the
160-
format strings for required clauses from the ones for optional clauses. The
161-
latter are wrapped in an `oilist()` and interleaved with "|" instead of spaces.
158+
list. In the case of the `assemblyFormat`, this involves combining the
159+
`reqAssemblyFormat` and the `optAssemblyFormat` properties. The
160+
`reqAssemblyFormat` of all clauses is concatenated first and separated using
161+
spaces, whereas the `optAssemblyFormat` is wrapped in an `oilist()` and
162+
interleaved with "|" instead of spaces. The resulting `assemblyFormat` contains
163+
the required assembly format strings, followed by the optional assembly format
164+
strings, optionally the `$region` and the `attr-dict`.
162165

163166
### Overriding Clause-Inherited Properties
164167

@@ -178,7 +181,8 @@ a clause-populated operation property. Instead of overriding the property in the
178181
definition of the operation and having to manually replicate what would
179182
otherwise be automatically populated before adding to it, some internal
180183
properties are defined to hold this default value: `clausesArgs`,
181-
`clausesAssemblyFormat` and `clausesExtraClassDeclaration`.
184+
`clausesAssemblyFormat`, `clauses{Req,Opt}AssemblyFormat` and
185+
`clausesExtraClassDeclaration`.
182186

183187
In the following example, assuming both the `OpenMP_InReductionClause` and the
184188
`OpenMP_ReductionClause` define a `getReductionVars` extra class declaration,

0 commit comments

Comments
 (0)