• Home
  • Line#
  • Scopes#
  • Navigate#
  • Raw
  • Download
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 LLVM_LIB_TARGET_MIPS_MIPSREGISTERINFO_H
15 #define LLVM_LIB_TARGET_MIPS_MIPSREGISTERINFO_H
16 
17 #include "Mips.h"
18 #include "llvm/CodeGen/MachineBasicBlock.h"
19 #include <cstdint>
20 
21 #define GET_REGINFO_HEADER
22 #include "MipsGenRegisterInfo.inc"
23 
24 namespace llvm {
25 
26 class TargetRegisterClass;
27 
28 class MipsRegisterInfo : public MipsGenRegisterInfo {
29 public:
30   enum class MipsPtrClass {
31     /// The default register class for integer values.
32     Default = 0,
33     /// The subset of registers permitted in certain microMIPS instructions
34     /// such as lw16.
35     GPR16MM = 1,
36     /// The stack pointer only.
37     StackPointer = 2,
38     /// The global pointer only.
39     GlobalPointer = 3,
40   };
41 
42   MipsRegisterInfo();
43 
44   /// Get PIC indirect call register
45   static unsigned getPICCallReg();
46 
47   /// Code Generation virtual methods...
48   const TargetRegisterClass *getPointerRegClass(const MachineFunction &MF,
49                                                 unsigned Kind) const override;
50 
51   unsigned getRegPressureLimit(const TargetRegisterClass *RC,
52                                MachineFunction &MF) const override;
53   const MCPhysReg *getCalleeSavedRegs(const MachineFunction *MF) const override;
54   const uint32_t *getCallPreservedMask(const MachineFunction &MF,
55                                        CallingConv::ID) const override;
56   static const uint32_t *getMips16RetHelperMask();
57 
58   BitVector getReservedRegs(const MachineFunction &MF) const override;
59 
enableMultipleCopyHints()60   bool enableMultipleCopyHints() const override { return true; }
61 
62   bool requiresRegisterScavenging(const MachineFunction &MF) const override;
63 
64   bool trackLivenessAfterRegAlloc(const MachineFunction &MF) const override;
65 
66   /// Stack Frame Processing Methods
67   void eliminateFrameIndex(MachineBasicBlock::iterator II,
68                            int SPAdj, unsigned FIOperandNum,
69                            RegScavenger *RS = nullptr) const override;
70 
71   // Stack realignment queries.
72   bool canRealignStack(const MachineFunction &MF) const override;
73 
74   /// Debug information queries.
75   unsigned getFrameRegister(const MachineFunction &MF) const override;
76 
77   /// Return GPR register class.
78   virtual const TargetRegisterClass *intRegClass(unsigned Size) const = 0;
79 
80 private:
81   virtual void eliminateFI(MachineBasicBlock::iterator II, unsigned OpNo,
82                            int FrameIndex, uint64_t StackSize,
83                            int64_t SPOffset) const = 0;
84 };
85 
86 } // end namespace llvm
87 
88 #endif // LLVM_LIB_TARGET_MIPS_MIPSREGISTERINFO_H
89