Skip to content

Commit c6ed0c9

Browse files
committed
[CMake] Declare all parts of *GenRegisterInfo.inc as outputs.
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>.
1 parent 6f5c8fe commit c6ed0c9

File tree

2 files changed

+13
-1
lines changed

2 files changed

+13
-1
lines changed

llvm/cmake/modules/TableGen.cmake

Lines changed: 11 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -66,6 +66,16 @@ function(tablegen project ofn)
6666
list(APPEND LLVM_TABLEGEN_FLAGS "-omit-comments")
6767
endif()
6868

69+
set(EXTRA_OUTPUTS)
70+
if("-gen-register-info" IN_LIST ARGN)
71+
string(REGEX REPLACE "\\.[^.]*$" "" OUTPUT_BASENAME ${ofn})
72+
list(APPEND EXTRA_OUTPUTS
73+
${CMAKE_CURRENT_BINARY_DIR}/${OUTPUT_BASENAME}Enums.inc
74+
${CMAKE_CURRENT_BINARY_DIR}/${OUTPUT_BASENAME}Header.inc
75+
${CMAKE_CURRENT_BINARY_DIR}/${OUTPUT_BASENAME}MCDesc.inc
76+
${CMAKE_CURRENT_BINARY_DIR}/${OUTPUT_BASENAME}TargetDesc.inc)
77+
endif()
78+
6979
# MSVC can't support long string literals ("long" > 65534 bytes)[1], so if there's
7080
# a possibility of generated tables being consumed by MSVC, generate arrays of
7181
# char literals, instead. If we're cross-compiling, then conservatively assume
@@ -126,7 +136,7 @@ function(tablegen project ofn)
126136
set(LLVM_TABLEGEN_JOB_POOL "")
127137
endif()
128138

129-
add_custom_command(OUTPUT ${CMAKE_CURRENT_BINARY_DIR}/${ofn}
139+
add_custom_command(OUTPUT ${CMAKE_CURRENT_BINARY_DIR}/${ofn} ${EXTRA_OUTPUTS}
130140
COMMAND ${tablegen_exe} ${ARG_UNPARSED_ARGUMENTS}
131141
${tblgen_includes}
132142
${LLVM_TABLEGEN_FLAGS}

llvm/utils/TableGen/RegisterInfoEmitter.cpp

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -1878,6 +1878,8 @@ TableGenOutputFiles RegisterInfoEmitter::run(StringRef FilenamePrefix) {
18781878
if (RegisterInfoDebug)
18791879
debugDump(errs());
18801880

1881+
// The suffixes should be in sync with the tablegen function in
1882+
// llvm/cmake/modules/TableGen.cmake.
18811883
return {Main,
18821884
{{"Enums.inc", Enums},
18831885
{"MCDesc.inc", MCDesc},

0 commit comments

Comments
 (0)