Akira Hatanaka | 96ca182 | 2013-03-13 00:54:29 +0000 | [diff] [blame] | 1 | //===-- 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 Hatanaka | 3a34d14 | 2013-03-30 01:12:05 +0000 | [diff] [blame] | 18 | #include "MipsRegisterInfo.h" |
Akira Hatanaka | 96ca182 | 2013-03-13 00:54:29 +0000 | [diff] [blame] | 19 | |
| 20 | namespace llvm { |
| 21 | class MipsSETargetLowering : public MipsTargetLowering { |
| 22 | public: |
| 23 | explicit MipsSETargetLowering(MipsTargetMachine &TM); |
| 24 | |
Daniel Sanders | 7a289d0 | 2013-09-23 12:02:46 +0000 | [diff] [blame] | 25 | /// \brief Enable MSA support for the given integer type and Register |
| 26 | /// class. |
Daniel Sanders | c65f58a | 2013-09-11 10:15:48 +0000 | [diff] [blame] | 27 | void addMSAIntType(MVT::SimpleValueType Ty, const TargetRegisterClass *RC); |
Daniel Sanders | 7a289d0 | 2013-09-23 12:02:46 +0000 | [diff] [blame] | 28 | /// \brief Enable MSA support for the given floating-point type and |
| 29 | /// Register class. |
Daniel Sanders | c65f58a | 2013-09-11 10:15:48 +0000 | [diff] [blame] | 30 | void addMSAFloatType(MVT::SimpleValueType Ty, |
| 31 | const TargetRegisterClass *RC); |
Jack Carter | babdcc8 | 2013-08-15 12:24:57 +0000 | [diff] [blame] | 32 | |
Akira Hatanaka | 96ca182 | 2013-03-13 00:54:29 +0000 | [diff] [blame] | 33 | virtual bool allowsUnalignedMemoryAccesses(EVT VT, bool *Fast) const; |
| 34 | |
Akira Hatanaka | be8612f | 2013-03-30 01:36:35 +0000 | [diff] [blame] | 35 | virtual SDValue LowerOperation(SDValue Op, SelectionDAG &DAG) const; |
| 36 | |
Akira Hatanaka | 9efcd76 | 2013-03-30 01:42:24 +0000 | [diff] [blame] | 37 | virtual SDValue PerformDAGCombine(SDNode *N, DAGCombinerInfo &DCI) const; |
| 38 | |
Akira Hatanaka | 96ca182 | 2013-03-13 00:54:29 +0000 | [diff] [blame] | 39 | virtual MachineBasicBlock * |
| 40 | EmitInstrWithCustomInserter(MachineInstr *MI, MachineBasicBlock *MBB) const; |
| 41 | |
Akira Hatanaka | 48996b0 | 2013-04-13 00:45:02 +0000 | [diff] [blame] | 42 | virtual bool isShuffleMaskLegal(const SmallVectorImpl<int> &Mask, |
| 43 | EVT VT) const { |
| 44 | return false; |
| 45 | } |
| 46 | |
Akira Hatanaka | 3a34d14 | 2013-03-30 01:12:05 +0000 | [diff] [blame] | 47 | virtual const TargetRegisterClass *getRepRegClassFor(MVT VT) const { |
| 48 | if (VT == MVT::Untyped) |
Akira Hatanaka | 00fcf2e | 2013-08-08 21:54:26 +0000 | [diff] [blame] | 49 | return Subtarget->hasDSP() ? &Mips::ACC64DSPRegClass : |
| 50 | &Mips::ACC64RegClass; |
Akira Hatanaka | 3a34d14 | 2013-03-30 01:12:05 +0000 | [diff] [blame] | 51 | |
| 52 | return TargetLowering::getRepRegClassFor(VT); |
| 53 | } |
| 54 | |
Akira Hatanaka | 96ca182 | 2013-03-13 00:54:29 +0000 | [diff] [blame] | 55 | private: |
| 56 | virtual bool |
| 57 | isEligibleForTailCallOptimization(const MipsCC &MipsCCInfo, |
| 58 | unsigned NextStackOffset, |
| 59 | const MipsFunctionInfo& FI) const; |
| 60 | |
| 61 | virtual void |
| 62 | getOpndList(SmallVectorImpl<SDValue> &Ops, |
| 63 | std::deque< std::pair<unsigned, SDValue> > &RegsToPass, |
| 64 | bool IsPICCall, bool GlobalOrExternal, bool InternalLinkage, |
| 65 | CallLoweringInfo &CLI, SDValue Callee, SDValue Chain) const; |
| 66 | |
Akira Hatanaka | 6379121 | 2013-09-07 00:52:30 +0000 | [diff] [blame] | 67 | SDValue lowerLOAD(SDValue Op, SelectionDAG &DAG) const; |
| 68 | SDValue lowerSTORE(SDValue Op, SelectionDAG &DAG) const; |
| 69 | |
Akira Hatanaka | be8612f | 2013-03-30 01:36:35 +0000 | [diff] [blame] | 70 | SDValue lowerMulDiv(SDValue Op, unsigned NewOpc, bool HasLo, bool HasHi, |
| 71 | SelectionDAG &DAG) const; |
| 72 | |
Akira Hatanaka | a6bbde5 | 2013-04-13 02:13:30 +0000 | [diff] [blame] | 73 | SDValue lowerINTRINSIC_WO_CHAIN(SDValue Op, SelectionDAG &DAG) const; |
| 74 | SDValue lowerINTRINSIC_W_CHAIN(SDValue Op, SelectionDAG &DAG) const; |
Daniel Sanders | e6ed5b7 | 2013-08-28 12:04:29 +0000 | [diff] [blame] | 75 | SDValue lowerINTRINSIC_VOID(SDValue Op, SelectionDAG &DAG) const; |
Daniel Sanders | a4c8f3a | 2013-09-23 14:03:12 +0000 | [diff] [blame] | 76 | SDValue lowerEXTRACT_VECTOR_ELT(SDValue Op, SelectionDAG &DAG) const; |
Daniel Sanders | 7a289d0 | 2013-09-23 12:02:46 +0000 | [diff] [blame] | 77 | SDValue lowerBUILD_VECTOR(SDValue Op, SelectionDAG &DAG) const; |
Daniel Sanders | e508704 | 2013-09-24 14:02:15 +0000 | [diff] [blame] | 78 | /// \brief Lower VECTOR_SHUFFLE into one of a number of instructions |
| 79 | /// depending on the indices in the shuffle. |
| 80 | SDValue lowerVECTOR_SHUFFLE(SDValue Op, SelectionDAG &DAG) const; |
Akira Hatanaka | a6bbde5 | 2013-04-13 02:13:30 +0000 | [diff] [blame] | 81 | |
Akira Hatanaka | 96ca182 | 2013-03-13 00:54:29 +0000 | [diff] [blame] | 82 | MachineBasicBlock *emitBPOSGE32(MachineInstr *MI, |
| 83 | MachineBasicBlock *BB) const; |
Daniel Sanders | ce09d07 | 2013-08-28 12:14:50 +0000 | [diff] [blame] | 84 | MachineBasicBlock *emitMSACBranchPseudo(MachineInstr *MI, |
| 85 | MachineBasicBlock *BB, |
| 86 | unsigned BranchOp) const; |
Daniel Sanders | 39bb8ba | 2013-09-27 12:17:32 +0000 | [diff] [blame] | 87 | /// \brief Emit the COPY_FW pseudo instruction |
| 88 | MachineBasicBlock *emitCOPY_FW(MachineInstr *MI, |
| 89 | MachineBasicBlock *BB) const; |
| 90 | /// \brief Emit the COPY_FD pseudo instruction |
| 91 | MachineBasicBlock *emitCOPY_FD(MachineInstr *MI, |
| 92 | MachineBasicBlock *BB) const; |
Daniel Sanders | a515070 | 2013-09-27 12:31:32 +0000 | [diff] [blame] | 93 | /// \brief Emit the INSERT_FW pseudo instruction |
| 94 | MachineBasicBlock *emitINSERT_FW(MachineInstr *MI, |
| 95 | MachineBasicBlock *BB) const; |
| 96 | /// \brief Emit the INSERT_FD pseudo instruction |
| 97 | MachineBasicBlock *emitINSERT_FD(MachineInstr *MI, |
| 98 | MachineBasicBlock *BB) const; |
Daniel Sanders | 1dfddc7 | 2013-10-15 13:14:41 +0000 | [diff] [blame^] | 99 | /// \brief Emit the FILL_FW pseudo instruction |
| 100 | MachineBasicBlock *emitFILL_FW(MachineInstr *MI, |
| 101 | MachineBasicBlock *BB) const; |
| 102 | /// \brief Emit the FILL_FD pseudo instruction |
| 103 | MachineBasicBlock *emitFILL_FD(MachineInstr *MI, |
| 104 | MachineBasicBlock *BB) const; |
Akira Hatanaka | 96ca182 | 2013-03-13 00:54:29 +0000 | [diff] [blame] | 105 | }; |
| 106 | } |
| 107 | |
| 108 | #endif // MipsSEISELLOWERING_H |