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