Details
Diff Detail
- Repository
- rG LLVM Github Monorepo
Event Timeline
This still needs some polishing, proper tests and documentation and then maybe separating the AMDGPU changes, but some early feedback might be a help.
Nice! This looks very useful as a diagnostic tool. I'm not sure I'd ever want to have it enabled by default.
Yeah, I'd prefer the checks disabled by default in TableGen, but hope they can always be enabled for AMDGPU so we can catch unused bits as they appear rather than treat them later on occasional checks.
The implementation looks good to me, except perhaps for isInCommonTableGenHeader. It seems like you're inventing a new concept of C-like "system headers", which TableGen did not previously have.
The implementation looks good to me, except perhaps for isInCommonTableGenHeader. It seems like you're inventing a new concept of C-like "system headers", which TableGen did not previously have.
That was the intention, yes. I think conceptually the common .td files are part of the TableGen backends as much as system headers are part of a C implementation.
However, I guess the purity of the core TableGen code might still be of concern with the isInCommonTableGenHeader() hardcoding the paths, in which case something more explicit would probably work better, like instantiating a special class in such headers maybe?
// In include/llvm/CodeGen/ValueTypes.td. // The file path in the source position of the definition should now // be considered a path of a common TableGen header. def : CommonTableGenHeader<"ValueTypes">;
As shown by the many related revisions, this is clearly a good idea.
I'm wracking my brain as for how the "common" TableGen files can be identified in a cleaner way. I don't like the def way, but something like a pragma common_header perhaps?
I'm wracking my brain as for how the "common" TableGen files can be identified in a cleaner way. I don't like the def way, but something like a pragma common_header perhaps?
Maybe you could specify on the command line which files you do want to see warnings in?
llvm-tblgen -warn-in=lib/Target/AMDGPU/ ...
Maybe you could specify on the command line which files you do want to see warnings in?
llvm-tblgen -warn-in=lib/Target/AMDGPU/ ...
Would be easy to implement, but feels a bit like we ask the user to provide information that should already be known to the system. To be compared with something like gcc --warn-in=foo.c foo.c.
I'm wracking my brain as for how the "common" TableGen files can be identified in a cleaner way. I don't like the def way, but something like a pragma common_header perhaps?
Yeah, a pragma was my first thought as well, so probably should be most natural and expected, though it's yet another concept to be added. Will try that.
I like it, but maybe instead add the equivalent option (-isystem) and pass it from CMake? Paths may change, and there are also at least clang and mlir that might want to enable this warning.
"common header" sounds rather vague. Maybe add a way to disable/enable specific warning?