1 //===- MipsRegisterInfo.h - Mips Register Information Impl ------*- C++ -*-===//
3 // The LLVM Compiler Infrastructure
5 // This file is distributed under the University of Illinois Open Source
6 // License. See LICENSE.TXT for details.
8 //===----------------------------------------------------------------------===//
10 // This file contains the Mips implementation of the TargetRegisterInfo class.
12 //===----------------------------------------------------------------------===//
14 #ifndef MIPSREGISTERINFO_H
15 #define MIPSREGISTERINFO_H
18 #include "llvm/Target/TargetRegisterInfo.h"
19 #include "MipsGenRegisterInfo.h.inc"
23 class TargetInstrInfo;
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.
31 SUBREG_FPEVEN = 1, SUBREG_FPODD = 2
35 struct MipsRegisterInfo : public MipsGenRegisterInfo {
36 const MipsSubtarget &Subtarget;
37 const TargetInstrInfo &TII;
39 MipsRegisterInfo(const MipsSubtarget &Subtarget, const TargetInstrInfo &tii);
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);
45 /// Get PIC indirect call register
46 static unsigned getPICCallReg();
48 /// Adjust the Mips stack frame.
49 void adjustMipsStackFrame(MachineFunction &MF) const;
51 /// Code Generation virtual methods...
52 const unsigned *getCalleeSavedRegs(const MachineFunction* MF = 0) const;
54 const TargetRegisterClass* const*
55 getCalleeSavedRegClasses(const MachineFunction* MF = 0) const;
57 BitVector getReservedRegs(const MachineFunction &MF) const;
59 bool hasFP(const MachineFunction &MF) const;
61 void eliminateCallFramePseudoInstr(MachineFunction &MF,
62 MachineBasicBlock &MBB,
63 MachineBasicBlock::iterator I) const;
65 /// Stack Frame Processing Methods
66 unsigned eliminateFrameIndex(MachineBasicBlock::iterator II,
67 int SPAdj, int *Value = NULL,
68 RegScavenger *RS = NULL) const;
70 void processFunctionBeforeFrameFinalized(MachineFunction &MF) const;
72 void emitPrologue(MachineFunction &MF) const;
73 void emitEpilogue(MachineFunction &MF, MachineBasicBlock &MBB) const;
75 /// Debug information queries.
76 unsigned getRARegister() const;
77 unsigned getFrameRegister(const MachineFunction &MF) const;
79 /// Exception handling queries.
80 unsigned getEHExceptionRegister() const;
81 unsigned getEHHandlerRegister() const;
83 int getDwarfRegNum(unsigned RegNum, bool isEH) const;
86 } // end namespace llvm