• Home
  • Line#
  • Scopes#
  • Navigate#
  • Raw
  • Download
1 //===-- PPCRegisterInfo.h - PowerPC 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 PowerPC implementation of the TargetRegisterInfo
11 // class.
12 //
13 //===----------------------------------------------------------------------===//
14 
15 #ifndef POWERPC32_REGISTERINFO_H
16 #define POWERPC32_REGISTERINFO_H
17 
18 #include "PPC.h"
19 #include <map>
20 
21 #define GET_REGINFO_HEADER
22 #include "PPCGenRegisterInfo.inc"
23 
24 namespace llvm {
25 class PPCSubtarget;
26 class TargetInstrInfo;
27 class Type;
28 
29 class PPCRegisterInfo : public PPCGenRegisterInfo {
30   std::map<unsigned, unsigned> ImmToIdxMap;
31   const PPCSubtarget &Subtarget;
32   const TargetInstrInfo &TII;
33 public:
34   PPCRegisterInfo(const PPCSubtarget &SubTarget, const TargetInstrInfo &tii);
35 
36   /// getPointerRegClass - Return the register class to use to hold pointers.
37   /// This is used for addressing modes.
38   virtual const TargetRegisterClass *
39   getPointerRegClass(const MachineFunction &MF, unsigned Kind=0) const;
40 
41   unsigned getRegPressureLimit(const TargetRegisterClass *RC,
42                                MachineFunction &MF) const;
43 
44   /// Code Generation virtual methods...
45   const uint16_t *getCalleeSavedRegs(const MachineFunction* MF = 0) const;
46   const uint32_t *getCallPreservedMask(CallingConv::ID CC) const;
47 
48   BitVector getReservedRegs(const MachineFunction &MF) const;
49 
50   /// We require the register scavenger.
requiresRegisterScavenging(const MachineFunction & MF)51   bool requiresRegisterScavenging(const MachineFunction &MF) const {
52     return true;
53   }
54 
requiresFrameIndexScavenging(const MachineFunction & MF)55   bool requiresFrameIndexScavenging(const MachineFunction &MF) const {
56     return true;
57   }
58 
trackLivenessAfterRegAlloc(const MachineFunction & MF)59   bool trackLivenessAfterRegAlloc(const MachineFunction &MF) const {
60     return true;
61   }
62 
63   void lowerDynamicAlloc(MachineBasicBlock::iterator II,
64                          int SPAdj, RegScavenger *RS) const;
65   void lowerCRSpilling(MachineBasicBlock::iterator II, unsigned FrameIndex,
66                        int SPAdj, RegScavenger *RS) const;
67   void lowerCRRestore(MachineBasicBlock::iterator II, unsigned FrameIndex,
68                        int SPAdj, RegScavenger *RS) const;
69   bool hasReservedSpillSlot(const MachineFunction &MF, unsigned Reg,
70 			    int &FrameIdx) const;
71   void eliminateFrameIndex(MachineBasicBlock::iterator II,
72                            int SPAdj, unsigned FIOperandNum,
73                            RegScavenger *RS = NULL) const;
74 
75   // Debug information queries.
76   unsigned getFrameRegister(const MachineFunction &MF) const;
77 
78   // Exception handling queries.
79   unsigned getEHExceptionRegister() const;
80   unsigned getEHHandlerRegister() const;
81 };
82 
83 } // end namespace llvm
84 
85 #endif
86