[llvm] r361567 - Break false dependencies on target libraries

Daniel Sanders via llvm-commits llvm-commits at lists.llvm.org
Thu May 23 16:02:57 PDT 2019


Author: dsanders
Date: Thu May 23 16:02:56 2019
New Revision: 361567

URL: http://llvm.org/viewvc/llvm-project?rev=361567&view=rev
Log:
Break false dependencies on target libraries

Summary:
For the most part this consists of replacing ${LLVM_TARGETS_TO_BUILD} with
some combination of AllTargets* so that they depend on specific components
of a target backend rather than all of it. The overall effect of this is
that, for example, tools like opt no longer falsely depend on the
disassembler, while tools like llvm-ar no longer depend on the code
generator.

There's a couple quirks to point out here:
* AllTargetsCodeGens is a bit more prevalent than expected. Tools like dsymutil
  seem to need it which I was surprised by.
* llvm-xray linked to all the backends but doesn't seem to need any of them.
  It builds and passes the tests so that seems to be correct.
* I left gold out as it's not built when binutils is not available so I'm
  unable to test it

Reviewers: bogner, JDevlieghere

Reviewed By: bogner

Subscribers: mehdi_amini, mgorny, steven_wu, dexonsmith, rupprecht, llvm-commits

Tags: #llvm

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

Modified:
    llvm/trunk/cmake/modules/LLVM-Config.cmake
    llvm/trunk/tools/bugpoint/CMakeLists.txt
    llvm/trunk/tools/dsymutil/CMakeLists.txt
    llvm/trunk/tools/llc/CMakeLists.txt
    llvm/trunk/tools/llvm-ar/CMakeLists.txt
    llvm/trunk/tools/llvm-c-test/CMakeLists.txt
    llvm/trunk/tools/llvm-cxxdump/CMakeLists.txt
    llvm/trunk/tools/llvm-dwp/CMakeLists.txt
    llvm/trunk/tools/llvm-lto/CMakeLists.txt
    llvm/trunk/tools/llvm-lto2/CMakeLists.txt
    llvm/trunk/tools/llvm-rtdyld/CMakeLists.txt
    llvm/trunk/tools/llvm-xray/CMakeLists.txt
    llvm/trunk/tools/lto/CMakeLists.txt
    llvm/trunk/tools/opt/CMakeLists.txt

Modified: llvm/trunk/cmake/modules/LLVM-Config.cmake
URL: http://llvm.org/viewvc/llvm-project/llvm/trunk/cmake/modules/LLVM-Config.cmake?rev=361567&r1=361566&r2=361567&view=diff
==============================================================================
--- llvm/trunk/cmake/modules/LLVM-Config.cmake (original)
+++ llvm/trunk/cmake/modules/LLVM-Config.cmake Thu May 23 16:02:56 2019
@@ -209,6 +209,13 @@ function(llvm_map_components_to_libnames
       # already processed
     elseif( c STREQUAL "all" )
       list(APPEND expanded_components ${LLVM_AVAILABLE_LIBS})
+    elseif( c STREQUAL "AllTargetsCodeGens" )
+      # Link all the asm printers from all the targets
+      foreach(t ${LLVM_TARGETS_TO_BUILD})
+        if( TARGET LLVM${t}CodeGen)
+          list(APPEND expanded_components "LLVM${t}CodeGen")
+        endif()
+      endforeach(t)
     elseif( c STREQUAL "AllTargetsAsmPrinters" )
       # Link all the asm printers from all the targets
       foreach(t ${LLVM_TARGETS_TO_BUILD})

Modified: llvm/trunk/tools/bugpoint/CMakeLists.txt
URL: http://llvm.org/viewvc/llvm-project/llvm/trunk/tools/bugpoint/CMakeLists.txt?rev=361567&r1=361566&r2=361567&view=diff
==============================================================================
--- llvm/trunk/tools/bugpoint/CMakeLists.txt (original)
+++ llvm/trunk/tools/bugpoint/CMakeLists.txt Thu May 23 16:02:56 2019
@@ -1,5 +1,6 @@
 set(LLVM_LINK_COMPONENTS
-  ${LLVM_TARGETS_TO_BUILD}
+  AllTargetsAsmParsers
+  AllTargetsCodeGens
   Analysis
   BitWriter
   CodeGen

Modified: llvm/trunk/tools/dsymutil/CMakeLists.txt
URL: http://llvm.org/viewvc/llvm-project/llvm/trunk/tools/dsymutil/CMakeLists.txt?rev=361567&r1=361566&r2=361567&view=diff
==============================================================================
--- llvm/trunk/tools/dsymutil/CMakeLists.txt (original)
+++ llvm/trunk/tools/dsymutil/CMakeLists.txt Thu May 23 16:02:56 2019
@@ -1,5 +1,8 @@
 set(LLVM_LINK_COMPONENTS
-  ${LLVM_TARGETS_TO_BUILD}
+  AllTargetsAsmPrinters
+  AllTargetsCodeGens
+  AllTargetsDescs
+  AllTargetsInfos
   AsmPrinter
   DebugInfoDWARF
   MC

Modified: llvm/trunk/tools/llc/CMakeLists.txt
URL: http://llvm.org/viewvc/llvm-project/llvm/trunk/tools/llc/CMakeLists.txt?rev=361567&r1=361566&r2=361567&view=diff
==============================================================================
--- llvm/trunk/tools/llc/CMakeLists.txt (original)
+++ llvm/trunk/tools/llc/CMakeLists.txt Thu May 23 16:02:56 2019
@@ -1,5 +1,6 @@
 set(LLVM_LINK_COMPONENTS
-  ${LLVM_TARGETS_TO_BUILD}
+  AllTargetsAsmParsers
+  AllTargetsCodeGens
   Analysis
   AsmPrinter
   CodeGen

Modified: llvm/trunk/tools/llvm-ar/CMakeLists.txt
URL: http://llvm.org/viewvc/llvm-project/llvm/trunk/tools/llvm-ar/CMakeLists.txt?rev=361567&r1=361566&r2=361567&view=diff
==============================================================================
--- llvm/trunk/tools/llvm-ar/CMakeLists.txt (original)
+++ llvm/trunk/tools/llvm-ar/CMakeLists.txt Thu May 23 16:02:56 2019
@@ -1,5 +1,7 @@
 set(LLVM_LINK_COMPONENTS
-  ${LLVM_TARGETS_TO_BUILD}
+  AllTargetsAsmParsers
+  AllTargetsDescs
+  AllTargetsInfos
   BinaryFormat
   Core
   DlltoolDriver

Modified: llvm/trunk/tools/llvm-c-test/CMakeLists.txt
URL: http://llvm.org/viewvc/llvm-project/llvm/trunk/tools/llvm-c-test/CMakeLists.txt?rev=361567&r1=361566&r2=361567&view=diff
==============================================================================
--- llvm/trunk/tools/llvm-c-test/CMakeLists.txt (original)
+++ llvm/trunk/tools/llvm-c-test/CMakeLists.txt Thu May 23 16:02:56 2019
@@ -1,5 +1,7 @@
 set(LLVM_LINK_COMPONENTS
-  ${LLVM_TARGETS_TO_BUILD}
+  AllTargetsAsmParsers
+  AllTargetsCodeGens
+  AllTargetsDisassemblers
   BitReader
   Core
   MCDisassembler

Modified: llvm/trunk/tools/llvm-cxxdump/CMakeLists.txt
URL: http://llvm.org/viewvc/llvm-project/llvm/trunk/tools/llvm-cxxdump/CMakeLists.txt?rev=361567&r1=361566&r2=361567&view=diff
==============================================================================
--- llvm/trunk/tools/llvm-cxxdump/CMakeLists.txt (original)
+++ llvm/trunk/tools/llvm-cxxdump/CMakeLists.txt Thu May 23 16:02:56 2019
@@ -1,5 +1,5 @@
 set(LLVM_LINK_COMPONENTS
-  ${LLVM_TARGETS_TO_BUILD}
+  AllTargetsInfos
   Object
   Support
   )

Modified: llvm/trunk/tools/llvm-dwp/CMakeLists.txt
URL: http://llvm.org/viewvc/llvm-project/llvm/trunk/tools/llvm-dwp/CMakeLists.txt?rev=361567&r1=361566&r2=361567&view=diff
==============================================================================
--- llvm/trunk/tools/llvm-dwp/CMakeLists.txt (original)
+++ llvm/trunk/tools/llvm-dwp/CMakeLists.txt Thu May 23 16:02:56 2019
@@ -1,5 +1,6 @@
 set(LLVM_LINK_COMPONENTS
-  ${LLVM_TARGETS_TO_BUILD}
+  AllTargetsAsmParsers
+  AllTargetsCodeGens
   AsmPrinter
   DebugInfoDWARF
   MC

Modified: llvm/trunk/tools/llvm-lto/CMakeLists.txt
URL: http://llvm.org/viewvc/llvm-project/llvm/trunk/tools/llvm-lto/CMakeLists.txt?rev=361567&r1=361566&r2=361567&view=diff
==============================================================================
--- llvm/trunk/tools/llvm-lto/CMakeLists.txt (original)
+++ llvm/trunk/tools/llvm-lto/CMakeLists.txt Thu May 23 16:02:56 2019
@@ -1,5 +1,6 @@
 set(LLVM_LINK_COMPONENTS
-  ${LLVM_TARGETS_TO_BUILD}
+  AllTargetsAsmParsers
+  AllTargetsCodeGens
   BitReader
   BitWriter
   Core

Modified: llvm/trunk/tools/llvm-lto2/CMakeLists.txt
URL: http://llvm.org/viewvc/llvm-project/llvm/trunk/tools/llvm-lto2/CMakeLists.txt?rev=361567&r1=361566&r2=361567&view=diff
==============================================================================
--- llvm/trunk/tools/llvm-lto2/CMakeLists.txt (original)
+++ llvm/trunk/tools/llvm-lto2/CMakeLists.txt Thu May 23 16:02:56 2019
@@ -1,5 +1,7 @@
 set(LLVM_LINK_COMPONENTS
-  ${LLVM_TARGETS_TO_BUILD}
+  AllTargetsAsmParsers
+  AllTargetsCodeGens
+  AllTargetsDescs
   BitReader
   Core
   Linker

Modified: llvm/trunk/tools/llvm-rtdyld/CMakeLists.txt
URL: http://llvm.org/viewvc/llvm-project/llvm/trunk/tools/llvm-rtdyld/CMakeLists.txt?rev=361567&r1=361566&r2=361567&view=diff
==============================================================================
--- llvm/trunk/tools/llvm-rtdyld/CMakeLists.txt (original)
+++ llvm/trunk/tools/llvm-rtdyld/CMakeLists.txt Thu May 23 16:02:56 2019
@@ -1,5 +1,7 @@
 set(LLVM_LINK_COMPONENTS
-  ${LLVM_TARGETS_TO_BUILD}
+  AllTargetsDisassemblers
+  AllTargetsDescs
+  AllTargetsInfos
   DebugInfoDWARF
   ExecutionEngine
   MC

Modified: llvm/trunk/tools/llvm-xray/CMakeLists.txt
URL: http://llvm.org/viewvc/llvm-project/llvm/trunk/tools/llvm-xray/CMakeLists.txt?rev=361567&r1=361566&r2=361567&view=diff
==============================================================================
--- llvm/trunk/tools/llvm-xray/CMakeLists.txt (original)
+++ llvm/trunk/tools/llvm-xray/CMakeLists.txt Thu May 23 16:02:56 2019
@@ -1,5 +1,4 @@
 set(LLVM_LINK_COMPONENTS
-  ${LLVM_TARGETS_TO_BUILD}
   DebugInfoDWARF
   Object
   Support

Modified: llvm/trunk/tools/lto/CMakeLists.txt
URL: http://llvm.org/viewvc/llvm-project/llvm/trunk/tools/lto/CMakeLists.txt?rev=361567&r1=361566&r2=361567&view=diff
==============================================================================
--- llvm/trunk/tools/lto/CMakeLists.txt (original)
+++ llvm/trunk/tools/lto/CMakeLists.txt Thu May 23 16:02:56 2019
@@ -1,5 +1,9 @@
 set(LLVM_LINK_COMPONENTS
-  ${LLVM_TARGETS_TO_BUILD}
+  AllTargetsAsmParsers
+  AllTargetsCodeGens
+  AllTargetsDescs
+  AllTargetsDisassemblers
+  AllTargetsInfos
   BitReader
   Core
   LTO

Modified: llvm/trunk/tools/opt/CMakeLists.txt
URL: http://llvm.org/viewvc/llvm-project/llvm/trunk/tools/opt/CMakeLists.txt?rev=361567&r1=361566&r2=361567&view=diff
==============================================================================
--- llvm/trunk/tools/opt/CMakeLists.txt (original)
+++ llvm/trunk/tools/opt/CMakeLists.txt Thu May 23 16:02:56 2019
@@ -1,5 +1,7 @@
 set(LLVM_LINK_COMPONENTS
-  ${LLVM_TARGETS_TO_BUILD}
+  AllTargetsAsmParsers
+  AllTargetsCodeGens
+  AllTargetsInfos
   AggressiveInstCombine
   Analysis
   BitWriter




More information about the llvm-commits mailing list