1235633Sdim//===-- PPCRegisterInfo.h - PowerPC Register Information Impl ---*- C++ -*-===// 2193323Sed// 3193323Sed// The LLVM Compiler Infrastructure 4193323Sed// 5193323Sed// This file is distributed under the University of Illinois Open Source 6193323Sed// License. See LICENSE.TXT for details. 7193323Sed// 8193323Sed//===----------------------------------------------------------------------===// 9193323Sed// 10193323Sed// This file contains the PowerPC implementation of the TargetRegisterInfo 11193323Sed// class. 12193323Sed// 13193323Sed//===----------------------------------------------------------------------===// 14193323Sed 15193323Sed#ifndef POWERPC32_REGISTERINFO_H 16193323Sed#define POWERPC32_REGISTERINFO_H 17193323Sed 18252723Sdim#include "llvm/ADT/DenseMap.h" 19193323Sed#include "PPC.h" 20193323Sed 21224145Sdim#define GET_REGINFO_HEADER 22224145Sdim#include "PPCGenRegisterInfo.inc" 23224145Sdim 24193323Sednamespace llvm { 25193323Sedclass PPCSubtarget; 26193323Sedclass TargetInstrInfo; 27193323Sedclass Type; 28193323Sed 29193323Sedclass PPCRegisterInfo : public PPCGenRegisterInfo { 30252723Sdim DenseMap<unsigned, unsigned> ImmToIdxMap; 31193323Sed const PPCSubtarget &Subtarget; 32193323Sedpublic: 33263509Sdim PPCRegisterInfo(const PPCSubtarget &SubTarget); 34193323Sed 35193323Sed /// getPointerRegClass - Return the register class to use to hold pointers. 36193323Sed /// This is used for addressing modes. 37245431Sdim virtual const TargetRegisterClass * 38245431Sdim getPointerRegClass(const MachineFunction &MF, unsigned Kind=0) const; 39193323Sed 40235633Sdim unsigned getRegPressureLimit(const TargetRegisterClass *RC, 41235633Sdim MachineFunction &MF) const; 42235633Sdim 43193323Sed /// Code Generation virtual methods... 44235633Sdim const uint16_t *getCalleeSavedRegs(const MachineFunction* MF = 0) const; 45245431Sdim const uint32_t *getCallPreservedMask(CallingConv::ID CC) const; 46252723Sdim const uint32_t *getNoPreservedMask() const; 47193323Sed 48193323Sed BitVector getReservedRegs(const MachineFunction &MF) const; 49193323Sed 50252723Sdim /// We require the register scavenger. 51252723Sdim bool requiresRegisterScavenging(const MachineFunction &MF) const { 52252723Sdim return true; 53252723Sdim } 54245431Sdim 55252723Sdim bool requiresFrameIndexScavenging(const MachineFunction &MF) const { 56252723Sdim return true; 57252723Sdim } 58193323Sed 59252723Sdim bool trackLivenessAfterRegAlloc(const MachineFunction &MF) const { 60252723Sdim return true; 61252723Sdim } 62245431Sdim 63252723Sdim virtual bool requiresVirtualBaseRegisters(const MachineFunction &MF) const { 64252723Sdim return true; 65252723Sdim } 66193323Sed 67252723Sdim void lowerDynamicAlloc(MachineBasicBlock::iterator II) const; 68252723Sdim void lowerCRSpilling(MachineBasicBlock::iterator II, 69252723Sdim unsigned FrameIndex) const; 70252723Sdim void lowerCRRestore(MachineBasicBlock::iterator II, 71252723Sdim unsigned FrameIndex) const; 72252723Sdim void lowerVRSAVESpilling(MachineBasicBlock::iterator II, 73252723Sdim unsigned FrameIndex) const; 74252723Sdim void lowerVRSAVERestore(MachineBasicBlock::iterator II, 75252723Sdim unsigned FrameIndex) const; 76252723Sdim 77245431Sdim bool hasReservedSpillSlot(const MachineFunction &MF, unsigned Reg, 78245431Sdim int &FrameIdx) const; 79212904Sdim void eliminateFrameIndex(MachineBasicBlock::iterator II, 80252723Sdim int SPAdj, unsigned FIOperandNum, 81252723Sdim RegScavenger *RS = NULL) const; 82193323Sed 83252723Sdim // Support for virtual base registers. 84252723Sdim bool needsFrameBaseReg(MachineInstr *MI, int64_t Offset) const; 85252723Sdim void materializeFrameBaseRegister(MachineBasicBlock *MBB, 86252723Sdim unsigned BaseReg, int FrameIdx, 87252723Sdim int64_t Offset) const; 88252723Sdim void resolveFrameIndex(MachineBasicBlock::iterator I, 89252723Sdim unsigned BaseReg, int64_t Offset) const; 90252723Sdim bool isFrameOffsetLegal(const MachineInstr *MI, int64_t Offset) const; 91252723Sdim 92193323Sed // Debug information queries. 93199481Srdivacky unsigned getFrameRegister(const MachineFunction &MF) const; 94193323Sed 95263509Sdim // Base pointer (stack realignment) support. 96263509Sdim unsigned getBaseRegister(const MachineFunction &MF) const; 97263509Sdim bool hasBasePointer(const MachineFunction &MF) const; 98263509Sdim bool canRealignStack(const MachineFunction &MF) const; 99263509Sdim bool needsStackRealignment(const MachineFunction &MF) const; 100193323Sed}; 101193323Sed 102193323Sed} // end namespace llvm 103193323Sed 104193323Sed#endif 105