llvmorg-github-actions[bot] wrote:
<!--LLVM PR SUMMARY COMMENT--> @llvm/pr-subscribers-backend-amdgpu @llvm/pr-subscribers-backend-aarch64 Author: Markus Böck (zero9178) <details> <summary>Changes</summary> Other subprojects invoke their TableGen through a project-specific wrapper (clang_tablegen, mlir_tablegen, lldb_tablegen). Add llvm_tablegen for llvm-tblgen and replace every tablegen(LLVM ...) call with it. The llvm-tblgen-specific logic in tablegen() moves into llvm_tablegen: the DAGISel/GlobalISel coverage and -omit-comments flags, and the extra outputs of -gen-register-info, which tablegen() now accepts generically through a new EXTRA_OUTPUTS argument. My motivation is general cleanliness but also as a use-case to add the `EXTRA_OUTPUTS` cmake option to the `tablegen` command --- Patch is 94.59 KiB, truncated to 20.00 KiB below, full version: https://github.com/llvm/llvm-project/pull/235796.diff 96 Files Affected: - (modified) bolt/lib/Target/AArch64/CMakeLists.txt (+4-4) - (modified) bolt/lib/Target/RISCV/CMakeLists.txt (+4-4) - (modified) bolt/lib/Target/X86/CMakeLists.txt (+4-4) - (modified) clang/include/clang/Options/CMakeLists.txt (+1-1) - (modified) clang/tools/clang-installapi/CMakeLists.txt (+1-1) - (modified) clang/tools/clang-linker-wrapper/CMakeLists.txt (+1-1) - (modified) clang/tools/clang-nvlink-wrapper/CMakeLists.txt (+1-1) - (modified) clang/tools/clang-scan-deps/CMakeLists.txt (+1-1) - (modified) clang/tools/clang-sycl-linker/CMakeLists.txt (+1-1) - (modified) lld/COFF/CMakeLists.txt (+1-1) - (modified) lld/ELF/CMakeLists.txt (+1-1) - (modified) lld/MachO/CMakeLists.txt (+1-1) - (modified) lld/MinGW/CMakeLists.txt (+1-1) - (modified) lld/wasm/CMakeLists.txt (+1-1) - (modified) lldb/tools/driver/CMakeLists.txt (+1-1) - (modified) lldb/tools/lldb-dap/tool/CMakeLists.txt (+1-1) - (modified) lldb/tools/lldb-server/CMakeLists.txt (+2-2) - (modified) llvm/cmake/modules/TableGen.cmake (+31-23) - (modified) llvm/docs/CommandLine.md (+1-1) - (modified) llvm/examples/OptSubcommand/CMakeLists.txt (+1-1) - (modified) llvm/include/llvm/Analysis/CMakeLists.txt (+1-1) - (modified) llvm/include/llvm/CMakeLists.txt (+1-1) - (modified) llvm/include/llvm/CodeGen/CMakeLists.txt (+1-1) - (modified) llvm/include/llvm/Frontend/OpenACC/CMakeLists.txt (+2-2) - (modified) llvm/include/llvm/Frontend/OpenMP/CMakeLists.txt (+2-2) - (modified) llvm/include/llvm/IR/CMakeLists.txt (+23-23) - (modified) llvm/include/llvm/TargetParser/CMakeLists.txt (+5-5) - (modified) llvm/lib/CGData/CMakeLists.txt (+1-1) - (modified) llvm/lib/CodeGen/CMakeLists.txt (+1-1) - (modified) llvm/lib/ExecutionEngine/JITLink/CMakeLists.txt (+1-1) - (modified) llvm/lib/IR/CMakeLists.txt (+1-1) - (modified) llvm/lib/MC/CMakeLists.txt (+1-1) - (modified) llvm/lib/Passes/CMakeLists.txt (+1-1) - (modified) llvm/lib/Target/AArch64/CMakeLists.txt (+23-23) - (modified) llvm/lib/Target/AMDGPU/CMakeLists.txt (+25-25) - (modified) llvm/lib/Target/ARC/CMakeLists.txt (+8-8) - (modified) llvm/lib/Target/ARM/CMakeLists.txt (+16-16) - (modified) llvm/lib/Target/AVR/CMakeLists.txt (+10-10) - (modified) llvm/lib/Target/BPF/CMakeLists.txt (+12-12) - (modified) llvm/lib/Target/CSKY/CMakeLists.txt (+13-13) - (modified) llvm/lib/Target/DirectX/CMakeLists.txt (+4-4) - (modified) llvm/lib/Target/Hexagon/CMakeLists.txt (+11-11) - (modified) llvm/lib/Target/Lanai/CMakeLists.txt (+11-11) - (modified) llvm/lib/Target/LoongArch/CMakeLists.txt (+10-10) - (modified) llvm/lib/Target/M68k/CMakeLists.txt (+13-13) - (modified) llvm/lib/Target/MSP430/CMakeLists.txt (+11-11) - (modified) llvm/lib/Target/Mips/CMakeLists.txt (+18-18) - (modified) llvm/lib/Target/NVPTX/CMakeLists.txt (+6-6) - (modified) llvm/lib/Target/PowerPC/CMakeLists.txt (+14-14) - (modified) llvm/lib/Target/RISCV/CMakeLists.txt (+21-21) - (modified) llvm/lib/Target/SPIRV/CMakeLists.txt (+9-9) - (modified) llvm/lib/Target/Sparc/CMakeLists.txt (+12-12) - (modified) llvm/lib/Target/SystemZ/CMakeLists.txt (+12-12) - (modified) llvm/lib/Target/VE/CMakeLists.txt (+10-10) - (modified) llvm/lib/Target/WebAssembly/CMakeLists.txt (+14-14) - (modified) llvm/lib/Target/X86/CMakeLists.txt (+21-21) - (modified) llvm/lib/Target/XCore/CMakeLists.txt (+9-9) - (modified) llvm/lib/Target/Xtensa/CMakeLists.txt (+10-10) - (modified) llvm/lib/ToolDrivers/llvm-dlltool/CMakeLists.txt (+1-1) - (modified) llvm/lib/ToolDrivers/llvm-lib/CMakeLists.txt (+1-1) - (modified) llvm/lib/Transforms/InstCombine/CMakeLists.txt (+1-1) - (modified) llvm/lib/Transforms/Instrumentation/CMakeLists.txt (+1-1) - (modified) llvm/lib/Transforms/Scalar/CMakeLists.txt (+1-1) - (modified) llvm/lib/Transforms/Vectorize/CMakeLists.txt (+1-1) - (modified) llvm/tools/dsymutil/CMakeLists.txt (+1-1) - (modified) llvm/tools/llvm-cas/CMakeLists.txt (+1-1) - (modified) llvm/tools/llvm-cgdata/CMakeLists.txt (+1-1) - (modified) llvm/tools/llvm-cov/CMakeLists.txt (+1-1) - (modified) llvm/tools/llvm-cvtres/CMakeLists.txt (+1-1) - (modified) llvm/tools/llvm-cxxfilt/CMakeLists.txt (+1-1) - (modified) llvm/tools/llvm-debuginfod-find/CMakeLists.txt (+1-1) - (modified) llvm/tools/llvm-debuginfod/CMakeLists.txt (+1-1) - (modified) llvm/tools/llvm-dwarfutil/CMakeLists.txt (+1-1) - (modified) llvm/tools/llvm-dwp/CMakeLists.txt (+1-1) - (modified) llvm/tools/llvm-gsymutil/CMakeLists.txt (+1-1) - (modified) llvm/tools/llvm-ifs/CMakeLists.txt (+1-1) - (modified) llvm/tools/llvm-libtool-darwin/CMakeLists.txt (+1-1) - (modified) llvm/tools/llvm-lipo/CMakeLists.txt (+1-1) - (modified) llvm/tools/llvm-ml/CMakeLists.txt (+1-1) - (modified) llvm/tools/llvm-mt/CMakeLists.txt (+1-1) - (modified) llvm/tools/llvm-nm/CMakeLists.txt (+1-1) - (modified) llvm/tools/llvm-objcopy/CMakeLists.txt (+5-5) - (modified) llvm/tools/llvm-objdump/CMakeLists.txt (+2-2) - (modified) llvm/tools/llvm-rc/CMakeLists.txt (+2-2) - (modified) llvm/tools/llvm-readobj/CMakeLists.txt (+1-1) - (modified) llvm/tools/llvm-readtapi/CMakeLists.txt (+1-1) - (modified) llvm/tools/llvm-size/CMakeLists.txt (+1-1) - (modified) llvm/tools/llvm-strings/CMakeLists.txt (+1-1) - (modified) llvm/tools/llvm-symbolizer/CMakeLists.txt (+1-1) - (modified) llvm/tools/llvm-tli-checker/CMakeLists.txt (+1-1) - (modified) llvm/tools/obj2yaml/CMakeLists.txt (+1-1) - (modified) llvm/tools/sancov/CMakeLists.txt (+1-1) - (modified) llvm/tools/yaml2obj/CMakeLists.txt (+1-1) - (modified) llvm/unittests/Option/CMakeLists.txt (+3-3) - (modified) llvm/unittests/TableGen/CMakeLists.txt (+2-2) - (modified) llvm/utils/split-file/CMakeLists.txt (+1-1) ``````````diff diff --git a/bolt/lib/Target/AArch64/CMakeLists.txt b/bolt/lib/Target/AArch64/CMakeLists.txt index b18da3ef1ae3a7..3f2e41434097ca 100644 --- a/bolt/lib/Target/AArch64/CMakeLists.txt +++ b/bolt/lib/Target/AArch64/CMakeLists.txt @@ -10,10 +10,10 @@ set(LLVM_LINK_COMPONENTS if(BOLT_BUILT_STANDALONE) set(LLVM_TARGET_DEFINITIONS ${LLVM_MAIN_SRC_DIR}/lib/Target/AArch64/AArch64.td) list(APPEND LLVM_TABLEGEN_FLAGS -I ${LLVM_MAIN_SRC_DIR}/lib/Target/AArch64) - tablegen(LLVM AArch64GenInstrInfo.inc -gen-instr-info) - tablegen(LLVM AArch64GenRegisterInfo.inc -gen-register-info) - tablegen(LLVM AArch64GenSystemOperands.inc -gen-searchable-tables) - tablegen(LLVM AArch64GenSubtargetInfo.inc -gen-subtarget) + llvm_tablegen(AArch64GenInstrInfo.inc -gen-instr-info) + llvm_tablegen(AArch64GenRegisterInfo.inc -gen-register-info) + llvm_tablegen(AArch64GenSystemOperands.inc -gen-searchable-tables) + llvm_tablegen(AArch64GenSubtargetInfo.inc -gen-subtarget) add_public_tablegen_target(AArch64CommonTableGen) include_directories(${CMAKE_CURRENT_BINARY_DIR}) diff --git a/bolt/lib/Target/RISCV/CMakeLists.txt b/bolt/lib/Target/RISCV/CMakeLists.txt index 1af849d99800d6..d3a81a2c970802 100644 --- a/bolt/lib/Target/RISCV/CMakeLists.txt +++ b/bolt/lib/Target/RISCV/CMakeLists.txt @@ -10,10 +10,10 @@ if(BOLT_BUILT_STANDALONE) # tablegen, copied from llvm/lib/Target/RISCV/CMakeLists.txt set(LLVM_TARGET_DEFINITIONS ${LLVM_MAIN_SRC_DIR}/lib/Target/RISCV/RISCV.td) list(APPEND LLVM_TABLEGEN_FLAGS -I ${LLVM_MAIN_SRC_DIR}/lib/Target/RISCV) - tablegen(LLVM RISCVGenInstrInfo.inc -gen-instr-info) - tablegen(LLVM RISCVGenRegisterInfo.inc -gen-register-info) - tablegen(LLVM RISCVGenSearchableTables.inc -gen-searchable-tables) - tablegen(LLVM RISCVGenSubtargetInfo.inc -gen-subtarget) + llvm_tablegen(RISCVGenInstrInfo.inc -gen-instr-info) + llvm_tablegen(RISCVGenRegisterInfo.inc -gen-register-info) + llvm_tablegen(RISCVGenSearchableTables.inc -gen-searchable-tables) + llvm_tablegen(RISCVGenSubtargetInfo.inc -gen-subtarget) add_public_tablegen_target(RISCVCommonTableGen) include_directories(${CMAKE_CURRENT_BINARY_DIR}) diff --git a/bolt/lib/Target/X86/CMakeLists.txt b/bolt/lib/Target/X86/CMakeLists.txt index c9567e6fc00295..310344e1c0ecd8 100644 --- a/bolt/lib/Target/X86/CMakeLists.txt +++ b/bolt/lib/Target/X86/CMakeLists.txt @@ -9,10 +9,10 @@ set(LLVM_LINK_COMPONENTS if(BOLT_BUILT_STANDALONE) set(LLVM_TARGET_DEFINITIONS ${LLVM_MAIN_SRC_DIR}/lib/Target/X86/X86.td) list(APPEND LLVM_TABLEGEN_FLAGS -I ${LLVM_MAIN_SRC_DIR}/lib/Target/X86) - tablegen(LLVM X86GenInstrInfo.inc -gen-instr-info -instr-info-expand-mi-operand-info=0) - tablegen(LLVM X86GenMnemonicTables.inc -gen-x86-mnemonic-tables -asmwriternum=1) - tablegen(LLVM X86GenRegisterInfo.inc -gen-register-info) - tablegen(LLVM X86GenSubtargetInfo.inc -gen-subtarget) + llvm_tablegen(X86GenInstrInfo.inc -gen-instr-info -instr-info-expand-mi-operand-info=0) + llvm_tablegen(X86GenMnemonicTables.inc -gen-x86-mnemonic-tables -asmwriternum=1) + llvm_tablegen(X86GenRegisterInfo.inc -gen-register-info) + llvm_tablegen(X86GenSubtargetInfo.inc -gen-subtarget) add_public_tablegen_target(X86CommonTableGen) include_directories(${CMAKE_CURRENT_BINARY_DIR}) diff --git a/clang/include/clang/Options/CMakeLists.txt b/clang/include/clang/Options/CMakeLists.txt index a9d988047920b0..a959cb258054aa 100644 --- a/clang/include/clang/Options/CMakeLists.txt +++ b/clang/include/clang/Options/CMakeLists.txt @@ -1,3 +1,3 @@ set(LLVM_TARGET_DEFINITIONS Options.td) -tablegen(LLVM Options.inc -gen-opt-parser-defs) +llvm_tablegen(Options.inc -gen-opt-parser-defs) add_public_tablegen_target(ClangDriverOptions) diff --git a/clang/tools/clang-installapi/CMakeLists.txt b/clang/tools/clang-installapi/CMakeLists.txt index 54bc80486472fc..edea962986009b 100644 --- a/clang/tools/clang-installapi/CMakeLists.txt +++ b/clang/tools/clang-installapi/CMakeLists.txt @@ -8,7 +8,7 @@ set(LLVM_LINK_COMPONENTS ) set(LLVM_TARGET_DEFINITIONS InstallAPIOpts.td) -tablegen(LLVM InstallAPIOpts.inc -gen-opt-parser-defs) +llvm_tablegen(InstallAPIOpts.inc -gen-opt-parser-defs) add_public_tablegen_target(InstallAPIDriverOptions) add_clang_tool(clang-installapi diff --git a/clang/tools/clang-linker-wrapper/CMakeLists.txt b/clang/tools/clang-linker-wrapper/CMakeLists.txt index bf37d8031025ed..d9ecc848fe489e 100644 --- a/clang/tools/clang-linker-wrapper/CMakeLists.txt +++ b/clang/tools/clang-linker-wrapper/CMakeLists.txt @@ -19,7 +19,7 @@ set(LLVM_LINK_COMPONENTS ) set(LLVM_TARGET_DEFINITIONS LinkerWrapperOpts.td) -tablegen(LLVM LinkerWrapperOpts.inc -gen-opt-parser-defs) +llvm_tablegen(LinkerWrapperOpts.inc -gen-opt-parser-defs) add_public_tablegen_target(LinkerWrapperOpts) if(NOT CLANG_BUILT_STANDALONE) diff --git a/clang/tools/clang-nvlink-wrapper/CMakeLists.txt b/clang/tools/clang-nvlink-wrapper/CMakeLists.txt index 846fa952ba58d2..c8093f2435a2c5 100644 --- a/clang/tools/clang-nvlink-wrapper/CMakeLists.txt +++ b/clang/tools/clang-nvlink-wrapper/CMakeLists.txt @@ -18,7 +18,7 @@ set(LLVM_LINK_COMPONENTS ) set(LLVM_TARGET_DEFINITIONS NVLinkOpts.td) -tablegen(LLVM NVLinkOpts.inc -gen-opt-parser-defs) +llvm_tablegen(NVLinkOpts.inc -gen-opt-parser-defs) add_public_tablegen_target(NVLinkWrapperOpts) if(NOT CLANG_BUILT_STANDALONE) diff --git a/clang/tools/clang-scan-deps/CMakeLists.txt b/clang/tools/clang-scan-deps/CMakeLists.txt index 10bc0ff23c5482..a05c787e8a05c8 100644 --- a/clang/tools/clang-scan-deps/CMakeLists.txt +++ b/clang/tools/clang-scan-deps/CMakeLists.txt @@ -7,7 +7,7 @@ set(LLVM_LINK_COMPONENTS ) set(LLVM_TARGET_DEFINITIONS Opts.td) -tablegen(LLVM Opts.inc -gen-opt-parser-defs) +llvm_tablegen(Opts.inc -gen-opt-parser-defs) add_public_tablegen_target(ScanDepsOptsTableGen) add_clang_tool(clang-scan-deps diff --git a/clang/tools/clang-sycl-linker/CMakeLists.txt b/clang/tools/clang-sycl-linker/CMakeLists.txt index 84f24603ea87dc..41d29578bc4528 100644 --- a/clang/tools/clang-sycl-linker/CMakeLists.txt +++ b/clang/tools/clang-sycl-linker/CMakeLists.txt @@ -18,7 +18,7 @@ set(LLVM_LINK_COMPONENTS ) set(LLVM_TARGET_DEFINITIONS SYCLLinkOpts.td) -tablegen(LLVM SYCLLinkOpts.inc -gen-opt-parser-defs) +llvm_tablegen(SYCLLinkOpts.inc -gen-opt-parser-defs) add_public_tablegen_target(SYCLLinkerOpts) if(NOT CLANG_BUILT_STANDALONE) diff --git a/lld/COFF/CMakeLists.txt b/lld/COFF/CMakeLists.txt index 62f10e97b21e2b..1b68db06eb1fde 100644 --- a/lld/COFF/CMakeLists.txt +++ b/lld/COFF/CMakeLists.txt @@ -1,5 +1,5 @@ set(LLVM_TARGET_DEFINITIONS Options.td) -tablegen(LLVM Options.inc -gen-opt-parser-defs) +llvm_tablegen(Options.inc -gen-opt-parser-defs) add_public_tablegen_target(COFFOptionsTableGen) add_lld_library(lldCOFF diff --git a/lld/ELF/CMakeLists.txt b/lld/ELF/CMakeLists.txt index e22897c2789d82..d7ab52eef08a8a 100644 --- a/lld/ELF/CMakeLists.txt +++ b/lld/ELF/CMakeLists.txt @@ -1,5 +1,5 @@ set(LLVM_TARGET_DEFINITIONS Options.td) -tablegen(LLVM Options.inc -gen-opt-parser-defs) +llvm_tablegen(Options.inc -gen-opt-parser-defs) add_public_tablegen_target(ELFOptionsTableGen) if(LLVM_ENABLE_ZLIB) diff --git a/lld/MachO/CMakeLists.txt b/lld/MachO/CMakeLists.txt index 172e34803dcdd8..3417c6f9f7702a 100644 --- a/lld/MachO/CMakeLists.txt +++ b/lld/MachO/CMakeLists.txt @@ -1,5 +1,5 @@ set(LLVM_TARGET_DEFINITIONS Options.td) -tablegen(LLVM Options.inc -gen-opt-parser-defs) +llvm_tablegen(Options.inc -gen-opt-parser-defs) add_public_tablegen_target(MachOOptionsTableGen) include_directories(${LLVM_MAIN_SRC_DIR}/../libunwind/include) diff --git a/lld/MinGW/CMakeLists.txt b/lld/MinGW/CMakeLists.txt index 35eb6f89f531a1..2cd0a1e4dc50b5 100644 --- a/lld/MinGW/CMakeLists.txt +++ b/lld/MinGW/CMakeLists.txt @@ -1,5 +1,5 @@ set(LLVM_TARGET_DEFINITIONS Options.td) -tablegen(LLVM Options.inc -gen-opt-parser-defs) +llvm_tablegen(Options.inc -gen-opt-parser-defs) add_public_tablegen_target(MinGWOptionsTableGen) add_lld_library(lldMinGW diff --git a/lld/wasm/CMakeLists.txt b/lld/wasm/CMakeLists.txt index 05b12d76df50c5..930151ef9c5882 100644 --- a/lld/wasm/CMakeLists.txt +++ b/lld/wasm/CMakeLists.txt @@ -1,5 +1,5 @@ set(LLVM_TARGET_DEFINITIONS Options.td) -tablegen(LLVM Options.inc -gen-opt-parser-defs) +llvm_tablegen(Options.inc -gen-opt-parser-defs) add_public_tablegen_target(WasmOptionsTableGen) add_lld_library(lldWasm diff --git a/lldb/tools/driver/CMakeLists.txt b/lldb/tools/driver/CMakeLists.txt index 4cedb9048c06c2..0e5dfa1a2c6633 100644 --- a/lldb/tools/driver/CMakeLists.txt +++ b/lldb/tools/driver/CMakeLists.txt @@ -1,5 +1,5 @@ set(LLVM_TARGET_DEFINITIONS Options.td) -tablegen(LLVM Options.inc -gen-opt-parser-defs) +llvm_tablegen(Options.inc -gen-opt-parser-defs) add_public_tablegen_target(LLDBOptionsTableGen) if(APPLE) diff --git a/lldb/tools/lldb-dap/tool/CMakeLists.txt b/lldb/tools/lldb-dap/tool/CMakeLists.txt index 9cdaab2480c1d6..da44fed2410e4c 100644 --- a/lldb/tools/lldb-dap/tool/CMakeLists.txt +++ b/lldb/tools/lldb-dap/tool/CMakeLists.txt @@ -1,5 +1,5 @@ set(LLVM_TARGET_DEFINITIONS Options.td) -tablegen(LLVM Options.inc -gen-opt-parser-defs) +llvm_tablegen(Options.inc -gen-opt-parser-defs) add_public_tablegen_target(LLDBDAPOptionsTableGen) set(LLDB_DAP_LINK_LIBS lldbDAP liblldb lldbHost) diff --git a/lldb/tools/lldb-server/CMakeLists.txt b/lldb/tools/lldb-server/CMakeLists.txt index fd31d81a35c202..264318c512e275 100644 --- a/lldb/tools/lldb-server/CMakeLists.txt +++ b/lldb/tools/lldb-server/CMakeLists.txt @@ -1,9 +1,9 @@ set(LLVM_TARGET_DEFINITIONS LLGSOptions.td) -tablegen(LLVM LLGSOptions.inc -gen-opt-parser-defs) +llvm_tablegen(LLGSOptions.inc -gen-opt-parser-defs) add_public_tablegen_target(LLGSOptionsTableGen) set(LLVM_TARGET_DEFINITIONS PlatformOptions.td) -tablegen(LLVM PlatformOptions.inc -gen-opt-parser-defs) +llvm_tablegen(PlatformOptions.inc -gen-opt-parser-defs) add_public_tablegen_target(PlatformOptionsTableGen) set(LLDB_PLUGINS) diff --git a/llvm/cmake/modules/TableGen.cmake b/llvm/cmake/modules/TableGen.cmake index c1b5019d73200d..aa39398e31f7c9 100644 --- a/llvm/cmake/modules/TableGen.cmake +++ b/llvm/cmake/modules/TableGen.cmake @@ -1,6 +1,8 @@ # LLVM_TARGET_DEFINITIONS must contain the name of the .td file to process, # while LLVM_TARGET_DEPENDS may contain additional file dependencies. # Extra parameters for `tblgen' may come after `ofn' parameter. +# Files that the generator writes besides `ofn' may be listed after +# EXTRA_OUTPUTS. # Adds the name of the generated file to TABLEGEN_OUTPUT. include(LLVMDistributionSupport) @@ -8,7 +10,7 @@ set(LLVM_TABLEGEN_LAUNCHER "" CACHE STRING "Semicolon-separated command prefix for TableGen invocations") function(tablegen project ofn) - cmake_parse_arguments(ARG "" "" "DEPENDS;EXTRA_INCLUDES" ${ARGN}) + cmake_parse_arguments(ARG "" "" "DEPENDS;EXTRA_INCLUDES;EXTRA_OUTPUTS" ${ARGN}) # Override ${project} with ${project}_TABLEGEN_PROJECT if(NOT "${${project}_TABLEGEN_PROJECT}" STREQUAL "") @@ -58,27 +60,6 @@ function(tablegen project ofn) ) endif() - if (LLVM_ENABLE_DAGISEL_COV AND "-gen-dag-isel" IN_LIST ARGN) - list(APPEND LLVM_TABLEGEN_FLAGS "-instrument-coverage") - endif() - if (LLVM_ENABLE_GISEL_COV AND "-gen-global-isel" IN_LIST ARGN) - list(APPEND LLVM_TABLEGEN_FLAGS "-instrument-gisel-coverage") - list(APPEND LLVM_TABLEGEN_FLAGS "-gisel-coverage-file=${LLVM_GISEL_COV_PREFIX}all") - endif() - if (LLVM_OMIT_DAGISEL_COMMENTS AND "-gen-dag-isel" IN_LIST ARGN) - list(APPEND LLVM_TABLEGEN_FLAGS "-omit-comments") - endif() - - set(EXTRA_OUTPUTS) - if("-gen-register-info" IN_LIST ARGN) - cmake_path(GET ofn STEM OUTPUT_BASENAME) - 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 @@ -148,7 +129,7 @@ function(tablegen project ofn) set(LLVM_TABLEGEN_JOB_POOL "") endif() - add_custom_command(OUTPUT ${CMAKE_CURRENT_BINARY_DIR}/${ofn} ${EXTRA_OUTPUTS} + add_custom_command(OUTPUT ${CMAKE_CURRENT_BINARY_DIR}/${ofn} ${ARG_EXTRA_OUTPUTS} COMMAND ${tablegen_launcher} ${tablegen_exe} ${ARG_UNPARSED_ARGUMENTS} ${tblgen_includes} ${LLVM_TABLEGEN_FLAGS} @@ -174,6 +155,33 @@ function(tablegen project ofn) GENERATED 1) endfunction() +# Invokes llvm-tblgen; see tablegen() for the calling convention. +function(llvm_tablegen ofn) + if (LLVM_ENABLE_DAGISEL_COV AND "-gen-dag-isel" IN_LIST ARGN) + list(APPEND LLVM_TABLEGEN_FLAGS "-instrument-coverage") + endif() + if (LLVM_ENABLE_GISEL_COV AND "-gen-global-isel" IN_LIST ARGN) + list(APPEND LLVM_TABLEGEN_FLAGS "-instrument-gisel-coverage") + list(APPEND LLVM_TABLEGEN_FLAGS "-gisel-coverage-file=${LLVM_GISEL_COV_PREFIX}all") + endif() + if (LLVM_OMIT_DAGISEL_COMMENTS AND "-gen-dag-isel" IN_LIST ARGN) + list(APPEND LLVM_TABLEGEN_FLAGS "-omit-comments") + endif() + + set(extra_outputs) + if("-gen-register-info" IN_LIST ARGN) + cmake_path(GET ofn STEM output_basename) + 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() + + tablegen(LLVM ${ofn} ${ARGN} EXTRA_OUTPUTS ${extra_outputs}) + set(TABLEGEN_OUTPUT ${TABLEGEN_OUTPUT} PARENT_SCOPE) +endfunction() + # Creates a target for publicly exporting tablegen dependencies. function(add_public_tablegen_target target) if(NOT TABLEGEN_OUTPUT) diff --git a/llvm/docs/CommandLine.md b/llvm/docs/CommandLine.md index 51a6528b62e81a..00e293a12be1d0 100644 --- a/llvm/docs/CommandLine.md +++ b/llvm/docs/CommandLine.md @@ -1601,6 +1601,6 @@ An `OptionalValueField` or `OptionalEnumField` takes no default; its `std::optio The header declares the struct after including what the member defaults need, and one source file defines it and registers it with `cl::`. The library then lists `FooOptionsTableGen` under `DEPENDS` and `Option` under `LINK_COMPONENTS`. -A library that otherwise needs only `llvm-min-tblgen` sets `LLVM_TABLEGEN_PROJECT` to `LLVM_HEADERS` before its `tablegen()` call, so that its sources need not wait for `llvm-tblgen`. +A library that otherwise needs only `llvm-min-tblgen` sets `LLVM_TABLEGEN_PROJECT` to `LLVM_HEADERS` before its `llvm_tablegen()` call, so that its sources need not wait for `llvm-tblgen`. Code reads `FooOptions::Global.enable_foo`, the instance the command line sets. Keep the header in `lib/`, as private as the `static cl::opt` it replaces; another library that needs a value calls a function or takes a parameter. diff --git a/llvm/examples/OptSubcommand/CMakeLists.txt b/llvm/examples/OptSubcommand/CMakeLists.txt index debc948611866e..ded3c9b1477169 100644 --- a/llvm/examples/OptSubcommand/CMakeLists.txt +++ b/llvm/examples/OptSubcommand/CMakeLists.txt @@ -1,7 +1,7 @@ # Set the .td file to be processed for this target. set(LLVM_TARGET_DEFINITIONS Opts.td) -tablegen(LLVM Opts.inc -gen-opt-parser-defs) +llvm_tablegen(Opts.inc -gen-opt-parser-defs) add_public_tablegen_target(HelloSubTableGen) set(LLVM_LINK_COMPONENTS diff --git a/llvm/include/llvm/Analysis/CMakeLists.txt b/llvm/include/llvm/Analysis/CMakeLists.txt index 036f7ff00ce862..5e45e345591dba 100644 --- a/llvm/include/llvm/Analysis/CMakeLists.txt +++ b/llvm/include/llvm/Analysis/CMakeLists.txt @@ -1,3 +1,3 @@ set(LLVM_TARGET_DEFINITIONS TargetLibraryInfo.td) -tablegen(LLVM TargetLibraryInfo.inc -gen-target-library-info) +llvm_tablegen(TargetLibraryInfo.inc -gen-target-library-info) add_public_tablegen_target(analysis_gen) diff --git a/llvm/include/llvm/CMakeLists.txt b/llvm/include/llvm/CMakeLists.txt index c66bfda4c1f6ff..621021ecb9e349 100644 --- a/llvm/include/llvm/CMakeLists.txt +++ b/llvm/include/llvm/CMakeLists.txt @@ -1,4 +1,4 @@ -# Use LLVM_HEADERS for each `tablegen(LLVM)` in subdirectories +# Use LLVM_HEADERS for each `llvm_tablegen()` in subdirectories # LLVM_HEADERS_TABLEGEN points to `llvm-min-tblgen` set(LLVM_TABLEGEN_PROJECT LLVM_HEADERS) diff --git a/llvm/include/llvm/CodeGen/CMakeLists.txt b/llvm/include/llvm/CodeGen/CMakeLists.txt index 652e1baed1e7c4..fa72d2d579e971 100644 --- a/llvm/include/llvm/CodeGen/CMakeLists.txt +++ b/llvm/include/llvm/CodeGen/CMakeLists.txt @@ -1,3 +1,3 @@ set(LLVM_TARGET_DEFINITIONS ${PROJECT_SOURCE_DIR}/include/llvm/CodeGen/ValueTypes.td) -tablegen(LLVM GenVT.inc -gen-vt) +llvm_tablegen(GenVT.inc -gen-vt) add_public_tablegen_target(vt_gen) diff --git a/llvm/include/llvm/Frontend/OpenACC/CMakeLists.txt b/llvm/include/llvm/Frontend/OpenACC/CMakeLists.txt index 558de3aa92204c..f5398eea9bd91d 100644 --- a/llvm/include/llvm/Frontend/OpenACC/CMakeLists.txt +++ b/llvm/include/llvm/Frontend/OpenACC/CMakeLists.txt @@ -1,4 +1,4 @@ set(LLVM_TARGET_DEFINITIONS ACC.td) -tablegen(LLVM ACC.h.inc --gen-directive-decl) -tablegen(LLVM ACC.inc --gen-directive-impl) +llvm_tablegen(ACC.h.inc --gen-directive-decl) +llvm_tablegen(ACC.inc --gen-directive-impl) add_public_tablegen_target(acc_gen) diff --git a/llvm/include/llvm/Frontend/OpenMP/CMakeLists.txt b/llvm/include/llvm/Frontend/OpenMP/CMakeLists.txt index e983cf5ca56db3..95407a81cc9047 100644 --- a/llvm/include/llvm/Frontend/OpenMP/CMakeLists.txt +++ b/llvm/include/llvm/Frontend/OpenMP/CMakeLists.txt @@ -1,4 +1,4 @@ set(LLVM_TARGET_DEFINITIONS OMP.td) -tablegen(LLVM OMP.h.inc --gen-directive-decl) -tablegen(LLVM OMP.inc --gen-directive-impl) +llvm_tablegen(OMP.h.inc --gen-directive-decl) +llvm_tablegen(OMP.inc --gen-directive-impl) add_public_tablegen_target(omp_gen) diff --git a/llvm/include/llvm/IR/CMakeLists.txt b/llvm/include/llvm/IR/CMakeLists.txt index 5a7676b968589a..39f1cad3e42e75 100644 --- a/llvm/include/llvm/IR/CMakeLists.txt +++ b/llvm/include/llvm/IR/CMakeLists.txt @@ -1,29 +1,29 @@ set(LLVM_TARGET_DEFINITIONS Attributes.td) -tablegen(LLVM Attributes.inc -gen-attrs) +llvm_tablegen(Attributes.inc -gen-attrs) set(LLVM_TARGET_DEFINITIONS RuntimeLibcalls.td) -tablegen(LLVM RuntimeLibcalls.inc -gen-runtime-libcalls) +llvm_tablegen(RuntimeLibcalls.inc -gen-runtime-libcalls) set(LLVM_TARGET_DEFINITIONS Intrinsics.td) -tablegen(LLVM IntrinsicImpl.inc -gen-intrinsic-impl) -tablegen(LLVM IntrinsicEnums.inc -gen-intrinsic-enums) -tablegen(LLVM IntrinsicsAArch64.h -gen-intrinsic-enums -intrinsic-prefix=aarch64) -tablegen(LLVM IntrinsicsAMDGPU.h -gen-intrinsic-enums -intrinsic-prefix=amdgcn) -tablegen(LLVM IntrinsicsARM.h -gen-intrinsic-enums -intrinsic-prefix=arm) -tablegen(LLVM IntrinsicsAVR.h -gen-intrinsic-enums -intrinsic-prefix=avr) -tablegen(LLVM IntrinsicsBPF.h -gen-intrinsic-enums -intrinsic-prefix=bpf) -tablegen(LLVM IntrinsicsDirectX.h -gen-intrinsic-enums -intrinsic-prefix=dx) -tablegen(LLVM IntrinsicsHexagon.h -gen-intrinsic-enums -intrinsic-prefix=hexagon) -tablegen(LLVM IntrinsicsLoongArch.h -gen-intrinsic-enums -intrinsic-prefix=loongarch) -tablegen(LLVM IntrinsicsMips.h -gen-intrinsic-enums -intrinsic-prefix=mips) -tablegen(LLVM IntrinsicsNVPTX.h -gen-intrinsic-enums -intrinsic-prefix=nvvm) -tablegen(LLVM IntrinsicsPowerPC.h -gen-intrinsic-enums -intrinsic-prefix=ppc) -tablegen(LLVM IntrinsicsR600.h -gen-intrinsic-enums -intrinsic-prefix=r600) -tablegen(LLVM IntrinsicsRISCV.h -gen-intrinsic-enums -intrinsic-prefix=riscv) -tablegen(LLVM IntrinsicsSPIRV.h -gen-intrinsic-enums -intrinsic-prefix=spv) -tablegen(LLVM IntrinsicsS390.h -gen-intrinsic-enums -intrinsic-prefix=s390) -tablegen(LLVM IntrinsicsWebAssembly.h -gen-intrinsic-enums -intrinsic-prefix=wasm) -tablegen(LLVM IntrinsicsX86.h -gen-intrinsic-enums -intrinsic-prefix=x86) -tablegen(LLVM IntrinsicsXCore.h -gen-intrinsic-enums -intrinsic-prefix=xcore) -tablegen(LLVM IntrinsicsVE.h -gen-intrinsic-enums -intrinsic-prefix=ve) +llvm_tablegen(IntrinsicImpl.inc -gen-intrinsic-impl) +llvm_tablegen(IntrinsicEnums.inc -gen-intrinsic-enum... [truncated] `````````` </details> https://github.com/llvm/llvm-project/pull/235796 _______________________________________________ cfe-commits mailing list [email protected] https://lists.llvm.org/cgi-bin/mailman/listinfo/cfe-commits
