Skip to content

Commit 89b5706

Browse files
committed
Move TargetRegistry.(h|cpp) from Support to MC
This moves the registry higher in the LLVM library dependency stack. Every client of the target registry needs to link against MC anyway to actually use the target, so we might as well move this out of Support. This allows us to ensure that Support doesn't have includes from MC/*. Differential Revision: https://reviews.llvm.org/D111454
1 parent 3db1ade commit 89b5706

File tree

296 files changed

+319
-321
lines changed

Some content is hidden

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

296 files changed

+319
-321
lines changed

clang/lib/CodeGen/BackendUtil.cpp

+1-1
Original file line numberDiff line numberDiff line change
@@ -38,14 +38,14 @@
3838
#include "llvm/LTO/LTOBackend.h"
3939
#include "llvm/MC/MCAsmInfo.h"
4040
#include "llvm/MC/SubtargetFeature.h"
41+
#include "llvm/MC/TargetRegistry.h"
4142
#include "llvm/Passes/PassBuilder.h"
4243
#include "llvm/Passes/PassPlugin.h"
4344
#include "llvm/Passes/StandardInstrumentations.h"
4445
#include "llvm/Support/BuryPointer.h"
4546
#include "llvm/Support/CommandLine.h"
4647
#include "llvm/Support/MemoryBuffer.h"
4748
#include "llvm/Support/PrettyStackTrace.h"
48-
#include "llvm/Support/TargetRegistry.h"
4949
#include "llvm/Support/TimeProfiler.h"
5050
#include "llvm/Support/Timer.h"
5151
#include "llvm/Support/ToolOutputFile.h"

clang/lib/CodeGen/ObjectFilePCHContainerOperations.cpp

+1-1
Original file line numberDiff line numberDiff line change
@@ -27,10 +27,10 @@
2727
#include "llvm/IR/DataLayout.h"
2828
#include "llvm/IR/LLVMContext.h"
2929
#include "llvm/IR/Module.h"
30+
#include "llvm/MC/TargetRegistry.h"
3031
#include "llvm/Object/COFF.h"
3132
#include "llvm/Object/ObjectFile.h"
3233
#include "llvm/Support/Path.h"
33-
#include "llvm/Support/TargetRegistry.h"
3434
#include <memory>
3535
#include <utility>
3636

clang/lib/Driver/Driver.cpp

+1-1
Original file line numberDiff line numberDiff line change
@@ -67,6 +67,7 @@
6767
#include "llvm/ADT/StringSet.h"
6868
#include "llvm/ADT/StringSwitch.h"
6969
#include "llvm/Config/llvm-config.h"
70+
#include "llvm/MC/TargetRegistry.h"
7071
#include "llvm/Option/Arg.h"
7172
#include "llvm/Option/ArgList.h"
7273
#include "llvm/Option/OptSpecifier.h"
@@ -84,7 +85,6 @@
8485
#include "llvm/Support/Process.h"
8586
#include "llvm/Support/Program.h"
8687
#include "llvm/Support/StringSaver.h"
87-
#include "llvm/Support/TargetRegistry.h"
8888
#include "llvm/Support/VirtualFileSystem.h"
8989
#include "llvm/Support/raw_ostream.h"
9090
#include <map>

clang/lib/Driver/ToolChain.cpp

+2-2
Original file line numberDiff line numberDiff line change
@@ -9,8 +9,8 @@
99
#include "clang/Driver/ToolChain.h"
1010
#include "ToolChains/Arch/ARM.h"
1111
#include "ToolChains/Clang.h"
12-
#include "ToolChains/InterfaceStubs.h"
1312
#include "ToolChains/Flang.h"
13+
#include "ToolChains/InterfaceStubs.h"
1414
#include "clang/Basic/ObjCRuntime.h"
1515
#include "clang/Basic/Sanitizers.h"
1616
#include "clang/Config/config.h"
@@ -29,6 +29,7 @@
2929
#include "llvm/ADT/Twine.h"
3030
#include "llvm/Config/llvm-config.h"
3131
#include "llvm/MC/MCTargetOptions.h"
32+
#include "llvm/MC/TargetRegistry.h"
3233
#include "llvm/Option/Arg.h"
3334
#include "llvm/Option/ArgList.h"
3435
#include "llvm/Option/OptTable.h"
@@ -37,7 +38,6 @@
3738
#include "llvm/Support/FileSystem.h"
3839
#include "llvm/Support/Path.h"
3940
#include "llvm/Support/TargetParser.h"
40-
#include "llvm/Support/TargetRegistry.h"
4141
#include "llvm/Support/VersionTuple.h"
4242
#include "llvm/Support/VirtualFileSystem.h"
4343
#include <cassert>

clang/lib/Parse/ParseStmtAsm.cpp

+2-2
Original file line numberDiff line numberDiff line change
@@ -10,10 +10,10 @@
1010
//
1111
//===----------------------------------------------------------------------===//
1212

13-
#include "clang/Parse/Parser.h"
1413
#include "clang/AST/ASTContext.h"
1514
#include "clang/Basic/Diagnostic.h"
1615
#include "clang/Basic/TargetInfo.h"
16+
#include "clang/Parse/Parser.h"
1717
#include "clang/Parse/RAIIObjectsForParser.h"
1818
#include "llvm/ADT/SmallString.h"
1919
#include "llvm/ADT/StringExtras.h"
@@ -28,8 +28,8 @@
2828
#include "llvm/MC/MCStreamer.h"
2929
#include "llvm/MC/MCSubtargetInfo.h"
3030
#include "llvm/MC/MCTargetOptions.h"
31+
#include "llvm/MC/TargetRegistry.h"
3132
#include "llvm/Support/SourceMgr.h"
32-
#include "llvm/Support/TargetRegistry.h"
3333
#include "llvm/Support/TargetSelect.h"
3434
using namespace clang;
3535

clang/tools/clang-fuzzer/handle-llvm/handle_llvm.cpp

+1-1
Original file line numberDiff line numberDiff line change
@@ -35,11 +35,11 @@
3535
#include "llvm/IR/Module.h"
3636
#include "llvm/IR/Verifier.h"
3737
#include "llvm/IRReader/IRReader.h"
38+
#include "llvm/MC/TargetRegistry.h"
3839
#include "llvm/Pass.h"
3940
#include "llvm/PassRegistry.h"
4041
#include "llvm/Support/MemoryBuffer.h"
4142
#include "llvm/Support/SourceMgr.h"
42-
#include "llvm/Support/TargetRegistry.h"
4343
#include "llvm/Support/TargetSelect.h"
4444
#include "llvm/Target/TargetMachine.h"
4545
#include "llvm/Transforms/IPO.h"

clang/tools/driver/cc1_main.cpp

+1-1
Original file line numberDiff line numberDiff line change
@@ -28,6 +28,7 @@
2828
#include "llvm/ADT/Statistic.h"
2929
#include "llvm/Config/llvm-config.h"
3030
#include "llvm/LinkAllPasses.h"
31+
#include "llvm/MC/TargetRegistry.h"
3132
#include "llvm/Option/Arg.h"
3233
#include "llvm/Option/ArgList.h"
3334
#include "llvm/Option/OptTable.h"
@@ -38,7 +39,6 @@
3839
#include "llvm/Support/Path.h"
3940
#include "llvm/Support/Process.h"
4041
#include "llvm/Support/Signals.h"
41-
#include "llvm/Support/TargetRegistry.h"
4242
#include "llvm/Support/TargetSelect.h"
4343
#include "llvm/Support/TimeProfiler.h"
4444
#include "llvm/Support/Timer.h"

clang/tools/driver/cc1as_main.cpp

+1-1
Original file line numberDiff line numberDiff line change
@@ -36,6 +36,7 @@
3636
#include "llvm/MC/MCStreamer.h"
3737
#include "llvm/MC/MCSubtargetInfo.h"
3838
#include "llvm/MC/MCTargetOptions.h"
39+
#include "llvm/MC/TargetRegistry.h"
3940
#include "llvm/Option/Arg.h"
4041
#include "llvm/Option/ArgList.h"
4142
#include "llvm/Option/OptTable.h"
@@ -49,7 +50,6 @@
4950
#include "llvm/Support/Process.h"
5051
#include "llvm/Support/Signals.h"
5152
#include "llvm/Support/SourceMgr.h"
52-
#include "llvm/Support/TargetRegistry.h"
5353
#include "llvm/Support/TargetSelect.h"
5454
#include "llvm/Support/Timer.h"
5555
#include "llvm/Support/raw_ostream.h"

clang/unittests/Driver/ToolChainTest.cpp

+1-1
Original file line numberDiff line numberDiff line change
@@ -17,7 +17,7 @@
1717
#include "clang/Driver/Compilation.h"
1818
#include "clang/Driver/Driver.h"
1919
#include "llvm/ADT/ArrayRef.h"
20-
#include "llvm/Support/TargetRegistry.h"
20+
#include "llvm/MC/TargetRegistry.h"
2121
#include "llvm/Support/TargetSelect.h"
2222
#include "llvm/Support/VirtualFileSystem.h"
2323
#include "llvm/Support/raw_ostream.h"

clang/unittests/Tooling/DependencyScannerTest.cpp

+2-2
Original file line numberDiff line numberDiff line change
@@ -14,12 +14,12 @@
1414
#include "clang/Frontend/FrontendAction.h"
1515
#include "clang/Frontend/FrontendActions.h"
1616
#include "clang/Tooling/CompilationDatabase.h"
17-
#include "clang/Tooling/Tooling.h"
1817
#include "clang/Tooling/DependencyScanning/DependencyScanningFilesystem.h"
18+
#include "clang/Tooling/Tooling.h"
1919
#include "llvm/ADT/STLExtras.h"
20+
#include "llvm/MC/TargetRegistry.h"
2021
#include "llvm/Support/FormatVariadic.h"
2122
#include "llvm/Support/Path.h"
22-
#include "llvm/Support/TargetRegistry.h"
2323
#include "llvm/Support/TargetSelect.h"
2424
#include "gtest/gtest.h"
2525
#include <algorithm>

clang/unittests/Tooling/ToolingTest.cpp

+2-2
Original file line numberDiff line numberDiff line change
@@ -6,6 +6,7 @@
66
//
77
//===----------------------------------------------------------------------===//
88

9+
#include "clang/Tooling/Tooling.h"
910
#include "clang/AST/ASTConsumer.h"
1011
#include "clang/AST/DeclCXX.h"
1112
#include "clang/AST/DeclGroup.h"
@@ -18,12 +19,11 @@
1819
#include "clang/Frontend/TextDiagnosticBuffer.h"
1920
#include "clang/Tooling/ArgumentsAdjusters.h"
2021
#include "clang/Tooling/CompilationDatabase.h"
21-
#include "clang/Tooling/Tooling.h"
2222
#include "llvm/ADT/STLExtras.h"
2323
#include "llvm/ADT/StringRef.h"
24+
#include "llvm/MC/TargetRegistry.h"
2425
#include "llvm/Support/Host.h"
2526
#include "llvm/Support/Path.h"
26-
#include "llvm/Support/TargetRegistry.h"
2727
#include "llvm/Support/TargetSelect.h"
2828
#include "gtest/gtest.h"
2929
#include <algorithm>

lldb/source/Plugins/Disassembler/LLVMC/DisassemblerLLVMC.cpp

+1-1
Original file line numberDiff line numberDiff line change
@@ -21,9 +21,9 @@
2121
#include "llvm/MC/MCRegisterInfo.h"
2222
#include "llvm/MC/MCSubtargetInfo.h"
2323
#include "llvm/MC/MCTargetOptions.h"
24+
#include "llvm/MC/TargetRegistry.h"
2425
#include "llvm/Support/ErrorHandling.h"
2526
#include "llvm/Support/ScopedPrinter.h"
26-
#include "llvm/Support/TargetRegistry.h"
2727
#include "llvm/Support/TargetSelect.h"
2828

2929
#include "lldb/Core/Address.h"

lldb/source/Plugins/Instruction/MIPS/EmulateInstructionMIPS.cpp

+1-1
Original file line numberDiff line numberDiff line change
@@ -29,7 +29,7 @@
2929
#include "llvm/MC/MCRegisterInfo.h"
3030
#include "llvm/MC/MCSubtargetInfo.h"
3131
#include "llvm/MC/MCTargetOptions.h"
32-
#include "llvm/Support/TargetRegistry.h"
32+
#include "llvm/MC/TargetRegistry.h"
3333
#include "llvm/Support/TargetSelect.h"
3434

3535
#include "llvm/ADT/STLExtras.h"

lldb/source/Plugins/Instruction/MIPS64/EmulateInstructionMIPS64.cpp

+1-1
Original file line numberDiff line numberDiff line change
@@ -29,7 +29,7 @@
2929
#include "llvm/MC/MCRegisterInfo.h"
3030
#include "llvm/MC/MCSubtargetInfo.h"
3131
#include "llvm/MC/MCTargetOptions.h"
32-
#include "llvm/Support/TargetRegistry.h"
32+
#include "llvm/MC/TargetRegistry.h"
3333
#include "llvm/Support/TargetSelect.h"
3434

3535
#include "llvm/ADT/STLExtras.h"

lldb/source/Plugins/LanguageRuntime/RenderScript/RenderScriptRuntime/RenderScriptExpressionOpts.cpp

+1-1
Original file line numberDiff line numberDiff line change
@@ -14,7 +14,7 @@
1414
#include "llvm/IR/Instructions.h"
1515
#include "llvm/IR/LegacyPassManager.h"
1616
#include "llvm/IR/Module.h"
17-
#include "llvm/Support/TargetRegistry.h"
17+
#include "llvm/MC/TargetRegistry.h"
1818
#include "llvm/Target/TargetMachine.h"
1919
#include "llvm/Target/TargetOptions.h"
2020

lldb/source/Plugins/LanguageRuntime/RenderScript/RenderScriptRuntime/RenderScriptExpressionOpts.h

+1-1
Original file line numberDiff line numberDiff line change
@@ -10,7 +10,7 @@
1010
#define LLDB_SOURCE_PLUGINS_LANGUAGERUNTIME_RENDERSCRIPT_RENDERSCRIPTRUNTIME_RENDERSCRIPTEXPRESSIONOPTS_H
1111

1212
#include "llvm/IR/Module.h"
13-
#include "llvm/Support/TargetRegistry.h"
13+
#include "llvm/MC/TargetRegistry.h"
1414
#include "llvm/Target/TargetMachine.h"
1515
#include "llvm/Target/TargetOptions.h"
1616

lldb/source/Target/ABI.cpp

+1-1
Original file line numberDiff line numberDiff line change
@@ -16,7 +16,7 @@
1616
#include "lldb/Target/Target.h"
1717
#include "lldb/Target/Thread.h"
1818
#include "lldb/Utility/Log.h"
19-
#include "llvm/Support/TargetRegistry.h"
19+
#include "llvm/MC/TargetRegistry.h"
2020
#include <cctype>
2121

2222
using namespace lldb;

llvm/examples/Kaleidoscope/Chapter8/toy.cpp

+3-3
Original file line numberDiff line numberDiff line change
@@ -5,18 +5,18 @@
55
#include "llvm/IR/Constants.h"
66
#include "llvm/IR/DerivedTypes.h"
77
#include "llvm/IR/Function.h"
8-
#include "llvm/IR/Instructions.h"
98
#include "llvm/IR/IRBuilder.h"
9+
#include "llvm/IR/Instructions.h"
1010
#include "llvm/IR/LLVMContext.h"
1111
#include "llvm/IR/LegacyPassManager.h"
1212
#include "llvm/IR/Module.h"
1313
#include "llvm/IR/Type.h"
1414
#include "llvm/IR/Verifier.h"
15+
#include "llvm/MC/TargetRegistry.h"
1516
#include "llvm/Support/FileSystem.h"
1617
#include "llvm/Support/Host.h"
17-
#include "llvm/Support/raw_ostream.h"
18-
#include "llvm/Support/TargetRegistry.h"
1918
#include "llvm/Support/TargetSelect.h"
19+
#include "llvm/Support/raw_ostream.h"
2020
#include "llvm/Target/TargetMachine.h"
2121
#include "llvm/Target/TargetOptions.h"
2222
#include <algorithm>

llvm/include/llvm/Support/TargetRegistry.h renamed to llvm/include/llvm/MC/TargetRegistry.h

+4-4
Original file line numberDiff line numberDiff line change
@@ -1,4 +1,4 @@
1-
//===- Support/TargetRegistry.h - Target Registration -----------*- C++ -*-===//
1+
//===- MC/TargetRegistry.h - Target Registration ----------------*- C++ -*-===//
22
//
33
// Part of the LLVM Project, under the Apache License v2.0 with LLVM Exceptions.
44
// See https://llvm.org/LICENSE.txt for license information.
@@ -15,8 +15,8 @@
1515
//
1616
//===----------------------------------------------------------------------===//
1717

18-
#ifndef LLVM_SUPPORT_TARGETREGISTRY_H
19-
#define LLVM_SUPPORT_TARGETREGISTRY_H
18+
#ifndef LLVM_MC_TARGETREGISTRY_H
19+
#define LLVM_MC_TARGETREGISTRY_H
2020

2121
#include "llvm-c/DisassemblerTypes.h"
2222
#include "llvm/ADT/Optional.h"
@@ -1370,4 +1370,4 @@ template <class MCCodeEmitterImpl> struct RegisterMCCodeEmitter {
13701370

13711371
} // end namespace llvm
13721372

1373-
#endif // LLVM_SUPPORT_TARGETREGISTRY_H
1373+
#endif // LLVM_MC_TARGETREGISTRY_H

llvm/lib/Bitcode/Writer/BitcodeWriter.cpp

+1-1
Original file line numberDiff line numberDiff line change
@@ -58,6 +58,7 @@
5858
#include "llvm/IR/Value.h"
5959
#include "llvm/IR/ValueSymbolTable.h"
6060
#include "llvm/MC/StringTableBuilder.h"
61+
#include "llvm/MC/TargetRegistry.h"
6162
#include "llvm/Object/IRSymtab.h"
6263
#include "llvm/Support/AtomicOrdering.h"
6364
#include "llvm/Support/Casting.h"
@@ -67,7 +68,6 @@
6768
#include "llvm/Support/ErrorHandling.h"
6869
#include "llvm/Support/MathExtras.h"
6970
#include "llvm/Support/SHA1.h"
70-
#include "llvm/Support/TargetRegistry.h"
7171
#include "llvm/Support/raw_ostream.h"
7272
#include <algorithm>
7373
#include <cassert>

llvm/lib/CodeGen/AsmPrinter/AsmPrinter.cpp

+1-1
Original file line numberDiff line numberDiff line change
@@ -102,6 +102,7 @@
102102
#include "llvm/MC/MCTargetOptions.h"
103103
#include "llvm/MC/MCValue.h"
104104
#include "llvm/MC/SectionKind.h"
105+
#include "llvm/MC/TargetRegistry.h"
105106
#include "llvm/Pass.h"
106107
#include "llvm/Remarks/Remark.h"
107108
#include "llvm/Remarks/RemarkFormat.h"
@@ -115,7 +116,6 @@
115116
#include "llvm/Support/Format.h"
116117
#include "llvm/Support/MathExtras.h"
117118
#include "llvm/Support/Path.h"
118-
#include "llvm/Support/TargetRegistry.h"
119119
#include "llvm/Support/Timer.h"
120120
#include "llvm/Support/raw_ostream.h"
121121
#include "llvm/Target/TargetLoweringObjectFile.h"

llvm/lib/CodeGen/AsmPrinter/AsmPrinterInlineAsm.cpp

+1-1
Original file line numberDiff line numberDiff line change
@@ -30,10 +30,10 @@
3030
#include "llvm/MC/MCStreamer.h"
3131
#include "llvm/MC/MCSubtargetInfo.h"
3232
#include "llvm/MC/MCSymbol.h"
33+
#include "llvm/MC/TargetRegistry.h"
3334
#include "llvm/Support/ErrorHandling.h"
3435
#include "llvm/Support/MemoryBuffer.h"
3536
#include "llvm/Support/SourceMgr.h"
36-
#include "llvm/Support/TargetRegistry.h"
3737
#include "llvm/Support/raw_ostream.h"
3838
#include "llvm/Target/TargetMachine.h"
3939
using namespace llvm;

llvm/lib/CodeGen/GlobalISel/InstructionSelect.cpp

+2-2
Original file line numberDiff line numberDiff line change
@@ -20,8 +20,8 @@
2020
#include "llvm/CodeGen/GlobalISel/InstructionSelector.h"
2121
#include "llvm/CodeGen/GlobalISel/LegalizerInfo.h"
2222
#include "llvm/CodeGen/GlobalISel/Utils.h"
23-
#include "llvm/CodeGen/MachineOptimizationRemarkEmitter.h"
2423
#include "llvm/CodeGen/MachineFrameInfo.h"
24+
#include "llvm/CodeGen/MachineOptimizationRemarkEmitter.h"
2525
#include "llvm/CodeGen/MachineRegisterInfo.h"
2626
#include "llvm/CodeGen/TargetInstrInfo.h"
2727
#include "llvm/CodeGen/TargetLowering.h"
@@ -30,9 +30,9 @@
3030
#include "llvm/Config/config.h"
3131
#include "llvm/IR/Constants.h"
3232
#include "llvm/IR/Function.h"
33+
#include "llvm/MC/TargetRegistry.h"
3334
#include "llvm/Support/CommandLine.h"
3435
#include "llvm/Support/Debug.h"
35-
#include "llvm/Support/TargetRegistry.h"
3636
#include "llvm/Target/TargetMachine.h"
3737

3838
#define DEBUG_TYPE "instruction-select"

llvm/lib/CodeGen/LLVMTargetMachine.cpp

+1-1
Original file line numberDiff line numberDiff line change
@@ -25,10 +25,10 @@
2525
#include "llvm/MC/MCObjectWriter.h"
2626
#include "llvm/MC/MCStreamer.h"
2727
#include "llvm/MC/MCSubtargetInfo.h"
28+
#include "llvm/MC/TargetRegistry.h"
2829
#include "llvm/Support/CommandLine.h"
2930
#include "llvm/Support/ErrorHandling.h"
3031
#include "llvm/Support/FormattedStream.h"
31-
#include "llvm/Support/TargetRegistry.h"
3232
#include "llvm/Target/TargetLoweringObjectFile.h"
3333
#include "llvm/Target/TargetMachine.h"
3434
#include "llvm/Target/TargetOptions.h"

llvm/lib/DWARFLinker/DWARFStreamer.cpp

+1-1
Original file line numberDiff line numberDiff line change
@@ -21,8 +21,8 @@
2121
#include "llvm/MC/MCSymbol.h"
2222
#include "llvm/MC/MCTargetOptions.h"
2323
#include "llvm/MC/MCTargetOptionsCommandFlags.h"
24+
#include "llvm/MC/TargetRegistry.h"
2425
#include "llvm/Support/LEB128.h"
25-
#include "llvm/Support/TargetRegistry.h"
2626
#include "llvm/Target/TargetOptions.h"
2727

2828
namespace llvm {

llvm/lib/DebugInfo/DWARF/DWARFContext.cpp

+1-1
Original file line numberDiff line numberDiff line change
@@ -33,6 +33,7 @@
3333
#include "llvm/DebugInfo/DWARF/DWARFUnitIndex.h"
3434
#include "llvm/DebugInfo/DWARF/DWARFVerifier.h"
3535
#include "llvm/MC/MCRegisterInfo.h"
36+
#include "llvm/MC/TargetRegistry.h"
3637
#include "llvm/Object/Decompressor.h"
3738
#include "llvm/Object/MachO.h"
3839
#include "llvm/Object/ObjectFile.h"
@@ -44,7 +45,6 @@
4445
#include "llvm/Support/LEB128.h"
4546
#include "llvm/Support/MemoryBuffer.h"
4647
#include "llvm/Support/Path.h"
47-
#include "llvm/Support/TargetRegistry.h"
4848
#include "llvm/Support/raw_ostream.h"
4949
#include <algorithm>
5050
#include <cstdint>

0 commit comments

Comments
 (0)