Skip to content

Commit b26592e

Browse files
committed
[AArch64] Create a TargetInfo header. NFC
Move the declarations of getThe<Name>Target() functions into a new header in TargetInfo and make users of these functions include this new header. This fixes a layering problem. llvm-svn: 360709
1 parent 9b234b3 commit b26592e

File tree

8 files changed

+36
-14
lines changed

8 files changed

+36
-14
lines changed

llvm/lib/Target/AArch64/AArch64AsmPrinter.cpp

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -22,6 +22,7 @@
2222
#include "MCTargetDesc/AArch64MCExpr.h"
2323
#include "MCTargetDesc/AArch64MCTargetDesc.h"
2424
#include "MCTargetDesc/AArch64TargetStreamer.h"
25+
#include "TargetInfo/AArch64TargetInfo.h"
2526
#include "Utils/AArch64BaseInfo.h"
2627
#include "llvm/ADT/SmallString.h"
2728
#include "llvm/ADT/SmallVector.h"

llvm/lib/Target/AArch64/AArch64TargetMachine.cpp

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -16,6 +16,7 @@
1616
#include "AArch64TargetObjectFile.h"
1717
#include "AArch64TargetTransformInfo.h"
1818
#include "MCTargetDesc/AArch64MCTargetDesc.h"
19+
#include "TargetInfo/AArch64TargetInfo.h"
1920
#include "llvm/ADT/STLExtras.h"
2021
#include "llvm/ADT/Triple.h"
2122
#include "llvm/Analysis/TargetTransformInfo.h"

llvm/lib/Target/AArch64/AsmParser/AArch64AsmParser.cpp

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -10,6 +10,7 @@
1010
#include "MCTargetDesc/AArch64MCExpr.h"
1111
#include "MCTargetDesc/AArch64MCTargetDesc.h"
1212
#include "MCTargetDesc/AArch64TargetStreamer.h"
13+
#include "TargetInfo/AArch64TargetInfo.h"
1314
#include "AArch64InstrInfo.h"
1415
#include "Utils/AArch64BaseInfo.h"
1516
#include "llvm/ADT/APFloat.h"

llvm/lib/Target/AArch64/Disassembler/AArch64Disassembler.cpp

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -13,6 +13,7 @@
1313
#include "AArch64ExternalSymbolizer.h"
1414
#include "MCTargetDesc/AArch64AddressingModes.h"
1515
#include "MCTargetDesc/AArch64MCTargetDesc.h"
16+
#include "TargetInfo/AArch64TargetInfo.h"
1617
#include "Utils/AArch64BaseInfo.h"
1718
#include "llvm-c/Disassembler.h"
1819
#include "llvm/MC/MCDisassembler/MCRelocationInfo.h"

llvm/lib/Target/AArch64/MCTargetDesc/AArch64MCTargetDesc.cpp

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -16,6 +16,7 @@
1616
#include "AArch64WinCOFFStreamer.h"
1717
#include "MCTargetDesc/AArch64AddressingModes.h"
1818
#include "MCTargetDesc/AArch64InstPrinter.h"
19+
#include "TargetInfo/AArch64TargetInfo.h"
1920
#include "llvm/MC/MCAsmBackend.h"
2021
#include "llvm/MC/MCCodeEmitter.h"
2122
#include "llvm/MC/MCInstrAnalysis.h"

llvm/lib/Target/AArch64/MCTargetDesc/AArch64MCTargetDesc.h

Lines changed: 0 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -36,12 +36,6 @@ class Triple;
3636
class raw_ostream;
3737
class raw_pwrite_stream;
3838

39-
Target &getTheAArch64leTarget();
40-
Target &getTheAArch64beTarget();
41-
Target &getTheAArch64_32Target();
42-
Target &getTheARM64Target();
43-
Target &getTheARM64_32Target();
44-
4539
MCCodeEmitter *createAArch64MCCodeEmitter(const MCInstrInfo &MCII,
4640
const MCRegisterInfo &MRI,
4741
MCContext &Ctx);

llvm/lib/Target/AArch64/TargetInfo/AArch64TargetInfo.cpp

Lines changed: 7 additions & 8 deletions
Original file line numberDiff line numberDiff line change
@@ -6,31 +6,30 @@
66
//
77
//===----------------------------------------------------------------------===//
88

9-
#include "llvm/ADT/Triple.h"
9+
#include "TargetInfo/AArch64TargetInfo.h"
1010
#include "llvm/Support/TargetRegistry.h"
11+
1112
using namespace llvm;
12-
namespace llvm {
13-
Target &getTheAArch64leTarget() {
13+
Target &llvm::getTheAArch64leTarget() {
1414
static Target TheAArch64leTarget;
1515
return TheAArch64leTarget;
1616
}
17-
Target &getTheAArch64beTarget() {
17+
Target &llvm::getTheAArch64beTarget() {
1818
static Target TheAArch64beTarget;
1919
return TheAArch64beTarget;
2020
}
21-
Target &getTheAArch64_32Target() {
21+
Target &llvm::getTheAArch64_32Target() {
2222
static Target TheAArch64leTarget;
2323
return TheAArch64leTarget;
2424
}
25-
Target &getTheARM64Target() {
25+
Target &llvm::getTheARM64Target() {
2626
static Target TheARM64Target;
2727
return TheARM64Target;
2828
}
29-
Target &getTheARM64_32Target() {
29+
Target &llvm::getTheARM64_32Target() {
3030
static Target TheARM64_32Target;
3131
return TheARM64_32Target;
3232
}
33-
} // namespace llvm
3433

3534
extern "C" void LLVMInitializeAArch64TargetInfo() {
3635
// Now register the "arm64" name for use with "-march". We don't want it to
Lines changed: 24 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,24 @@
1+
//===-- AArch64TargetInfo.h - AArch64 Target Implementation -----*- C++ -*-===//
2+
//
3+
// Part of the LLVM Project, under the Apache License v2.0 with LLVM Exceptions.
4+
// See https://llvm.org/LICENSE.txt for license information.
5+
// SPDX-License-Identifier: Apache-2.0 WITH LLVM-exception
6+
//
7+
//===----------------------------------------------------------------------===//
8+
9+
#ifndef LLVM_LIB_TARGET_AARCH64_TARGETINFO_AARCH64TARGETINFO_H
10+
#define LLVM_LIB_TARGET_AARCH64_TARGETINFO_AARCH64TARGETINFO_H
11+
12+
namespace llvm {
13+
14+
class Target;
15+
16+
Target &getTheAArch64leTarget();
17+
Target &getTheAArch64beTarget();
18+
Target &getTheAArch64_32Target();
19+
Target &getTheARM64Target();
20+
Target &getTheARM64_32Target();
21+
22+
} // namespace llvm
23+
24+
#endif // LLVM_LIB_TARGET_AARCH64_TARGETINFO_AARCH64TARGETINFO_H

0 commit comments

Comments
 (0)