zpu: managed to compile program that writes constant to global variable
[llvm/zpu.git] / lib / Target / MBlaze / MBlazeRegisterInfo.h
blob1e1fde14ab7b8faf1a4f568d5a3d7663219867dc
1 //===- MBlazeRegisterInfo.h - MBlaze 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 MBlaze implementation of the TargetRegisterInfo
11 // class.
13 //===----------------------------------------------------------------------===//
15 #ifndef MBLAZEREGISTERINFO_H
16 #define MBLAZEREGISTERINFO_H
18 #include "MBlaze.h"
19 #include "llvm/Target/TargetRegisterInfo.h"
20 #include "MBlazeGenRegisterInfo.h.inc"
22 namespace llvm {
23 class MBlazeSubtarget;
24 class TargetInstrInfo;
25 class Type;
27 namespace MBlaze {
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.
31 enum SubregIndex {
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);
46 static unsigned getRegisterFromNumbering(unsigned RegEnum);
48 /// Get PIC indirect call register
49 static unsigned getPICCallReg();
51 /// Adjust the MBlaze stack frame.
52 void adjustMBlazeStackFrame(MachineFunction &MF) const;
54 /// Code Generation virtual methods...
55 const unsigned *getCalleeSavedRegs(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 void eliminateFrameIndex(MachineBasicBlock::iterator II,
67 int SPAdj, RegScavenger *RS = NULL) const;
69 void processFunctionBeforeFrameFinalized(MachineFunction &MF) const;
71 void emitPrologue(MachineFunction &MF) const;
72 void emitEpilogue(MachineFunction &MF, MachineBasicBlock &MBB) const;
74 /// Debug information queries.
75 unsigned getRARegister() const;
76 unsigned getFrameRegister(const MachineFunction &MF) const;
78 /// Exception handling queries.
79 unsigned getEHExceptionRegister() const;
80 unsigned getEHHandlerRegister() const;
82 /// targetHandlesStackFrameRounding - Returns true if the target is
83 /// responsible for rounding up the stack frame (probably at emitPrologue
84 /// time).
85 bool targetHandlesStackFrameRounding() const { return true; }
87 int getDwarfRegNum(unsigned RegNum, bool isEH) const;
90 } // end namespace llvm
92 #endif