This has been a long standing TODO, and cleans up a bit of IR/. This will also make it easier to move FuncOp out of IR/ at some point in the future. For now, Module.h and Function.h just forward BuiltinDialect.h. These files will be removed in a followup.
Details
Diff Detail
- Repository
- rG LLVM Github Monorepo
Event Timeline
I was funnily looking at this this morning, so yay :-) (just scanned but didn't review yet, just wanted to remark as timing is perfect :-))
Nice, only small nits.
mlir/include/mlir/IR/BuiltinOps.td | ||
---|---|---|
150 | OOC what parts doesn't work with the ASM syntax here? | |
221 | "The summary should be short and concise. It should be a one-liner without trailing punctuation." (of course we have an example in that file that violates this sigh) | |
mlir/lib/TableGen/OpClass.cpp | ||
308 | Why was this one needed? |
mlir/include/mlir/IR/BuiltinOps.td | ||
---|---|---|
150 | The declarative syntax won't be able to do all of the crazy signature handling(e.g. argument/result attributes, argument printing, etc.) that is necessary, so a majority of it would need to be written using C++ anyways. We've already factored all of that into a common place so the necessary work here is trivial. | |
mlir/lib/TableGen/OpClass.cpp | ||
308 | It's required to be able to call the base Op::print methods, i.e. the ones that actually print the operation and not the ones used to define the declarative syntax. If we don't inherit them, they get hidden given that Op classes declare a new print method. tldr; this lets you do: FuncOp foo = ...; foo.print(llvm::errs()); |
I think the builtin dialect isn't documented anywhere:
https://mlir.llvm.org/docs/Dialects/
(Crazy question: do we really need to even call it a dialect? Can't it just be BuiltinOps.h?)
mlir/include/mlir/IR/BuiltinOps.td | ||
---|---|---|
199 | Typo. | |
mlir/lib/IR/BuiltinDialect.cpp | ||
45–46 | I think this comment should go on the top (or be replicated) as the file comment, which is missing: here and even on BuiltinDialect.h. I think the purpose of this dialect and why something is in this dialect isn't spelt out anywhere but here. |
Thanks Uday! Addressed comments in 65fcddff24d68e2b75a5fa820b6664b6ea78b1de. Moved the ops to BuiltinOps.h, but I kept BuiltinDialect because I think it's important that it is a publicly visible thing. Right now there are places that kind of just assume that an empty dialect namespace means the builtin dialect, which is kind of weird.
OOC what parts doesn't work with the ASM syntax here?