Adds documentation for the new ODS TypeDef support.
Details
Diff Detail
- Repository
 - rG LLVM Github Monorepo
 
Event Timeline
I'm working on this in this branch: https://github.com/teqdruid/llvm-project/tree/ods-types-doc. It may be faster to edit directly. I can either push this branch upstream or give reviews/editors access to my fork.
| mlir/docs/OpDefinitions.md | ||
|---|---|---|
| 1415 | As a title, it may be more clear to expand this. The name "TypeDef" is a bit confusing to me by the way, as it first got me to think about C++ typedefs.  | |
| 1433 | ||
| 1454 | (offtopic with the doc)  | |
| 1462–1463 | How does it work when there is no printer/parser for a Type?  | |
| 1538 | Nit: can you wrap this line?  | |
Also, this documentation is very slightly wrong without https://reviews.llvm.org/D89438
LGTM for the current documentation after resolving comments. The questions related to where the methods are generated and merging TypeDef with something else aren't blocking on this revision.
| mlir/docs/OpDefinitions.md | ||
|---|---|---|
| 1415 | The use of Data is weird to me given that not all types represent "Data". I would just remove it.  | |
| 1415 | Can you merge the tablegen TypeDef class with DialectType?  | |
| 1433 | The indent here is off.  | |
| 1437 | Can you just make this one line?  | |
| 1449 | LLVM/MLIR don't have code on the same line as the if, can you add a newline to each of these.  | |
| 1468 | is in -> as in  | |
| 1479 | nit: Set ... to generate or Setting ... will generate.  | |
| 1482 | nit: Use a -> Use the  | |
| 1524 | nit: StorageAllocator allocator -> StorageAllocator &allocator  | |
| 1532–1533 | ||
| 1547 | Why are they placed in the dialect's namespace and not local/static to where the .inc file is included?  | |
| 1580 | nit: Drop the extra newlines here.  | |
- Changes based on River's feedback.
 
| mlir/docs/OpDefinitions.md | ||
|---|---|---|
| 1415 | RE merging: I'm not sure what the implications of that would be. Was also considering having TypeDef extend Type and make it have a predicate which only matches itself. Either way, I'm considering both future improvements.  | |
| 1547 | They're declared in the header file so you don't have to #include the cpp in the same place as you put your Dialect::parseType definition.  | |
| mlir/docs/OpDefinitions.md | ||
|---|---|---|
| 1547 | For the general infra we should try as hard as possible not to expose internal implementation details to public users. In most cases(all the ones that I can think of both upstream and downstream), the user wouldn't want to expose these methods and they would also be included in the same file as the parseType/printType implementations. If a user wants to do that differently, they can always manually expose it themselves but I wouldn't want that to be the default.  | |
| mlir/docs/OpDefinitions.md | ||
|---|---|---|
| 1547 | In understand but couldn't think of an alternative since I didn't want to require users to include the implementation in the same file as Dialect::parseType. Though maybe that's appropriate. Isolate all the Type code to one cpp file.  | |
As a title, it may be more clear to expand this.
The name "TypeDef" is a bit confusing to me by the way, as it first got me to think about C++ typedefs.