Skip to content

Commit

Permalink
Break false dependencies on target libraries
Browse files Browse the repository at this point in the history
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
  • Loading branch information
dsandersllvm committed May 23, 2019
1 parent e94ac06 commit 6519fa1
Show file tree
Hide file tree
Showing 14 changed files with 40 additions and 13 deletions.
7 changes: 7 additions & 0 deletions cmake/modules/LLVM-Config.cmake
Original file line number Diff line number Diff line change
Expand Up @@ -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})
Expand Down
3 changes: 2 additions & 1 deletion tools/bugpoint/CMakeLists.txt
Original file line number Diff line number Diff line change
@@ -1,5 +1,6 @@
set(LLVM_LINK_COMPONENTS
${LLVM_TARGETS_TO_BUILD}
AllTargetsAsmParsers
AllTargetsCodeGens
Analysis
BitWriter
CodeGen
Expand Down
5 changes: 4 additions & 1 deletion tools/dsymutil/CMakeLists.txt
Original file line number Diff line number Diff line change
@@ -1,5 +1,8 @@
set(LLVM_LINK_COMPONENTS
${LLVM_TARGETS_TO_BUILD}
AllTargetsAsmPrinters
AllTargetsCodeGens
AllTargetsDescs
AllTargetsInfos
AsmPrinter
DebugInfoDWARF
MC
Expand Down
3 changes: 2 additions & 1 deletion tools/llc/CMakeLists.txt
Original file line number Diff line number Diff line change
@@ -1,5 +1,6 @@
set(LLVM_LINK_COMPONENTS
${LLVM_TARGETS_TO_BUILD}
AllTargetsAsmParsers
AllTargetsCodeGens
Analysis
AsmPrinter
CodeGen
Expand Down
4 changes: 3 additions & 1 deletion tools/llvm-ar/CMakeLists.txt
Original file line number Diff line number Diff line change
@@ -1,5 +1,7 @@
set(LLVM_LINK_COMPONENTS
${LLVM_TARGETS_TO_BUILD}
AllTargetsAsmParsers
AllTargetsDescs
AllTargetsInfos
BinaryFormat
Core
DlltoolDriver
Expand Down
4 changes: 3 additions & 1 deletion tools/llvm-c-test/CMakeLists.txt
Original file line number Diff line number Diff line change
@@ -1,5 +1,7 @@
set(LLVM_LINK_COMPONENTS
${LLVM_TARGETS_TO_BUILD}
AllTargetsAsmParsers
AllTargetsCodeGens
AllTargetsDisassemblers
BitReader
Core
MCDisassembler
Expand Down
2 changes: 1 addition & 1 deletion tools/llvm-cxxdump/CMakeLists.txt
Original file line number Diff line number Diff line change
@@ -1,5 +1,5 @@
set(LLVM_LINK_COMPONENTS
${LLVM_TARGETS_TO_BUILD}
AllTargetsInfos
Object
Support
)
Expand Down
3 changes: 2 additions & 1 deletion tools/llvm-dwp/CMakeLists.txt
Original file line number Diff line number Diff line change
@@ -1,5 +1,6 @@
set(LLVM_LINK_COMPONENTS
${LLVM_TARGETS_TO_BUILD}
AllTargetsAsmParsers
AllTargetsCodeGens
AsmPrinter
DebugInfoDWARF
MC
Expand Down
3 changes: 2 additions & 1 deletion tools/llvm-lto/CMakeLists.txt
Original file line number Diff line number Diff line change
@@ -1,5 +1,6 @@
set(LLVM_LINK_COMPONENTS
${LLVM_TARGETS_TO_BUILD}
AllTargetsAsmParsers
AllTargetsCodeGens
BitReader
BitWriter
Core
Expand Down
4 changes: 3 additions & 1 deletion tools/llvm-lto2/CMakeLists.txt
Original file line number Diff line number Diff line change
@@ -1,5 +1,7 @@
set(LLVM_LINK_COMPONENTS
${LLVM_TARGETS_TO_BUILD}
AllTargetsAsmParsers
AllTargetsCodeGens
AllTargetsDescs
BitReader
Core
Linker
Expand Down
4 changes: 3 additions & 1 deletion tools/llvm-rtdyld/CMakeLists.txt
Original file line number Diff line number Diff line change
@@ -1,5 +1,7 @@
set(LLVM_LINK_COMPONENTS
${LLVM_TARGETS_TO_BUILD}
AllTargetsDisassemblers
AllTargetsDescs
AllTargetsInfos
DebugInfoDWARF
ExecutionEngine
MC
Expand Down
1 change: 0 additions & 1 deletion tools/llvm-xray/CMakeLists.txt
Original file line number Diff line number Diff line change
@@ -1,5 +1,4 @@
set(LLVM_LINK_COMPONENTS
${LLVM_TARGETS_TO_BUILD}
DebugInfoDWARF
Object
Support
Expand Down
6 changes: 5 additions & 1 deletion tools/lto/CMakeLists.txt
Original file line number Diff line number Diff line change
@@ -1,5 +1,9 @@
set(LLVM_LINK_COMPONENTS
${LLVM_TARGETS_TO_BUILD}
AllTargetsAsmParsers
AllTargetsCodeGens
AllTargetsDescs
AllTargetsDisassemblers
AllTargetsInfos
BitReader
Core
LTO
Expand Down
4 changes: 3 additions & 1 deletion tools/opt/CMakeLists.txt
Original file line number Diff line number Diff line change
@@ -1,5 +1,7 @@
set(LLVM_LINK_COMPONENTS
${LLVM_TARGETS_TO_BUILD}
AllTargetsAsmParsers
AllTargetsCodeGens
AllTargetsInfos
AggressiveInstCombine
Analysis
BitWriter
Expand Down

0 comments on commit 6519fa1

Please sign in to comment.