2013-04-10 03:46:01 +08:00
|
|
|
//===----------------------------------------------------------------------===//
|
|
|
|
// Instruction Selector Subtarget Control
|
|
|
|
//===----------------------------------------------------------------------===//
|
|
|
|
|
|
|
|
//===----------------------------------------------------------------------===//
|
|
|
|
// This file defines a pass used to change the subtarget for the
|
|
|
|
// Mips Instruction selector.
|
|
|
|
//
|
|
|
|
//===----------------------------------------------------------------------===//
|
|
|
|
|
2015-03-14 17:20:52 +08:00
|
|
|
#include "Mips.h"
|
2015-03-09 23:50:58 +08:00
|
|
|
#include "MipsTargetMachine.h"
|
2013-04-10 03:46:01 +08:00
|
|
|
#include "llvm/Support/Debug.h"
|
2015-03-24 02:07:13 +08:00
|
|
|
#include "llvm/Support/raw_ostream.h"
|
2015-03-14 17:20:52 +08:00
|
|
|
|
2015-03-09 23:50:58 +08:00
|
|
|
using namespace llvm;
|
2013-04-10 03:46:01 +08:00
|
|
|
|
2014-04-22 06:55:11 +08:00
|
|
|
#define DEBUG_TYPE "mips-isel"
|
|
|
|
|
2015-03-09 23:50:58 +08:00
|
|
|
namespace {
|
2015-03-14 17:20:52 +08:00
|
|
|
class MipsModuleDAGToDAGISel : public MachineFunctionPass {
|
|
|
|
public:
|
|
|
|
static char ID;
|
2015-03-09 23:50:58 +08:00
|
|
|
|
2015-03-14 17:20:52 +08:00
|
|
|
explicit MipsModuleDAGToDAGISel(MipsTargetMachine &TM_)
|
2015-03-09 23:50:58 +08:00
|
|
|
: MachineFunctionPass(ID), TM(TM_) {}
|
|
|
|
|
2015-03-14 17:20:52 +08:00
|
|
|
// Pass Name
|
|
|
|
const char *getPassName() const override {
|
|
|
|
return "MIPS DAG->DAG Pattern Instruction Selection";
|
|
|
|
}
|
2015-03-09 23:50:58 +08:00
|
|
|
|
2015-03-14 17:20:52 +08:00
|
|
|
bool runOnMachineFunction(MachineFunction &MF) override;
|
2015-03-09 23:50:58 +08:00
|
|
|
|
2015-03-14 17:20:52 +08:00
|
|
|
protected:
|
|
|
|
MipsTargetMachine &TM;
|
|
|
|
};
|
|
|
|
|
|
|
|
char MipsModuleDAGToDAGISel::ID = 0;
|
2015-06-23 17:49:53 +08:00
|
|
|
}
|
2013-04-10 03:46:01 +08:00
|
|
|
|
|
|
|
bool MipsModuleDAGToDAGISel::runOnMachineFunction(MachineFunction &MF) {
|
|
|
|
DEBUG(errs() << "In MipsModuleDAGToDAGISel::runMachineFunction\n");
|
2014-07-19 07:41:32 +08:00
|
|
|
TM.resetSubtarget(&MF);
|
2013-04-10 03:46:01 +08:00
|
|
|
return false;
|
|
|
|
}
|
|
|
|
|
2015-03-14 17:20:52 +08:00
|
|
|
llvm::FunctionPass *llvm::createMipsModuleISelDagPass(MipsTargetMachine &TM) {
|
2013-04-10 03:46:01 +08:00
|
|
|
return new MipsModuleDAGToDAGISel(TM);
|
|
|
|
}
|