Move the eliminateCallFramePseudoInstr method from TargetRegisterInfo
[oota-llvm.git] / lib / Target / PowerPC / PPCRegisterInfo.h
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   mutable int CRSpillFrameIdx;
34 public:
35   PPCRegisterInfo(const PPCSubtarget &SubTarget, const TargetInstrInfo &tii);
36   
37   /// getPointerRegClass - Return the register class to use to hold pointers.
38   /// This is used for addressing modes.
39   virtual const TargetRegisterClass *
40   getPointerRegClass(const MachineFunction &MF, unsigned Kind=0) const;
41
42   unsigned getRegPressureLimit(const TargetRegisterClass *RC,
43                                MachineFunction &MF) const;
44
45   /// Code Generation virtual methods...
46   const uint16_t *getCalleeSavedRegs(const MachineFunction* MF = 0) const;
47   const uint32_t *getCallPreservedMask(CallingConv::ID CC) const;
48
49   BitVector getReservedRegs(const MachineFunction &MF) const;
50
51   virtual bool avoidWriteAfterWrite(const TargetRegisterClass *RC) const;
52
53   /// requiresRegisterScavenging - We require a register scavenger.
54   /// FIXME (64-bit): Should be inlined.
55   bool requiresRegisterScavenging(const MachineFunction &MF) const;
56
57   bool trackLivenessAfterRegAlloc(const MachineFunction &MF) const;
58
59   void lowerDynamicAlloc(MachineBasicBlock::iterator II,
60                          int SPAdj, RegScavenger *RS) const;
61   void lowerCRSpilling(MachineBasicBlock::iterator II, unsigned FrameIndex,
62                        int SPAdj, RegScavenger *RS) const;
63   void lowerCRRestore(MachineBasicBlock::iterator II, unsigned FrameIndex,
64                        int SPAdj, RegScavenger *RS) const;
65   bool hasReservedSpillSlot(const MachineFunction &MF, unsigned Reg,
66                             int &FrameIdx) const;
67   void eliminateFrameIndex(MachineBasicBlock::iterator II,
68                            int SPAdj, unsigned FIOperandNum,
69                            RegScavenger *RS = NULL) const;
70
71   // Debug information queries.
72   unsigned getFrameRegister(const MachineFunction &MF) const;
73
74   // Exception handling queries.
75   unsigned getEHExceptionRegister() const;
76   unsigned getEHHandlerRegister() const;
77 };
78
79 } // end namespace llvm
80
81 #endif