Hexagon backend support
[oota-llvm.git] / lib / Target / Hexagon / HexagonRegisterInfo.h
1 //==- HexagonRegisterInfo.h - Hexagon 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 Hexagon implementation of the TargetRegisterInfo
11 // class.
12 //
13 //===----------------------------------------------------------------------===//
14
15 #ifndef HexagonREGISTERINFO_H
16 #define HexagonREGISTERINFO_H
17
18 #include "llvm/Target/TargetRegisterInfo.h"
19 #define GET_REGINFO_HEADER
20 #include "HexagonGenRegisterInfo.inc"
21 #include "llvm/MC/MachineLocation.h"
22
23 //
24 //  We try not to hard code the reserved registers in our code,
25 //  so the following two macros were defined. However, there
26 //  are still a few places that R11 and R10 are hard wired.
27 //  See below. If, in the future, we decided to change the reserved
28 //  register. Don't forget changing the following places.
29 //
30 //  1. the "Defs" set of STriw_pred in HexagonInstrInfo.td
31 //  2. the "Defs" set of LDri_pred in HexagonInstrInfo.td
32 //  3. the definition of "IntRegs" in HexagonRegisterInfo.td
33 //  4. the definition of "DoubleRegs" in HexagonRegisterInfo.td
34 //
35 #define HEXAGON_RESERVED_REG_1 Hexagon::R10
36 #define HEXAGON_RESERVED_REG_2 Hexagon::R11
37
38 namespace llvm {
39
40 class HexagonSubtarget;
41 class HexagonInstrInfo;
42 class Type;
43
44 struct HexagonRegisterInfo : public HexagonGenRegisterInfo {
45   HexagonSubtarget &Subtarget;
46   const HexagonInstrInfo &TII;
47
48   HexagonRegisterInfo(HexagonSubtarget &st, const HexagonInstrInfo &tii);
49
50   /// Code Generation virtual methods...
51   const unsigned *getCalleeSavedRegs(const MachineFunction *MF = 0) const;
52
53   const TargetRegisterClass* const* getCalleeSavedRegClasses(
54                                      const MachineFunction *MF = 0) const;
55
56   BitVector getReservedRegs(const MachineFunction &MF) const;
57
58   void eliminateCallFramePseudoInstr(MachineFunction &MF,
59                                      MachineBasicBlock &MBB,
60                                      MachineBasicBlock::iterator I) const;
61
62   void eliminateFrameIndex(MachineBasicBlock::iterator II,
63                            int SPAdj, RegScavenger *RS = NULL) const;
64
65   /// determineFrameLayout - Determine the size of the frame and maximum call
66   /// frame size.
67   void determineFrameLayout(MachineFunction &MF) const;
68
69   /// requiresRegisterScavenging - returns true since we may need scavenging for
70   /// a temporary register when generating hardware loop instructions.
71   bool requiresRegisterScavenging(const MachineFunction &MF) const {
72     return true;
73   }
74
75   // Debug information queries.
76   unsigned getRARegister() const;
77   unsigned getFrameRegister(const MachineFunction &MF) const;
78   unsigned getFrameRegister() const;
79   void getInitialFrameState(std::vector<MachineMove> &Moves) const;
80   unsigned getStackRegister() const;
81
82   // Exception handling queries.
83   unsigned getEHExceptionRegister() const;
84   unsigned getEHHandlerRegister() const;
85 };
86
87 } // end namespace llvm
88
89 #endif