39#define GET_REGINFO_TARGET_DESC
40#include "X86GenRegisterInfo.inc"
44 cl::desc(
"Enable use of a base pointer for complex stack frames"));
49 cl::desc(
"Disable two address hints for register "
54 cl::desc(
"Basic block count threshold for emitting a warning about "
55 "callee-saved registers reserved due to setjmp"));
63 (TT.isX86_64() ?
X86::RIP :
X86::EIP)) {
67 Is64Bit = TT.isX86_64();
68 IsTarget64BitLP64 = Is64Bit && !TT.isX32();
69 IsWin64 = Is64Bit && TT.isOSWindows();
70 IsUEFI64 = Is64Bit && TT.isUEFI();
80 bool Use64BitReg = !TT.isX32();
81 StackPtr = Use64BitReg ? X86::RSP : X86::ESP;
82 FramePtr = Use64BitReg ? X86::RBP : X86::EBP;
83 BasePtr = Use64BitReg ? X86::RBX : X86::EBX;
97 if (!Is64Bit && Idx == X86::sub_8bit)
98 Idx = X86::sub_8bit_hi;
101 return X86GenRegisterInfo::getSubClassWithSubReg(RC, Idx);
107 unsigned SubIdx)
const {
109 if (!Is64Bit && SubIdx == X86::sub_8bit) {
110 A = X86GenRegisterInfo::getSubClassWithSubReg(
A, X86::sub_8bit_hi);
114 return X86GenRegisterInfo::getMatchingSuperRegClass(
A,
B, SubIdx);
128 if (RC == &X86::GR8_NOREXRegClass)
142 switch (Super->getID()) {
143 case X86::FR32RegClassID:
144 case X86::FR64RegClassID:
147 getRegSizeInBits(*Super) == getRegSizeInBits(*RC))
150 case X86::VR128RegClassID:
151 case X86::VR256RegClassID:
153 if (!Subtarget.hasVLX() &&
154 getRegSizeInBits(*Super) == getRegSizeInBits(*RC))
157 case X86::VR128XRegClassID:
158 case X86::VR256XRegClassID:
160 if (Subtarget.hasVLX() &&
161 getRegSizeInBits(*Super) == getRegSizeInBits(*RC))
164 case X86::FR32XRegClassID:
165 case X86::FR64XRegClassID:
168 getRegSizeInBits(*Super) == getRegSizeInBits(*RC))
171 case X86::GR8RegClassID:
172 case X86::GR16RegClassID:
173 case X86::GR32RegClassID:
174 case X86::GR64RegClassID:
175 case X86::GR8_NOREX2RegClassID:
176 case X86::GR16_NOREX2RegClassID:
177 case X86::GR32_NOREX2RegClassID:
178 case X86::GR64_NOREX2RegClassID:
179 case X86::RFP32RegClassID:
180 case X86::RFP64RegClassID:
181 case X86::RFP80RegClassID:
182 case X86::VR512_0_15RegClassID:
183 case X86::VR512RegClassID:
186 if (getRegSizeInBits(*Super) == getRegSizeInBits(*RC))
201 assert(Kind == 0 &&
"this should only be used for default cases");
202 if (IsTarget64BitLP64)
203 return &X86::GR64RegClass;
208 return Is64Bit ? &X86::LOW32_ADDR_ACCESSRegClass : &X86::GR32RegClass;
213 if (RC == &X86::CCRRegClass) {
215 return &X86::GR64RegClass;
217 return &X86::GR32RegClass;
227 unsigned FPDiff = TFI->
hasFP(MF) ? 1 : 0;
228 switch (RC->
getID()) {
231 case X86::GR32RegClassID:
233 case X86::GR64RegClassID:
235 case X86::VR128RegClassID:
236 return Is64Bit ? 10 : 4;
237 case X86::VR64RegClassID:
244 assert(MF &&
"MachineFunction required");
248 bool HasSSE = Subtarget.
hasSSE1();
249 bool HasAVX = Subtarget.
hasAVX();
251 bool HasEGPR = Subtarget.hasEGPR();
264 return CSR_NoRegs_SaveList;
269 return CSR_NoRegs_SaveList;
272 return CSR_64_AllRegs_AVX_SaveList;
273 return CSR_64_AllRegs_SaveList;
276 return HasEGPR ? CSR_Win64_APX_RT_MostRegs_SaveList
277 : CSR_Win64_RT_MostRegs_SaveList;
278 return CSR_64_RT_MostRegs_SaveList;
281 return CSR_64_RT_AllRegs_AVX_SaveList;
282 return CSR_64_RT_AllRegs_SaveList;
284 return CSR_64_NoneRegs_SaveList;
288 CSR_64_CXX_TLS_Darwin_PE_SaveList : CSR_64_TLS_Darwin_SaveList;
291 if (HasAVX512 && IsWin64)
292 return HasEGPR ? CSR_Win64_APX_Intel_OCL_BI_AVX512_SaveList
293 : CSR_Win64_Intel_OCL_BI_AVX512_SaveList;
294 if (HasAVX512 && Is64Bit)
295 return CSR_64_Intel_OCL_BI_AVX512_SaveList;
296 if (HasAVX && IsWin64)
297 return HasEGPR ? CSR_Win64_APX_Intel_OCL_BI_AVX_SaveList
298 : CSR_Win64_Intel_OCL_BI_AVX_SaveList;
299 if (HasAVX && Is64Bit)
300 return CSR_64_Intel_OCL_BI_AVX_SaveList;
301 if (!HasAVX && !IsWin64 && Is64Bit)
302 return CSR_64_Intel_OCL_BI_SaveList;
309 return HasEGPR ? CSR_Win64_APX_RegCall_SaveList
310 : CSR_Win64_RegCall_SaveList;
311 return CSR_Win64_RegCall_NoSSE_SaveList;
313 return HasSSE ? CSR_SysV64_RegCall_SaveList
314 : CSR_SysV64_RegCall_NoSSE_SaveList;
316 return HasSSE ? CSR_32_RegCall_SaveList : CSR_32_RegCall_NoSSE_SaveList;
318 assert(!Is64Bit &&
"CFGuard check mechanism only used on 32-bit X86");
319 return HasSSE ? CSR_Win32_CFGuard_Check_SaveList
320 : CSR_Win32_CFGuard_Check_NoSSE_SaveList;
323 return CSR_64_MostRegs_SaveList;
327 return HasEGPR ? CSR_Win64_APX_SaveList : CSR_Win64_SaveList;
328 return CSR_Win64_NoSSE_SaveList;
331 return CSR_32_SaveList;
333 return HasEGPR ? CSR_Win64_APX_SwiftTail_SaveList
334 : CSR_Win64_SwiftTail_SaveList;
335 return CSR_64_SwiftTail_SaveList;
338 return CSR_64EHRet_SaveList;
339 return CSR_64_SaveList;
343 return CSR_64_AllRegs_AVX512_SaveList;
345 return CSR_64_AllRegs_AVX_SaveList;
347 return CSR_64_AllRegs_SaveList;
348 return CSR_64_AllRegs_NoSSE_SaveList;
351 return CSR_32_AllRegs_AVX512_SaveList;
353 return CSR_32_AllRegs_AVX_SaveList;
355 return CSR_32_AllRegs_SSE_SaveList;
356 return CSR_32_AllRegs_SaveList;
363 F.getAttributes().hasAttrSomewhere(Attribute::SwiftError);
366 return HasEGPR ? CSR_Win64_APX_SwiftError_SaveList
367 : CSR_Win64_SwiftError_SaveList;
368 return CSR_64_SwiftError_SaveList;
371 if (IsWin64 || IsUEFI64) {
373 return HasEGPR ? CSR_Win64_APX_SaveList : CSR_Win64_SaveList;
374 return CSR_Win64_NoSSE_SaveList;
377 return CSR_64EHRet_SaveList;
378 return CSR_64_SaveList;
381 return CallsEHReturn ? CSR_32EHRet_SaveList : CSR_32_SaveList;
386 return Is64Bit ? CSR_IPRA_64_SaveList : CSR_IPRA_32_SaveList;
391 assert(MF &&
"Invalid MachineFunction pointer.");
394 return CSR_64_CXX_TLS_Darwin_ViaCopy_SaveList;
402 bool HasSSE = Subtarget.
hasSSE1();
403 bool HasAVX = Subtarget.
hasAVX();
405 bool HasEGPR = Subtarget.hasEGPR();
410 return CSR_NoRegs_RegMask;
413 return CSR_64_AllRegs_AVX_RegMask;
414 return CSR_64_AllRegs_RegMask;
417 return HasEGPR ? CSR_Win64_APX_RT_MostRegs_RegMask
418 : CSR_Win64_RT_MostRegs_RegMask;
419 return CSR_64_RT_MostRegs_RegMask;
422 return CSR_64_RT_AllRegs_AVX_RegMask;
423 return CSR_64_RT_AllRegs_RegMask;
425 return CSR_64_NoneRegs_RegMask;
428 return CSR_64_TLS_Darwin_RegMask;
431 if (HasAVX512 && IsWin64)
432 return HasEGPR ? CSR_Win64_APX_Intel_OCL_BI_AVX512_RegMask
433 : CSR_Win64_Intel_OCL_BI_AVX512_RegMask;
434 if (HasAVX512 && Is64Bit)
435 return CSR_64_Intel_OCL_BI_AVX512_RegMask;
436 if (HasAVX && IsWin64)
437 return HasEGPR ? CSR_Win64_APX_Intel_OCL_BI_AVX_RegMask
438 : CSR_Win64_Intel_OCL_BI_AVX_RegMask;
439 if (HasAVX && Is64Bit)
440 return CSR_64_Intel_OCL_BI_AVX_RegMask;
441 if (!HasAVX && !IsWin64 && Is64Bit)
442 return CSR_64_Intel_OCL_BI_RegMask;
449 return HasEGPR ? CSR_Win64_APX_RegCall_RegMask
450 : CSR_Win64_RegCall_RegMask;
451 return CSR_Win64_RegCall_NoSSE_RegMask;
453 return HasSSE ? CSR_SysV64_RegCall_RegMask
454 : CSR_SysV64_RegCall_NoSSE_RegMask;
456 return HasSSE ? CSR_32_RegCall_RegMask : CSR_32_RegCall_NoSSE_RegMask;
460 return HasEGPR ? CSR_Win64_APX_CFGuard_Check_RegMask
461 : CSR_Win64_CFGuard_Check_RegMask;
462 return CSR_Win64_CFGuard_Check_NoSSE_RegMask;
464 return HasSSE ? CSR_Win32_CFGuard_Check_RegMask
465 : CSR_Win32_CFGuard_Check_NoSSE_RegMask;
468 return CSR_64_MostRegs_RegMask;
471 return HasEGPR ? CSR_Win64_APX_RegMask : CSR_Win64_RegMask;
474 return CSR_32_RegMask;
476 return HasEGPR ? CSR_Win64_APX_SwiftTail_RegMask
477 : CSR_Win64_SwiftTail_RegMask;
478 return CSR_64_SwiftTail_RegMask;
480 return CSR_64_RegMask;
484 return CSR_64_AllRegs_AVX512_RegMask;
486 return CSR_64_AllRegs_AVX_RegMask;
488 return CSR_64_AllRegs_RegMask;
489 return CSR_64_AllRegs_NoSSE_RegMask;
492 return CSR_32_AllRegs_AVX512_RegMask;
494 return CSR_32_AllRegs_AVX_RegMask;
496 return CSR_32_AllRegs_SSE_RegMask;
497 return CSR_32_AllRegs_RegMask;
507 F.getAttributes().hasAttrSomewhere(Attribute::SwiftError);
510 return HasEGPR ? CSR_Win64_APX_SwiftError_RegMask
511 : CSR_Win64_SwiftError_RegMask;
512 return CSR_64_SwiftError_RegMask;
515 if (IsWin64 || IsUEFI64)
516 return HasEGPR ? CSR_Win64_APX_RegMask : CSR_Win64_RegMask;
517 return CSR_64_RegMask;
520 return CSR_32_RegMask;
525 return CSR_NoRegs_RegMask;
529 return CSR_64_TLS_Darwin_RegMask;
546 for (
const MCPhysReg &SubReg : subregs_inclusive(X86::RSP))
553 if (ST.hasUserReservedRegisters()) {
556 for (
unsigned Reg = X86::R8; Reg <= X86::R15; ++Reg)
557 if (ST.isRegisterReservedByUser(Reg))
558 for (
const MCPhysReg &SubReg : subregs_inclusive(Reg))
561 for (
unsigned Reg = X86::R16; Reg <= X86::R31; ++Reg)
562 if (ST.isRegisterReservedByUser(Reg))
563 for (
const MCPhysReg &SubReg : subregs_inclusive(Reg))
566 if (ST.isRegisterReservedByUser(X86::EDI))
567 for (
const MCPhysReg &SubReg : sub_and_superregs_inclusive(X86::EDI))
573 for (
const MCPhysReg &SubReg : subregs_inclusive(X86::RIP))
581 "Frame pointer clobbered by function invoke is not supported.");
583 for (
const MCPhysReg &SubReg : subregs_inclusive(X86::RBP))
591 "Stack realignment in presence of dynamic "
592 "allocas is not supported with "
593 "this calling convention.");
596 for (
const MCPhysReg &SubReg : subregs_inclusive(BasePtr))
609 for (
unsigned n = 0; n != 8; ++n)
614 if (ST.useSoftFloat() || !ST.hasX87())
615 for (
unsigned n = 0; n != 7; ++n)
631 for (
unsigned n = 0; n != 8; ++n) {
642 for (
unsigned n = 0; n != 16; ++n) {
651 Reserved.set(X86::R16, X86::R31WH + 1);
657 unsigned NumReservedCSRs = 0;
658 for (
unsigned Reg = X86::R16; Reg <= X86::R31; ++Reg)
659 if (isCalleeSavedPhysReg(Reg, MF)) {
661 for (
const MCPhysReg &SubReg : subregs_inclusive(Reg))
668 " callee-saved register(s) reserved due to setjmp in '" +
670 "'; this may impact performance in large functions");
692 {X86::SIL, X86::DIL, X86::BPL, X86::SPL,
693 X86::SIH, X86::DIH, X86::BPH, X86::SPH}));
709 static_assert((X86::R15WH + 1 == X86::YMM0) && (X86::YMM15 + 1 == X86::K0) &&
710 (X86::K6_K7 + 1 == X86::TMMCFG) &&
711 (X86::TMM7 + 1 == X86::R16) &&
712 (X86::R31WH + 1 == X86::NUM_TARGET_REGS),
713 "Register number may be incorrect");
717 return X86::NUM_TARGET_REGS;
719 return X86::TMM7 + 1;
721 return X86::K6_K7 + 1;
723 return X86::YMM15 + 1;
724 return X86::R15WH + 1;
732 return TRI.isSuperOrSubRegisterEq(RegA, RegB);
738 [&](
MCRegister &RegA) {
return IsSubReg(RegA, Reg); }) ||
739 (ST.hasMMX() && X86::VR64RegClass.contains(Reg));
748 [&](
MCRegister &RegA) {
return IsSubReg(RegA, Reg); }))
753 [&](
MCRegister &RegA) {
return IsSubReg(RegA, Reg); }))
758 X86::XMM3, X86::XMM4, X86::XMM5,
759 X86::XMM6, X86::XMM7},
760 [&](
MCRegister &RegA) { return IsSubReg(RegA, Reg); }))
763 return X86GenRegisterInfo::isArgumentRegister(MF, Reg);
772 if (
TRI.isSuperOrSubRegisterEq(X86::RSP, PhysReg))
777 if (TFI.
hasFP(MF) &&
TRI.isSuperOrSubRegisterEq(X86::RBP, PhysReg))
780 return X86GenRegisterInfo::isFixedRegister(MF, PhysReg);
784 return RC->
getID() == X86::TILERegClassID;
795 assert(!(Mask[X86::EFLAGS / 32] & (1U << (X86::EFLAGS % 32))) &&
796 "EFLAGS are not live-out from a patchpoint.");
799 for (
auto Reg : {X86::EFLAGS, X86::RIP, X86::EIP, X86::IP})
800 Mask[Reg / 32] &= ~(1U << (Reg % 32));
831 bool CantUseFP = hasStackRealignment(MF);
867 unsigned Opc =
II->getOpcode();
869 if ((
Opc != X86::LEA32r &&
Opc != X86::LEA64r &&
Opc != X86::LEA64_32r) ||
870 MI.getOperand(2).getImm() != 1 ||
871 MI.getOperand(3).getReg() != X86::NoRegister ||
872 MI.getOperand(4).getImm() != 0 ||
873 MI.getOperand(5).getReg() != X86::NoRegister)
879 if (
Opc == X86::LEA64_32r)
881 Register NewDestReg =
MI.getOperand(0).getReg();
883 MI.getParent()->getParent()->getSubtarget<
X86Subtarget>().getInstrInfo();
884 TII->copyPhysReg(*
MI.getParent(),
II,
MI.getDebugLoc(), NewDestReg, BasePtr,
885 MI.getOperand(1).isKill());
886 MI.eraseFromParent();
891 switch (
MI.getOpcode()) {
893 case X86::CLEANUPRET:
902 unsigned FIOperandNum,
904 int FIOffset)
const {
906 unsigned Opc =
MI.getOpcode();
907 if (
Opc == TargetOpcode::LOCAL_ESCAPE) {
913 MI.getOperand(FIOperandNum).ChangeToRegister(BaseReg,
false);
917 if (
Opc == TargetOpcode::STACKMAP ||
Opc == TargetOpcode::PATCHPOINT) {
918 assert(BasePtr == FramePtr &&
"Expected the FP as base register");
919 int64_t
Offset =
MI.getOperand(FIOperandNum + 1).getImm() + FIOffset;
920 MI.getOperand(FIOperandNum + 1).ChangeToImmediate(
Offset);
924 if (
MI.getOperand(FIOperandNum + 3).isImm()) {
926 int Imm = (int)(
MI.getOperand(FIOperandNum + 3).getImm());
929 "Requesting 64-bit offset in 32-bit immediate!");
931 MI.getOperand(FIOperandNum + 3).ChangeToImmediate(
Offset);
935 FIOffset + (uint64_t)
MI.getOperand(FIOperandNum + 3).getOffset();
936 MI.getOperand(FIOperandNum + 3).setOffset(
Offset);
942 int SPAdj,
unsigned FIOperandNum,
951 int FrameIndex =
MI.getOperand(FIOperandNum).getIndex();
957 assert((!hasStackRealignment(MF) ||
959 "Return instruction can only reference SP relative frame objects");
962 }
else if (TFI->
Is64Bit && (
MBB.isEHFuncletEntry() || IsEHFuncletEpilogue)) {
973 unsigned Opc =
MI.getOpcode();
974 if (
Opc == TargetOpcode::LOCAL_ESCAPE) {
985 if (
Opc == X86::LEA64_32r && X86::GR32RegClass.
contains(BasePtr))
990 MI.getOperand(FIOperandNum).ChangeToRegister(MachineBasePtr,
false);
992 if (BasePtr == StackPtr)
997 if (
Opc == TargetOpcode::STACKMAP ||
Opc == TargetOpcode::PATCHPOINT) {
998 assert(BasePtr == FramePtr &&
"Expected the FP as base register");
999 int64_t
Offset =
MI.getOperand(FIOperandNum + 1).getImm() + FIOffset;
1000 MI.getOperand(FIOperandNum + 1).ChangeToImmediate(
Offset);
1004 if (
MI.getOperand(FIOperandNum+3).isImm()) {
1007 int64_t
Imm =
MI.getOperand(FIOperandNum + 3).getImm();
1012 if (Is64Bit && !FitsIn32Bits) {
1013 assert(RS &&
"RegisterScavenger was NULL");
1015 RS->enterBasicBlockEnd(
MBB);
1016 RS->backward(std::next(
II));
1018 Register ScratchReg = RS->scavengeRegisterBackwards(
1019 X86::GR64RegClass,
II,
false, 0,
1021 assert(ScratchReg != 0 &&
"scratch reg was 0");
1022 RS->setRegUsed(ScratchReg);
1026 MI.getOperand(FIOperandNum + 3).setImm(0);
1027 if (
MI.getOperand(FIOperandNum + 2).getReg() == X86::NoRegister) {
1028 MI.getOperand(FIOperandNum + 2).setReg(ScratchReg);
1037 .
addReg(X86::NoRegister);
1038 MI.getOperand(FIOperandNum).setReg(ScratchReg);
1045 if (!Is64Bit && !FitsIn32Bits) {
1046 MI.emitGenericError(
"64-bit offset calculated but target is 32-bit");
1053 MI.getOperand(FIOperandNum + 3).ChangeToImmediate(
Offset);
1056 uint64_t
Offset = FIOffset +
1057 (uint64_t)
MI.getOperand(FIOperandNum+3).getOffset();
1058 MI.getOperand(FIOperandNum + 3).setOffset(
Offset);
1073 switch (
MBBI->getOpcode()) {
1076 case TargetOpcode::PATCHABLE_RET:
1082 case X86::TCRETURNdi:
1083 case X86::TCRETURNri:
1084 case X86::TCRETURN_WIN64ri:
1085 case X86::TCRETURN_HIPE32ri:
1086 case X86::TCRETURNmi:
1087 case X86::TCRETURNdi64:
1088 case X86::TCRETURNri64:
1089 case X86::TCRETURNri64_ImpCall:
1090 case X86::TCRETURNmi64:
1091 case X86::TCRETURN_WINmi64:
1092 case X86::EH_RETURN:
1093 case X86::EH_RETURN64: {
1099 Is64Bit ? X86::GR64_NOSPRegClass : X86::GR32_NOSPRegClass;
1112 return TFI->
hasFP(MF) ? FramePtr : StackPtr;
1140 unsigned OpCode =
MI->getOpcode();
1146 Register SrcReg =
MI->getOperand(1).getReg();
1152 case X86::PTILELOADDV:
1153 case X86::PTILELOADDT1V:
1154 case X86::PTDPBSSDV:
1155 case X86::PTDPBSUDV:
1156 case X86::PTDPBUSDV:
1157 case X86::PTDPBUUDV:
1158 case X86::PTILEZEROV:
1159 case X86::PTDPBF16PSV:
1160 case X86::PTDPFP16PSV:
1161 case X86::PTCMMIMFP16PSV:
1162 case X86::PTCMMRLFP16PSV:
1163 case X86::PTILELOADDRSV:
1164 case X86::PTILELOADDRST1V:
1165 case X86::PTDPBF8PSV:
1166 case X86::PTDPBHF8PSV:
1167 case X86::PTDPHBF8PSV:
1168 case X86::PTDPHF8PSV: {
1171 ShapeT Shape(&MO1, &MO2, MRI);
1187 VirtReg, Order, Hints, MF, VRM,
Matrix);
1191 unsigned ID = RC.
getID();
1194 return BaseImplRetVal;
1196 if (ID != X86::TILERegClassID) {
1198 !
TRI.isGeneralPurposeRegisterClass(&RC))
1199 return BaseImplRetVal;
1208 TwoAddrHints.
insert(PhysReg);
1217 unsigned OpIdx =
MI.getOperandNo(&MO);
1220 TryAddNDDHint(
MI.getOperand(1));
1221 if (
MI.isCommutable()) {
1223 TryAddNDDHint(
MI.getOperand(2));
1225 }
else if (OpIdx == 1) {
1226 TryAddNDDHint(
MI.getOperand(0));
1227 }
else if (
MI.isCommutable() && OpIdx == 2) {
1228 TryAddNDDHint(
MI.getOperand(0));
1233 if (TwoAddrHints.
count(OrderReg))
1236 return BaseImplRetVal;
1247 if (PhysShape == VirtShape)
1253 for (
auto Hint : CopyHints) {
1263#define DEBUG_TYPE "tile-hint"
1265 dbgs() <<
"Hints for virtual register " <<
format_hex(VirtReg, 8) <<
"\n";
1266 for (
auto Hint : Hints) {
1267 dbgs() <<
"tmm" << Hint <<
",";
1278 switch (RC->
getID()) {
1281 case X86::GR8RegClassID:
1282 return &X86::GR8_NOREX2RegClass;
1283 case X86::GR16RegClassID:
1284 return &X86::GR16_NOREX2RegClass;
1285 case X86::GR32RegClassID:
1286 return &X86::GR32_NOREX2RegClass;
1287 case X86::GR64RegClassID:
1288 return &X86::GR64_NOREX2RegClass;
1289 case X86::GR32_NOSPRegClassID:
1290 return &X86::GR32_NOREX2_NOSPRegClass;
1291 case X86::GR64_NOSPRegClassID:
1292 return &X86::GR64_NOREX2_NOSPRegClass;
1297 switch (RC->
getID()) {
1300 case X86::GR8_NOREX2RegClassID:
1301 case X86::GR16_NOREX2RegClassID:
1302 case X86::GR32_NOREX2RegClassID:
1303 case X86::GR64_NOREX2RegClassID:
1304 case X86::GR32_NOREX2_NOSPRegClassID:
1305 case X86::GR64_NOREX2_NOSPRegClassID:
1306 case X86::GR64_with_sub_16bit_in_GR16_NOREX2RegClassID:
static const TargetRegisterClass * getRegClass(const MachineInstr &MI, Register Reg)
assert(UImm &&(UImm !=~static_cast< T >(0)) &&"Invalid immediate!")
MachineBasicBlock MachineBasicBlock::iterator DebugLoc DL
MachineBasicBlock MachineBasicBlock::iterator MBBI
This file implements the BitVector class.
static GCRegistry::Add< ErlangGC > A("erlang", "erlang-compatible garbage collector")
static GCRegistry::Add< OcamlGC > B("ocaml", "ocaml 3.10-compatible GC")
const HexagonInstrInfo * TII
static cl::opt< bool > EnableBasePointer("m68k-use-base-pointer", cl::Hidden, cl::init(true), cl::desc("Enable use of a base pointer for complex stack frames"))
static bool CantUseSP(const MachineFrameInfo &MFI)
Register const TargetRegisterInfo * TRI
Promote Memory to Register
uint64_t IntrinsicInst * II
This file declares the machine register scavenger class.
static bool contains(SmallPtrSetImpl< ConstantExpr * > &Cache, ConstantExpr *Expr, Constant *C)
This file defines the SmallSet class.
cl::opt< bool > X86EnableAPXForRelocation
static cl::opt< unsigned > SetjmpCSRWarningThreshold("x86-setjmp-csr-warning-threshold", cl::Hidden, cl::init(50), cl::desc("Basic block count threshold for emitting a warning about " "callee-saved registers reserved due to setjmp"))
static cl::opt< bool > EnableBasePointer("x86-use-base-pointer", cl::Hidden, cl::init(true), cl::desc("Enable use of a base pointer for complex stack frames"))
static bool tryOptimizeLEAtoMOV(MachineBasicBlock::iterator II)
static cl::opt< bool > DisableRegAllocNDDHints("x86-disable-regalloc-hints-for-ndd", cl::Hidden, cl::init(false), cl::desc("Disable two address hints for register " "allocation"))
static ShapeT getTileShape(Register VirtReg, VirtRegMap *VRM, const MachineRegisterInfo *MRI)
Represent a constant reference to an array (0 or more elements consecutively in memory),...
CallingConv::ID getCallingConv() const
getCallingConv()/setCallingConv(CC) - These method get and set the calling convention of this functio...
bool hasFnAttribute(Attribute::AttrKind Kind) const
Return true if the function has the attribute.
A set of register units used to track register liveness.
bool available(MCRegister Reg) const
Returns true if no part of physical register Reg is live.
LLVM_ABI void stepBackward(const MachineInstr &MI)
Updates liveness when stepping backwards over the instruction MI.
LLVM_ABI void addLiveOuts(const MachineBasicBlock &MBB)
Adds registers living out of block MBB.
LLVM_ABI void reportWarning(SMLoc L, const Twine &Msg)
LLVM_ABI void reportError(SMLoc L, const Twine &Msg)
MCRegAliasIterator enumerates all registers aliasing Reg.
ArrayRef< unsigned > superclasses() const
Returns a list of super-classes.
unsigned getID() const
getID() - Return the register class ID number.
bool contains(MCRegister Reg) const
contains - Return true if the specified register is included in this register class.
Wrapper class representing physical registers. Should be passed by value.
static constexpr unsigned NoRegister
MachineInstrBundleIterator< MachineInstr > iterator
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 ...
bool hasOpaqueSPAdjustment() const
Returns true if the function contains opaque dynamic stack adjustments.
bool isFixedObjectIndex(int ObjectIdx) const
Returns true if the specified index corresponds to a fixed stack object.
const TargetSubtargetInfo & getSubtarget() const
getSubtarget - Return the subtarget for which this machine code is being compiled.
StringRef getName() const
getName - Return the name of the corresponding LLVM function.
bool exposesReturnsTwice() const
exposesReturnsTwice - Returns true if the function calls setjmp or any other similar functions with a...
LLVM_ABI bool framePointerIsReserved() const
Returns true if the frame pointer must always either point to a new frame record or be un-modified in...
MachineFrameInfo & getFrameInfo()
getFrameInfo - Return the frame info object for the current function.
MCContext & getContext() const
bool callsEHReturn() const
MachineRegisterInfo & getRegInfo()
getRegInfo - Return information about the registers currently in use.
Function & getFunction()
Return the LLVM function that this machine code represents.
Ty * getInfo()
getInfo - Keep track of various per-function pieces of information for backends that would like to do...
const MachineInstrBuilder & addReg(Register RegNo, RegState Flags={}, unsigned SubReg=0) const
Add a new virtual register operand.
const MachineInstrBuilder & addImm(int64_t Val) const
Add a new immediate operand.
Representation of each machine instruction.
MachineOperand class - Representation of each machine instruction operand.
LLVM_ABI void ChangeToImmediate(int64_t ImmVal, unsigned TargetFlags=0)
ChangeToImmediate - Replace this operand with a new immediate operand of the specified value.
MachineRegisterInfo - Keep track of information for virtual and physical registers,...
const TargetRegisterClass * getRegClass(Register Reg) const
Return the register class of the specified virtual register.
bool isReserved(MCRegister PhysReg) const
isReserved - Returns true when PhysReg is a reserved register.
def_iterator def_begin(Register RegNo) const
bool reservedRegsFrozen() const
reservedRegsFrozen - Returns true after freezeReservedRegs() was called to ensure the set of reserved...
bool canReserveReg(MCRegister PhysReg) const
canReserveReg - Returns true if PhysReg can be used as a reserved register.
iterator_range< reg_nodbg_iterator > reg_nodbg_operands(Register Reg) const
Wrapper class representing virtual and physical registers.
constexpr bool isPhysical() const
Return true if the specified register number is in the physical register namespace.
Represents a location in source code.
SmallSet - This maintains a set of unique values, optimizing for the case when the set is small (less...
size_type count(const T &V) const
count - Return 1 if the element is in the set, 0 otherwise.
std::pair< const_iterator, bool > insert(const T &V)
insert - Insert an element into the set if it isn't already there.
This class consists of common code factored out of the SmallVector class to reduce code duplication b...
void push_back(const T &Elt)
This is a 'vector' (really, a variable-sized array), optimized for the case when the array is small.
static StackOffset getFixed(int64_t Fixed)
bool hasFP(const MachineFunction &MF) const
hasFP - Return true if the specified function should have a dedicated frame pointer register.
TargetRegisterInfo base class - We assume that the target defines a static array of TargetRegisterDes...
virtual bool canRealignStack(const MachineFunction &MF) const
True if the stack can be realigned for the target.
virtual bool shouldRealignStack(const MachineFunction &MF) const
True if storage within the function requires the stack pointer to be aligned more than the normal cal...
virtual bool getRegAllocationHints(Register VirtReg, ArrayRef< MCPhysReg > Order, SmallVectorImpl< MCPhysReg > &Hints, const MachineFunction &MF, const VirtRegMap *VRM=nullptr, const LiveRegMatrix *Matrix=nullptr) const
Get a list of 'hint' registers that the register allocator should try first when allocating a physica...
Triple - Helper class for working with autoconf configuration names.
Twine - A lightweight data structure for efficiently representing the concatenation of temporary valu...
bool hasShape(Register virtReg) const
ShapeT getShape(Register virtReg) const
MCRegister getPhys(Register virtReg) const
returns the physical register mapped to the specified virtual register
void assignVirt2Shape(Register virtReg, ShapeT shape)
StackOffset getFrameIndexReferenceSP(const MachineFunction &MF, int FI, Register &SPReg, int Adjustment) const
StackOffset getFrameIndexReference(const MachineFunction &MF, int FI, Register &FrameReg) const override
getFrameIndexReference - This method should return the base register and offset used to reference a f...
bool Is64Bit
Is64Bit implies that x86_64 instructions are available.
int getWin64EHFrameIndexRef(const MachineFunction &MF, int FI, Register &SPReg) const
X86MachineFunctionInfo - This class is derived from MachineFunction and contains private X86 target-s...
bool getBPClobberedByInvoke() const
bool hasPreallocatedCall() const
MachineInstr * getStackPtrSaveMI() const
bool getFPClobberedByInvoke() const
bool hasBasePointer(const MachineFunction &MF) const
const TargetRegisterClass * getPointerRegClass(unsigned Kind=0) const override
getPointerRegClass - Returns a TargetRegisterClass used for pointer values.
const MCPhysReg * getCalleeSavedRegsViaCopy(const MachineFunction *MF) const
bool canRealignStack(const MachineFunction &MF) const override
BitVector getReservedRegs(const MachineFunction &MF) const override
getReservedRegs - Returns a bitset indexed by physical register number indicating if a register is a ...
Register getPtrSizedFrameRegister(const MachineFunction &MF) const
bool shouldRealignStack(const MachineFunction &MF) const override
unsigned getNumSupportedRegs(const MachineFunction &MF) const override
Return the number of registers for the function.
const MCPhysReg * getIPRACSRegs(const MachineFunction *MF) const override
getIPRACSRegs - This API can be removed when rbp is safe to optimized out when IPRA is on.
Register getFrameRegister(const MachineFunction &MF) const override
unsigned findDeadCallerSavedReg(MachineBasicBlock &MBB, MachineBasicBlock::iterator &MBBI) const
findDeadCallerSavedReg - Return a caller-saved register that isn't live when it reaches the "return" ...
const uint32_t * getDarwinTLSCallPreservedMask() const
bool isTileRegisterClass(const TargetRegisterClass *RC) const
Return true if it is tile register class.
bool isNonRex2RegClass(const TargetRegisterClass *RC) const
const uint32_t * getCallPreservedMask(const MachineFunction &MF, CallingConv::ID) const override
Register getPtrSizedStackRegister(const MachineFunction &MF) const
bool isArgumentRegister(const MachineFunction &MF, MCRegister Reg) const override
isArgumentReg - Returns true if Reg can be used as an argument to a function.
Register getStackRegister() const
const TargetRegisterClass * getLargestLegalSuperClass(const TargetRegisterClass *RC, const MachineFunction &MF) const override
const TargetRegisterClass * getMatchingSuperRegClass(const TargetRegisterClass *A, const TargetRegisterClass *B, unsigned Idx) const override
getMatchingSuperRegClass - Return a subclass of the specified register class A so that each register ...
unsigned getRegPressureLimit(const TargetRegisterClass *RC, MachineFunction &MF) const override
const TargetRegisterClass * getCrossCopyRegClass(const TargetRegisterClass *RC) const override
getCrossCopyRegClass - Returns a legal register class to copy a register in the specified class to or...
X86RegisterInfo(const Triple &TT)
const TargetRegisterClass * constrainRegClassToNonRex2(const TargetRegisterClass *RC) const
Register getBaseRegister() const
bool getRegAllocationHints(Register VirtReg, ArrayRef< MCPhysReg > Order, SmallVectorImpl< MCPhysReg > &Hints, const MachineFunction &MF, const VirtRegMap *VRM, const LiveRegMatrix *Matrix) const override
void eliminateFrameIndex(MachineBasicBlock::iterator II, unsigned FIOperandNum, Register BaseReg, int FIOffset) const
const uint32_t * getNoPreservedMask() const override
bool isFixedRegister(const MachineFunction &MF, MCRegister PhysReg) const override
Returns true if PhysReg is a fixed register.
const TargetRegisterClass * getSubClassWithSubReg(const TargetRegisterClass *RC, unsigned Idx) const override
const MCPhysReg * getCalleeSavedRegs(const MachineFunction *MF) const override
getCalleeSavedRegs - Return a null-terminated list of all of the callee-save registers on this target...
void adjustStackMapLiveOutMask(uint32_t *Mask) const override
const X86TargetLowering * getTargetLowering() const override
bool isTarget64BitILP32() const
Is this x86_64 with the ILP32 programming model (x32 ABI)?
bool supportSwiftError() const override
Return true if the target supports swifterror attribute.
#define llvm_unreachable(msg)
Marks that the current location is not supposed to be reachable.
unsigned ID
LLVM IR allows to use arbitrary numbers as calling convention identifiers.
@ X86_64_SysV
The C convention as specified in the x86-64 supplement to the System V ABI, used on most non-Windows ...
@ HiPE
Used by the High-Performance Erlang Compiler (HiPE).
@ CFGuard_Check
Special calling convention on Windows for calling the Control Guard Check ICall funtion.
@ PreserveMost
Used for runtime calls that preserves most registers.
@ AnyReg
OBSOLETED - Used for stack based JavaScript calls.
@ CXX_FAST_TLS
Used for access functions.
@ X86_INTR
x86 hardware interrupt context.
@ GHC
Used by the Glasgow Haskell Compiler (GHC).
@ Cold
Attempts to make code in the caller as efficient as possible under the assumption that the call is no...
@ PreserveAll
Used for runtime calls that preserves (almost) all registers.
@ Intel_OCL_BI
Used for Intel OpenCL built-ins.
@ PreserveNone
Used for runtime calls that preserves none general registers.
@ Win64
The C convention as implemented on Windows/x86-64 and AArch64.
@ SwiftTail
This follows the Swift calling convention in how arguments are passed but guarantees tail calls will ...
@ GRAAL
Used by GraalVM. Two additional registers are reserved.
@ X86_RegCall
Register calling convention used for parameters transfer optimization.
void initLLVMToSEHAndCVRegMapping(MCRegisterInfo *MRI)
Define some predicates that are used for node matching.
unsigned getNonNDVariant(unsigned Opc)
initializer< Ty > init(const Ty &Val)
This is an optimization pass for GlobalISel generic memory operations.
MachineInstrBuilder BuildMI(MachineFunction &MF, const MIMetadata &MIMD, const MCInstrDesc &MCID)
Builder interface. Specify how to create the initial instruction itself.
constexpr bool isInt(int64_t x)
Checks if an integer fits into the given bit width.
MCRegister getX86SubSuperRegister(MCRegister Reg, unsigned Size, bool High=false)
constexpr from_range_t from_range
bool any_of(R &&range, UnaryPredicate P)
Provide wrappers to std::any_of which take ranges instead of having to pass begin/end explicitly.
static bool isFuncletReturnInstr(const MachineInstr &MI)
LLVM_ABI raw_ostream & dbgs()
dbgs() - This returns a reference to a raw_ostream for debugging messages.
FormattedNumber format_hex(uint64_t N, unsigned Width, bool Upper=false)
format_hex - Output N as a fixed width hexadecimal.
uint16_t MCPhysReg
An unsigned integer type large enough to represent all physical registers, but not necessarily virtua...
bool is_contained(R &&Range, const E &Element)
Returns true if Element is found in Range.
MCRegisterClass TargetRegisterClass