LLVM 22.0.0git
AArch64RegisterInfo.h
Go to the documentation of this file.
1//==- AArch64RegisterInfo.h - AArch64 Register Information Impl --*- C++ -*-==//
2//
3// Part of the LLVM Project, under the Apache License v2.0 with LLVM Exceptions.
4// See https://llvm.org/LICENSE.txt for license information.
5// SPDX-License-Identifier: Apache-2.0 WITH LLVM-exception
6//
7//===----------------------------------------------------------------------===//
8//
9// This file contains the AArch64 implementation of the MRegisterInfo class.
10//
11//===----------------------------------------------------------------------===//
12
13#ifndef LLVM_LIB_TARGET_AARCH64_AARCH64REGISTERINFO_H
14#define LLVM_LIB_TARGET_AARCH64_AARCH64REGISTERINFO_H
15
16#define GET_REGINFO_HEADER
17#include "AArch64GenRegisterInfo.inc"
18
19namespace llvm {
20
21class MachineFunction;
22class RegScavenger;
23class TargetRegisterClass;
24class Triple;
25
27 const Triple &TT;
28
29public:
30 AArch64RegisterInfo(const Triple &TT, unsigned HwMode);
31
32 // FIXME: This should be tablegen'd like getDwarfRegNum is
33 int getSEHRegNum(unsigned i) const {
34 return getEncodingValue(i);
35 }
36
37 bool isReservedReg(const MachineFunction &MF, MCRegister Reg) const;
38 bool isUserReservedReg(const MachineFunction &MF, MCRegister Reg) const;
40 bool isAnyArgRegReserved(const MachineFunction &MF) const;
41 void emitReservedArgRegCallError(const MachineFunction &MF) const;
42
45 const uint32_t **Mask) const;
46
47 /// Code Generation virtual methods...
48 const MCPhysReg *getCalleeSavedRegs(const MachineFunction *MF) const override;
50 const MCPhysReg *
53 CallingConv::ID) const override;
55 CallingConv::ID) const;
56
57 unsigned getCSRFirstUseCost() const override {
58 // The cost will be compared against BlockFrequency where entry has the
59 // value of 1 << 14. A value of 5 will choose to spill or split really
60 // cold path instead of using a callee-saved register.
61 return 5;
62 }
63
66 unsigned Idx) const override;
67
68 // Calls involved in thread-local variable lookup save more registers than
69 // normal calls, so they need a different mask to represent this.
70 const uint32_t *getTLSCallPreservedMask() const;
71
74
75 // Funclets on ARM64 Windows don't preserve any registers.
76 const uint32_t *getNoPreservedMask() const override;
77
78 // Unwinders may not preserve all Neon and SVE registers.
79 const uint32_t *
80 getCustomEHPadPreservedMask(const MachineFunction &MF) const override;
81
82 /// getThisReturnPreservedMask - Returns a call preserved mask specific to the
83 /// case that 'returned' is on an i64 first argument if the calling convention
84 /// is one that can (partially) model this attribute with a preserved mask
85 /// (i.e. it is a calling convention that uses the same register for the first
86 /// i64 argument and an i64 return value)
87 ///
88 /// Should return NULL in the case that the calling convention does not have
89 /// this property
91 CallingConv::ID) const;
92
93 /// Stack probing calls preserve different CSRs to the normal CC.
95
98 BitVector getReservedRegs(const MachineFunction &MF) const override;
99 std::optional<std::string>
101 MCRegister PhysReg) const override;
102 bool isAsmClobberable(const MachineFunction &MF,
103 MCRegister PhysReg) const override;
104 const TargetRegisterClass *
106 unsigned Kind = 0) const override;
107 const TargetRegisterClass *
108 getCrossCopyRegClass(const TargetRegisterClass *RC) const override;
109
110 bool requiresRegisterScavenging(const MachineFunction &MF) const override;
111 bool useFPForScavengingIndex(const MachineFunction &MF) const override;
112 bool requiresFrameIndexScavenging(const MachineFunction &MF) const override;
113
114 bool needsFrameBaseReg(MachineInstr *MI, int64_t Offset) const override;
115 bool isFrameOffsetLegal(const MachineInstr *MI, Register BaseReg,
116 int64_t Offset) const override;
118 int64_t Offset) const override;
120 int64_t Offset) const override;
122 unsigned FIOperandNum,
123 RegScavenger *RS = nullptr) const override;
124 bool cannotEliminateFrame(const MachineFunction &MF) const;
125
126 bool requiresVirtualBaseRegisters(const MachineFunction &MF) const override;
127 bool hasBasePointer(const MachineFunction &MF) const;
128 unsigned getBaseRegister() const;
129
130 bool isArgumentRegister(const MachineFunction &MF,
131 MCRegister Reg) const override;
132
133 // Debug information queries.
134 Register getFrameRegister(const MachineFunction &MF) const override;
135
136 unsigned getRegPressureLimit(const TargetRegisterClass *RC,
137 MachineFunction &MF) const override;
138
141 const MachineFunction &MF, const VirtRegMap *VRM,
142 const LiveRegMatrix *Matrix) const override;
143
144 unsigned getLocalAddressRegister(const MachineFunction &MF) const;
145 bool regNeedsCFI(MCRegister Reg, MCRegister &RegToUseForCFI) const;
146
147 /// SrcRC and DstRC will be morphed into NewRC if this returns true
149 unsigned SubReg, const TargetRegisterClass *DstRC,
150 unsigned DstSubReg, const TargetRegisterClass *NewRC,
151 LiveIntervals &LIS) const override;
152
154 SmallVectorImpl<uint64_t> &Ops) const override;
155
157
158 virtual bool isIgnoredCVReg(MCRegister LLVMReg) const override;
159};
160
161} // end namespace llvm
162
163#endif
unsigned SubReg
MachineBasicBlock & MBB
IRTranslator LLVM IR MI
const AbstractManglingParser< Derived, Alloc >::OperatorInfo AbstractManglingParser< Derived, Alloc >::Ops[]
Live Register Matrix
Register Reg
uint64_t IntrinsicInst * II
BitVector getStrictlyReservedRegs(const MachineFunction &MF) const
const TargetRegisterClass * getCrossCopyRegClass(const TargetRegisterClass *RC) const override
const uint32_t * getThisReturnPreservedMask(const MachineFunction &MF, CallingConv::ID) const
getThisReturnPreservedMask - Returns a call preserved mask specific to the case that 'returned' is on...
int getSEHRegNum(unsigned i) const
bool isReservedReg(const MachineFunction &MF, MCRegister Reg) const
const uint32_t * getCallPreservedMask(const MachineFunction &MF, CallingConv::ID) const override
unsigned getCSRFirstUseCost() const override
const MCPhysReg * getCalleeSavedRegsViaCopy(const MachineFunction *MF) const
virtual bool isIgnoredCVReg(MCRegister LLVMReg) const override
BitVector getReservedRegs(const MachineFunction &MF) const override
bool shouldCoalesce(MachineInstr *MI, const TargetRegisterClass *SrcRC, unsigned SubReg, const TargetRegisterClass *DstRC, unsigned DstSubReg, const TargetRegisterClass *NewRC, LiveIntervals &LIS) const override
SrcRC and DstRC will be morphed into NewRC if this returns true.
bool requiresVirtualBaseRegisters(const MachineFunction &MF) const override
bool isUserReservedReg(const MachineFunction &MF, MCRegister Reg) const
const TargetRegisterClass * getSubClassWithSubReg(const TargetRegisterClass *RC, unsigned Idx) const override
unsigned getRegPressureLimit(const TargetRegisterClass *RC, MachineFunction &MF) const override
bool getRegAllocationHints(Register VirtReg, ArrayRef< MCPhysReg > Order, SmallVectorImpl< MCPhysReg > &Hints, const MachineFunction &MF, const VirtRegMap *VRM, const LiveRegMatrix *Matrix) const override
Register materializeFrameBaseRegister(MachineBasicBlock *MBB, int FrameIdx, int64_t Offset) const override
Insert defining instruction(s) for BaseReg to be a pointer to FrameIdx at the beginning of the basic ...
const TargetRegisterClass * getPointerRegClass(const MachineFunction &MF, unsigned Kind=0) const override
void UpdateCustomCalleeSavedRegs(MachineFunction &MF) const
bool requiresRegisterScavenging(const MachineFunction &MF) const override
bool isFrameOffsetLegal(const MachineInstr *MI, Register BaseReg, int64_t Offset) const override
BitVector getUserReservedRegs(const MachineFunction &MF) const
void resolveFrameIndex(MachineInstr &MI, Register BaseReg, int64_t Offset) const override
bool needsFrameBaseReg(MachineInstr *MI, int64_t Offset) const override
needsFrameBaseReg - Returns true if the instruction's frame index reference would be better served by...
const uint32_t * getWindowsStackProbePreservedMask() const
Stack probing calls preserve different CSRs to the normal CC.
bool regNeedsCFI(MCRegister Reg, MCRegister &RegToUseForCFI) const
Return whether the register needs a CFI entry.
bool isAnyArgRegReserved(const MachineFunction &MF) const
void emitReservedArgRegCallError(const MachineFunction &MF) const
bool isStrictlyReservedReg(const MachineFunction &MF, MCRegister Reg) const
bool eliminateFrameIndex(MachineBasicBlock::iterator II, int SPAdj, unsigned FIOperandNum, RegScavenger *RS=nullptr) const override
const uint32_t * getTLSCallPreservedMask() const
const uint32_t * getNoPreservedMask() const override
Register getFrameRegister(const MachineFunction &MF) const override
bool shouldAnalyzePhysregInMachineLoopInfo(MCRegister R) const override
void getOffsetOpcodes(const StackOffset &Offset, SmallVectorImpl< uint64_t > &Ops) const override
const MCPhysReg * getDarwinCalleeSavedRegs(const MachineFunction *MF) const
bool isAsmClobberable(const MachineFunction &MF, MCRegister PhysReg) const override
AArch64RegisterInfo(const Triple &TT, unsigned HwMode)
const uint32_t * SMEABISupportRoutinesCallPreservedMaskFromX0() const
const MCPhysReg * getCalleeSavedRegs(const MachineFunction *MF) const override
Code Generation virtual methods...
const uint32_t * getCustomEHPadPreservedMask(const MachineFunction &MF) const override
unsigned getLocalAddressRegister(const MachineFunction &MF) const
bool hasBasePointer(const MachineFunction &MF) const
const uint32_t * getDarwinCallPreservedMask(const MachineFunction &MF, CallingConv::ID) const
const uint32_t * getSMStartStopCallPreservedMask() const
bool useFPForScavengingIndex(const MachineFunction &MF) const override
bool cannotEliminateFrame(const MachineFunction &MF) const
bool isArgumentRegister(const MachineFunction &MF, MCRegister Reg) const override
void UpdateCustomCallPreservedMask(MachineFunction &MF, const uint32_t **Mask) const
std::optional< std::string > explainReservedReg(const MachineFunction &MF, MCRegister PhysReg) const override
bool requiresFrameIndexScavenging(const MachineFunction &MF) const override
ArrayRef - Represent a constant reference to an array (0 or more elements consecutively in memory),...
Definition ArrayRef.h:41
Wrapper class representing physical registers. Should be passed by value.
Definition MCRegister.h:33
MachineInstrBundleIterator< MachineInstr > iterator
Representation of each machine instruction.
Wrapper class representing virtual and physical registers.
Definition Register.h:19
This class consists of common code factored out of the SmallVector class to reduce code duplication b...
StackOffset holds a fixed and a scalable offset in bytes.
Definition TypeSize.h:31
Triple - Helper class for working with autoconf configuration names.
Definition Triple.h:47
unsigned ID
LLVM IR allows to use arbitrary numbers as calling convention identifiers.
Definition CallingConv.h:24
This is an optimization pass for GlobalISel generic memory operations.
@ Offset
Definition DWP.cpp:477
uint16_t MCPhysReg
An unsigned integer type large enough to represent all physical registers, but not necessarily virtua...
Definition MCRegister.h:21