LLVM API Documentation

MipsSEInstrInfo.h
Go to the documentation of this file.
00001 //===-- MipsSEInstrInfo.h - Mips32/64 Instruction Information ---*- C++ -*-===//
00002 //
00003 //                     The LLVM Compiler Infrastructure
00004 //
00005 // This file is distributed under the University of Illinois Open Source
00006 // License. See LICENSE.TXT for details.
00007 //
00008 //===----------------------------------------------------------------------===//
00009 //
00010 // This file contains the Mips32/64 implementation of the TargetInstrInfo class.
00011 //
00012 //===----------------------------------------------------------------------===//
00013 
00014 #ifndef LLVM_LIB_TARGET_MIPS_MIPSSEINSTRINFO_H
00015 #define LLVM_LIB_TARGET_MIPS_MIPSSEINSTRINFO_H
00016 
00017 #include "MipsInstrInfo.h"
00018 #include "MipsSERegisterInfo.h"
00019 
00020 namespace llvm {
00021 
00022 class MipsSEInstrInfo : public MipsInstrInfo {
00023   const MipsSERegisterInfo RI;
00024   bool IsN64;
00025 
00026 public:
00027   explicit MipsSEInstrInfo(const MipsSubtarget &STI);
00028 
00029   const MipsRegisterInfo &getRegisterInfo() const override;
00030 
00031   /// isLoadFromStackSlot - If the specified machine instruction is a direct
00032   /// load from a stack slot, return the virtual or physical register number of
00033   /// the destination along with the FrameIndex of the loaded stack slot.  If
00034   /// not, return 0.  This predicate must return 0 if the instruction has
00035   /// any side effects other than loading from the stack slot.
00036   unsigned isLoadFromStackSlot(const MachineInstr *MI,
00037                                int &FrameIndex) const override;
00038 
00039   /// isStoreToStackSlot - If the specified machine instruction is a direct
00040   /// store to a stack slot, return the virtual or physical register number of
00041   /// the source reg along with the FrameIndex of the loaded stack slot.  If
00042   /// not, return 0.  This predicate must return 0 if the instruction has
00043   /// any side effects other than storing to the stack slot.
00044   unsigned isStoreToStackSlot(const MachineInstr *MI,
00045                               int &FrameIndex) const override;
00046 
00047   void copyPhysReg(MachineBasicBlock &MBB,
00048                    MachineBasicBlock::iterator MI, DebugLoc DL,
00049                    unsigned DestReg, unsigned SrcReg,
00050                    bool KillSrc) const override;
00051 
00052   void storeRegToStack(MachineBasicBlock &MBB,
00053                        MachineBasicBlock::iterator MI,
00054                        unsigned SrcReg, bool isKill, int FrameIndex,
00055                        const TargetRegisterClass *RC,
00056                        const TargetRegisterInfo *TRI,
00057                        int64_t Offset) const override;
00058 
00059   void loadRegFromStack(MachineBasicBlock &MBB,
00060                         MachineBasicBlock::iterator MI,
00061                         unsigned DestReg, int FrameIndex,
00062                         const TargetRegisterClass *RC,
00063                         const TargetRegisterInfo *TRI,
00064                         int64_t Offset) const override;
00065 
00066   bool expandPostRAPseudo(MachineBasicBlock::iterator MI) const override;
00067 
00068   unsigned getOppositeBranchOpc(unsigned Opc) const override;
00069 
00070   /// Adjust SP by Amount bytes.
00071   void adjustStackPtr(unsigned SP, int64_t Amount, MachineBasicBlock &MBB,
00072                       MachineBasicBlock::iterator I) const;
00073 
00074   /// Emit a series of instructions to load an immediate. If NewImm is a
00075   /// non-NULL parameter, the last instruction is not emitted, but instead
00076   /// its immediate operand is returned in NewImm.
00077   unsigned loadImmediate(int64_t Imm, MachineBasicBlock &MBB,
00078                          MachineBasicBlock::iterator II, DebugLoc DL,
00079                          unsigned *NewImm) const;
00080 
00081 private:
00082   unsigned getAnalyzableBrOpc(unsigned Opc) const override;
00083 
00084   void expandRetRA(MachineBasicBlock &MBB, MachineBasicBlock::iterator I) const;
00085 
00086   std::pair<bool, bool> compareOpndSize(unsigned Opc,
00087                                         const MachineFunction &MF) const;
00088 
00089   void expandPseudoMFHiLo(MachineBasicBlock &MBB, MachineBasicBlock::iterator I,
00090                           unsigned NewOpc) const;
00091 
00092   void expandPseudoMTLoHi(MachineBasicBlock &MBB, MachineBasicBlock::iterator I,
00093                           unsigned LoOpc, unsigned HiOpc,
00094                           bool HasExplicitDef) const;
00095 
00096   /// Expand pseudo Int-to-FP conversion instructions.
00097   ///
00098   /// For example, the following pseudo instruction
00099   ///  PseudoCVT_D32_W D2, A5
00100   /// gets expanded into these two instructions:
00101   ///  MTC1 F4, A5
00102   ///  CVT_D32_W D2, F4
00103   ///
00104   /// We do this expansion post-RA to avoid inserting a floating point copy
00105   /// instruction between MTC1 and CVT_D32_W.
00106   void expandCvtFPInt(MachineBasicBlock &MBB, MachineBasicBlock::iterator I,
00107                       unsigned CvtOpc, unsigned MovOpc, bool IsI64) const;
00108 
00109   void expandExtractElementF64(MachineBasicBlock &MBB,
00110                                MachineBasicBlock::iterator I, bool FP64) const;
00111   void expandBuildPairF64(MachineBasicBlock &MBB,
00112                           MachineBasicBlock::iterator I, bool FP64) const;
00113   void expandEhReturn(MachineBasicBlock &MBB,
00114                       MachineBasicBlock::iterator I) const;
00115 };
00116 
00117 }
00118 
00119 #endif