The BLX instruction is encoded differently than the BL, because why not? In
[oota-llvm.git] / lib / Target / Blackfin / BlackfinRegisterInfo.h
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.
12 //
13 //===----------------------------------------------------------------------===//
14
15 #ifndef BLACKFINREGISTERINFO_H
16 #define BLACKFINREGISTERINFO_H
17
18 #include "llvm/Target/TargetRegisterInfo.h"
19 #include "BlackfinGenRegisterInfo.h.inc"
20
21 namespace llvm {
22
23   class BlackfinSubtarget;
24   class TargetInstrInfo;
25   class Type;
26
27   struct BlackfinRegisterInfo : public BlackfinGenRegisterInfo {
28     BlackfinSubtarget &Subtarget;
29     const TargetInstrInfo &TII;
30
31     BlackfinRegisterInfo(BlackfinSubtarget &st, const TargetInstrInfo &tii);
32
33     /// Code Generation virtual methods...
34     const unsigned *getCalleeSavedRegs(const MachineFunction *MF = 0) const;
35
36     BitVector getReservedRegs(const MachineFunction &MF) const;
37
38     // getSubReg implemented by tablegen
39
40     const TargetRegisterClass *getPointerRegClass(unsigned Kind = 0) const {
41       return &BF::PRegClass;
42     }
43
44     // bool hasReservedCallFrame(MachineFunction &MF) const;
45
46     bool requiresRegisterScavenging(const MachineFunction &MF) const;
47
48     void eliminateCallFramePseudoInstr(MachineFunction &MF,
49                                        MachineBasicBlock &MBB,
50                                        MachineBasicBlock::iterator I) const;
51
52     void eliminateFrameIndex(MachineBasicBlock::iterator II,
53                              int SPAdj, RegScavenger *RS = NULL) const;
54
55     unsigned getFrameRegister(const MachineFunction &MF) const;
56     unsigned getRARegister() const;
57
58     // Exception handling queries.
59     unsigned getEHExceptionRegister() const;
60     unsigned getEHHandlerRegister() const;
61
62     int getDwarfRegNum(unsigned RegNum, bool isEH) const;
63
64     // Utility functions
65     void adjustRegister(MachineBasicBlock &MBB,
66                         MachineBasicBlock::iterator I,
67                         DebugLoc DL,
68                         unsigned Reg,
69                         unsigned ScratchReg,
70                         int delta) const;
71     void loadConstant(MachineBasicBlock &MBB,
72                       MachineBasicBlock::iterator I,
73                       DebugLoc DL,
74                       unsigned Reg,
75                       int value) const;
76   };
77
78 } // end namespace llvm
79
80 #endif