//===----------------------------------------------------------------------===//
#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"
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
char Mips16HardFloat::ID = 0;
-}
-
ModulePass *llvm::createMips16HardFloat(MipsTargetMachine &TM) {
return new Mips16HardFloat(TM);
}
#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
#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");
char MipsModuleDAGToDAGISel::ID = 0;
-}
-
-
llvm::FunctionPass *llvm::createMipsModuleISelDag(MipsTargetMachine &TM) {
return new MipsModuleDAGToDAGISel(TM);
}
#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.
//===----------------------------------------------------------------------===//
#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(""),
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;
char MipsOs16::ID = 0;
-}
-
ModulePass *llvm::createMipsOs16(MipsTargetMachine &TM) {
return new MipsOs16;
}
-
-
#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
//===----------------------------------------------------------------------===//
#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;
#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