xref: /aosp_15_r20/external/llvm/lib/Target/Mips/MipsSEISelLowering.h (revision 9880d6810fe72a1726cb53787c6711e909410d58)
1*9880d681SAndroid Build Coastguard Worker //===-- MipsSEISelLowering.h - MipsSE DAG Lowering Interface ----*- C++ -*-===//
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 MipsTargetLowering specialized for mips32/64.
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_MIPSSEISELLOWERING_H
15*9880d681SAndroid Build Coastguard Worker #define LLVM_LIB_TARGET_MIPS_MIPSSEISELLOWERING_H
16*9880d681SAndroid Build Coastguard Worker 
17*9880d681SAndroid Build Coastguard Worker #include "MipsISelLowering.h"
18*9880d681SAndroid Build Coastguard Worker #include "MipsRegisterInfo.h"
19*9880d681SAndroid Build Coastguard Worker 
20*9880d681SAndroid Build Coastguard Worker namespace llvm {
21*9880d681SAndroid Build Coastguard Worker   class MipsSETargetLowering : public MipsTargetLowering  {
22*9880d681SAndroid Build Coastguard Worker   public:
23*9880d681SAndroid Build Coastguard Worker     explicit MipsSETargetLowering(const MipsTargetMachine &TM,
24*9880d681SAndroid Build Coastguard Worker                                   const MipsSubtarget &STI);
25*9880d681SAndroid Build Coastguard Worker 
26*9880d681SAndroid Build Coastguard Worker     /// \brief Enable MSA support for the given integer type and Register
27*9880d681SAndroid Build Coastguard Worker     /// class.
28*9880d681SAndroid Build Coastguard Worker     void addMSAIntType(MVT::SimpleValueType Ty, const TargetRegisterClass *RC);
29*9880d681SAndroid Build Coastguard Worker     /// \brief Enable MSA support for the given floating-point type and
30*9880d681SAndroid Build Coastguard Worker     /// Register class.
31*9880d681SAndroid Build Coastguard Worker     void addMSAFloatType(MVT::SimpleValueType Ty,
32*9880d681SAndroid Build Coastguard Worker                          const TargetRegisterClass *RC);
33*9880d681SAndroid Build Coastguard Worker 
34*9880d681SAndroid Build Coastguard Worker     bool allowsMisalignedMemoryAccesses(EVT VT, unsigned AS = 0,
35*9880d681SAndroid Build Coastguard Worker                                         unsigned Align = 1,
36*9880d681SAndroid Build Coastguard Worker                                         bool *Fast = nullptr) const override;
37*9880d681SAndroid Build Coastguard Worker 
38*9880d681SAndroid Build Coastguard Worker     SDValue LowerOperation(SDValue Op, SelectionDAG &DAG) const override;
39*9880d681SAndroid Build Coastguard Worker 
40*9880d681SAndroid Build Coastguard Worker     SDValue PerformDAGCombine(SDNode *N, DAGCombinerInfo &DCI) const override;
41*9880d681SAndroid Build Coastguard Worker 
42*9880d681SAndroid Build Coastguard Worker     MachineBasicBlock *
43*9880d681SAndroid Build Coastguard Worker     EmitInstrWithCustomInserter(MachineInstr &MI,
44*9880d681SAndroid Build Coastguard Worker                                 MachineBasicBlock *MBB) const override;
45*9880d681SAndroid Build Coastguard Worker 
isShuffleMaskLegal(const SmallVectorImpl<int> & Mask,EVT VT)46*9880d681SAndroid Build Coastguard Worker     bool isShuffleMaskLegal(const SmallVectorImpl<int> &Mask,
47*9880d681SAndroid Build Coastguard Worker                             EVT VT) const override {
48*9880d681SAndroid Build Coastguard Worker       return false;
49*9880d681SAndroid Build Coastguard Worker     }
50*9880d681SAndroid Build Coastguard Worker 
51*9880d681SAndroid Build Coastguard Worker     const TargetRegisterClass *getRepRegClassFor(MVT VT) const override;
52*9880d681SAndroid Build Coastguard Worker 
53*9880d681SAndroid Build Coastguard Worker   private:
54*9880d681SAndroid Build Coastguard Worker     bool isEligibleForTailCallOptimization(
55*9880d681SAndroid Build Coastguard Worker         const CCState &CCInfo, unsigned NextStackOffset,
56*9880d681SAndroid Build Coastguard Worker         const MipsFunctionInfo &FI) const override;
57*9880d681SAndroid Build Coastguard Worker 
58*9880d681SAndroid Build Coastguard Worker     void
59*9880d681SAndroid Build Coastguard Worker     getOpndList(SmallVectorImpl<SDValue> &Ops,
60*9880d681SAndroid Build Coastguard Worker                 std::deque< std::pair<unsigned, SDValue> > &RegsToPass,
61*9880d681SAndroid Build Coastguard Worker                 bool IsPICCall, bool GlobalOrExternal, bool InternalLinkage,
62*9880d681SAndroid Build Coastguard Worker                 bool IsCallReloc, CallLoweringInfo &CLI, SDValue Callee,
63*9880d681SAndroid Build Coastguard Worker                 SDValue Chain) const override;
64*9880d681SAndroid Build Coastguard Worker 
65*9880d681SAndroid Build Coastguard Worker     SDValue lowerLOAD(SDValue Op, SelectionDAG &DAG) const;
66*9880d681SAndroid Build Coastguard Worker     SDValue lowerSTORE(SDValue Op, SelectionDAG &DAG) const;
67*9880d681SAndroid Build Coastguard Worker 
68*9880d681SAndroid Build Coastguard Worker     SDValue lowerMulDiv(SDValue Op, unsigned NewOpc, bool HasLo, bool HasHi,
69*9880d681SAndroid Build Coastguard Worker                         SelectionDAG &DAG) const;
70*9880d681SAndroid Build Coastguard Worker 
71*9880d681SAndroid Build Coastguard Worker     SDValue lowerINTRINSIC_WO_CHAIN(SDValue Op, SelectionDAG &DAG) const;
72*9880d681SAndroid Build Coastguard Worker     SDValue lowerINTRINSIC_W_CHAIN(SDValue Op, SelectionDAG &DAG) const;
73*9880d681SAndroid Build Coastguard Worker     SDValue lowerINTRINSIC_VOID(SDValue Op, SelectionDAG &DAG) const;
74*9880d681SAndroid Build Coastguard Worker     SDValue lowerEXTRACT_VECTOR_ELT(SDValue Op, SelectionDAG &DAG) const;
75*9880d681SAndroid Build Coastguard Worker     SDValue lowerBUILD_VECTOR(SDValue Op, SelectionDAG &DAG) const;
76*9880d681SAndroid Build Coastguard Worker     /// \brief Lower VECTOR_SHUFFLE into one of a number of instructions
77*9880d681SAndroid Build Coastguard Worker     /// depending on the indices in the shuffle.
78*9880d681SAndroid Build Coastguard Worker     SDValue lowerVECTOR_SHUFFLE(SDValue Op, SelectionDAG &DAG) const;
79*9880d681SAndroid Build Coastguard Worker 
80*9880d681SAndroid Build Coastguard Worker     MachineBasicBlock *emitBPOSGE32(MachineInstr &MI,
81*9880d681SAndroid Build Coastguard Worker                                     MachineBasicBlock *BB) const;
82*9880d681SAndroid Build Coastguard Worker     MachineBasicBlock *emitMSACBranchPseudo(MachineInstr &MI,
83*9880d681SAndroid Build Coastguard Worker                                             MachineBasicBlock *BB,
84*9880d681SAndroid Build Coastguard Worker                                             unsigned BranchOp) const;
85*9880d681SAndroid Build Coastguard Worker     /// \brief Emit the COPY_FW pseudo instruction
86*9880d681SAndroid Build Coastguard Worker     MachineBasicBlock *emitCOPY_FW(MachineInstr &MI,
87*9880d681SAndroid Build Coastguard Worker                                    MachineBasicBlock *BB) const;
88*9880d681SAndroid Build Coastguard Worker     /// \brief Emit the COPY_FD pseudo instruction
89*9880d681SAndroid Build Coastguard Worker     MachineBasicBlock *emitCOPY_FD(MachineInstr &MI,
90*9880d681SAndroid Build Coastguard Worker                                    MachineBasicBlock *BB) const;
91*9880d681SAndroid Build Coastguard Worker     /// \brief Emit the INSERT_FW pseudo instruction
92*9880d681SAndroid Build Coastguard Worker     MachineBasicBlock *emitINSERT_FW(MachineInstr &MI,
93*9880d681SAndroid Build Coastguard Worker                                      MachineBasicBlock *BB) const;
94*9880d681SAndroid Build Coastguard Worker     /// \brief Emit the INSERT_FD pseudo instruction
95*9880d681SAndroid Build Coastguard Worker     MachineBasicBlock *emitINSERT_FD(MachineInstr &MI,
96*9880d681SAndroid Build Coastguard Worker                                      MachineBasicBlock *BB) const;
97*9880d681SAndroid Build Coastguard Worker     /// \brief Emit the INSERT_([BHWD]|F[WD])_VIDX pseudo instruction
98*9880d681SAndroid Build Coastguard Worker     MachineBasicBlock *emitINSERT_DF_VIDX(MachineInstr &MI,
99*9880d681SAndroid Build Coastguard Worker                                           MachineBasicBlock *BB,
100*9880d681SAndroid Build Coastguard Worker                                           unsigned EltSizeInBytes,
101*9880d681SAndroid Build Coastguard Worker                                           bool IsFP) const;
102*9880d681SAndroid Build Coastguard Worker     /// \brief Emit the FILL_FW pseudo instruction
103*9880d681SAndroid Build Coastguard Worker     MachineBasicBlock *emitFILL_FW(MachineInstr &MI,
104*9880d681SAndroid Build Coastguard Worker                                    MachineBasicBlock *BB) const;
105*9880d681SAndroid Build Coastguard Worker     /// \brief Emit the FILL_FD pseudo instruction
106*9880d681SAndroid Build Coastguard Worker     MachineBasicBlock *emitFILL_FD(MachineInstr &MI,
107*9880d681SAndroid Build Coastguard Worker                                    MachineBasicBlock *BB) const;
108*9880d681SAndroid Build Coastguard Worker     /// \brief Emit the FEXP2_W_1 pseudo instructions.
109*9880d681SAndroid Build Coastguard Worker     MachineBasicBlock *emitFEXP2_W_1(MachineInstr &MI,
110*9880d681SAndroid Build Coastguard Worker                                      MachineBasicBlock *BB) const;
111*9880d681SAndroid Build Coastguard Worker     /// \brief Emit the FEXP2_D_1 pseudo instructions.
112*9880d681SAndroid Build Coastguard Worker     MachineBasicBlock *emitFEXP2_D_1(MachineInstr &MI,
113*9880d681SAndroid Build Coastguard Worker                                      MachineBasicBlock *BB) const;
114*9880d681SAndroid Build Coastguard Worker   };
115*9880d681SAndroid Build Coastguard Worker }
116*9880d681SAndroid Build Coastguard Worker 
117*9880d681SAndroid Build Coastguard Worker #endif
118