MipsRegisterInfo.h revision dff4b4c5a7cc894d3b4b6c6e779ea8f47fa50630
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#include "MipsGenRegisterInfo.h.inc"
20
21namespace llvm {
22class MipsSubtarget;
23class TargetInstrInfo;
24class Type;
25
26namespace Mips {
27  /// SubregIndex - The index of various sized subregister classes. Note that
28  /// these indices must be kept in sync with the class indices in the
29  /// MipsRegisterInfo.td file.
30  enum SubregIndex {
31    SUBREG_FPEVEN = 1, SUBREG_FPODD = 2
32  };
33}
34
35struct MipsRegisterInfo : public MipsGenRegisterInfo {
36  const MipsSubtarget &Subtarget;
37  const TargetInstrInfo &TII;
38
39  MipsRegisterInfo(const MipsSubtarget &Subtarget, const TargetInstrInfo &tii);
40
41  /// getRegisterNumbering - Given the enum value for some register, e.g.
42  /// Mips::RA, return the number that it corresponds to (e.g. 31).
43  static unsigned getRegisterNumbering(unsigned RegEnum);
44
45  /// Get PIC indirect call register
46  static unsigned getPICCallReg();
47
48  /// Adjust the Mips stack frame.
49  void adjustMipsStackFrame(MachineFunction &MF) const;
50
51  /// Code Generation virtual methods...
52  const unsigned *getCalleeSavedRegs(const MachineFunction* MF = 0) const;
53
54  const TargetRegisterClass* const*
55  getCalleeSavedRegClasses(const MachineFunction* MF = 0) const;
56
57  BitVector getReservedRegs(const MachineFunction &MF) const;
58
59  bool hasFP(const MachineFunction &MF) const;
60
61  void eliminateCallFramePseudoInstr(MachineFunction &MF,
62                                     MachineBasicBlock &MBB,
63                                     MachineBasicBlock::iterator I) const;
64
65  /// Stack Frame Processing Methods
66  unsigned eliminateFrameIndex(MachineBasicBlock::iterator II,
67                               int SPAdj, FrameIndexValue *Value = NULL,
68                               RegScavenger *RS = NULL) const;
69
70  void processFunctionBeforeFrameFinalized(MachineFunction &MF) const;
71
72  void emitPrologue(MachineFunction &MF) const;
73  void emitEpilogue(MachineFunction &MF, MachineBasicBlock &MBB) const;
74
75  /// Debug information queries.
76  unsigned getRARegister() const;
77  unsigned getFrameRegister(const MachineFunction &MF) const;
78
79  /// Exception handling queries.
80  unsigned getEHExceptionRegister() const;
81  unsigned getEHHandlerRegister() const;
82
83  int getDwarfRegNum(unsigned RegNum, bool isEH) const;
84};
85
86} // end namespace llvm
87
88#endif
89