-
Notifications
You must be signed in to change notification settings - Fork 13.5k
[CMake] Move common target dependencies into ${TARGET_LIBRARIES} #141271
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
base: main
Are you sure you want to change the base?
Conversation
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.
@llvm/pr-subscribers-backend-m68k @llvm/pr-subscribers-backend-nvptx Author: LLChris (CBSears) ChangesUsing 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 Why? 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. Full diff: https://github.com/llvm/llvm-project/pull/141271.diff 26 Files Affected:
diff --git a/llvm/lib/Target/AArch64/CMakeLists.txt b/llvm/lib/Target/AArch64/CMakeLists.txt
index 583003f2f46e6..ea37cdcf53bbf 100644
--- a/llvm/lib/Target/AArch64/CMakeLists.txt
+++ b/llvm/lib/Target/AArch64/CMakeLists.txt
@@ -98,20 +98,9 @@ add_llvm_target(AArch64CodeGen
AArch64Desc
AArch64Info
AArch64Utils
- Analysis
- AsmPrinter
+ ${TARGET_LIBRARIES}
CFGuard
- CodeGen
- CodeGenTypes
- Core
GlobalISel
- MC
- Scalar
- SelectionDAG
- Support
- Target
- TargetParser
- TransformUtils
Vectorize
ADD_TO_COMPONENT
diff --git a/llvm/lib/Target/AMDGPU/CMakeLists.txt b/llvm/lib/Target/AMDGPU/CMakeLists.txt
index c6d70ee39202e..88c7bf815ec6f 100644
--- a/llvm/lib/Target/AMDGPU/CMakeLists.txt
+++ b/llvm/lib/Target/AMDGPU/CMakeLists.txt
@@ -185,26 +185,13 @@ add_llvm_target(AMDGPUCodeGen
AMDGPUDesc
AMDGPUInfo
AMDGPUUtils
- Analysis
- AsmPrinter
+ ${TARGET_LIBRARIES}
BinaryFormat
- CodeGen
- CodeGenTypes
- Core
GlobalISel
HipStdPar
- IPO
IRPrinter
- Instrumentation
- MC
MIRParser
Passes
- Scalar
- SelectionDAG
- Support
- Target
- TargetParser
- TransformUtils
Vectorize
ADD_TO_COMPONENT
diff --git a/llvm/lib/Target/ARC/CMakeLists.txt b/llvm/lib/Target/ARC/CMakeLists.txt
index 196cc31cc5080..d1fa1ec912c35 100644
--- a/llvm/lib/Target/ARC/CMakeLists.txt
+++ b/llvm/lib/Target/ARC/CMakeLists.txt
@@ -32,17 +32,7 @@ add_llvm_target(ARCCodeGen
LINK_COMPONENTS
ARCDesc
ARCInfo
- Analysis
- AsmPrinter
- CodeGen
- CodeGenTypes
- Core
- MC
- SelectionDAG
- Support
- Target
- TargetParser
- TransformUtils
+ ${TARGET_LIBRARIES}
ADD_TO_COMPONENT
ARC
diff --git a/llvm/lib/Target/ARM/CMakeLists.txt b/llvm/lib/Target/ARM/CMakeLists.txt
index a39629bd8aeb0..1610d88ce8b75 100644
--- a/llvm/lib/Target/ARM/CMakeLists.txt
+++ b/llvm/lib/Target/ARM/CMakeLists.txt
@@ -74,21 +74,9 @@ add_llvm_target(ARMCodeGen
ARMDesc
ARMInfo
ARMUtils
- Analysis
- AsmPrinter
+ ${TARGET_LIBRARIES}
CFGuard
- CodeGen
- CodeGenTypes
- Core
GlobalISel
- IPO
- MC
- Scalar
- SelectionDAG
- Support
- Target
- TargetParser
- TransformUtils
ADD_TO_COMPONENT
ARM
diff --git a/llvm/lib/Target/AVR/CMakeLists.txt b/llvm/lib/Target/AVR/CMakeLists.txt
index 781dac02c7083..b18013fae6b47 100644
--- a/llvm/lib/Target/AVR/CMakeLists.txt
+++ b/llvm/lib/Target/AVR/CMakeLists.txt
@@ -36,14 +36,7 @@ add_llvm_target(AVRCodeGen
LINK_COMPONENTS
AVRDesc
AVRInfo
- AsmPrinter
- CodeGen
- CodeGenTypes
- Core
- MC
- SelectionDAG
- Support
- Target
+ ${TARGET_LIBRARIES}
ADD_TO_COMPONENT
AVR
diff --git a/llvm/lib/Target/BPF/CMakeLists.txt b/llvm/lib/Target/BPF/CMakeLists.txt
index eade4cacb7100..cf695cd6d5ceb 100644
--- a/llvm/lib/Target/BPF/CMakeLists.txt
+++ b/llvm/lib/Target/BPF/CMakeLists.txt
@@ -44,23 +44,11 @@ add_llvm_target(BPFCodeGen
BTFDebug.cpp
LINK_COMPONENTS
- Analysis
- AsmPrinter
BPFDesc
BPFInfo
- CodeGen
- CodeGenTypes
- Core
+ ${TARGET_LIBRARIES}
GlobalISel
- IPO
- MC
Passes
- Scalar
- SelectionDAG
- Support
- Target
- TargetParser
- TransformUtils
ADD_TO_COMPONENT
BPF
diff --git a/llvm/lib/Target/CMakeLists.txt b/llvm/lib/Target/CMakeLists.txt
index 9472288229cac..84248fb80a32a 100644
--- a/llvm/lib/Target/CMakeLists.txt
+++ b/llvm/lib/Target/CMakeLists.txt
@@ -19,6 +19,22 @@ add_llvm_component_library(LLVMTarget
TargetParser
)
+set(TARGET_LIBRARIES
+ Analysis
+ AsmPrinter
+ CodeGen
+ CodeGenTypes
+ Core
+ Instrumentation
+ IPO
+ MC
+ Scalar
+ SelectionDAG
+ Support
+ Target
+ TargetParser
+ TransformUtils)
+
# When building shared objects for each target there are some internal APIs
# that are used across shared objects which we can't hide.
if (NOT BUILD_SHARED_LIBS AND NOT APPLE AND
diff --git a/llvm/lib/Target/CSKY/CMakeLists.txt b/llvm/lib/Target/CSKY/CMakeLists.txt
index 4b900bc99c271..78282455309bd 100644
--- a/llvm/lib/Target/CSKY/CMakeLists.txt
+++ b/llvm/lib/Target/CSKY/CMakeLists.txt
@@ -33,17 +33,9 @@ add_llvm_target(CSKYCodeGen
CSKYTargetObjectFile.cpp
LINK_COMPONENTS
- Analysis
- AsmPrinter
CSKYDesc
CSKYInfo
- CodeGen
- CodeGenTypes
- Core
- MC
- SelectionDAG
- Support
- Target
+ ${TARGET_LIBRARIES}
ADD_TO_COMPONENT
CSKY
diff --git a/llvm/lib/Target/DirectX/CMakeLists.txt b/llvm/lib/Target/DirectX/CMakeLists.txt
index c7c09caf43667..c4a869ca8b5e8 100644
--- a/llvm/lib/Target/DirectX/CMakeLists.txt
+++ b/llvm/lib/Target/DirectX/CMakeLists.txt
@@ -39,23 +39,12 @@ add_llvm_target(DirectXCodeGen
DXILLegalizePass.cpp
LINK_COMPONENTS
- Analysis
- AsmPrinter
- CodeGen
- CodeGenTypes
- Core
DXILBitWriter
DirectXDesc
DirectXInfo
DirectXPointerTypeAnalysis
FrontendHLSL
- MC
- ScalarOpts
- SelectionDAG
- Support
- Target
- TargetParser
- TransformUtils
+ ${TARGET_LIBRARIES}
ADD_TO_COMPONENT
DirectX
diff --git a/llvm/lib/Target/Hexagon/CMakeLists.txt b/llvm/lib/Target/Hexagon/CMakeLists.txt
index d758260a8ab5d..072eea5c7885a 100644
--- a/llvm/lib/Target/Hexagon/CMakeLists.txt
+++ b/llvm/lib/Target/Hexagon/CMakeLists.txt
@@ -74,22 +74,10 @@ add_llvm_target(HexagonCodeGen
RDFDeadCode.cpp
LINK_COMPONENTS
- Analysis
- AsmPrinter
- CodeGen
- CodeGenTypes
- Core
HexagonAsmParser
HexagonDesc
HexagonInfo
- IPO
- MC
- Scalar
- SelectionDAG
- Support
- Target
- TargetParser
- TransformUtils
+ ${TARGET_LIBRARIES}
ADD_TO_COMPONENT
Hexagon
diff --git a/llvm/lib/Target/Lanai/CMakeLists.txt b/llvm/lib/Target/Lanai/CMakeLists.txt
index 4a628e13fc177..32e34747142d2 100644
--- a/llvm/lib/Target/Lanai/CMakeLists.txt
+++ b/llvm/lib/Target/Lanai/CMakeLists.txt
@@ -32,20 +32,10 @@ add_llvm_target(LanaiCodeGen
LanaiTargetObjectFile.cpp
LINK_COMPONENTS
- Analysis
- AsmPrinter
- CodeGen
- CodeGenTypes
- Core
LanaiAsmParser
LanaiDesc
LanaiInfo
- MC
- SelectionDAG
- Support
- Target
- TargetParser
- TransformUtils
+ ${TARGET_LIBRARIES}
ADD_TO_COMPONENT
Lanai
diff --git a/llvm/lib/Target/LoongArch/CMakeLists.txt b/llvm/lib/Target/LoongArch/CMakeLists.txt
index 0f674b1b0fa9e..909d0dca79b48 100644
--- a/llvm/lib/Target/LoongArch/CMakeLists.txt
+++ b/llvm/lib/Target/LoongArch/CMakeLists.txt
@@ -32,20 +32,9 @@ add_llvm_target(LoongArchCodeGen
LoongArchTargetTransformInfo.cpp
LINK_COMPONENTS
- Analysis
- AsmPrinter
- CodeGen
- CodeGenTypes
- Core
LoongArchDesc
LoongArchInfo
- MC
- Scalar
- SelectionDAG
- Support
- Target
- TargetParser
- TransformUtils
+ ${TARGET_LIBRARIES}
ADD_TO_COMPONENT
LoongArch
diff --git a/llvm/lib/Target/M68k/CMakeLists.txt b/llvm/lib/Target/M68k/CMakeLists.txt
index 7005df4fb8a82..e7892d5bb5855 100644
--- a/llvm/lib/Target/M68k/CMakeLists.txt
+++ b/llvm/lib/Target/M68k/CMakeLists.txt
@@ -39,18 +39,10 @@ add_llvm_target(M68kCodeGen
M68kTargetObjectFile.cpp
LINK_COMPONENTS
- Analysis
- AsmPrinter
- CodeGen
- CodeGenTypes
- Core
- GlobalISel
M68kDesc
M68kInfo
- MC
- SelectionDAG
- Support
- Target
+ ${TARGET_LIBRARIES}
+ GlobalISel
ADD_TO_COMPONENT
M68k
diff --git a/llvm/lib/Target/MSP430/CMakeLists.txt b/llvm/lib/Target/MSP430/CMakeLists.txt
index 4081d3472fd78..60c74238d9e9f 100644
--- a/llvm/lib/Target/MSP430/CMakeLists.txt
+++ b/llvm/lib/Target/MSP430/CMakeLists.txt
@@ -30,16 +30,9 @@ add_llvm_target(MSP430CodeGen
MSP430MCInstLower.cpp
LINK_COMPONENTS
- AsmPrinter
- CodeGen
- CodeGenTypes
- Core
- MC
MSP430Desc
MSP430Info
- SelectionDAG
- Support
- Target
+ ${TARGET_LIBRARIES}
ADD_TO_COMPONENT
MSP430
diff --git a/llvm/lib/Target/Mips/CMakeLists.txt b/llvm/lib/Target/Mips/CMakeLists.txt
index 21d1765107ae6..6dc747f0d8ead 100644
--- a/llvm/lib/Target/Mips/CMakeLists.txt
+++ b/llvm/lib/Target/Mips/CMakeLists.txt
@@ -67,20 +67,10 @@ add_llvm_target(MipsCodeGen
MipsMulMulBugPass.cpp
LINK_COMPONENTS
- Analysis
- AsmPrinter
- CodeGen
- CodeGenTypes
- Core
- GlobalISel
- MC
MipsDesc
MipsInfo
- SelectionDAG
- Support
- Target
- TargetParser
- TransformUtils
+ ${TARGET_LIBRARIES}
+ GlobalISel
ADD_TO_COMPONENT
Mips
diff --git a/llvm/lib/Target/NVPTX/CMakeLists.txt b/llvm/lib/Target/NVPTX/CMakeLists.txt
index 693f0d0b35edc..35518afa6e784 100644
--- a/llvm/lib/Target/NVPTX/CMakeLists.txt
+++ b/llvm/lib/Target/NVPTX/CMakeLists.txt
@@ -48,21 +48,9 @@ add_llvm_target(NVPTXCodeGen
${NVPTXCodeGen_sources}
LINK_COMPONENTS
- Analysis
- AsmPrinter
- CodeGen
- CodeGenTypes
- Core
- IPO
- MC
NVPTXDesc
NVPTXInfo
- Scalar
- SelectionDAG
- Support
- Target
- TargetParser
- TransformUtils
+ ${TARGET_LIBRARIES}
Vectorize
ADD_TO_COMPONENT
diff --git a/llvm/lib/Target/PowerPC/CMakeLists.txt b/llvm/lib/Target/PowerPC/CMakeLists.txt
index 3808a26a0b92a..6d4f6b889a4e8 100644
--- a/llvm/lib/Target/PowerPC/CMakeLists.txt
+++ b/llvm/lib/Target/PowerPC/CMakeLists.txt
@@ -62,22 +62,11 @@ add_llvm_target(PowerPCCodeGen
GISel/PPCLegalizerInfo.cpp
LINK_COMPONENTS
- Analysis
- AsmPrinter
- BinaryFormat
- CodeGen
- CodeGenTypes
- Core
- GlobalISel
- MC
PowerPCDesc
PowerPCInfo
- Scalar
- SelectionDAG
- Support
- Target
- TargetParser
- TransformUtils
+ ${TARGET_LIBRARIES}
+ BinaryFormat
+ GlobalISel
ADD_TO_COMPONENT
PowerPC
diff --git a/llvm/lib/Target/RISCV/CMakeLists.txt b/llvm/lib/Target/RISCV/CMakeLists.txt
index e32d6eab3b977..a1b178cc6429d 100644
--- a/llvm/lib/Target/RISCV/CMakeLists.txt
+++ b/llvm/lib/Target/RISCV/CMakeLists.txt
@@ -78,22 +78,10 @@ add_llvm_target(RISCVCodeGen
GISel/RISCVRegisterBankInfo.cpp
LINK_COMPONENTS
- Analysis
- AsmPrinter
- CodeGen
- CodeGenTypes
- Core
- GlobalISel
- IPO
- MC
RISCVDesc
RISCVInfo
- Scalar
- SelectionDAG
- Support
- Target
- TargetParser
- TransformUtils
+ ${TARGET_LIBRARIES}
+ GlobalISel
Vectorize
ADD_TO_COMPONENT
diff --git a/llvm/lib/Target/SPIRV/CMakeLists.txt b/llvm/lib/Target/SPIRV/CMakeLists.txt
index 4a2b534b948d6..f2fab35dc3989 100644
--- a/llvm/lib/Target/SPIRV/CMakeLists.txt
+++ b/llvm/lib/Target/SPIRV/CMakeLists.txt
@@ -48,23 +48,12 @@ add_llvm_target(SPIRVCodeGen
SPIRVEmitNonSemanticDI.cpp
LINK_COMPONENTS
- Analysis
- AsmPrinter
- CodeGen
- CodeGenTypes
- Core
- Demangle
- GlobalISel
SPIRVAnalysis
- MC
SPIRVDesc
SPIRVInfo
- ScalarOpts
- SelectionDAG
- Support
- Target
- TargetParser
- TransformUtils
+ ${TARGET_LIBRARIES}
+ Demangle
+ GlobalISel
ADD_TO_COMPONENT
SPIRV
diff --git a/llvm/lib/Target/Sparc/CMakeLists.txt b/llvm/lib/Target/Sparc/CMakeLists.txt
index f682719ac483f..364483c1ea13b 100644
--- a/llvm/lib/Target/Sparc/CMakeLists.txt
+++ b/llvm/lib/Target/Sparc/CMakeLists.txt
@@ -32,17 +32,9 @@ add_llvm_target(SparcCodeGen
SparcTargetObjectFile.cpp
LINK_COMPONENTS
- AsmPrinter
- CodeGen
- CodeGenTypes
- Core
- MC
- SelectionDAG
SparcDesc
SparcInfo
- Support
- Target
- TargetParser
+ ${TARGET_LIBRARIES}
ADD_TO_COMPONENT
Sparc
diff --git a/llvm/lib/Target/SystemZ/CMakeLists.txt b/llvm/lib/Target/SystemZ/CMakeLists.txt
index 0d8f3eac6ee4f..ee4a3a2d1e333 100644
--- a/llvm/lib/Target/SystemZ/CMakeLists.txt
+++ b/llvm/lib/Target/SystemZ/CMakeLists.txt
@@ -42,20 +42,9 @@ add_llvm_target(SystemZCodeGen
SystemZTDC.cpp
LINK_COMPONENTS
- Analysis
- AsmPrinter
- CodeGen
- CodeGenTypes
- Core
- MC
- Scalar
- SelectionDAG
- Support
SystemZDesc
SystemZInfo
- Target
- TargetParser
- TransformUtils
+ ${TARGET_LIBRARIES}
ADD_TO_COMPONENT
SystemZ
diff --git a/llvm/lib/Target/VE/CMakeLists.txt b/llvm/lib/Target/VE/CMakeLists.txt
index d1bb4f32fcba7..c34472a29436d 100644
--- a/llvm/lib/Target/VE/CMakeLists.txt
+++ b/llvm/lib/Target/VE/CMakeLists.txt
@@ -29,19 +29,9 @@ add_llvm_target(VECodeGen
VVPISelLowering.cpp
LINK_COMPONENTS
- Analysis
- AsmPrinter
- CodeGen
- CodeGenTypes
- Core
- MC
- SelectionDAG
- Support
- Target
- TargetParser
- TransformUtils
VEDesc
VEInfo
+ ${TARGET_LIBRARIES}
ADD_TO_COMPONENT
VE
diff --git a/llvm/lib/Target/WebAssembly/CMakeLists.txt b/llvm/lib/Target/WebAssembly/CMakeLists.txt
index 1e83cbeac50d6..ffd7c9f599f98 100644
--- a/llvm/lib/Target/WebAssembly/CMakeLists.txt
+++ b/llvm/lib/Target/WebAssembly/CMakeLists.txt
@@ -65,22 +65,11 @@ add_llvm_target(WebAssemblyCodeGen
intrinsics_gen
LINK_COMPONENTS
- Analysis
- AsmPrinter
- BinaryFormat
- CodeGen
- CodeGenTypes
- Core
- MC
- Scalar
- SelectionDAG
- Support
- Target
- TargetParser
- TransformUtils
WebAssemblyDesc
WebAssemblyInfo
WebAssemblyUtils
+ ${TARGET_LIBRARIES}
+ BinaryFormat
ADD_TO_COMPONENT
WebAssembly
diff --git a/llvm/lib/Target/X86/CMakeLists.txt b/llvm/lib/Target/X86/CMakeLists.txt
index 6627e97dd0943..27b2ef8b6d5e6 100644
--- a/llvm/lib/Target/X86/CMakeLists.txt
+++ b/llvm/lib/Target/X86/CMakeLists.txt
@@ -95,25 +95,13 @@ set(sources
add_llvm_target(X86CodeGen ${sources}
LINK_COMPONENTS
- Analysis
- AsmPrinter
+ X86Desc
+ X86Info
+ ${TARGET_LIBRARIES}
CFGuard
- CodeGen
- CodeGenTypes
- Core
GlobalISel
IRPrinter
- Instrumentation
- MC
ProfileData
- Scalar
- SelectionDAG
- Support
- Target
- TargetParser
- TransformUtils
- X86Desc
- X86Info
ADD_TO_COMPONENT
X86
diff --git a/llvm/lib/Target/XCore/CMakeLists.txt b/llvm/lib/Target/XCore/CMakeLists.txt
index f411c658b43b0..2f3959360551c 100644
--- a/llvm/lib/Target/XCore/CMakeLists.txt
+++ b/llvm/lib/Target/XCore/CMakeLists.txt
@@ -30,19 +30,9 @@ add_llvm_target(XCoreCodeGen
XCoreFrameToArgsOffsetElim.cpp
LINK_COMPONENTS
- Analysis
- AsmPrinter
- CodeGen
- CodeGenTypes
- Core
- MC
- SelectionDAG
- Support
- Target
- TargetParser
- TransformUtils
XCoreDesc
XCoreInfo
+ ${TARGET_LIBRARIES}
ADD_TO_COMPONENT
XCore
diff --git a/llvm/lib/Target/Xtensa/CMakeLists.txt b/llvm/lib/Target/Xtensa/CMakeLists.txt
index 4fc1ba6dfa650..33d42a9eb5e74 100644
--- a/llvm/lib/Target/Xtensa/CMakeLists.txt
+++ b/llvm/lib/Target/Xtensa/CMakeLists.txt
@@ -26,15 +26,9 @@ add_llvm_target(XtensaCodeGen
XtensaTargetMachine.cpp
LINK_COMPONENTS
- AsmPrinter
- CodeGen
- Core
- MC
- SelectionDAG
- Support
- Target
XtensaDesc
XtensaInfo
+ ${TARGET_LIBRARIES}
ADD_TO_COMPONENT
Xtensa
|
@llvm/pr-subscribers-backend-arm Author: LLChris (CBSears) ChangesUsing 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 Why? 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. Full diff: https://github.com/llvm/llvm-project/pull/141271.diff 26 Files Affected:
diff --git a/llvm/lib/Target/AArch64/CMakeLists.txt b/llvm/lib/Target/AArch64/CMakeLists.txt
index 583003f2f46e6..ea37cdcf53bbf 100644
--- a/llvm/lib/Target/AArch64/CMakeLists.txt
+++ b/llvm/lib/Target/AArch64/CMakeLists.txt
@@ -98,20 +98,9 @@ add_llvm_target(AArch64CodeGen
AArch64Desc
AArch64Info
AArch64Utils
- Analysis
- AsmPrinter
+ ${TARGET_LIBRARIES}
CFGuard
- CodeGen
- CodeGenTypes
- Core
GlobalISel
- MC
- Scalar
- SelectionDAG
- Support
- Target
- TargetParser
- TransformUtils
Vectorize
ADD_TO_COMPONENT
diff --git a/llvm/lib/Target/AMDGPU/CMakeLists.txt b/llvm/lib/Target/AMDGPU/CMakeLists.txt
index c6d70ee39202e..88c7bf815ec6f 100644
--- a/llvm/lib/Target/AMDGPU/CMakeLists.txt
+++ b/llvm/lib/Target/AMDGPU/CMakeLists.txt
@@ -185,26 +185,13 @@ add_llvm_target(AMDGPUCodeGen
AMDGPUDesc
AMDGPUInfo
AMDGPUUtils
- Analysis
- AsmPrinter
+ ${TARGET_LIBRARIES}
BinaryFormat
- CodeGen
- CodeGenTypes
- Core
GlobalISel
HipStdPar
- IPO
IRPrinter
- Instrumentation
- MC
MIRParser
Passes
- Scalar
- SelectionDAG
- Support
- Target
- TargetParser
- TransformUtils
Vectorize
ADD_TO_COMPONENT
diff --git a/llvm/lib/Target/ARC/CMakeLists.txt b/llvm/lib/Target/ARC/CMakeLists.txt
index 196cc31cc5080..d1fa1ec912c35 100644
--- a/llvm/lib/Target/ARC/CMakeLists.txt
+++ b/llvm/lib/Target/ARC/CMakeLists.txt
@@ -32,17 +32,7 @@ add_llvm_target(ARCCodeGen
LINK_COMPONENTS
ARCDesc
ARCInfo
- Analysis
- AsmPrinter
- CodeGen
- CodeGenTypes
- Core
- MC
- SelectionDAG
- Support
- Target
- TargetParser
- TransformUtils
+ ${TARGET_LIBRARIES}
ADD_TO_COMPONENT
ARC
diff --git a/llvm/lib/Target/ARM/CMakeLists.txt b/llvm/lib/Target/ARM/CMakeLists.txt
index a39629bd8aeb0..1610d88ce8b75 100644
--- a/llvm/lib/Target/ARM/CMakeLists.txt
+++ b/llvm/lib/Target/ARM/CMakeLists.txt
@@ -74,21 +74,9 @@ add_llvm_target(ARMCodeGen
ARMDesc
ARMInfo
ARMUtils
- Analysis
- AsmPrinter
+ ${TARGET_LIBRARIES}
CFGuard
- CodeGen
- CodeGenTypes
- Core
GlobalISel
- IPO
- MC
- Scalar
- SelectionDAG
- Support
- Target
- TargetParser
- TransformUtils
ADD_TO_COMPONENT
ARM
diff --git a/llvm/lib/Target/AVR/CMakeLists.txt b/llvm/lib/Target/AVR/CMakeLists.txt
index 781dac02c7083..b18013fae6b47 100644
--- a/llvm/lib/Target/AVR/CMakeLists.txt
+++ b/llvm/lib/Target/AVR/CMakeLists.txt
@@ -36,14 +36,7 @@ add_llvm_target(AVRCodeGen
LINK_COMPONENTS
AVRDesc
AVRInfo
- AsmPrinter
- CodeGen
- CodeGenTypes
- Core
- MC
- SelectionDAG
- Support
- Target
+ ${TARGET_LIBRARIES}
ADD_TO_COMPONENT
AVR
diff --git a/llvm/lib/Target/BPF/CMakeLists.txt b/llvm/lib/Target/BPF/CMakeLists.txt
index eade4cacb7100..cf695cd6d5ceb 100644
--- a/llvm/lib/Target/BPF/CMakeLists.txt
+++ b/llvm/lib/Target/BPF/CMakeLists.txt
@@ -44,23 +44,11 @@ add_llvm_target(BPFCodeGen
BTFDebug.cpp
LINK_COMPONENTS
- Analysis
- AsmPrinter
BPFDesc
BPFInfo
- CodeGen
- CodeGenTypes
- Core
+ ${TARGET_LIBRARIES}
GlobalISel
- IPO
- MC
Passes
- Scalar
- SelectionDAG
- Support
- Target
- TargetParser
- TransformUtils
ADD_TO_COMPONENT
BPF
diff --git a/llvm/lib/Target/CMakeLists.txt b/llvm/lib/Target/CMakeLists.txt
index 9472288229cac..84248fb80a32a 100644
--- a/llvm/lib/Target/CMakeLists.txt
+++ b/llvm/lib/Target/CMakeLists.txt
@@ -19,6 +19,22 @@ add_llvm_component_library(LLVMTarget
TargetParser
)
+set(TARGET_LIBRARIES
+ Analysis
+ AsmPrinter
+ CodeGen
+ CodeGenTypes
+ Core
+ Instrumentation
+ IPO
+ MC
+ Scalar
+ SelectionDAG
+ Support
+ Target
+ TargetParser
+ TransformUtils)
+
# When building shared objects for each target there are some internal APIs
# that are used across shared objects which we can't hide.
if (NOT BUILD_SHARED_LIBS AND NOT APPLE AND
diff --git a/llvm/lib/Target/CSKY/CMakeLists.txt b/llvm/lib/Target/CSKY/CMakeLists.txt
index 4b900bc99c271..78282455309bd 100644
--- a/llvm/lib/Target/CSKY/CMakeLists.txt
+++ b/llvm/lib/Target/CSKY/CMakeLists.txt
@@ -33,17 +33,9 @@ add_llvm_target(CSKYCodeGen
CSKYTargetObjectFile.cpp
LINK_COMPONENTS
- Analysis
- AsmPrinter
CSKYDesc
CSKYInfo
- CodeGen
- CodeGenTypes
- Core
- MC
- SelectionDAG
- Support
- Target
+ ${TARGET_LIBRARIES}
ADD_TO_COMPONENT
CSKY
diff --git a/llvm/lib/Target/DirectX/CMakeLists.txt b/llvm/lib/Target/DirectX/CMakeLists.txt
index c7c09caf43667..c4a869ca8b5e8 100644
--- a/llvm/lib/Target/DirectX/CMakeLists.txt
+++ b/llvm/lib/Target/DirectX/CMakeLists.txt
@@ -39,23 +39,12 @@ add_llvm_target(DirectXCodeGen
DXILLegalizePass.cpp
LINK_COMPONENTS
- Analysis
- AsmPrinter
- CodeGen
- CodeGenTypes
- Core
DXILBitWriter
DirectXDesc
DirectXInfo
DirectXPointerTypeAnalysis
FrontendHLSL
- MC
- ScalarOpts
- SelectionDAG
- Support
- Target
- TargetParser
- TransformUtils
+ ${TARGET_LIBRARIES}
ADD_TO_COMPONENT
DirectX
diff --git a/llvm/lib/Target/Hexagon/CMakeLists.txt b/llvm/lib/Target/Hexagon/CMakeLists.txt
index d758260a8ab5d..072eea5c7885a 100644
--- a/llvm/lib/Target/Hexagon/CMakeLists.txt
+++ b/llvm/lib/Target/Hexagon/CMakeLists.txt
@@ -74,22 +74,10 @@ add_llvm_target(HexagonCodeGen
RDFDeadCode.cpp
LINK_COMPONENTS
- Analysis
- AsmPrinter
- CodeGen
- CodeGenTypes
- Core
HexagonAsmParser
HexagonDesc
HexagonInfo
- IPO
- MC
- Scalar
- SelectionDAG
- Support
- Target
- TargetParser
- TransformUtils
+ ${TARGET_LIBRARIES}
ADD_TO_COMPONENT
Hexagon
diff --git a/llvm/lib/Target/Lanai/CMakeLists.txt b/llvm/lib/Target/Lanai/CMakeLists.txt
index 4a628e13fc177..32e34747142d2 100644
--- a/llvm/lib/Target/Lanai/CMakeLists.txt
+++ b/llvm/lib/Target/Lanai/CMakeLists.txt
@@ -32,20 +32,10 @@ add_llvm_target(LanaiCodeGen
LanaiTargetObjectFile.cpp
LINK_COMPONENTS
- Analysis
- AsmPrinter
- CodeGen
- CodeGenTypes
- Core
LanaiAsmParser
LanaiDesc
LanaiInfo
- MC
- SelectionDAG
- Support
- Target
- TargetParser
- TransformUtils
+ ${TARGET_LIBRARIES}
ADD_TO_COMPONENT
Lanai
diff --git a/llvm/lib/Target/LoongArch/CMakeLists.txt b/llvm/lib/Target/LoongArch/CMakeLists.txt
index 0f674b1b0fa9e..909d0dca79b48 100644
--- a/llvm/lib/Target/LoongArch/CMakeLists.txt
+++ b/llvm/lib/Target/LoongArch/CMakeLists.txt
@@ -32,20 +32,9 @@ add_llvm_target(LoongArchCodeGen
LoongArchTargetTransformInfo.cpp
LINK_COMPONENTS
- Analysis
- AsmPrinter
- CodeGen
- CodeGenTypes
- Core
LoongArchDesc
LoongArchInfo
- MC
- Scalar
- SelectionDAG
- Support
- Target
- TargetParser
- TransformUtils
+ ${TARGET_LIBRARIES}
ADD_TO_COMPONENT
LoongArch
diff --git a/llvm/lib/Target/M68k/CMakeLists.txt b/llvm/lib/Target/M68k/CMakeLists.txt
index 7005df4fb8a82..e7892d5bb5855 100644
--- a/llvm/lib/Target/M68k/CMakeLists.txt
+++ b/llvm/lib/Target/M68k/CMakeLists.txt
@@ -39,18 +39,10 @@ add_llvm_target(M68kCodeGen
M68kTargetObjectFile.cpp
LINK_COMPONENTS
- Analysis
- AsmPrinter
- CodeGen
- CodeGenTypes
- Core
- GlobalISel
M68kDesc
M68kInfo
- MC
- SelectionDAG
- Support
- Target
+ ${TARGET_LIBRARIES}
+ GlobalISel
ADD_TO_COMPONENT
M68k
diff --git a/llvm/lib/Target/MSP430/CMakeLists.txt b/llvm/lib/Target/MSP430/CMakeLists.txt
index 4081d3472fd78..60c74238d9e9f 100644
--- a/llvm/lib/Target/MSP430/CMakeLists.txt
+++ b/llvm/lib/Target/MSP430/CMakeLists.txt
@@ -30,16 +30,9 @@ add_llvm_target(MSP430CodeGen
MSP430MCInstLower.cpp
LINK_COMPONENTS
- AsmPrinter
- CodeGen
- CodeGenTypes
- Core
- MC
MSP430Desc
MSP430Info
- SelectionDAG
- Support
- Target
+ ${TARGET_LIBRARIES}
ADD_TO_COMPONENT
MSP430
diff --git a/llvm/lib/Target/Mips/CMakeLists.txt b/llvm/lib/Target/Mips/CMakeLists.txt
index 21d1765107ae6..6dc747f0d8ead 100644
--- a/llvm/lib/Target/Mips/CMakeLists.txt
+++ b/llvm/lib/Target/Mips/CMakeLists.txt
@@ -67,20 +67,10 @@ add_llvm_target(MipsCodeGen
MipsMulMulBugPass.cpp
LINK_COMPONENTS
- Analysis
- AsmPrinter
- CodeGen
- CodeGenTypes
- Core
- GlobalISel
- MC
MipsDesc
MipsInfo
- SelectionDAG
- Support
- Target
- TargetParser
- TransformUtils
+ ${TARGET_LIBRARIES}
+ GlobalISel
ADD_TO_COMPONENT
Mips
diff --git a/llvm/lib/Target/NVPTX/CMakeLists.txt b/llvm/lib/Target/NVPTX/CMakeLists.txt
index 693f0d0b35edc..35518afa6e784 100644
--- a/llvm/lib/Target/NVPTX/CMakeLists.txt
+++ b/llvm/lib/Target/NVPTX/CMakeLists.txt
@@ -48,21 +48,9 @@ add_llvm_target(NVPTXCodeGen
${NVPTXCodeGen_sources}
LINK_COMPONENTS
- Analysis
- AsmPrinter
- CodeGen
- CodeGenTypes
- Core
- IPO
- MC
NVPTXDesc
NVPTXInfo
- Scalar
- SelectionDAG
- Support
- Target
- TargetParser
- TransformUtils
+ ${TARGET_LIBRARIES}
Vectorize
ADD_TO_COMPONENT
diff --git a/llvm/lib/Target/PowerPC/CMakeLists.txt b/llvm/lib/Target/PowerPC/CMakeLists.txt
index 3808a26a0b92a..6d4f6b889a4e8 100644
--- a/llvm/lib/Target/PowerPC/CMakeLists.txt
+++ b/llvm/lib/Target/PowerPC/CMakeLists.txt
@@ -62,22 +62,11 @@ add_llvm_target(PowerPCCodeGen
GISel/PPCLegalizerInfo.cpp
LINK_COMPONENTS
- Analysis
- AsmPrinter
- BinaryFormat
- CodeGen
- CodeGenTypes
- Core
- GlobalISel
- MC
PowerPCDesc
PowerPCInfo
- Scalar
- SelectionDAG
- Support
- Target
- TargetParser
- TransformUtils
+ ${TARGET_LIBRARIES}
+ BinaryFormat
+ GlobalISel
ADD_TO_COMPONENT
PowerPC
diff --git a/llvm/lib/Target/RISCV/CMakeLists.txt b/llvm/lib/Target/RISCV/CMakeLists.txt
index e32d6eab3b977..a1b178cc6429d 100644
--- a/llvm/lib/Target/RISCV/CMakeLists.txt
+++ b/llvm/lib/Target/RISCV/CMakeLists.txt
@@ -78,22 +78,10 @@ add_llvm_target(RISCVCodeGen
GISel/RISCVRegisterBankInfo.cpp
LINK_COMPONENTS
- Analysis
- AsmPrinter
- CodeGen
- CodeGenTypes
- Core
- GlobalISel
- IPO
- MC
RISCVDesc
RISCVInfo
- Scalar
- SelectionDAG
- Support
- Target
- TargetParser
- TransformUtils
+ ${TARGET_LIBRARIES}
+ GlobalISel
Vectorize
ADD_TO_COMPONENT
diff --git a/llvm/lib/Target/SPIRV/CMakeLists.txt b/llvm/lib/Target/SPIRV/CMakeLists.txt
index 4a2b534b948d6..f2fab35dc3989 100644
--- a/llvm/lib/Target/SPIRV/CMakeLists.txt
+++ b/llvm/lib/Target/SPIRV/CMakeLists.txt
@@ -48,23 +48,12 @@ add_llvm_target(SPIRVCodeGen
SPIRVEmitNonSemanticDI.cpp
LINK_COMPONENTS
- Analysis
- AsmPrinter
- CodeGen
- CodeGenTypes
- Core
- Demangle
- GlobalISel
SPIRVAnalysis
- MC
SPIRVDesc
SPIRVInfo
- ScalarOpts
- SelectionDAG
- Support
- Target
- TargetParser
- TransformUtils
+ ${TARGET_LIBRARIES}
+ Demangle
+ GlobalISel
ADD_TO_COMPONENT
SPIRV
diff --git a/llvm/lib/Target/Sparc/CMakeLists.txt b/llvm/lib/Target/Sparc/CMakeLists.txt
index f682719ac483f..364483c1ea13b 100644
--- a/llvm/lib/Target/Sparc/CMakeLists.txt
+++ b/llvm/lib/Target/Sparc/CMakeLists.txt
@@ -32,17 +32,9 @@ add_llvm_target(SparcCodeGen
SparcTargetObjectFile.cpp
LINK_COMPONENTS
- AsmPrinter
- CodeGen
- CodeGenTypes
- Core
- MC
- SelectionDAG
SparcDesc
SparcInfo
- Support
- Target
- TargetParser
+ ${TARGET_LIBRARIES}
ADD_TO_COMPONENT
Sparc
diff --git a/llvm/lib/Target/SystemZ/CMakeLists.txt b/llvm/lib/Target/SystemZ/CMakeLists.txt
index 0d8f3eac6ee4f..ee4a3a2d1e333 100644
--- a/llvm/lib/Target/SystemZ/CMakeLists.txt
+++ b/llvm/lib/Target/SystemZ/CMakeLists.txt
@@ -42,20 +42,9 @@ add_llvm_target(SystemZCodeGen
SystemZTDC.cpp
LINK_COMPONENTS
- Analysis
- AsmPrinter
- CodeGen
- CodeGenTypes
- Core
- MC
- Scalar
- SelectionDAG
- Support
SystemZDesc
SystemZInfo
- Target
- TargetParser
- TransformUtils
+ ${TARGET_LIBRARIES}
ADD_TO_COMPONENT
SystemZ
diff --git a/llvm/lib/Target/VE/CMakeLists.txt b/llvm/lib/Target/VE/CMakeLists.txt
index d1bb4f32fcba7..c34472a29436d 100644
--- a/llvm/lib/Target/VE/CMakeLists.txt
+++ b/llvm/lib/Target/VE/CMakeLists.txt
@@ -29,19 +29,9 @@ add_llvm_target(VECodeGen
VVPISelLowering.cpp
LINK_COMPONENTS
- Analysis
- AsmPrinter
- CodeGen
- CodeGenTypes
- Core
- MC
- SelectionDAG
- Support
- Target
- TargetParser
- TransformUtils
VEDesc
VEInfo
+ ${TARGET_LIBRARIES}
ADD_TO_COMPONENT
VE
diff --git a/llvm/lib/Target/WebAssembly/CMakeLists.txt b/llvm/lib/Target/WebAssembly/CMakeLists.txt
index 1e83cbeac50d6..ffd7c9f599f98 100644
--- a/llvm/lib/Target/WebAssembly/CMakeLists.txt
+++ b/llvm/lib/Target/WebAssembly/CMakeLists.txt
@@ -65,22 +65,11 @@ add_llvm_target(WebAssemblyCodeGen
intrinsics_gen
LINK_COMPONENTS
- Analysis
- AsmPrinter
- BinaryFormat
- CodeGen
- CodeGenTypes
- Core
- MC
- Scalar
- SelectionDAG
- Support
- Target
- TargetParser
- TransformUtils
WebAssemblyDesc
WebAssemblyInfo
WebAssemblyUtils
+ ${TARGET_LIBRARIES}
+ BinaryFormat
ADD_TO_COMPONENT
WebAssembly
diff --git a/llvm/lib/Target/X86/CMakeLists.txt b/llvm/lib/Target/X86/CMakeLists.txt
index 6627e97dd0943..27b2ef8b6d5e6 100644
--- a/llvm/lib/Target/X86/CMakeLists.txt
+++ b/llvm/lib/Target/X86/CMakeLists.txt
@@ -95,25 +95,13 @@ set(sources
add_llvm_target(X86CodeGen ${sources}
LINK_COMPONENTS
- Analysis
- AsmPrinter
+ X86Desc
+ X86Info
+ ${TARGET_LIBRARIES}
CFGuard
- CodeGen
- CodeGenTypes
- Core
GlobalISel
IRPrinter
- Instrumentation
- MC
ProfileData
- Scalar
- SelectionDAG
- Support
- Target
- TargetParser
- TransformUtils
- X86Desc
- X86Info
ADD_TO_COMPONENT
X86
diff --git a/llvm/lib/Target/XCore/CMakeLists.txt b/llvm/lib/Target/XCore/CMakeLists.txt
index f411c658b43b0..2f3959360551c 100644
--- a/llvm/lib/Target/XCore/CMakeLists.txt
+++ b/llvm/lib/Target/XCore/CMakeLists.txt
@@ -30,19 +30,9 @@ add_llvm_target(XCoreCodeGen
XCoreFrameToArgsOffsetElim.cpp
LINK_COMPONENTS
- Analysis
- AsmPrinter
- CodeGen
- CodeGenTypes
- Core
- MC
- SelectionDAG
- Support
- Target
- TargetParser
- TransformUtils
XCoreDesc
XCoreInfo
+ ${TARGET_LIBRARIES}
ADD_TO_COMPONENT
XCore
diff --git a/llvm/lib/Target/Xtensa/CMakeLists.txt b/llvm/lib/Target/Xtensa/CMakeLists.txt
index 4fc1ba6dfa650..33d42a9eb5e74 100644
--- a/llvm/lib/Target/Xtensa/CMakeLists.txt
+++ b/llvm/lib/Target/Xtensa/CMakeLists.txt
@@ -26,15 +26,9 @@ add_llvm_target(XtensaCodeGen
XtensaTargetMachine.cpp
LINK_COMPONENTS
- AsmPrinter
- CodeGen
- Core
- MC
- SelectionDAG
- Support
- Target
XtensaDesc
XtensaInfo
+ ${TARGET_LIBRARIES}
ADD_TO_COMPONENT
Xtensa
|
@llvm/pr-subscribers-backend-amdgpu Author: LLChris (CBSears) ChangesUsing 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 Why? 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. Full diff: https://github.com/llvm/llvm-project/pull/141271.diff 26 Files Affected:
diff --git a/llvm/lib/Target/AArch64/CMakeLists.txt b/llvm/lib/Target/AArch64/CMakeLists.txt
index 583003f2f46e6..ea37cdcf53bbf 100644
--- a/llvm/lib/Target/AArch64/CMakeLists.txt
+++ b/llvm/lib/Target/AArch64/CMakeLists.txt
@@ -98,20 +98,9 @@ add_llvm_target(AArch64CodeGen
AArch64Desc
AArch64Info
AArch64Utils
- Analysis
- AsmPrinter
+ ${TARGET_LIBRARIES}
CFGuard
- CodeGen
- CodeGenTypes
- Core
GlobalISel
- MC
- Scalar
- SelectionDAG
- Support
- Target
- TargetParser
- TransformUtils
Vectorize
ADD_TO_COMPONENT
diff --git a/llvm/lib/Target/AMDGPU/CMakeLists.txt b/llvm/lib/Target/AMDGPU/CMakeLists.txt
index c6d70ee39202e..88c7bf815ec6f 100644
--- a/llvm/lib/Target/AMDGPU/CMakeLists.txt
+++ b/llvm/lib/Target/AMDGPU/CMakeLists.txt
@@ -185,26 +185,13 @@ add_llvm_target(AMDGPUCodeGen
AMDGPUDesc
AMDGPUInfo
AMDGPUUtils
- Analysis
- AsmPrinter
+ ${TARGET_LIBRARIES}
BinaryFormat
- CodeGen
- CodeGenTypes
- Core
GlobalISel
HipStdPar
- IPO
IRPrinter
- Instrumentation
- MC
MIRParser
Passes
- Scalar
- SelectionDAG
- Support
- Target
- TargetParser
- TransformUtils
Vectorize
ADD_TO_COMPONENT
diff --git a/llvm/lib/Target/ARC/CMakeLists.txt b/llvm/lib/Target/ARC/CMakeLists.txt
index 196cc31cc5080..d1fa1ec912c35 100644
--- a/llvm/lib/Target/ARC/CMakeLists.txt
+++ b/llvm/lib/Target/ARC/CMakeLists.txt
@@ -32,17 +32,7 @@ add_llvm_target(ARCCodeGen
LINK_COMPONENTS
ARCDesc
ARCInfo
- Analysis
- AsmPrinter
- CodeGen
- CodeGenTypes
- Core
- MC
- SelectionDAG
- Support
- Target
- TargetParser
- TransformUtils
+ ${TARGET_LIBRARIES}
ADD_TO_COMPONENT
ARC
diff --git a/llvm/lib/Target/ARM/CMakeLists.txt b/llvm/lib/Target/ARM/CMakeLists.txt
index a39629bd8aeb0..1610d88ce8b75 100644
--- a/llvm/lib/Target/ARM/CMakeLists.txt
+++ b/llvm/lib/Target/ARM/CMakeLists.txt
@@ -74,21 +74,9 @@ add_llvm_target(ARMCodeGen
ARMDesc
ARMInfo
ARMUtils
- Analysis
- AsmPrinter
+ ${TARGET_LIBRARIES}
CFGuard
- CodeGen
- CodeGenTypes
- Core
GlobalISel
- IPO
- MC
- Scalar
- SelectionDAG
- Support
- Target
- TargetParser
- TransformUtils
ADD_TO_COMPONENT
ARM
diff --git a/llvm/lib/Target/AVR/CMakeLists.txt b/llvm/lib/Target/AVR/CMakeLists.txt
index 781dac02c7083..b18013fae6b47 100644
--- a/llvm/lib/Target/AVR/CMakeLists.txt
+++ b/llvm/lib/Target/AVR/CMakeLists.txt
@@ -36,14 +36,7 @@ add_llvm_target(AVRCodeGen
LINK_COMPONENTS
AVRDesc
AVRInfo
- AsmPrinter
- CodeGen
- CodeGenTypes
- Core
- MC
- SelectionDAG
- Support
- Target
+ ${TARGET_LIBRARIES}
ADD_TO_COMPONENT
AVR
diff --git a/llvm/lib/Target/BPF/CMakeLists.txt b/llvm/lib/Target/BPF/CMakeLists.txt
index eade4cacb7100..cf695cd6d5ceb 100644
--- a/llvm/lib/Target/BPF/CMakeLists.txt
+++ b/llvm/lib/Target/BPF/CMakeLists.txt
@@ -44,23 +44,11 @@ add_llvm_target(BPFCodeGen
BTFDebug.cpp
LINK_COMPONENTS
- Analysis
- AsmPrinter
BPFDesc
BPFInfo
- CodeGen
- CodeGenTypes
- Core
+ ${TARGET_LIBRARIES}
GlobalISel
- IPO
- MC
Passes
- Scalar
- SelectionDAG
- Support
- Target
- TargetParser
- TransformUtils
ADD_TO_COMPONENT
BPF
diff --git a/llvm/lib/Target/CMakeLists.txt b/llvm/lib/Target/CMakeLists.txt
index 9472288229cac..84248fb80a32a 100644
--- a/llvm/lib/Target/CMakeLists.txt
+++ b/llvm/lib/Target/CMakeLists.txt
@@ -19,6 +19,22 @@ add_llvm_component_library(LLVMTarget
TargetParser
)
+set(TARGET_LIBRARIES
+ Analysis
+ AsmPrinter
+ CodeGen
+ CodeGenTypes
+ Core
+ Instrumentation
+ IPO
+ MC
+ Scalar
+ SelectionDAG
+ Support
+ Target
+ TargetParser
+ TransformUtils)
+
# When building shared objects for each target there are some internal APIs
# that are used across shared objects which we can't hide.
if (NOT BUILD_SHARED_LIBS AND NOT APPLE AND
diff --git a/llvm/lib/Target/CSKY/CMakeLists.txt b/llvm/lib/Target/CSKY/CMakeLists.txt
index 4b900bc99c271..78282455309bd 100644
--- a/llvm/lib/Target/CSKY/CMakeLists.txt
+++ b/llvm/lib/Target/CSKY/CMakeLists.txt
@@ -33,17 +33,9 @@ add_llvm_target(CSKYCodeGen
CSKYTargetObjectFile.cpp
LINK_COMPONENTS
- Analysis
- AsmPrinter
CSKYDesc
CSKYInfo
- CodeGen
- CodeGenTypes
- Core
- MC
- SelectionDAG
- Support
- Target
+ ${TARGET_LIBRARIES}
ADD_TO_COMPONENT
CSKY
diff --git a/llvm/lib/Target/DirectX/CMakeLists.txt b/llvm/lib/Target/DirectX/CMakeLists.txt
index c7c09caf43667..c4a869ca8b5e8 100644
--- a/llvm/lib/Target/DirectX/CMakeLists.txt
+++ b/llvm/lib/Target/DirectX/CMakeLists.txt
@@ -39,23 +39,12 @@ add_llvm_target(DirectXCodeGen
DXILLegalizePass.cpp
LINK_COMPONENTS
- Analysis
- AsmPrinter
- CodeGen
- CodeGenTypes
- Core
DXILBitWriter
DirectXDesc
DirectXInfo
DirectXPointerTypeAnalysis
FrontendHLSL
- MC
- ScalarOpts
- SelectionDAG
- Support
- Target
- TargetParser
- TransformUtils
+ ${TARGET_LIBRARIES}
ADD_TO_COMPONENT
DirectX
diff --git a/llvm/lib/Target/Hexagon/CMakeLists.txt b/llvm/lib/Target/Hexagon/CMakeLists.txt
index d758260a8ab5d..072eea5c7885a 100644
--- a/llvm/lib/Target/Hexagon/CMakeLists.txt
+++ b/llvm/lib/Target/Hexagon/CMakeLists.txt
@@ -74,22 +74,10 @@ add_llvm_target(HexagonCodeGen
RDFDeadCode.cpp
LINK_COMPONENTS
- Analysis
- AsmPrinter
- CodeGen
- CodeGenTypes
- Core
HexagonAsmParser
HexagonDesc
HexagonInfo
- IPO
- MC
- Scalar
- SelectionDAG
- Support
- Target
- TargetParser
- TransformUtils
+ ${TARGET_LIBRARIES}
ADD_TO_COMPONENT
Hexagon
diff --git a/llvm/lib/Target/Lanai/CMakeLists.txt b/llvm/lib/Target/Lanai/CMakeLists.txt
index 4a628e13fc177..32e34747142d2 100644
--- a/llvm/lib/Target/Lanai/CMakeLists.txt
+++ b/llvm/lib/Target/Lanai/CMakeLists.txt
@@ -32,20 +32,10 @@ add_llvm_target(LanaiCodeGen
LanaiTargetObjectFile.cpp
LINK_COMPONENTS
- Analysis
- AsmPrinter
- CodeGen
- CodeGenTypes
- Core
LanaiAsmParser
LanaiDesc
LanaiInfo
- MC
- SelectionDAG
- Support
- Target
- TargetParser
- TransformUtils
+ ${TARGET_LIBRARIES}
ADD_TO_COMPONENT
Lanai
diff --git a/llvm/lib/Target/LoongArch/CMakeLists.txt b/llvm/lib/Target/LoongArch/CMakeLists.txt
index 0f674b1b0fa9e..909d0dca79b48 100644
--- a/llvm/lib/Target/LoongArch/CMakeLists.txt
+++ b/llvm/lib/Target/LoongArch/CMakeLists.txt
@@ -32,20 +32,9 @@ add_llvm_target(LoongArchCodeGen
LoongArchTargetTransformInfo.cpp
LINK_COMPONENTS
- Analysis
- AsmPrinter
- CodeGen
- CodeGenTypes
- Core
LoongArchDesc
LoongArchInfo
- MC
- Scalar
- SelectionDAG
- Support
- Target
- TargetParser
- TransformUtils
+ ${TARGET_LIBRARIES}
ADD_TO_COMPONENT
LoongArch
diff --git a/llvm/lib/Target/M68k/CMakeLists.txt b/llvm/lib/Target/M68k/CMakeLists.txt
index 7005df4fb8a82..e7892d5bb5855 100644
--- a/llvm/lib/Target/M68k/CMakeLists.txt
+++ b/llvm/lib/Target/M68k/CMakeLists.txt
@@ -39,18 +39,10 @@ add_llvm_target(M68kCodeGen
M68kTargetObjectFile.cpp
LINK_COMPONENTS
- Analysis
- AsmPrinter
- CodeGen
- CodeGenTypes
- Core
- GlobalISel
M68kDesc
M68kInfo
- MC
- SelectionDAG
- Support
- Target
+ ${TARGET_LIBRARIES}
+ GlobalISel
ADD_TO_COMPONENT
M68k
diff --git a/llvm/lib/Target/MSP430/CMakeLists.txt b/llvm/lib/Target/MSP430/CMakeLists.txt
index 4081d3472fd78..60c74238d9e9f 100644
--- a/llvm/lib/Target/MSP430/CMakeLists.txt
+++ b/llvm/lib/Target/MSP430/CMakeLists.txt
@@ -30,16 +30,9 @@ add_llvm_target(MSP430CodeGen
MSP430MCInstLower.cpp
LINK_COMPONENTS
- AsmPrinter
- CodeGen
- CodeGenTypes
- Core
- MC
MSP430Desc
MSP430Info
- SelectionDAG
- Support
- Target
+ ${TARGET_LIBRARIES}
ADD_TO_COMPONENT
MSP430
diff --git a/llvm/lib/Target/Mips/CMakeLists.txt b/llvm/lib/Target/Mips/CMakeLists.txt
index 21d1765107ae6..6dc747f0d8ead 100644
--- a/llvm/lib/Target/Mips/CMakeLists.txt
+++ b/llvm/lib/Target/Mips/CMakeLists.txt
@@ -67,20 +67,10 @@ add_llvm_target(MipsCodeGen
MipsMulMulBugPass.cpp
LINK_COMPONENTS
- Analysis
- AsmPrinter
- CodeGen
- CodeGenTypes
- Core
- GlobalISel
- MC
MipsDesc
MipsInfo
- SelectionDAG
- Support
- Target
- TargetParser
- TransformUtils
+ ${TARGET_LIBRARIES}
+ GlobalISel
ADD_TO_COMPONENT
Mips
diff --git a/llvm/lib/Target/NVPTX/CMakeLists.txt b/llvm/lib/Target/NVPTX/CMakeLists.txt
index 693f0d0b35edc..35518afa6e784 100644
--- a/llvm/lib/Target/NVPTX/CMakeLists.txt
+++ b/llvm/lib/Target/NVPTX/CMakeLists.txt
@@ -48,21 +48,9 @@ add_llvm_target(NVPTXCodeGen
${NVPTXCodeGen_sources}
LINK_COMPONENTS
- Analysis
- AsmPrinter
- CodeGen
- CodeGenTypes
- Core
- IPO
- MC
NVPTXDesc
NVPTXInfo
- Scalar
- SelectionDAG
- Support
- Target
- TargetParser
- TransformUtils
+ ${TARGET_LIBRARIES}
Vectorize
ADD_TO_COMPONENT
diff --git a/llvm/lib/Target/PowerPC/CMakeLists.txt b/llvm/lib/Target/PowerPC/CMakeLists.txt
index 3808a26a0b92a..6d4f6b889a4e8 100644
--- a/llvm/lib/Target/PowerPC/CMakeLists.txt
+++ b/llvm/lib/Target/PowerPC/CMakeLists.txt
@@ -62,22 +62,11 @@ add_llvm_target(PowerPCCodeGen
GISel/PPCLegalizerInfo.cpp
LINK_COMPONENTS
- Analysis
- AsmPrinter
- BinaryFormat
- CodeGen
- CodeGenTypes
- Core
- GlobalISel
- MC
PowerPCDesc
PowerPCInfo
- Scalar
- SelectionDAG
- Support
- Target
- TargetParser
- TransformUtils
+ ${TARGET_LIBRARIES}
+ BinaryFormat
+ GlobalISel
ADD_TO_COMPONENT
PowerPC
diff --git a/llvm/lib/Target/RISCV/CMakeLists.txt b/llvm/lib/Target/RISCV/CMakeLists.txt
index e32d6eab3b977..a1b178cc6429d 100644
--- a/llvm/lib/Target/RISCV/CMakeLists.txt
+++ b/llvm/lib/Target/RISCV/CMakeLists.txt
@@ -78,22 +78,10 @@ add_llvm_target(RISCVCodeGen
GISel/RISCVRegisterBankInfo.cpp
LINK_COMPONENTS
- Analysis
- AsmPrinter
- CodeGen
- CodeGenTypes
- Core
- GlobalISel
- IPO
- MC
RISCVDesc
RISCVInfo
- Scalar
- SelectionDAG
- Support
- Target
- TargetParser
- TransformUtils
+ ${TARGET_LIBRARIES}
+ GlobalISel
Vectorize
ADD_TO_COMPONENT
diff --git a/llvm/lib/Target/SPIRV/CMakeLists.txt b/llvm/lib/Target/SPIRV/CMakeLists.txt
index 4a2b534b948d6..f2fab35dc3989 100644
--- a/llvm/lib/Target/SPIRV/CMakeLists.txt
+++ b/llvm/lib/Target/SPIRV/CMakeLists.txt
@@ -48,23 +48,12 @@ add_llvm_target(SPIRVCodeGen
SPIRVEmitNonSemanticDI.cpp
LINK_COMPONENTS
- Analysis
- AsmPrinter
- CodeGen
- CodeGenTypes
- Core
- Demangle
- GlobalISel
SPIRVAnalysis
- MC
SPIRVDesc
SPIRVInfo
- ScalarOpts
- SelectionDAG
- Support
- Target
- TargetParser
- TransformUtils
+ ${TARGET_LIBRARIES}
+ Demangle
+ GlobalISel
ADD_TO_COMPONENT
SPIRV
diff --git a/llvm/lib/Target/Sparc/CMakeLists.txt b/llvm/lib/Target/Sparc/CMakeLists.txt
index f682719ac483f..364483c1ea13b 100644
--- a/llvm/lib/Target/Sparc/CMakeLists.txt
+++ b/llvm/lib/Target/Sparc/CMakeLists.txt
@@ -32,17 +32,9 @@ add_llvm_target(SparcCodeGen
SparcTargetObjectFile.cpp
LINK_COMPONENTS
- AsmPrinter
- CodeGen
- CodeGenTypes
- Core
- MC
- SelectionDAG
SparcDesc
SparcInfo
- Support
- Target
- TargetParser
+ ${TARGET_LIBRARIES}
ADD_TO_COMPONENT
Sparc
diff --git a/llvm/lib/Target/SystemZ/CMakeLists.txt b/llvm/lib/Target/SystemZ/CMakeLists.txt
index 0d8f3eac6ee4f..ee4a3a2d1e333 100644
--- a/llvm/lib/Target/SystemZ/CMakeLists.txt
+++ b/llvm/lib/Target/SystemZ/CMakeLists.txt
@@ -42,20 +42,9 @@ add_llvm_target(SystemZCodeGen
SystemZTDC.cpp
LINK_COMPONENTS
- Analysis
- AsmPrinter
- CodeGen
- CodeGenTypes
- Core
- MC
- Scalar
- SelectionDAG
- Support
SystemZDesc
SystemZInfo
- Target
- TargetParser
- TransformUtils
+ ${TARGET_LIBRARIES}
ADD_TO_COMPONENT
SystemZ
diff --git a/llvm/lib/Target/VE/CMakeLists.txt b/llvm/lib/Target/VE/CMakeLists.txt
index d1bb4f32fcba7..c34472a29436d 100644
--- a/llvm/lib/Target/VE/CMakeLists.txt
+++ b/llvm/lib/Target/VE/CMakeLists.txt
@@ -29,19 +29,9 @@ add_llvm_target(VECodeGen
VVPISelLowering.cpp
LINK_COMPONENTS
- Analysis
- AsmPrinter
- CodeGen
- CodeGenTypes
- Core
- MC
- SelectionDAG
- Support
- Target
- TargetParser
- TransformUtils
VEDesc
VEInfo
+ ${TARGET_LIBRARIES}
ADD_TO_COMPONENT
VE
diff --git a/llvm/lib/Target/WebAssembly/CMakeLists.txt b/llvm/lib/Target/WebAssembly/CMakeLists.txt
index 1e83cbeac50d6..ffd7c9f599f98 100644
--- a/llvm/lib/Target/WebAssembly/CMakeLists.txt
+++ b/llvm/lib/Target/WebAssembly/CMakeLists.txt
@@ -65,22 +65,11 @@ add_llvm_target(WebAssemblyCodeGen
intrinsics_gen
LINK_COMPONENTS
- Analysis
- AsmPrinter
- BinaryFormat
- CodeGen
- CodeGenTypes
- Core
- MC
- Scalar
- SelectionDAG
- Support
- Target
- TargetParser
- TransformUtils
WebAssemblyDesc
WebAssemblyInfo
WebAssemblyUtils
+ ${TARGET_LIBRARIES}
+ BinaryFormat
ADD_TO_COMPONENT
WebAssembly
diff --git a/llvm/lib/Target/X86/CMakeLists.txt b/llvm/lib/Target/X86/CMakeLists.txt
index 6627e97dd0943..27b2ef8b6d5e6 100644
--- a/llvm/lib/Target/X86/CMakeLists.txt
+++ b/llvm/lib/Target/X86/CMakeLists.txt
@@ -95,25 +95,13 @@ set(sources
add_llvm_target(X86CodeGen ${sources}
LINK_COMPONENTS
- Analysis
- AsmPrinter
+ X86Desc
+ X86Info
+ ${TARGET_LIBRARIES}
CFGuard
- CodeGen
- CodeGenTypes
- Core
GlobalISel
IRPrinter
- Instrumentation
- MC
ProfileData
- Scalar
- SelectionDAG
- Support
- Target
- TargetParser
- TransformUtils
- X86Desc
- X86Info
ADD_TO_COMPONENT
X86
diff --git a/llvm/lib/Target/XCore/CMakeLists.txt b/llvm/lib/Target/XCore/CMakeLists.txt
index f411c658b43b0..2f3959360551c 100644
--- a/llvm/lib/Target/XCore/CMakeLists.txt
+++ b/llvm/lib/Target/XCore/CMakeLists.txt
@@ -30,19 +30,9 @@ add_llvm_target(XCoreCodeGen
XCoreFrameToArgsOffsetElim.cpp
LINK_COMPONENTS
- Analysis
- AsmPrinter
- CodeGen
- CodeGenTypes
- Core
- MC
- SelectionDAG
- Support
- Target
- TargetParser
- TransformUtils
XCoreDesc
XCoreInfo
+ ${TARGET_LIBRARIES}
ADD_TO_COMPONENT
XCore
diff --git a/llvm/lib/Target/Xtensa/CMakeLists.txt b/llvm/lib/Target/Xtensa/CMakeLists.txt
index 4fc1ba6dfa650..33d42a9eb5e74 100644
--- a/llvm/lib/Target/Xtensa/CMakeLists.txt
+++ b/llvm/lib/Target/Xtensa/CMakeLists.txt
@@ -26,15 +26,9 @@ add_llvm_target(XtensaCodeGen
XtensaTargetMachine.cpp
LINK_COMPONENTS
- AsmPrinter
- CodeGen
- Core
- MC
- SelectionDAG
- Support
- Target
XtensaDesc
XtensaInfo
+ ${TARGET_LIBRARIES}
ADD_TO_COMPONENT
Xtensa
|
@llvm/pr-subscribers-backend-aarch64 Author: LLChris (CBSears) ChangesUsing 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 Why? 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. Full diff: https://github.com/llvm/llvm-project/pull/141271.diff 26 Files Affected:
diff --git a/llvm/lib/Target/AArch64/CMakeLists.txt b/llvm/lib/Target/AArch64/CMakeLists.txt
index 583003f2f46e6..ea37cdcf53bbf 100644
--- a/llvm/lib/Target/AArch64/CMakeLists.txt
+++ b/llvm/lib/Target/AArch64/CMakeLists.txt
@@ -98,20 +98,9 @@ add_llvm_target(AArch64CodeGen
AArch64Desc
AArch64Info
AArch64Utils
- Analysis
- AsmPrinter
+ ${TARGET_LIBRARIES}
CFGuard
- CodeGen
- CodeGenTypes
- Core
GlobalISel
- MC
- Scalar
- SelectionDAG
- Support
- Target
- TargetParser
- TransformUtils
Vectorize
ADD_TO_COMPONENT
diff --git a/llvm/lib/Target/AMDGPU/CMakeLists.txt b/llvm/lib/Target/AMDGPU/CMakeLists.txt
index c6d70ee39202e..88c7bf815ec6f 100644
--- a/llvm/lib/Target/AMDGPU/CMakeLists.txt
+++ b/llvm/lib/Target/AMDGPU/CMakeLists.txt
@@ -185,26 +185,13 @@ add_llvm_target(AMDGPUCodeGen
AMDGPUDesc
AMDGPUInfo
AMDGPUUtils
- Analysis
- AsmPrinter
+ ${TARGET_LIBRARIES}
BinaryFormat
- CodeGen
- CodeGenTypes
- Core
GlobalISel
HipStdPar
- IPO
IRPrinter
- Instrumentation
- MC
MIRParser
Passes
- Scalar
- SelectionDAG
- Support
- Target
- TargetParser
- TransformUtils
Vectorize
ADD_TO_COMPONENT
diff --git a/llvm/lib/Target/ARC/CMakeLists.txt b/llvm/lib/Target/ARC/CMakeLists.txt
index 196cc31cc5080..d1fa1ec912c35 100644
--- a/llvm/lib/Target/ARC/CMakeLists.txt
+++ b/llvm/lib/Target/ARC/CMakeLists.txt
@@ -32,17 +32,7 @@ add_llvm_target(ARCCodeGen
LINK_COMPONENTS
ARCDesc
ARCInfo
- Analysis
- AsmPrinter
- CodeGen
- CodeGenTypes
- Core
- MC
- SelectionDAG
- Support
- Target
- TargetParser
- TransformUtils
+ ${TARGET_LIBRARIES}
ADD_TO_COMPONENT
ARC
diff --git a/llvm/lib/Target/ARM/CMakeLists.txt b/llvm/lib/Target/ARM/CMakeLists.txt
index a39629bd8aeb0..1610d88ce8b75 100644
--- a/llvm/lib/Target/ARM/CMakeLists.txt
+++ b/llvm/lib/Target/ARM/CMakeLists.txt
@@ -74,21 +74,9 @@ add_llvm_target(ARMCodeGen
ARMDesc
ARMInfo
ARMUtils
- Analysis
- AsmPrinter
+ ${TARGET_LIBRARIES}
CFGuard
- CodeGen
- CodeGenTypes
- Core
GlobalISel
- IPO
- MC
- Scalar
- SelectionDAG
- Support
- Target
- TargetParser
- TransformUtils
ADD_TO_COMPONENT
ARM
diff --git a/llvm/lib/Target/AVR/CMakeLists.txt b/llvm/lib/Target/AVR/CMakeLists.txt
index 781dac02c7083..b18013fae6b47 100644
--- a/llvm/lib/Target/AVR/CMakeLists.txt
+++ b/llvm/lib/Target/AVR/CMakeLists.txt
@@ -36,14 +36,7 @@ add_llvm_target(AVRCodeGen
LINK_COMPONENTS
AVRDesc
AVRInfo
- AsmPrinter
- CodeGen
- CodeGenTypes
- Core
- MC
- SelectionDAG
- Support
- Target
+ ${TARGET_LIBRARIES}
ADD_TO_COMPONENT
AVR
diff --git a/llvm/lib/Target/BPF/CMakeLists.txt b/llvm/lib/Target/BPF/CMakeLists.txt
index eade4cacb7100..cf695cd6d5ceb 100644
--- a/llvm/lib/Target/BPF/CMakeLists.txt
+++ b/llvm/lib/Target/BPF/CMakeLists.txt
@@ -44,23 +44,11 @@ add_llvm_target(BPFCodeGen
BTFDebug.cpp
LINK_COMPONENTS
- Analysis
- AsmPrinter
BPFDesc
BPFInfo
- CodeGen
- CodeGenTypes
- Core
+ ${TARGET_LIBRARIES}
GlobalISel
- IPO
- MC
Passes
- Scalar
- SelectionDAG
- Support
- Target
- TargetParser
- TransformUtils
ADD_TO_COMPONENT
BPF
diff --git a/llvm/lib/Target/CMakeLists.txt b/llvm/lib/Target/CMakeLists.txt
index 9472288229cac..84248fb80a32a 100644
--- a/llvm/lib/Target/CMakeLists.txt
+++ b/llvm/lib/Target/CMakeLists.txt
@@ -19,6 +19,22 @@ add_llvm_component_library(LLVMTarget
TargetParser
)
+set(TARGET_LIBRARIES
+ Analysis
+ AsmPrinter
+ CodeGen
+ CodeGenTypes
+ Core
+ Instrumentation
+ IPO
+ MC
+ Scalar
+ SelectionDAG
+ Support
+ Target
+ TargetParser
+ TransformUtils)
+
# When building shared objects for each target there are some internal APIs
# that are used across shared objects which we can't hide.
if (NOT BUILD_SHARED_LIBS AND NOT APPLE AND
diff --git a/llvm/lib/Target/CSKY/CMakeLists.txt b/llvm/lib/Target/CSKY/CMakeLists.txt
index 4b900bc99c271..78282455309bd 100644
--- a/llvm/lib/Target/CSKY/CMakeLists.txt
+++ b/llvm/lib/Target/CSKY/CMakeLists.txt
@@ -33,17 +33,9 @@ add_llvm_target(CSKYCodeGen
CSKYTargetObjectFile.cpp
LINK_COMPONENTS
- Analysis
- AsmPrinter
CSKYDesc
CSKYInfo
- CodeGen
- CodeGenTypes
- Core
- MC
- SelectionDAG
- Support
- Target
+ ${TARGET_LIBRARIES}
ADD_TO_COMPONENT
CSKY
diff --git a/llvm/lib/Target/DirectX/CMakeLists.txt b/llvm/lib/Target/DirectX/CMakeLists.txt
index c7c09caf43667..c4a869ca8b5e8 100644
--- a/llvm/lib/Target/DirectX/CMakeLists.txt
+++ b/llvm/lib/Target/DirectX/CMakeLists.txt
@@ -39,23 +39,12 @@ add_llvm_target(DirectXCodeGen
DXILLegalizePass.cpp
LINK_COMPONENTS
- Analysis
- AsmPrinter
- CodeGen
- CodeGenTypes
- Core
DXILBitWriter
DirectXDesc
DirectXInfo
DirectXPointerTypeAnalysis
FrontendHLSL
- MC
- ScalarOpts
- SelectionDAG
- Support
- Target
- TargetParser
- TransformUtils
+ ${TARGET_LIBRARIES}
ADD_TO_COMPONENT
DirectX
diff --git a/llvm/lib/Target/Hexagon/CMakeLists.txt b/llvm/lib/Target/Hexagon/CMakeLists.txt
index d758260a8ab5d..072eea5c7885a 100644
--- a/llvm/lib/Target/Hexagon/CMakeLists.txt
+++ b/llvm/lib/Target/Hexagon/CMakeLists.txt
@@ -74,22 +74,10 @@ add_llvm_target(HexagonCodeGen
RDFDeadCode.cpp
LINK_COMPONENTS
- Analysis
- AsmPrinter
- CodeGen
- CodeGenTypes
- Core
HexagonAsmParser
HexagonDesc
HexagonInfo
- IPO
- MC
- Scalar
- SelectionDAG
- Support
- Target
- TargetParser
- TransformUtils
+ ${TARGET_LIBRARIES}
ADD_TO_COMPONENT
Hexagon
diff --git a/llvm/lib/Target/Lanai/CMakeLists.txt b/llvm/lib/Target/Lanai/CMakeLists.txt
index 4a628e13fc177..32e34747142d2 100644
--- a/llvm/lib/Target/Lanai/CMakeLists.txt
+++ b/llvm/lib/Target/Lanai/CMakeLists.txt
@@ -32,20 +32,10 @@ add_llvm_target(LanaiCodeGen
LanaiTargetObjectFile.cpp
LINK_COMPONENTS
- Analysis
- AsmPrinter
- CodeGen
- CodeGenTypes
- Core
LanaiAsmParser
LanaiDesc
LanaiInfo
- MC
- SelectionDAG
- Support
- Target
- TargetParser
- TransformUtils
+ ${TARGET_LIBRARIES}
ADD_TO_COMPONENT
Lanai
diff --git a/llvm/lib/Target/LoongArch/CMakeLists.txt b/llvm/lib/Target/LoongArch/CMakeLists.txt
index 0f674b1b0fa9e..909d0dca79b48 100644
--- a/llvm/lib/Target/LoongArch/CMakeLists.txt
+++ b/llvm/lib/Target/LoongArch/CMakeLists.txt
@@ -32,20 +32,9 @@ add_llvm_target(LoongArchCodeGen
LoongArchTargetTransformInfo.cpp
LINK_COMPONENTS
- Analysis
- AsmPrinter
- CodeGen
- CodeGenTypes
- Core
LoongArchDesc
LoongArchInfo
- MC
- Scalar
- SelectionDAG
- Support
- Target
- TargetParser
- TransformUtils
+ ${TARGET_LIBRARIES}
ADD_TO_COMPONENT
LoongArch
diff --git a/llvm/lib/Target/M68k/CMakeLists.txt b/llvm/lib/Target/M68k/CMakeLists.txt
index 7005df4fb8a82..e7892d5bb5855 100644
--- a/llvm/lib/Target/M68k/CMakeLists.txt
+++ b/llvm/lib/Target/M68k/CMakeLists.txt
@@ -39,18 +39,10 @@ add_llvm_target(M68kCodeGen
M68kTargetObjectFile.cpp
LINK_COMPONENTS
- Analysis
- AsmPrinter
- CodeGen
- CodeGenTypes
- Core
- GlobalISel
M68kDesc
M68kInfo
- MC
- SelectionDAG
- Support
- Target
+ ${TARGET_LIBRARIES}
+ GlobalISel
ADD_TO_COMPONENT
M68k
diff --git a/llvm/lib/Target/MSP430/CMakeLists.txt b/llvm/lib/Target/MSP430/CMakeLists.txt
index 4081d3472fd78..60c74238d9e9f 100644
--- a/llvm/lib/Target/MSP430/CMakeLists.txt
+++ b/llvm/lib/Target/MSP430/CMakeLists.txt
@@ -30,16 +30,9 @@ add_llvm_target(MSP430CodeGen
MSP430MCInstLower.cpp
LINK_COMPONENTS
- AsmPrinter
- CodeGen
- CodeGenTypes
- Core
- MC
MSP430Desc
MSP430Info
- SelectionDAG
- Support
- Target
+ ${TARGET_LIBRARIES}
ADD_TO_COMPONENT
MSP430
diff --git a/llvm/lib/Target/Mips/CMakeLists.txt b/llvm/lib/Target/Mips/CMakeLists.txt
index 21d1765107ae6..6dc747f0d8ead 100644
--- a/llvm/lib/Target/Mips/CMakeLists.txt
+++ b/llvm/lib/Target/Mips/CMakeLists.txt
@@ -67,20 +67,10 @@ add_llvm_target(MipsCodeGen
MipsMulMulBugPass.cpp
LINK_COMPONENTS
- Analysis
- AsmPrinter
- CodeGen
- CodeGenTypes
- Core
- GlobalISel
- MC
MipsDesc
MipsInfo
- SelectionDAG
- Support
- Target
- TargetParser
- TransformUtils
+ ${TARGET_LIBRARIES}
+ GlobalISel
ADD_TO_COMPONENT
Mips
diff --git a/llvm/lib/Target/NVPTX/CMakeLists.txt b/llvm/lib/Target/NVPTX/CMakeLists.txt
index 693f0d0b35edc..35518afa6e784 100644
--- a/llvm/lib/Target/NVPTX/CMakeLists.txt
+++ b/llvm/lib/Target/NVPTX/CMakeLists.txt
@@ -48,21 +48,9 @@ add_llvm_target(NVPTXCodeGen
${NVPTXCodeGen_sources}
LINK_COMPONENTS
- Analysis
- AsmPrinter
- CodeGen
- CodeGenTypes
- Core
- IPO
- MC
NVPTXDesc
NVPTXInfo
- Scalar
- SelectionDAG
- Support
- Target
- TargetParser
- TransformUtils
+ ${TARGET_LIBRARIES}
Vectorize
ADD_TO_COMPONENT
diff --git a/llvm/lib/Target/PowerPC/CMakeLists.txt b/llvm/lib/Target/PowerPC/CMakeLists.txt
index 3808a26a0b92a..6d4f6b889a4e8 100644
--- a/llvm/lib/Target/PowerPC/CMakeLists.txt
+++ b/llvm/lib/Target/PowerPC/CMakeLists.txt
@@ -62,22 +62,11 @@ add_llvm_target(PowerPCCodeGen
GISel/PPCLegalizerInfo.cpp
LINK_COMPONENTS
- Analysis
- AsmPrinter
- BinaryFormat
- CodeGen
- CodeGenTypes
- Core
- GlobalISel
- MC
PowerPCDesc
PowerPCInfo
- Scalar
- SelectionDAG
- Support
- Target
- TargetParser
- TransformUtils
+ ${TARGET_LIBRARIES}
+ BinaryFormat
+ GlobalISel
ADD_TO_COMPONENT
PowerPC
diff --git a/llvm/lib/Target/RISCV/CMakeLists.txt b/llvm/lib/Target/RISCV/CMakeLists.txt
index e32d6eab3b977..a1b178cc6429d 100644
--- a/llvm/lib/Target/RISCV/CMakeLists.txt
+++ b/llvm/lib/Target/RISCV/CMakeLists.txt
@@ -78,22 +78,10 @@ add_llvm_target(RISCVCodeGen
GISel/RISCVRegisterBankInfo.cpp
LINK_COMPONENTS
- Analysis
- AsmPrinter
- CodeGen
- CodeGenTypes
- Core
- GlobalISel
- IPO
- MC
RISCVDesc
RISCVInfo
- Scalar
- SelectionDAG
- Support
- Target
- TargetParser
- TransformUtils
+ ${TARGET_LIBRARIES}
+ GlobalISel
Vectorize
ADD_TO_COMPONENT
diff --git a/llvm/lib/Target/SPIRV/CMakeLists.txt b/llvm/lib/Target/SPIRV/CMakeLists.txt
index 4a2b534b948d6..f2fab35dc3989 100644
--- a/llvm/lib/Target/SPIRV/CMakeLists.txt
+++ b/llvm/lib/Target/SPIRV/CMakeLists.txt
@@ -48,23 +48,12 @@ add_llvm_target(SPIRVCodeGen
SPIRVEmitNonSemanticDI.cpp
LINK_COMPONENTS
- Analysis
- AsmPrinter
- CodeGen
- CodeGenTypes
- Core
- Demangle
- GlobalISel
SPIRVAnalysis
- MC
SPIRVDesc
SPIRVInfo
- ScalarOpts
- SelectionDAG
- Support
- Target
- TargetParser
- TransformUtils
+ ${TARGET_LIBRARIES}
+ Demangle
+ GlobalISel
ADD_TO_COMPONENT
SPIRV
diff --git a/llvm/lib/Target/Sparc/CMakeLists.txt b/llvm/lib/Target/Sparc/CMakeLists.txt
index f682719ac483f..364483c1ea13b 100644
--- a/llvm/lib/Target/Sparc/CMakeLists.txt
+++ b/llvm/lib/Target/Sparc/CMakeLists.txt
@@ -32,17 +32,9 @@ add_llvm_target(SparcCodeGen
SparcTargetObjectFile.cpp
LINK_COMPONENTS
- AsmPrinter
- CodeGen
- CodeGenTypes
- Core
- MC
- SelectionDAG
SparcDesc
SparcInfo
- Support
- Target
- TargetParser
+ ${TARGET_LIBRARIES}
ADD_TO_COMPONENT
Sparc
diff --git a/llvm/lib/Target/SystemZ/CMakeLists.txt b/llvm/lib/Target/SystemZ/CMakeLists.txt
index 0d8f3eac6ee4f..ee4a3a2d1e333 100644
--- a/llvm/lib/Target/SystemZ/CMakeLists.txt
+++ b/llvm/lib/Target/SystemZ/CMakeLists.txt
@@ -42,20 +42,9 @@ add_llvm_target(SystemZCodeGen
SystemZTDC.cpp
LINK_COMPONENTS
- Analysis
- AsmPrinter
- CodeGen
- CodeGenTypes
- Core
- MC
- Scalar
- SelectionDAG
- Support
SystemZDesc
SystemZInfo
- Target
- TargetParser
- TransformUtils
+ ${TARGET_LIBRARIES}
ADD_TO_COMPONENT
SystemZ
diff --git a/llvm/lib/Target/VE/CMakeLists.txt b/llvm/lib/Target/VE/CMakeLists.txt
index d1bb4f32fcba7..c34472a29436d 100644
--- a/llvm/lib/Target/VE/CMakeLists.txt
+++ b/llvm/lib/Target/VE/CMakeLists.txt
@@ -29,19 +29,9 @@ add_llvm_target(VECodeGen
VVPISelLowering.cpp
LINK_COMPONENTS
- Analysis
- AsmPrinter
- CodeGen
- CodeGenTypes
- Core
- MC
- SelectionDAG
- Support
- Target
- TargetParser
- TransformUtils
VEDesc
VEInfo
+ ${TARGET_LIBRARIES}
ADD_TO_COMPONENT
VE
diff --git a/llvm/lib/Target/WebAssembly/CMakeLists.txt b/llvm/lib/Target/WebAssembly/CMakeLists.txt
index 1e83cbeac50d6..ffd7c9f599f98 100644
--- a/llvm/lib/Target/WebAssembly/CMakeLists.txt
+++ b/llvm/lib/Target/WebAssembly/CMakeLists.txt
@@ -65,22 +65,11 @@ add_llvm_target(WebAssemblyCodeGen
intrinsics_gen
LINK_COMPONENTS
- Analysis
- AsmPrinter
- BinaryFormat
- CodeGen
- CodeGenTypes
- Core
- MC
- Scalar
- SelectionDAG
- Support
- Target
- TargetParser
- TransformUtils
WebAssemblyDesc
WebAssemblyInfo
WebAssemblyUtils
+ ${TARGET_LIBRARIES}
+ BinaryFormat
ADD_TO_COMPONENT
WebAssembly
diff --git a/llvm/lib/Target/X86/CMakeLists.txt b/llvm/lib/Target/X86/CMakeLists.txt
index 6627e97dd0943..27b2ef8b6d5e6 100644
--- a/llvm/lib/Target/X86/CMakeLists.txt
+++ b/llvm/lib/Target/X86/CMakeLists.txt
@@ -95,25 +95,13 @@ set(sources
add_llvm_target(X86CodeGen ${sources}
LINK_COMPONENTS
- Analysis
- AsmPrinter
+ X86Desc
+ X86Info
+ ${TARGET_LIBRARIES}
CFGuard
- CodeGen
- CodeGenTypes
- Core
GlobalISel
IRPrinter
- Instrumentation
- MC
ProfileData
- Scalar
- SelectionDAG
- Support
- Target
- TargetParser
- TransformUtils
- X86Desc
- X86Info
ADD_TO_COMPONENT
X86
diff --git a/llvm/lib/Target/XCore/CMakeLists.txt b/llvm/lib/Target/XCore/CMakeLists.txt
index f411c658b43b0..2f3959360551c 100644
--- a/llvm/lib/Target/XCore/CMakeLists.txt
+++ b/llvm/lib/Target/XCore/CMakeLists.txt
@@ -30,19 +30,9 @@ add_llvm_target(XCoreCodeGen
XCoreFrameToArgsOffsetElim.cpp
LINK_COMPONENTS
- Analysis
- AsmPrinter
- CodeGen
- CodeGenTypes
- Core
- MC
- SelectionDAG
- Support
- Target
- TargetParser
- TransformUtils
XCoreDesc
XCoreInfo
+ ${TARGET_LIBRARIES}
ADD_TO_COMPONENT
XCore
diff --git a/llvm/lib/Target/Xtensa/CMakeLists.txt b/llvm/lib/Target/Xtensa/CMakeLists.txt
index 4fc1ba6dfa650..33d42a9eb5e74 100644
--- a/llvm/lib/Target/Xtensa/CMakeLists.txt
+++ b/llvm/lib/Target/Xtensa/CMakeLists.txt
@@ -26,15 +26,9 @@ add_llvm_target(XtensaCodeGen
XtensaTargetMachine.cpp
LINK_COMPONENTS
- AsmPrinter
- CodeGen
- Core
- MC
- SelectionDAG
- Support
- Target
XtensaDesc
XtensaInfo
+ ${TARGET_LIBRARIES}
ADD_TO_COMPONENT
Xtensa
|
@llvm/pr-subscribers-backend-x86 Author: LLChris (CBSears) ChangesUsing 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 Why? 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. Full diff: https://github.com/llvm/llvm-project/pull/141271.diff 26 Files Affected:
diff --git a/llvm/lib/Target/AArch64/CMakeLists.txt b/llvm/lib/Target/AArch64/CMakeLists.txt
index 583003f2f46e6..ea37cdcf53bbf 100644
--- a/llvm/lib/Target/AArch64/CMakeLists.txt
+++ b/llvm/lib/Target/AArch64/CMakeLists.txt
@@ -98,20 +98,9 @@ add_llvm_target(AArch64CodeGen
AArch64Desc
AArch64Info
AArch64Utils
- Analysis
- AsmPrinter
+ ${TARGET_LIBRARIES}
CFGuard
- CodeGen
- CodeGenTypes
- Core
GlobalISel
- MC
- Scalar
- SelectionDAG
- Support
- Target
- TargetParser
- TransformUtils
Vectorize
ADD_TO_COMPONENT
diff --git a/llvm/lib/Target/AMDGPU/CMakeLists.txt b/llvm/lib/Target/AMDGPU/CMakeLists.txt
index c6d70ee39202e..88c7bf815ec6f 100644
--- a/llvm/lib/Target/AMDGPU/CMakeLists.txt
+++ b/llvm/lib/Target/AMDGPU/CMakeLists.txt
@@ -185,26 +185,13 @@ add_llvm_target(AMDGPUCodeGen
AMDGPUDesc
AMDGPUInfo
AMDGPUUtils
- Analysis
- AsmPrinter
+ ${TARGET_LIBRARIES}
BinaryFormat
- CodeGen
- CodeGenTypes
- Core
GlobalISel
HipStdPar
- IPO
IRPrinter
- Instrumentation
- MC
MIRParser
Passes
- Scalar
- SelectionDAG
- Support
- Target
- TargetParser
- TransformUtils
Vectorize
ADD_TO_COMPONENT
diff --git a/llvm/lib/Target/ARC/CMakeLists.txt b/llvm/lib/Target/ARC/CMakeLists.txt
index 196cc31cc5080..d1fa1ec912c35 100644
--- a/llvm/lib/Target/ARC/CMakeLists.txt
+++ b/llvm/lib/Target/ARC/CMakeLists.txt
@@ -32,17 +32,7 @@ add_llvm_target(ARCCodeGen
LINK_COMPONENTS
ARCDesc
ARCInfo
- Analysis
- AsmPrinter
- CodeGen
- CodeGenTypes
- Core
- MC
- SelectionDAG
- Support
- Target
- TargetParser
- TransformUtils
+ ${TARGET_LIBRARIES}
ADD_TO_COMPONENT
ARC
diff --git a/llvm/lib/Target/ARM/CMakeLists.txt b/llvm/lib/Target/ARM/CMakeLists.txt
index a39629bd8aeb0..1610d88ce8b75 100644
--- a/llvm/lib/Target/ARM/CMakeLists.txt
+++ b/llvm/lib/Target/ARM/CMakeLists.txt
@@ -74,21 +74,9 @@ add_llvm_target(ARMCodeGen
ARMDesc
ARMInfo
ARMUtils
- Analysis
- AsmPrinter
+ ${TARGET_LIBRARIES}
CFGuard
- CodeGen
- CodeGenTypes
- Core
GlobalISel
- IPO
- MC
- Scalar
- SelectionDAG
- Support
- Target
- TargetParser
- TransformUtils
ADD_TO_COMPONENT
ARM
diff --git a/llvm/lib/Target/AVR/CMakeLists.txt b/llvm/lib/Target/AVR/CMakeLists.txt
index 781dac02c7083..b18013fae6b47 100644
--- a/llvm/lib/Target/AVR/CMakeLists.txt
+++ b/llvm/lib/Target/AVR/CMakeLists.txt
@@ -36,14 +36,7 @@ add_llvm_target(AVRCodeGen
LINK_COMPONENTS
AVRDesc
AVRInfo
- AsmPrinter
- CodeGen
- CodeGenTypes
- Core
- MC
- SelectionDAG
- Support
- Target
+ ${TARGET_LIBRARIES}
ADD_TO_COMPONENT
AVR
diff --git a/llvm/lib/Target/BPF/CMakeLists.txt b/llvm/lib/Target/BPF/CMakeLists.txt
index eade4cacb7100..cf695cd6d5ceb 100644
--- a/llvm/lib/Target/BPF/CMakeLists.txt
+++ b/llvm/lib/Target/BPF/CMakeLists.txt
@@ -44,23 +44,11 @@ add_llvm_target(BPFCodeGen
BTFDebug.cpp
LINK_COMPONENTS
- Analysis
- AsmPrinter
BPFDesc
BPFInfo
- CodeGen
- CodeGenTypes
- Core
+ ${TARGET_LIBRARIES}
GlobalISel
- IPO
- MC
Passes
- Scalar
- SelectionDAG
- Support
- Target
- TargetParser
- TransformUtils
ADD_TO_COMPONENT
BPF
diff --git a/llvm/lib/Target/CMakeLists.txt b/llvm/lib/Target/CMakeLists.txt
index 9472288229cac..84248fb80a32a 100644
--- a/llvm/lib/Target/CMakeLists.txt
+++ b/llvm/lib/Target/CMakeLists.txt
@@ -19,6 +19,22 @@ add_llvm_component_library(LLVMTarget
TargetParser
)
+set(TARGET_LIBRARIES
+ Analysis
+ AsmPrinter
+ CodeGen
+ CodeGenTypes
+ Core
+ Instrumentation
+ IPO
+ MC
+ Scalar
+ SelectionDAG
+ Support
+ Target
+ TargetParser
+ TransformUtils)
+
# When building shared objects for each target there are some internal APIs
# that are used across shared objects which we can't hide.
if (NOT BUILD_SHARED_LIBS AND NOT APPLE AND
diff --git a/llvm/lib/Target/CSKY/CMakeLists.txt b/llvm/lib/Target/CSKY/CMakeLists.txt
index 4b900bc99c271..78282455309bd 100644
--- a/llvm/lib/Target/CSKY/CMakeLists.txt
+++ b/llvm/lib/Target/CSKY/CMakeLists.txt
@@ -33,17 +33,9 @@ add_llvm_target(CSKYCodeGen
CSKYTargetObjectFile.cpp
LINK_COMPONENTS
- Analysis
- AsmPrinter
CSKYDesc
CSKYInfo
- CodeGen
- CodeGenTypes
- Core
- MC
- SelectionDAG
- Support
- Target
+ ${TARGET_LIBRARIES}
ADD_TO_COMPONENT
CSKY
diff --git a/llvm/lib/Target/DirectX/CMakeLists.txt b/llvm/lib/Target/DirectX/CMakeLists.txt
index c7c09caf43667..c4a869ca8b5e8 100644
--- a/llvm/lib/Target/DirectX/CMakeLists.txt
+++ b/llvm/lib/Target/DirectX/CMakeLists.txt
@@ -39,23 +39,12 @@ add_llvm_target(DirectXCodeGen
DXILLegalizePass.cpp
LINK_COMPONENTS
- Analysis
- AsmPrinter
- CodeGen
- CodeGenTypes
- Core
DXILBitWriter
DirectXDesc
DirectXInfo
DirectXPointerTypeAnalysis
FrontendHLSL
- MC
- ScalarOpts
- SelectionDAG
- Support
- Target
- TargetParser
- TransformUtils
+ ${TARGET_LIBRARIES}
ADD_TO_COMPONENT
DirectX
diff --git a/llvm/lib/Target/Hexagon/CMakeLists.txt b/llvm/lib/Target/Hexagon/CMakeLists.txt
index d758260a8ab5d..072eea5c7885a 100644
--- a/llvm/lib/Target/Hexagon/CMakeLists.txt
+++ b/llvm/lib/Target/Hexagon/CMakeLists.txt
@@ -74,22 +74,10 @@ add_llvm_target(HexagonCodeGen
RDFDeadCode.cpp
LINK_COMPONENTS
- Analysis
- AsmPrinter
- CodeGen
- CodeGenTypes
- Core
HexagonAsmParser
HexagonDesc
HexagonInfo
- IPO
- MC
- Scalar
- SelectionDAG
- Support
- Target
- TargetParser
- TransformUtils
+ ${TARGET_LIBRARIES}
ADD_TO_COMPONENT
Hexagon
diff --git a/llvm/lib/Target/Lanai/CMakeLists.txt b/llvm/lib/Target/Lanai/CMakeLists.txt
index 4a628e13fc177..32e34747142d2 100644
--- a/llvm/lib/Target/Lanai/CMakeLists.txt
+++ b/llvm/lib/Target/Lanai/CMakeLists.txt
@@ -32,20 +32,10 @@ add_llvm_target(LanaiCodeGen
LanaiTargetObjectFile.cpp
LINK_COMPONENTS
- Analysis
- AsmPrinter
- CodeGen
- CodeGenTypes
- Core
LanaiAsmParser
LanaiDesc
LanaiInfo
- MC
- SelectionDAG
- Support
- Target
- TargetParser
- TransformUtils
+ ${TARGET_LIBRARIES}
ADD_TO_COMPONENT
Lanai
diff --git a/llvm/lib/Target/LoongArch/CMakeLists.txt b/llvm/lib/Target/LoongArch/CMakeLists.txt
index 0f674b1b0fa9e..909d0dca79b48 100644
--- a/llvm/lib/Target/LoongArch/CMakeLists.txt
+++ b/llvm/lib/Target/LoongArch/CMakeLists.txt
@@ -32,20 +32,9 @@ add_llvm_target(LoongArchCodeGen
LoongArchTargetTransformInfo.cpp
LINK_COMPONENTS
- Analysis
- AsmPrinter
- CodeGen
- CodeGenTypes
- Core
LoongArchDesc
LoongArchInfo
- MC
- Scalar
- SelectionDAG
- Support
- Target
- TargetParser
- TransformUtils
+ ${TARGET_LIBRARIES}
ADD_TO_COMPONENT
LoongArch
diff --git a/llvm/lib/Target/M68k/CMakeLists.txt b/llvm/lib/Target/M68k/CMakeLists.txt
index 7005df4fb8a82..e7892d5bb5855 100644
--- a/llvm/lib/Target/M68k/CMakeLists.txt
+++ b/llvm/lib/Target/M68k/CMakeLists.txt
@@ -39,18 +39,10 @@ add_llvm_target(M68kCodeGen
M68kTargetObjectFile.cpp
LINK_COMPONENTS
- Analysis
- AsmPrinter
- CodeGen
- CodeGenTypes
- Core
- GlobalISel
M68kDesc
M68kInfo
- MC
- SelectionDAG
- Support
- Target
+ ${TARGET_LIBRARIES}
+ GlobalISel
ADD_TO_COMPONENT
M68k
diff --git a/llvm/lib/Target/MSP430/CMakeLists.txt b/llvm/lib/Target/MSP430/CMakeLists.txt
index 4081d3472fd78..60c74238d9e9f 100644
--- a/llvm/lib/Target/MSP430/CMakeLists.txt
+++ b/llvm/lib/Target/MSP430/CMakeLists.txt
@@ -30,16 +30,9 @@ add_llvm_target(MSP430CodeGen
MSP430MCInstLower.cpp
LINK_COMPONENTS
- AsmPrinter
- CodeGen
- CodeGenTypes
- Core
- MC
MSP430Desc
MSP430Info
- SelectionDAG
- Support
- Target
+ ${TARGET_LIBRARIES}
ADD_TO_COMPONENT
MSP430
diff --git a/llvm/lib/Target/Mips/CMakeLists.txt b/llvm/lib/Target/Mips/CMakeLists.txt
index 21d1765107ae6..6dc747f0d8ead 100644
--- a/llvm/lib/Target/Mips/CMakeLists.txt
+++ b/llvm/lib/Target/Mips/CMakeLists.txt
@@ -67,20 +67,10 @@ add_llvm_target(MipsCodeGen
MipsMulMulBugPass.cpp
LINK_COMPONENTS
- Analysis
- AsmPrinter
- CodeGen
- CodeGenTypes
- Core
- GlobalISel
- MC
MipsDesc
MipsInfo
- SelectionDAG
- Support
- Target
- TargetParser
- TransformUtils
+ ${TARGET_LIBRARIES}
+ GlobalISel
ADD_TO_COMPONENT
Mips
diff --git a/llvm/lib/Target/NVPTX/CMakeLists.txt b/llvm/lib/Target/NVPTX/CMakeLists.txt
index 693f0d0b35edc..35518afa6e784 100644
--- a/llvm/lib/Target/NVPTX/CMakeLists.txt
+++ b/llvm/lib/Target/NVPTX/CMakeLists.txt
@@ -48,21 +48,9 @@ add_llvm_target(NVPTXCodeGen
${NVPTXCodeGen_sources}
LINK_COMPONENTS
- Analysis
- AsmPrinter
- CodeGen
- CodeGenTypes
- Core
- IPO
- MC
NVPTXDesc
NVPTXInfo
- Scalar
- SelectionDAG
- Support
- Target
- TargetParser
- TransformUtils
+ ${TARGET_LIBRARIES}
Vectorize
ADD_TO_COMPONENT
diff --git a/llvm/lib/Target/PowerPC/CMakeLists.txt b/llvm/lib/Target/PowerPC/CMakeLists.txt
index 3808a26a0b92a..6d4f6b889a4e8 100644
--- a/llvm/lib/Target/PowerPC/CMakeLists.txt
+++ b/llvm/lib/Target/PowerPC/CMakeLists.txt
@@ -62,22 +62,11 @@ add_llvm_target(PowerPCCodeGen
GISel/PPCLegalizerInfo.cpp
LINK_COMPONENTS
- Analysis
- AsmPrinter
- BinaryFormat
- CodeGen
- CodeGenTypes
- Core
- GlobalISel
- MC
PowerPCDesc
PowerPCInfo
- Scalar
- SelectionDAG
- Support
- Target
- TargetParser
- TransformUtils
+ ${TARGET_LIBRARIES}
+ BinaryFormat
+ GlobalISel
ADD_TO_COMPONENT
PowerPC
diff --git a/llvm/lib/Target/RISCV/CMakeLists.txt b/llvm/lib/Target/RISCV/CMakeLists.txt
index e32d6eab3b977..a1b178cc6429d 100644
--- a/llvm/lib/Target/RISCV/CMakeLists.txt
+++ b/llvm/lib/Target/RISCV/CMakeLists.txt
@@ -78,22 +78,10 @@ add_llvm_target(RISCVCodeGen
GISel/RISCVRegisterBankInfo.cpp
LINK_COMPONENTS
- Analysis
- AsmPrinter
- CodeGen
- CodeGenTypes
- Core
- GlobalISel
- IPO
- MC
RISCVDesc
RISCVInfo
- Scalar
- SelectionDAG
- Support
- Target
- TargetParser
- TransformUtils
+ ${TARGET_LIBRARIES}
+ GlobalISel
Vectorize
ADD_TO_COMPONENT
diff --git a/llvm/lib/Target/SPIRV/CMakeLists.txt b/llvm/lib/Target/SPIRV/CMakeLists.txt
index 4a2b534b948d6..f2fab35dc3989 100644
--- a/llvm/lib/Target/SPIRV/CMakeLists.txt
+++ b/llvm/lib/Target/SPIRV/CMakeLists.txt
@@ -48,23 +48,12 @@ add_llvm_target(SPIRVCodeGen
SPIRVEmitNonSemanticDI.cpp
LINK_COMPONENTS
- Analysis
- AsmPrinter
- CodeGen
- CodeGenTypes
- Core
- Demangle
- GlobalISel
SPIRVAnalysis
- MC
SPIRVDesc
SPIRVInfo
- ScalarOpts
- SelectionDAG
- Support
- Target
- TargetParser
- TransformUtils
+ ${TARGET_LIBRARIES}
+ Demangle
+ GlobalISel
ADD_TO_COMPONENT
SPIRV
diff --git a/llvm/lib/Target/Sparc/CMakeLists.txt b/llvm/lib/Target/Sparc/CMakeLists.txt
index f682719ac483f..364483c1ea13b 100644
--- a/llvm/lib/Target/Sparc/CMakeLists.txt
+++ b/llvm/lib/Target/Sparc/CMakeLists.txt
@@ -32,17 +32,9 @@ add_llvm_target(SparcCodeGen
SparcTargetObjectFile.cpp
LINK_COMPONENTS
- AsmPrinter
- CodeGen
- CodeGenTypes
- Core
- MC
- SelectionDAG
SparcDesc
SparcInfo
- Support
- Target
- TargetParser
+ ${TARGET_LIBRARIES}
ADD_TO_COMPONENT
Sparc
diff --git a/llvm/lib/Target/SystemZ/CMakeLists.txt b/llvm/lib/Target/SystemZ/CMakeLists.txt
index 0d8f3eac6ee4f..ee4a3a2d1e333 100644
--- a/llvm/lib/Target/SystemZ/CMakeLists.txt
+++ b/llvm/lib/Target/SystemZ/CMakeLists.txt
@@ -42,20 +42,9 @@ add_llvm_target(SystemZCodeGen
SystemZTDC.cpp
LINK_COMPONENTS
- Analysis
- AsmPrinter
- CodeGen
- CodeGenTypes
- Core
- MC
- Scalar
- SelectionDAG
- Support
SystemZDesc
SystemZInfo
- Target
- TargetParser
- TransformUtils
+ ${TARGET_LIBRARIES}
ADD_TO_COMPONENT
SystemZ
diff --git a/llvm/lib/Target/VE/CMakeLists.txt b/llvm/lib/Target/VE/CMakeLists.txt
index d1bb4f32fcba7..c34472a29436d 100644
--- a/llvm/lib/Target/VE/CMakeLists.txt
+++ b/llvm/lib/Target/VE/CMakeLists.txt
@@ -29,19 +29,9 @@ add_llvm_target(VECodeGen
VVPISelLowering.cpp
LINK_COMPONENTS
- Analysis
- AsmPrinter
- CodeGen
- CodeGenTypes
- Core
- MC
- SelectionDAG
- Support
- Target
- TargetParser
- TransformUtils
VEDesc
VEInfo
+ ${TARGET_LIBRARIES}
ADD_TO_COMPONENT
VE
diff --git a/llvm/lib/Target/WebAssembly/CMakeLists.txt b/llvm/lib/Target/WebAssembly/CMakeLists.txt
index 1e83cbeac50d6..ffd7c9f599f98 100644
--- a/llvm/lib/Target/WebAssembly/CMakeLists.txt
+++ b/llvm/lib/Target/WebAssembly/CMakeLists.txt
@@ -65,22 +65,11 @@ add_llvm_target(WebAssemblyCodeGen
intrinsics_gen
LINK_COMPONENTS
- Analysis
- AsmPrinter
- BinaryFormat
- CodeGen
- CodeGenTypes
- Core
- MC
- Scalar
- SelectionDAG
- Support
- Target
- TargetParser
- TransformUtils
WebAssemblyDesc
WebAssemblyInfo
WebAssemblyUtils
+ ${TARGET_LIBRARIES}
+ BinaryFormat
ADD_TO_COMPONENT
WebAssembly
diff --git a/llvm/lib/Target/X86/CMakeLists.txt b/llvm/lib/Target/X86/CMakeLists.txt
index 6627e97dd0943..27b2ef8b6d5e6 100644
--- a/llvm/lib/Target/X86/CMakeLists.txt
+++ b/llvm/lib/Target/X86/CMakeLists.txt
@@ -95,25 +95,13 @@ set(sources
add_llvm_target(X86CodeGen ${sources}
LINK_COMPONENTS
- Analysis
- AsmPrinter
+ X86Desc
+ X86Info
+ ${TARGET_LIBRARIES}
CFGuard
- CodeGen
- CodeGenTypes
- Core
GlobalISel
IRPrinter
- Instrumentation
- MC
ProfileData
- Scalar
- SelectionDAG
- Support
- Target
- TargetParser
- TransformUtils
- X86Desc
- X86Info
ADD_TO_COMPONENT
X86
diff --git a/llvm/lib/Target/XCore/CMakeLists.txt b/llvm/lib/Target/XCore/CMakeLists.txt
index f411c658b43b0..2f3959360551c 100644
--- a/llvm/lib/Target/XCore/CMakeLists.txt
+++ b/llvm/lib/Target/XCore/CMakeLists.txt
@@ -30,19 +30,9 @@ add_llvm_target(XCoreCodeGen
XCoreFrameToArgsOffsetElim.cpp
LINK_COMPONENTS
- Analysis
- AsmPrinter
- CodeGen
- CodeGenTypes
- Core
- MC
- SelectionDAG
- Support
- Target
- TargetParser
- TransformUtils
XCoreDesc
XCoreInfo
+ ${TARGET_LIBRARIES}
ADD_TO_COMPONENT
XCore
diff --git a/llvm/lib/Target/Xtensa/CMakeLists.txt b/llvm/lib/Target/Xtensa/CMakeLists.txt
index 4fc1ba6dfa650..33d42a9eb5e74 100644
--- a/llvm/lib/Target/Xtensa/CMakeLists.txt
+++ b/llvm/lib/Target/Xtensa/CMakeLists.txt
@@ -26,15 +26,9 @@ add_llvm_target(XtensaCodeGen
XtensaTargetMachine.cpp
LINK_COMPONENTS
- AsmPrinter
- CodeGen
- Core
- MC
- SelectionDAG
- Support
- Target
XtensaDesc
XtensaInfo
+ ${TARGET_LIBRARIES}
ADD_TO_COMPONENT
Xtensa
|
Thanks! This looks great. However, I was confused by the three sections.
How about |
This commit moves common target dependencies into ${TARGET_LIBRARIES} and 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
Why? 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.