10b57cec5SDimitry Andric //===- MipsSEISelLowering.h - MipsSE DAG Lowering Interface -----*- C++ -*-===// 20b57cec5SDimitry Andric // 30b57cec5SDimitry Andric // Part of the LLVM Project, under the Apache License v2.0 with LLVM Exceptions. 40b57cec5SDimitry Andric // See https://llvm.org/LICENSE.txt for license information. 50b57cec5SDimitry Andric // SPDX-License-Identifier: Apache-2.0 WITH LLVM-exception 60b57cec5SDimitry Andric // 70b57cec5SDimitry Andric //===----------------------------------------------------------------------===// 80b57cec5SDimitry Andric // 90b57cec5SDimitry Andric // Subclass of MipsTargetLowering specialized for mips32/64. 100b57cec5SDimitry Andric // 110b57cec5SDimitry Andric //===----------------------------------------------------------------------===// 120b57cec5SDimitry Andric 130b57cec5SDimitry Andric #ifndef LLVM_LIB_TARGET_MIPS_MIPSSEISELLOWERING_H 140b57cec5SDimitry Andric #define LLVM_LIB_TARGET_MIPS_MIPSSEISELLOWERING_H 150b57cec5SDimitry Andric 160b57cec5SDimitry Andric #include "MipsISelLowering.h" 170b57cec5SDimitry Andric #include "llvm/CodeGen/SelectionDAGNodes.h" 18*0fca6ea1SDimitry Andric #include "llvm/CodeGenTypes/MachineValueType.h" 190b57cec5SDimitry Andric 200b57cec5SDimitry Andric namespace llvm { 210b57cec5SDimitry Andric 220b57cec5SDimitry Andric class MachineBasicBlock; 230b57cec5SDimitry Andric class MachineInstr; 240b57cec5SDimitry Andric class MipsSubtarget; 250b57cec5SDimitry Andric class MipsTargetMachine; 260b57cec5SDimitry Andric class SelectionDAG; 270b57cec5SDimitry Andric class TargetRegisterClass; 280b57cec5SDimitry Andric 290b57cec5SDimitry Andric class MipsSETargetLowering : public MipsTargetLowering { 300b57cec5SDimitry Andric public: 310b57cec5SDimitry Andric explicit MipsSETargetLowering(const MipsTargetMachine &TM, 320b57cec5SDimitry Andric const MipsSubtarget &STI); 330b57cec5SDimitry Andric 340b57cec5SDimitry Andric /// Enable MSA support for the given integer type and Register 350b57cec5SDimitry Andric /// class. 360b57cec5SDimitry Andric void addMSAIntType(MVT::SimpleValueType Ty, const TargetRegisterClass *RC); 370b57cec5SDimitry Andric 380b57cec5SDimitry Andric /// Enable MSA support for the given floating-point type and 390b57cec5SDimitry Andric /// Register class. 400b57cec5SDimitry Andric void addMSAFloatType(MVT::SimpleValueType Ty, 410b57cec5SDimitry Andric const TargetRegisterClass *RC); 420b57cec5SDimitry Andric 430b57cec5SDimitry Andric bool allowsMisalignedMemoryAccesses( 44fe6060f1SDimitry Andric EVT VT, unsigned AS = 0, Align Alignment = Align(1), 450b57cec5SDimitry Andric MachineMemOperand::Flags Flags = MachineMemOperand::MONone, 46bdd1243dSDimitry Andric unsigned *Fast = nullptr) const override; 470b57cec5SDimitry Andric 480b57cec5SDimitry Andric SDValue LowerOperation(SDValue Op, SelectionDAG &DAG) const override; 490b57cec5SDimitry Andric 500b57cec5SDimitry Andric SDValue PerformDAGCombine(SDNode *N, DAGCombinerInfo &DCI) const override; 510b57cec5SDimitry Andric 520b57cec5SDimitry Andric MachineBasicBlock * 530b57cec5SDimitry Andric EmitInstrWithCustomInserter(MachineInstr &MI, 540b57cec5SDimitry Andric MachineBasicBlock *MBB) const override; 550b57cec5SDimitry Andric 560b57cec5SDimitry Andric bool isShuffleMaskLegal(ArrayRef<int> Mask, EVT VT) const override { 570b57cec5SDimitry Andric return false; 580b57cec5SDimitry Andric } 590b57cec5SDimitry Andric 600b57cec5SDimitry Andric const TargetRegisterClass *getRepRegClassFor(MVT VT) const override; 610b57cec5SDimitry Andric 620b57cec5SDimitry Andric private: 630b57cec5SDimitry Andric bool isEligibleForTailCallOptimization( 640b57cec5SDimitry Andric const CCState &CCInfo, unsigned NextStackOffset, 650b57cec5SDimitry Andric const MipsFunctionInfo &FI) const override; 660b57cec5SDimitry Andric 670b57cec5SDimitry Andric void 680b57cec5SDimitry Andric getOpndList(SmallVectorImpl<SDValue> &Ops, 690b57cec5SDimitry Andric std::deque<std::pair<unsigned, SDValue>> &RegsToPass, 700b57cec5SDimitry Andric bool IsPICCall, bool GlobalOrExternal, bool InternalLinkage, 710b57cec5SDimitry Andric bool IsCallReloc, CallLoweringInfo &CLI, SDValue Callee, 720b57cec5SDimitry Andric SDValue Chain) const override; 730b57cec5SDimitry Andric 740b57cec5SDimitry Andric SDValue lowerLOAD(SDValue Op, SelectionDAG &DAG) const; 750b57cec5SDimitry Andric SDValue lowerSTORE(SDValue Op, SelectionDAG &DAG) const; 760b57cec5SDimitry Andric SDValue lowerBITCAST(SDValue Op, SelectionDAG &DAG) const; 770b57cec5SDimitry Andric 780b57cec5SDimitry Andric SDValue lowerMulDiv(SDValue Op, unsigned NewOpc, bool HasLo, bool HasHi, 790b57cec5SDimitry Andric SelectionDAG &DAG) const; 800b57cec5SDimitry Andric 810b57cec5SDimitry Andric SDValue lowerINTRINSIC_WO_CHAIN(SDValue Op, SelectionDAG &DAG) const; 820b57cec5SDimitry Andric SDValue lowerINTRINSIC_W_CHAIN(SDValue Op, SelectionDAG &DAG) const; 830b57cec5SDimitry Andric SDValue lowerINTRINSIC_VOID(SDValue Op, SelectionDAG &DAG) const; 840b57cec5SDimitry Andric SDValue lowerEXTRACT_VECTOR_ELT(SDValue Op, SelectionDAG &DAG) const; 850b57cec5SDimitry Andric SDValue lowerBUILD_VECTOR(SDValue Op, SelectionDAG &DAG) const; 860b57cec5SDimitry Andric /// Lower VECTOR_SHUFFLE into one of a number of instructions 870b57cec5SDimitry Andric /// depending on the indices in the shuffle. 880b57cec5SDimitry Andric SDValue lowerVECTOR_SHUFFLE(SDValue Op, SelectionDAG &DAG) const; 890b57cec5SDimitry Andric SDValue lowerSELECT(SDValue Op, SelectionDAG &DAG) const; 900b57cec5SDimitry Andric 910b57cec5SDimitry Andric MachineBasicBlock *emitBPOSGE32(MachineInstr &MI, 920b57cec5SDimitry Andric MachineBasicBlock *BB) const; 930b57cec5SDimitry Andric MachineBasicBlock *emitMSACBranchPseudo(MachineInstr &MI, 940b57cec5SDimitry Andric MachineBasicBlock *BB, 950b57cec5SDimitry Andric unsigned BranchOp) const; 960b57cec5SDimitry Andric /// Emit the COPY_FW pseudo instruction 970b57cec5SDimitry Andric MachineBasicBlock *emitCOPY_FW(MachineInstr &MI, 980b57cec5SDimitry Andric MachineBasicBlock *BB) const; 990b57cec5SDimitry Andric /// Emit the COPY_FD pseudo instruction 1000b57cec5SDimitry Andric MachineBasicBlock *emitCOPY_FD(MachineInstr &MI, 1010b57cec5SDimitry Andric MachineBasicBlock *BB) const; 1020b57cec5SDimitry Andric /// Emit the INSERT_FW pseudo instruction 1030b57cec5SDimitry Andric MachineBasicBlock *emitINSERT_FW(MachineInstr &MI, 1040b57cec5SDimitry Andric MachineBasicBlock *BB) const; 1050b57cec5SDimitry Andric /// Emit the INSERT_FD pseudo instruction 1060b57cec5SDimitry Andric MachineBasicBlock *emitINSERT_FD(MachineInstr &MI, 1070b57cec5SDimitry Andric MachineBasicBlock *BB) const; 1080b57cec5SDimitry Andric /// Emit the INSERT_([BHWD]|F[WD])_VIDX pseudo instruction 1090b57cec5SDimitry Andric MachineBasicBlock *emitINSERT_DF_VIDX(MachineInstr &MI, 1100b57cec5SDimitry Andric MachineBasicBlock *BB, 1110b57cec5SDimitry Andric unsigned EltSizeInBytes, 1120b57cec5SDimitry Andric bool IsFP) const; 1130b57cec5SDimitry Andric /// Emit the FILL_FW pseudo instruction 1140b57cec5SDimitry Andric MachineBasicBlock *emitFILL_FW(MachineInstr &MI, 1150b57cec5SDimitry Andric MachineBasicBlock *BB) const; 1160b57cec5SDimitry Andric /// Emit the FILL_FD pseudo instruction 1170b57cec5SDimitry Andric MachineBasicBlock *emitFILL_FD(MachineInstr &MI, 1180b57cec5SDimitry Andric MachineBasicBlock *BB) const; 1190b57cec5SDimitry Andric /// Emit the FEXP2_W_1 pseudo instructions. 1200b57cec5SDimitry Andric MachineBasicBlock *emitFEXP2_W_1(MachineInstr &MI, 1210b57cec5SDimitry Andric MachineBasicBlock *BB) const; 1220b57cec5SDimitry Andric /// Emit the FEXP2_D_1 pseudo instructions. 1230b57cec5SDimitry Andric MachineBasicBlock *emitFEXP2_D_1(MachineInstr &MI, 1240b57cec5SDimitry Andric MachineBasicBlock *BB) const; 1250b57cec5SDimitry Andric /// Emit the FILL_FW pseudo instruction 1260b57cec5SDimitry Andric MachineBasicBlock *emitLD_F16_PSEUDO(MachineInstr &MI, 1270b57cec5SDimitry Andric MachineBasicBlock *BB) const; 1280b57cec5SDimitry Andric /// Emit the FILL_FD pseudo instruction 1290b57cec5SDimitry Andric MachineBasicBlock *emitST_F16_PSEUDO(MachineInstr &MI, 1300b57cec5SDimitry Andric MachineBasicBlock *BB) const; 1310b57cec5SDimitry Andric /// Emit the FEXP2_W_1 pseudo instructions. 1320b57cec5SDimitry Andric MachineBasicBlock *emitFPEXTEND_PSEUDO(MachineInstr &MI, 1330b57cec5SDimitry Andric MachineBasicBlock *BB, 1340b57cec5SDimitry Andric bool IsFGR64) const; 1350b57cec5SDimitry Andric /// Emit the FEXP2_D_1 pseudo instructions. 1360b57cec5SDimitry Andric MachineBasicBlock *emitFPROUND_PSEUDO(MachineInstr &MI, 1370b57cec5SDimitry Andric MachineBasicBlock *BBi, 1380b57cec5SDimitry Andric bool IsFGR64) const; 1390b57cec5SDimitry Andric }; 1400b57cec5SDimitry Andric 1410b57cec5SDimitry Andric } // end namespace llvm 1420b57cec5SDimitry Andric 1430b57cec5SDimitry Andric #endif // LLVM_LIB_TARGET_MIPS_MIPSSEISELLOWERING_H 144