1 //===----------------------------------------------------------------------===// 2 // Instruction Selector Subtarget Control 3 //===----------------------------------------------------------------------===// 4 5 //===----------------------------------------------------------------------===// 6 // This file defines a pass used to change the subtarget for the 7 // Mips Instruction selector. 8 // 9 //===----------------------------------------------------------------------===// 10 11 #include "Mips.h" 12 #include "MipsTargetMachine.h" 13 #include "llvm/Support/Debug.h" 14 15 using namespace llvm; 16 17 #define DEBUG_TYPE "mips-isel" 18 19 namespace { 20 class MipsModuleDAGToDAGISel : public MachineFunctionPass { 21 public: 22 static char ID; 23 24 explicit MipsModuleDAGToDAGISel(MipsTargetMachine &TM_) 25 : MachineFunctionPass(ID), TM(TM_) {} 26 27 // Pass Name 28 const char *getPassName() const override { 29 return "MIPS DAG->DAG Pattern Instruction Selection"; 30 } 31 32 bool runOnMachineFunction(MachineFunction &MF) override; 33 34 protected: 35 MipsTargetMachine &TM; 36 }; 37 38 char MipsModuleDAGToDAGISel::ID = 0; 39 } 40 41 bool MipsModuleDAGToDAGISel::runOnMachineFunction(MachineFunction &MF) { 42 DEBUG(errs() << "In MipsModuleDAGToDAGISel::runMachineFunction\n"); 43 TM.resetSubtarget(&MF); 44 return false; 45 } 46 47 llvm::FunctionPass *llvm::createMipsModuleISelDagPass(MipsTargetMachine &TM) { 48 return new MipsModuleDAGToDAGISel(TM); 49 } 50