xref: /aosp_15_r20/external/llvm/lib/Target/Mips/Mips16ISelDAGToDAG.h (revision 9880d6810fe72a1726cb53787c6711e909410d58)
1*9880d681SAndroid Build Coastguard Worker //===---- Mips16ISelDAGToDAG.h - A Dag to Dag Inst Selector for Mips ------===//
2*9880d681SAndroid Build Coastguard Worker //
3*9880d681SAndroid Build Coastguard Worker //                     The LLVM Compiler Infrastructure
4*9880d681SAndroid Build Coastguard Worker //
5*9880d681SAndroid Build Coastguard Worker // This file is distributed under the University of Illinois Open Source
6*9880d681SAndroid Build Coastguard Worker // License. See LICENSE.TXT for details.
7*9880d681SAndroid Build Coastguard Worker //
8*9880d681SAndroid Build Coastguard Worker //===----------------------------------------------------------------------===//
9*9880d681SAndroid Build Coastguard Worker //
10*9880d681SAndroid Build Coastguard Worker // Subclass of MipsDAGToDAGISel specialized for mips16.
11*9880d681SAndroid Build Coastguard Worker //
12*9880d681SAndroid Build Coastguard Worker //===----------------------------------------------------------------------===//
13*9880d681SAndroid Build Coastguard Worker 
14*9880d681SAndroid Build Coastguard Worker #ifndef LLVM_LIB_TARGET_MIPS_MIPS16ISELDAGTODAG_H
15*9880d681SAndroid Build Coastguard Worker #define LLVM_LIB_TARGET_MIPS_MIPS16ISELDAGTODAG_H
16*9880d681SAndroid Build Coastguard Worker 
17*9880d681SAndroid Build Coastguard Worker #include "MipsISelDAGToDAG.h"
18*9880d681SAndroid Build Coastguard Worker 
19*9880d681SAndroid Build Coastguard Worker namespace llvm {
20*9880d681SAndroid Build Coastguard Worker 
21*9880d681SAndroid Build Coastguard Worker class Mips16DAGToDAGISel : public MipsDAGToDAGISel {
22*9880d681SAndroid Build Coastguard Worker public:
Mips16DAGToDAGISel(MipsTargetMachine & TM,CodeGenOpt::Level OL)23*9880d681SAndroid Build Coastguard Worker   explicit Mips16DAGToDAGISel(MipsTargetMachine &TM, CodeGenOpt::Level OL)
24*9880d681SAndroid Build Coastguard Worker       : MipsDAGToDAGISel(TM, OL) {}
25*9880d681SAndroid Build Coastguard Worker 
26*9880d681SAndroid Build Coastguard Worker private:
27*9880d681SAndroid Build Coastguard Worker   std::pair<SDNode *, SDNode *> selectMULT(SDNode *N, unsigned Opc,
28*9880d681SAndroid Build Coastguard Worker                                            const SDLoc &DL, EVT Ty, bool HasLo,
29*9880d681SAndroid Build Coastguard Worker                                            bool HasHi);
30*9880d681SAndroid Build Coastguard Worker 
31*9880d681SAndroid Build Coastguard Worker   bool runOnMachineFunction(MachineFunction &MF) override;
32*9880d681SAndroid Build Coastguard Worker 
33*9880d681SAndroid Build Coastguard Worker   bool selectAddr(bool SPAllowed, SDValue Addr, SDValue &Base,
34*9880d681SAndroid Build Coastguard Worker                   SDValue &Offset);
35*9880d681SAndroid Build Coastguard Worker   bool selectAddr16(SDValue Addr, SDValue &Base,
36*9880d681SAndroid Build Coastguard Worker                     SDValue &Offset) override;
37*9880d681SAndroid Build Coastguard Worker   bool selectAddr16SP(SDValue Addr, SDValue &Base,
38*9880d681SAndroid Build Coastguard Worker                       SDValue &Offset) override;
39*9880d681SAndroid Build Coastguard Worker 
40*9880d681SAndroid Build Coastguard Worker   bool trySelect(SDNode *Node) override;
41*9880d681SAndroid Build Coastguard Worker 
42*9880d681SAndroid Build Coastguard Worker   void processFunctionAfterISel(MachineFunction &MF) override;
43*9880d681SAndroid Build Coastguard Worker 
44*9880d681SAndroid Build Coastguard Worker   // Insert instructions to initialize the global base register in the
45*9880d681SAndroid Build Coastguard Worker   // first MBB of the function.
46*9880d681SAndroid Build Coastguard Worker   void initGlobalBaseReg(MachineFunction &MF);
47*9880d681SAndroid Build Coastguard Worker 
48*9880d681SAndroid Build Coastguard Worker   void initMips16SPAliasReg(MachineFunction &MF);
49*9880d681SAndroid Build Coastguard Worker };
50*9880d681SAndroid Build Coastguard Worker 
51*9880d681SAndroid Build Coastguard Worker FunctionPass *createMips16ISelDag(MipsTargetMachine &TM,
52*9880d681SAndroid Build Coastguard Worker                                   CodeGenOpt::Level OptLevel);
53*9880d681SAndroid Build Coastguard Worker }
54*9880d681SAndroid Build Coastguard Worker 
55*9880d681SAndroid Build Coastguard Worker #endif
56