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
19 #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;
33 PPCRegisterInfo(const PPCSubtarget &SubTarget);
35 /// getPointerRegClass - Return the register class to use to hold pointers.
36 /// This is used for addressing modes.
37 virtual const TargetRegisterClass *
38 getPointerRegClass(const MachineFunction &MF, unsigned Kind=0) const;
40 unsigned getRegPressureLimit(const TargetRegisterClass *RC,
41 MachineFunction &MF) const;
43 const TargetRegisterClass*
44 getLargestLegalSuperClass(const TargetRegisterClass *RC) const;
46 /// Code Generation virtual methods...
47 const MCPhysReg *getCalleeSavedRegs(const MachineFunction* MF = 0) const;
48 const uint32_t *getCallPreservedMask(CallingConv::ID CC) const;
49 const uint32_t *getNoPreservedMask() const;
51 BitVector getReservedRegs(const MachineFunction &MF) const;
53 /// We require the register scavenger.
54 bool requiresRegisterScavenging(const MachineFunction &MF) const {
58 bool requiresFrameIndexScavenging(const MachineFunction &MF) const {
62 bool trackLivenessAfterRegAlloc(const MachineFunction &MF) const {
66 virtual bool requiresVirtualBaseRegisters(const MachineFunction &MF) const {
70 void lowerDynamicAlloc(MachineBasicBlock::iterator II) const;
71 void lowerCRSpilling(MachineBasicBlock::iterator II,
72 unsigned FrameIndex) const;
73 void lowerCRRestore(MachineBasicBlock::iterator II,
74 unsigned FrameIndex) const;
75 void lowerCRBitSpilling(MachineBasicBlock::iterator II,
76 unsigned FrameIndex) const;
77 void lowerCRBitRestore(MachineBasicBlock::iterator II,
78 unsigned FrameIndex) const;
79 void lowerVRSAVESpilling(MachineBasicBlock::iterator II,
80 unsigned FrameIndex) const;
81 void lowerVRSAVERestore(MachineBasicBlock::iterator II,
82 unsigned FrameIndex) const;
84 bool hasReservedSpillSlot(const MachineFunction &MF, unsigned Reg,
86 void eliminateFrameIndex(MachineBasicBlock::iterator II,
87 int SPAdj, unsigned FIOperandNum,
88 RegScavenger *RS = NULL) const;
90 // Support for virtual base registers.
91 bool needsFrameBaseReg(MachineInstr *MI, int64_t Offset) const;
92 void materializeFrameBaseRegister(MachineBasicBlock *MBB,
93 unsigned BaseReg, int FrameIdx,
94 int64_t Offset) const;
95 void resolveFrameIndex(MachineInstr &MI, unsigned BaseReg,
96 int64_t Offset) const;
97 bool isFrameOffsetLegal(const MachineInstr *MI, int64_t Offset) const;
99 // Debug information queries.
100 unsigned getFrameRegister(const MachineFunction &MF) const;
102 // Base pointer (stack realignment) support.
103 unsigned getBaseRegister(const MachineFunction &MF) const;
104 bool hasBasePointer(const MachineFunction &MF) const;
105 bool canRealignStack(const MachineFunction &MF) const;
106 bool needsStackRealignment(const MachineFunction &MF) const;
109 } // end namespace llvm