blob: a6b6c5ab9f087516fb2ee98f4e2d06cb89a8cee8 [file] [log] [blame]
Reed Kotler1595f362013-04-09 19:46:01 +00001//===----------------------------------------------------------------------===//
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 Kramera52f6962015-03-09 15:50:58 +000013#include "MipsTargetMachine.h"
Reed Kotler1595f362013-04-09 19:46:01 +000014#include "llvm/Support/Casting.h"
15#include "llvm/Support/Debug.h"
16#include "llvm/Support/raw_ostream.h"
Benjamin Kramera52f6962015-03-09 15:50:58 +000017using namespace llvm;
Reed Kotler1595f362013-04-09 19:46:01 +000018
Chandler Carruthe96dd892014-04-21 22:55:11 +000019#define DEBUG_TYPE "mips-isel"
20
Benjamin Kramera52f6962015-03-09 15:50:58 +000021namespace {
22//===----------------------------------------------------------------------===//
23// MipsModuleDAGToDAGISel - MIPS specific code to select MIPS machine
24// instructions for SelectionDAG operations.
25//===----------------------------------------------------------------------===//
26class MipsModuleDAGToDAGISel : public MachineFunctionPass {
27public:
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
41protected:
42 MipsTargetMachine &TM;
43};
44} // namespace
Reed Kotler1595f362013-04-09 19:46:01 +000045
46bool MipsModuleDAGToDAGISel::runOnMachineFunction(MachineFunction &MF) {
47 DEBUG(errs() << "In MipsModuleDAGToDAGISel::runMachineFunction\n");
Eric Christopher4e7d1e72014-07-18 23:41:32 +000048 TM.resetSubtarget(&MF);
Reed Kotler1595f362013-04-09 19:46:01 +000049 return false;
50}
51
52char MipsModuleDAGToDAGISel::ID = 0;
53
Reed Kotler1595f362013-04-09 19:46:01 +000054llvm::FunctionPass *llvm::createMipsModuleISelDag(MipsTargetMachine &TM) {
55 return new MipsModuleDAGToDAGISel(TM);
56}
57
58