1 //===---- Mips16ISelDAGToDAG.h - A Dag to Dag Inst Selector for Mips ------===//
3 // The LLVM Compiler Infrastructure
5 // This file is distributed under the University of Illinois Open Source
6 // License. See LICENSE.TXT for details.
8 //===----------------------------------------------------------------------===//
10 // Subclass of MipsDAGToDAGISel specialized for mips16.
12 //===----------------------------------------------------------------------===//
14 #ifndef LLVM_LIB_TARGET_MIPS_MIPS16ISELDAGTODAG_H
15 #define LLVM_LIB_TARGET_MIPS_MIPS16ISELDAGTODAG_H
17 #include "MipsISelDAGToDAG.h"
21 class Mips16DAGToDAGISel : public MipsDAGToDAGISel {
23 explicit Mips16DAGToDAGISel(MipsTargetMachine &TM) : MipsDAGToDAGISel(TM) {}
26 std::pair<SDNode*, SDNode*> selectMULT(SDNode *N, unsigned Opc, SDLoc DL,
27 EVT Ty, bool HasLo, bool HasHi);
29 SDValue getMips16SPAliasReg();
31 bool runOnMachineFunction(MachineFunction &MF) override;
33 void getMips16SPRefReg(SDNode *Parent, SDValue &AliasReg);
35 bool selectAddr16(SDNode *Parent, SDValue N, SDValue &Base,
36 SDValue &Offset, SDValue &Alias) override;
38 std::pair<bool, SDNode*> selectNode(SDNode *Node) override;
40 void processFunctionAfterISel(MachineFunction &MF) override;
42 // Insert instructions to initialize the global base register in the
43 // first MBB of the function.
44 void initGlobalBaseReg(MachineFunction &MF);
46 void initMips16SPAliasReg(MachineFunction &MF);
49 FunctionPass *createMips16ISelDag(MipsTargetMachine &TM);