Skip to content

Commit 418516e

Browse files
committed
This commit reorganizes LINK_COMPONENTS into three sections.
Using AArch64 as an example, the first section lists the target specific files: AArch64Desc, AArch64Info and AArch64Utils. The second section is ${TARGET_LIBRARIES}, a new CMake variable which is inherited from Target/CMakelists.txt. TARGET_LIBRARIES factors out 14 boilerplate libraries: Analysis, AsmPrinter, CodeGen, CodeGenTypes, Core, Instrumentation, IPO, MC, Scalar, SelectionDAG, Support, Target, TargetParser and TransformUtils. The third (and optional) section lists any additional non-boilerplate libraries: CFGuard, GlobalISel and Vectorize in the case of AArch64. The result looks like: LINK_COMPONENTS AArch64Desc AArch64Info AArch64Utils ${TARGET_LIBRARIES} CFGuard GlobalISel Vectorize Currently, some LLVM libraries are in most yet not all of the backend CMakelists.txt files. For example, Analysis is missing from AVR, MSP430, Sparc and Xtensa. Of course, Analysis is not used in those backends but then something like adding a call from an STI reference to an Analysis function would result in a build error coming from one of them, even if you're not working on that particular backend. However, standardizing these boilerplate libraries into an expansive+common list prevents these sort of build issues from happening while neither increasing binary sizes nor appreciably increasing build times.
1 parent 51a03ed commit 418516e

26 files changed

+52
-292
lines changed

llvm/lib/Target/AArch64/CMakeLists.txt

Lines changed: 1 addition & 12 deletions
Original file line numberDiff line numberDiff line change
@@ -98,20 +98,9 @@ add_llvm_target(AArch64CodeGen
9898
AArch64Desc
9999
AArch64Info
100100
AArch64Utils
101-
Analysis
102-
AsmPrinter
101+
${TARGET_LIBRARIES}
103102
CFGuard
104-
CodeGen
105-
CodeGenTypes
106-
Core
107103
GlobalISel
108-
MC
109-
Scalar
110-
SelectionDAG
111-
Support
112-
Target
113-
TargetParser
114-
TransformUtils
115104
Vectorize
116105

117106
ADD_TO_COMPONENT

llvm/lib/Target/AMDGPU/CMakeLists.txt

Lines changed: 1 addition & 14 deletions
Original file line numberDiff line numberDiff line change
@@ -185,26 +185,13 @@ add_llvm_target(AMDGPUCodeGen
185185
AMDGPUDesc
186186
AMDGPUInfo
187187
AMDGPUUtils
188-
Analysis
189-
AsmPrinter
188+
${TARGET_LIBRARIES}
190189
BinaryFormat
191-
CodeGen
192-
CodeGenTypes
193-
Core
194190
GlobalISel
195191
HipStdPar
196-
IPO
197192
IRPrinter
198-
Instrumentation
199-
MC
200193
MIRParser
201194
Passes
202-
Scalar
203-
SelectionDAG
204-
Support
205-
Target
206-
TargetParser
207-
TransformUtils
208195
Vectorize
209196

210197
ADD_TO_COMPONENT

llvm/lib/Target/ARC/CMakeLists.txt

Lines changed: 1 addition & 11 deletions
Original file line numberDiff line numberDiff line change
@@ -32,17 +32,7 @@ add_llvm_target(ARCCodeGen
3232
LINK_COMPONENTS
3333
ARCDesc
3434
ARCInfo
35-
Analysis
36-
AsmPrinter
37-
CodeGen
38-
CodeGenTypes
39-
Core
40-
MC
41-
SelectionDAG
42-
Support
43-
Target
44-
TargetParser
45-
TransformUtils
35+
${TARGET_LIBRARIES}
4636

4737
ADD_TO_COMPONENT
4838
ARC

llvm/lib/Target/ARM/CMakeLists.txt

Lines changed: 1 addition & 13 deletions
Original file line numberDiff line numberDiff line change
@@ -74,21 +74,9 @@ add_llvm_target(ARMCodeGen
7474
ARMDesc
7575
ARMInfo
7676
ARMUtils
77-
Analysis
78-
AsmPrinter
77+
${TARGET_LIBRARIES}
7978
CFGuard
80-
CodeGen
81-
CodeGenTypes
82-
Core
8379
GlobalISel
84-
IPO
85-
MC
86-
Scalar
87-
SelectionDAG
88-
Support
89-
Target
90-
TargetParser
91-
TransformUtils
9280

9381
ADD_TO_COMPONENT
9482
ARM

llvm/lib/Target/AVR/CMakeLists.txt

Lines changed: 1 addition & 8 deletions
Original file line numberDiff line numberDiff line change
@@ -36,14 +36,7 @@ add_llvm_target(AVRCodeGen
3636
LINK_COMPONENTS
3737
AVRDesc
3838
AVRInfo
39-
AsmPrinter
40-
CodeGen
41-
CodeGenTypes
42-
Core
43-
MC
44-
SelectionDAG
45-
Support
46-
Target
39+
${TARGET_LIBRARIES}
4740

4841
ADD_TO_COMPONENT
4942
AVR

llvm/lib/Target/BPF/CMakeLists.txt

Lines changed: 1 addition & 13 deletions
Original file line numberDiff line numberDiff line change
@@ -44,23 +44,11 @@ add_llvm_target(BPFCodeGen
4444
BTFDebug.cpp
4545

4646
LINK_COMPONENTS
47-
Analysis
48-
AsmPrinter
4947
BPFDesc
5048
BPFInfo
51-
CodeGen
52-
CodeGenTypes
53-
Core
49+
${TARGET_LIBRARIES}
5450
GlobalISel
55-
IPO
56-
MC
5751
Passes
58-
Scalar
59-
SelectionDAG
60-
Support
61-
Target
62-
TargetParser
63-
TransformUtils
6452

6553
ADD_TO_COMPONENT
6654
BPF

llvm/lib/Target/CMakeLists.txt

Lines changed: 16 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -19,6 +19,22 @@ add_llvm_component_library(LLVMTarget
1919
TargetParser
2020
)
2121

22+
set(TARGET_LIBRARIES
23+
Analysis
24+
AsmPrinter
25+
CodeGen
26+
CodeGenTypes
27+
Core
28+
Instrumentation
29+
IPO
30+
MC
31+
Scalar
32+
SelectionDAG
33+
Support
34+
Target
35+
TargetParser
36+
TransformUtils)
37+
2238
# When building shared objects for each target there are some internal APIs
2339
# that are used across shared objects which we can't hide.
2440
if (NOT BUILD_SHARED_LIBS AND NOT APPLE AND

llvm/lib/Target/CSKY/CMakeLists.txt

Lines changed: 1 addition & 9 deletions
Original file line numberDiff line numberDiff line change
@@ -33,17 +33,9 @@ add_llvm_target(CSKYCodeGen
3333
CSKYTargetObjectFile.cpp
3434

3535
LINK_COMPONENTS
36-
Analysis
37-
AsmPrinter
3836
CSKYDesc
3937
CSKYInfo
40-
CodeGen
41-
CodeGenTypes
42-
Core
43-
MC
44-
SelectionDAG
45-
Support
46-
Target
38+
${TARGET_LIBRARIES}
4739

4840
ADD_TO_COMPONENT
4941
CSKY

llvm/lib/Target/DirectX/CMakeLists.txt

Lines changed: 2 additions & 13 deletions
Original file line numberDiff line numberDiff line change
@@ -39,23 +39,12 @@ add_llvm_target(DirectXCodeGen
3939
DXILLegalizePass.cpp
4040

4141
LINK_COMPONENTS
42-
Analysis
43-
AsmPrinter
44-
CodeGen
45-
CodeGenTypes
46-
Core
47-
DXILBitWriter
4842
DirectXDesc
4943
DirectXInfo
5044
DirectXPointerTypeAnalysis
45+
DXILBitWriter
46+
${TARGET_LIBRARIES}
5147
FrontendHLSL
52-
MC
53-
ScalarOpts
54-
SelectionDAG
55-
Support
56-
Target
57-
TargetParser
58-
TransformUtils
5948

6049
ADD_TO_COMPONENT
6150
DirectX

llvm/lib/Target/Hexagon/CMakeLists.txt

Lines changed: 1 addition & 13 deletions
Original file line numberDiff line numberDiff line change
@@ -74,22 +74,10 @@ add_llvm_target(HexagonCodeGen
7474
RDFDeadCode.cpp
7575

7676
LINK_COMPONENTS
77-
Analysis
78-
AsmPrinter
79-
CodeGen
80-
CodeGenTypes
81-
Core
8277
HexagonAsmParser
8378
HexagonDesc
8479
HexagonInfo
85-
IPO
86-
MC
87-
Scalar
88-
SelectionDAG
89-
Support
90-
Target
91-
TargetParser
92-
TransformUtils
80+
${TARGET_LIBRARIES}
9381

9482
ADD_TO_COMPONENT
9583
Hexagon

0 commit comments

Comments
 (0)