Skip to content

Commit

Permalink
[AArch64] Create a TargetInfo header. NFC
Browse files Browse the repository at this point in the history
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
  • Loading branch information
Weverything committed May 14, 2019
1 parent 9b234b3 commit b26592e
Show file tree
Hide file tree
Showing 8 changed files with 36 additions and 14 deletions.
1 change: 1 addition & 0 deletions llvm/lib/Target/AArch64/AArch64AsmPrinter.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -22,6 +22,7 @@
#include "MCTargetDesc/AArch64MCExpr.h"
#include "MCTargetDesc/AArch64MCTargetDesc.h"
#include "MCTargetDesc/AArch64TargetStreamer.h"
#include "TargetInfo/AArch64TargetInfo.h"
#include "Utils/AArch64BaseInfo.h"
#include "llvm/ADT/SmallString.h"
#include "llvm/ADT/SmallVector.h"
Expand Down
1 change: 1 addition & 0 deletions llvm/lib/Target/AArch64/AArch64TargetMachine.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -16,6 +16,7 @@
#include "AArch64TargetObjectFile.h"
#include "AArch64TargetTransformInfo.h"
#include "MCTargetDesc/AArch64MCTargetDesc.h"
#include "TargetInfo/AArch64TargetInfo.h"
#include "llvm/ADT/STLExtras.h"
#include "llvm/ADT/Triple.h"
#include "llvm/Analysis/TargetTransformInfo.h"
Expand Down
1 change: 1 addition & 0 deletions llvm/lib/Target/AArch64/AsmParser/AArch64AsmParser.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -10,6 +10,7 @@
#include "MCTargetDesc/AArch64MCExpr.h"
#include "MCTargetDesc/AArch64MCTargetDesc.h"
#include "MCTargetDesc/AArch64TargetStreamer.h"
#include "TargetInfo/AArch64TargetInfo.h"
#include "AArch64InstrInfo.h"
#include "Utils/AArch64BaseInfo.h"
#include "llvm/ADT/APFloat.h"
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -13,6 +13,7 @@
#include "AArch64ExternalSymbolizer.h"
#include "MCTargetDesc/AArch64AddressingModes.h"
#include "MCTargetDesc/AArch64MCTargetDesc.h"
#include "TargetInfo/AArch64TargetInfo.h"
#include "Utils/AArch64BaseInfo.h"
#include "llvm-c/Disassembler.h"
#include "llvm/MC/MCDisassembler/MCRelocationInfo.h"
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -16,6 +16,7 @@
#include "AArch64WinCOFFStreamer.h"
#include "MCTargetDesc/AArch64AddressingModes.h"
#include "MCTargetDesc/AArch64InstPrinter.h"
#include "TargetInfo/AArch64TargetInfo.h"
#include "llvm/MC/MCAsmBackend.h"
#include "llvm/MC/MCCodeEmitter.h"
#include "llvm/MC/MCInstrAnalysis.h"
Expand Down
6 changes: 0 additions & 6 deletions llvm/lib/Target/AArch64/MCTargetDesc/AArch64MCTargetDesc.h
Original file line number Diff line number Diff line change
Expand Up @@ -36,12 +36,6 @@ class Triple;
class raw_ostream;
class raw_pwrite_stream;

Target &getTheAArch64leTarget();
Target &getTheAArch64beTarget();
Target &getTheAArch64_32Target();
Target &getTheARM64Target();
Target &getTheARM64_32Target();

MCCodeEmitter *createAArch64MCCodeEmitter(const MCInstrInfo &MCII,
const MCRegisterInfo &MRI,
MCContext &Ctx);
Expand Down
15 changes: 7 additions & 8 deletions llvm/lib/Target/AArch64/TargetInfo/AArch64TargetInfo.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -6,31 +6,30 @@
//
//===----------------------------------------------------------------------===//

#include "llvm/ADT/Triple.h"
#include "TargetInfo/AArch64TargetInfo.h"
#include "llvm/Support/TargetRegistry.h"

using namespace llvm;
namespace llvm {
Target &getTheAArch64leTarget() {
Target &llvm::getTheAArch64leTarget() {
static Target TheAArch64leTarget;
return TheAArch64leTarget;
}
Target &getTheAArch64beTarget() {
Target &llvm::getTheAArch64beTarget() {
static Target TheAArch64beTarget;
return TheAArch64beTarget;
}
Target &getTheAArch64_32Target() {
Target &llvm::getTheAArch64_32Target() {
static Target TheAArch64leTarget;
return TheAArch64leTarget;
}
Target &getTheARM64Target() {
Target &llvm::getTheARM64Target() {
static Target TheARM64Target;
return TheARM64Target;
}
Target &getTheARM64_32Target() {
Target &llvm::getTheARM64_32Target() {
static Target TheARM64_32Target;
return TheARM64_32Target;
}
} // namespace llvm

extern "C" void LLVMInitializeAArch64TargetInfo() {
// Now register the "arm64" name for use with "-march". We don't want it to
Expand Down
24 changes: 24 additions & 0 deletions llvm/lib/Target/AArch64/TargetInfo/AArch64TargetInfo.h
Original file line number Diff line number Diff line change
@@ -0,0 +1,24 @@
//===-- AArch64TargetInfo.h - AArch64 Target Implementation -----*- C++ -*-===//
//
// Part of the LLVM Project, under the Apache License v2.0 with LLVM Exceptions.
// See https://llvm.org/LICENSE.txt for license information.
// SPDX-License-Identifier: Apache-2.0 WITH LLVM-exception
//
//===----------------------------------------------------------------------===//

#ifndef LLVM_LIB_TARGET_AARCH64_TARGETINFO_AARCH64TARGETINFO_H
#define LLVM_LIB_TARGET_AARCH64_TARGETINFO_AARCH64TARGETINFO_H

namespace llvm {

class Target;

Target &getTheAArch64leTarget();
Target &getTheAArch64beTarget();
Target &getTheAArch64_32Target();
Target &getTheARM64Target();
Target &getTheARM64_32Target();

} // namespace llvm

#endif // LLVM_LIB_TARGET_AARCH64_TARGETINFO_AARCH64TARGETINFO_H

0 comments on commit b26592e

Please sign in to comment.