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

Lines changed: 1 addition & 0 deletions
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

Lines changed: 1 addition & 0 deletions
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

Lines changed: 1 addition & 0 deletions
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

Lines changed: 1 addition & 0 deletions
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

Lines changed: 1 addition & 0 deletions
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

Lines changed: 1 addition & 0 deletions
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

Lines changed: 3 additions & 3 deletions
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

Lines changed: 1 addition & 0 deletions
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

Lines changed: 1 addition & 0 deletions
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

Lines changed: 1 addition & 0 deletions
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)

0 commit comments

Comments
 (0)