[Mips] Support for unaligned load/store microMips instructions
[oota-llvm.git] / lib / Target / Mips / MipsSEISelDAGToDAG.h
1 //===-- MipsSEISelDAGToDAG.h - A Dag to Dag Inst Selector for MipsSE -----===//
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 // Subclass of MipsDAGToDAGISel specialized for mips32/64.
11 //
12 //===----------------------------------------------------------------------===//
13
14 #ifndef MIPSSEISELDAGTODAG_H
15 #define MIPSSEISELDAGTODAG_H
16
17 #include "MipsISelDAGToDAG.h"
18
19 namespace llvm {
20
21 class MipsSEDAGToDAGISel : public MipsDAGToDAGISel {
22
23 public:
24   explicit MipsSEDAGToDAGISel(MipsTargetMachine &TM) : MipsDAGToDAGISel(TM) {}
25
26 private:
27
28   virtual bool runOnMachineFunction(MachineFunction &MF);
29
30   void addDSPCtrlRegOperands(bool IsDef, MachineInstr &MI,
31                              MachineFunction &MF);
32
33   bool replaceUsesWithZeroReg(MachineRegisterInfo *MRI, const MachineInstr&);
34
35   std::pair<SDNode*, SDNode*> selectMULT(SDNode *N, unsigned Opc, SDLoc dl,
36                                          EVT Ty, bool HasLo, bool HasHi);
37
38   SDNode *selectAddESubE(unsigned MOp, SDValue InFlag, SDValue CmpLHS,
39                          SDLoc DL, SDNode *Node) const;
40
41   virtual bool selectAddrRegImm(SDValue Addr, SDValue &Base,
42                                 SDValue &Offset) const;
43
44   virtual bool selectAddrDefault(SDValue Addr, SDValue &Base,
45                                  SDValue &Offset) const;
46
47   virtual bool selectIntAddr(SDValue Addr, SDValue &Base,
48                              SDValue &Offset) const;
49
50   virtual bool selectAddrRegImm12(SDValue Addr, SDValue &Base,
51                                   SDValue &Offset) const;
52
53   virtual bool selectIntAddrMM(SDValue Addr, SDValue &Base,
54                                SDValue &Offset) const;
55
56   virtual std::pair<bool, SDNode*> selectNode(SDNode *Node);
57
58   virtual void processFunctionAfterISel(MachineFunction &MF);
59
60   // Insert instructions to initialize the global base register in the
61   // first MBB of the function.
62   void initGlobalBaseReg(MachineFunction &MF);
63 };
64
65 FunctionPass *createMipsSEISelDag(MipsTargetMachine &TM);
66
67 }
68
69 #endif