1235633Sdim//===-- MipsRegisterInfo.h - Mips Register Information Impl -----*- C++ -*-===//
2193323Sed//
3193323Sed//                     The LLVM Compiler Infrastructure
4193323Sed//
5193323Sed// This file is distributed under the University of Illinois Open Source
6193323Sed// License. See LICENSE.TXT for details.
7193323Sed//
8193323Sed//===----------------------------------------------------------------------===//
9193323Sed//
10193323Sed// This file contains the Mips implementation of the TargetRegisterInfo class.
11193323Sed//
12193323Sed//===----------------------------------------------------------------------===//
13193323Sed
14193323Sed#ifndef MIPSREGISTERINFO_H
15193323Sed#define MIPSREGISTERINFO_H
16193323Sed
17193323Sed#include "Mips.h"
18193323Sed#include "llvm/Target/TargetRegisterInfo.h"
19193323Sed
20224145Sdim#define GET_REGINFO_HEADER
21224145Sdim#include "MipsGenRegisterInfo.inc"
22224145Sdim
23193323Sednamespace llvm {
24193323Sedclass MipsSubtarget;
25193323Sedclass Type;
26193323Sed
27245431Sdimclass MipsRegisterInfo : public MipsGenRegisterInfo {
28245431Sdimprotected:
29193323Sed  const MipsSubtarget &Subtarget;
30221345Sdim
31245431Sdimpublic:
32245431Sdim  MipsRegisterInfo(const MipsSubtarget &Subtarget);
33193323Sed
34193323Sed  /// getRegisterNumbering - Given the enum value for some register, e.g.
35193323Sed  /// Mips::RA, return the number that it corresponds to (e.g. 31).
36193323Sed  static unsigned getRegisterNumbering(unsigned RegEnum);
37193323Sed
38193323Sed  /// Get PIC indirect call register
39198090Srdivacky  static unsigned getPICCallReg();
40193323Sed
41193323Sed  /// Adjust the Mips stack frame.
42193323Sed  void adjustMipsStackFrame(MachineFunction &MF) const;
43193323Sed
44193323Sed  /// Code Generation virtual methods...
45263509Sdim  const TargetRegisterClass *getPointerRegClass(const MachineFunction &MF,
46263509Sdim                                                unsigned Kind) const;
47263509Sdim
48252723Sdim  unsigned getRegPressureLimit(const TargetRegisterClass *RC,
49252723Sdim                               MachineFunction &MF) const;
50245431Sdim  const uint16_t *getCalleeSavedRegs(const MachineFunction *MF = 0) const;
51235633Sdim  const uint32_t *getCallPreservedMask(CallingConv::ID) const;
52263509Sdim  static const uint32_t *getMips16RetHelperMask();
53193323Sed
54193323Sed  BitVector getReservedRegs(const MachineFunction &MF) const;
55193323Sed
56235633Sdim  virtual bool requiresRegisterScavenging(const MachineFunction &MF) const;
57235633Sdim
58245431Sdim  virtual bool trackLivenessAfterRegAlloc(const MachineFunction &MF) const;
59193323Sed
60193323Sed  /// Stack Frame Processing Methods
61212904Sdim  void eliminateFrameIndex(MachineBasicBlock::iterator II,
62252723Sdim                           int SPAdj, unsigned FIOperandNum,
63252723Sdim                           RegScavenger *RS = NULL) const;
64193323Sed
65252723Sdim  void processFunctionBeforeFrameFinalized(MachineFunction &MF,
66252723Sdim                                       RegScavenger *RS = NULL) const;
67193323Sed
68193323Sed  /// Debug information queries.
69199481Srdivacky  unsigned getFrameRegister(const MachineFunction &MF) const;
70193323Sed
71252723Sdim  /// \brief Return GPR register class.
72252723Sdim  virtual const TargetRegisterClass *intRegClass(unsigned Size) const = 0;
73252723Sdim
74245431Sdimprivate:
75245431Sdim  virtual void eliminateFI(MachineBasicBlock::iterator II, unsigned OpNo,
76245431Sdim                           int FrameIndex, uint64_t StackSize,
77245431Sdim                           int64_t SPOffset) const = 0;
78193323Sed};
79193323Sed
80193323Sed} // end namespace llvm
81193323Sed
82193323Sed#endif
83