[llvm] 2c3cf62 - Make TableGenGlobalISel an object library

Aaron Puchert via llvm-commits llvm-commits at lists.llvm.org
Wed Mar 31 13:22:11 PDT 2021


Author: Aaron Puchert
Date: 2021-03-31T22:20:56+02:00
New Revision: 2c3cf62d4a26de85aab180bb43a579c913b17f3e

URL: https://github.com/llvm/llvm-project/commit/2c3cf62d4a26de85aab180bb43a579c913b17f3e
DIFF: https://github.com/llvm/llvm-project/commit/2c3cf62d4a26de85aab180bb43a579c913b17f3e.diff

LOG: Make TableGenGlobalISel an object library

That's how it was originally intended but that wasn't possible because
we still needed to support older CMake versions.

The problem here is that the sources in TableGenGlobalISel are meant to
be linked into both llvm-tblgen and TableGenTests (a unit test), but not
be part of LLVM proper. So they shouldn't be an ordinary LLVM component.
Because they are used in llvm-tblgen, they can't draw in the LLVM dylib
dependency, but then we'd have to do the same thing in TableGenTests to
make sure we don't link both a static Support library and another copy
through the LLVM dylib.

With an object library we're just reusing the object files and don't
have to care about dependencies at all.

Reviewed By: beanz

Differential Revision: https://reviews.llvm.org/D74588

Added: 
    

Modified: 
    llvm/unittests/TableGen/CMakeLists.txt
    llvm/utils/TableGen/CMakeLists.txt
    llvm/utils/TableGen/GlobalISel/CMakeLists.txt

Removed: 
    


################################################################################
diff  --git a/llvm/unittests/TableGen/CMakeLists.txt b/llvm/unittests/TableGen/CMakeLists.txt
index 178018ba89674..c678f2b639d97 100644
--- a/llvm/unittests/TableGen/CMakeLists.txt
+++ b/llvm/unittests/TableGen/CMakeLists.txt
@@ -12,6 +12,7 @@ add_public_tablegen_target(AutomataTestTableGen)
 add_llvm_unittest(TableGenTests
   CodeExpanderTest.cpp
   AutomataTest.cpp
+  $<TARGET_OBJECTS:obj.LLVMTableGenGlobalISel>
   )
 include_directories(${CMAKE_CURRENT_SOURCE_DIR}/../../utils/TableGen)
-target_link_libraries(TableGenTests PRIVATE LLVMTableGenGlobalISel LLVMTableGen)
+target_link_libraries(TableGenTests PRIVATE LLVMTableGen)

diff  --git a/llvm/utils/TableGen/CMakeLists.txt b/llvm/utils/TableGen/CMakeLists.txt
index 9e918852b1c0f..8b01a40f3ad58 100644
--- a/llvm/utils/TableGen/CMakeLists.txt
+++ b/llvm/utils/TableGen/CMakeLists.txt
@@ -56,6 +56,6 @@ add_tablegen(llvm-tblgen LLVM
   X86RecognizableInstr.cpp
   WebAssemblyDisassemblerEmitter.cpp
   CTagsEmitter.cpp
+  $<TARGET_OBJECTS:obj.LLVMTableGenGlobalISel>
   )
-target_link_libraries(llvm-tblgen PRIVATE LLVMTableGenGlobalISel)
 set_target_properties(llvm-tblgen PROPERTIES FOLDER "Tablegenning")

diff  --git a/llvm/utils/TableGen/GlobalISel/CMakeLists.txt b/llvm/utils/TableGen/GlobalISel/CMakeLists.txt
index c23ef6742f32e..1cd741cd6be1a 100644
--- a/llvm/utils/TableGen/GlobalISel/CMakeLists.txt
+++ b/llvm/utils/TableGen/GlobalISel/CMakeLists.txt
@@ -3,7 +3,7 @@ set(LLVM_LINK_COMPONENTS
   TableGen
   )
 
-add_llvm_library(LLVMTableGenGlobalISel STATIC DISABLE_LLVM_LINK_LLVM_DYLIB
+add_llvm_library(LLVMTableGenGlobalISel OBJECT
                  CodeExpander.cpp
                  GIMatchDag.cpp
                  GIMatchDagEdge.cpp


        


More information about the llvm-commits mailing list