1 //===-- XCoreRegisterInfo.h - XCore 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 XCore implementation of the MRegisterInfo class.
11 //
12 //===----------------------------------------------------------------------===//
13 
14 #ifndef XCOREREGISTERINFO_H
15 #define XCOREREGISTERINFO_H
16 
17 #include "llvm/Target/TargetRegisterInfo.h"
18 
19 #define GET_REGINFO_HEADER
20 #include "XCoreGenRegisterInfo.inc"
21 
22 namespace llvm {
23 
24 class TargetInstrInfo;
25 
26 struct XCoreRegisterInfo : public XCoreGenRegisterInfo {
27 private:
28   const TargetInstrInfo &TII;
29 
30   void loadConstant(MachineBasicBlock &MBB,
31                   MachineBasicBlock::iterator I,
32                   unsigned DstReg, int64_t Value, DebugLoc dl) const;
33 
34   void storeToStack(MachineBasicBlock &MBB,
35                   MachineBasicBlock::iterator I,
36                   unsigned SrcReg, int Offset, DebugLoc dl) const;
37 
38   void loadFromStack(MachineBasicBlock &MBB,
39                   MachineBasicBlock::iterator I,
40                   unsigned DstReg, int Offset, DebugLoc dl) const;
41 
42 public:
43   XCoreRegisterInfo(const TargetInstrInfo &tii);
44 
45   /// Code Generation virtual methods...
46 
47   const uint16_t *getCalleeSavedRegs(const MachineFunction *MF = 0) const;
48 
49   BitVector getReservedRegs(const MachineFunction &MF) const;
50 
51   bool requiresRegisterScavenging(const MachineFunction &MF) const;
52 
53   bool trackLivenessAfterRegAlloc(const MachineFunction &MF) const;
54 
55   bool useFPForScavengingIndex(const MachineFunction &MF) const;
56 
57   void eliminateFrameIndex(MachineBasicBlock::iterator II,
58                            int SPAdj, unsigned FIOperandNum,
59                            RegScavenger *RS = NULL) const;
60 
61   // Debug information queries.
62   unsigned getFrameRegister(const MachineFunction &MF) const;
63 
64   //! Return whether to emit frame moves
65   static bool needsFrameMoves(const MachineFunction &MF);
66 };
67 
68 } // end namespace llvm
69 
70 #endif
71