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