Move unreferenced passes into the cpp file

NFC.

git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@231661 91177308-0d34-0410-b5e6-96231b3b80d8
This commit is contained in:
Benjamin Kramer 2015-03-09 15:50:58 +00:00
parent b0c48577ca
commit d3ff0b9845
8 changed files with 88 additions and 115 deletions

View File

@ -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);
}

View File

@ -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

View File

@ -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);
}

View File

@ -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.

View File

@ -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;
}

View File

@ -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

View 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"
@ -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;

View File

@ -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