]> granicus.if.org Git - llvm/commitdiff
Break false dependencies on target libraries
authorDaniel Sanders <daniel_l_sanders@apple.com>
Thu, 23 May 2019 23:02:56 +0000 (23:02 +0000)
committerDaniel Sanders <daniel_l_sanders@apple.com>
Thu, 23 May 2019 23:02:56 +0000 (23:02 +0000)
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

git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@361567 91177308-0d34-0410-b5e6-96231b3b80d8

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

index 474a874a4426ec873351595752618499f5c88f38..57c02f170e18f5bedfe2e380aca8bc06fccdb6f5 100644 (file)
@@ -209,6 +209,13 @@ function(llvm_map_components_to_libnames out_libs)
       # 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})
index 654ecc496a919b498cc48b4cc9d11ecc600ed951..6ed15a24a2d4d38bfb0d1cddf1ed896759e4d2fc 100644 (file)
@@ -1,5 +1,6 @@
 set(LLVM_LINK_COMPONENTS
-  ${LLVM_TARGETS_TO_BUILD}
+  AllTargetsAsmParsers
+  AllTargetsCodeGens
   Analysis
   BitWriter
   CodeGen
index 480f78fb1888cce4ca1a8794667e285c1a759bf4..19865e3d20e1429e7ee5188e76c71b7826a9a857 100644 (file)
@@ -1,5 +1,8 @@
 set(LLVM_LINK_COMPONENTS
-  ${LLVM_TARGETS_TO_BUILD}
+  AllTargetsAsmPrinters
+  AllTargetsCodeGens
+  AllTargetsDescs
+  AllTargetsInfos
   AsmPrinter
   DebugInfoDWARF
   MC
index 4f8181a1b6577e33b04fd4f479b06672d84e801b..863358b5e71c73c838b3afba97366441ea771f8c 100644 (file)
@@ -1,5 +1,6 @@
 set(LLVM_LINK_COMPONENTS
-  ${LLVM_TARGETS_TO_BUILD}
+  AllTargetsAsmParsers
+  AllTargetsCodeGens
   Analysis
   AsmPrinter
   CodeGen
index 191c684d5245eb90c79c4994a3e2b92d78f2c2fb..602b4a46ea055c5be34252418639ef424193033f 100644 (file)
@@ -1,5 +1,7 @@
 set(LLVM_LINK_COMPONENTS
-  ${LLVM_TARGETS_TO_BUILD}
+  AllTargetsAsmParsers
+  AllTargetsDescs
+  AllTargetsInfos
   BinaryFormat
   Core
   DlltoolDriver
index bce0f4a5a4209d0f025de0837aa08d5356a52e1a..78eaafc3b5a403f8a4767a6fd5792aac7667c5fe 100644 (file)
@@ -1,5 +1,7 @@
 set(LLVM_LINK_COMPONENTS
-  ${LLVM_TARGETS_TO_BUILD}
+  AllTargetsAsmParsers
+  AllTargetsCodeGens
+  AllTargetsDisassemblers
   BitReader
   Core
   MCDisassembler
index ada886e888734225f53b575365ded0b89be2f112..519e728e87b6f5267ba9e303bf3f42ac968f80c5 100644 (file)
@@ -1,5 +1,5 @@
 set(LLVM_LINK_COMPONENTS
-  ${LLVM_TARGETS_TO_BUILD}
+  AllTargetsInfos
   Object
   Support
   )
index 1b5fbddc1f75090349579cf537bd43e5d77247d7..49f40b5c6397b6732d66d0ac9c4fb15a93809dec 100644 (file)
@@ -1,5 +1,6 @@
 set(LLVM_LINK_COMPONENTS
-  ${LLVM_TARGETS_TO_BUILD}
+  AllTargetsAsmParsers
+  AllTargetsCodeGens
   AsmPrinter
   DebugInfoDWARF
   MC
index f0b385b7993d210d86bc4880a254cc46525ce191..d0222315d25f7e5c7a9c6db88d085246bccbfa90 100644 (file)
@@ -1,5 +1,6 @@
 set(LLVM_LINK_COMPONENTS
-  ${LLVM_TARGETS_TO_BUILD}
+  AllTargetsAsmParsers
+  AllTargetsCodeGens
   BitReader
   BitWriter
   Core
index 9be12d71ed793e18b670c4f7bb03be5dbc7c9d2b..233817a387f9d9940a439bf2129465fe5ec1a395 100644 (file)
@@ -1,5 +1,7 @@
 set(LLVM_LINK_COMPONENTS
-  ${LLVM_TARGETS_TO_BUILD}
+  AllTargetsAsmParsers
+  AllTargetsCodeGens
+  AllTargetsDescs
   BitReader
   Core
   Linker
index c1acbe5846bdb549808e5812352076f7f83b446d..e1738633cfc39039bb6497e7eff029b4aacdd0ea 100644 (file)
@@ -1,5 +1,7 @@
 set(LLVM_LINK_COMPONENTS
-  ${LLVM_TARGETS_TO_BUILD}
+  AllTargetsDisassemblers
+  AllTargetsDescs
+  AllTargetsInfos
   DebugInfoDWARF
   ExecutionEngine
   MC
index 4b056d10758f9818b86e3db3a538d0e048d98e93..2551b97e550dc9c2d3231f73bc294cb92c9c1883 100644 (file)
@@ -1,5 +1,4 @@
 set(LLVM_LINK_COMPONENTS
-  ${LLVM_TARGETS_TO_BUILD}
   DebugInfoDWARF
   Object
   Support
index 6e913519a809a3afa6115665561e9272d4e52c60..20118e029f827a35ae91cc000303806e509234db 100644 (file)
@@ -1,5 +1,9 @@
 set(LLVM_LINK_COMPONENTS
-  ${LLVM_TARGETS_TO_BUILD}
+  AllTargetsAsmParsers
+  AllTargetsCodeGens
+  AllTargetsDescs
+  AllTargetsDisassemblers
+  AllTargetsInfos
   BitReader
   Core
   LTO
index f03d11516657f14a8cb877a2941a14f596d3b018..2f9665c6898075920ce57f64394d8863897fefa7 100644 (file)
@@ -1,5 +1,7 @@
 set(LLVM_LINK_COMPONENTS
-  ${LLVM_TARGETS_TO_BUILD}
+  AllTargetsAsmParsers
+  AllTargetsCodeGens
+  AllTargetsInfos
   AggressiveInstCombine
   Analysis
   BitWriter