35 #define GET_REGINFO_TARGET_DESC 36 #include "AArch64GenRegisterInfo.inc" 45 assert(MF &&
"Invalid MachineFunction pointer.");
47 return CSR_Win_AArch64_AAPCS_SaveList;
51 return CSR_AArch64_NoRegs_SaveList;
53 return CSR_AArch64_AllRegs_SaveList;
55 return CSR_AArch64_AAVPCS_SaveList;
58 CSR_AArch64_CXX_TLS_Darwin_PE_SaveList :
59 CSR_AArch64_CXX_TLS_Darwin_SaveList;
64 return CSR_AArch64_AAPCS_SwiftError_SaveList;
66 return CSR_AArch64_RT_MostRegs_SaveList;
68 return CSR_AArch64_AAPCS_SaveList;
73 assert(MF &&
"Invalid MachineFunction pointer.");
76 return CSR_AArch64_CXX_TLS_Darwin_ViaCopy_SaveList;
87 for (
size_t i = 0; i < AArch64::GPR64commonRegClass.getNumRegs(); ++i) {
89 UpdatedCSRs.
push_back(AArch64::GPR64commonRegClass.getRegister(i));
101 if (RC == &AArch64::GPR32allRegClass && Idx == AArch64::hsub)
102 return &AArch64::FPR32RegClass;
103 else if (RC == &AArch64::GPR64allRegClass && Idx == AArch64::hsub)
104 return &AArch64::FPR64RegClass;
107 return AArch64GenRegisterInfo::getSubClassWithSubReg(RC, Idx);
116 return SCS ? CSR_AArch64_NoRegs_SCS_RegMask : CSR_AArch64_NoRegs_RegMask;
118 return SCS ? CSR_AArch64_AllRegs_SCS_RegMask : CSR_AArch64_AllRegs_RegMask;
120 return SCS ? CSR_AArch64_CXX_TLS_Darwin_SCS_RegMask
121 : CSR_AArch64_CXX_TLS_Darwin_RegMask;
123 return SCS ? CSR_AArch64_AAVPCS_SCS_RegMask : CSR_AArch64_AAVPCS_RegMask;
127 return SCS ? CSR_AArch64_AAPCS_SwiftError_SCS_RegMask
128 : CSR_AArch64_AAPCS_SwiftError_RegMask;
130 return SCS ? CSR_AArch64_RT_MostRegs_SCS_RegMask
131 : CSR_AArch64_RT_MostRegs_RegMask;
133 return SCS ? CSR_AArch64_AAPCS_SCS_RegMask : CSR_AArch64_AAPCS_RegMask;
138 return CSR_AArch64_TLS_Darwin_RegMask;
141 return CSR_AArch64_TLS_ELF_RegMask;
148 memcpy(UpdatedMask, *Mask,
sizeof(UpdatedMask[0]) * RegMaskSize);
150 for (
size_t i = 0; i < AArch64::GPR64commonRegClass.getNumRegs(); ++i) {
165 return CSR_AArch64_NoRegs_RegMask;
179 return CSR_AArch64_AAPCS_ThisReturn_RegMask;
183 return CSR_AArch64_StackProbe_Windows_RegMask;
192 markSuperRegs(Reserved, AArch64::WSP);
193 markSuperRegs(Reserved, AArch64::WZR);
196 markSuperRegs(Reserved, AArch64::W29);
198 for (
size_t i = 0; i < AArch64::GPR32commonRegClass.getNumRegs(); ++i) {
200 markSuperRegs(Reserved, AArch64::GPR32commonRegClass.getRegister(i));
204 markSuperRegs(Reserved, AArch64::W19);
208 markSuperRegs(Reserved, AArch64::W16);
210 assert(checkAllSuperRegsMarked(Reserved));
215 unsigned Reg)
const {
222 AArch64::X3, AArch64::X4, AArch64::X5,
223 AArch64::X6, AArch64::X7 };
232 " function calls if any of the argument registers is reserved."});
236 unsigned PhysReg)
const {
241 return PhysReg == AArch64::WZR || PhysReg == AArch64::XZR;
246 unsigned Kind)
const {
247 return &AArch64::GPR64spRegClass;
252 if (RC == &AArch64::CCRRegClass)
253 return &AArch64::GPR64RegClass;
271 if (needsStackRealignment(MF))
310 return TFI.
hasFP(MF);
333 assert(i < MI->getNumOperands() &&
334 "Instr doesn't have FrameIndex operand!");
360 int64_t FPOffset = Offset - 16 * 20;
393 assert(Offset <= INT_MAX &&
"Offset too big to fit in int.");
394 assert(MI &&
"Unable to get the legal offset for nil instruction.");
407 if (Ins != MBB->
end())
408 DL = Ins->getDebugLoc();
412 const MCInstrDesc &MCID = TII->get(AArch64::ADDXri);
417 BuildMI(*MBB, Ins, DL, MCID, BaseReg)
436 assert(Done &&
"Unable to resolve frame index!");
441 int SPAdj,
unsigned FIOperandNum,
443 assert(SPAdj == 0 &&
"Unexpected");
458 MI.
getOpcode() == TargetOpcode::PATCHPOINT) {
470 if (MI.
getOpcode() == TargetOpcode::LOCAL_ESCAPE) {
480 "Emergency spill slot is out of reach");
485 unsigned ScratchReg =
495 switch (RC->
getID()) {
498 case AArch64::GPR32RegClassID:
499 case AArch64::GPR32spRegClassID:
500 case AArch64::GPR32allRegClassID:
501 case AArch64::GPR64spRegClassID:
502 case AArch64::GPR64allRegClassID:
503 case AArch64::GPR64RegClassID:
504 case AArch64::GPR32commonRegClassID:
505 case AArch64::GPR64commonRegClassID:
510 case AArch64::FPR8RegClassID:
511 case AArch64::FPR16RegClassID:
512 case AArch64::FPR32RegClassID:
513 case AArch64::FPR64RegClassID:
514 case AArch64::FPR128RegClassID:
517 case AArch64::DDRegClassID:
518 case AArch64::DDDRegClassID:
519 case AArch64::DDDDRegClassID:
520 case AArch64::QQRegClassID:
521 case AArch64::QQQRegClassID:
522 case AArch64::QQQQRegClassID:
525 case AArch64::FPR128_loRegClassID:
bool isOSDarwin() const
isOSDarwin - Is this a "Darwin" OS (OS X, iOS, or watchOS).
static unsigned getRegMaskSize(unsigned NumRegs)
Returns number of elements needed for a regmask array.
const_iterator end(StringRef path)
Get end iterator over path.
bool isScavengingFrameIndex(int FI) const
Query whether a frame index is a scavenging frame index.
AArch64FunctionInfo - This class is derived from MachineFunctionInfo and contains private AArch64-spe...
Diagnostic information for unsupported feature in backend.
const_iterator begin(StringRef path, Style style=Style::native)
Get begin iterator over path.
This class represents lattice values for constants.
void ChangeToRegister(unsigned Reg, bool isDef, bool isImp=false, bool isKill=false, bool isDead=false, bool isUndef=false, bool isDebug=false)
ChangeToRegister - Replace this operand with a new register operand of the specified value...
bool isOSBinFormatELF() const
Tests whether the OS uses the ELF binary format.
void push_back(const T &Elt)
const DebugLoc & getDebugLoc() const
Returns the debug location id of this MachineInstr.
bool cannotEliminateFrame(const MachineFunction &MF) const
Describe properties that are true of each instruction in the target description file.
int64_t getLocalFrameSize() const
Get the size of the local object blob.
bool isFrameOffsetLegal(const MachineInstr *MI, unsigned BaseReg, int64_t Offset) const override
bool hasFnAttribute(Attribute::AttrKind Kind) const
Return true if the function has the attribute.
bool adjustsStack() const
Return true if this function adjusts the stack – e.g., when calling another function.
bool isAnyArgRegReserved(const MachineFunction &MF) const
bool supportSwiftError() const override
Return true if the target supports swifterror attribute.
unsigned getFrameRegister(const MachineFunction &MF) const override
bool isFrameAddressTaken() const
This method may be called any time after instruction selection is complete to determine if there is a...
const HexagonInstrInfo * TII
void emitFrameOffset(MachineBasicBlock &MBB, MachineBasicBlock::iterator MBBI, const DebugLoc &DL, unsigned DestReg, unsigned SrcReg, int Offset, const TargetInstrInfo *TII, MachineInstr::MIFlag=MachineInstr::NoFlags, bool SetNZCV=false, bool NeedsWinCFI=false)
emitFrameOffset - Emit instructions as needed to set DestReg to SrcReg plus Offset.
unsigned getNumOperands() const
Retuns the total number of operands.
bool requiresFrameIndexScavenging(const MachineFunction &MF) const override
The MachineFrameInfo class represents an abstract stack frame until prolog/epilog code is inserted...
bool hasVarSizedObjects() const
This method may be called any time after instruction selection is complete to determine if the stack ...
unsigned getOpcode() const
Returns the opcode of this MachineInstr.
unsigned getID() const
Return the register class ID number.
int isAArch64FrameOffsetLegal(const MachineInstr &MI, int &Offset, bool *OutUseUnscaledOp=nullptr, unsigned *OutUnscaledOp=nullptr, int *EmittableOffset=nullptr)
Check if the Offset is a valid frame offset for MI.
const uint32_t * getNoPreservedMask() const override
bool DisableFramePointerElim(const MachineFunction &MF) const
DisableFramePointerElim - This returns true if frame pointer elimination optimization should be disab...
AArch64RegisterInfo(const Triple &TT)
AttributeList getAttributes() const
Return the attribute list for this Function.
static const MCPhysReg GPRArgRegs[]
bool isXRegisterReserved(size_t i) const
const TargetRegisterClass * constrainRegClass(unsigned Reg, const TargetRegisterClass *RC, unsigned MinNumRegs=0)
constrainRegClass - Constrain the register class of the specified virtual register to be a common sub...
const uint32_t * getCallPreservedMask(const MachineFunction &MF, CallingConv::ID) const override
static unsigned getShifterImm(AArch64_AM::ShiftExtendType ST, unsigned Imm)
getShifterImm - Encode the shift type and amount: imm: 6-bit shift amount shifter: 000 ==> lsl 001 ==...
uint16_t MCPhysReg
An unsigned integer type large enough to represent all physical registers, but not necessarily virtua...
void ChangeToImmediate(int64_t ImmVal)
ChangeToImmediate - Replace this operand with a new immediate operand of the specified value...
bool isTargetWindows() const
void materializeFrameBaseRegister(MachineBasicBlock *MBB, unsigned BaseReg, 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 ...
bool hasAttrSomewhere(Attribute::AttrKind Kind, unsigned *Index=nullptr) const
Return true if the specified attribute is set for at least one parameter or for the return value...
MachineInstrBuilder BuildMI(MachineFunction &MF, const DebugLoc &DL, const MCInstrDesc &MCID)
Builder interface. Specify how to create the initial instruction itself.
const AArch64TargetLowering * getTargetLowering() const override
const TargetRegisterClass * getPointerRegClass(const MachineFunction &MF, unsigned Kind=0) const override
bool mayStore(QueryType Type=AnyInBundle) const
Return true if this instruction could possibly modify memory.
This file declares the machine register scavenger class.
unsigned const MachineRegisterInfo * MRI
const TargetSubtargetInfo & getSubtarget() const
getSubtarget - Return the subtarget for which this machine code is being compiled.
MachineFrameInfo & getFrameInfo()
getFrameInfo - Return the frame info object for the current function.
bool hasEHFunclets() const
int resolveFrameIndexReference(const MachineFunction &MF, int FI, unsigned &FrameReg, bool PreferFP=false) const
void eliminateFrameIndex(MachineBasicBlock::iterator II, int SPAdj, unsigned FIOperandNum, RegScavenger *RS=nullptr) const override
bool rewriteAArch64FrameIndex(MachineInstr &MI, unsigned FrameRegIdx, unsigned FrameReg, int &Offset, const AArch64InstrInfo *TII)
rewriteAArch64FrameIndex - Rewrite MI to access 'Offset' bytes from the FP.
bool any_of(R &&range, UnaryPredicate P)
Provide wrappers to std::any_of which take ranges instead of having to pass begin/end explicitly...
Ty * getInfo()
getInfo - Keep track of various per-function pieces of information for backends that would like to do...
const uint32_t * getThisReturnPreservedMask(const MachineFunction &MF, CallingConv::ID) const
getThisReturnPreservedMask - Returns a call preserved mask specific to the case that 'returned' is on...
const MCPhysReg * getCalleeSavedRegsViaCopy(const MachineFunction *MF) const
void setCalleeSavedRegs(ArrayRef< MCPhysReg > CSRs)
Sets the updated Callee Saved Registers list.
const MCPhysReg * getCalleeSavedRegs(const MachineFunction *MF) const override
Code Generation virtual methods...
const MachineInstrBuilder & addFrameIndex(int Idx) const
LLVMContext & getContext() const
getContext - Return a reference to the LLVMContext associated with this function. ...
MCSubRegIterator enumerates all sub-registers of Reg.
Triple - Helper class for working with autoconf configuration names.
CallingConv::ID getCallingConv() const
getCallingConv()/setCallingConv(CC) - These method get and set the calling convention of this functio...
bool isDebugValue() const
MachineOperand class - Representation of each machine instruction operand.
This is a 'vector' (really, a variable-sized array), optimized for the case when the array is small...
uint32_t * allocateRegMask()
Allocate and initialize a register mask with NumRegister bits.
void resolveFrameIndex(MachineInstr &MI, unsigned BaseReg, int64_t Offset) const override
const Function & getFunction() const
Return the LLVM function that this machine code represents.
const TargetRegisterClass * getSubClassWithSubReg(const TargetRegisterClass *RC, unsigned Idx) const override
unsigned getNumXRegisterReserved() const
void UpdateCustomCallPreservedMask(MachineFunction &MF, const uint32_t **Mask) const
const uint32_t * getWindowsStackProbePreservedMask() const
Stack probing calls preserve different CSRs to the normal CC.
bool hasFP(const MachineFunction &MF) const override
hasFP - Return true if the specified function should have a dedicated frame pointer register...
const MachineBasicBlock * getParent() const
MachineRegisterInfo - Keep track of information for virtual and physical registers, including vreg register classes, use/def chains for registers, etc.
void initLLVMToCVRegMapping(MCRegisterInfo *MRI)
bool isReservedReg(const MachineFunction &MF, unsigned Reg) const
Representation of each machine instruction.
BitVector getReservedRegs(const MachineFunction &MF) const override
void UpdateCustomCalleeSavedRegs(MachineFunction &MF) const
bool requiresVirtualBaseRegisters(const MachineFunction &MF) const override
void emitReservedArgRegCallError(const MachineFunction &MF) const
const MachineFunction * getParent() const
Return the MachineFunction containing this basic block.
const MachineInstrBuilder & addImm(int64_t Val) const
Add a new immediate operand.
MachineRegisterInfo & getRegInfo()
getRegInfo - Return information about the registers currently in use.
bool useFPForScavengingIndex(const MachineFunction &MF) const override
bool isFI() const
isFI - Tests if this is a MO_FrameIndex operand.
bool requiresRegisterScavenging(const MachineFunction &MF) const override
const uint32_t * getTLSCallPreservedMask() const
void diagnose(const DiagnosticInfo &DI)
Report a message to the currently installed diagnostic handler.
const LLVMTargetMachine & getTarget() const
getTarget - Return the target machine this machine code is compiled with
unsigned getRegPressureLimit(const TargetRegisterClass *RC, MachineFunction &MF) const override
bool mayLoad(QueryType Type=AnyInBundle) const
Return true if this instruction could possibly read memory.
assert(ImpDefSCC.getReg()==AMDGPU::SCC &&ImpDefSCC.isDef())
bool isConstantPhysReg(unsigned PhysReg) const override
bool hasBasePointer(const MachineFunction &MF) const
bool isXRegCustomCalleeSaved(size_t i) const
std::underlying_type< E >::type Mask()
Get a bitmask with 1s in all places up to the high-order bit of E's largest value.
const TargetRegisterClass * getCrossCopyRegClass(const TargetRegisterClass *RC) 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 MachineOperand & getOperand(unsigned i) const
unsigned getBaseRegister() const
bool isAsmClobberable(const MachineFunction &MF, unsigned PhysReg) const override
unsigned createVirtualRegister(const TargetRegisterClass *RegClass, StringRef Name="")
createVirtualRegister - Create and return a new virtual register in the function with the specified r...