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 "MipsISelDAGToDAG.h" 12 #include "MipsModuleISelDAGToDAG.h" 13 #include "MipsTargetMachine.h" 14 #include "llvm/Support/Casting.h" 15 #include "llvm/Support/Debug.h" 16 #include "llvm/Support/raw_ostream.h" 17 using namespace llvm; 18 19 #define DEBUG_TYPE "mips-isel" 20 21 namespace { 22 //===----------------------------------------------------------------------===// 23 // MipsModuleDAGToDAGISel - MIPS specific code to select MIPS machine 24 // instructions for SelectionDAG operations. 25 //===----------------------------------------------------------------------===// 26 class MipsModuleDAGToDAGISel : public MachineFunctionPass { 27 public: 28 29 static char ID; 30 31 explicit MipsModuleDAGToDAGISel(MipsTargetMachine &TM_) 32 : MachineFunctionPass(ID), TM(TM_) {} 33 34 // Pass Name 35 const char *getPassName() const override { 36 return "MIPS DAG->DAG Pattern Instruction Selection"; 37 } 38 39 bool runOnMachineFunction(MachineFunction &MF) override; 40 41 protected: 42 MipsTargetMachine &TM; 43 }; 44 } // namespace 45 46 bool MipsModuleDAGToDAGISel::runOnMachineFunction(MachineFunction &MF) { 47 DEBUG(errs() << "In MipsModuleDAGToDAGISel::runMachineFunction\n"); 48 TM.resetSubtarget(&MF); 49 return false; 50 } 51 52 char MipsModuleDAGToDAGISel::ID = 0; 53 54 llvm::FunctionPass *llvm::createMipsModuleISelDag(MipsTargetMachine &TM) { 55 return new MipsModuleDAGToDAGISel(TM); 56 } 57 58 59