Move unreferenced passes into the cpp file
authorBenjamin Kramer <benny.kra@googlemail.com>
Mon, 9 Mar 2015 15:50:58 +0000 (15:50 +0000)
committerBenjamin Kramer <benny.kra@googlemail.com>
Mon, 9 Mar 2015 15:50:58 +0000 (15:50 +0000)
NFC.

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

lib/Target/Mips/Mips16HardFloat.cpp
lib/Target/Mips/Mips16HardFloat.h
lib/Target/Mips/MipsModuleISelDAGToDAG.cpp
lib/Target/Mips/MipsModuleISelDAGToDAG.h
lib/Target/Mips/MipsOs16.cpp
lib/Target/Mips/MipsOs16.h
lib/Target/NVPTX/NVPTXLowerAggrCopies.cpp
lib/Target/NVPTX/NVPTXLowerAggrCopies.h

index 32dc90af2ef48380bff7cff2758e88927b504ab6..e330dda7d03022eb65f8d7821f055e7ca2c08aac 100644 (file)
 //===----------------------------------------------------------------------===//
 
 #include "Mips16HardFloat.h"
+#include "MipsTargetMachine.h"
 #include "llvm/IR/Module.h"
 #include "llvm/IR/Value.h"
 #include "llvm/Support/Debug.h"
 #include "llvm/Support/raw_ostream.h"
 #include <algorithm>
 #include <string>
+using namespace llvm;
 
 #define DEBUG_TYPE "mips16-hard-float"
 
@@ -489,7 +491,20 @@ static void removeUseSoftFloat(Function &F) {
   F.addAttributes(AttributeSet::FunctionIndex, A);
 }
 
-namespace llvm {
+namespace {
+class Mips16HardFloat : public ModulePass {
+public:
+  static char ID;
+
+  Mips16HardFloat(MipsTargetMachine &TM_) : ModulePass(ID), TM(TM_) {}
+
+  const char *getPassName() const override { return "MIPS16 Hard Float Pass"; }
+  bool runOnModule(Module &M) override;
+
+protected:
+  const MipsTargetMachine &TM;
+};
+} // namespace
 
 //
 // This pass only makes sense when the underlying chip has floating point but
@@ -532,8 +547,6 @@ bool Mips16HardFloat::runOnModule(Module &M) {
 
 char Mips16HardFloat::ID = 0;
 
-}
-
 ModulePass *llvm::createMips16HardFloat(MipsTargetMachine &TM) {
   return new Mips16HardFloat(TM);
 }
index 586cc252353b14e900f5e827d8f067514b2de9f6..a97e2cff9f4cebfabeeaee47644f44099910fcb7 100644 (file)
 #ifndef LLVM_LIB_TARGET_MIPS_MIPS16HARDFLOAT_H
 #define LLVM_LIB_TARGET_MIPS_MIPS16HARDFLOAT_H
 
-#include "MCTargetDesc/MipsMCTargetDesc.h"
-#include "MipsTargetMachine.h"
-#include "llvm/Pass.h"
-#include "llvm/Target/TargetMachine.h"
-
-using namespace llvm;
-
 namespace llvm {
-
-class Mips16HardFloat : public ModulePass {
-public:
-  static char ID;
-
-  Mips16HardFloat(MipsTargetMachine &TM_) : ModulePass(ID), TM(TM_) {}
-
-  const char *getPassName() const override { return "MIPS16 Hard Float Pass"; }
-  bool runOnModule(Module &M) override;
-
-protected:
-  const MipsTargetMachine &TM;
-};
+class MipsTargetMachine;
+class ModulePass;
 
 ModulePass *createMips16HardFloat(MipsTargetMachine &TM);
-
 }
+
 #endif
index b011e8fcd8b76f21ef423d6ca61ec53dc4d9233b..a6b6c5ab9f087516fb2ee98f4e2d06cb89a8cee8 100644 (file)
 
 #include "MipsISelDAGToDAG.h"
 #include "MipsModuleISelDAGToDAG.h"
+#include "MipsTargetMachine.h"
 #include "llvm/Support/Casting.h"
 #include "llvm/Support/Debug.h"
 #include "llvm/Support/raw_ostream.h"
+using namespace llvm;
 
 #define DEBUG_TYPE "mips-isel"
 
-namespace llvm {
+namespace {
+//===----------------------------------------------------------------------===//
+// MipsModuleDAGToDAGISel - MIPS specific code to select MIPS machine
+// instructions for SelectionDAG operations.
+//===----------------------------------------------------------------------===//
+class MipsModuleDAGToDAGISel : public MachineFunctionPass {
+public:
+
+  static char ID;
+
+  explicit MipsModuleDAGToDAGISel(MipsTargetMachine &TM_)
+      : MachineFunctionPass(ID), TM(TM_) {}
+
+  // Pass Name
+  const char *getPassName() const override {
+    return "MIPS DAG->DAG Pattern Instruction Selection";
+  }
+
+  bool runOnMachineFunction(MachineFunction &MF) override;
+
+protected:
+  MipsTargetMachine &TM;
+};
+} // namespace
 
 bool MipsModuleDAGToDAGISel::runOnMachineFunction(MachineFunction &MF) {
   DEBUG(errs() << "In MipsModuleDAGToDAGISel::runMachineFunction\n");
@@ -26,9 +51,6 @@ bool MipsModuleDAGToDAGISel::runOnMachineFunction(MachineFunction &MF) {
 
 char MipsModuleDAGToDAGISel::ID = 0;
 
-}
-
-
 llvm::FunctionPass *llvm::createMipsModuleISelDag(MipsTargetMachine &TM) {
   return new MipsModuleDAGToDAGISel(TM);
 }
index 85bae47aa08ee5043efcc5f21b6ae87a236ea48a..1b3789f5d03f733cf86c58c9ae56ab66391f62d5 100644 (file)
 #ifndef LLVM_LIB_TARGET_MIPS_MIPSMODULEISELDAGTODAG_H
 #define LLVM_LIB_TARGET_MIPS_MIPSMODULEISELDAGTODAG_H
 
-#include "Mips.h"
-#include "MipsSubtarget.h"
-#include "MipsTargetMachine.h"
-#include "llvm/CodeGen/SelectionDAGISel.h"
-
-
 //===----------------------------------------------------------------------===//
 // Instruction Selector Implementation
 //===----------------------------------------------------------------------===//
 
-//===----------------------------------------------------------------------===//
-// MipsModuleDAGToDAGISel - MIPS specific code to select MIPS machine
-// instructions for SelectionDAG operations.
-//===----------------------------------------------------------------------===//
 namespace llvm {
-
-class MipsModuleDAGToDAGISel : public MachineFunctionPass {
-public:
-
-  static char ID;
-
-  explicit MipsModuleDAGToDAGISel(MipsTargetMachine &TM_)
-      : MachineFunctionPass(ID), TM(TM_) {}
-
-  // Pass Name
-  const char *getPassName() const override {
-    return "MIPS DAG->DAG Pattern Instruction Selection";
-  }
-
-  bool runOnMachineFunction(MachineFunction &MF) override;
-
-protected:
-  MipsTargetMachine &TM;
-};
+class FunctionPass;
+class MipsTargetMachine;
 
 /// createMipsISelDag - This pass converts a legalized DAG into a
 /// MIPS-specific DAG, ready for instruction scheduling.
index 7aae964df538552484cc75e83f402525ce4bf5f2..b02ea841f83fa8b1d0fe275ca809fccafd4186dd 100644 (file)
 //===----------------------------------------------------------------------===//
 
 #include "MipsOs16.h"
+#include "llvm/IR/Instructions.h"
 #include "llvm/IR/Module.h"
 #include "llvm/Support/CommandLine.h"
 #include "llvm/Support/Debug.h"
 #include "llvm/Support/raw_ostream.h"
+using namespace llvm;
 
 #define DEBUG_TYPE "mips-os16"
 
-
 static cl::opt<std::string> Mips32FunctionMask(
   "mips32-function-mask",
   cl::init(""),
@@ -90,8 +91,19 @@ namespace {
     return false;
   }
 }
-namespace llvm {
 
+namespace {
+
+class MipsOs16 : public ModulePass {
+public:
+  static char ID;
+
+  MipsOs16() : ModulePass(ID) {}
+
+  const char *getPassName() const override { return "MIPS Os16 Optimization"; }
+  bool runOnModule(Module &M) override;
+};
+} // namespace
 
 bool MipsOs16::runOnModule(Module &M) {
   bool usingMask = Mips32FunctionMask.length() > 0;
@@ -138,10 +150,6 @@ bool MipsOs16::runOnModule(Module &M) {
 
 char MipsOs16::ID = 0;
 
-}
-
 ModulePass *llvm::createMipsOs16(MipsTargetMachine &TM) {
   return new MipsOs16;
 }
-
-
index 77183ece7b9f33a094f8fccdd396c4e517ff0a6f..d60af400d937985d7a58723706739eac2154cea4 100644 (file)
 #ifndef LLVM_LIB_TARGET_MIPS_MIPSOS16_H
 #define LLVM_LIB_TARGET_MIPS_MIPSOS16_H
 
-#include "MCTargetDesc/MipsMCTargetDesc.h"
-#include "MipsTargetMachine.h"
-#include "llvm/Pass.h"
-#include "llvm/Target/TargetMachine.h"
-
-using namespace llvm;
-
 namespace llvm {
-
-class MipsOs16 : public ModulePass {
-
-public:
-  static char ID;
-
-  MipsOs16() : ModulePass(ID) {
-
-  }
-
-  const char *getPassName() const override {
-    return "MIPS Os16 Optimization";
-  }
-
-  bool runOnModule(Module &M) override;
-
-};
+class MipsTargetMachine;
+class ModulePass;
 
 ModulePass *createMipsOs16(MipsTargetMachine &TM);
-
 }
 
 #endif
index 52060d2783b1d284e88fe3ff17542b607f425d06..578401a34ea20f7b11a34ffb4b487fe083cf6247 100644 (file)
@@ -12,6 +12,8 @@
 //===----------------------------------------------------------------------===//
 
 #include "NVPTXLowerAggrCopies.h"
+#include "llvm/CodeGen/MachineFunctionAnalysis.h"
+#include "llvm/CodeGen/StackProtector.h"
 #include "llvm/IR/Constants.h"
 #include "llvm/IR/DataLayout.h"
 #include "llvm/IR/Function.h"
 
 using namespace llvm;
 
-namespace llvm { FunctionPass *createLowerAggrCopies(); }
+namespace {
+// actual analysis class, which is a functionpass
+struct NVPTXLowerAggrCopies : public FunctionPass {
+  static char ID;
+
+  NVPTXLowerAggrCopies() : FunctionPass(ID) {}
+
+  void getAnalysisUsage(AnalysisUsage &AU) const override {
+    AU.addPreserved<MachineFunctionAnalysis>();
+    AU.addPreserved<StackProtector>();
+  }
+
+  bool runOnFunction(Function &F) override;
+
+  static const unsigned MaxAggrCopySize = 128;
+
+  const char *getPassName() const override {
+    return "Lower aggregate copies/intrinsics into loops";
+  }
+};
+} // namespace
 
 char NVPTXLowerAggrCopies::ID = 0;
 
index 7b0a4aed522f433723f11e6ad1f6a109411b6396..3c39f53eb30a7cb75a51c34295d11497878314b8 100644 (file)
 #ifndef LLVM_LIB_TARGET_NVPTX_NVPTXLOWERAGGRCOPIES_H
 #define LLVM_LIB_TARGET_NVPTX_NVPTXLOWERAGGRCOPIES_H
 
-#include "llvm/CodeGen/MachineFunctionAnalysis.h"
-#include "llvm/CodeGen/StackProtector.h"
-#include "llvm/IR/DataLayout.h"
-#include "llvm/Pass.h"
-
 namespace llvm {
+class FunctionPass;
 
-// actual analysis class, which is a functionpass
-struct NVPTXLowerAggrCopies : public FunctionPass {
-  static char ID;
-
-  NVPTXLowerAggrCopies() : FunctionPass(ID) {}
-
-  void getAnalysisUsage(AnalysisUsage &AU) const override {
-    AU.addPreserved<MachineFunctionAnalysis>();
-    AU.addPreserved<StackProtector>();
-  }
-
-  bool runOnFunction(Function &F) override;
-
-  static const unsigned MaxAggrCopySize = 128;
-
-  const char *getPassName() const override {
-    return "Lower aggregate copies/intrinsics into loops";
-  }
-};
-
-extern FunctionPass *createLowerAggrCopies();
+FunctionPass *createLowerAggrCopies();
 }
 
 #endif