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