34 #define GET_REGINFO_TARGET_DESC 35 #include "AArch64GenRegisterInfo.inc" 44 assert(MF &&
"Invalid MachineFunction pointer.");
48 return CSR_AArch64_NoRegs_SaveList;
50 return CSR_AArch64_AllRegs_SaveList;
53 CSR_AArch64_CXX_TLS_Darwin_PE_SaveList :
54 CSR_AArch64_CXX_TLS_Darwin_SaveList;
58 Attribute::SwiftError))
59 return CSR_AArch64_AAPCS_SwiftError_SaveList;
61 return CSR_AArch64_RT_MostRegs_SaveList;
63 return CSR_AArch64_AAPCS_SaveList;
68 assert(MF &&
"Invalid MachineFunction pointer.");
71 return CSR_AArch64_CXX_TLS_Darwin_ViaCopy_SaveList;
79 if (RC == &AArch64::GPR32allRegClass && Idx == AArch64::hsub)
80 return &AArch64::FPR32RegClass;
81 else if (RC == &AArch64::GPR64allRegClass && Idx == AArch64::hsub)
82 return &AArch64::FPR64RegClass;
85 return AArch64GenRegisterInfo::getSubClassWithSubReg(RC, Idx);
94 return SCS ? CSR_AArch64_NoRegs_SCS_RegMask : CSR_AArch64_NoRegs_RegMask;
96 return SCS ? CSR_AArch64_AllRegs_SCS_RegMask : CSR_AArch64_AllRegs_RegMask;
98 return SCS ? CSR_AArch64_CXX_TLS_Darwin_SCS_RegMask
99 : CSR_AArch64_CXX_TLS_Darwin_RegMask;
103 return SCS ? CSR_AArch64_AAPCS_SwiftError_SCS_RegMask
104 : CSR_AArch64_AAPCS_SwiftError_RegMask;
106 return SCS ? CSR_AArch64_RT_MostRegs_SCS_RegMask
107 : CSR_AArch64_RT_MostRegs_RegMask;
109 return SCS ? CSR_AArch64_AAPCS_SCS_RegMask : CSR_AArch64_AAPCS_RegMask;
114 return CSR_AArch64_TLS_Darwin_RegMask;
117 return CSR_AArch64_TLS_ELF_RegMask;
131 return CSR_AArch64_AAPCS_ThisReturn_RegMask;
135 return CSR_AArch64_StackProbe_Windows_RegMask;
144 markSuperRegs(Reserved, AArch64::WSP);
145 markSuperRegs(Reserved, AArch64::WZR);
148 markSuperRegs(Reserved, AArch64::W29);
151 markSuperRegs(Reserved, AArch64::W18);
154 markSuperRegs(Reserved, AArch64::W20);
157 markSuperRegs(Reserved, AArch64::W19);
159 assert(checkAllSuperRegsMarked(Reserved));
164 unsigned Reg)
const {
193 return PhysReg == AArch64::WZR || PhysReg == AArch64::XZR;
198 unsigned Kind)
const {
199 return &AArch64::GPR64spRegClass;
204 if (RC == &AArch64::CCRRegClass)
205 return &AArch64::GPR64RegClass;
222 if (needsStackRealignment(MF))
240 return TFI->
hasFP(MF) ? AArch64::FP : AArch64::SP;
261 return TFI.
hasFP(MF);
284 assert(i < MI->getNumOperands() &&
285 "Instr doesn't have FrameIndex operand!");
311 int64_t FPOffset = Offset - 16 * 20;
344 assert(Offset <= INT_MAX &&
"Offset too big to fit in int.");
345 assert(MI &&
"Unable to get the legal offset for nil instruction.");
358 if (Ins != MBB->
end())
359 DL = Ins->getDebugLoc();
363 const MCInstrDesc &MCID = TII->get(AArch64::ADDXri);
368 BuildMI(*MBB, Ins, DL, MCID, BaseReg)
387 assert(Done &&
"Unable to resolve frame index!");
392 int SPAdj,
unsigned FIOperandNum,
394 assert(SPAdj == 0 &&
"Unexpected");
409 MI.
getOpcode() == TargetOpcode::PATCHPOINT) {
424 "Emergency spill slot is out of reach");
429 unsigned ScratchReg =
439 switch (RC->
getID()) {
442 case AArch64::GPR32RegClassID:
443 case AArch64::GPR32spRegClassID:
444 case AArch64::GPR32allRegClassID:
445 case AArch64::GPR64spRegClassID:
446 case AArch64::GPR64allRegClassID:
447 case AArch64::GPR64RegClassID:
448 case AArch64::GPR32commonRegClassID:
449 case AArch64::GPR64commonRegClassID:
457 case AArch64::FPR8RegClassID:
458 case AArch64::FPR16RegClassID:
459 case AArch64::FPR32RegClassID:
460 case AArch64::FPR64RegClassID:
461 case AArch64::FPR128RegClassID:
464 case AArch64::DDRegClassID:
465 case AArch64::DDDRegClassID:
466 case AArch64::DDDDRegClassID:
467 case AArch64::QQRegClassID:
468 case AArch64::QQQRegClassID:
469 case AArch64::QQQQRegClassID:
472 case AArch64::FPR128_loRegClassID:
bool isOSDarwin() const
isOSDarwin - Is this a "Darwin" OS (OS X, iOS, or watchOS).
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...
Compute iterated dominance frontiers using a linear time algorithm.
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.
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 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
unsigned getNumOperands() const
Access to explicit operands of the instruction.
const TargetMachine & getTarget() const
getTarget - Return the target machine this machine code is compiled with
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.
bool isX18Reserved() const
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.
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.
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 ==...
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)
emitFrameOffset - Emit instructions as needed to set DestReg to SrcReg plus Offset.
uint16_t MCPhysReg
An unsigned integer type large enough to represent all physical registers, but not necessarily virtua...
bool isX20Reserved() const
void ChangeToImmediate(int64_t ImmVal)
ChangeToImmediate - Replace this operand with a new immediate operand of the specified value...
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.
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.
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
const MCPhysReg * getCalleeSavedRegs(const MachineFunction *MF) const override
Code Generation virtual methods...
const MachineInstrBuilder & addFrameIndex(int Idx) const
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
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
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
bool requiresVirtualBaseRegisters(const MachineFunction &MF) const override
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
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
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
unsigned createVirtualRegister(const TargetRegisterClass *RegClass, StringRef Name="")
createVirtualRegister - Create and return a new virtual register in the function with the specified r...