Mips16ISelDAGToDAG.h revision 554d9312b284265f91ac5ee5bf0351d446f669b1
1//===---- Mips16ISelDAGToDAG.h - A Dag to Dag Inst Selector for Mips ------===//
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 mips16.
11//
12//===----------------------------------------------------------------------===//
13
14#ifndef MIPS16ISELDAGTODAG_H
15#define MIPS16ISELDAGTODAG_H
16
17#include "MipsISelDAGToDAG.h"
18
19namespace llvm {
20
21class Mips16DAGToDAGISel : public MipsDAGToDAGISel {
22public:
23  explicit Mips16DAGToDAGISel(MipsTargetMachine &TM) : MipsDAGToDAGISel(TM) {}
24
25private:
26  std::pair<SDNode*, SDNode*> SelectMULT(SDNode *N, unsigned Opc, DebugLoc dl,
27                                         EVT Ty, bool HasLo, bool HasHi);
28
29  SDValue getMips16SPAliasReg();
30
31  void getMips16SPRefReg(SDNode *Parent, SDValue &AliasReg);
32
33  virtual bool SelectAddr16(SDNode *Parent, SDValue N, SDValue &Base,
34                            SDValue &Offset, SDValue &Alias);
35
36  virtual std::pair<bool, SDNode*> SelectNode(SDNode *Node);
37
38  virtual void ProcessFunctionAfterISel(MachineFunction &MF);
39
40  // Insert instructions to initialize the global base register in the
41  // first MBB of the function.
42  void InitGlobalBaseReg(MachineFunction &MF);
43
44  void InitMips16SPAliasReg(MachineFunction &MF);
45};
46
47FunctionPass *createMips16ISelDag(MipsTargetMachine &TM);
48
49}
50
51#endif
52