[llvm] r360733 - [Sparc] Create a TargetInfo header. NFC
Richard Trieu via llvm-commits
llvm-commits at lists.llvm.org
Tue May 14 17:35:37 PDT 2019
Author: rtrieu
Date: Tue May 14 17:35:37 2019
New Revision: 360733
URL: http://llvm.org/viewvc/llvm-project?rev=360733&view=rev
Log:
[Sparc] 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.
Added:
llvm/trunk/lib/Target/Sparc/TargetInfo/SparcTargetInfo.h
- copied, changed from r360731, llvm/trunk/lib/Target/Sparc/TargetInfo/SparcTargetInfo.cpp
Modified:
llvm/trunk/lib/Target/Sparc/AsmParser/SparcAsmParser.cpp
llvm/trunk/lib/Target/Sparc/Disassembler/SparcDisassembler.cpp
llvm/trunk/lib/Target/Sparc/MCTargetDesc/SparcMCTargetDesc.cpp
llvm/trunk/lib/Target/Sparc/MCTargetDesc/SparcMCTargetDesc.h
llvm/trunk/lib/Target/Sparc/SparcAsmPrinter.cpp
llvm/trunk/lib/Target/Sparc/SparcTargetMachine.cpp
llvm/trunk/lib/Target/Sparc/TargetInfo/SparcTargetInfo.cpp
Modified: llvm/trunk/lib/Target/Sparc/AsmParser/SparcAsmParser.cpp
URL: http://llvm.org/viewvc/llvm-project/llvm/trunk/lib/Target/Sparc/AsmParser/SparcAsmParser.cpp?rev=360733&r1=360732&r2=360733&view=diff
==============================================================================
--- llvm/trunk/lib/Target/Sparc/AsmParser/SparcAsmParser.cpp (original)
+++ llvm/trunk/lib/Target/Sparc/AsmParser/SparcAsmParser.cpp Tue May 14 17:35:37 2019
@@ -8,6 +8,7 @@
#include "MCTargetDesc/SparcMCExpr.h"
#include "MCTargetDesc/SparcMCTargetDesc.h"
+#include "TargetInfo/SparcTargetInfo.h"
#include "llvm/ADT/STLExtras.h"
#include "llvm/ADT/SmallVector.h"
#include "llvm/ADT/StringRef.h"
Modified: llvm/trunk/lib/Target/Sparc/Disassembler/SparcDisassembler.cpp
URL: http://llvm.org/viewvc/llvm-project/llvm/trunk/lib/Target/Sparc/Disassembler/SparcDisassembler.cpp?rev=360733&r1=360732&r2=360733&view=diff
==============================================================================
--- llvm/trunk/lib/Target/Sparc/Disassembler/SparcDisassembler.cpp (original)
+++ llvm/trunk/lib/Target/Sparc/Disassembler/SparcDisassembler.cpp Tue May 14 17:35:37 2019
@@ -11,6 +11,7 @@
//===----------------------------------------------------------------------===//
#include "MCTargetDesc/SparcMCTargetDesc.h"
+#include "TargetInfo/SparcTargetInfo.h"
#include "llvm/MC/MCAsmInfo.h"
#include "llvm/MC/MCContext.h"
#include "llvm/MC/MCDisassembler/MCDisassembler.h"
@@ -40,12 +41,6 @@ public:
};
}
-namespace llvm {
-Target &getTheSparcTarget();
-Target &getTheSparcV9Target();
-Target &getTheSparcelTarget();
-}
-
static MCDisassembler *createSparcDisassembler(const Target &T,
const MCSubtargetInfo &STI,
MCContext &Ctx) {
Modified: llvm/trunk/lib/Target/Sparc/MCTargetDesc/SparcMCTargetDesc.cpp
URL: http://llvm.org/viewvc/llvm-project/llvm/trunk/lib/Target/Sparc/MCTargetDesc/SparcMCTargetDesc.cpp?rev=360733&r1=360732&r2=360733&view=diff
==============================================================================
--- llvm/trunk/lib/Target/Sparc/MCTargetDesc/SparcMCTargetDesc.cpp (original)
+++ llvm/trunk/lib/Target/Sparc/MCTargetDesc/SparcMCTargetDesc.cpp Tue May 14 17:35:37 2019
@@ -14,6 +14,7 @@
#include "SparcInstPrinter.h"
#include "SparcMCAsmInfo.h"
#include "SparcTargetStreamer.h"
+#include "TargetInfo/SparcTargetInfo.h"
#include "llvm/MC/MCInstrInfo.h"
#include "llvm/MC/MCRegisterInfo.h"
#include "llvm/MC/MCSubtargetInfo.h"
Modified: llvm/trunk/lib/Target/Sparc/MCTargetDesc/SparcMCTargetDesc.h
URL: http://llvm.org/viewvc/llvm-project/llvm/trunk/lib/Target/Sparc/MCTargetDesc/SparcMCTargetDesc.h?rev=360733&r1=360732&r2=360733&view=diff
==============================================================================
--- llvm/trunk/lib/Target/Sparc/MCTargetDesc/SparcMCTargetDesc.h (original)
+++ llvm/trunk/lib/Target/Sparc/MCTargetDesc/SparcMCTargetDesc.h Tue May 14 17:35:37 2019
@@ -32,10 +32,6 @@ class StringRef;
class raw_pwrite_stream;
class raw_ostream;
-Target &getTheSparcTarget();
-Target &getTheSparcV9Target();
-Target &getTheSparcelTarget();
-
MCCodeEmitter *createSparcMCCodeEmitter(const MCInstrInfo &MCII,
const MCRegisterInfo &MRI,
MCContext &Ctx);
Modified: llvm/trunk/lib/Target/Sparc/SparcAsmPrinter.cpp
URL: http://llvm.org/viewvc/llvm-project/llvm/trunk/lib/Target/Sparc/SparcAsmPrinter.cpp?rev=360733&r1=360732&r2=360733&view=diff
==============================================================================
--- llvm/trunk/lib/Target/Sparc/SparcAsmPrinter.cpp (original)
+++ llvm/trunk/lib/Target/Sparc/SparcAsmPrinter.cpp Tue May 14 17:35:37 2019
@@ -17,6 +17,7 @@
#include "Sparc.h"
#include "SparcInstrInfo.h"
#include "SparcTargetMachine.h"
+#include "TargetInfo/SparcTargetInfo.h"
#include "llvm/CodeGen/AsmPrinter.h"
#include "llvm/CodeGen/MachineInstr.h"
#include "llvm/CodeGen/MachineModuleInfoImpls.h"
Modified: llvm/trunk/lib/Target/Sparc/SparcTargetMachine.cpp
URL: http://llvm.org/viewvc/llvm-project/llvm/trunk/lib/Target/Sparc/SparcTargetMachine.cpp?rev=360733&r1=360732&r2=360733&view=diff
==============================================================================
--- llvm/trunk/lib/Target/Sparc/SparcTargetMachine.cpp (original)
+++ llvm/trunk/lib/Target/Sparc/SparcTargetMachine.cpp Tue May 14 17:35:37 2019
@@ -13,6 +13,7 @@
#include "LeonPasses.h"
#include "Sparc.h"
#include "SparcTargetObjectFile.h"
+#include "TargetInfo/SparcTargetInfo.h"
#include "llvm/CodeGen/Passes.h"
#include "llvm/CodeGen/TargetPassConfig.h"
#include "llvm/IR/LegacyPassManager.h"
Modified: llvm/trunk/lib/Target/Sparc/TargetInfo/SparcTargetInfo.cpp
URL: http://llvm.org/viewvc/llvm-project/llvm/trunk/lib/Target/Sparc/TargetInfo/SparcTargetInfo.cpp?rev=360733&r1=360732&r2=360733&view=diff
==============================================================================
--- llvm/trunk/lib/Target/Sparc/TargetInfo/SparcTargetInfo.cpp (original)
+++ llvm/trunk/lib/Target/Sparc/TargetInfo/SparcTargetInfo.cpp Tue May 14 17:35:37 2019
@@ -6,8 +6,7 @@
//
//===----------------------------------------------------------------------===//
-#include "Sparc.h"
-#include "llvm/IR/Module.h"
+#include "TargetInfo/SparcTargetInfo.h"
#include "llvm/Support/TargetRegistry.h"
using namespace llvm;
Copied: llvm/trunk/lib/Target/Sparc/TargetInfo/SparcTargetInfo.h (from r360731, llvm/trunk/lib/Target/Sparc/TargetInfo/SparcTargetInfo.cpp)
URL: http://llvm.org/viewvc/llvm-project/llvm/trunk/lib/Target/Sparc/TargetInfo/SparcTargetInfo.h?p2=llvm/trunk/lib/Target/Sparc/TargetInfo/SparcTargetInfo.h&p1=llvm/trunk/lib/Target/Sparc/TargetInfo/SparcTargetInfo.cpp&r1=360731&r2=360733&rev=360733&view=diff
==============================================================================
--- llvm/trunk/lib/Target/Sparc/TargetInfo/SparcTargetInfo.cpp (original)
+++ llvm/trunk/lib/Target/Sparc/TargetInfo/SparcTargetInfo.h Tue May 14 17:35:37 2019
@@ -1,4 +1,4 @@
-//===-- SparcTargetInfo.cpp - Sparc Target Implementation -----------------===//
+//===-- SparcTargetInfo.h - Sparc 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.
@@ -6,29 +6,17 @@
//
//===----------------------------------------------------------------------===//
-#include "Sparc.h"
-#include "llvm/IR/Module.h"
-#include "llvm/Support/TargetRegistry.h"
-using namespace llvm;
-
-Target &llvm::getTheSparcTarget() {
- static Target TheSparcTarget;
- return TheSparcTarget;
-}
-Target &llvm::getTheSparcV9Target() {
- static Target TheSparcV9Target;
- return TheSparcV9Target;
-}
-Target &llvm::getTheSparcelTarget() {
- static Target TheSparcelTarget;
- return TheSparcelTarget;
-}
-
-extern "C" void LLVMInitializeSparcTargetInfo() {
- RegisterTarget<Triple::sparc, /*HasJIT=*/true> X(getTheSparcTarget(), "sparc",
- "Sparc", "Sparc");
- RegisterTarget<Triple::sparcv9, /*HasJIT=*/true> Y(
- getTheSparcV9Target(), "sparcv9", "Sparc V9", "Sparc");
- RegisterTarget<Triple::sparcel, /*HasJIT=*/true> Z(
- getTheSparcelTarget(), "sparcel", "Sparc LE", "Sparc");
-}
+#ifndef LLVM_LIB_TARGET_SPARC_TARGETINFO_SPARCTARGETINFO_H
+#define LLVM_LIB_TARGET_SPARC_TARGETINFO_SPARCTARGETINFO_H
+
+namespace llvm {
+
+class Target;
+
+Target &getTheSparcTarget();
+Target &getTheSparcV9Target();
+Target &getTheSparcelTarget();
+
+} // namespace llvm
+
+#endif // LLVM_LIB_TARGET_SPARC_TARGETINFO_SPARCTARGETINFO_H
More information about the llvm-commits
mailing list