1 //===----------------------------------------------------------------------===//
2 // Instruction Selector Subtarget Control
3 //===----------------------------------------------------------------------===//
5 //===----------------------------------------------------------------------===//
6 // This file defines a pass used to change the subtarget for the
7 // Mips Instruction selector.
9 //===----------------------------------------------------------------------===//
12 #include "MipsTargetMachine.h"
13 #include "llvm/Support/Debug.h"
17 #define DEBUG_TYPE "mips-isel"
20 class MipsModuleDAGToDAGISel : public MachineFunctionPass {
24 explicit MipsModuleDAGToDAGISel(MipsTargetMachine &TM_)
25 : MachineFunctionPass(ID), TM(TM_) {}
28 const char *getPassName() const override {
29 return "MIPS DAG->DAG Pattern Instruction Selection";
32 bool runOnMachineFunction(MachineFunction &MF) override;
35 MipsTargetMachine &TM;
38 char MipsModuleDAGToDAGISel::ID = 0;
41 bool MipsModuleDAGToDAGISel::runOnMachineFunction(MachineFunction &MF) {
42 DEBUG(errs() << "In MipsModuleDAGToDAGISel::runMachineFunction\n");
43 TM.resetSubtarget(&MF);
47 llvm::FunctionPass *llvm::createMipsModuleISelDagPass(MipsTargetMachine &TM) {
48 return new MipsModuleDAGToDAGISel(TM);