blob: 03ed1f97cf7a9b6491175e0c2f8f09c44b353e0d [file] [log] [blame]
Akira Hatanaka554d9312013-03-14 18:27:31 +00001//===-- 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
19namespace llvm {
20
21class MipsSEDAGToDAGISel : public MipsDAGToDAGISel {
22
23public:
24 explicit MipsSEDAGToDAGISel(MipsTargetMachine &TM) : MipsDAGToDAGISel(TM) {}
25
26private:
Reed Kotlera430cb62013-04-09 19:46:01 +000027
28 virtual bool runOnMachineFunction(MachineFunction &MF);
29
Akira Hatanakaa2b22002013-05-03 18:37:49 +000030 void addDSPCtrlRegOperands(bool IsDef, MachineInstr &MI,
31 MachineFunction &MF);
32
Akira Hatanakaf2835122013-03-14 18:33:23 +000033 bool replaceUsesWithZeroReg(MachineRegisterInfo *MRI, const MachineInstr&);
Akira Hatanaka554d9312013-03-14 18:27:31 +000034
Andrew Trickac6d9be2013-05-25 02:42:55 +000035 std::pair<SDNode*, SDNode*> selectMULT(SDNode *N, unsigned Opc, SDLoc dl,
Akira Hatanaka554d9312013-03-14 18:27:31 +000036 EVT Ty, bool HasLo, bool HasHi);
37
Akira Hatanaka275f3542013-03-14 18:39:25 +000038 SDNode *selectAddESubE(unsigned MOp, SDValue InFlag, SDValue CmpLHS,
Andrew Trickac6d9be2013-05-25 02:42:55 +000039 SDLoc DL, SDNode *Node) const;
Akira Hatanaka275f3542013-03-14 18:39:25 +000040
Akira Hatanaka554d9312013-03-14 18:27:31 +000041 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
Akira Hatanakaf2835122013-03-14 18:33:23 +000050 virtual std::pair<bool, SDNode*> selectNode(SDNode *Node);
Akira Hatanaka554d9312013-03-14 18:27:31 +000051
Akira Hatanakaf2835122013-03-14 18:33:23 +000052 virtual void processFunctionAfterISel(MachineFunction &MF);
Akira Hatanaka554d9312013-03-14 18:27:31 +000053
54 // Insert instructions to initialize the global base register in the
55 // first MBB of the function.
Akira Hatanakaf2835122013-03-14 18:33:23 +000056 void initGlobalBaseReg(MachineFunction &MF);
Akira Hatanaka554d9312013-03-14 18:27:31 +000057};
58
59FunctionPass *createMipsSEISelDag(MipsTargetMachine &TM);
60
61}
62
63#endif