summaryrefslogtreecommitdiffstats
path: root/llvm/lib
diff options
context:
space:
mode:
Diffstat (limited to 'llvm/lib')
-rw-r--r--llvm/lib/Target/Mips/Mips16HardFloat.cpp19
-rw-r--r--llvm/lib/Target/Mips/Mips16HardFloat.h24
-rw-r--r--llvm/lib/Target/Mips/MipsModuleISelDAGToDAG.cpp30
-rw-r--r--llvm/lib/Target/Mips/MipsModuleISelDAGToDAG.h31
-rw-r--r--llvm/lib/Target/Mips/MipsOs16.cpp20
-rw-r--r--llvm/lib/Target/Mips/MipsOs16.h27
-rw-r--r--llvm/lib/Target/NVPTX/NVPTXLowerAggrCopies.cpp24
-rw-r--r--llvm/lib/Target/NVPTX/NVPTXLowerAggrCopies.h28
8 files changed, 88 insertions, 115 deletions
diff --git a/llvm/lib/Target/Mips/Mips16HardFloat.cpp b/llvm/lib/Target/Mips/Mips16HardFloat.cpp
index 32dc90af2ef..e330dda7d03 100644
--- a/llvm/lib/Target/Mips/Mips16HardFloat.cpp
+++ b/llvm/lib/Target/Mips/Mips16HardFloat.cpp
@@ -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) {
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);
}
diff --git a/llvm/lib/Target/Mips/Mips16HardFloat.h b/llvm/lib/Target/Mips/Mips16HardFloat.h
index 586cc252353..a97e2cff9f4 100644
--- a/llvm/lib/Target/Mips/Mips16HardFloat.h
+++ b/llvm/lib/Target/Mips/Mips16HardFloat.h
@@ -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
diff --git a/llvm/lib/Target/Mips/MipsModuleISelDAGToDAG.cpp b/llvm/lib/Target/Mips/MipsModuleISelDAGToDAG.cpp
index b011e8fcd8b..a6b6c5ab9f0 100644
--- a/llvm/lib/Target/Mips/MipsModuleISelDAGToDAG.cpp
+++ b/llvm/lib/Target/Mips/MipsModuleISelDAGToDAG.cpp
@@ -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::runOnMachineFunction(MachineFunction &MF) {
char MipsModuleDAGToDAGISel::ID = 0;
-}
-
-
llvm::FunctionPass *llvm::createMipsModuleISelDag(MipsTargetMachine &TM) {
return new MipsModuleDAGToDAGISel(TM);
}
diff --git a/llvm/lib/Target/Mips/MipsModuleISelDAGToDAG.h b/llvm/lib/Target/Mips/MipsModuleISelDAGToDAG.h
index 85bae47aa08..1b3789f5d03 100644
--- a/llvm/lib/Target/Mips/MipsModuleISelDAGToDAG.h
+++ b/llvm/lib/Target/Mips/MipsModuleISelDAGToDAG.h
@@ -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.
diff --git a/llvm/lib/Target/Mips/MipsOs16.cpp b/llvm/lib/Target/Mips/MipsOs16.cpp
index 7aae964df53..b02ea841f83 100644
--- a/llvm/lib/Target/Mips/MipsOs16.cpp
+++ b/llvm/lib/Target/Mips/MipsOs16.cpp
@@ -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;
}
-
-
diff --git a/llvm/lib/Target/Mips/MipsOs16.h b/llvm/lib/Target/Mips/MipsOs16.h
index 77183ece7b9..d60af400d93 100644
--- a/llvm/lib/Target/Mips/MipsOs16.h
+++ b/llvm/lib/Target/Mips/MipsOs16.h
@@ -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
diff --git a/llvm/lib/Target/NVPTX/NVPTXLowerAggrCopies.cpp b/llvm/lib/Target/NVPTX/NVPTXLowerAggrCopies.cpp
index 52060d2783b..578401a34ea 100644
--- a/llvm/lib/Target/NVPTX/NVPTXLowerAggrCopies.cpp
+++ b/llvm/lib/Target/NVPTX/NVPTXLowerAggrCopies.cpp
@@ -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;
diff --git a/llvm/lib/Target/NVPTX/NVPTXLowerAggrCopies.h b/llvm/lib/Target/NVPTX/NVPTXLowerAggrCopies.h
index 7b0a4aed522..3c39f53eb30 100644
--- a/llvm/lib/Target/NVPTX/NVPTXLowerAggrCopies.h
+++ b/llvm/lib/Target/NVPTX/NVPTXLowerAggrCopies.h
@@ -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
OpenPOWER on IntegriCloud