1276479Sdim//==- AArch64RegisterInfo.h - AArch64 Register Information Impl --*- C++ -*-==// 2249259Sdim// 3249259Sdim// The LLVM Compiler Infrastructure 4249259Sdim// 5249259Sdim// This file is distributed under the University of Illinois Open Source 6249259Sdim// License. See LICENSE.TXT for details. 7249259Sdim// 8249259Sdim//===----------------------------------------------------------------------===// 9249259Sdim// 10276479Sdim// This file contains the AArch64 implementation of the MRegisterInfo class. 11249259Sdim// 12249259Sdim//===----------------------------------------------------------------------===// 13249259Sdim 14280031Sdim#ifndef LLVM_LIB_TARGET_AARCH64_AARCH64REGISTERINFO_H 15280031Sdim#define LLVM_LIB_TARGET_AARCH64_AARCH64REGISTERINFO_H 16249259Sdim 17249259Sdim#define GET_REGINFO_HEADER 18249259Sdim#include "AArch64GenRegisterInfo.inc" 19249259Sdim 20249259Sdimnamespace llvm { 21249259Sdim 22276479Sdimclass MachineFunction; 23276479Sdimclass RegScavenger; 24276479Sdimclass TargetRegisterClass; 25288943Sdimclass Triple; 26249259Sdim 27249259Sdimstruct AArch64RegisterInfo : public AArch64GenRegisterInfo { 28276479Sdimprivate: 29288943Sdim const Triple &TT; 30249259Sdim 31276479Sdimpublic: 32288943Sdim AArch64RegisterInfo(const Triple &TT); 33249259Sdim 34276479Sdim bool isReservedReg(const MachineFunction &MF, unsigned Reg) const; 35249259Sdim 36276479Sdim /// Code Generation virtual methods... 37288943Sdim const MCPhysReg *getCalleeSavedRegs(const MachineFunction *MF) const override; 38296417Sdim const MCPhysReg * 39296417Sdim getCalleeSavedRegsViaCopy(const MachineFunction *MF) const override; 40288943Sdim const uint32_t *getCallPreservedMask(const MachineFunction &MF, 41288943Sdim CallingConv::ID) const override; 42249259Sdim 43276479Sdim unsigned getCSRFirstUseCost() const override { 44276479Sdim // The cost will be compared against BlockFrequency where entry has the 45276479Sdim // value of 1 << 14. A value of 5 will choose to spill or split really 46276479Sdim // cold path instead of using a callee-saved register. 47276479Sdim return 5; 48276479Sdim } 49249259Sdim 50276479Sdim // Calls involved in thread-local variable lookup save more registers than 51276479Sdim // normal calls, so they need a different mask to represent this. 52276479Sdim const uint32_t *getTLSCallPreservedMask() const; 53276479Sdim 54276479Sdim /// getThisReturnPreservedMask - Returns a call preserved mask specific to the 55276479Sdim /// case that 'returned' is on an i64 first argument if the calling convention 56276479Sdim /// is one that can (partially) model this attribute with a preserved mask 57276479Sdim /// (i.e. it is a calling convention that uses the same register for the first 58276479Sdim /// i64 argument and an i64 return value) 59276479Sdim /// 60276479Sdim /// Should return NULL in the case that the calling convention does not have 61276479Sdim /// this property 62288943Sdim const uint32_t *getThisReturnPreservedMask(const MachineFunction &MF, 63288943Sdim CallingConv::ID) const; 64276479Sdim 65276479Sdim BitVector getReservedRegs(const MachineFunction &MF) const override; 66249259Sdim const TargetRegisterClass * 67276479Sdim getPointerRegClass(const MachineFunction &MF, 68276479Sdim unsigned Kind = 0) const override; 69276479Sdim const TargetRegisterClass * 70276479Sdim getCrossCopyRegClass(const TargetRegisterClass *RC) const override; 71249259Sdim 72276479Sdim bool requiresRegisterScavenging(const MachineFunction &MF) const override; 73276479Sdim bool useFPForScavengingIndex(const MachineFunction &MF) const override; 74276479Sdim bool requiresFrameIndexScavenging(const MachineFunction &MF) const override; 75249259Sdim 76276479Sdim bool needsFrameBaseReg(MachineInstr *MI, int64_t Offset) const override; 77288943Sdim bool isFrameOffsetLegal(const MachineInstr *MI, unsigned BaseReg, 78276479Sdim int64_t Offset) const override; 79276479Sdim void materializeFrameBaseRegister(MachineBasicBlock *MBB, unsigned BaseReg, 80276479Sdim int FrameIdx, 81276479Sdim int64_t Offset) const override; 82276479Sdim void resolveFrameIndex(MachineInstr &MI, unsigned BaseReg, 83276479Sdim int64_t Offset) const override; 84276479Sdim void eliminateFrameIndex(MachineBasicBlock::iterator II, int SPAdj, 85276479Sdim unsigned FIOperandNum, 86276479Sdim RegScavenger *RS = nullptr) const override; 87276479Sdim bool cannotEliminateFrame(const MachineFunction &MF) const; 88249259Sdim 89276479Sdim bool requiresVirtualBaseRegisters(const MachineFunction &MF) const override; 90276479Sdim bool hasBasePointer(const MachineFunction &MF) const; 91276479Sdim unsigned getBaseRegister() const; 92249259Sdim 93276479Sdim // Debug information queries. 94276479Sdim unsigned getFrameRegister(const MachineFunction &MF) const override; 95249259Sdim 96276479Sdim unsigned getRegPressureLimit(const TargetRegisterClass *RC, 97276479Sdim MachineFunction &MF) const override; 98249259Sdim}; 99249259Sdim 100249259Sdim} // end namespace llvm 101249259Sdim 102280031Sdim#endif 103