1 //===- MBlazeRegisterInfo.h - MBlaze 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 MBlaze implementation of the TargetRegisterInfo
13 //===----------------------------------------------------------------------===//
15 #ifndef MBLAZEREGISTERINFO_H
16 #define MBLAZEREGISTERINFO_H
19 #include "llvm/Target/TargetRegisterInfo.h"
20 #include "MBlazeGenRegisterInfo.h.inc"
23 class MBlazeSubtarget;
24 class TargetInstrInfo;
28 /// SubregIndex - The index of various sized subregister classes. Note that
29 /// these indices must be kept in sync with the class indices in the
30 /// MBlazeRegisterInfo.td file.
32 SUBREG_FPEVEN = 1, SUBREG_FPODD = 2
36 struct MBlazeRegisterInfo : public MBlazeGenRegisterInfo {
37 const MBlazeSubtarget &Subtarget;
38 const TargetInstrInfo &TII;
40 MBlazeRegisterInfo(const MBlazeSubtarget &Subtarget,
41 const TargetInstrInfo &tii);
43 /// getRegisterNumbering - Given the enum value for some register, e.g.
44 /// MBlaze::RA, return the number that it corresponds to (e.g. 31).
45 static unsigned getRegisterNumbering(unsigned RegEnum);
47 /// Get PIC indirect call register
48 static unsigned getPICCallReg();
50 /// Adjust the MBlaze stack frame.
51 void adjustMBlazeStackFrame(MachineFunction &MF) const;
53 /// Code Generation virtual methods...
54 const unsigned *getCalleeSavedRegs(const MachineFunction* MF = 0) const;
56 const TargetRegisterClass* const*
57 getCalleeSavedRegClasses(const MachineFunction* MF = 0) const;
59 BitVector getReservedRegs(const MachineFunction &MF) const;
61 bool hasFP(const MachineFunction &MF) const;
63 void eliminateCallFramePseudoInstr(MachineFunction &MF,
64 MachineBasicBlock &MBB,
65 MachineBasicBlock::iterator I) const;
67 /// Stack Frame Processing Methods
68 unsigned eliminateFrameIndex(MachineBasicBlock::iterator II,
69 int SPAdj, int *Value = NULL,
70 RegScavenger *RS = NULL) const;
72 void processFunctionBeforeFrameFinalized(MachineFunction &MF) const;
74 void emitPrologue(MachineFunction &MF) const;
75 void emitEpilogue(MachineFunction &MF, MachineBasicBlock &MBB) const;
77 /// Debug information queries.
78 unsigned getRARegister() const;
79 unsigned getFrameRegister(const MachineFunction &MF) const;
81 /// Exception handling queries.
82 unsigned getEHExceptionRegister() const;
83 unsigned getEHHandlerRegister() const;
85 int getDwarfRegNum(unsigned RegNum, bool isEH) const;
88 } // end namespace llvm