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 #include "llvm/Support/raw_ostream.h" 15 16 using namespace llvm; 17 18 #define DEBUG_TYPE "mips-isel" 19 20 namespace { 21 class MipsModuleDAGToDAGISel : public MachineFunctionPass { 22 public: 23 static char ID; 24 MipsModuleDAGToDAGISel(MipsTargetMachine & TM_)25 explicit MipsModuleDAGToDAGISel(MipsTargetMachine &TM_) 26 : MachineFunctionPass(ID), TM(TM_) {} 27 28 // Pass Name getPassName() const29 const char *getPassName() const override { 30 return "MIPS DAG->DAG Pattern Instruction Selection"; 31 } 32 33 bool runOnMachineFunction(MachineFunction &MF) override; 34 35 protected: 36 MipsTargetMachine &TM; 37 }; 38 39 char MipsModuleDAGToDAGISel::ID = 0; 40 } 41 runOnMachineFunction(MachineFunction & MF)42bool MipsModuleDAGToDAGISel::runOnMachineFunction(MachineFunction &MF) { 43 DEBUG(errs() << "In MipsModuleDAGToDAGISel::runMachineFunction\n"); 44 TM.resetSubtarget(&MF); 45 return false; 46 } 47 createMipsModuleISelDagPass(MipsTargetMachine & TM)48llvm::FunctionPass *llvm::createMipsModuleISelDagPass(MipsTargetMachine &TM) { 49 return new MipsModuleDAGToDAGISel(TM); 50 } 51