Skip to content

[TargetParser][cmake] Be Smarter about TableGen Deps #144848

New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Open
wants to merge 1 commit into
base: main
Choose a base branch
from

Conversation

lenary
Copy link
Member

@lenary lenary commented Jun 19, 2025

This tries to be a bit smarter for the OLD behaviour of CMP0116, to glob more relevant directories looking for possible dependencies.

The changes are:

  • Remove some duplication of lines in the tablegen function.
  • Put CURRENT_SOURCE_DIR into tblgen_includes (at the front)
  • Glob all directories in tblgen_includes
  • Give up on local_tds which was wrong when using tablegen to compile a file in a different directory (as TargetParser does)
  • Use EXTRA_INCLUDES in TargetParser tablegen calls.

This is still an under-approximation of what might be included, at least comparing the RISCVTargetParserDef.inc.d (after building target_parser_gen), and the list of deps in the ninja file when explicitly setting CMP0116 to OLD.

Fixes #144639

This tries to be a bit smarter for the OLD behaviour of CMP0116, to glob
more relevant directories looking for possible dependencies.

The changes are:
- Remove some duplication of lines in the `tablegen` function.
- Put CURRENT_SOURCE_DIR into `tblgen_includes` (at the front)
- Glob all directories in `tblgen_includes`
- Give up on `local_tds` which was wrong when using tablegen to compile
  a file in a different directory (as TargetParser does)
- Use `EXTRA_INCLUDES` in TargetParser `tablegen` calls.

This is still an under-approximation of what might be included, at least
comparing the RISCVTargetParserDef.inc.d (after building
`target_parser_gen`), and the list of deps in the ninja file when
explicitly setting CMP0116 to OLD.

Fixes llvm#144639
@llvmbot llvmbot added the cmake Build system in general and CMake in particular label Jun 19, 2025
# Filter out any empty include items.
list(REMOVE_ITEM tblgen_includes "")

# Build the absolute path for the current input file.
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

We shouldn't delete this comment.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
cmake Build system in general and CMake in particular
Projects
None yet
Development

Successfully merging this pull request may close these issues.

[RISCV] RISCVTargetParserDef.inc doesn't get rebuilt when RISCVProcessors.td is modified
3 participants