blob: 435c15c750392dc38b2de52c99111f850f01f9c9 [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
14#ifndef MipsSEISELLOWERING_H
15#define MipsSEISELLOWERING_H
16
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:
23 explicit MipsSETargetLowering(MipsTargetMachine &TM);
24
Daniel Sanders7a289d02013-09-23 12:02:46 +000025 /// \brief Enable MSA support for the given integer type and Register
26 /// class.
Daniel Sandersc65f58a2013-09-11 10:15:48 +000027 void addMSAIntType(MVT::SimpleValueType Ty, const TargetRegisterClass *RC);
Daniel Sanders7a289d02013-09-23 12:02:46 +000028 /// \brief Enable MSA support for the given floating-point type and
29 /// Register class.
Daniel Sandersc65f58a2013-09-11 10:15:48 +000030 void addMSAFloatType(MVT::SimpleValueType Ty,
31 const TargetRegisterClass *RC);
Jack Carterbabdcc82013-08-15 12:24:57 +000032
Craig Toppere73658d2014-04-28 04:05:08 +000033 bool allowsUnalignedMemoryAccesses(EVT VT, unsigned AS = 0,
34 bool *Fast = nullptr) const override;
Akira Hatanaka96ca1822013-03-13 00:54:29 +000035
Akira Hatanakabe8612f2013-03-30 01:36:35 +000036 virtual SDValue LowerOperation(SDValue Op, SelectionDAG &DAG) const;
37
Akira Hatanaka9efcd762013-03-30 01:42:24 +000038 virtual SDValue PerformDAGCombine(SDNode *N, DAGCombinerInfo &DCI) const;
39
Akira Hatanaka96ca1822013-03-13 00:54:29 +000040 virtual MachineBasicBlock *
41 EmitInstrWithCustomInserter(MachineInstr *MI, MachineBasicBlock *MBB) const;
42
Akira Hatanaka48996b02013-04-13 00:45:02 +000043 virtual bool isShuffleMaskLegal(const SmallVectorImpl<int> &Mask,
44 EVT VT) const {
45 return false;
46 }
47
Akira Hatanaka3a34d142013-03-30 01:12:05 +000048 virtual const TargetRegisterClass *getRepRegClassFor(MVT VT) const {
49 if (VT == MVT::Untyped)
Akira Hatanaka00fcf2e2013-08-08 21:54:26 +000050 return Subtarget->hasDSP() ? &Mips::ACC64DSPRegClass :
51 &Mips::ACC64RegClass;
Akira Hatanaka3a34d142013-03-30 01:12:05 +000052
53 return TargetLowering::getRepRegClassFor(VT);
54 }
55
Akira Hatanaka96ca1822013-03-13 00:54:29 +000056 private:
57 virtual bool
58 isEligibleForTailCallOptimization(const MipsCC &MipsCCInfo,
59 unsigned NextStackOffset,
60 const MipsFunctionInfo& FI) const;
61
62 virtual void
63 getOpndList(SmallVectorImpl<SDValue> &Ops,
64 std::deque< std::pair<unsigned, SDValue> > &RegsToPass,
65 bool IsPICCall, bool GlobalOrExternal, bool InternalLinkage,
66 CallLoweringInfo &CLI, SDValue Callee, SDValue Chain) const;
67
Akira Hatanaka63791212013-09-07 00:52:30 +000068 SDValue lowerLOAD(SDValue Op, SelectionDAG &DAG) const;
69 SDValue lowerSTORE(SDValue Op, SelectionDAG &DAG) const;
70
Akira Hatanakabe8612f2013-03-30 01:36:35 +000071 SDValue lowerMulDiv(SDValue Op, unsigned NewOpc, bool HasLo, bool HasHi,
72 SelectionDAG &DAG) const;
73
Akira Hatanakaa6bbde52013-04-13 02:13:30 +000074 SDValue lowerINTRINSIC_WO_CHAIN(SDValue Op, SelectionDAG &DAG) const;
75 SDValue lowerINTRINSIC_W_CHAIN(SDValue Op, SelectionDAG &DAG) const;
Daniel Sanderse6ed5b72013-08-28 12:04:29 +000076 SDValue lowerINTRINSIC_VOID(SDValue Op, SelectionDAG &DAG) const;
Daniel Sandersa4c8f3a2013-09-23 14:03:12 +000077 SDValue lowerEXTRACT_VECTOR_ELT(SDValue Op, SelectionDAG &DAG) const;
Daniel Sanders7a289d02013-09-23 12:02:46 +000078 SDValue lowerBUILD_VECTOR(SDValue Op, SelectionDAG &DAG) const;
Daniel Sanderse5087042013-09-24 14:02:15 +000079 /// \brief Lower VECTOR_SHUFFLE into one of a number of instructions
80 /// depending on the indices in the shuffle.
81 SDValue lowerVECTOR_SHUFFLE(SDValue Op, SelectionDAG &DAG) const;
Akira Hatanakaa6bbde52013-04-13 02:13:30 +000082
Akira Hatanaka96ca1822013-03-13 00:54:29 +000083 MachineBasicBlock *emitBPOSGE32(MachineInstr *MI,
84 MachineBasicBlock *BB) const;
Daniel Sandersce09d072013-08-28 12:14:50 +000085 MachineBasicBlock *emitMSACBranchPseudo(MachineInstr *MI,
86 MachineBasicBlock *BB,
87 unsigned BranchOp) const;
Daniel Sanders39bb8ba2013-09-27 12:17:32 +000088 /// \brief Emit the COPY_FW pseudo instruction
89 MachineBasicBlock *emitCOPY_FW(MachineInstr *MI,
90 MachineBasicBlock *BB) const;
91 /// \brief Emit the COPY_FD pseudo instruction
92 MachineBasicBlock *emitCOPY_FD(MachineInstr *MI,
93 MachineBasicBlock *BB) const;
Daniel Sandersa5150702013-09-27 12:31:32 +000094 /// \brief Emit the INSERT_FW pseudo instruction
95 MachineBasicBlock *emitINSERT_FW(MachineInstr *MI,
96 MachineBasicBlock *BB) const;
97 /// \brief Emit the INSERT_FD pseudo instruction
98 MachineBasicBlock *emitINSERT_FD(MachineInstr *MI,
99 MachineBasicBlock *BB) const;
Daniel Sanders1dfddc72013-10-15 13:14:41 +0000100 /// \brief Emit the FILL_FW pseudo instruction
101 MachineBasicBlock *emitFILL_FW(MachineInstr *MI,
102 MachineBasicBlock *BB) const;
103 /// \brief Emit the FILL_FD pseudo instruction
104 MachineBasicBlock *emitFILL_FD(MachineInstr *MI,
105 MachineBasicBlock *BB) const;
Daniel Sandersa9521602013-10-23 10:36:52 +0000106 /// \brief Emit the FEXP2_W_1 pseudo instructions.
107 MachineBasicBlock *emitFEXP2_W_1(MachineInstr *MI,
108 MachineBasicBlock *BB) const;
109 /// \brief Emit the FEXP2_D_1 pseudo instructions.
110 MachineBasicBlock *emitFEXP2_D_1(MachineInstr *MI,
111 MachineBasicBlock *BB) const;
Akira Hatanaka96ca1822013-03-13 00:54:29 +0000112 };
113}
114
115#endif // MipsSEISELLOWERING_H