Details
Diff Detail
- Repository
- rG LLVM Github Monorepo
Event Timeline
@thakis If it still makes sense to make the directive TableGen backend closer to your initial proposal (D83636) please have a look. Otherwise I'll abandon this revision.
@jdoerfert
Not generating a translation unit directly but including the generated part is great.
However, emitting everything into a single file and selecting using preprocessor directives doesn't seem what other tablegen targets are doing. E.g. for intrinsics there is IntrinsicImpl.inc, IntrinsicEnums.inc. Clang has Attrs.inc, AttrImpl.inc, AttrVisitor.inc, etc.
This is what MLIR is doing with all its TableGen related code generation. Since we are generating lots of different code block, the number of files would probably explode.
The reason why MLIR does not split declaration and implementation-generation might be that nobody yet wanted to invest the work to split them. While I would not request splitting tablegen-generated files into separate files, fusing feels like a step backwards. If only implementation details change, with a merged output everything that includes OMP.h must be recompiled as well. I don't see how a separation into declaration and implementation causes the number of files to explode.
We are not fusing header and implementation. We had initially 3 files and after comments from a previous patch it was recommended to reduce that to two files. So after this patch you will have one header file and the implementation with the different code block.
OK, I found the header include is generated in CMakeLists.txt in include/llvm/Frontend. This patch removes the "-gen-directive-impl" target and integrates it into "-gen-directive-gen". IMHO "-gen-directive-impl" is the better name for for the implementation file, following the scheme set by "AttrImpl.inc" and "IntrinsicImpl.inc".
Sorry for me not noticing that there have been 3 tablegen targets per td.
I'd prefer using the name "impl" for the implementation, but my LGTM does not depend on it.
llvm/utils/TableGen/TableGen.cpp | ||
---|---|---|
138 | What does "part" refer to? |
Thanks for the review.
I'm fine with changing the current name to impl. @kiranchandramohan What do you think about it?
llvm/utils/TableGen/TableGen.cpp | ||
---|---|---|
138 | It refers to various code "part" needed in clang and flang and libFrontend. Not sure if we can be more precise here. |
llvm/utils/TableGen/TableGen.cpp | ||
---|---|---|
138 | "part" seems to refer to -gen-directive-impl, as in "the other part of the implementation". Again, I suggest to keep the gen-directive-impl flag instead. |
Great change, thanks for doing it!
Can we fold the .h.inc files into the .inc files too? I haven't seen .h.inc files elsewhere in the build.
clang-tidy: error: 'llvm/Frontend/OpenACC/ACC.inc' file not found [clang-diagnostic-error]
not useful