Reed Kotler | 1595f36 | 2013-04-09 19:46:01 +0000 | [diff] [blame] | 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" |
Benjamin Kramer | a52f696 | 2015-03-09 15:50:58 +0000 | [diff] [blame] | 13 | #include "MipsTargetMachine.h" |
Reed Kotler | 1595f36 | 2013-04-09 19:46:01 +0000 | [diff] [blame] | 14 | #include "llvm/Support/Casting.h" |
| 15 | #include "llvm/Support/Debug.h" |
| 16 | #include "llvm/Support/raw_ostream.h" |
Benjamin Kramer | a52f696 | 2015-03-09 15:50:58 +0000 | [diff] [blame] | 17 | using namespace llvm; |
Reed Kotler | 1595f36 | 2013-04-09 19:46:01 +0000 | [diff] [blame] | 18 | |
Chandler Carruth | e96dd89 | 2014-04-21 22:55:11 +0000 | [diff] [blame] | 19 | #define DEBUG_TYPE "mips-isel" |
| 20 | |
Benjamin Kramer | a52f696 | 2015-03-09 15:50:58 +0000 | [diff] [blame] | 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 |
Reed Kotler | 1595f36 | 2013-04-09 19:46:01 +0000 | [diff] [blame] | 45 | |
| 46 | bool MipsModuleDAGToDAGISel::runOnMachineFunction(MachineFunction &MF) { |
| 47 | DEBUG(errs() << "In MipsModuleDAGToDAGISel::runMachineFunction\n"); |
Eric Christopher | 4e7d1e7 | 2014-07-18 23:41:32 +0000 | [diff] [blame] | 48 | TM.resetSubtarget(&MF); |
Reed Kotler | 1595f36 | 2013-04-09 19:46:01 +0000 | [diff] [blame] | 49 | return false; |
| 50 | } |
| 51 | |
| 52 | char MipsModuleDAGToDAGISel::ID = 0; |
| 53 | |
Reed Kotler | 1595f36 | 2013-04-09 19:46:01 +0000 | [diff] [blame] | 54 | llvm::FunctionPass *llvm::createMipsModuleISelDag(MipsTargetMachine &TM) { |
| 55 | return new MipsModuleDAGToDAGISel(TM); |
| 56 | } |
| 57 | |
| 58 | |