blob: 54154662f2614551e8e8743e5c9c3ab13ae505bc [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
Benjamin Kramera7c40ef2014-08-13 16:26:38 +000014#ifndef LLVM_LIB_TARGET_MIPS_MIPSSEISELLOWERING_H
15#define LLVM_LIB_TARGET_MIPS_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 Christopherb1526602014-09-19 23:30:42 +000023 explicit MipsSETargetLowering(const MipsTargetMachine &TM,
Eric Christopher8924d272014-07-18 23:25:04 +000024 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
Matt Arsenault6f2a5262014-07-27 17:46:40 +000034 bool allowsMisalignedMemoryAccesses(EVT VT, unsigned AS = 0,
35 unsigned Align = 1,
36 bool *Fast = nullptr) const override;
Akira Hatanaka96ca1822013-03-13 00:54:29 +000037
Craig Topper56c590a2014-04-29 07:58:02 +000038 SDValue LowerOperation(SDValue Op, SelectionDAG &DAG) const override;
Akira Hatanakabe8612f2013-03-30 01:36:35 +000039
Craig Topper56c590a2014-04-29 07:58:02 +000040 SDValue PerformDAGCombine(SDNode *N, DAGCombinerInfo &DCI) const override;
Akira Hatanaka9efcd762013-03-30 01:42:24 +000041
Craig Topper56c590a2014-04-29 07:58:02 +000042 MachineBasicBlock *
Duncan P. N. Exon Smithe4f5e4f2016-06-30 22:52:52 +000043 EmitInstrWithCustomInserter(MachineInstr &MI,
Craig Topper56c590a2014-04-29 07:58:02 +000044 MachineBasicBlock *MBB) const override;
Akira Hatanaka96ca1822013-03-13 00:54:29 +000045
Craig Topper56c590a2014-04-29 07:58:02 +000046 bool isShuffleMaskLegal(const SmallVectorImpl<int> &Mask,
47 EVT VT) const override {
Akira Hatanaka48996b02013-04-13 00:45:02 +000048 return false;
49 }
50
Eric Christopherbf33a3c2014-07-02 23:18:40 +000051 const TargetRegisterClass *getRepRegClassFor(MVT VT) const override;
Akira Hatanaka3a34d142013-03-30 01:12:05 +000052
Akira Hatanaka96ca1822013-03-13 00:54:29 +000053 private:
Daniel Sanders23e98772014-11-02 16:09:29 +000054 bool isEligibleForTailCallOptimization(
55 const CCState &CCInfo, unsigned NextStackOffset,
56 const MipsFunctionInfo &FI) const override;
Akira Hatanaka96ca1822013-03-13 00:54:29 +000057
Craig Topper56c590a2014-04-29 07:58:02 +000058 void
Akira Hatanaka96ca1822013-03-13 00:54:29 +000059 getOpndList(SmallVectorImpl<SDValue> &Ops,
60 std::deque< std::pair<unsigned, SDValue> > &RegsToPass,
61 bool IsPICCall, bool GlobalOrExternal, bool InternalLinkage,
Sasa Stankovic7072a792014-10-01 08:22:21 +000062 bool IsCallReloc, CallLoweringInfo &CLI, SDValue Callee,
Craig Topper56c590a2014-04-29 07:58:02 +000063 SDValue Chain) const override;
Akira Hatanaka96ca1822013-03-13 00:54:29 +000064
Akira Hatanaka63791212013-09-07 00:52:30 +000065 SDValue lowerLOAD(SDValue Op, SelectionDAG &DAG) const;
66 SDValue lowerSTORE(SDValue Op, SelectionDAG &DAG) const;
67
Akira Hatanakabe8612f2013-03-30 01:36:35 +000068 SDValue lowerMulDiv(SDValue Op, unsigned NewOpc, bool HasLo, bool HasHi,
69 SelectionDAG &DAG) const;
70
Akira Hatanakaa6bbde52013-04-13 02:13:30 +000071 SDValue lowerINTRINSIC_WO_CHAIN(SDValue Op, SelectionDAG &DAG) const;
72 SDValue lowerINTRINSIC_W_CHAIN(SDValue Op, SelectionDAG &DAG) const;
Daniel Sanderse6ed5b72013-08-28 12:04:29 +000073 SDValue lowerINTRINSIC_VOID(SDValue Op, SelectionDAG &DAG) const;
Daniel Sandersa4c8f3a2013-09-23 14:03:12 +000074 SDValue lowerEXTRACT_VECTOR_ELT(SDValue Op, SelectionDAG &DAG) const;
Daniel Sanders7a289d02013-09-23 12:02:46 +000075 SDValue lowerBUILD_VECTOR(SDValue Op, SelectionDAG &DAG) const;
Daniel Sanderse5087042013-09-24 14:02:15 +000076 /// \brief Lower VECTOR_SHUFFLE into one of a number of instructions
77 /// depending on the indices in the shuffle.
78 SDValue lowerVECTOR_SHUFFLE(SDValue Op, SelectionDAG &DAG) const;
Akira Hatanakaa6bbde52013-04-13 02:13:30 +000079
Duncan P. N. Exon Smithe4f5e4f2016-06-30 22:52:52 +000080 MachineBasicBlock *emitBPOSGE32(MachineInstr &MI,
Akira Hatanaka96ca1822013-03-13 00:54:29 +000081 MachineBasicBlock *BB) const;
Duncan P. N. Exon Smithe4f5e4f2016-06-30 22:52:52 +000082 MachineBasicBlock *emitMSACBranchPseudo(MachineInstr &MI,
Daniel Sandersce09d072013-08-28 12:14:50 +000083 MachineBasicBlock *BB,
84 unsigned BranchOp) const;
Daniel Sanders39bb8ba2013-09-27 12:17:32 +000085 /// \brief Emit the COPY_FW pseudo instruction
Duncan P. N. Exon Smithe4f5e4f2016-06-30 22:52:52 +000086 MachineBasicBlock *emitCOPY_FW(MachineInstr &MI,
Daniel Sanders39bb8ba2013-09-27 12:17:32 +000087 MachineBasicBlock *BB) const;
88 /// \brief Emit the COPY_FD pseudo instruction
Duncan P. N. Exon Smithe4f5e4f2016-06-30 22:52:52 +000089 MachineBasicBlock *emitCOPY_FD(MachineInstr &MI,
Daniel Sanders39bb8ba2013-09-27 12:17:32 +000090 MachineBasicBlock *BB) const;
Daniel Sandersa5150702013-09-27 12:31:32 +000091 /// \brief Emit the INSERT_FW pseudo instruction
Duncan P. N. Exon Smithe4f5e4f2016-06-30 22:52:52 +000092 MachineBasicBlock *emitINSERT_FW(MachineInstr &MI,
Daniel Sandersa5150702013-09-27 12:31:32 +000093 MachineBasicBlock *BB) const;
94 /// \brief Emit the INSERT_FD pseudo instruction
Duncan P. N. Exon Smithe4f5e4f2016-06-30 22:52:52 +000095 MachineBasicBlock *emitINSERT_FD(MachineInstr &MI,
Daniel Sandersa5150702013-09-27 12:31:32 +000096 MachineBasicBlock *BB) const;
Daniel Sanderse296a0f2014-04-30 12:09:32 +000097 /// \brief Emit the INSERT_([BHWD]|F[WD])_VIDX pseudo instruction
Duncan P. N. Exon Smithe4f5e4f2016-06-30 22:52:52 +000098 MachineBasicBlock *emitINSERT_DF_VIDX(MachineInstr &MI,
Daniel Sanderse296a0f2014-04-30 12:09:32 +000099 MachineBasicBlock *BB,
100 unsigned EltSizeInBytes,
101 bool IsFP) const;
Daniel Sanders1dfddc72013-10-15 13:14:41 +0000102 /// \brief Emit the FILL_FW pseudo instruction
Duncan P. N. Exon Smithe4f5e4f2016-06-30 22:52:52 +0000103 MachineBasicBlock *emitFILL_FW(MachineInstr &MI,
Daniel Sanders1dfddc72013-10-15 13:14:41 +0000104 MachineBasicBlock *BB) const;
105 /// \brief Emit the FILL_FD pseudo instruction
Duncan P. N. Exon Smithe4f5e4f2016-06-30 22:52:52 +0000106 MachineBasicBlock *emitFILL_FD(MachineInstr &MI,
Daniel Sanders1dfddc72013-10-15 13:14:41 +0000107 MachineBasicBlock *BB) const;
Daniel Sandersa9521602013-10-23 10:36:52 +0000108 /// \brief Emit the FEXP2_W_1 pseudo instructions.
Duncan P. N. Exon Smithe4f5e4f2016-06-30 22:52:52 +0000109 MachineBasicBlock *emitFEXP2_W_1(MachineInstr &MI,
Daniel Sandersa9521602013-10-23 10:36:52 +0000110 MachineBasicBlock *BB) const;
111 /// \brief Emit the FEXP2_D_1 pseudo instructions.
Duncan P. N. Exon Smithe4f5e4f2016-06-30 22:52:52 +0000112 MachineBasicBlock *emitFEXP2_D_1(MachineInstr &MI,
Daniel Sandersa9521602013-10-23 10:36:52 +0000113 MachineBasicBlock *BB) const;
Akira Hatanaka96ca1822013-03-13 00:54:29 +0000114 };
Alexander Kornienkof00654e2015-06-23 09:49:53 +0000115}
Akira Hatanaka96ca1822013-03-13 00:54:29 +0000116
Benjamin Kramera7c40ef2014-08-13 16:26:38 +0000117#endif