Home | History | Annotate | Download | only in Mips
      1 //===-- MipsRegisterInfo.h - Mips Register Information Impl -----*- 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 // This file contains the Mips implementation of the TargetRegisterInfo class.
     11 //
     12 //===----------------------------------------------------------------------===//
     13 
     14 #ifndef MIPSREGISTERINFO_H
     15 #define MIPSREGISTERINFO_H
     16 
     17 #include "Mips.h"
     18 #include "llvm/Target/TargetRegisterInfo.h"
     19 
     20 #define GET_REGINFO_HEADER
     21 #include "MipsGenRegisterInfo.inc"
     22 
     23 namespace llvm {
     24 class MipsSubtarget;
     25 class Type;
     26 
     27 class MipsRegisterInfo : public MipsGenRegisterInfo {
     28 protected:
     29   const MipsSubtarget &Subtarget;
     30 
     31 public:
     32   MipsRegisterInfo(const MipsSubtarget &Subtarget);
     33 
     34   /// getRegisterNumbering - Given the enum value for some register, e.g.
     35   /// Mips::RA, return the number that it corresponds to (e.g. 31).
     36   static unsigned getRegisterNumbering(unsigned RegEnum);
     37 
     38   /// Get PIC indirect call register
     39   static unsigned getPICCallReg();
     40 
     41   /// Adjust the Mips stack frame.
     42   void adjustMipsStackFrame(MachineFunction &MF) const;
     43 
     44   /// Code Generation virtual methods...
     45   const TargetRegisterClass *getPointerRegClass(const MachineFunction &MF,
     46                                                 unsigned Kind) const override;
     47 
     48   unsigned getRegPressureLimit(const TargetRegisterClass *RC,
     49                                MachineFunction &MF) const override;
     50   const MCPhysReg *
     51   getCalleeSavedRegs(const MachineFunction *MF = nullptr) const override;
     52   const uint32_t *getCallPreservedMask(CallingConv::ID) const override;
     53   static const uint32_t *getMips16RetHelperMask();
     54 
     55   BitVector getReservedRegs(const MachineFunction &MF) const override;
     56 
     57   bool requiresRegisterScavenging(const MachineFunction &MF) const override;
     58 
     59   bool trackLivenessAfterRegAlloc(const MachineFunction &MF) const override;
     60 
     61   /// Stack Frame Processing Methods
     62   void eliminateFrameIndex(MachineBasicBlock::iterator II,
     63                            int SPAdj, unsigned FIOperandNum,
     64                            RegScavenger *RS = nullptr) const override;
     65 
     66   void processFunctionBeforeFrameFinalized(MachineFunction &MF,
     67                                        RegScavenger *RS = nullptr) const;
     68 
     69   /// Debug information queries.
     70   unsigned getFrameRegister(const MachineFunction &MF) const override;
     71 
     72   /// \brief Return GPR register class.
     73   virtual const TargetRegisterClass *intRegClass(unsigned Size) const = 0;
     74 
     75 private:
     76   virtual void eliminateFI(MachineBasicBlock::iterator II, unsigned OpNo,
     77                            int FrameIndex, uint64_t StackSize,
     78                            int64_t SPOffset) const = 0;
     79 };
     80 
     81 } // end namespace llvm
     82 
     83 #endif
     84