blob: a96862a6a11a4792cd2975bc7e18f47b96759223 [file] [log] [blame]
Reed Kotler1595f362013-04-09 19:46:01 +00001//===---- MipsModuleISelDAGToDAG.h - Change Subtarget --------===//
2//
3// The LLVM Compiler Infrastructure
4//
5// This file is distributed under the University of Illinois Open Source
6// License. See LICENSE.TXT for details.
7//
8//===----------------------------------------------------------------------===//
9//
10// This file defines a pass used to change the subtarget for the
11// Mips Instruction selector.
12//
13//===----------------------------------------------------------------------===//
14
15#ifndef MIPSMODULEISELDAGTODAG_H
16#define MIPSMODULEISELDAGTODAG_H
17
18#include "Mips.h"
19#include "MipsSubtarget.h"
20#include "MipsTargetMachine.h"
21#include "llvm/CodeGen/SelectionDAGISel.h"
22
23
24//===----------------------------------------------------------------------===//
25// Instruction Selector Implementation
26//===----------------------------------------------------------------------===//
27
28//===----------------------------------------------------------------------===//
29// MipsModuleDAGToDAGISel - MIPS specific code to select MIPS machine
30// instructions for SelectionDAG operations.
31//===----------------------------------------------------------------------===//
32namespace llvm {
33
34class MipsModuleDAGToDAGISel : public MachineFunctionPass {
35public:
36
37 static char ID;
38
39 explicit MipsModuleDAGToDAGISel(MipsTargetMachine &TM_)
40 : MachineFunctionPass(ID),
41 TM(TM_), Subtarget(TM.getSubtarget<MipsSubtarget>()) {}
42
43 // Pass Name
Craig Topper56c590a2014-04-29 07:58:02 +000044 const char *getPassName() const override {
Reed Kotler1595f362013-04-09 19:46:01 +000045 return "MIPS DAG->DAG Pattern Instruction Selection";
46 }
47
Craig Topper56c590a2014-04-29 07:58:02 +000048 bool runOnMachineFunction(MachineFunction &MF) override;
Reed Kotler1595f362013-04-09 19:46:01 +000049
50protected:
51 /// Keep a pointer to the MipsSubtarget around so that we can make the right
52 /// decision when generating code for different targets.
53 const TargetMachine &TM;
54 const MipsSubtarget &Subtarget;
55};
56
57/// createMipsISelDag - This pass converts a legalized DAG into a
58/// MIPS-specific DAG, ready for instruction scheduling.
59FunctionPass *createMipsModuleISelDag(MipsTargetMachine &TM);
60}
61
62#endif