Fixed some bugs in register stack pass.
[llvm/zpu.git] / lib / Target / Blackfin / BlackfinRegisterInfo.h
blobbb83c34f80032bccfe911fe2d639e6e63e75a867
1 //===- BlackfinRegisterInfo.h - Blackfin Register Information ..-*- 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 Blackfin implementation of the TargetRegisterInfo
11 // class.
13 //===----------------------------------------------------------------------===//
15 #ifndef BLACKFINREGISTERINFO_H
16 #define BLACKFINREGISTERINFO_H
18 #include "llvm/Target/TargetRegisterInfo.h"
19 #include "BlackfinGenRegisterInfo.h.inc"
21 namespace llvm {
23 class BlackfinSubtarget;
24 class TargetInstrInfo;
25 class Type;
27 struct BlackfinRegisterInfo : public BlackfinGenRegisterInfo {
28 BlackfinSubtarget &Subtarget;
29 const TargetInstrInfo &TII;
31 BlackfinRegisterInfo(BlackfinSubtarget &st, const TargetInstrInfo &tii);
33 /// Code Generation virtual methods...
34 const unsigned *getCalleeSavedRegs(const MachineFunction *MF = 0) const;
36 BitVector getReservedRegs(const MachineFunction &MF) const;
38 // getSubReg implemented by tablegen
40 const TargetRegisterClass *getPointerRegClass(unsigned Kind = 0) const {
41 return &BF::PRegClass;
44 bool hasFP(const MachineFunction &MF) const;
46 // bool hasReservedCallFrame(MachineFunction &MF) const;
48 bool requiresRegisterScavenging(const MachineFunction &MF) const;
50 void eliminateCallFramePseudoInstr(MachineFunction &MF,
51 MachineBasicBlock &MBB,
52 MachineBasicBlock::iterator I) const;
54 void eliminateFrameIndex(MachineBasicBlock::iterator II,
55 int SPAdj, RegScavenger *RS = NULL) const;
57 void processFunctionBeforeCalleeSavedScan(MachineFunction &MF,
58 RegScavenger *RS) const;
60 void emitPrologue(MachineFunction &MF) const;
61 void emitEpilogue(MachineFunction &MF, MachineBasicBlock &MBB) const;
63 unsigned getFrameRegister(const MachineFunction &MF) const;
64 unsigned getRARegister() const;
66 // Exception handling queries.
67 unsigned getEHExceptionRegister() const;
68 unsigned getEHHandlerRegister() const;
70 int getDwarfRegNum(unsigned RegNum, bool isEH) const;
72 // Utility functions
73 void adjustRegister(MachineBasicBlock &MBB,
74 MachineBasicBlock::iterator I,
75 DebugLoc DL,
76 unsigned Reg,
77 unsigned ScratchReg,
78 int delta) const;
79 void loadConstant(MachineBasicBlock &MBB,
80 MachineBasicBlock::iterator I,
81 DebugLoc DL,
82 unsigned Reg,
83 int value) const;
86 } // end namespace llvm
88 #endif