diff --git a/clang/tools/clang-linker-wrapper/CMakeLists.txt b/clang/tools/clang-linker-wrapper/CMakeLists.txt --- a/clang/tools/clang-linker-wrapper/CMakeLists.txt +++ b/clang/tools/clang-linker-wrapper/CMakeLists.txt @@ -22,13 +22,15 @@ add_public_tablegen_target(LinkerWrapperOpts) if(NOT CLANG_BUILT_STANDALONE) - set(tablegen_deps intrinsics_gen LinkerWrapperOpts) + set(tablegen_deps intrinsics_gen) endif() add_clang_tool(clang-linker-wrapper ClangLinkerWrapper.cpp OffloadWrapper.cpp + LinkerWrapperOpts.inc + DEPENDS ${tablegen_deps} ) diff --git a/clang/tools/clang-scan-deps/CMakeLists.txt b/clang/tools/clang-scan-deps/CMakeLists.txt --- a/clang/tools/clang-scan-deps/CMakeLists.txt +++ b/clang/tools/clang-scan-deps/CMakeLists.txt @@ -7,13 +7,11 @@ set(LLVM_TARGET_DEFINITIONS Opts.td) tablegen(LLVM Opts.inc -gen-opt-parser-defs) -add_public_tablegen_target(ScanDepsOptsTableGen) add_clang_tool(clang-scan-deps ClangScanDeps.cpp - DEPENDS - ScanDepsOptsTableGen + Opts.inc GENERATE_DRIVER ) diff --git a/lld/COFF/CMakeLists.txt b/lld/COFF/CMakeLists.txt --- a/lld/COFF/CMakeLists.txt +++ b/lld/COFF/CMakeLists.txt @@ -1,6 +1,5 @@ set(LLVM_TARGET_DEFINITIONS Options.td) tablegen(LLVM Options.inc -gen-opt-parser-defs) -add_public_tablegen_target(COFFOptionsTableGen) add_lld_library(lldCOFF CallGraphSort.cpp @@ -22,6 +21,8 @@ Symbols.cpp Writer.cpp + Options.inc + LINK_COMPONENTS ${LLVM_TARGETS_TO_BUILD} BinaryFormat @@ -48,6 +49,5 @@ ${LLVM_ATOMIC_LIB} DEPENDS - COFFOptionsTableGen intrinsics_gen ) diff --git a/lld/ELF/CMakeLists.txt b/lld/ELF/CMakeLists.txt --- a/lld/ELF/CMakeLists.txt +++ b/lld/ELF/CMakeLists.txt @@ -1,6 +1,5 @@ set(LLVM_TARGET_DEFINITIONS Options.td) tablegen(LLVM Options.inc -gen-opt-parser-defs) -add_public_tablegen_target(ELFOptionsTableGen) if(LLVM_ENABLE_ZLIB) set(imported_libs ZLIB::ZLIB) @@ -58,6 +57,8 @@ Thunks.cpp Writer.cpp + Options.inc + LINK_COMPONENTS ${LLVM_TARGETS_TO_BUILD} BinaryFormat @@ -79,6 +80,5 @@ ${LLVM_PTHREAD_LIB} DEPENDS - ELFOptionsTableGen intrinsics_gen ) diff --git a/lld/MachO/CMakeLists.txt b/lld/MachO/CMakeLists.txt --- a/lld/MachO/CMakeLists.txt +++ b/lld/MachO/CMakeLists.txt @@ -1,6 +1,5 @@ set(LLVM_TARGET_DEFINITIONS Options.td) tablegen(LLVM Options.inc -gen-opt-parser-defs) -add_public_tablegen_target(MachOOptionsTableGen) include_directories(${LLVM_MAIN_SRC_DIR}/../libunwind/include) @@ -34,6 +33,8 @@ UnwindInfoSection.cpp Writer.cpp + Options.inc + LINK_COMPONENTS ${LLVM_TARGETS_TO_BUILD} BinaryFormat @@ -56,9 +57,6 @@ lldCommon ${LLVM_PTHREAD_LIB} ${XAR_LIB} - - DEPENDS - MachOOptionsTableGen ) if(LLVM_HAVE_LIBXAR) diff --git a/lld/MinGW/CMakeLists.txt b/lld/MinGW/CMakeLists.txt --- a/lld/MinGW/CMakeLists.txt +++ b/lld/MinGW/CMakeLists.txt @@ -1,10 +1,11 @@ set(LLVM_TARGET_DEFINITIONS Options.td) tablegen(LLVM Options.inc -gen-opt-parser-defs) -add_public_tablegen_target(MinGWOptionsTableGen) add_lld_library(lldMinGW Driver.cpp + Options.inc + LINK_COMPONENTS Option Support @@ -15,6 +16,5 @@ lldCommon DEPENDS - MinGWOptionsTableGen intrinsics_gen ) diff --git a/lld/wasm/CMakeLists.txt b/lld/wasm/CMakeLists.txt --- a/lld/wasm/CMakeLists.txt +++ b/lld/wasm/CMakeLists.txt @@ -1,6 +1,5 @@ set(LLVM_TARGET_DEFINITIONS Options.td) tablegen(LLVM Options.inc -gen-opt-parser-defs) -add_public_tablegen_target(WasmOptionsTableGen) add_lld_library(lldWasm Driver.cpp @@ -18,6 +17,8 @@ Writer.cpp WriterUtils.cpp + Options.inc + LINK_COMPONENTS ${LLVM_TARGETS_TO_BUILD} BinaryFormat @@ -35,6 +36,5 @@ lldCommon DEPENDS - WasmOptionsTableGen intrinsics_gen ) diff --git a/llvm/lib/ExecutionEngine/JITLink/CMakeLists.txt b/llvm/lib/ExecutionEngine/JITLink/CMakeLists.txt --- a/llvm/lib/ExecutionEngine/JITLink/CMakeLists.txt +++ b/llvm/lib/ExecutionEngine/JITLink/CMakeLists.txt @@ -1,6 +1,5 @@ set(LLVM_TARGET_DEFINITIONS COFFOptions.td) tablegen(LLVM COFFOptions.inc -gen-opt-parser-defs) -add_public_tablegen_target(JITLinkTableGen) add_llvm_component_library(LLVMJITLink DWARFRecordSectionSplitter.cpp @@ -41,12 +40,14 @@ riscv.cpp x86_64.cpp + # Generated header + COFFOptions.inc + ADDITIONAL_HEADER_DIRS ${LLVM_MAIN_INCLUDE_DIR}/llvm/ExecutionEngine/JITLink DEPENDS intrinsics_gen - JITLinkTableGen LINK_COMPONENTS BinaryFormat diff --git a/llvm/lib/ToolDrivers/llvm-dlltool/CMakeLists.txt b/llvm/lib/ToolDrivers/llvm-dlltool/CMakeLists.txt --- a/llvm/lib/ToolDrivers/llvm-dlltool/CMakeLists.txt +++ b/llvm/lib/ToolDrivers/llvm-dlltool/CMakeLists.txt @@ -1,15 +1,14 @@ set(LLVM_TARGET_DEFINITIONS Options.td) tablegen(LLVM Options.inc -gen-opt-parser-defs) -add_public_tablegen_target(DllOptionsTableGen) add_llvm_component_library(LLVMDlltoolDriver DlltoolDriver.cpp + Options.inc + LINK_COMPONENTS Object Option Support TargetParser ) - -add_dependencies(LLVMDlltoolDriver DllOptionsTableGen) diff --git a/llvm/lib/ToolDrivers/llvm-lib/CMakeLists.txt b/llvm/lib/ToolDrivers/llvm-lib/CMakeLists.txt --- a/llvm/lib/ToolDrivers/llvm-lib/CMakeLists.txt +++ b/llvm/lib/ToolDrivers/llvm-lib/CMakeLists.txt @@ -1,10 +1,11 @@ set(LLVM_TARGET_DEFINITIONS Options.td) tablegen(LLVM Options.inc -gen-opt-parser-defs) -add_public_tablegen_target(LibOptionsTableGen) add_llvm_component_library(LLVMLibDriver LibDriver.cpp + Options.inc + DEPENDS intrinsics_gen @@ -16,4 +17,3 @@ Support TargetParser ) -add_dependencies(LLVMLibDriver LibOptionsTableGen) diff --git a/llvm/tools/dsymutil/CMakeLists.txt b/llvm/tools/dsymutil/CMakeLists.txt --- a/llvm/tools/dsymutil/CMakeLists.txt +++ b/llvm/tools/dsymutil/CMakeLists.txt @@ -1,6 +1,5 @@ set(LLVM_TARGET_DEFINITIONS Options.td) tablegen(LLVM Options.inc -gen-opt-parser-defs) -add_public_tablegen_target(DsymutilTableGen) set(LLVM_LINK_COMPONENTS AllTargetsCodeGens @@ -30,9 +29,10 @@ Reproducer.cpp SymbolMap.cpp + Options.inc + DEPENDS intrinsics_gen - DsymutilTableGen ) if(APPLE) diff --git a/llvm/tools/llvm-cvtres/CMakeLists.txt b/llvm/tools/llvm-cvtres/CMakeLists.txt --- a/llvm/tools/llvm-cvtres/CMakeLists.txt +++ b/llvm/tools/llvm-cvtres/CMakeLists.txt @@ -7,8 +7,9 @@ set(LLVM_TARGET_DEFINITIONS Opts.td) tablegen(LLVM Opts.inc -gen-opt-parser-defs) -add_public_tablegen_target(CvtResTableGen) add_llvm_tool(llvm-cvtres llvm-cvtres.cpp + + Opts.inc ) diff --git a/llvm/tools/llvm-cxxfilt/CMakeLists.txt b/llvm/tools/llvm-cxxfilt/CMakeLists.txt --- a/llvm/tools/llvm-cxxfilt/CMakeLists.txt +++ b/llvm/tools/llvm-cxxfilt/CMakeLists.txt @@ -7,13 +7,11 @@ set(LLVM_TARGET_DEFINITIONS Opts.td) tablegen(LLVM Opts.inc -gen-opt-parser-defs) -add_public_tablegen_target(CxxfiltOptsTableGen) add_llvm_tool(llvm-cxxfilt llvm-cxxfilt.cpp - DEPENDS - CxxfiltOptsTableGen + Opts.inc GENERATE_DRIVER ) diff --git a/llvm/tools/llvm-dwarfutil/CMakeLists.txt b/llvm/tools/llvm-dwarfutil/CMakeLists.txt --- a/llvm/tools/llvm-dwarfutil/CMakeLists.txt +++ b/llvm/tools/llvm-dwarfutil/CMakeLists.txt @@ -1,6 +1,5 @@ set(LLVM_TARGET_DEFINITIONS Options.td) tablegen(LLVM Options.inc -gen-opt-parser-defs) -add_public_tablegen_target(DwarfutilTableGen) set(LLVM_LINK_COMPONENTS AllTargetsCodeGens @@ -21,6 +20,8 @@ llvm-dwarfutil.cpp DebugInfoLinker.cpp + Options.inc + DEPENDS intrinsics_gen ) diff --git a/llvm/tools/llvm-ifs/CMakeLists.txt b/llvm/tools/llvm-ifs/CMakeLists.txt --- a/llvm/tools/llvm-ifs/CMakeLists.txt +++ b/llvm/tools/llvm-ifs/CMakeLists.txt @@ -10,14 +10,12 @@ set(LLVM_TARGET_DEFINITIONS Opts.td) tablegen(LLVM Opts.inc -gen-opt-parser-defs) -add_public_tablegen_target(IFSOptsTableGen) add_llvm_tool(llvm-ifs ErrorCollector.cpp llvm-ifs.cpp - DEPENDS - IFSOptsTableGen + Opts.inc GENERATE_DRIVER ) diff --git a/llvm/tools/llvm-lipo/CMakeLists.txt b/llvm/tools/llvm-lipo/CMakeLists.txt --- a/llvm/tools/llvm-lipo/CMakeLists.txt +++ b/llvm/tools/llvm-lipo/CMakeLists.txt @@ -11,13 +11,11 @@ set(LLVM_TARGET_DEFINITIONS LipoOpts.td) tablegen(LLVM LipoOpts.inc -gen-opt-parser-defs) -add_public_tablegen_target(LipoOptsTableGen) add_llvm_tool(llvm-lipo llvm-lipo.cpp - DEPENDS - LipoOptsTableGen + LipoOpts.inc GENERATE_DRIVER ) diff --git a/llvm/tools/llvm-ml/CMakeLists.txt b/llvm/tools/llvm-ml/CMakeLists.txt --- a/llvm/tools/llvm-ml/CMakeLists.txt +++ b/llvm/tools/llvm-ml/CMakeLists.txt @@ -13,9 +13,10 @@ set(LLVM_TARGET_DEFINITIONS Opts.td) tablegen(LLVM Opts.inc -gen-opt-parser-defs) -add_public_tablegen_target(MLTableGen) add_llvm_tool(llvm-ml llvm-ml.cpp Disassembler.cpp + + Opts.inc ) diff --git a/llvm/tools/llvm-mt/CMakeLists.txt b/llvm/tools/llvm-mt/CMakeLists.txt --- a/llvm/tools/llvm-mt/CMakeLists.txt +++ b/llvm/tools/llvm-mt/CMakeLists.txt @@ -6,13 +6,11 @@ set(LLVM_TARGET_DEFINITIONS Opts.td) tablegen(LLVM Opts.inc -gen-opt-parser-defs) -add_public_tablegen_target(MtTableGen) add_llvm_tool(llvm-mt llvm-mt.cpp - DEPENDS - MtTableGen + Opts.inc GENERATE_DRIVER ) diff --git a/llvm/tools/llvm-nm/CMakeLists.txt b/llvm/tools/llvm-nm/CMakeLists.txt --- a/llvm/tools/llvm-nm/CMakeLists.txt +++ b/llvm/tools/llvm-nm/CMakeLists.txt @@ -14,13 +14,13 @@ set(LLVM_TARGET_DEFINITIONS Opts.td) tablegen(LLVM Opts.inc -gen-opt-parser-defs) -add_public_tablegen_target(NmOptsTableGen) add_llvm_tool(llvm-nm llvm-nm.cpp + Opts.inc + DEPENDS - NmOptsTableGen intrinsics_gen GENERATE_DRIVER diff --git a/llvm/tools/llvm-objcopy/CMakeLists.txt b/llvm/tools/llvm-objcopy/CMakeLists.txt --- a/llvm/tools/llvm-objcopy/CMakeLists.txt +++ b/llvm/tools/llvm-objcopy/CMakeLists.txt @@ -10,28 +10,21 @@ set(LLVM_TARGET_DEFINITIONS ObjcopyOpts.td) tablegen(LLVM ObjcopyOpts.inc -gen-opt-parser-defs) -add_public_tablegen_target(ObjcopyOptsTableGen) set(LLVM_TARGET_DEFINITIONS InstallNameToolOpts.td) tablegen(LLVM InstallNameToolOpts.inc -gen-opt-parser-defs) -add_public_tablegen_target(InstallNameToolOptsTableGen) set(LLVM_TARGET_DEFINITIONS BitcodeStripOpts.td) tablegen(LLVM BitcodeStripOpts.inc -gen-opt-parser-defs) -add_public_tablegen_target(BitcodeStripOptsTableGen) set(LLVM_TARGET_DEFINITIONS StripOpts.td) tablegen(LLVM StripOpts.inc -gen-opt-parser-defs) -add_public_tablegen_target(StripOptsTableGen) add_llvm_tool(llvm-objcopy ObjcopyOptions.cpp llvm-objcopy.cpp - DEPENDS - ObjcopyOptsTableGen - InstallNameToolOptsTableGen - StripOptsTableGen + ${TABLEGEN_OUTPUT} GENERATE_DRIVER ) diff --git a/llvm/tools/llvm-objdump/CMakeLists.txt b/llvm/tools/llvm-objdump/CMakeLists.txt --- a/llvm/tools/llvm-objdump/CMakeLists.txt +++ b/llvm/tools/llvm-objdump/CMakeLists.txt @@ -16,11 +16,9 @@ set(LLVM_TARGET_DEFINITIONS ObjdumpOpts.td) tablegen(LLVM ObjdumpOpts.inc -gen-opt-parser-defs) -add_public_tablegen_target(ObjdumpOptsTableGen) set(LLVM_TARGET_DEFINITIONS OtoolOpts.td) tablegen(LLVM OtoolOpts.inc -gen-opt-parser-defs) -add_public_tablegen_target(OtoolOptsTableGen) add_llvm_tool(llvm-objdump llvm-objdump.cpp @@ -32,9 +30,8 @@ WasmDump.cpp XCOFFDump.cpp - DEPENDS - ObjdumpOptsTableGen - OtoolOptsTableGen + ObjdumpOpts.inc + OtoolOpts.inc ) target_link_libraries(llvm-objdump PRIVATE LLVMDebuginfod) diff --git a/llvm/tools/llvm-rc/CMakeLists.txt b/llvm/tools/llvm-rc/CMakeLists.txt --- a/llvm/tools/llvm-rc/CMakeLists.txt +++ b/llvm/tools/llvm-rc/CMakeLists.txt @@ -7,11 +7,9 @@ set(LLVM_TARGET_DEFINITIONS Opts.td) tablegen(LLVM Opts.inc -gen-opt-parser-defs) -add_public_tablegen_target(RcOptsTableGen) set(LLVM_TARGET_DEFINITIONS WindresOpts.td) tablegen(LLVM WindresOpts.inc -gen-opt-parser-defs) -add_public_tablegen_target(WindresOptsTableGen) add_llvm_tool(llvm-rc llvm-rc.cpp @@ -21,8 +19,8 @@ ResourceScriptStmt.cpp ResourceScriptToken.cpp - DEPENDS - WindresOptsTableGen + Opts.inc + WindresOpts.inc GENERATE_DRIVER ) diff --git a/llvm/tools/llvm-readobj/CMakeLists.txt b/llvm/tools/llvm-readobj/CMakeLists.txt --- a/llvm/tools/llvm-readobj/CMakeLists.txt +++ b/llvm/tools/llvm-readobj/CMakeLists.txt @@ -11,7 +11,6 @@ set(LLVM_TARGET_DEFINITIONS Opts.td) tablegen(LLVM Opts.inc -gen-opt-parser-defs) -add_public_tablegen_target(ReadobjOptsTableGen) add_llvm_tool(llvm-readobj ARMWinEHPrinter.cpp @@ -26,8 +25,7 @@ WindowsResourceDumper.cpp XCOFFDumper.cpp - DEPENDS - ReadobjOptsTableGen + Opts.inc GENERATE_DRIVER ) diff --git a/llvm/tools/llvm-size/CMakeLists.txt b/llvm/tools/llvm-size/CMakeLists.txt --- a/llvm/tools/llvm-size/CMakeLists.txt +++ b/llvm/tools/llvm-size/CMakeLists.txt @@ -7,13 +7,11 @@ set(LLVM_TARGET_DEFINITIONS Opts.td) tablegen(LLVM Opts.inc -gen-opt-parser-defs) -add_public_tablegen_target(SizeOptsTableGen) add_llvm_tool(llvm-size llvm-size.cpp - DEPENDS - SizeOptsTableGen + Opts.inc GENERATE_DRIVER ) diff --git a/llvm/tools/llvm-strings/CMakeLists.txt b/llvm/tools/llvm-strings/CMakeLists.txt --- a/llvm/tools/llvm-strings/CMakeLists.txt +++ b/llvm/tools/llvm-strings/CMakeLists.txt @@ -7,13 +7,11 @@ set(LLVM_TARGET_DEFINITIONS Opts.td) tablegen(LLVM Opts.inc -gen-opt-parser-defs) -add_public_tablegen_target(StringsOptsTableGen) add_llvm_tool(llvm-strings llvm-strings.cpp - DEPENDS - StringsOptsTableGen + Opts.inc ) if(LLVM_INSTALL_BINUTILS_SYMLINKS) diff --git a/llvm/tools/llvm-symbolizer/CMakeLists.txt b/llvm/tools/llvm-symbolizer/CMakeLists.txt --- a/llvm/tools/llvm-symbolizer/CMakeLists.txt +++ b/llvm/tools/llvm-symbolizer/CMakeLists.txt @@ -5,7 +5,6 @@ set(LLVM_TARGET_DEFINITIONS Opts.td) tablegen(LLVM Opts.inc -gen-opt-parser-defs) -add_public_tablegen_target(SymbolizerOptsTableGen) set(LLVM_LINK_COMPONENTS Demangle @@ -18,8 +17,7 @@ add_llvm_tool(llvm-symbolizer llvm-symbolizer.cpp - DEPENDS - SymbolizerOptsTableGen + Opts.inc ) target_link_libraries(llvm-symbolizer PRIVATE LLVMDebuginfod) diff --git a/llvm/tools/llvm-tli-checker/CMakeLists.txt b/llvm/tools/llvm-tli-checker/CMakeLists.txt --- a/llvm/tools/llvm-tli-checker/CMakeLists.txt +++ b/llvm/tools/llvm-tli-checker/CMakeLists.txt @@ -17,11 +17,9 @@ set(LLVM_TARGET_DEFINITIONS Opts.td) tablegen(LLVM Opts.inc -gen-opt-parser-defs) -add_public_tablegen_target(TLICheckerOptsTableGen) add_llvm_tool(llvm-tli-checker llvm-tli-checker.cpp - DEPENDS - TLICheckerOptsTableGen + Opts.inc ) diff --git a/llvm/unittests/Option/CMakeLists.txt b/llvm/unittests/Option/CMakeLists.txt --- a/llvm/unittests/Option/CMakeLists.txt +++ b/llvm/unittests/Option/CMakeLists.txt @@ -5,9 +5,10 @@ set(LLVM_TARGET_DEFINITIONS Opts.td) tablegen(LLVM Opts.inc -gen-opt-parser-defs) -add_public_tablegen_target(OptsTestTableGen) add_llvm_unittest(OptionTests OptionParsingTest.cpp OptionMarshallingTest.cpp + + Opts.inc ) diff --git a/llvm/unittests/TableGen/CMakeLists.txt b/llvm/unittests/TableGen/CMakeLists.txt --- a/llvm/unittests/TableGen/CMakeLists.txt +++ b/llvm/unittests/TableGen/CMakeLists.txt @@ -7,12 +7,14 @@ tablegen(LLVM AutomataTables.inc -gen-searchable-tables) tablegen(LLVM AutomataAutomata.inc -gen-automata) -add_public_tablegen_target(AutomataTestTableGen) add_llvm_unittest(TableGenTests DISABLE_LLVM_LINK_LLVM_DYLIB AutomataTest.cpp CodeExpanderTest.cpp ParserEntryPointTest.cpp + + AutomataAutomata.inc + AutomataTables.inc ) target_link_libraries(TableGenTests PRIVATE LLVMTableGenGlobalISel LLVMTableGen)