]> granicus.if.org Git - llvm/commitdiff
[BPF] Create a TargetInfo header. NFC
authorRichard Trieu <rtrieu@google.com>
Tue, 14 May 2019 22:54:06 +0000 (22:54 +0000)
committerRichard Trieu <rtrieu@google.com>
Tue, 14 May 2019 22:54:06 +0000 (22:54 +0000)
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.

git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@360722 91177308-0d34-0410-b5e6-96231b3b80d8

lib/Target/BPF/AsmParser/BPFAsmParser.cpp
lib/Target/BPF/BPFAsmPrinter.cpp
lib/Target/BPF/BPFTargetMachine.cpp
lib/Target/BPF/Disassembler/BPFDisassembler.cpp
lib/Target/BPF/MCTargetDesc/BPFMCTargetDesc.cpp
lib/Target/BPF/MCTargetDesc/BPFMCTargetDesc.h
lib/Target/BPF/TargetInfo/BPFTargetInfo.cpp
lib/Target/BPF/TargetInfo/BPFTargetInfo.h [new file with mode: 0644]

index 6fcf34370a64fdc609a9a4b1ebc3c80593f862f1..75885fd058a746909a4a2479f76fafc17041a8f3 100644 (file)
@@ -7,6 +7,7 @@
 //===----------------------------------------------------------------------===//
 
 #include "MCTargetDesc/BPFMCTargetDesc.h"
+#include "TargetInfo/BPFTargetInfo.h"
 #include "llvm/ADT/STLExtras.h"
 #include "llvm/ADT/StringSwitch.h"
 #include "llvm/MC/MCContext.h"
index 76b22056e5d98d2ae3140b0b6e315dab99fd0f9b..129a8c0704d8c555f209132d9fdd2600d960a990 100644 (file)
@@ -17,6 +17,7 @@
 #include "BPFTargetMachine.h"
 #include "BTFDebug.h"
 #include "MCTargetDesc/BPFInstPrinter.h"
+#include "TargetInfo/BPFTargetInfo.h"
 #include "llvm/CodeGen/AsmPrinter.h"
 #include "llvm/CodeGen/MachineConstantPool.h"
 #include "llvm/CodeGen/MachineFunctionPass.h"
index 0efeaa2c4626b805517a462ff87b8aa0c5acf7a5..e5d2e72e4519702a2be2f8197a00913a2f3ec8b7 100644 (file)
@@ -13,6 +13,7 @@
 #include "BPFTargetMachine.h"
 #include "BPF.h"
 #include "MCTargetDesc/BPFMCAsmInfo.h"
+#include "TargetInfo/BPFTargetInfo.h"
 #include "llvm/CodeGen/Passes.h"
 #include "llvm/CodeGen/TargetLoweringObjectFileImpl.h"
 #include "llvm/CodeGen/TargetPassConfig.h"
index c5be7cb1a4eceed7b9080d7df0eb66a36e7e4662..c845524ad657a5af89293efd60f67c1fb4c02ccd 100644 (file)
@@ -11,6 +11,7 @@
 //===----------------------------------------------------------------------===//
 
 #include "MCTargetDesc/BPFMCTargetDesc.h"
+#include "TargetInfo/BPFTargetInfo.h"
 #include "llvm/ADT/ArrayRef.h"
 #include "llvm/MC/MCAsmInfo.h"
 #include "llvm/MC/MCContext.h"
index 6a3af28ab3031b9b032c571378f6b88728090271..38f3931c3ad509e4dd56baaea8bfe81fa25da861 100644 (file)
@@ -14,6 +14,7 @@
 #include "BPF.h"
 #include "MCTargetDesc/BPFInstPrinter.h"
 #include "MCTargetDesc/BPFMCAsmInfo.h"
+#include "TargetInfo/BPFTargetInfo.h"
 #include "llvm/MC/MCInstrAnalysis.h"
 #include "llvm/MC/MCInstrInfo.h"
 #include "llvm/MC/MCRegisterInfo.h"
index 4093a4062252124a3b803e869375bf8b09a1e49e..1a391321f60d06ff5e82b2f714de7215551aa6aa 100644 (file)
@@ -33,10 +33,6 @@ class Triple;
 class raw_ostream;
 class raw_pwrite_stream;
 
-Target &getTheBPFleTarget();
-Target &getTheBPFbeTarget();
-Target &getTheBPFTarget();
-
 MCCodeEmitter *createBPFMCCodeEmitter(const MCInstrInfo &MCII,
                                       const MCRegisterInfo &MRI,
                                       MCContext &Ctx);
index be879495fedae25d28d48f07bfd4bb4eefca1992..5dfa915034bada08775b68b0e115353e326d2ded 100644 (file)
@@ -6,24 +6,23 @@
 //
 //===----------------------------------------------------------------------===//
 
-#include "BPF.h"
+#include "TargetInfo/BPFTargetInfo.h"
 #include "llvm/Support/TargetRegistry.h"
+
 using namespace llvm;
 
-namespace llvm {
-Target &getTheBPFleTarget() {
+Target &llvm::getTheBPFleTarget() {
   static Target TheBPFleTarget;
   return TheBPFleTarget;
 }
-Target &getTheBPFbeTarget() {
+Target &llvm::getTheBPFbeTarget() {
   static Target TheBPFbeTarget;
   return TheBPFbeTarget;
 }
-Target &getTheBPFTarget() {
+Target &llvm::getTheBPFTarget() {
   static Target TheBPFTarget;
   return TheBPFTarget;
 }
-} // namespace llvm
 
 extern "C" void LLVMInitializeBPFTargetInfo() {
   TargetRegistry::RegisterTarget(getTheBPFTarget(), "bpf", "BPF (host endian)",
diff --git a/lib/Target/BPF/TargetInfo/BPFTargetInfo.h b/lib/Target/BPF/TargetInfo/BPFTargetInfo.h
new file mode 100644 (file)
index 0000000..150526c
--- /dev/null
@@ -0,0 +1,22 @@
+//===-- BPFTargetInfo.h - BPF 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_BPF_TARGETINFO_BPFTARGETINFO_H
+#define LLVM_LIB_TARGET_BPF_TARGETINFO_BPFTARGETINFO_H
+
+namespace llvm {
+
+class Target;
+
+Target &getTheBPFleTarget();
+Target &getTheBPFbeTarget();
+Target &getTheBPFTarget();
+
+} // namespace llvm
+
+#endif // LLVM_LIB_TARGET_BPF_TARGETINFO_BPFTARGETINFO_H