[mips] Remove trivial header for the MipsOs16 pass. NFC.

git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@232258 91177308-0d34-0410-b5e6-96231b3b80d8
This commit is contained in:
Vasileios Kalintiris 2015-03-14 08:34:25 +00:00
parent 9786d3d019
commit 3ccd82623a
4 changed files with 75 additions and 96 deletions

View File

@ -20,8 +20,11 @@
namespace llvm { namespace llvm {
class MipsTargetMachine; class MipsTargetMachine;
class ModulePass;
class FunctionPass; class FunctionPass;
ModulePass *createMipsOs16Pass(MipsTargetMachine &TM);
FunctionPass *createMipsOptimizePICCallPass(MipsTargetMachine &TM); FunctionPass *createMipsOptimizePICCallPass(MipsTargetMachine &TM);
FunctionPass *createMipsDelaySlotFillerPass(MipsTargetMachine &TM); FunctionPass *createMipsDelaySlotFillerPass(MipsTargetMachine &TM);
FunctionPass *createMipsLongBranchPass(MipsTargetMachine &TM); FunctionPass *createMipsLongBranchPass(MipsTargetMachine &TM);

View File

@ -11,12 +11,12 @@
// //
//===----------------------------------------------------------------------===// //===----------------------------------------------------------------------===//
#include "MipsOs16.h"
#include "llvm/IR/Instructions.h" #include "llvm/IR/Instructions.h"
#include "llvm/IR/Module.h" #include "llvm/IR/Module.h"
#include "llvm/Support/CommandLine.h" #include "llvm/Support/CommandLine.h"
#include "llvm/Support/Debug.h" #include "llvm/Support/Debug.h"
#include "llvm/Support/raw_ostream.h" #include "Mips.h"
using namespace llvm; using namespace llvm;
#define DEBUG_TYPE "mips-os16" #define DEBUG_TYPE "mips-os16"
@ -28,12 +28,27 @@ static cl::opt<std::string> Mips32FunctionMask(
cl::Hidden); cl::Hidden);
namespace { 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;
};
char MipsOs16::ID = 0;
}
// Figure out if we need float point based on the function signature. // Figure out if we need float point based on the function signature.
// We need to move variables in and/or out of floating point // We need to move variables in and/or out of floating point
// registers because of the ABI // registers because of the ABI
// //
bool needsFPFromSig(Function &F) { static bool needsFPFromSig(Function &F) {
Type* RetType = F.getReturnType(); Type* RetType = F.getReturnType();
switch (RetType->getTypeID()) { switch (RetType->getTypeID()) {
case Type::FloatTyID: case Type::FloatTyID:
@ -57,7 +72,7 @@ namespace {
// Figure out if the function will need floating point operations // Figure out if the function will need floating point operations
// //
bool needsFP(Function &F) { static bool needsFP(Function &F) {
if (needsFPFromSig(F)) if (needsFPFromSig(F))
return true; return true;
for (Function::const_iterator BB = F.begin(), E = F.end(); BB != E; ++BB) for (Function::const_iterator BB = F.begin(), E = F.end(); BB != E; ++BB)
@ -90,20 +105,7 @@ namespace {
} }
return false; return false;
} }
}
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 MipsOs16::runOnModule(Module &M) {
bool usingMask = Mips32FunctionMask.length() > 0; bool usingMask = Mips32FunctionMask.length() > 0;
@ -148,8 +150,6 @@ bool MipsOs16::runOnModule(Module &M) {
return modified; return modified;
} }
char MipsOs16::ID = 0; ModulePass *llvm::createMipsOs16Pass(MipsTargetMachine &TM) {
ModulePass *llvm::createMipsOs16(MipsTargetMachine &TM) {
return new MipsOs16; return new MipsOs16;
} }

View File

@ -1,24 +0,0 @@
//===---- MipsOs16.h for Mips Option -Os16 --------===//
//
// The LLVM Compiler Infrastructure
//
// This file is distributed under the University of Illinois Open Source
// License. See LICENSE.TXT for details.
//
//===----------------------------------------------------------------------===//
//
// This file defines an optimization phase for the MIPS target.
//
//===----------------------------------------------------------------------===//
#ifndef LLVM_LIB_TARGET_MIPS_MIPSOS16_H
#define LLVM_LIB_TARGET_MIPS_MIPSOS16_H
namespace llvm {
class MipsTargetMachine;
class ModulePass;
ModulePass *createMipsOs16(MipsTargetMachine &TM);
}
#endif

View File

@ -21,7 +21,6 @@
#include "MipsFrameLowering.h" #include "MipsFrameLowering.h"
#include "MipsInstrInfo.h" #include "MipsInstrInfo.h"
#include "MipsModuleISelDAGToDAG.h" #include "MipsModuleISelDAGToDAG.h"
#include "MipsOs16.h"
#include "MipsSEFrameLowering.h" #include "MipsSEFrameLowering.h"
#include "MipsSEISelDAGToDAG.h" #include "MipsSEISelDAGToDAG.h"
#include "MipsSEISelLowering.h" #include "MipsSEISelLowering.h"
@ -34,6 +33,7 @@
#include "llvm/Support/TargetRegistry.h" #include "llvm/Support/TargetRegistry.h"
#include "llvm/Support/raw_ostream.h" #include "llvm/Support/raw_ostream.h"
#include "llvm/Transforms/Scalar.h" #include "llvm/Transforms/Scalar.h"
using namespace llvm; using namespace llvm;
#define DEBUG_TYPE "mips" #define DEBUG_TYPE "mips"
@ -213,7 +213,7 @@ void MipsPassConfig::addIRPasses() {
TargetPassConfig::addIRPasses(); TargetPassConfig::addIRPasses();
addPass(createAtomicExpandPass(&getMipsTargetMachine())); addPass(createAtomicExpandPass(&getMipsTargetMachine()));
if (getMipsSubtarget().os16()) if (getMipsSubtarget().os16())
addPass(createMipsOs16(getMipsTargetMachine())); addPass(createMipsOs16Pass(getMipsTargetMachine()));
if (getMipsSubtarget().inMips16HardFloat()) if (getMipsSubtarget().inMips16HardFloat())
addPass(createMips16HardFloat(getMipsTargetMachine())); addPass(createMips16HardFloat(getMipsTargetMachine()));
} }