Skip to content

Commit f09cf34

Browse files
committed
[Support] Move TargetParsers to new component
This is a fairly large changeset, but it can be broken into a few pieces: - `llvm/Support/*TargetParser*` are all moved from the LLVM Support component into a new LLVM Component called "TargetParser". This potentially enables using tablegen to maintain this information, as is shown in https://reviews.llvm.org/D137517. This cannot currently be done, as llvm-tblgen relies on LLVM's Support component. - This also moves two files from Support which use and depend on information in the TargetParser: - `llvm/Support/Host.{h,cpp}` which contains functions for inspecting the current Host machine for info about it, primarily to support getting the host triple, but also for `-mcpu=native` support in e.g. Clang. This is fairly tightly intertwined with the information in `X86TargetParser.h`, so keeping them in the same component makes sense. - `llvm/ADT/Triple.h` and `llvm/Support/Triple.cpp`, which contains the target triple parser and representation. This is very intertwined with the Arm target parser, because the arm architecture version appears in canonical triples on arm platforms. - I moved the relevant unittests to their own directory. And so, we end up with a single component that has all the information about the following, which to me seems like a unified component: - Triples that LLVM Knows about - Architecture names and CPUs that LLVM knows about - CPU detection logic for LLVM Given this, I have also moved `RISCVISAInfo.h` into this component, as it seems to me to be part of that same set of functionality. If you get link errors in your components after this patch, you likely need to add TargetParser into LLVM_LINK_COMPONENTS in CMake. Differential Revision: https://reviews.llvm.org/D137838
1 parent 57aac3d commit f09cf34

File tree

295 files changed

+3156
-2704
lines changed

Some content is hidden

Large Commits have some content hidden by default. Use the searchbox below for content that may be hidden.

295 files changed

+3156
-2704
lines changed

bolt/lib/Core/CMakeLists.txt

+1
Original file line numberDiff line numberDiff line change
@@ -5,6 +5,7 @@ set(LLVM_LINK_COMPONENTS
55
MCDisassembler
66
Object
77
Support
8+
TargetParser
89
)
910

1011
add_llvm_library(LLVMBOLTCore

bolt/lib/Passes/CMakeLists.txt

+1
Original file line numberDiff line numberDiff line change
@@ -56,6 +56,7 @@ add_llvm_library(LLVMBOLTPasses
5656
AsmPrinter
5757
MC
5858
Support
59+
TargetParser
5960
TransformUtils
6061
)
6162

bolt/lib/Rewrite/CMakeLists.txt

+1
Original file line numberDiff line numberDiff line change
@@ -5,6 +5,7 @@ set(LLVM_LINK_COMPONENTS
55
MC
66
Object
77
Support
8+
TargetParser
89
)
910

1011
set(TARGET_LINK_LIBRARIES

clang-tools-extra/clang-tidy/portability/CMakeLists.txt

+1
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,7 @@
11
set(LLVM_LINK_COMPONENTS
22
FrontendOpenMP
33
Support
4+
TargetParser
45
)
56

67
add_clang_library(clangTidyPortabilityModule

clang-tools-extra/clangd/CMakeLists.txt

+1
Original file line numberDiff line numberDiff line change
@@ -44,6 +44,7 @@ set(LLVM_LINK_COMPONENTS
4444
AllTargetsInfos
4545
FrontendOpenMP
4646
Option
47+
TargetParser
4748
)
4849

4950
set(COMPLETIONMODEL_SOURCES)

clang-tools-extra/modularize/CMakeLists.txt

+1
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,7 @@
11
set(LLVM_LINK_COMPONENTS
22
Option
33
Support
4+
TargetParser
45
)
56

67
add_clang_tool(modularize

clang/docs/tools/clang-formatted-files.txt

+3-3
Original file line numberDiff line numberDiff line change
@@ -5484,7 +5484,7 @@ llvm/include/llvm/Support/CodeGenCoverage.h
54845484
llvm/include/llvm/Support/CRC.h
54855485
llvm/include/llvm/Support/CSKYAttributeParser.h
54865486
llvm/include/llvm/Support/CSKYAttributes.h
5487-
llvm/include/llvm/Support/CSKYTargetParser.h
5487+
llvm/include/llvm/TargetParser/CSKYTargetParser.h
54885488
llvm/include/llvm/Support/DataTypes.h
54895489
llvm/include/llvm/Support/DebugCounter.h
54905490
llvm/include/llvm/Support/Discriminator.h
@@ -5511,7 +5511,7 @@ llvm/include/llvm/Support/PGOOptions.h
55115511
llvm/include/llvm/Support/PointerLikeTypeTraits.h
55125512
llvm/include/llvm/Support/RISCVAttributeParser.h
55135513
llvm/include/llvm/Support/RISCVAttributes.h
5514-
llvm/include/llvm/Support/RISCVISAInfo.h
5514+
llvm/include/llvm/TargetParser/RISCVISAInfo.h
55155515
llvm/include/llvm/Support/RWMutex.h
55165516
llvm/include/llvm/Support/ScopedPrinter.h
55175517
llvm/include/llvm/Support/SHA256.h
@@ -5523,7 +5523,7 @@ llvm/include/llvm/Support/SourceMgr.h
55235523
llvm/include/llvm/Support/SuffixTree.h
55245524
llvm/include/llvm/Support/SymbolRemappingReader.h
55255525
llvm/include/llvm/Support/SystemUtils.h
5526-
llvm/include/llvm/Support/TargetParser.h
5526+
llvm/include/llvm/TargetParser/TargetParser.h
55275527
llvm/include/llvm/Support/TrailingObjects.h
55285528
llvm/include/llvm/Support/Unicode.h
55295529
llvm/include/llvm/Support/UnicodeCharRanges.h

clang/lib/ARCMigrate/CMakeLists.txt

+1
Original file line numberDiff line numberDiff line change
@@ -1,5 +1,6 @@
11
set(LLVM_LINK_COMPONENTS
22
Support
3+
TargetParser
34
)
45

56
# By default MSVC has a 2^16 limit on the number of sections in an object

clang/lib/AST/CMakeLists.txt

+1
Original file line numberDiff line numberDiff line change
@@ -3,6 +3,7 @@ set(LLVM_LINK_COMPONENTS
33
Core
44
FrontendOpenMP
55
Support
6+
TargetParser
67
)
78

89
# FIXME: the entry points to the interpreter should be moved out of clangAST

clang/lib/Basic/CMakeLists.txt

+1
Original file line numberDiff line numberDiff line change
@@ -1,5 +1,6 @@
11
set(LLVM_LINK_COMPONENTS
22
Support
3+
TargetParser
34
)
45

56
find_first_existing_vc_file("${LLVM_MAIN_SRC_DIR}" llvm_vc)

clang/lib/CodeGen/CMakeLists.txt

+1
Original file line numberDiff line numberDiff line change
@@ -26,6 +26,7 @@ set(LLVM_LINK_COMPONENTS
2626
ScalarOpts
2727
Support
2828
Target
29+
TargetParser
2930
TransformUtils
3031
)
3132

clang/lib/CrossTU/CMakeLists.txt

+1
Original file line numberDiff line numberDiff line change
@@ -1,5 +1,6 @@
11
set(LLVM_LINK_COMPONENTS
22
Support
3+
TargetParser
34
)
45

56
add_clang_library(clangCrossTU

clang/lib/Driver/CMakeLists.txt

+1
Original file line numberDiff line numberDiff line change
@@ -5,6 +5,7 @@ set(LLVM_LINK_COMPONENTS
55
Option
66
ProfileData
77
Support
8+
TargetParser
89
WindowsDriver
910
)
1011

clang/lib/ExtractAPI/CMakeLists.txt

+1
Original file line numberDiff line numberDiff line change
@@ -1,5 +1,6 @@
11
set(LLVM_LINK_COMPONENTS
22
Support
3+
TargetParser
34
)
45

56
add_clang_library(clangExtractAPI

clang/lib/Frontend/CMakeLists.txt

+1
Original file line numberDiff line numberDiff line change
@@ -6,6 +6,7 @@ set(LLVM_LINK_COMPONENTS
66
Option
77
ProfileData
88
Support
9+
TargetParser
910
)
1011

1112
add_clang_library(clangFrontend

clang/lib/Interpreter/CMakeLists.txt

+1
Original file line numberDiff line numberDiff line change
@@ -5,6 +5,7 @@ set(LLVM_LINK_COMPONENTS
55
OrcJit
66
Support
77
Target
8+
TargetParser
89
)
910

1011
add_clang_library(clangInterpreter

clang/lib/Lex/CMakeLists.txt

+4-1
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,9 @@
11
# TODO: Add -maltivec when ARCH is PowerPC.
22

3-
set(LLVM_LINK_COMPONENTS support)
3+
set(LLVM_LINK_COMPONENTS
4+
Support
5+
TargetParser
6+
)
47

58
add_clang_library(clangLex
69
DependencyDirectivesScanner.cpp

clang/lib/Parse/CMakeLists.txt

+1
Original file line numberDiff line numberDiff line change
@@ -3,6 +3,7 @@ set(LLVM_LINK_COMPONENTS
33
MC
44
MCParser
55
Support
6+
TargetParser
67
)
78

89
add_clang_library(clangParse

clang/lib/Sema/CMakeLists.txt

+1
Original file line numberDiff line numberDiff line change
@@ -4,6 +4,7 @@ set(LLVM_LINK_COMPONENTS
44
FrontendOpenMP
55
MC
66
Support
7+
TargetParser
78
)
89

910
clang_tablegen(OpenCLBuiltins.inc -gen-clang-opencl-builtins

clang/lib/Serialization/CMakeLists.txt

+1
Original file line numberDiff line numberDiff line change
@@ -2,6 +2,7 @@ set(LLVM_LINK_COMPONENTS
22
BitReader
33
BitstreamReader
44
Support
5+
TargetParser
56
)
67

78

clang/lib/StaticAnalyzer/Checkers/CMakeLists.txt

+1
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,7 @@
11
set(LLVM_LINK_COMPONENTS
22
FrontendOpenMP
33
Support
4+
TargetParser
45
)
56

67
add_clang_library(clangStaticAnalyzerCheckers

clang/lib/Tooling/CMakeLists.txt

+1
Original file line numberDiff line numberDiff line change
@@ -2,6 +2,7 @@ set(LLVM_LINK_COMPONENTS
22
Option
33
FrontendOpenMP
44
Support
5+
TargetParser
56
)
67

78
add_subdirectory(Core)

clang/lib/Tooling/DependencyScanning/CMakeLists.txt

+1
Original file line numberDiff line numberDiff line change
@@ -3,6 +3,7 @@ set(LLVM_LINK_COMPONENTS
33
Core
44
Option
55
Support
6+
TargetParser
67
)
78

89
add_clang_library(clangDependencyScanning

clang/tools/clang-fuzzer/handle-llvm/CMakeLists.txt

+1
Original file line numberDiff line numberDiff line change
@@ -14,6 +14,7 @@ set(LLVM_LINK_COMPONENTS
1414
SelectionDAG
1515
Support
1616
Target
17+
TargetParser
1718
TransformUtils
1819
native
1920
)

clang/tools/clang-import-test/CMakeLists.txt

+1
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,7 @@
11
set(LLVM_LINK_COMPONENTS
22
Core
33
Support
4+
TargetParser
45
)
56

67
add_clang_executable(clang-import-test

clang/tools/clang-linker-wrapper/CMakeLists.txt

+4-2
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,6 @@
11
include(GNUInstallDirs)
22

3-
set(LLVM_LINK_COMPONENTS
3+
set(LLVM_LINK_COMPONENTS
44
${LLVM_TARGETS_TO_BUILD}
55
BitWriter
66
Core
@@ -14,8 +14,10 @@ set(LLVM_LINK_COMPONENTS
1414
Object
1515
Option
1616
Support
17+
TargetParser
1718
CodeGen
18-
LTO)
19+
LTO
20+
)
1921

2022
set(LLVM_TARGET_DEFINITIONS LinkerWrapperOpts.td)
2123
tablegen(LLVM LinkerWrapperOpts.inc -gen-opt-parser-defs)

clang/tools/clang-offload-bundler/CMakeLists.txt

+5-1
Original file line numberDiff line numberDiff line change
@@ -1,4 +1,8 @@
1-
set(LLVM_LINK_COMPONENTS Object Support)
1+
set(LLVM_LINK_COMPONENTS
2+
Object
3+
Support
4+
TargetParser
5+
)
26

37
add_clang_tool(clang-offload-bundler
48
ClangOffloadBundler.cpp

clang/tools/driver/CMakeLists.txt

+1
Original file line numberDiff line numberDiff line change
@@ -13,6 +13,7 @@ set( LLVM_LINK_COMPONENTS
1313
Option
1414
ScalarOpts
1515
Support
16+
TargetParser
1617
TransformUtils
1718
Vectorize
1819
)

clang/tools/libclang/CMakeLists.txt

+1
Original file line numberDiff line numberDiff line change
@@ -149,6 +149,7 @@ add_clang_library(libclang ${ENABLE_SHARED} ${ENABLE_STATIC} INSTALL_WITH_TOOLCH
149149
${LLVM_TARGETS_TO_BUILD}
150150
Core
151151
Support
152+
TargetParser
152153
)
153154

154155
if(ENABLE_STATIC)

clang/unittests/AST/CMakeLists.txt

+1
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,7 @@
11
set(LLVM_LINK_COMPONENTS
22
FrontendOpenMP
33
Support
4+
TargetParser
45
)
56

67

clang/unittests/ASTMatchers/CMakeLists.txt

+1
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,7 @@
11
set(LLVM_LINK_COMPONENTS
22
FrontendOpenMP
33
Support
4+
TargetParser
45
)
56

67
add_clang_unittest(ASTMatchersTests

clang/unittests/CodeGen/CMakeLists.txt

+1
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,7 @@
11
set(LLVM_LINK_COMPONENTS
22
Core
33
Support
4+
TargetParser
45
)
56

67
add_clang_unittest(ClangCodeGenTests

clang/unittests/Driver/CMakeLists.txt

+1
Original file line numberDiff line numberDiff line change
@@ -3,6 +3,7 @@ set(LLVM_LINK_COMPONENTS
33
MC
44
Option
55
Support
6+
TargetParser
67
)
78

89
add_clang_unittest(ClangDriverTests

clang/unittests/Frontend/CMakeLists.txt

+1
Original file line numberDiff line numberDiff line change
@@ -1,5 +1,6 @@
11
set(LLVM_LINK_COMPONENTS
22
Support
3+
TargetParser
34
)
45

56
add_clang_unittest(FrontendTests

clang/unittests/Interpreter/CMakeLists.txt

+1
Original file line numberDiff line numberDiff line change
@@ -3,6 +3,7 @@ set(LLVM_LINK_COMPONENTS
33
Core
44
OrcJIT
55
Support
6+
TargetParser
67
)
78

89
add_clang_unittest(ClangReplInterpreterTests

clang/unittests/Tooling/CMakeLists.txt

+1
Original file line numberDiff line numberDiff line change
@@ -4,6 +4,7 @@ set(LLVM_LINK_COMPONENTS
44
Option
55
FrontendOpenMP
66
Support
7+
TargetParser
78
)
89

910

flang/lib/Frontend/CMakeLists.txt

+1
Original file line numberDiff line numberDiff line change
@@ -48,6 +48,7 @@ add_flang_library(flangFrontend
4848
Option
4949
Support
5050
Target
51+
TargetParser
5152
FrontendOpenACC
5253
FrontendOpenMP
5354
)

flang/lib/Optimizer/CodeGen/CMakeLists.txt

+1
Original file line numberDiff line numberDiff line change
@@ -30,4 +30,5 @@ add_flang_library(FIRCodeGen
3030
AsmParser
3131
AsmPrinter
3232
Remarks
33+
TargetParser
3334
)

flang/lib/Optimizer/Support/CMakeLists.txt

+3
Original file line numberDiff line numberDiff line change
@@ -17,4 +17,7 @@ add_flang_library(FIRSupport
1717
MLIROpenMPToLLVMIRTranslation
1818
MLIRLLVMToLLVMIRTranslation
1919
MLIRTargetLLVMIRExport
20+
21+
LINK_COMPONENTS
22+
TargetParser
2023
)

flang/tools/bbc/CMakeLists.txt

+1
Original file line numberDiff line numberDiff line change
@@ -1,5 +1,6 @@
11
set(LLVM_LINK_COMPONENTS
22
Passes
3+
TargetParser
34
)
45

56
add_flang_tool(bbc bbc.cpp

flang/tools/flang-driver/CMakeLists.txt

+1
Original file line numberDiff line numberDiff line change
@@ -8,6 +8,7 @@ set( LLVM_LINK_COMPONENTS
88
${LLVM_TARGETS_TO_BUILD}
99
Option
1010
Support
11+
TargetParser
1112
)
1213

1314
add_flang_tool(flang-new

flang/unittests/Frontend/CMakeLists.txt

+1
Original file line numberDiff line numberDiff line change
@@ -1,5 +1,6 @@
11
set(LLVM_LINK_COMPONENTS
22
${LLVM_TARGETS_TO_BUILD}
3+
TargetParser
34
)
45

56
add_flang_unittest(FlangFrontendTests

flang/unittests/Optimizer/CMakeLists.txt

+1
Original file line numberDiff line numberDiff line change
@@ -7,6 +7,7 @@ set(LIBS
77
FIRSupport
88
HLFIRDialect
99
${dialect_libs}
10+
LLVMTargetParser
1011
)
1112

1213
add_flang_unittest(FlangOptimizerTests

libc/benchmarks/CMakeLists.txt

+4-1
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,9 @@
11
find_package(Threads)
22

3-
set(LLVM_LINK_COMPONENTS Support)
3+
set(LLVM_LINK_COMPONENTS
4+
Support
5+
TargetParser
6+
)
47

58
#==============================================================================
69
# Add Unit Testing Support

lld/COFF/CMakeLists.txt

+1
Original file line numberDiff line numberDiff line change
@@ -38,6 +38,7 @@ add_lld_library(lldCOFF
3838
Option
3939
Passes
4040
Support
41+
TargetParser
4142
WindowsDriver
4243
WindowsManifest
4344

lld/Common/CMakeLists.txt

+1
Original file line numberDiff line numberDiff line change
@@ -46,6 +46,7 @@ add_lld_library(lldCommon
4646
Option
4747
Support
4848
Target
49+
TargetParser
4950

5051
LINK_LIBS
5152
${LLVM_PTHREAD_LIB}

0 commit comments

Comments
 (0)