1*9880d681SAndroid Build Coastguard Worker //===-- MipsSEInstrInfo.h - Mips32/64 Instruction Information ---*- C++ -*-===// 2*9880d681SAndroid Build Coastguard Worker // 3*9880d681SAndroid Build Coastguard Worker // The LLVM Compiler Infrastructure 4*9880d681SAndroid Build Coastguard Worker // 5*9880d681SAndroid Build Coastguard Worker // This file is distributed under the University of Illinois Open Source 6*9880d681SAndroid Build Coastguard Worker // License. See LICENSE.TXT for details. 7*9880d681SAndroid Build Coastguard Worker // 8*9880d681SAndroid Build Coastguard Worker //===----------------------------------------------------------------------===// 9*9880d681SAndroid Build Coastguard Worker // 10*9880d681SAndroid Build Coastguard Worker // This file contains the Mips32/64 implementation of the TargetInstrInfo class. 11*9880d681SAndroid Build Coastguard Worker // 12*9880d681SAndroid Build Coastguard Worker //===----------------------------------------------------------------------===// 13*9880d681SAndroid Build Coastguard Worker 14*9880d681SAndroid Build Coastguard Worker #ifndef LLVM_LIB_TARGET_MIPS_MIPSSEINSTRINFO_H 15*9880d681SAndroid Build Coastguard Worker #define LLVM_LIB_TARGET_MIPS_MIPSSEINSTRINFO_H 16*9880d681SAndroid Build Coastguard Worker 17*9880d681SAndroid Build Coastguard Worker #include "MipsInstrInfo.h" 18*9880d681SAndroid Build Coastguard Worker #include "MipsSERegisterInfo.h" 19*9880d681SAndroid Build Coastguard Worker 20*9880d681SAndroid Build Coastguard Worker namespace llvm { 21*9880d681SAndroid Build Coastguard Worker 22*9880d681SAndroid Build Coastguard Worker class MipsSEInstrInfo : public MipsInstrInfo { 23*9880d681SAndroid Build Coastguard Worker const MipsSERegisterInfo RI; 24*9880d681SAndroid Build Coastguard Worker 25*9880d681SAndroid Build Coastguard Worker public: 26*9880d681SAndroid Build Coastguard Worker explicit MipsSEInstrInfo(const MipsSubtarget &STI); 27*9880d681SAndroid Build Coastguard Worker 28*9880d681SAndroid Build Coastguard Worker const MipsRegisterInfo &getRegisterInfo() const override; 29*9880d681SAndroid Build Coastguard Worker 30*9880d681SAndroid Build Coastguard Worker /// isLoadFromStackSlot - If the specified machine instruction is a direct 31*9880d681SAndroid Build Coastguard Worker /// load from a stack slot, return the virtual or physical register number of 32*9880d681SAndroid Build Coastguard Worker /// the destination along with the FrameIndex of the loaded stack slot. If 33*9880d681SAndroid Build Coastguard Worker /// not, return 0. This predicate must return 0 if the instruction has 34*9880d681SAndroid Build Coastguard Worker /// any side effects other than loading from the stack slot. 35*9880d681SAndroid Build Coastguard Worker unsigned isLoadFromStackSlot(const MachineInstr &MI, 36*9880d681SAndroid Build Coastguard Worker int &FrameIndex) const override; 37*9880d681SAndroid Build Coastguard Worker 38*9880d681SAndroid Build Coastguard Worker /// isStoreToStackSlot - If the specified machine instruction is a direct 39*9880d681SAndroid Build Coastguard Worker /// store to a stack slot, return the virtual or physical register number of 40*9880d681SAndroid Build Coastguard Worker /// the source reg along with the FrameIndex of the loaded stack slot. If 41*9880d681SAndroid Build Coastguard Worker /// not, return 0. This predicate must return 0 if the instruction has 42*9880d681SAndroid Build Coastguard Worker /// any side effects other than storing to the stack slot. 43*9880d681SAndroid Build Coastguard Worker unsigned isStoreToStackSlot(const MachineInstr &MI, 44*9880d681SAndroid Build Coastguard Worker int &FrameIndex) const override; 45*9880d681SAndroid Build Coastguard Worker 46*9880d681SAndroid Build Coastguard Worker void copyPhysReg(MachineBasicBlock &MBB, MachineBasicBlock::iterator MI, 47*9880d681SAndroid Build Coastguard Worker const DebugLoc &DL, unsigned DestReg, unsigned SrcReg, 48*9880d681SAndroid Build Coastguard Worker bool KillSrc) const override; 49*9880d681SAndroid Build Coastguard Worker 50*9880d681SAndroid Build Coastguard Worker void storeRegToStack(MachineBasicBlock &MBB, 51*9880d681SAndroid Build Coastguard Worker MachineBasicBlock::iterator MI, 52*9880d681SAndroid Build Coastguard Worker unsigned SrcReg, bool isKill, int FrameIndex, 53*9880d681SAndroid Build Coastguard Worker const TargetRegisterClass *RC, 54*9880d681SAndroid Build Coastguard Worker const TargetRegisterInfo *TRI, 55*9880d681SAndroid Build Coastguard Worker int64_t Offset) const override; 56*9880d681SAndroid Build Coastguard Worker 57*9880d681SAndroid Build Coastguard Worker void loadRegFromStack(MachineBasicBlock &MBB, 58*9880d681SAndroid Build Coastguard Worker MachineBasicBlock::iterator MI, 59*9880d681SAndroid Build Coastguard Worker unsigned DestReg, int FrameIndex, 60*9880d681SAndroid Build Coastguard Worker const TargetRegisterClass *RC, 61*9880d681SAndroid Build Coastguard Worker const TargetRegisterInfo *TRI, 62*9880d681SAndroid Build Coastguard Worker int64_t Offset) const override; 63*9880d681SAndroid Build Coastguard Worker 64*9880d681SAndroid Build Coastguard Worker bool expandPostRAPseudo(MachineInstr &MI) const override; 65*9880d681SAndroid Build Coastguard Worker 66*9880d681SAndroid Build Coastguard Worker unsigned getOppositeBranchOpc(unsigned Opc) const override; 67*9880d681SAndroid Build Coastguard Worker 68*9880d681SAndroid Build Coastguard Worker /// Adjust SP by Amount bytes. 69*9880d681SAndroid Build Coastguard Worker void adjustStackPtr(unsigned SP, int64_t Amount, MachineBasicBlock &MBB, 70*9880d681SAndroid Build Coastguard Worker MachineBasicBlock::iterator I) const override; 71*9880d681SAndroid Build Coastguard Worker 72*9880d681SAndroid Build Coastguard Worker /// Emit a series of instructions to load an immediate. If NewImm is a 73*9880d681SAndroid Build Coastguard Worker /// non-NULL parameter, the last instruction is not emitted, but instead 74*9880d681SAndroid Build Coastguard Worker /// its immediate operand is returned in NewImm. 75*9880d681SAndroid Build Coastguard Worker unsigned loadImmediate(int64_t Imm, MachineBasicBlock &MBB, 76*9880d681SAndroid Build Coastguard Worker MachineBasicBlock::iterator II, const DebugLoc &DL, 77*9880d681SAndroid Build Coastguard Worker unsigned *NewImm) const; 78*9880d681SAndroid Build Coastguard Worker 79*9880d681SAndroid Build Coastguard Worker private: 80*9880d681SAndroid Build Coastguard Worker unsigned getAnalyzableBrOpc(unsigned Opc) const override; 81*9880d681SAndroid Build Coastguard Worker 82*9880d681SAndroid Build Coastguard Worker void expandRetRA(MachineBasicBlock &MBB, MachineBasicBlock::iterator I) const; 83*9880d681SAndroid Build Coastguard Worker 84*9880d681SAndroid Build Coastguard Worker void expandERet(MachineBasicBlock &MBB, MachineBasicBlock::iterator I) const; 85*9880d681SAndroid Build Coastguard Worker 86*9880d681SAndroid Build Coastguard Worker std::pair<bool, bool> compareOpndSize(unsigned Opc, 87*9880d681SAndroid Build Coastguard Worker const MachineFunction &MF) const; 88*9880d681SAndroid Build Coastguard Worker 89*9880d681SAndroid Build Coastguard Worker void expandPseudoMFHiLo(MachineBasicBlock &MBB, MachineBasicBlock::iterator I, 90*9880d681SAndroid Build Coastguard Worker unsigned NewOpc) const; 91*9880d681SAndroid Build Coastguard Worker 92*9880d681SAndroid Build Coastguard Worker void expandPseudoMTLoHi(MachineBasicBlock &MBB, MachineBasicBlock::iterator I, 93*9880d681SAndroid Build Coastguard Worker unsigned LoOpc, unsigned HiOpc, 94*9880d681SAndroid Build Coastguard Worker bool HasExplicitDef) const; 95*9880d681SAndroid Build Coastguard Worker 96*9880d681SAndroid Build Coastguard Worker /// Expand pseudo Int-to-FP conversion instructions. 97*9880d681SAndroid Build Coastguard Worker /// 98*9880d681SAndroid Build Coastguard Worker /// For example, the following pseudo instruction 99*9880d681SAndroid Build Coastguard Worker /// PseudoCVT_D32_W D2, A5 100*9880d681SAndroid Build Coastguard Worker /// gets expanded into these two instructions: 101*9880d681SAndroid Build Coastguard Worker /// MTC1 F4, A5 102*9880d681SAndroid Build Coastguard Worker /// CVT_D32_W D2, F4 103*9880d681SAndroid Build Coastguard Worker /// 104*9880d681SAndroid Build Coastguard Worker /// We do this expansion post-RA to avoid inserting a floating point copy 105*9880d681SAndroid Build Coastguard Worker /// instruction between MTC1 and CVT_D32_W. 106*9880d681SAndroid Build Coastguard Worker void expandCvtFPInt(MachineBasicBlock &MBB, MachineBasicBlock::iterator I, 107*9880d681SAndroid Build Coastguard Worker unsigned CvtOpc, unsigned MovOpc, bool IsI64) const; 108*9880d681SAndroid Build Coastguard Worker 109*9880d681SAndroid Build Coastguard Worker void expandExtractElementF64(MachineBasicBlock &MBB, 110*9880d681SAndroid Build Coastguard Worker MachineBasicBlock::iterator I, bool FP64) const; 111*9880d681SAndroid Build Coastguard Worker void expandBuildPairF64(MachineBasicBlock &MBB, 112*9880d681SAndroid Build Coastguard Worker MachineBasicBlock::iterator I, bool FP64) const; 113*9880d681SAndroid Build Coastguard Worker void expandEhReturn(MachineBasicBlock &MBB, 114*9880d681SAndroid Build Coastguard Worker MachineBasicBlock::iterator I) const; 115*9880d681SAndroid Build Coastguard Worker }; 116*9880d681SAndroid Build Coastguard Worker 117*9880d681SAndroid Build Coastguard Worker } 118*9880d681SAndroid Build Coastguard Worker 119*9880d681SAndroid Build Coastguard Worker #endif 120