https://github.com/zero9178 created 
https://github.com/llvm/llvm-project/pull/235796

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

From 0f17edb62559802947f239e2b0b02ea8e6bc3929 Mon Sep 17 00:00:00 2001
From: Markus Boeck <[email protected]>
Date: Mon, 26 Oct 2026 15:05:44 +0000
Subject: [PATCH] [CMake][NFC] Add llvm_tablegen and use it instead of
 tablegen(LLVM ...)

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.
---
 bolt/lib/Target/AArch64/CMakeLists.txt        |  8 +--
 bolt/lib/Target/RISCV/CMakeLists.txt          |  8 +--
 bolt/lib/Target/X86/CMakeLists.txt            |  8 +--
 clang/include/clang/Options/CMakeLists.txt    |  2 +-
 clang/tools/clang-installapi/CMakeLists.txt   |  2 +-
 .../tools/clang-linker-wrapper/CMakeLists.txt |  2 +-
 .../tools/clang-nvlink-wrapper/CMakeLists.txt |  2 +-
 clang/tools/clang-scan-deps/CMakeLists.txt    |  2 +-
 clang/tools/clang-sycl-linker/CMakeLists.txt  |  2 +-
 lld/COFF/CMakeLists.txt                       |  2 +-
 lld/ELF/CMakeLists.txt                        |  2 +-
 lld/MachO/CMakeLists.txt                      |  2 +-
 lld/MinGW/CMakeLists.txt                      |  2 +-
 lld/wasm/CMakeLists.txt                       |  2 +-
 lldb/tools/driver/CMakeLists.txt              |  2 +-
 lldb/tools/lldb-dap/tool/CMakeLists.txt       |  2 +-
 lldb/tools/lldb-server/CMakeLists.txt         |  4 +-
 llvm/cmake/modules/TableGen.cmake             | 54 +++++++++++--------
 llvm/docs/CommandLine.md                      |  2 +-
 llvm/examples/OptSubcommand/CMakeLists.txt    |  2 +-
 llvm/include/llvm/Analysis/CMakeLists.txt     |  2 +-
 llvm/include/llvm/CMakeLists.txt              |  2 +-
 llvm/include/llvm/CodeGen/CMakeLists.txt      |  2 +-
 .../llvm/Frontend/OpenACC/CMakeLists.txt      |  4 +-
 .../llvm/Frontend/OpenMP/CMakeLists.txt       |  4 +-
 llvm/include/llvm/IR/CMakeLists.txt           | 46 ++++++++--------
 llvm/include/llvm/TargetParser/CMakeLists.txt | 10 ++--
 llvm/lib/CGData/CMakeLists.txt                |  2 +-
 llvm/lib/CodeGen/CMakeLists.txt               |  2 +-
 .../ExecutionEngine/JITLink/CMakeLists.txt    |  2 +-
 llvm/lib/IR/CMakeLists.txt                    |  2 +-
 llvm/lib/MC/CMakeLists.txt                    |  2 +-
 llvm/lib/Passes/CMakeLists.txt                |  2 +-
 llvm/lib/Target/AArch64/CMakeLists.txt        | 46 ++++++++--------
 llvm/lib/Target/AMDGPU/CMakeLists.txt         | 50 ++++++++---------
 llvm/lib/Target/ARC/CMakeLists.txt            | 16 +++---
 llvm/lib/Target/ARM/CMakeLists.txt            | 32 +++++------
 llvm/lib/Target/AVR/CMakeLists.txt            | 20 +++----
 llvm/lib/Target/BPF/CMakeLists.txt            | 24 ++++-----
 llvm/lib/Target/CSKY/CMakeLists.txt           | 26 ++++-----
 llvm/lib/Target/DirectX/CMakeLists.txt        |  8 +--
 llvm/lib/Target/Hexagon/CMakeLists.txt        | 22 ++++----
 llvm/lib/Target/Lanai/CMakeLists.txt          | 22 ++++----
 llvm/lib/Target/LoongArch/CMakeLists.txt      | 20 +++----
 llvm/lib/Target/M68k/CMakeLists.txt           | 26 ++++-----
 llvm/lib/Target/MSP430/CMakeLists.txt         | 22 ++++----
 llvm/lib/Target/Mips/CMakeLists.txt           | 36 ++++++-------
 llvm/lib/Target/NVPTX/CMakeLists.txt          | 12 ++---
 llvm/lib/Target/PowerPC/CMakeLists.txt        | 28 +++++-----
 llvm/lib/Target/RISCV/CMakeLists.txt          | 42 +++++++--------
 llvm/lib/Target/SPIRV/CMakeLists.txt          | 18 +++----
 llvm/lib/Target/Sparc/CMakeLists.txt          | 24 ++++-----
 llvm/lib/Target/SystemZ/CMakeLists.txt        | 24 ++++-----
 llvm/lib/Target/VE/CMakeLists.txt             | 20 +++----
 llvm/lib/Target/WebAssembly/CMakeLists.txt    | 28 +++++-----
 llvm/lib/Target/X86/CMakeLists.txt            | 42 +++++++--------
 llvm/lib/Target/XCore/CMakeLists.txt          | 18 +++----
 llvm/lib/Target/Xtensa/CMakeLists.txt         | 20 +++----
 .../ToolDrivers/llvm-dlltool/CMakeLists.txt   |  2 +-
 llvm/lib/ToolDrivers/llvm-lib/CMakeLists.txt  |  2 +-
 .../lib/Transforms/InstCombine/CMakeLists.txt |  2 +-
 .../Transforms/Instrumentation/CMakeLists.txt |  2 +-
 llvm/lib/Transforms/Scalar/CMakeLists.txt     |  2 +-
 llvm/lib/Transforms/Vectorize/CMakeLists.txt  |  2 +-
 llvm/tools/dsymutil/CMakeLists.txt            |  2 +-
 llvm/tools/llvm-cas/CMakeLists.txt            |  2 +-
 llvm/tools/llvm-cgdata/CMakeLists.txt         |  2 +-
 llvm/tools/llvm-cov/CMakeLists.txt            |  2 +-
 llvm/tools/llvm-cvtres/CMakeLists.txt         |  2 +-
 llvm/tools/llvm-cxxfilt/CMakeLists.txt        |  2 +-
 .../tools/llvm-debuginfod-find/CMakeLists.txt |  2 +-
 llvm/tools/llvm-debuginfod/CMakeLists.txt     |  2 +-
 llvm/tools/llvm-dwarfutil/CMakeLists.txt      |  2 +-
 llvm/tools/llvm-dwp/CMakeLists.txt            |  2 +-
 llvm/tools/llvm-gsymutil/CMakeLists.txt       |  2 +-
 llvm/tools/llvm-ifs/CMakeLists.txt            |  2 +-
 llvm/tools/llvm-libtool-darwin/CMakeLists.txt |  2 +-
 llvm/tools/llvm-lipo/CMakeLists.txt           |  2 +-
 llvm/tools/llvm-ml/CMakeLists.txt             |  2 +-
 llvm/tools/llvm-mt/CMakeLists.txt             |  2 +-
 llvm/tools/llvm-nm/CMakeLists.txt             |  2 +-
 llvm/tools/llvm-objcopy/CMakeLists.txt        | 10 ++--
 llvm/tools/llvm-objdump/CMakeLists.txt        |  4 +-
 llvm/tools/llvm-rc/CMakeLists.txt             |  4 +-
 llvm/tools/llvm-readobj/CMakeLists.txt        |  2 +-
 llvm/tools/llvm-readtapi/CMakeLists.txt       |  2 +-
 llvm/tools/llvm-size/CMakeLists.txt           |  2 +-
 llvm/tools/llvm-strings/CMakeLists.txt        |  2 +-
 llvm/tools/llvm-symbolizer/CMakeLists.txt     |  2 +-
 llvm/tools/llvm-tli-checker/CMakeLists.txt    |  2 +-
 llvm/tools/obj2yaml/CMakeLists.txt            |  2 +-
 llvm/tools/sancov/CMakeLists.txt              |  2 +-
 llvm/tools/yaml2obj/CMakeLists.txt            |  2 +-
 llvm/unittests/Option/CMakeLists.txt          |  6 +--
 llvm/unittests/TableGen/CMakeLists.txt        |  4 +-
 llvm/utils/split-file/CMakeLists.txt          |  2 +-
 96 files changed, 471 insertions(+), 463 deletions(-)

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-enums)
+llvm_tablegen(IntrinsicsAArch64.h -gen-intrinsic-enums 
-intrinsic-prefix=aarch64)
+llvm_tablegen(IntrinsicsAMDGPU.h -gen-intrinsic-enums -intrinsic-prefix=amdgcn)
+llvm_tablegen(IntrinsicsARM.h -gen-intrinsic-enums -intrinsic-prefix=arm)
+llvm_tablegen(IntrinsicsAVR.h -gen-intrinsic-enums -intrinsic-prefix=avr)
+llvm_tablegen(IntrinsicsBPF.h -gen-intrinsic-enums -intrinsic-prefix=bpf)
+llvm_tablegen(IntrinsicsDirectX.h -gen-intrinsic-enums -intrinsic-prefix=dx)
+llvm_tablegen(IntrinsicsHexagon.h -gen-intrinsic-enums 
-intrinsic-prefix=hexagon)
+llvm_tablegen(IntrinsicsLoongArch.h -gen-intrinsic-enums 
-intrinsic-prefix=loongarch)
+llvm_tablegen(IntrinsicsMips.h -gen-intrinsic-enums -intrinsic-prefix=mips)
+llvm_tablegen(IntrinsicsNVPTX.h -gen-intrinsic-enums -intrinsic-prefix=nvvm)
+llvm_tablegen(IntrinsicsPowerPC.h -gen-intrinsic-enums -intrinsic-prefix=ppc)
+llvm_tablegen(IntrinsicsR600.h -gen-intrinsic-enums -intrinsic-prefix=r600)
+llvm_tablegen(IntrinsicsRISCV.h -gen-intrinsic-enums -intrinsic-prefix=riscv)
+llvm_tablegen(IntrinsicsSPIRV.h -gen-intrinsic-enums -intrinsic-prefix=spv)
+llvm_tablegen(IntrinsicsS390.h -gen-intrinsic-enums -intrinsic-prefix=s390)
+llvm_tablegen(IntrinsicsWebAssembly.h -gen-intrinsic-enums 
-intrinsic-prefix=wasm)
+llvm_tablegen(IntrinsicsX86.h -gen-intrinsic-enums -intrinsic-prefix=x86)
+llvm_tablegen(IntrinsicsXCore.h -gen-intrinsic-enums -intrinsic-prefix=xcore)
+llvm_tablegen(IntrinsicsVE.h -gen-intrinsic-enums -intrinsic-prefix=ve)
 add_public_tablegen_target(intrinsics_gen)
diff --git a/llvm/include/llvm/TargetParser/CMakeLists.txt 
b/llvm/include/llvm/TargetParser/CMakeLists.txt
index 1ca79b7a365f05..527fbca1fec6a1 100644
--- a/llvm/include/llvm/TargetParser/CMakeLists.txt
+++ b/llvm/include/llvm/TargetParser/CMakeLists.txt
@@ -1,17 +1,17 @@
 set(LLVM_TARGET_DEFINITIONS 
${PROJECT_SOURCE_DIR}/lib/Target/AArch64/AArch64TargetParserDef.td)
-tablegen(LLVM AArch64TargetParserDef.inc -gen-arm-target-def EXTRA_INCLUDES 
${PROJECT_SOURCE_DIR}/lib/Target/AArch64)
+llvm_tablegen(AArch64TargetParserDef.inc -gen-arm-target-def EXTRA_INCLUDES 
${PROJECT_SOURCE_DIR}/lib/Target/AArch64)
 
 set(LLVM_TARGET_DEFINITIONS ${PROJECT_SOURCE_DIR}/lib/Target/RISCV/RISCV.td)
-tablegen(LLVM RISCVTargetParserDef.inc -gen-riscv-target-def EXTRA_INCLUDES 
${PROJECT_SOURCE_DIR}/lib/Target/RISCV)
+llvm_tablegen(RISCVTargetParserDef.inc -gen-riscv-target-def EXTRA_INCLUDES 
${PROJECT_SOURCE_DIR}/lib/Target/RISCV)
 
 set(LLVM_TARGET_DEFINITIONS 
${PROJECT_SOURCE_DIR}/lib/Target/PowerPC/PPCTargetParserDef.td)
-tablegen(LLVM PPCGenTargetFeatures.inc -gen-target-features EXTRA_INCLUDES 
${PROJECT_SOURCE_DIR}/lib/Target/PowerPC)
+llvm_tablegen(PPCGenTargetFeatures.inc -gen-target-features EXTRA_INCLUDES 
${PROJECT_SOURCE_DIR}/lib/Target/PowerPC)
 
 set(LLVM_TARGET_DEFINITIONS 
${PROJECT_SOURCE_DIR}/lib/Target/AMDGPU/R600TargetParserDef.td)
-tablegen(LLVM R600TargetParserDef.inc -gen-amdgpu-target-def EXTRA_INCLUDES 
${PROJECT_SOURCE_DIR}/lib/Target/AMDGPU)
+llvm_tablegen(R600TargetParserDef.inc -gen-amdgpu-target-def EXTRA_INCLUDES 
${PROJECT_SOURCE_DIR}/lib/Target/AMDGPU)
 
 set(LLVM_TARGET_DEFINITIONS 
${PROJECT_SOURCE_DIR}/lib/Target/AMDGPU/AMDGPUTargetParserDef.td)
-tablegen(LLVM AMDGPUTargetParserDef.inc -gen-amdgpu-target-def EXTRA_INCLUDES 
${PROJECT_SOURCE_DIR}/lib/Target/AMDGPU)
+llvm_tablegen(AMDGPUTargetParserDef.inc -gen-amdgpu-target-def EXTRA_INCLUDES 
${PROJECT_SOURCE_DIR}/lib/Target/AMDGPU)
 
 # This covers all of the tablegen calls above.
 add_public_tablegen_target(target_parser_gen)
diff --git a/llvm/lib/CGData/CMakeLists.txt b/llvm/lib/CGData/CMakeLists.txt
index e01c2c7f2391d6..03e360dd7bb888 100644
--- a/llvm/lib/CGData/CMakeLists.txt
+++ b/llvm/lib/CGData/CMakeLists.txt
@@ -1,6 +1,6 @@
 set(LLVM_TABLEGEN_PROJECT LLVM_HEADERS)
 set(LLVM_TARGET_DEFINITIONS CGDataOptions.td)
-tablegen(LLVM CGDataOptions.inc -gen-opt-parser-defs)
+llvm_tablegen(CGDataOptions.inc -gen-opt-parser-defs)
 add_public_tablegen_target(CGDataOptionsTableGen)
 
 add_llvm_component_library(LLVMCGData
diff --git a/llvm/lib/CodeGen/CMakeLists.txt b/llvm/lib/CodeGen/CMakeLists.txt
index c0078f2b4e86ab..3af45f8ce89cb1 100644
--- a/llvm/lib/CodeGen/CMakeLists.txt
+++ b/llvm/lib/CodeGen/CMakeLists.txt
@@ -36,7 +36,7 @@ endif()
 
 set(LLVM_TABLEGEN_PROJECT LLVM_HEADERS)
 set(LLVM_TARGET_DEFINITIONS CodeGenOptions.td)
-tablegen(LLVM CodeGenOptions.inc -gen-opt-parser-defs)
+llvm_tablegen(CodeGenOptions.inc -gen-opt-parser-defs)
 add_public_tablegen_target(CodeGenOptionsTableGen)
 
 add_llvm_component_library(LLVMCodeGen
diff --git a/llvm/lib/ExecutionEngine/JITLink/CMakeLists.txt 
b/llvm/lib/ExecutionEngine/JITLink/CMakeLists.txt
index 8162d8ee18ec54..316fbb576f675a 100644
--- a/llvm/lib/ExecutionEngine/JITLink/CMakeLists.txt
+++ b/llvm/lib/ExecutionEngine/JITLink/CMakeLists.txt
@@ -1,5 +1,5 @@
 set(LLVM_TARGET_DEFINITIONS COFFOptions.td)
-tablegen(LLVM COFFOptions.inc -gen-opt-parser-defs)
+llvm_tablegen(COFFOptions.inc -gen-opt-parser-defs)
 add_public_tablegen_target(JITLinkTableGen)
 
 add_llvm_component_library(LLVMJITLink
diff --git a/llvm/lib/IR/CMakeLists.txt b/llvm/lib/IR/CMakeLists.txt
index 4a1f0a827a9b6d..5abc00d9f6e35f 100644
--- a/llvm/lib/IR/CMakeLists.txt
+++ b/llvm/lib/IR/CMakeLists.txt
@@ -1,6 +1,6 @@
 set(LLVM_TABLEGEN_PROJECT LLVM_HEADERS)
 set(LLVM_TARGET_DEFINITIONS IROptions.td)
-tablegen(LLVM IROptions.inc -gen-opt-parser-defs)
+llvm_tablegen(IROptions.inc -gen-opt-parser-defs)
 add_public_tablegen_target(IROptionsTableGen)
 
 add_llvm_component_library(LLVMCore
diff --git a/llvm/lib/MC/CMakeLists.txt b/llvm/lib/MC/CMakeLists.txt
index 2ef414d62bc50a..5c2fda10ca28cb 100644
--- a/llvm/lib/MC/CMakeLists.txt
+++ b/llvm/lib/MC/CMakeLists.txt
@@ -1,6 +1,6 @@
 set(LLVM_TABLEGEN_PROJECT LLVM_HEADERS)
 set(LLVM_TARGET_DEFINITIONS MCCLOptions.td)
-tablegen(LLVM MCCLOptions.inc -gen-opt-parser-defs)
+llvm_tablegen(MCCLOptions.inc -gen-opt-parser-defs)
 add_public_tablegen_target(MCCLOptionsTableGen)
 
 add_llvm_component_library(LLVMMC
diff --git a/llvm/lib/Passes/CMakeLists.txt b/llvm/lib/Passes/CMakeLists.txt
index e4abb96cfd23b1..668e8c7e636a5e 100644
--- a/llvm/lib/Passes/CMakeLists.txt
+++ b/llvm/lib/Passes/CMakeLists.txt
@@ -1,6 +1,6 @@
 set(LLVM_TABLEGEN_PROJECT LLVM_HEADERS)
 set(LLVM_TARGET_DEFINITIONS PassesOptions.td)
-tablegen(LLVM PassesOptions.inc -gen-opt-parser-defs)
+llvm_tablegen(PassesOptions.inc -gen-opt-parser-defs)
 add_public_tablegen_target(PassesOptionsTableGen)
 
 add_llvm_component_library(LLVMPasses
diff --git a/llvm/lib/Target/AArch64/CMakeLists.txt 
b/llvm/lib/Target/AArch64/CMakeLists.txt
index f1f42aae78b2cc..14b6f59da5a66b 100644
--- a/llvm/lib/Target/AArch64/CMakeLists.txt
+++ b/llvm/lib/Target/AArch64/CMakeLists.txt
@@ -2,37 +2,37 @@ add_llvm_component_group(AArch64 HAS_JIT)
 
 set(LLVM_TARGET_DEFINITIONS AArch64.td)
 
-tablegen(LLVM AArch64GenAsmMatcher.inc -gen-asm-matcher)
-tablegen(LLVM AArch64GenAsmWriter.inc -gen-asm-writer)
-tablegen(LLVM AArch64GenAsmWriter1.inc -gen-asm-writer -asmwriternum=1)
-tablegen(LLVM AArch64GenCallingConv.inc -gen-callingconv)
-tablegen(LLVM AArch64GenDAGISel.inc -gen-dag-isel)
-tablegen(LLVM AArch64GenDisassemblerTables.inc -gen-disassembler)
-tablegen(LLVM AArch64GenFastISel.inc -gen-fast-isel)
-tablegen(LLVM AArch64GenGlobalISel.inc -gen-global-isel -gisel-extended-llt)
-tablegen(LLVM AArch64GenO0PreLegalizeGICombiner.inc -gen-global-isel-combiner
+llvm_tablegen(AArch64GenAsmMatcher.inc -gen-asm-matcher)
+llvm_tablegen(AArch64GenAsmWriter.inc -gen-asm-writer)
+llvm_tablegen(AArch64GenAsmWriter1.inc -gen-asm-writer -asmwriternum=1)
+llvm_tablegen(AArch64GenCallingConv.inc -gen-callingconv)
+llvm_tablegen(AArch64GenDAGISel.inc -gen-dag-isel)
+llvm_tablegen(AArch64GenDisassemblerTables.inc -gen-disassembler)
+llvm_tablegen(AArch64GenFastISel.inc -gen-fast-isel)
+llvm_tablegen(AArch64GenGlobalISel.inc -gen-global-isel -gisel-extended-llt)
+llvm_tablegen(AArch64GenO0PreLegalizeGICombiner.inc -gen-global-isel-combiner
               -combiners="AArch64O0PreLegalizerCombiner")
-tablegen(LLVM AArch64GenPreLegalizeGICombiner.inc -gen-global-isel-combiner
+llvm_tablegen(AArch64GenPreLegalizeGICombiner.inc -gen-global-isel-combiner
               -combiners="AArch64PreLegalizerCombiner")
-tablegen(LLVM AArch64GenPostLegalizeGICombiner.inc -gen-global-isel-combiner
+llvm_tablegen(AArch64GenPostLegalizeGICombiner.inc -gen-global-isel-combiner
               -combiners="AArch64PostLegalizerCombiner")
-tablegen(LLVM AArch64GenPostLegalizeGILowering.inc -gen-global-isel-combiner
+llvm_tablegen(AArch64GenPostLegalizeGILowering.inc -gen-global-isel-combiner
               -combiners="AArch64PostLegalizerLowering")
-tablegen(LLVM AArch64GenInstrInfo.inc -gen-instr-info)
-tablegen(LLVM AArch64GenMCCodeEmitter.inc -gen-emitter)
-tablegen(LLVM AArch64GenMCPseudoLowering.inc -gen-pseudo-lowering)
-tablegen(LLVM AArch64GenRegisterBank.inc -gen-register-bank)
-tablegen(LLVM AArch64GenRegisterInfo.inc -gen-register-info)
-tablegen(LLVM AArch64GenSDNodeInfo.inc -gen-sd-node-info)
-tablegen(LLVM AArch64GenSubtargetInfo.inc -gen-subtarget)
-tablegen(LLVM AArch64GenSystemOperands.inc -gen-searchable-tables)
-tablegen(LLVM AArch64GenExegesis.inc -gen-exegesis)
+llvm_tablegen(AArch64GenInstrInfo.inc -gen-instr-info)
+llvm_tablegen(AArch64GenMCCodeEmitter.inc -gen-emitter)
+llvm_tablegen(AArch64GenMCPseudoLowering.inc -gen-pseudo-lowering)
+llvm_tablegen(AArch64GenRegisterBank.inc -gen-register-bank)
+llvm_tablegen(AArch64GenRegisterInfo.inc -gen-register-info)
+llvm_tablegen(AArch64GenSDNodeInfo.inc -gen-sd-node-info)
+llvm_tablegen(AArch64GenSubtargetInfo.inc -gen-subtarget)
+llvm_tablegen(AArch64GenSystemOperands.inc -gen-searchable-tables)
+llvm_tablegen(AArch64GenExegesis.inc -gen-exegesis)
 
 set(LLVM_TARGET_DEFINITIONS AArch64Options.td)
-tablegen(LLVM AArch64Options.inc -gen-opt-parser-defs)
+llvm_tablegen(AArch64Options.inc -gen-opt-parser-defs)
 
 set(LLVM_TARGET_DEFINITIONS MCTargetDesc/AArch64MCOptions.td)
-tablegen(LLVM AArch64MCOptions.inc -gen-opt-parser-defs)
+llvm_tablegen(AArch64MCOptions.inc -gen-opt-parser-defs)
 
 add_public_tablegen_target(AArch64CommonTableGen)
 
diff --git a/llvm/lib/Target/AMDGPU/CMakeLists.txt 
b/llvm/lib/Target/AMDGPU/CMakeLists.txt
index b6c5f63379344c..a188c691c29d12 100644
--- a/llvm/lib/Target/AMDGPU/CMakeLists.txt
+++ b/llvm/lib/Target/AMDGPU/CMakeLists.txt
@@ -2,41 +2,41 @@ add_llvm_component_group(AMDGPU)
 
 set(LLVM_TARGET_DEFINITIONS AMDGPU.td)
 
-tablegen(LLVM AMDGPUGenAsmMatcher.inc -gen-asm-matcher)
-tablegen(LLVM AMDGPUGenAsmWriter.inc -gen-asm-writer)
-tablegen(LLVM AMDGPUGenCallingConv.inc -gen-callingconv)
-tablegen(LLVM AMDGPUGenDAGISel.inc -gen-dag-isel)
-tablegen(LLVM AMDGPUGenDisassemblerTables.inc -gen-disassembler
+llvm_tablegen(AMDGPUGenAsmMatcher.inc -gen-asm-matcher)
+llvm_tablegen(AMDGPUGenAsmWriter.inc -gen-asm-writer)
+llvm_tablegen(AMDGPUGenCallingConv.inc -gen-callingconv)
+llvm_tablegen(AMDGPUGenDAGISel.inc -gen-dag-isel)
+llvm_tablegen(AMDGPUGenDisassemblerTables.inc -gen-disassembler
               --specialize-decoders-per-bitwidth
               -ignore-non-decodable-operands
               -ignore-fully-defined-operands)
-tablegen(LLVM AMDGPUGenInstrInfo.inc -gen-instr-info)
-tablegen(LLVM AMDGPUGenMCCodeEmitter.inc -gen-emitter)
-tablegen(LLVM AMDGPUGenMCPseudoLowering.inc -gen-pseudo-lowering)
-tablegen(LLVM AMDGPUGenRegisterBank.inc -gen-register-bank)
-tablegen(LLVM AMDGPUGenRegisterInfo.inc -gen-register-info)
-tablegen(LLVM AMDGPUGenSDNodeInfo.inc -gen-sd-node-info)
-tablegen(LLVM AMDGPUGenSearchableTables.inc -gen-searchable-tables)
-tablegen(LLVM AMDGPUGenSubtargetInfo.inc -gen-subtarget)
+llvm_tablegen(AMDGPUGenInstrInfo.inc -gen-instr-info)
+llvm_tablegen(AMDGPUGenMCCodeEmitter.inc -gen-emitter)
+llvm_tablegen(AMDGPUGenMCPseudoLowering.inc -gen-pseudo-lowering)
+llvm_tablegen(AMDGPUGenRegisterBank.inc -gen-register-bank)
+llvm_tablegen(AMDGPUGenRegisterInfo.inc -gen-register-info)
+llvm_tablegen(AMDGPUGenSDNodeInfo.inc -gen-sd-node-info)
+llvm_tablegen(AMDGPUGenSearchableTables.inc -gen-searchable-tables)
+llvm_tablegen(AMDGPUGenSubtargetInfo.inc -gen-subtarget)
 
 set(LLVM_TARGET_DEFINITIONS AMDGPUGISel.td)
-tablegen(LLVM AMDGPUGenGlobalISel.inc -gen-global-isel -gisel-extended-llt)
-tablegen(LLVM AMDGPUGenPreLegalizeGICombiner.inc -gen-global-isel-combiner
+llvm_tablegen(AMDGPUGenGlobalISel.inc -gen-global-isel -gisel-extended-llt)
+llvm_tablegen(AMDGPUGenPreLegalizeGICombiner.inc -gen-global-isel-combiner
               -combiners="AMDGPUPreLegalizerCombiner" -gisel-extended-llt)
-tablegen(LLVM AMDGPUGenPostLegalizeGICombiner.inc -gen-global-isel-combiner
+llvm_tablegen(AMDGPUGenPostLegalizeGICombiner.inc -gen-global-isel-combiner
               -combiners="AMDGPUPostLegalizerCombiner" -gisel-extended-llt)
-tablegen(LLVM AMDGPUGenRegBankGICombiner.inc -gen-global-isel-combiner
+llvm_tablegen(AMDGPUGenRegBankGICombiner.inc -gen-global-isel-combiner
               -combiners="AMDGPURegBankCombiner" -gisel-extended-llt)
 
 set(LLVM_TARGET_DEFINITIONS R600.td)
-tablegen(LLVM R600GenAsmWriter.inc -gen-asm-writer)
-tablegen(LLVM R600GenCallingConv.inc -gen-callingconv)
-tablegen(LLVM R600GenDAGISel.inc -gen-dag-isel)
-tablegen(LLVM R600GenDFAPacketizer.inc -gen-dfa-packetizer)
-tablegen(LLVM R600GenInstrInfo.inc -gen-instr-info)
-tablegen(LLVM R600GenMCCodeEmitter.inc -gen-emitter)
-tablegen(LLVM R600GenRegisterInfo.inc -gen-register-info)
-tablegen(LLVM R600GenSubtargetInfo.inc -gen-subtarget)
+llvm_tablegen(R600GenAsmWriter.inc -gen-asm-writer)
+llvm_tablegen(R600GenCallingConv.inc -gen-callingconv)
+llvm_tablegen(R600GenDAGISel.inc -gen-dag-isel)
+llvm_tablegen(R600GenDFAPacketizer.inc -gen-dfa-packetizer)
+llvm_tablegen(R600GenInstrInfo.inc -gen-instr-info)
+llvm_tablegen(R600GenMCCodeEmitter.inc -gen-emitter)
+llvm_tablegen(R600GenRegisterInfo.inc -gen-register-info)
+llvm_tablegen(R600GenSubtargetInfo.inc -gen-subtarget)
 
 add_public_tablegen_target(AMDGPUCommonTableGen)
 
diff --git a/llvm/lib/Target/ARC/CMakeLists.txt 
b/llvm/lib/Target/ARC/CMakeLists.txt
index 196cc31cc50802..f889700475902e 100644
--- a/llvm/lib/Target/ARC/CMakeLists.txt
+++ b/llvm/lib/Target/ARC/CMakeLists.txt
@@ -2,14 +2,14 @@ add_llvm_component_group(ARC)
 
 set(LLVM_TARGET_DEFINITIONS ARC.td)
 
-tablegen(LLVM ARCGenAsmWriter.inc -gen-asm-writer)
-tablegen(LLVM ARCGenCallingConv.inc -gen-callingconv)
-tablegen(LLVM ARCGenDAGISel.inc -gen-dag-isel)
-tablegen(LLVM ARCGenDisassemblerTables.inc -gen-disassembler)
-tablegen(LLVM ARCGenInstrInfo.inc -gen-instr-info)
-tablegen(LLVM ARCGenRegisterInfo.inc -gen-register-info)
-tablegen(LLVM ARCGenSDNodeInfo.inc -gen-sd-node-info)
-tablegen(LLVM ARCGenSubtargetInfo.inc -gen-subtarget)
+llvm_tablegen(ARCGenAsmWriter.inc -gen-asm-writer)
+llvm_tablegen(ARCGenCallingConv.inc -gen-callingconv)
+llvm_tablegen(ARCGenDAGISel.inc -gen-dag-isel)
+llvm_tablegen(ARCGenDisassemblerTables.inc -gen-disassembler)
+llvm_tablegen(ARCGenInstrInfo.inc -gen-instr-info)
+llvm_tablegen(ARCGenRegisterInfo.inc -gen-register-info)
+llvm_tablegen(ARCGenSDNodeInfo.inc -gen-sd-node-info)
+llvm_tablegen(ARCGenSubtargetInfo.inc -gen-subtarget)
 
 add_public_tablegen_target(ARCCommonTableGen)
 
diff --git a/llvm/lib/Target/ARM/CMakeLists.txt 
b/llvm/lib/Target/ARM/CMakeLists.txt
index 7b76f5f4d14241..62d8bb51fc5b08 100644
--- a/llvm/lib/Target/ARM/CMakeLists.txt
+++ b/llvm/lib/Target/ARM/CMakeLists.txt
@@ -2,22 +2,22 @@ add_llvm_component_group(ARM HAS_JIT)
 
 set(LLVM_TARGET_DEFINITIONS ARM.td)
 
-tablegen(LLVM ARMGenAsmMatcher.inc -gen-asm-matcher)
-tablegen(LLVM ARMGenAsmWriter.inc -gen-asm-writer)
-tablegen(LLVM ARMGenCallingConv.inc -gen-callingconv)
-tablegen(LLVM ARMGenDAGISel.inc -gen-dag-isel)
-tablegen(LLVM ARMGenDisassemblerTables.inc -gen-disassembler)
-tablegen(LLVM ARMGenFastISel.inc -gen-fast-isel)
-tablegen(LLVM ARMGenGlobalISel.inc -gen-global-isel)
-tablegen(LLVM ARMGenInstrInfo.inc -gen-instr-info)
-tablegen(LLVM ARMGenMCCodeEmitter.inc -gen-emitter)
-tablegen(LLVM ARMGenMCPseudoLowering.inc -gen-pseudo-lowering)
-tablegen(LLVM ARMGenRegisterBank.inc -gen-register-bank)
-tablegen(LLVM ARMGenRegisterInfo.inc -gen-register-info)
-tablegen(LLVM ARMGenSDNodeInfo.inc -gen-sd-node-info)
-tablegen(LLVM ARMGenSubtargetInfo.inc -gen-subtarget)
-tablegen(LLVM ARMGenSystemRegister.inc -gen-searchable-tables)
-tablegen(LLVM ARMGenTargetDef.inc -gen-arm-target-def)
+llvm_tablegen(ARMGenAsmMatcher.inc -gen-asm-matcher)
+llvm_tablegen(ARMGenAsmWriter.inc -gen-asm-writer)
+llvm_tablegen(ARMGenCallingConv.inc -gen-callingconv)
+llvm_tablegen(ARMGenDAGISel.inc -gen-dag-isel)
+llvm_tablegen(ARMGenDisassemblerTables.inc -gen-disassembler)
+llvm_tablegen(ARMGenFastISel.inc -gen-fast-isel)
+llvm_tablegen(ARMGenGlobalISel.inc -gen-global-isel)
+llvm_tablegen(ARMGenInstrInfo.inc -gen-instr-info)
+llvm_tablegen(ARMGenMCCodeEmitter.inc -gen-emitter)
+llvm_tablegen(ARMGenMCPseudoLowering.inc -gen-pseudo-lowering)
+llvm_tablegen(ARMGenRegisterBank.inc -gen-register-bank)
+llvm_tablegen(ARMGenRegisterInfo.inc -gen-register-info)
+llvm_tablegen(ARMGenSDNodeInfo.inc -gen-sd-node-info)
+llvm_tablegen(ARMGenSubtargetInfo.inc -gen-subtarget)
+llvm_tablegen(ARMGenSystemRegister.inc -gen-searchable-tables)
+llvm_tablegen(ARMGenTargetDef.inc -gen-arm-target-def)
 
 add_public_tablegen_target(ARMCommonTableGen)
 
diff --git a/llvm/lib/Target/AVR/CMakeLists.txt 
b/llvm/lib/Target/AVR/CMakeLists.txt
index a31c545f48ba38..1375c487e3ed09 100644
--- a/llvm/lib/Target/AVR/CMakeLists.txt
+++ b/llvm/lib/Target/AVR/CMakeLists.txt
@@ -2,16 +2,16 @@ add_llvm_component_group(AVR)
 
 set(LLVM_TARGET_DEFINITIONS AVR.td)
 
-tablegen(LLVM AVRGenAsmMatcher.inc -gen-asm-matcher)
-tablegen(LLVM AVRGenAsmWriter.inc -gen-asm-writer)
-tablegen(LLVM AVRGenCallingConv.inc -gen-callingconv)
-tablegen(LLVM AVRGenDAGISel.inc -gen-dag-isel)
-tablegen(LLVM AVRGenDisassemblerTables.inc -gen-disassembler)
-tablegen(LLVM AVRGenInstrInfo.inc -gen-instr-info)
-tablegen(LLVM AVRGenMCCodeEmitter.inc -gen-emitter)
-tablegen(LLVM AVRGenRegisterInfo.inc -gen-register-info)
-tablegen(LLVM AVRGenSDNodeInfo.inc -gen-sd-node-info)
-tablegen(LLVM AVRGenSubtargetInfo.inc -gen-subtarget)
+llvm_tablegen(AVRGenAsmMatcher.inc -gen-asm-matcher)
+llvm_tablegen(AVRGenAsmWriter.inc -gen-asm-writer)
+llvm_tablegen(AVRGenCallingConv.inc -gen-callingconv)
+llvm_tablegen(AVRGenDAGISel.inc -gen-dag-isel)
+llvm_tablegen(AVRGenDisassemblerTables.inc -gen-disassembler)
+llvm_tablegen(AVRGenInstrInfo.inc -gen-instr-info)
+llvm_tablegen(AVRGenMCCodeEmitter.inc -gen-emitter)
+llvm_tablegen(AVRGenRegisterInfo.inc -gen-register-info)
+llvm_tablegen(AVRGenSDNodeInfo.inc -gen-sd-node-info)
+llvm_tablegen(AVRGenSubtargetInfo.inc -gen-subtarget)
 
 add_public_tablegen_target(AVRCommonTableGen)
 
diff --git a/llvm/lib/Target/BPF/CMakeLists.txt 
b/llvm/lib/Target/BPF/CMakeLists.txt
index 94e0a059abc1bd..c45d5cc1bf13d6 100644
--- a/llvm/lib/Target/BPF/CMakeLists.txt
+++ b/llvm/lib/Target/BPF/CMakeLists.txt
@@ -2,18 +2,18 @@ add_llvm_component_group(BPF)
 
 set(LLVM_TARGET_DEFINITIONS BPF.td)
 
-tablegen(LLVM BPFGenAsmMatcher.inc -gen-asm-matcher)
-tablegen(LLVM BPFGenAsmWriter.inc -gen-asm-writer)
-tablegen(LLVM BPFGenCallingConv.inc -gen-callingconv)
-tablegen(LLVM BPFGenDAGISel.inc -gen-dag-isel)
-tablegen(LLVM BPFGenDisassemblerTables.inc -gen-disassembler)
-tablegen(LLVM BPFGenInstrInfo.inc -gen-instr-info)
-tablegen(LLVM BPFGenMCCodeEmitter.inc -gen-emitter)
-tablegen(LLVM BPFGenRegisterInfo.inc -gen-register-info)
-tablegen(LLVM BPFGenSDNodeInfo.inc -gen-sd-node-info)
-tablegen(LLVM BPFGenSubtargetInfo.inc -gen-subtarget)
-tablegen(LLVM BPFGenGlobalISel.inc -gen-global-isel)
-tablegen(LLVM BPFGenRegisterBank.inc -gen-register-bank)
+llvm_tablegen(BPFGenAsmMatcher.inc -gen-asm-matcher)
+llvm_tablegen(BPFGenAsmWriter.inc -gen-asm-writer)
+llvm_tablegen(BPFGenCallingConv.inc -gen-callingconv)
+llvm_tablegen(BPFGenDAGISel.inc -gen-dag-isel)
+llvm_tablegen(BPFGenDisassemblerTables.inc -gen-disassembler)
+llvm_tablegen(BPFGenInstrInfo.inc -gen-instr-info)
+llvm_tablegen(BPFGenMCCodeEmitter.inc -gen-emitter)
+llvm_tablegen(BPFGenRegisterInfo.inc -gen-register-info)
+llvm_tablegen(BPFGenSDNodeInfo.inc -gen-sd-node-info)
+llvm_tablegen(BPFGenSubtargetInfo.inc -gen-subtarget)
+llvm_tablegen(BPFGenGlobalISel.inc -gen-global-isel)
+llvm_tablegen(BPFGenRegisterBank.inc -gen-register-bank)
 
 add_public_tablegen_target(BPFCommonTableGen)
 
diff --git a/llvm/lib/Target/CSKY/CMakeLists.txt 
b/llvm/lib/Target/CSKY/CMakeLists.txt
index 9064e42ddcdc62..ab6f566550368f 100644
--- a/llvm/lib/Target/CSKY/CMakeLists.txt
+++ b/llvm/lib/Target/CSKY/CMakeLists.txt
@@ -2,21 +2,21 @@ add_llvm_component_group(CSKY)
 
 set(LLVM_TARGET_DEFINITIONS CSKY.td)
 
-tablegen(LLVM CSKYGenAsmMatcher.inc -gen-asm-matcher)
-tablegen(LLVM CSKYGenAsmWriter.inc -gen-asm-writer)
-tablegen(LLVM CSKYGenCallingConv.inc -gen-callingconv)
-tablegen(LLVM CSKYGenCompressInstEmitter.inc -gen-compress-inst-emitter)
-tablegen(LLVM CSKYGenDAGISel.inc -gen-dag-isel)
-tablegen(LLVM CSKYGenDisassemblerTables.inc -gen-disassembler)
-tablegen(LLVM CSKYGenInstrInfo.inc -gen-instr-info)
-tablegen(LLVM CSKYGenMCCodeEmitter.inc -gen-emitter)
-tablegen(LLVM CSKYGenMCPseudoLowering.inc -gen-pseudo-lowering)
-tablegen(LLVM CSKYGenRegisterInfo.inc -gen-register-info)
-tablegen(LLVM CSKYGenSDNodeInfo.inc -gen-sd-node-info)
-tablegen(LLVM CSKYGenSubtargetInfo.inc -gen-subtarget)
+llvm_tablegen(CSKYGenAsmMatcher.inc -gen-asm-matcher)
+llvm_tablegen(CSKYGenAsmWriter.inc -gen-asm-writer)
+llvm_tablegen(CSKYGenCallingConv.inc -gen-callingconv)
+llvm_tablegen(CSKYGenCompressInstEmitter.inc -gen-compress-inst-emitter)
+llvm_tablegen(CSKYGenDAGISel.inc -gen-dag-isel)
+llvm_tablegen(CSKYGenDisassemblerTables.inc -gen-disassembler)
+llvm_tablegen(CSKYGenInstrInfo.inc -gen-instr-info)
+llvm_tablegen(CSKYGenMCCodeEmitter.inc -gen-emitter)
+llvm_tablegen(CSKYGenMCPseudoLowering.inc -gen-pseudo-lowering)
+llvm_tablegen(CSKYGenRegisterInfo.inc -gen-register-info)
+llvm_tablegen(CSKYGenSDNodeInfo.inc -gen-sd-node-info)
+llvm_tablegen(CSKYGenSubtargetInfo.inc -gen-subtarget)
 
 set(LLVM_TARGET_DEFINITIONS MCTargetDesc/CSKYMCOptions.td)
-tablegen(LLVM CSKYMCOptions.inc -gen-opt-parser-defs)
+llvm_tablegen(CSKYMCOptions.inc -gen-opt-parser-defs)
 
 add_public_tablegen_target(CSKYCommonTableGen)
 
diff --git a/llvm/lib/Target/DirectX/CMakeLists.txt 
b/llvm/lib/Target/DirectX/CMakeLists.txt
index 3796fad3635364..c2d9e17b475431 100644
--- a/llvm/lib/Target/DirectX/CMakeLists.txt
+++ b/llvm/lib/Target/DirectX/CMakeLists.txt
@@ -2,12 +2,12 @@ add_llvm_component_group(DirectX)
 
 set(LLVM_TARGET_DEFINITIONS DirectX.td)
 
-tablegen(LLVM DirectXGenSubtargetInfo.inc -gen-subtarget)
-tablegen(LLVM DirectXGenInstrInfo.inc -gen-instr-info)
-tablegen(LLVM DirectXGenRegisterInfo.inc -gen-register-info)
+llvm_tablegen(DirectXGenSubtargetInfo.inc -gen-subtarget)
+llvm_tablegen(DirectXGenInstrInfo.inc -gen-instr-info)
+llvm_tablegen(DirectXGenRegisterInfo.inc -gen-register-info)
 
 set(LLVM_TARGET_DEFINITIONS DXIL.td)
-tablegen(LLVM DXILOperation.inc -gen-dxil-operation)
+llvm_tablegen(DXILOperation.inc -gen-dxil-operation)
 
 add_public_tablegen_target(DirectXCommonTableGen)
 
diff --git a/llvm/lib/Target/Hexagon/CMakeLists.txt 
b/llvm/lib/Target/Hexagon/CMakeLists.txt
index bdd826e7950fed..112573b39f11cb 100644
--- a/llvm/lib/Target/Hexagon/CMakeLists.txt
+++ b/llvm/lib/Target/Hexagon/CMakeLists.txt
@@ -2,17 +2,17 @@ add_llvm_component_group(Hexagon)
 
 set(LLVM_TARGET_DEFINITIONS Hexagon.td)
 
-tablegen(LLVM HexagonGenAsmMatcher.inc -gen-asm-matcher)
-tablegen(LLVM HexagonGenAsmWriter.inc -gen-asm-writer)
-tablegen(LLVM HexagonGenCallingConv.inc -gen-callingconv)
-tablegen(LLVM HexagonGenDAGISel.inc -gen-dag-isel)
-tablegen(LLVM HexagonGenDFAPacketizer.inc -gen-dfa-packetizer)
-tablegen(LLVM HexagonGenDisassemblerTables.inc -gen-disassembler)
-tablegen(LLVM HexagonGenInstrInfo.inc -gen-instr-info)
-tablegen(LLVM HexagonGenMCCodeEmitter.inc -gen-emitter)
-tablegen(LLVM HexagonGenRegisterInfo.inc -gen-register-info)
-tablegen(LLVM HexagonGenSDNodeInfo.inc -gen-sd-node-info)
-tablegen(LLVM HexagonGenSubtargetInfo.inc -gen-subtarget)
+llvm_tablegen(HexagonGenAsmMatcher.inc -gen-asm-matcher)
+llvm_tablegen(HexagonGenAsmWriter.inc -gen-asm-writer)
+llvm_tablegen(HexagonGenCallingConv.inc -gen-callingconv)
+llvm_tablegen(HexagonGenDAGISel.inc -gen-dag-isel)
+llvm_tablegen(HexagonGenDFAPacketizer.inc -gen-dfa-packetizer)
+llvm_tablegen(HexagonGenDisassemblerTables.inc -gen-disassembler)
+llvm_tablegen(HexagonGenInstrInfo.inc -gen-instr-info)
+llvm_tablegen(HexagonGenMCCodeEmitter.inc -gen-emitter)
+llvm_tablegen(HexagonGenRegisterInfo.inc -gen-register-info)
+llvm_tablegen(HexagonGenSDNodeInfo.inc -gen-sd-node-info)
+llvm_tablegen(HexagonGenSubtargetInfo.inc -gen-subtarget)
 
 add_public_tablegen_target(HexagonCommonTableGen)
 
diff --git a/llvm/lib/Target/Lanai/CMakeLists.txt 
b/llvm/lib/Target/Lanai/CMakeLists.txt
index f15ce2d65a33c7..1519e038abdbf7 100644
--- a/llvm/lib/Target/Lanai/CMakeLists.txt
+++ b/llvm/lib/Target/Lanai/CMakeLists.txt
@@ -2,19 +2,19 @@ add_llvm_component_group(Lanai)
 
 set(LLVM_TARGET_DEFINITIONS Lanai.td)
 
-tablegen(LLVM LanaiGenAsmMatcher.inc -gen-asm-matcher)
-tablegen(LLVM LanaiGenAsmWriter.inc -gen-asm-writer)
-tablegen(LLVM LanaiGenCallingConv.inc -gen-callingconv)
-tablegen(LLVM LanaiGenDAGISel.inc -gen-dag-isel)
-tablegen(LLVM LanaiGenDisassemblerTables.inc -gen-disassembler)
-tablegen(LLVM LanaiGenInstrInfo.inc -gen-instr-info)
-tablegen(LLVM LanaiGenMCCodeEmitter.inc -gen-emitter)
-tablegen(LLVM LanaiGenRegisterInfo.inc -gen-register-info)
-tablegen(LLVM LanaiGenSDNodeInfo.inc -gen-sd-node-info)
-tablegen(LLVM LanaiGenSubtargetInfo.inc -gen-subtarget)
+llvm_tablegen(LanaiGenAsmMatcher.inc -gen-asm-matcher)
+llvm_tablegen(LanaiGenAsmWriter.inc -gen-asm-writer)
+llvm_tablegen(LanaiGenCallingConv.inc -gen-callingconv)
+llvm_tablegen(LanaiGenDAGISel.inc -gen-dag-isel)
+llvm_tablegen(LanaiGenDisassemblerTables.inc -gen-disassembler)
+llvm_tablegen(LanaiGenInstrInfo.inc -gen-instr-info)
+llvm_tablegen(LanaiGenMCCodeEmitter.inc -gen-emitter)
+llvm_tablegen(LanaiGenRegisterInfo.inc -gen-register-info)
+llvm_tablegen(LanaiGenSDNodeInfo.inc -gen-sd-node-info)
+llvm_tablegen(LanaiGenSubtargetInfo.inc -gen-subtarget)
 
 set(LLVM_TARGET_DEFINITIONS LanaiOptions.td)
-tablegen(LLVM LanaiOptions.inc -gen-opt-parser-defs)
+llvm_tablegen(LanaiOptions.inc -gen-opt-parser-defs)
 
 add_public_tablegen_target(LanaiCommonTableGen)
 
diff --git a/llvm/lib/Target/LoongArch/CMakeLists.txt 
b/llvm/lib/Target/LoongArch/CMakeLists.txt
index 26da74c926df87..739f0f3d65b0e3 100644
--- a/llvm/lib/Target/LoongArch/CMakeLists.txt
+++ b/llvm/lib/Target/LoongArch/CMakeLists.txt
@@ -2,16 +2,16 @@ add_llvm_component_group(LoongArch)
 
 set(LLVM_TARGET_DEFINITIONS LoongArch.td)
 
-tablegen(LLVM LoongArchGenAsmMatcher.inc -gen-asm-matcher)
-tablegen(LLVM LoongArchGenAsmWriter.inc -gen-asm-writer)
-tablegen(LLVM LoongArchGenDAGISel.inc -gen-dag-isel)
-tablegen(LLVM LoongArchGenDisassemblerTables.inc -gen-disassembler)
-tablegen(LLVM LoongArchGenInstrInfo.inc -gen-instr-info)
-tablegen(LLVM LoongArchGenMCPseudoLowering.inc -gen-pseudo-lowering)
-tablegen(LLVM LoongArchGenMCCodeEmitter.inc -gen-emitter)
-tablegen(LLVM LoongArchGenRegisterInfo.inc -gen-register-info)
-tablegen(LLVM LoongArchGenSDNodeInfo.inc -gen-sd-node-info)
-tablegen(LLVM LoongArchGenSubtargetInfo.inc -gen-subtarget)
+llvm_tablegen(LoongArchGenAsmMatcher.inc -gen-asm-matcher)
+llvm_tablegen(LoongArchGenAsmWriter.inc -gen-asm-writer)
+llvm_tablegen(LoongArchGenDAGISel.inc -gen-dag-isel)
+llvm_tablegen(LoongArchGenDisassemblerTables.inc -gen-disassembler)
+llvm_tablegen(LoongArchGenInstrInfo.inc -gen-instr-info)
+llvm_tablegen(LoongArchGenMCPseudoLowering.inc -gen-pseudo-lowering)
+llvm_tablegen(LoongArchGenMCCodeEmitter.inc -gen-emitter)
+llvm_tablegen(LoongArchGenRegisterInfo.inc -gen-register-info)
+llvm_tablegen(LoongArchGenSDNodeInfo.inc -gen-sd-node-info)
+llvm_tablegen(LoongArchGenSubtargetInfo.inc -gen-subtarget)
 
 add_public_tablegen_target(LoongArchCommonTableGen)
 
diff --git a/llvm/lib/Target/M68k/CMakeLists.txt 
b/llvm/lib/Target/M68k/CMakeLists.txt
index 1ac7e211a996c3..7f0b341622e225 100644
--- a/llvm/lib/Target/M68k/CMakeLists.txt
+++ b/llvm/lib/Target/M68k/CMakeLists.txt
@@ -2,19 +2,19 @@ add_llvm_component_group(M68k)
 
 set(LLVM_TARGET_DEFINITIONS M68k.td)
 
-tablegen(LLVM M68kGenGlobalISel.inc       -gen-global-isel)
-tablegen(LLVM M68kGenRegisterInfo.inc     -gen-register-info)
-tablegen(LLVM M68kGenRegisterBank.inc     -gen-register-bank)
-tablegen(LLVM M68kGenInstrInfo.inc        -gen-instr-info)
-tablegen(LLVM M68kGenSDNodeInfo.inc       -gen-sd-node-info)
-tablegen(LLVM M68kGenSubtargetInfo.inc    -gen-subtarget)
-tablegen(LLVM M68kGenMCCodeEmitter.inc    -gen-emitter)
-tablegen(LLVM M68kGenMCPseudoLowering.inc -gen-pseudo-lowering)
-tablegen(LLVM M68kGenDAGISel.inc          -gen-dag-isel)
-tablegen(LLVM M68kGenCallingConv.inc      -gen-callingconv)
-tablegen(LLVM M68kGenAsmWriter.inc        -gen-asm-writer)
-tablegen(LLVM M68kGenAsmMatcher.inc       -gen-asm-matcher)
-tablegen(LLVM M68kGenDisassemblerTables.inc -gen-disassembler)
+llvm_tablegen(M68kGenGlobalISel.inc       -gen-global-isel)
+llvm_tablegen(M68kGenRegisterInfo.inc     -gen-register-info)
+llvm_tablegen(M68kGenRegisterBank.inc     -gen-register-bank)
+llvm_tablegen(M68kGenInstrInfo.inc        -gen-instr-info)
+llvm_tablegen(M68kGenSDNodeInfo.inc       -gen-sd-node-info)
+llvm_tablegen(M68kGenSubtargetInfo.inc    -gen-subtarget)
+llvm_tablegen(M68kGenMCCodeEmitter.inc    -gen-emitter)
+llvm_tablegen(M68kGenMCPseudoLowering.inc -gen-pseudo-lowering)
+llvm_tablegen(M68kGenDAGISel.inc          -gen-dag-isel)
+llvm_tablegen(M68kGenCallingConv.inc      -gen-callingconv)
+llvm_tablegen(M68kGenAsmWriter.inc        -gen-asm-writer)
+llvm_tablegen(M68kGenAsmMatcher.inc       -gen-asm-matcher)
+llvm_tablegen(M68kGenDisassemblerTables.inc -gen-disassembler)
 
 add_public_tablegen_target(M68kCommonTableGen)
 
diff --git a/llvm/lib/Target/MSP430/CMakeLists.txt 
b/llvm/lib/Target/MSP430/CMakeLists.txt
index 432dab01e8b4e9..f64cde0d6c9733 100644
--- a/llvm/lib/Target/MSP430/CMakeLists.txt
+++ b/llvm/lib/Target/MSP430/CMakeLists.txt
@@ -2,19 +2,19 @@ add_llvm_component_group(MSP430)
 
 set(LLVM_TARGET_DEFINITIONS MSP430.td)
 
-tablegen(LLVM MSP430GenAsmMatcher.inc -gen-asm-matcher)
-tablegen(LLVM MSP430GenAsmWriter.inc -gen-asm-writer)
-tablegen(LLVM MSP430GenCallingConv.inc -gen-callingconv)
-tablegen(LLVM MSP430GenDAGISel.inc -gen-dag-isel)
-tablegen(LLVM MSP430GenDisassemblerTables.inc -gen-disassembler)
-tablegen(LLVM MSP430GenInstrInfo.inc -gen-instr-info)
-tablegen(LLVM MSP430GenMCCodeEmitter.inc -gen-emitter)
-tablegen(LLVM MSP430GenRegisterInfo.inc -gen-register-info)
-tablegen(LLVM MSP430GenSDNodeInfo.inc -gen-sd-node-info)
-tablegen(LLVM MSP430GenSubtargetInfo.inc -gen-subtarget)
+llvm_tablegen(MSP430GenAsmMatcher.inc -gen-asm-matcher)
+llvm_tablegen(MSP430GenAsmWriter.inc -gen-asm-writer)
+llvm_tablegen(MSP430GenCallingConv.inc -gen-callingconv)
+llvm_tablegen(MSP430GenDAGISel.inc -gen-dag-isel)
+llvm_tablegen(MSP430GenDisassemblerTables.inc -gen-disassembler)
+llvm_tablegen(MSP430GenInstrInfo.inc -gen-instr-info)
+llvm_tablegen(MSP430GenMCCodeEmitter.inc -gen-emitter)
+llvm_tablegen(MSP430GenRegisterInfo.inc -gen-register-info)
+llvm_tablegen(MSP430GenSDNodeInfo.inc -gen-sd-node-info)
+llvm_tablegen(MSP430GenSubtargetInfo.inc -gen-subtarget)
 
 set(LLVM_TARGET_DEFINITIONS MSP430Options.td)
-tablegen(LLVM MSP430Options.inc -gen-opt-parser-defs)
+llvm_tablegen(MSP430Options.inc -gen-opt-parser-defs)
 
 add_public_tablegen_target(MSP430CommonTableGen)
 
diff --git a/llvm/lib/Target/Mips/CMakeLists.txt 
b/llvm/lib/Target/Mips/CMakeLists.txt
index 59cb2529c273d4..6e9de89a988798 100644
--- a/llvm/lib/Target/Mips/CMakeLists.txt
+++ b/llvm/lib/Target/Mips/CMakeLists.txt
@@ -2,30 +2,30 @@ add_llvm_component_group(Mips HAS_JIT)
 
 set(LLVM_TARGET_DEFINITIONS Mips.td)
 
-tablegen(LLVM MipsGenAsmMatcher.inc -gen-asm-matcher)
-tablegen(LLVM MipsGenAsmWriter.inc -gen-asm-writer)
-tablegen(LLVM MipsGenCallingConv.inc -gen-callingconv)
-tablegen(LLVM MipsGenDAGISel.inc -gen-dag-isel)
-tablegen(LLVM MipsGenDisassemblerTables.inc -gen-disassembler
+llvm_tablegen(MipsGenAsmMatcher.inc -gen-asm-matcher)
+llvm_tablegen(MipsGenAsmWriter.inc -gen-asm-writer)
+llvm_tablegen(MipsGenCallingConv.inc -gen-callingconv)
+llvm_tablegen(MipsGenDAGISel.inc -gen-dag-isel)
+llvm_tablegen(MipsGenDisassemblerTables.inc -gen-disassembler
               -ignore-non-decodable-operands)
-tablegen(LLVM MipsGenFastISel.inc -gen-fast-isel)
-tablegen(LLVM MipsGenGlobalISel.inc -gen-global-isel)
-tablegen(LLVM MipsGenPostLegalizeGICombiner.inc -gen-global-isel-combiner
+llvm_tablegen(MipsGenFastISel.inc -gen-fast-isel)
+llvm_tablegen(MipsGenGlobalISel.inc -gen-global-isel)
+llvm_tablegen(MipsGenPostLegalizeGICombiner.inc -gen-global-isel-combiner
               -combiners="MipsPostLegalizerCombiner")
-tablegen(LLVM MipsGenInstrInfo.inc -gen-instr-info)
-tablegen(LLVM MipsGenMCCodeEmitter.inc -gen-emitter)
-tablegen(LLVM MipsGenMCPseudoLowering.inc -gen-pseudo-lowering)
-tablegen(LLVM MipsGenRegisterBank.inc -gen-register-bank)
-tablegen(LLVM MipsGenRegisterInfo.inc -gen-register-info)
-tablegen(LLVM MipsGenSDNodeInfo.inc -gen-sd-node-info)
-tablegen(LLVM MipsGenSubtargetInfo.inc -gen-subtarget)
-tablegen(LLVM MipsGenExegesis.inc -gen-exegesis)
+llvm_tablegen(MipsGenInstrInfo.inc -gen-instr-info)
+llvm_tablegen(MipsGenMCCodeEmitter.inc -gen-emitter)
+llvm_tablegen(MipsGenMCPseudoLowering.inc -gen-pseudo-lowering)
+llvm_tablegen(MipsGenRegisterBank.inc -gen-register-bank)
+llvm_tablegen(MipsGenRegisterInfo.inc -gen-register-info)
+llvm_tablegen(MipsGenSDNodeInfo.inc -gen-sd-node-info)
+llvm_tablegen(MipsGenSubtargetInfo.inc -gen-subtarget)
+llvm_tablegen(MipsGenExegesis.inc -gen-exegesis)
 
 set(LLVM_TARGET_DEFINITIONS MipsOptions.td)
-tablegen(LLVM MipsOptions.inc -gen-opt-parser-defs)
+llvm_tablegen(MipsOptions.inc -gen-opt-parser-defs)
 
 set(LLVM_TARGET_DEFINITIONS MCTargetDesc/MipsMCOptions.td)
-tablegen(LLVM MipsMCOptions.inc -gen-opt-parser-defs)
+llvm_tablegen(MipsMCOptions.inc -gen-opt-parser-defs)
 
 add_public_tablegen_target(MipsCommonTableGen)
 
diff --git a/llvm/lib/Target/NVPTX/CMakeLists.txt 
b/llvm/lib/Target/NVPTX/CMakeLists.txt
index 8eb3471fa4fb2c..ae5ebbbc9b5ddb 100644
--- a/llvm/lib/Target/NVPTX/CMakeLists.txt
+++ b/llvm/lib/Target/NVPTX/CMakeLists.txt
@@ -2,12 +2,12 @@ add_llvm_component_group(NVPTX)
 
 set(LLVM_TARGET_DEFINITIONS NVPTX.td)
 
-tablegen(LLVM NVPTXGenAsmWriter.inc -gen-asm-writer)
-tablegen(LLVM NVPTXGenDAGISel.inc -gen-dag-isel)
-tablegen(LLVM NVPTXGenInstrInfo.inc -gen-instr-info)
-tablegen(LLVM NVPTXGenRegisterInfo.inc -gen-register-info)
-tablegen(LLVM NVPTXGenSDNodeInfo.inc -gen-sd-node-info)
-tablegen(LLVM NVPTXGenSubtargetInfo.inc -gen-subtarget)
+llvm_tablegen(NVPTXGenAsmWriter.inc -gen-asm-writer)
+llvm_tablegen(NVPTXGenDAGISel.inc -gen-dag-isel)
+llvm_tablegen(NVPTXGenInstrInfo.inc -gen-instr-info)
+llvm_tablegen(NVPTXGenRegisterInfo.inc -gen-register-info)
+llvm_tablegen(NVPTXGenSDNodeInfo.inc -gen-sd-node-info)
+llvm_tablegen(NVPTXGenSubtargetInfo.inc -gen-subtarget)
 
 add_public_tablegen_target(NVPTXCommonTableGen)
 
diff --git a/llvm/lib/Target/PowerPC/CMakeLists.txt 
b/llvm/lib/Target/PowerPC/CMakeLists.txt
index b7601bf1e21cdc..6e1eb3f4bd297c 100644
--- a/llvm/lib/Target/PowerPC/CMakeLists.txt
+++ b/llvm/lib/Target/PowerPC/CMakeLists.txt
@@ -2,20 +2,20 @@ add_llvm_component_group(PowerPC HAS_JIT)
 
 set(LLVM_TARGET_DEFINITIONS PPC.td)
 
-tablegen(LLVM PPCGenAsmMatcher.inc -gen-asm-matcher)
-tablegen(LLVM PPCGenAsmWriter.inc -gen-asm-writer)
-tablegen(LLVM PPCGenCallingConv.inc -gen-callingconv)
-tablegen(LLVM PPCGenDAGISel.inc -gen-dag-isel)
-tablegen(LLVM PPCGenDisassemblerTables.inc -gen-disassembler)
-tablegen(LLVM PPCGenFastISel.inc -gen-fast-isel)
-tablegen(LLVM PPCGenInstrInfo.inc -gen-instr-info)
-tablegen(LLVM PPCGenMCCodeEmitter.inc -gen-emitter)
-tablegen(LLVM PPCGenRegisterInfo.inc -gen-register-info)
-tablegen(LLVM PPCGenSDNodeInfo.inc -gen-sd-node-info)
-tablegen(LLVM PPCGenSubtargetInfo.inc -gen-subtarget)
-tablegen(LLVM PPCGenExegesis.inc -gen-exegesis)
-tablegen(LLVM PPCGenRegisterBank.inc -gen-register-bank)
-tablegen(LLVM PPCGenGlobalISel.inc -gen-global-isel)
+llvm_tablegen(PPCGenAsmMatcher.inc -gen-asm-matcher)
+llvm_tablegen(PPCGenAsmWriter.inc -gen-asm-writer)
+llvm_tablegen(PPCGenCallingConv.inc -gen-callingconv)
+llvm_tablegen(PPCGenDAGISel.inc -gen-dag-isel)
+llvm_tablegen(PPCGenDisassemblerTables.inc -gen-disassembler)
+llvm_tablegen(PPCGenFastISel.inc -gen-fast-isel)
+llvm_tablegen(PPCGenInstrInfo.inc -gen-instr-info)
+llvm_tablegen(PPCGenMCCodeEmitter.inc -gen-emitter)
+llvm_tablegen(PPCGenRegisterInfo.inc -gen-register-info)
+llvm_tablegen(PPCGenSDNodeInfo.inc -gen-sd-node-info)
+llvm_tablegen(PPCGenSubtargetInfo.inc -gen-subtarget)
+llvm_tablegen(PPCGenExegesis.inc -gen-exegesis)
+llvm_tablegen(PPCGenRegisterBank.inc -gen-register-bank)
+llvm_tablegen(PPCGenGlobalISel.inc -gen-global-isel)
 
 add_public_tablegen_target(PowerPCCommonTableGen)
 
diff --git a/llvm/lib/Target/RISCV/CMakeLists.txt 
b/llvm/lib/Target/RISCV/CMakeLists.txt
index 54e73a57d27cf5..a27f6a1902609b 100644
--- a/llvm/lib/Target/RISCV/CMakeLists.txt
+++ b/llvm/lib/Target/RISCV/CMakeLists.txt
@@ -2,37 +2,37 @@ add_llvm_component_group(RISCV)
 
 set(LLVM_TARGET_DEFINITIONS RISCV.td)
 
-tablegen(LLVM RISCVGenAsmMatcher.inc -gen-asm-matcher)
-tablegen(LLVM RISCVGenAsmWriter.inc -gen-asm-writer)
-tablegen(LLVM RISCVGenCompressInstEmitter.inc -gen-compress-inst-emitter)
-tablegen(LLVM RISCVGenMacroFusion.inc -gen-macro-fusion-pred)
-tablegen(LLVM RISCVGenDAGISel.inc -gen-dag-isel)
-tablegen(LLVM RISCVGenDisassemblerTables.inc -gen-disassembler
+llvm_tablegen(RISCVGenAsmMatcher.inc -gen-asm-matcher)
+llvm_tablegen(RISCVGenAsmWriter.inc -gen-asm-writer)
+llvm_tablegen(RISCVGenCompressInstEmitter.inc -gen-compress-inst-emitter)
+llvm_tablegen(RISCVGenMacroFusion.inc -gen-macro-fusion-pred)
+llvm_tablegen(RISCVGenDAGISel.inc -gen-dag-isel)
+llvm_tablegen(RISCVGenDisassemblerTables.inc -gen-disassembler
               --specialize-decoders-per-bitwidth)
-tablegen(LLVM RISCVGenInstrInfo.inc -gen-instr-info)
-tablegen(LLVM RISCVGenMCCodeEmitter.inc -gen-emitter)
-tablegen(LLVM RISCVGenMCPseudoLowering.inc -gen-pseudo-lowering)
-tablegen(LLVM RISCVGenRegisterBank.inc -gen-register-bank)
-tablegen(LLVM RISCVGenRegisterInfo.inc -gen-register-info)
-tablegen(LLVM RISCVGenSearchableTables.inc -gen-searchable-tables)
-tablegen(LLVM RISCVGenSubtargetInfo.inc -gen-subtarget)
-tablegen(LLVM RISCVGenExegesis.inc -gen-exegesis)
-tablegen(LLVM RISCVGenSDNodeInfo.inc -gen-sd-node-info)
+llvm_tablegen(RISCVGenInstrInfo.inc -gen-instr-info)
+llvm_tablegen(RISCVGenMCCodeEmitter.inc -gen-emitter)
+llvm_tablegen(RISCVGenMCPseudoLowering.inc -gen-pseudo-lowering)
+llvm_tablegen(RISCVGenRegisterBank.inc -gen-register-bank)
+llvm_tablegen(RISCVGenRegisterInfo.inc -gen-register-info)
+llvm_tablegen(RISCVGenSearchableTables.inc -gen-searchable-tables)
+llvm_tablegen(RISCVGenSubtargetInfo.inc -gen-subtarget)
+llvm_tablegen(RISCVGenExegesis.inc -gen-exegesis)
+llvm_tablegen(RISCVGenSDNodeInfo.inc -gen-sd-node-info)
 
 set(LLVM_TARGET_DEFINITIONS RISCVGISel.td)
-tablegen(LLVM RISCVGenGlobalISel.inc -gen-global-isel)
-tablegen(LLVM RISCVGenO0PreLegalizeGICombiner.inc -gen-global-isel-combiner
+llvm_tablegen(RISCVGenGlobalISel.inc -gen-global-isel)
+llvm_tablegen(RISCVGenO0PreLegalizeGICombiner.inc -gen-global-isel-combiner
               -combiners="RISCVO0PreLegalizerCombiner")
-tablegen(LLVM RISCVGenPreLegalizeGICombiner.inc -gen-global-isel-combiner
+llvm_tablegen(RISCVGenPreLegalizeGICombiner.inc -gen-global-isel-combiner
               -combiners="RISCVPreLegalizerCombiner")
-tablegen(LLVM RISCVGenPostLegalizeGICombiner.inc -gen-global-isel-combiner
+llvm_tablegen(RISCVGenPostLegalizeGICombiner.inc -gen-global-isel-combiner
               -combiners="RISCVPostLegalizerCombiner")
 
 set(LLVM_TARGET_DEFINITIONS RISCVOptions.td)
-tablegen(LLVM RISCVOptions.inc -gen-opt-parser-defs)
+llvm_tablegen(RISCVOptions.inc -gen-opt-parser-defs)
 
 set(LLVM_TARGET_DEFINITIONS MCTargetDesc/RISCVMCOptions.td)
-tablegen(LLVM RISCVMCOptions.inc -gen-opt-parser-defs)
+llvm_tablegen(RISCVMCOptions.inc -gen-opt-parser-defs)
 
 add_public_tablegen_target(RISCVCommonTableGen)
 
diff --git a/llvm/lib/Target/SPIRV/CMakeLists.txt 
b/llvm/lib/Target/SPIRV/CMakeLists.txt
index ab8b425ba35ca9..720518fde428f5 100644
--- a/llvm/lib/Target/SPIRV/CMakeLists.txt
+++ b/llvm/lib/Target/SPIRV/CMakeLists.txt
@@ -2,15 +2,15 @@ add_llvm_component_group(SPIRV)
 
 set(LLVM_TARGET_DEFINITIONS SPIRV.td)
 
-tablegen(LLVM SPIRVGenAsmWriter.inc -gen-asm-writer)
-tablegen(LLVM SPIRVGenGlobalISel.inc -gen-global-isel)
-tablegen(LLVM SPIRVGenInstrInfo.inc -gen-instr-info)
-tablegen(LLVM SPIRVGenMCCodeEmitter.inc -gen-emitter)
-tablegen(LLVM SPIRVGenRegisterBank.inc -gen-register-bank)
-tablegen(LLVM SPIRVGenRegisterInfo.inc -gen-register-info)
-tablegen(LLVM SPIRVGenSubtargetInfo.inc -gen-subtarget)
-tablegen(LLVM SPIRVGenTables.inc -gen-searchable-tables)
-tablegen(LLVM SPIRVGenPreLegalizeGICombiner.inc -gen-global-isel-combiner
+llvm_tablegen(SPIRVGenAsmWriter.inc -gen-asm-writer)
+llvm_tablegen(SPIRVGenGlobalISel.inc -gen-global-isel)
+llvm_tablegen(SPIRVGenInstrInfo.inc -gen-instr-info)
+llvm_tablegen(SPIRVGenMCCodeEmitter.inc -gen-emitter)
+llvm_tablegen(SPIRVGenRegisterBank.inc -gen-register-bank)
+llvm_tablegen(SPIRVGenRegisterInfo.inc -gen-register-info)
+llvm_tablegen(SPIRVGenSubtargetInfo.inc -gen-subtarget)
+llvm_tablegen(SPIRVGenTables.inc -gen-searchable-tables)
+llvm_tablegen(SPIRVGenPreLegalizeGICombiner.inc -gen-global-isel-combiner
               -combiners="SPIRVPreLegalizerCombiner")
 
 add_public_tablegen_target(SPIRVCommonTableGen)
diff --git a/llvm/lib/Target/Sparc/CMakeLists.txt 
b/llvm/lib/Target/Sparc/CMakeLists.txt
index c915add38dcf2b..3b3dfb7631225d 100644
--- a/llvm/lib/Target/Sparc/CMakeLists.txt
+++ b/llvm/lib/Target/Sparc/CMakeLists.txt
@@ -2,20 +2,20 @@ add_llvm_component_group(Sparc)
 
 set(LLVM_TARGET_DEFINITIONS Sparc.td)
 
-tablegen(LLVM SparcGenAsmMatcher.inc -gen-asm-matcher)
-tablegen(LLVM SparcGenAsmWriter.inc -gen-asm-writer)
-tablegen(LLVM SparcGenCallingConv.inc -gen-callingconv)
-tablegen(LLVM SparcGenDAGISel.inc -gen-dag-isel)
-tablegen(LLVM SparcGenDisassemblerTables.inc -gen-disassembler)
-tablegen(LLVM SparcGenInstrInfo.inc -gen-instr-info)
-tablegen(LLVM SparcGenMCCodeEmitter.inc -gen-emitter)
-tablegen(LLVM SparcGenRegisterInfo.inc -gen-register-info)
-tablegen(LLVM SparcGenSDNodeInfo.inc -gen-sd-node-info -sdnode-namespace=SPISD)
-tablegen(LLVM SparcGenSearchableTables.inc -gen-searchable-tables)
-tablegen(LLVM SparcGenSubtargetInfo.inc -gen-subtarget)
+llvm_tablegen(SparcGenAsmMatcher.inc -gen-asm-matcher)
+llvm_tablegen(SparcGenAsmWriter.inc -gen-asm-writer)
+llvm_tablegen(SparcGenCallingConv.inc -gen-callingconv)
+llvm_tablegen(SparcGenDAGISel.inc -gen-dag-isel)
+llvm_tablegen(SparcGenDisassemblerTables.inc -gen-disassembler)
+llvm_tablegen(SparcGenInstrInfo.inc -gen-instr-info)
+llvm_tablegen(SparcGenMCCodeEmitter.inc -gen-emitter)
+llvm_tablegen(SparcGenRegisterInfo.inc -gen-register-info)
+llvm_tablegen(SparcGenSDNodeInfo.inc -gen-sd-node-info -sdnode-namespace=SPISD)
+llvm_tablegen(SparcGenSearchableTables.inc -gen-searchable-tables)
+llvm_tablegen(SparcGenSubtargetInfo.inc -gen-subtarget)
 
 set(LLVM_TARGET_DEFINITIONS SparcOptions.td)
-tablegen(LLVM SparcOptions.inc -gen-opt-parser-defs)
+llvm_tablegen(SparcOptions.inc -gen-opt-parser-defs)
 
 add_public_tablegen_target(SparcCommonTableGen)
 
diff --git a/llvm/lib/Target/SystemZ/CMakeLists.txt 
b/llvm/lib/Target/SystemZ/CMakeLists.txt
index d0d80e5b3183ac..11993576ef0316 100644
--- a/llvm/lib/Target/SystemZ/CMakeLists.txt
+++ b/llvm/lib/Target/SystemZ/CMakeLists.txt
@@ -2,18 +2,18 @@ add_llvm_component_group(SystemZ HAS_JIT)
 
 set(LLVM_TARGET_DEFINITIONS SystemZ.td)
 
-tablegen(LLVM SystemZGenAsmMatcher.inc -gen-asm-matcher)
-tablegen(LLVM SystemZGenGNUAsmWriter.inc -gen-asm-writer)
-tablegen(LLVM SystemZGenHLASMAsmWriter.inc -gen-asm-writer -asmwriternum=1)
-tablegen(LLVM SystemZGenCallingConv.inc -gen-callingconv)
-tablegen(LLVM SystemZGenDAGISel.inc -gen-dag-isel)
-tablegen(LLVM SystemZGenDisassemblerTables.inc -gen-disassembler)
-tablegen(LLVM SystemZGenInsnMatchTable.inc -gen-insn-directive-match-table)
-tablegen(LLVM SystemZGenInstrInfo.inc -gen-instr-info)
-tablegen(LLVM SystemZGenMCCodeEmitter.inc -gen-emitter)
-tablegen(LLVM SystemZGenRegisterInfo.inc -gen-register-info)
-tablegen(LLVM SystemZGenSDNodeInfo.inc -gen-sd-node-info)
-tablegen(LLVM SystemZGenSubtargetInfo.inc -gen-subtarget)
+llvm_tablegen(SystemZGenAsmMatcher.inc -gen-asm-matcher)
+llvm_tablegen(SystemZGenGNUAsmWriter.inc -gen-asm-writer)
+llvm_tablegen(SystemZGenHLASMAsmWriter.inc -gen-asm-writer -asmwriternum=1)
+llvm_tablegen(SystemZGenCallingConv.inc -gen-callingconv)
+llvm_tablegen(SystemZGenDAGISel.inc -gen-dag-isel)
+llvm_tablegen(SystemZGenDisassemblerTables.inc -gen-disassembler)
+llvm_tablegen(SystemZGenInsnMatchTable.inc -gen-insn-directive-match-table)
+llvm_tablegen(SystemZGenInstrInfo.inc -gen-instr-info)
+llvm_tablegen(SystemZGenMCCodeEmitter.inc -gen-emitter)
+llvm_tablegen(SystemZGenRegisterInfo.inc -gen-register-info)
+llvm_tablegen(SystemZGenSDNodeInfo.inc -gen-sd-node-info)
+llvm_tablegen(SystemZGenSubtargetInfo.inc -gen-subtarget)
 
 add_public_tablegen_target(SystemZCommonTableGen)
 
diff --git a/llvm/lib/Target/VE/CMakeLists.txt 
b/llvm/lib/Target/VE/CMakeLists.txt
index b06072ddf85195..edf82cbfb2c547 100644
--- a/llvm/lib/Target/VE/CMakeLists.txt
+++ b/llvm/lib/Target/VE/CMakeLists.txt
@@ -2,16 +2,16 @@ add_llvm_component_group(VE)
 
 set(LLVM_TARGET_DEFINITIONS VE.td)
 
-tablegen(LLVM VEGenRegisterInfo.inc -gen-register-info)
-tablegen(LLVM VEGenInstrInfo.inc -gen-instr-info)
-tablegen(LLVM VEGenDisassemblerTables.inc -gen-disassembler)
-tablegen(LLVM VEGenMCCodeEmitter.inc -gen-emitter)
-tablegen(LLVM VEGenAsmWriter.inc -gen-asm-writer)
-tablegen(LLVM VEGenAsmMatcher.inc -gen-asm-matcher)
-tablegen(LLVM VEGenDAGISel.inc -gen-dag-isel)
-tablegen(LLVM VEGenSDNodeInfo.inc -gen-sd-node-info)
-tablegen(LLVM VEGenSubtargetInfo.inc -gen-subtarget)
-tablegen(LLVM VEGenCallingConv.inc -gen-callingconv)
+llvm_tablegen(VEGenRegisterInfo.inc -gen-register-info)
+llvm_tablegen(VEGenInstrInfo.inc -gen-instr-info)
+llvm_tablegen(VEGenDisassemblerTables.inc -gen-disassembler)
+llvm_tablegen(VEGenMCCodeEmitter.inc -gen-emitter)
+llvm_tablegen(VEGenAsmWriter.inc -gen-asm-writer)
+llvm_tablegen(VEGenAsmMatcher.inc -gen-asm-matcher)
+llvm_tablegen(VEGenDAGISel.inc -gen-dag-isel)
+llvm_tablegen(VEGenSDNodeInfo.inc -gen-sd-node-info)
+llvm_tablegen(VEGenSubtargetInfo.inc -gen-subtarget)
+llvm_tablegen(VEGenCallingConv.inc -gen-callingconv)
 add_public_tablegen_target(VECommonTableGen)
 
 add_llvm_target(VECodeGen
diff --git a/llvm/lib/Target/WebAssembly/CMakeLists.txt 
b/llvm/lib/Target/WebAssembly/CMakeLists.txt
index e96ac48aa00cba..dfa1d42e4e631c 100644
--- a/llvm/lib/Target/WebAssembly/CMakeLists.txt
+++ b/llvm/lib/Target/WebAssembly/CMakeLists.txt
@@ -2,23 +2,23 @@ add_llvm_component_group(WebAssembly)
 
 set(LLVM_TARGET_DEFINITIONS WebAssembly.td)
 
-tablegen(LLVM WebAssemblyGenAsmMatcher.inc -gen-asm-matcher)
-tablegen(LLVM WebAssemblyGenAsmWriter.inc -gen-asm-writer)
-tablegen(LLVM WebAssemblyGenDAGISel.inc -gen-dag-isel)
-tablegen(LLVM WebAssemblyGenDisassemblerTables.inc -gen-disassembler)
-tablegen(LLVM WebAssemblyGenFastISel.inc -gen-fast-isel)
-tablegen(LLVM WebAssemblyGenInstrInfo.inc -gen-instr-info)
-tablegen(LLVM WebAssemblyGenMCCodeEmitter.inc -gen-emitter)
-tablegen(LLVM WebAssemblyGenRegisterBank.inc -gen-register-bank)
-tablegen(LLVM WebAssemblyGenRegisterInfo.inc -gen-register-info)
-tablegen(LLVM WebAssemblyGenSDNodeInfo.inc -gen-sd-node-info)
-tablegen(LLVM WebAssemblyGenSubtargetInfo.inc -gen-subtarget)
+llvm_tablegen(WebAssemblyGenAsmMatcher.inc -gen-asm-matcher)
+llvm_tablegen(WebAssemblyGenAsmWriter.inc -gen-asm-writer)
+llvm_tablegen(WebAssemblyGenDAGISel.inc -gen-dag-isel)
+llvm_tablegen(WebAssemblyGenDisassemblerTables.inc -gen-disassembler)
+llvm_tablegen(WebAssemblyGenFastISel.inc -gen-fast-isel)
+llvm_tablegen(WebAssemblyGenInstrInfo.inc -gen-instr-info)
+llvm_tablegen(WebAssemblyGenMCCodeEmitter.inc -gen-emitter)
+llvm_tablegen(WebAssemblyGenRegisterBank.inc -gen-register-bank)
+llvm_tablegen(WebAssemblyGenRegisterInfo.inc -gen-register-info)
+llvm_tablegen(WebAssemblyGenSDNodeInfo.inc -gen-sd-node-info)
+llvm_tablegen(WebAssemblyGenSubtargetInfo.inc -gen-subtarget)
 
 set(LLVM_TARGET_DEFINITIONS WebAssemblyGISel.td)
-tablegen(LLVM WebAssemblyGenGlobalISel.inc -gen-global-isel 
-gisel-extended-llt)
-tablegen(LLVM WebAssemblyGenPreLegalizeGICombiner.inc -gen-global-isel-combiner
+llvm_tablegen(WebAssemblyGenGlobalISel.inc -gen-global-isel 
-gisel-extended-llt)
+llvm_tablegen(WebAssemblyGenPreLegalizeGICombiner.inc -gen-global-isel-combiner
               -combiners="WebAssemblyPreLegalizerCombiner")
-tablegen(LLVM WebAssemblyGenPostLegalizeGICombiner.inc 
-gen-global-isel-combiner
+llvm_tablegen(WebAssemblyGenPostLegalizeGICombiner.inc 
-gen-global-isel-combiner
               -combiners="WebAssemblyPostLegalizerCombiner")
 
 add_public_tablegen_target(WebAssemblyCommonTableGen)
diff --git a/llvm/lib/Target/X86/CMakeLists.txt 
b/llvm/lib/Target/X86/CMakeLists.txt
index 24e8131a982ba8..f3e8ef93dd1073 100644
--- a/llvm/lib/Target/X86/CMakeLists.txt
+++ b/llvm/lib/Target/X86/CMakeLists.txt
@@ -2,34 +2,34 @@ add_llvm_component_group(X86 HAS_JIT)
 
 set(LLVM_TARGET_DEFINITIONS X86.td)
 
-tablegen(LLVM X86GenAsmMatcher.inc -gen-asm-matcher)
-tablegen(LLVM X86GenAsmWriter.inc -gen-asm-writer)
-tablegen(LLVM X86GenAsmWriter1.inc -gen-asm-writer -asmwriternum=1)
-tablegen(LLVM X86GenCallingConv.inc -gen-callingconv)
-tablegen(LLVM X86GenDAGISel.inc -gen-dag-isel)
-tablegen(LLVM X86GenDisassemblerTables.inc -gen-disassembler)
-tablegen(LLVM X86GenInstrMapping.inc -gen-x86-instr-mapping)
-tablegen(LLVM X86GenExegesis.inc -gen-exegesis)
-tablegen(LLVM X86GenFastISel.inc -gen-fast-isel)
-tablegen(LLVM X86GenGlobalISel.inc -gen-global-isel)
-tablegen(LLVM X86GenInstrInfo.inc -gen-instr-info
+llvm_tablegen(X86GenAsmMatcher.inc -gen-asm-matcher)
+llvm_tablegen(X86GenAsmWriter.inc -gen-asm-writer)
+llvm_tablegen(X86GenAsmWriter1.inc -gen-asm-writer -asmwriternum=1)
+llvm_tablegen(X86GenCallingConv.inc -gen-callingconv)
+llvm_tablegen(X86GenDAGISel.inc -gen-dag-isel)
+llvm_tablegen(X86GenDisassemblerTables.inc -gen-disassembler)
+llvm_tablegen(X86GenInstrMapping.inc -gen-x86-instr-mapping)
+llvm_tablegen(X86GenExegesis.inc -gen-exegesis)
+llvm_tablegen(X86GenFastISel.inc -gen-fast-isel)
+llvm_tablegen(X86GenGlobalISel.inc -gen-global-isel)
+llvm_tablegen(X86GenInstrInfo.inc -gen-instr-info
                                   -instr-info-expand-mi-operand-info=0)
-tablegen(LLVM X86GenMnemonicTables.inc -gen-x86-mnemonic-tables 
-asmwriternum=1)
-tablegen(LLVM X86GenRegisterBank.inc -gen-register-bank)
-tablegen(LLVM X86GenRegisterInfo.inc -gen-register-info)
-tablegen(LLVM X86GenSDNodeInfo.inc -gen-sd-node-info)
-tablegen(LLVM X86GenSubtargetInfo.inc -gen-subtarget)
-tablegen(LLVM X86GenFoldTables.inc -gen-x86-fold-tables -asmwriternum=1)
-tablegen(LLVM X86GenPreLegalizeGICombiner.inc -gen-global-isel-combiner
+llvm_tablegen(X86GenMnemonicTables.inc -gen-x86-mnemonic-tables 
-asmwriternum=1)
+llvm_tablegen(X86GenRegisterBank.inc -gen-register-bank)
+llvm_tablegen(X86GenRegisterInfo.inc -gen-register-info)
+llvm_tablegen(X86GenSDNodeInfo.inc -gen-sd-node-info)
+llvm_tablegen(X86GenSubtargetInfo.inc -gen-subtarget)
+llvm_tablegen(X86GenFoldTables.inc -gen-x86-fold-tables -asmwriternum=1)
+llvm_tablegen(X86GenPreLegalizeGICombiner.inc -gen-global-isel-combiner
               -combiners="X86PreLegalizerCombiner")
-tablegen(LLVM X86GenPostLegalizeGICombiner.inc -gen-global-isel-combiner
+llvm_tablegen(X86GenPostLegalizeGICombiner.inc -gen-global-isel-combiner
               -combiners="X86PostLegalizerCombiner")
 
 set(LLVM_TARGET_DEFINITIONS X86Options.td)
-tablegen(LLVM X86Options.inc -gen-opt-parser-defs)
+llvm_tablegen(X86Options.inc -gen-opt-parser-defs)
 
 set(LLVM_TARGET_DEFINITIONS MCTargetDesc/X86MCOptions.td)
-tablegen(LLVM X86MCOptions.inc -gen-opt-parser-defs)
+llvm_tablegen(X86MCOptions.inc -gen-opt-parser-defs)
 
 add_public_tablegen_target(X86CommonTableGen)
 
diff --git a/llvm/lib/Target/XCore/CMakeLists.txt 
b/llvm/lib/Target/XCore/CMakeLists.txt
index 7100d66ef4cd7d..5a6d43819842df 100644
--- a/llvm/lib/Target/XCore/CMakeLists.txt
+++ b/llvm/lib/Target/XCore/CMakeLists.txt
@@ -2,17 +2,17 @@ add_llvm_component_group(XCore)
 
 set(LLVM_TARGET_DEFINITIONS XCore.td)
 
-tablegen(LLVM XCoreGenAsmWriter.inc -gen-asm-writer)
-tablegen(LLVM XCoreGenCallingConv.inc -gen-callingconv)
-tablegen(LLVM XCoreGenDAGISel.inc -gen-dag-isel)
-tablegen(LLVM XCoreGenDisassemblerTables.inc -gen-disassembler)
-tablegen(LLVM XCoreGenInstrInfo.inc -gen-instr-info)
-tablegen(LLVM XCoreGenRegisterInfo.inc -gen-register-info)
-tablegen(LLVM XCoreGenSDNodeInfo.inc -gen-sd-node-info)
-tablegen(LLVM XCoreGenSubtargetInfo.inc -gen-subtarget)
+llvm_tablegen(XCoreGenAsmWriter.inc -gen-asm-writer)
+llvm_tablegen(XCoreGenCallingConv.inc -gen-callingconv)
+llvm_tablegen(XCoreGenDAGISel.inc -gen-dag-isel)
+llvm_tablegen(XCoreGenDisassemblerTables.inc -gen-disassembler)
+llvm_tablegen(XCoreGenInstrInfo.inc -gen-instr-info)
+llvm_tablegen(XCoreGenRegisterInfo.inc -gen-register-info)
+llvm_tablegen(XCoreGenSDNodeInfo.inc -gen-sd-node-info)
+llvm_tablegen(XCoreGenSubtargetInfo.inc -gen-subtarget)
 
 set(LLVM_TARGET_DEFINITIONS XCoreOptions.td)
-tablegen(LLVM XCoreOptions.inc -gen-opt-parser-defs)
+llvm_tablegen(XCoreOptions.inc -gen-opt-parser-defs)
 
 add_public_tablegen_target(XCoreCommonTableGen)
 
diff --git a/llvm/lib/Target/Xtensa/CMakeLists.txt 
b/llvm/lib/Target/Xtensa/CMakeLists.txt
index a11ad9869d1600..3247ee66ea8836 100644
--- a/llvm/lib/Target/Xtensa/CMakeLists.txt
+++ b/llvm/lib/Target/Xtensa/CMakeLists.txt
@@ -2,16 +2,16 @@ add_llvm_component_group(Xtensa)
 
 set(LLVM_TARGET_DEFINITIONS Xtensa.td)
 
-tablegen(LLVM XtensaGenAsmMatcher.inc -gen-asm-matcher)
-tablegen(LLVM XtensaGenAsmWriter.inc -gen-asm-writer)
-tablegen(LLVM XtensaGenCallingConv.inc -gen-callingconv)
-tablegen(LLVM XtensaGenDAGISel.inc -gen-dag-isel)
-tablegen(LLVM XtensaGenDisassemblerTables.inc -gen-disassembler)
-tablegen(LLVM XtensaGenInstrInfo.inc -gen-instr-info)
-tablegen(LLVM XtensaGenMCCodeEmitter.inc -gen-emitter)
-tablegen(LLVM XtensaGenRegisterInfo.inc -gen-register-info)
-tablegen(LLVM XtensaGenSDNodeInfo.inc -gen-sd-node-info)
-tablegen(LLVM XtensaGenSubtargetInfo.inc -gen-subtarget)
+llvm_tablegen(XtensaGenAsmMatcher.inc -gen-asm-matcher)
+llvm_tablegen(XtensaGenAsmWriter.inc -gen-asm-writer)
+llvm_tablegen(XtensaGenCallingConv.inc -gen-callingconv)
+llvm_tablegen(XtensaGenDAGISel.inc -gen-dag-isel)
+llvm_tablegen(XtensaGenDisassemblerTables.inc -gen-disassembler)
+llvm_tablegen(XtensaGenInstrInfo.inc -gen-instr-info)
+llvm_tablegen(XtensaGenMCCodeEmitter.inc -gen-emitter)
+llvm_tablegen(XtensaGenRegisterInfo.inc -gen-register-info)
+llvm_tablegen(XtensaGenSDNodeInfo.inc -gen-sd-node-info)
+llvm_tablegen(XtensaGenSubtargetInfo.inc -gen-subtarget)
 
 add_public_tablegen_target(XtensaCommonTableGen)
 
diff --git a/llvm/lib/ToolDrivers/llvm-dlltool/CMakeLists.txt 
b/llvm/lib/ToolDrivers/llvm-dlltool/CMakeLists.txt
index 5db08e7852d03a..6f139cbb70e89a 100644
--- a/llvm/lib/ToolDrivers/llvm-dlltool/CMakeLists.txt
+++ b/llvm/lib/ToolDrivers/llvm-dlltool/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(DllOptionsTableGen)
 
 add_llvm_component_library(LLVMDlltoolDriver
diff --git a/llvm/lib/ToolDrivers/llvm-lib/CMakeLists.txt 
b/llvm/lib/ToolDrivers/llvm-lib/CMakeLists.txt
index a432cb47742526..afc4663f8209d8 100644
--- a/llvm/lib/ToolDrivers/llvm-lib/CMakeLists.txt
+++ b/llvm/lib/ToolDrivers/llvm-lib/CMakeLists.txt
@@ -7,7 +7,7 @@ set(LLVM_LINK_COMPONENTS
   )
 
 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(LibOptionsTableGen)
 
 add_llvm_component_library(LLVMLibDriver
diff --git a/llvm/lib/Transforms/InstCombine/CMakeLists.txt 
b/llvm/lib/Transforms/InstCombine/CMakeLists.txt
index 23d4552919c162..4b3d513630553c 100644
--- a/llvm/lib/Transforms/InstCombine/CMakeLists.txt
+++ b/llvm/lib/Transforms/InstCombine/CMakeLists.txt
@@ -1,6 +1,6 @@
 set(LLVM_TABLEGEN_PROJECT LLVM_HEADERS)
 set(LLVM_TARGET_DEFINITIONS InstCombineCLOptions.td)
-tablegen(LLVM InstCombineCLOptions.inc -gen-opt-parser-defs)
+llvm_tablegen(InstCombineCLOptions.inc -gen-opt-parser-defs)
 add_public_tablegen_target(InstCombineCLOptionsTableGen)
 
 add_llvm_component_library(LLVMInstCombine
diff --git a/llvm/lib/Transforms/Instrumentation/CMakeLists.txt 
b/llvm/lib/Transforms/Instrumentation/CMakeLists.txt
index 848ce9e65fdc7f..1e0cd78d3dc047 100644
--- a/llvm/lib/Transforms/Instrumentation/CMakeLists.txt
+++ b/llvm/lib/Transforms/Instrumentation/CMakeLists.txt
@@ -1,6 +1,6 @@
 set(LLVM_TABLEGEN_PROJECT LLVM_HEADERS)
 set(LLVM_TARGET_DEFINITIONS InstrumentationOptions.td)
-tablegen(LLVM InstrumentationOptions.inc -gen-opt-parser-defs)
+llvm_tablegen(InstrumentationOptions.inc -gen-opt-parser-defs)
 add_public_tablegen_target(InstrumentationOptionsTableGen)
 
 add_llvm_component_library(LLVMInstrumentation
diff --git a/llvm/lib/Transforms/Scalar/CMakeLists.txt 
b/llvm/lib/Transforms/Scalar/CMakeLists.txt
index 02cc89881ffb6c..485679f341c112 100644
--- a/llvm/lib/Transforms/Scalar/CMakeLists.txt
+++ b/llvm/lib/Transforms/Scalar/CMakeLists.txt
@@ -1,6 +1,6 @@
 set(LLVM_TABLEGEN_PROJECT LLVM_HEADERS)
 set(LLVM_TARGET_DEFINITIONS ScalarOptions.td)
-tablegen(LLVM ScalarOptions.inc -gen-opt-parser-defs)
+llvm_tablegen(ScalarOptions.inc -gen-opt-parser-defs)
 add_public_tablegen_target(ScalarOptionsTableGen)
 
 add_llvm_component_library(LLVMScalarOpts
diff --git a/llvm/lib/Transforms/Vectorize/CMakeLists.txt 
b/llvm/lib/Transforms/Vectorize/CMakeLists.txt
index f631d50c0c7164..29b079999b8601 100644
--- a/llvm/lib/Transforms/Vectorize/CMakeLists.txt
+++ b/llvm/lib/Transforms/Vectorize/CMakeLists.txt
@@ -1,6 +1,6 @@
 set(LLVM_TABLEGEN_PROJECT LLVM_HEADERS)
 set(LLVM_TARGET_DEFINITIONS VectorizeOptions.td)
-tablegen(LLVM VectorizeOptions.inc -gen-opt-parser-defs)
+llvm_tablegen(VectorizeOptions.inc -gen-opt-parser-defs)
 add_public_tablegen_target(VectorizeOptionsTableGen)
 
 add_llvm_component_library(LLVMVectorize
diff --git a/llvm/tools/dsymutil/CMakeLists.txt 
b/llvm/tools/dsymutil/CMakeLists.txt
index eeff3986fef880..e931ed5a258346 100644
--- a/llvm/tools/dsymutil/CMakeLists.txt
+++ b/llvm/tools/dsymutil/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(DsymutilTableGen)
 
 set(LLVM_LINK_COMPONENTS
diff --git a/llvm/tools/llvm-cas/CMakeLists.txt 
b/llvm/tools/llvm-cas/CMakeLists.txt
index e9d40cb49e015b..e11edd2901a948 100644
--- a/llvm/tools/llvm-cas/CMakeLists.txt
+++ b/llvm/tools/llvm-cas/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(LLVMCASToolTableGen)
 
 set(LLVM_LINK_COMPONENTS
diff --git a/llvm/tools/llvm-cgdata/CMakeLists.txt 
b/llvm/tools/llvm-cgdata/CMakeLists.txt
index 556bc388306a3c..5c16595fa5ba02 100644
--- a/llvm/tools/llvm-cgdata/CMakeLists.txt
+++ b/llvm/tools/llvm-cgdata/CMakeLists.txt
@@ -8,7 +8,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(CGDataOptsTableGen)
 
 add_llvm_tool(llvm-cgdata
diff --git a/llvm/tools/llvm-cov/CMakeLists.txt 
b/llvm/tools/llvm-cov/CMakeLists.txt
index 41e826ac88a466..733e993a97a209 100644
--- a/llvm/tools/llvm-cov/CMakeLists.txt
+++ b/llvm/tools/llvm-cov/CMakeLists.txt
@@ -9,7 +9,7 @@ set(LLVM_LINK_COMPONENTS
   )
 
 set(LLVM_TARGET_DEFINITIONS GcovOpts.td)
-tablegen(LLVM GcovOpts.inc -gen-opt-parser-defs)
+llvm_tablegen(GcovOpts.inc -gen-opt-parser-defs)
 add_public_tablegen_target(CovGcovOptsTableGen)
 
 add_llvm_tool(llvm-cov
diff --git a/llvm/tools/llvm-cvtres/CMakeLists.txt 
b/llvm/tools/llvm-cvtres/CMakeLists.txt
index 0898318ddfcc6b..48c8598fc1abb6 100644
--- a/llvm/tools/llvm-cvtres/CMakeLists.txt
+++ b/llvm/tools/llvm-cvtres/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(CvtResTableGen)
 
 add_llvm_tool(llvm-cvtres
diff --git a/llvm/tools/llvm-cxxfilt/CMakeLists.txt 
b/llvm/tools/llvm-cxxfilt/CMakeLists.txt
index a644baffdd90ea..26f06d0eecad82 100644
--- a/llvm/tools/llvm-cxxfilt/CMakeLists.txt
+++ b/llvm/tools/llvm-cxxfilt/CMakeLists.txt
@@ -6,7 +6,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(CxxfiltOptsTableGen)
 
 add_llvm_tool(llvm-cxxfilt
diff --git a/llvm/tools/llvm-debuginfod-find/CMakeLists.txt 
b/llvm/tools/llvm-debuginfod-find/CMakeLists.txt
index fcc706d6df452c..fefa677943636c 100644
--- a/llvm/tools/llvm-debuginfod-find/CMakeLists.txt
+++ b/llvm/tools/llvm-debuginfod-find/CMakeLists.txt
@@ -4,7 +4,7 @@ set(LLVM_LINK_COMPONENTS
   Support
   )
 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(DebugInfodFindOptsTableGen)
 
 add_llvm_tool(llvm-debuginfod-find
diff --git a/llvm/tools/llvm-debuginfod/CMakeLists.txt 
b/llvm/tools/llvm-debuginfod/CMakeLists.txt
index 194784b7a7eee2..ecb54531bd35b7 100644
--- a/llvm/tools/llvm-debuginfod/CMakeLists.txt
+++ b/llvm/tools/llvm-debuginfod/CMakeLists.txt
@@ -3,7 +3,7 @@ set(LLVM_LINK_COMPONENTS
   Support
   )
 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(DebugInfodOptsTableGen)
 
 add_llvm_tool(llvm-debuginfod
diff --git a/llvm/tools/llvm-dwarfutil/CMakeLists.txt 
b/llvm/tools/llvm-dwarfutil/CMakeLists.txt
index 88335928b68dd2..f63d2e36d9df55 100644
--- a/llvm/tools/llvm-dwarfutil/CMakeLists.txt
+++ b/llvm/tools/llvm-dwarfutil/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(DwarfutilTableGen)
 
 set(LLVM_LINK_COMPONENTS
diff --git a/llvm/tools/llvm-dwp/CMakeLists.txt 
b/llvm/tools/llvm-dwp/CMakeLists.txt
index bb8138bfe50ff2..29abc71abee4c2 100644
--- a/llvm/tools/llvm-dwp/CMakeLists.txt
+++ b/llvm/tools/llvm-dwp/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(DwpOptsTableGen)
 
 add_llvm_tool(llvm-dwp
diff --git a/llvm/tools/llvm-gsymutil/CMakeLists.txt 
b/llvm/tools/llvm-gsymutil/CMakeLists.txt
index 7f8a21a39d3240..10bf6aa7073549 100644
--- a/llvm/tools/llvm-gsymutil/CMakeLists.txt
+++ b/llvm/tools/llvm-gsymutil/CMakeLists.txt
@@ -10,7 +10,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(GSYMUtilOptsTableGen)
 
 add_llvm_tool(llvm-gsymutil
diff --git a/llvm/tools/llvm-ifs/CMakeLists.txt 
b/llvm/tools/llvm-ifs/CMakeLists.txt
index dc008eaec8bdc4..454aa5b6546102 100644
--- a/llvm/tools/llvm-ifs/CMakeLists.txt
+++ b/llvm/tools/llvm-ifs/CMakeLists.txt
@@ -9,7 +9,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(IFSOptsTableGen)
 
 add_llvm_tool(llvm-ifs
diff --git a/llvm/tools/llvm-libtool-darwin/CMakeLists.txt 
b/llvm/tools/llvm-libtool-darwin/CMakeLists.txt
index eb95a5ff7a0ee9..0e950fe60b5428 100644
--- a/llvm/tools/llvm-libtool-darwin/CMakeLists.txt
+++ b/llvm/tools/llvm-libtool-darwin/CMakeLists.txt
@@ -10,7 +10,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(LibtoolDarwinOptsTableGen)
 
 add_llvm_tool(llvm-libtool-darwin
diff --git a/llvm/tools/llvm-lipo/CMakeLists.txt 
b/llvm/tools/llvm-lipo/CMakeLists.txt
index 342f9bfafe915b..d6548db3f4de7d 100644
--- a/llvm/tools/llvm-lipo/CMakeLists.txt
+++ b/llvm/tools/llvm-lipo/CMakeLists.txt
@@ -10,7 +10,7 @@ set(LLVM_LINK_COMPONENTS
 )
 
 set(LLVM_TARGET_DEFINITIONS LipoOpts.td)
-tablegen(LLVM LipoOpts.inc -gen-opt-parser-defs)
+llvm_tablegen(LipoOpts.inc -gen-opt-parser-defs)
 add_public_tablegen_target(LipoOptsTableGen)
 
 add_llvm_tool(llvm-lipo
diff --git a/llvm/tools/llvm-ml/CMakeLists.txt 
b/llvm/tools/llvm-ml/CMakeLists.txt
index d3dfb87d92b986..d8e203b5a6ced9 100644
--- a/llvm/tools/llvm-ml/CMakeLists.txt
+++ b/llvm/tools/llvm-ml/CMakeLists.txt
@@ -12,7 +12,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(MLTableGen)
 
 add_llvm_tool(llvm-ml
diff --git a/llvm/tools/llvm-mt/CMakeLists.txt 
b/llvm/tools/llvm-mt/CMakeLists.txt
index baa9f986a85b30..52ae82f2747c03 100644
--- a/llvm/tools/llvm-mt/CMakeLists.txt
+++ b/llvm/tools/llvm-mt/CMakeLists.txt
@@ -11,7 +11,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(MtTableGen)
 
 add_llvm_tool(llvm-mt
diff --git a/llvm/tools/llvm-nm/CMakeLists.txt 
b/llvm/tools/llvm-nm/CMakeLists.txt
index 5191e138d1c0bb..b86f5fa94fc901 100644
--- a/llvm/tools/llvm-nm/CMakeLists.txt
+++ b/llvm/tools/llvm-nm/CMakeLists.txt
@@ -14,7 +14,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(NmOptsTableGen)
 
 add_llvm_tool(llvm-nm
diff --git a/llvm/tools/llvm-objcopy/CMakeLists.txt 
b/llvm/tools/llvm-objcopy/CMakeLists.txt
index fa3105e82efcf9..41cfc9824ec5a4 100644
--- a/llvm/tools/llvm-objcopy/CMakeLists.txt
+++ b/llvm/tools/llvm-objcopy/CMakeLists.txt
@@ -9,23 +9,23 @@ set(LLVM_LINK_COMPONENTS
   )
 
 set(LLVM_TARGET_DEFINITIONS ObjcopyOpts.td)
-tablegen(LLVM ObjcopyOpts.inc -gen-opt-parser-defs)
+llvm_tablegen(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)
+llvm_tablegen(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)
+llvm_tablegen(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)
+llvm_tablegen(StripOpts.inc -gen-opt-parser-defs)
 add_public_tablegen_target(StripOptsTableGen)
 
 set(LLVM_TARGET_DEFINITIONS ExtractBundleEntryOpts.td)
-tablegen(LLVM ExtractBundleEntryOpts.inc -gen-opt-parser-defs)
+llvm_tablegen(ExtractBundleEntryOpts.inc -gen-opt-parser-defs)
 add_public_tablegen_target(ExtractBundleEntryOptsTableGen)
 
 add_llvm_tool(llvm-objcopy
diff --git a/llvm/tools/llvm-objdump/CMakeLists.txt 
b/llvm/tools/llvm-objdump/CMakeLists.txt
index d2d0e6ae91836b..98e2c2e03f24b4 100644
--- a/llvm/tools/llvm-objdump/CMakeLists.txt
+++ b/llvm/tools/llvm-objdump/CMakeLists.txt
@@ -17,11 +17,11 @@ set(LLVM_LINK_COMPONENTS
   )
 
 set(LLVM_TARGET_DEFINITIONS ObjdumpOpts.td)
-tablegen(LLVM ObjdumpOpts.inc -gen-opt-parser-defs)
+llvm_tablegen(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)
+llvm_tablegen(OtoolOpts.inc -gen-opt-parser-defs)
 add_public_tablegen_target(OtoolOptsTableGen)
 
 add_llvm_tool(llvm-objdump
diff --git a/llvm/tools/llvm-rc/CMakeLists.txt 
b/llvm/tools/llvm-rc/CMakeLists.txt
index 9fddba881d70f9..fbcd86c67b4471 100644
--- a/llvm/tools/llvm-rc/CMakeLists.txt
+++ b/llvm/tools/llvm-rc/CMakeLists.txt
@@ -6,11 +6,11 @@ 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(RcOptsTableGen)
 
 set(LLVM_TARGET_DEFINITIONS WindresOpts.td)
-tablegen(LLVM WindresOpts.inc -gen-opt-parser-defs)
+llvm_tablegen(WindresOpts.inc -gen-opt-parser-defs)
 add_public_tablegen_target(WindresOptsTableGen)
 
 add_llvm_tool(llvm-rc
diff --git a/llvm/tools/llvm-readobj/CMakeLists.txt 
b/llvm/tools/llvm-readobj/CMakeLists.txt
index 0051f87b3c1039..3b1110bde38c9f 100644
--- a/llvm/tools/llvm-readobj/CMakeLists.txt
+++ b/llvm/tools/llvm-readobj/CMakeLists.txt
@@ -10,7 +10,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(ReadobjOptsTableGen)
 
 add_llvm_tool(llvm-readobj
diff --git a/llvm/tools/llvm-readtapi/CMakeLists.txt 
b/llvm/tools/llvm-readtapi/CMakeLists.txt
index 6d83c3263c5e07..ee65239036eb52 100644
--- a/llvm/tools/llvm-readtapi/CMakeLists.txt
+++ b/llvm/tools/llvm-readtapi/CMakeLists.txt
@@ -8,7 +8,7 @@ set(LLVM_LINK_COMPONENTS
   )
 
 set(LLVM_TARGET_DEFINITIONS TapiOpts.td)
-tablegen(LLVM TapiOpts.inc -gen-opt-parser-defs)
+llvm_tablegen(TapiOpts.inc -gen-opt-parser-defs)
 add_public_tablegen_target(ReadTAPIOptsTableGen)
 
 add_llvm_tool(llvm-readtapi
diff --git a/llvm/tools/llvm-size/CMakeLists.txt 
b/llvm/tools/llvm-size/CMakeLists.txt
index a837ba672ef85d..68fca6992ec7a4 100644
--- a/llvm/tools/llvm-size/CMakeLists.txt
+++ b/llvm/tools/llvm-size/CMakeLists.txt
@@ -6,7 +6,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(SizeOptsTableGen)
 
 add_llvm_tool(llvm-size
diff --git a/llvm/tools/llvm-strings/CMakeLists.txt 
b/llvm/tools/llvm-strings/CMakeLists.txt
index 95dd69c778e477..66eb2df051430a 100644
--- a/llvm/tools/llvm-strings/CMakeLists.txt
+++ b/llvm/tools/llvm-strings/CMakeLists.txt
@@ -6,7 +6,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(StringsOptsTableGen)
 
 add_llvm_tool(llvm-strings
diff --git a/llvm/tools/llvm-symbolizer/CMakeLists.txt 
b/llvm/tools/llvm-symbolizer/CMakeLists.txt
index 15ef8337f63c4e..420ff810cab0ba 100644
--- a/llvm/tools/llvm-symbolizer/CMakeLists.txt
+++ b/llvm/tools/llvm-symbolizer/CMakeLists.txt
@@ -4,7 +4,7 @@
 # targets as well. Currently, there is no support for such a build strategy.
 
 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(SymbolizerOptsTableGen)
 
 set(LLVM_LINK_COMPONENTS
diff --git a/llvm/tools/llvm-tli-checker/CMakeLists.txt 
b/llvm/tools/llvm-tli-checker/CMakeLists.txt
index 384c09d643a252..6ffb71736ed49c 100644
--- a/llvm/tools/llvm-tli-checker/CMakeLists.txt
+++ b/llvm/tools/llvm-tli-checker/CMakeLists.txt
@@ -16,7 +16,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(TLICheckerOptsTableGen)
 
 add_llvm_tool(llvm-tli-checker
diff --git a/llvm/tools/obj2yaml/CMakeLists.txt 
b/llvm/tools/obj2yaml/CMakeLists.txt
index fb34b526a66b96..f89a6e4fe7f33a 100644
--- a/llvm/tools/obj2yaml/CMakeLists.txt
+++ b/llvm/tools/obj2yaml/CMakeLists.txt
@@ -10,7 +10,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(Obj2YamlOptsTableGen)
 
 add_llvm_utility(obj2yaml
diff --git a/llvm/tools/sancov/CMakeLists.txt b/llvm/tools/sancov/CMakeLists.txt
index a174ddf618eed6..04821375305e20 100644
--- a/llvm/tools/sancov/CMakeLists.txt
+++ b/llvm/tools/sancov/CMakeLists.txt
@@ -12,7 +12,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(SancovOptsTableGen)
 
 add_llvm_tool(sancov
diff --git a/llvm/tools/yaml2obj/CMakeLists.txt 
b/llvm/tools/yaml2obj/CMakeLists.txt
index d9d1796c555c65..be426008c0c0fb 100644
--- a/llvm/tools/yaml2obj/CMakeLists.txt
+++ b/llvm/tools/yaml2obj/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(Yaml2ObjOptsTableGen)
 
 add_llvm_utility(yaml2obj
diff --git a/llvm/unittests/Option/CMakeLists.txt 
b/llvm/unittests/Option/CMakeLists.txt
index 2c48a7e8ad4b31..a5246816223b38 100644
--- a/llvm/unittests/Option/CMakeLists.txt
+++ b/llvm/unittests/Option/CMakeLists.txt
@@ -4,13 +4,13 @@ set(LLVM_LINK_COMPONENTS
   )
 
 set(LLVM_TARGET_DEFINITIONS LibraryOpts.td)
-tablegen(LLVM LibraryOpts.inc -gen-opt-parser-defs)
+llvm_tablegen(LibraryOpts.inc -gen-opt-parser-defs)
 
 set(LLVM_TARGET_DEFINITIONS Opts.td)
-tablegen(LLVM Opts.inc -gen-opt-parser-defs)
+llvm_tablegen(Opts.inc -gen-opt-parser-defs)
 
 set(LLVM_TARGET_DEFINITIONS SubCommandOpts.td)
-tablegen(LLVM SubCommandOpts.inc -gen-opt-parser-defs)
+llvm_tablegen(SubCommandOpts.inc -gen-opt-parser-defs)
 
 add_public_tablegen_target(OptsTestTableGen)
 
diff --git a/llvm/unittests/TableGen/CMakeLists.txt 
b/llvm/unittests/TableGen/CMakeLists.txt
index 854f6c0f9b162a..4bf5023c0c3472 100644
--- a/llvm/unittests/TableGen/CMakeLists.txt
+++ b/llvm/unittests/TableGen/CMakeLists.txt
@@ -5,8 +5,8 @@ set(LLVM_LINK_COMPONENTS
 
 set(LLVM_TARGET_DEFINITIONS Automata.td)
 
-tablegen(LLVM AutomataTables.inc -gen-searchable-tables)
-tablegen(LLVM AutomataAutomata.inc -gen-automata)
+llvm_tablegen(AutomataTables.inc -gen-searchable-tables)
+llvm_tablegen(AutomataAutomata.inc -gen-automata)
 add_public_tablegen_target(AutomataTestTableGen)
 
 add_llvm_unittest(TableGenTests
diff --git a/llvm/utils/split-file/CMakeLists.txt 
b/llvm/utils/split-file/CMakeLists.txt
index ff79420979d3a3..ae7f96aa844f46 100644
--- a/llvm/utils/split-file/CMakeLists.txt
+++ b/llvm/utils/split-file/CMakeLists.txt
@@ -4,7 +4,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(SplitFileOptsTableGen)
 
 add_llvm_utility(split-file

_______________________________________________
cfe-commits mailing list
[email protected]
https://lists.llvm.org/cgi-bin/mailman/listinfo/cfe-commits

Reply via email to