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"
21 #define GET_REGINFO_HEADER
22 #include "MBlazeGenRegisterInfo.inc"
25 class MBlazeSubtarget
;
26 class TargetInstrInfo
;
30 /// SubregIndex - The index of various sized subregister classes. Note that
31 /// these indices must be kept in sync with the class indices in the
32 /// MBlazeRegisterInfo.td file.
34 SUBREG_FPEVEN
= 1, SUBREG_FPODD
= 2
38 struct MBlazeRegisterInfo
: public MBlazeGenRegisterInfo
{
39 const MBlazeSubtarget
&Subtarget
;
40 const TargetInstrInfo
&TII
;
42 MBlazeRegisterInfo(const MBlazeSubtarget
&Subtarget
,
43 const TargetInstrInfo
&tii
);
45 /// getRegisterNumbering - Given the enum value for some register, e.g.
46 /// MBlaze::RA, return the number that it corresponds to (e.g. 31).
47 static unsigned getRegisterNumbering(unsigned RegEnum
);
48 static unsigned getRegisterFromNumbering(unsigned RegEnum
);
49 static unsigned getSpecialRegisterFromNumbering(unsigned RegEnum
);
50 static bool isRegister(unsigned RegEnum
);
51 static bool isSpecialRegister(unsigned RegEnum
);
53 /// Get PIC indirect call register
54 static unsigned getPICCallReg();
56 /// Code Generation virtual methods...
57 const unsigned *getCalleeSavedRegs(const MachineFunction
* MF
= 0) const;
59 BitVector
getReservedRegs(const MachineFunction
&MF
) const;
61 void eliminateCallFramePseudoInstr(MachineFunction
&MF
,
62 MachineBasicBlock
&MBB
,
63 MachineBasicBlock::iterator I
) const;
65 /// Stack Frame Processing Methods
66 void eliminateFrameIndex(MachineBasicBlock::iterator II
,
67 int SPAdj
, RegScavenger
*RS
= NULL
) const;
69 void processFunctionBeforeFrameFinalized(MachineFunction
&MF
) const;
71 /// Debug information queries.
72 unsigned getRARegister() const;
73 unsigned getFrameRegister(const MachineFunction
&MF
) const;
75 /// Exception handling queries.
76 unsigned getEHExceptionRegister() const;
77 unsigned getEHHandlerRegister() const;
79 int getDwarfRegNum(unsigned RegNum
, bool isEH
) const;
80 int getLLVMRegNum(unsigned RegNum
, bool isEH
) const;
83 } // end namespace llvm