[llvm] r231661 - Move unreferenced passes into the cpp file

Benjamin Kramer benny.kra at googlemail.com
Mon Mar 9 08:50:58 PDT 2015


Author: d0k
Date: Mon Mar  9 10:50:58 2015
New Revision: 231661

URL: http://llvm.org/viewvc/llvm-project?rev=231661&view=rev
Log:
Move unreferenced passes into the cpp file

NFC.

Modified:
    llvm/trunk/lib/Target/Mips/Mips16HardFloat.cpp
    llvm/trunk/lib/Target/Mips/Mips16HardFloat.h
    llvm/trunk/lib/Target/Mips/MipsModuleISelDAGToDAG.cpp
    llvm/trunk/lib/Target/Mips/MipsModuleISelDAGToDAG.h
    llvm/trunk/lib/Target/Mips/MipsOs16.cpp
    llvm/trunk/lib/Target/Mips/MipsOs16.h
    llvm/trunk/lib/Target/NVPTX/NVPTXLowerAggrCopies.cpp
    llvm/trunk/lib/Target/NVPTX/NVPTXLowerAggrCopies.h

Modified: llvm/trunk/lib/Target/Mips/Mips16HardFloat.cpp
URL: http://llvm.org/viewvc/llvm-project/llvm/trunk/lib/Target/Mips/Mips16HardFloat.cpp?rev=231661&r1=231660&r2=231661&view=diff
==============================================================================
--- llvm/trunk/lib/Target/Mips/Mips16HardFloat.cpp (original)
+++ llvm/trunk/lib/Target/Mips/Mips16HardFloat.cpp Mon Mar  9 10:50:58 2015
@@ -12,12 +12,14 @@
 //===----------------------------------------------------------------------===//
 
 #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.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
 
 char Mips16HardFloat::ID = 0;
 
-}
-
 ModulePass *llvm::createMips16HardFloat(MipsTargetMachine &TM) {
   return new Mips16HardFloat(TM);
 }

Modified: llvm/trunk/lib/Target/Mips/Mips16HardFloat.h
URL: http://llvm.org/viewvc/llvm-project/llvm/trunk/lib/Target/Mips/Mips16HardFloat.h?rev=231661&r1=231660&r2=231661&view=diff
==============================================================================
--- llvm/trunk/lib/Target/Mips/Mips16HardFloat.h (original)
+++ llvm/trunk/lib/Target/Mips/Mips16HardFloat.h Mon Mar  9 10:50:58 2015
@@ -15,29 +15,11 @@
 #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

Modified: llvm/trunk/lib/Target/Mips/MipsModuleISelDAGToDAG.cpp
URL: http://llvm.org/viewvc/llvm-project/llvm/trunk/lib/Target/Mips/MipsModuleISelDAGToDAG.cpp?rev=231661&r1=231660&r2=231661&view=diff
==============================================================================
--- llvm/trunk/lib/Target/Mips/MipsModuleISelDAGToDAG.cpp (original)
+++ llvm/trunk/lib/Target/Mips/MipsModuleISelDAGToDAG.cpp Mon Mar  9 10:50:58 2015
@@ -10,13 +10,38 @@
 
 #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::runOnMachin
 
 char MipsModuleDAGToDAGISel::ID = 0;
 
-}
-
-
 llvm::FunctionPass *llvm::createMipsModuleISelDag(MipsTargetMachine &TM) {
   return new MipsModuleDAGToDAGISel(TM);
 }

Modified: llvm/trunk/lib/Target/Mips/MipsModuleISelDAGToDAG.h
URL: http://llvm.org/viewvc/llvm-project/llvm/trunk/lib/Target/Mips/MipsModuleISelDAGToDAG.h?rev=231661&r1=231660&r2=231661&view=diff
==============================================================================
--- llvm/trunk/lib/Target/Mips/MipsModuleISelDAGToDAG.h (original)
+++ llvm/trunk/lib/Target/Mips/MipsModuleISelDAGToDAG.h Mon Mar  9 10:50:58 2015
@@ -15,40 +15,13 @@
 #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.

Modified: llvm/trunk/lib/Target/Mips/MipsOs16.cpp
URL: http://llvm.org/viewvc/llvm-project/llvm/trunk/lib/Target/Mips/MipsOs16.cpp?rev=231661&r1=231660&r2=231661&view=diff
==============================================================================
--- llvm/trunk/lib/Target/Mips/MipsOs16.cpp (original)
+++ llvm/trunk/lib/Target/Mips/MipsOs16.cpp Mon Mar  9 10:50:58 2015
@@ -12,14 +12,15 @@
 //===----------------------------------------------------------------------===//
 
 #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;
 }
-
-

Modified: llvm/trunk/lib/Target/Mips/MipsOs16.h
URL: http://llvm.org/viewvc/llvm-project/llvm/trunk/lib/Target/Mips/MipsOs16.h?rev=231661&r1=231660&r2=231661&view=diff
==============================================================================
--- llvm/trunk/lib/Target/Mips/MipsOs16.h (original)
+++ llvm/trunk/lib/Target/Mips/MipsOs16.h Mon Mar  9 10:50:58 2015
@@ -14,34 +14,11 @@
 #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

Modified: llvm/trunk/lib/Target/NVPTX/NVPTXLowerAggrCopies.cpp
URL: http://llvm.org/viewvc/llvm-project/llvm/trunk/lib/Target/NVPTX/NVPTXLowerAggrCopies.cpp?rev=231661&r1=231660&r2=231661&view=diff
==============================================================================
--- llvm/trunk/lib/Target/NVPTX/NVPTXLowerAggrCopies.cpp (original)
+++ llvm/trunk/lib/Target/NVPTX/NVPTXLowerAggrCopies.cpp Mon Mar  9 10:50:58 2015
@@ -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"
@@ -28,7 +30,27 @@
 
 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;
 

Modified: llvm/trunk/lib/Target/NVPTX/NVPTXLowerAggrCopies.h
URL: http://llvm.org/viewvc/llvm-project/llvm/trunk/lib/Target/NVPTX/NVPTXLowerAggrCopies.h?rev=231661&r1=231660&r2=231661&view=diff
==============================================================================
--- llvm/trunk/lib/Target/NVPTX/NVPTXLowerAggrCopies.h (original)
+++ llvm/trunk/lib/Target/NVPTX/NVPTXLowerAggrCopies.h Mon Mar  9 10:50:58 2015
@@ -15,34 +15,10 @@
 #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





More information about the llvm-commits mailing list