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"
14 #include "llvm/Support/raw_ostream.h"
18 #define DEBUG_TYPE "mips-isel"
21 class MipsModuleDAGToDAGISel : public MachineFunctionPass {
25 explicit MipsModuleDAGToDAGISel(MipsTargetMachine &TM_)
26 : MachineFunctionPass(ID), TM(TM_) {}
29 const char *getPassName() const override {
30 return "MIPS DAG->DAG Pattern Instruction Selection";
33 bool runOnMachineFunction(MachineFunction &MF) override;
36 MipsTargetMachine &TM;
39 char MipsModuleDAGToDAGISel::ID = 0;
42 bool MipsModuleDAGToDAGISel::runOnMachineFunction(MachineFunction &MF) {
43 DEBUG(errs() << "In MipsModuleDAGToDAGISel::runMachineFunction\n");
44 TM.resetSubtarget(&MF);
48 llvm::FunctionPass *llvm::createMipsModuleISelDagPass(MipsTargetMachine &TM) {
49 return new MipsModuleDAGToDAGISel(TM);