-
Notifications
You must be signed in to change notification settings - Fork 15.2k
[CMake] Declare all parts of *GenRegisterInfo.inc as outputs. #168405
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
Conversation
|
@llvm/pr-subscribers-tablegen Author: Ivan Kosarev (kosarev) ChangesThis tells the build system to check and regenerate the A follow-up from Full diff: https://github.com/llvm/llvm-project/pull/168405.diff 2 Files Affected:
diff --git a/llvm/cmake/modules/TableGen.cmake b/llvm/cmake/modules/TableGen.cmake
index 9a2e73a1e3718..706ae03115814 100644
--- a/llvm/cmake/modules/TableGen.cmake
+++ b/llvm/cmake/modules/TableGen.cmake
@@ -66,6 +66,16 @@ function(tablegen project ofn)
list(APPEND LLVM_TABLEGEN_FLAGS "-omit-comments")
endif()
+ set(EXTRA_OUTPUTS)
+ if("-gen-register-info" IN_LIST ARGN)
+ string(REGEX REPLACE "\\.[^.]*$" "" OUTPUT_BASENAME ${ofn})
+ list(APPEND EXTRA_OUTPUTS
+ ${CMAKE_CURRENT_BINARY_DIR}/${OUTPUT_BASENAME}Enums.inc
+ ${CMAKE_CURRENT_BINARY_DIR}/${OUTPUT_BASENAME}Header.inc
+ ${CMAKE_CURRENT_BINARY_DIR}/${OUTPUT_BASENAME}MCDesc.inc
+ ${CMAKE_CURRENT_BINARY_DIR}/${OUTPUT_BASENAME}TargetDesc.inc)
+ endif()
+
# MSVC can't support long string literals ("long" > 65534 bytes)[1], so if there's
# a possibility of generated tables being consumed by MSVC, generate arrays of
# char literals, instead. If we're cross-compiling, then conservatively assume
@@ -126,7 +136,7 @@ function(tablegen project ofn)
set(LLVM_TABLEGEN_JOB_POOL "")
endif()
- add_custom_command(OUTPUT ${CMAKE_CURRENT_BINARY_DIR}/${ofn}
+ add_custom_command(OUTPUT ${CMAKE_CURRENT_BINARY_DIR}/${ofn} ${EXTRA_OUTPUTS}
COMMAND ${tablegen_exe} ${ARG_UNPARSED_ARGUMENTS}
${tblgen_includes}
${LLVM_TABLEGEN_FLAGS}
diff --git a/llvm/utils/TableGen/RegisterInfoEmitter.cpp b/llvm/utils/TableGen/RegisterInfoEmitter.cpp
index ef7b13e8940f8..3486a7a7fb08c 100644
--- a/llvm/utils/TableGen/RegisterInfoEmitter.cpp
+++ b/llvm/utils/TableGen/RegisterInfoEmitter.cpp
@@ -1878,6 +1878,8 @@ TableGenOutputFiles RegisterInfoEmitter::run(StringRef FilenamePrefix) {
if (RegisterInfoDebug)
debugDump(errs());
+ // The suffixes should be in sync with the tablegen function in
+ // llvm/cmake/modules/TableGen.cmake.
return {Main,
{{"Enums.inc", Enums},
{"MCDesc.inc", MCDesc},
|
llvm/cmake/modules/TableGen.cmake
Outdated
|
|
||
| set(EXTRA_OUTPUTS) | ||
| if("-gen-register-info" IN_LIST ARGN) | ||
| string(REGEX REPLACE "\\.[^.]*$" "" OUTPUT_BASENAME ${ofn}) |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Nit: CMake has a function for getting the basename of a file, we should use it. I think the right syntax is cmake_path(GET ${ofn} STEMP OUTPUT_BASENAME) - https://cmake.org/cmake/help/latest/command/cmake_path.html#get-stem (available since 3.20, which is what LLVM requires)
lenary
left a comment
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
LGTM, with or without the Nit addressed.
This tells the build system to check and regenerate the *GenRegisterInfo*.inc files, should any of them be missing for whatever reason. A follow-up from <#167700>.
c6ed0c9 to
3c3dbaa
Compare
🐧 Linux x64 Test Results
|
|
LLVM Buildbot has detected a new failure on builder Full details are available at: https://lab.llvm.org/buildbot/#/builders/27/builds/19100 Here is the relevant piece of the build log for the reference |

This tells the build system to check and regenerate the
GenRegisterInfo.inc files, should any of them be missing for
whatever reason.
A follow-up from
#167700.