blob: 00d86834be0a38f2dc667e9613a94f743db9223c [file] [log] [blame]
Akira Hatanaka96ca1822013-03-13 00:54:29 +00001//===-- MipsSEISelLowering.h - MipsSE DAG Lowering Interface ----*- C++ -*-===//
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 MipsTargetLowering specialized for mips32/64.
11//
12//===----------------------------------------------------------------------===//
13
Eric Christopherf2042082014-07-03 00:44:31 +000014#ifndef MIPSSEISELLOWERING_H
15#define MIPSSEISELLOWERING_H
Akira Hatanaka96ca1822013-03-13 00:54:29 +000016
17#include "MipsISelLowering.h"
Akira Hatanaka3a34d142013-03-30 01:12:05 +000018#include "MipsRegisterInfo.h"
Akira Hatanaka96ca1822013-03-13 00:54:29 +000019
20namespace llvm {
21 class MipsSETargetLowering : public MipsTargetLowering {
22 public:
Eric Christopher8924d272014-07-18 23:25:04 +000023 explicit MipsSETargetLowering(MipsTargetMachine &TM,
24 const MipsSubtarget &STI);
Akira Hatanaka96ca1822013-03-13 00:54:29 +000025
Daniel Sanders7a289d02013-09-23 12:02:46 +000026 /// \brief Enable MSA support for the given integer type and Register
27 /// class.
Daniel Sandersc65f58a2013-09-11 10:15:48 +000028 void addMSAIntType(MVT::SimpleValueType Ty, const TargetRegisterClass *RC);
Daniel Sanders7a289d02013-09-23 12:02:46 +000029 /// \brief Enable MSA support for the given floating-point type and
30 /// Register class.
Daniel Sandersc65f58a2013-09-11 10:15:48 +000031 void addMSAFloatType(MVT::SimpleValueType Ty,
32 const TargetRegisterClass *RC);
Jack Carterbabdcc82013-08-15 12:24:57 +000033
Craig Toppere73658d2014-04-28 04:05:08 +000034 bool allowsUnalignedMemoryAccesses(EVT VT, unsigned AS = 0,
35 bool *Fast = nullptr) const override;
Akira Hatanaka96ca1822013-03-13 00:54:29 +000036
Craig Topper56c590a2014-04-29 07:58:02 +000037 SDValue LowerOperation(SDValue Op, SelectionDAG &DAG) const override;
Akira Hatanakabe8612f2013-03-30 01:36:35 +000038
Craig Topper56c590a2014-04-29 07:58:02 +000039 SDValue PerformDAGCombine(SDNode *N, DAGCombinerInfo &DCI) const override;
Akira Hatanaka9efcd762013-03-30 01:42:24 +000040
Craig Topper56c590a2014-04-29 07:58:02 +000041 MachineBasicBlock *
42 EmitInstrWithCustomInserter(MachineInstr *MI,
43 MachineBasicBlock *MBB) const override;
Akira Hatanaka96ca1822013-03-13 00:54:29 +000044
Craig Topper56c590a2014-04-29 07:58:02 +000045 bool isShuffleMaskLegal(const SmallVectorImpl<int> &Mask,
46 EVT VT) const override {
Akira Hatanaka48996b02013-04-13 00:45:02 +000047 return false;
48 }
49
Eric Christopherbf33a3c2014-07-02 23:18:40 +000050 const TargetRegisterClass *getRepRegClassFor(MVT VT) const override;
Akira Hatanaka3a34d142013-03-30 01:12:05 +000051
Akira Hatanaka96ca1822013-03-13 00:54:29 +000052 private:
Craig Topper56c590a2014-04-29 07:58:02 +000053 bool isEligibleForTailCallOptimization(const MipsCC &MipsCCInfo,
54 unsigned NextStackOffset,
55 const MipsFunctionInfo& FI) const override;
Akira Hatanaka96ca1822013-03-13 00:54:29 +000056
Craig Topper56c590a2014-04-29 07:58:02 +000057 void
Akira Hatanaka96ca1822013-03-13 00:54:29 +000058 getOpndList(SmallVectorImpl<SDValue> &Ops,
59 std::deque< std::pair<unsigned, SDValue> > &RegsToPass,
60 bool IsPICCall, bool GlobalOrExternal, bool InternalLinkage,
Craig Topper56c590a2014-04-29 07:58:02 +000061 CallLoweringInfo &CLI, SDValue Callee,
62 SDValue Chain) const override;
Akira Hatanaka96ca1822013-03-13 00:54:29 +000063
Akira Hatanaka63791212013-09-07 00:52:30 +000064 SDValue lowerLOAD(SDValue Op, SelectionDAG &DAG) const;
65 SDValue lowerSTORE(SDValue Op, SelectionDAG &DAG) const;
66
Akira Hatanakabe8612f2013-03-30 01:36:35 +000067 SDValue lowerMulDiv(SDValue Op, unsigned NewOpc, bool HasLo, bool HasHi,
68 SelectionDAG &DAG) const;
69
Akira Hatanakaa6bbde52013-04-13 02:13:30 +000070 SDValue lowerINTRINSIC_WO_CHAIN(SDValue Op, SelectionDAG &DAG) const;
71 SDValue lowerINTRINSIC_W_CHAIN(SDValue Op, SelectionDAG &DAG) const;
Daniel Sanderse6ed5b72013-08-28 12:04:29 +000072 SDValue lowerINTRINSIC_VOID(SDValue Op, SelectionDAG &DAG) const;
Daniel Sandersa4c8f3a2013-09-23 14:03:12 +000073 SDValue lowerEXTRACT_VECTOR_ELT(SDValue Op, SelectionDAG &DAG) const;
Daniel Sanders7a289d02013-09-23 12:02:46 +000074 SDValue lowerBUILD_VECTOR(SDValue Op, SelectionDAG &DAG) const;
Daniel Sanderse5087042013-09-24 14:02:15 +000075 /// \brief Lower VECTOR_SHUFFLE into one of a number of instructions
76 /// depending on the indices in the shuffle.
77 SDValue lowerVECTOR_SHUFFLE(SDValue Op, SelectionDAG &DAG) const;
Akira Hatanakaa6bbde52013-04-13 02:13:30 +000078
Akira Hatanaka96ca1822013-03-13 00:54:29 +000079 MachineBasicBlock *emitBPOSGE32(MachineInstr *MI,
80 MachineBasicBlock *BB) const;
Daniel Sandersce09d072013-08-28 12:14:50 +000081 MachineBasicBlock *emitMSACBranchPseudo(MachineInstr *MI,
82 MachineBasicBlock *BB,
83 unsigned BranchOp) const;
Daniel Sanders39bb8ba2013-09-27 12:17:32 +000084 /// \brief Emit the COPY_FW pseudo instruction
85 MachineBasicBlock *emitCOPY_FW(MachineInstr *MI,
86 MachineBasicBlock *BB) const;
87 /// \brief Emit the COPY_FD pseudo instruction
88 MachineBasicBlock *emitCOPY_FD(MachineInstr *MI,
89 MachineBasicBlock *BB) const;
Daniel Sandersa5150702013-09-27 12:31:32 +000090 /// \brief Emit the INSERT_FW pseudo instruction
91 MachineBasicBlock *emitINSERT_FW(MachineInstr *MI,
92 MachineBasicBlock *BB) const;
93 /// \brief Emit the INSERT_FD pseudo instruction
94 MachineBasicBlock *emitINSERT_FD(MachineInstr *MI,
95 MachineBasicBlock *BB) const;
Daniel Sanderse296a0f2014-04-30 12:09:32 +000096 /// \brief Emit the INSERT_([BHWD]|F[WD])_VIDX pseudo instruction
97 MachineBasicBlock *emitINSERT_DF_VIDX(MachineInstr *MI,
98 MachineBasicBlock *BB,
99 unsigned EltSizeInBytes,
100 bool IsFP) const;
Daniel Sanders1dfddc72013-10-15 13:14:41 +0000101 /// \brief Emit the FILL_FW pseudo instruction
102 MachineBasicBlock *emitFILL_FW(MachineInstr *MI,
103 MachineBasicBlock *BB) const;
104 /// \brief Emit the FILL_FD pseudo instruction
105 MachineBasicBlock *emitFILL_FD(MachineInstr *MI,
106 MachineBasicBlock *BB) const;
Daniel Sandersa9521602013-10-23 10:36:52 +0000107 /// \brief Emit the FEXP2_W_1 pseudo instructions.
108 MachineBasicBlock *emitFEXP2_W_1(MachineInstr *MI,
109 MachineBasicBlock *BB) const;
110 /// \brief Emit the FEXP2_D_1 pseudo instructions.
111 MachineBasicBlock *emitFEXP2_D_1(MachineInstr *MI,
112 MachineBasicBlock *BB) const;
Akira Hatanaka96ca1822013-03-13 00:54:29 +0000113 };
114}
115
116#endif // MipsSEISELLOWERING_H