1 //===- ARM64RegisterInfo.h - ARM64 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 ARM64 implementation of the MRegisterInfo class.
12 //===----------------------------------------------------------------------===//
14 #ifndef LLVM_TARGET_ARM64REGISTERINFO_H
15 #define LLVM_TARGET_ARM64REGISTERINFO_H
17 #define GET_REGINFO_HEADER
18 #include "ARM64GenRegisterInfo.inc"
24 class MachineFunction;
26 class TargetRegisterClass;
28 struct ARM64RegisterInfo : public ARM64GenRegisterInfo {
30 const ARM64InstrInfo *TII;
31 const ARM64Subtarget *STI;
34 ARM64RegisterInfo(const ARM64InstrInfo *tii, const ARM64Subtarget *sti);
36 /// Code Generation virtual methods...
37 bool isReservedReg(const MachineFunction &MF, unsigned Reg) const;
38 const uint16_t *getCalleeSavedRegs(const MachineFunction *MF = 0) const;
39 const uint32_t *getCallPreservedMask(CallingConv::ID) const;
41 // Calls involved in thread-local variable lookup save more registers than
42 // normal calls, so they need a different mask to represent this.
43 const uint32_t *getTLSCallPreservedMask() const;
45 /// getThisReturnPreservedMask - Returns a call preserved mask specific to the
46 /// case that 'returned' is on an i64 first argument if the calling convention
47 /// is one that can (partially) model this attribute with a preserved mask
48 /// (i.e. it is a calling convention that uses the same register for the first
49 /// i64 argument and an i64 return value)
51 /// Should return NULL in the case that the calling convention does not have
53 const uint32_t *getThisReturnPreservedMask(CallingConv::ID) const;
55 BitVector getReservedRegs(const MachineFunction &MF) const;
56 const TargetRegisterClass *getPointerRegClass(const MachineFunction &MF,
57 unsigned Kind = 0) const;
58 const TargetRegisterClass *
59 getCrossCopyRegClass(const TargetRegisterClass *RC) const;
61 bool requiresRegisterScavenging(const MachineFunction &MF) const;
62 bool useFPForScavengingIndex(const MachineFunction &MF) const;
63 bool requiresFrameIndexScavenging(const MachineFunction &MF) const;
65 bool needsFrameBaseReg(MachineInstr *MI, int64_t Offset) const;
66 bool isFrameOffsetLegal(const MachineInstr *MI, int64_t Offset) const;
67 void materializeFrameBaseRegister(MachineBasicBlock *MBB, unsigned BaseReg,
68 int FrameIdx, int64_t Offset) const;
69 void resolveFrameIndex(MachineBasicBlock::iterator I, unsigned BaseReg,
70 int64_t Offset) const;
71 void eliminateFrameIndex(MachineBasicBlock::iterator II, int SPAdj,
72 unsigned FIOperandNum,
73 RegScavenger *RS = NULL) const;
75 bool cannotEliminateFrame(const MachineFunction &MF) const;
76 bool requiresVirtualBaseRegisters(const MachineFunction &MF) const;
77 bool hasBasePointer(const MachineFunction &MF) const;
78 unsigned getBaseRegister() const;
80 // Debug information queries.
81 unsigned getFrameRegister(const MachineFunction &MF) const;
83 unsigned getRegPressureLimit(const TargetRegisterClass *RC,
84 MachineFunction &MF) const;
87 } // end namespace llvm
89 #endif // LLVM_TARGET_ARM64REGISTERINFO_H