1 //===-- PPCRegisterInfo.h - PowerPC Register Information Impl ---*- C++ -*-===//
3 // The LLVM Compiler Infrastructure
5 // This file is distributed under the University of Illinois Open Source
6 // License. See LICENSE.TXT for details.
8 //===----------------------------------------------------------------------===//
10 // This file contains the PowerPC implementation of the TargetRegisterInfo
13 //===----------------------------------------------------------------------===//
15 #ifndef POWERPC32_REGISTERINFO_H
16 #define POWERPC32_REGISTERINFO_H
18 #include "llvm/ADT/DenseMap.h"
21 #define GET_REGINFO_HEADER
22 #include "PPCGenRegisterInfo.inc"
26 class TargetInstrInfo;
29 class PPCRegisterInfo : public PPCGenRegisterInfo {
30 DenseMap<unsigned, unsigned> ImmToIdxMap;
31 const PPCSubtarget &Subtarget;
32 const TargetInstrInfo &TII;
34 PPCRegisterInfo(const PPCSubtarget &SubTarget, const TargetInstrInfo &tii);
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;
41 unsigned getRegPressureLimit(const TargetRegisterClass *RC,
42 MachineFunction &MF) const;
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 const uint32_t *getNoPreservedMask() const;
49 BitVector getReservedRegs(const MachineFunction &MF) const;
51 /// We require the register scavenger.
52 bool requiresRegisterScavenging(const MachineFunction &MF) const {
56 bool requiresFrameIndexScavenging(const MachineFunction &MF) const {
60 bool trackLivenessAfterRegAlloc(const MachineFunction &MF) const {
64 void lowerDynamicAlloc(MachineBasicBlock::iterator II) const;
65 void lowerCRSpilling(MachineBasicBlock::iterator II,
66 unsigned FrameIndex) const;
67 void lowerCRRestore(MachineBasicBlock::iterator II,
68 unsigned FrameIndex) const;
69 void lowerVRSAVESpilling(MachineBasicBlock::iterator II,
70 unsigned FrameIndex) const;
71 void lowerVRSAVERestore(MachineBasicBlock::iterator II,
72 unsigned FrameIndex) const;
74 bool hasReservedSpillSlot(const MachineFunction &MF, unsigned Reg,
76 void eliminateFrameIndex(MachineBasicBlock::iterator II,
77 int SPAdj, unsigned FIOperandNum,
78 RegScavenger *RS = NULL) const;
80 // Debug information queries.
81 unsigned getFrameRegister(const MachineFunction &MF) const;
83 // Exception handling queries.
84 unsigned getEHExceptionRegister() const;
85 unsigned getEHHandlerRegister() const;
88 } // end namespace llvm