32#define DEBUG_TYPE "x86-isel"
70static std::pair<MVT, unsigned>
76 return {MVT::v2i64, 1};
78 return {MVT::v4i32, 1};
81 return {MVT::v8i16, 1};
84 return {MVT::v16i8, 1};
88 return {MVT::v32i8, 1};
92 return {MVT::v64i8, 1};
93 return {MVT::v32i8, 2};
97 if (!
isPowerOf2_32(NumElts) || (NumElts == 64 && !Subtarget.hasBWI()) ||
99 return {MVT::i8, NumElts};
112 unsigned NumRegisters;
113 std::tie(RegisterVT, NumRegisters) =
124 if ((VT == MVT::f64 || VT == MVT::f80) && !Subtarget.is64Bit() &&
148 unsigned NumRegisters;
149 std::tie(RegisterVT, NumRegisters) =
161 if (!Subtarget.is64Bit() && !Subtarget.hasX87()) {
177 unsigned &NumIntermediates,
MVT &RegisterVT)
const {
179 if (VT.
isVectorOf(MVT::i1) && Subtarget.hasAVX512() &&
183 RegisterVT = MVT::i8;
184 IntermediateVT = MVT::i1;
186 return NumIntermediates;
190 if (VT == MVT::v64i1 && Subtarget.hasBWI() && !Subtarget.useAVX512Regs() &&
192 RegisterVT = MVT::v32i8;
193 IntermediateVT = MVT::v32i1;
194 NumIntermediates = 2;
203 NumIntermediates, RegisterVT);
212 if (Subtarget.hasAVX512()) {
242 if (Ty->isIntegerTy(128))
246 if (Subtarget.is32Bit() && Ty->isFP128Ty())
258 if (VTy->getPrimitiveSizeInBits().getFixedValue() == 128)
259 MaxAlign =
Align(16);
263 if (EltAlign > MaxAlign)
266 for (
auto *EltTy : STy->elements()) {
269 if (EltAlign > MaxAlign)
283 if (Subtarget.is64Bit())
287 if (Subtarget.hasSSE1())
298 const AttributeList &FuncAttributes)
const {
299 if (!FuncAttributes.hasFnAttr(Attribute::NoImplicitFloat)) {
300 if (
Op.size() >= 16 &&
301 (!Subtarget.isUnalignedMem16Slow() ||
Op.isAligned(
Align(16)))) {
303 if (
Op.size() >= 64 && Subtarget.hasAVX512() &&
304 (Subtarget.getPreferVectorWidth() >= 512)) {
305 return Subtarget.hasBWI() ? MVT::v64i8 : MVT::v16i32;
308 if (
Op.size() >= 32 && Subtarget.hasAVX() &&
309 Subtarget.useLight256BitInstructions()) {
317 if (Subtarget.hasSSE2() && (Subtarget.getPreferVectorWidth() >= 128))
321 if (Subtarget.hasSSE1() && (Subtarget.is64Bit() || Subtarget.hasX87()) &&
322 (Subtarget.getPreferVectorWidth() >= 128))
324 }
else if (((
Op.isMemcpyOrMemmove() && !
Op.isMemcpyStrSrc()) ||
325 Op.isZeroMemset()) &&
326 Op.size() >= 8 && !Subtarget.is64Bit() && Subtarget.hasSSE2()) {
339 if (Subtarget.is64Bit() &&
Op.size() >= 8)
346 return Subtarget.hasSSE1();
348 return Subtarget.hasSSE2();
353 return (8 * Alignment.
value()) % SizeInBits == 0;
364 return !Subtarget.isUnalignedMem16Slow();
366 return !Subtarget.isUnalignedMem32Slow();
373 unsigned *
Fast)
const {
383 return (Alignment < 16 || !Subtarget.hasSSE41());
392 unsigned AddrSpace,
Align Alignment,
394 unsigned *
Fast)
const {
418 if (Subtarget.hasAVX512())
438 !Subtarget.isTargetCOFF())
446 return Subtarget.useSoftFloat();
453 if (Subtarget.is64Bit())
457 unsigned ParamRegs = 0;
459 ParamRegs = M->getNumberRegisterParameters();
462 for (
auto &Arg : Args) {
464 if (
T->isIntOrPtrTy())
466 unsigned numRegs = 1;
469 if (ParamRegs < numRegs)
471 ParamRegs -= numRegs;
490 if (!Subtarget.is64Bit())
504 if (Subtarget.isPICStyleRIPRel() ||
505 (Subtarget.is64Bit() &&
513std::pair<const TargetRegisterClass *, uint8_t>
521 case MVT::i8:
case MVT::i16:
case MVT::i32:
case MVT::i64:
522 RRC = Subtarget.is64Bit() ? &X86::GR64RegClass : &X86::GR32RegClass;
525 RRC = &X86::VR64RegClass;
527 case MVT::f32:
case MVT::f64:
528 case MVT::v16i8:
case MVT::v8i16:
case MVT::v4i32:
case MVT::v2i64:
529 case MVT::v4f32:
case MVT::v2f64:
530 case MVT::v32i8:
case MVT::v16i16:
case MVT::v8i32:
case MVT::v4i64:
531 case MVT::v8f32:
case MVT::v4f64:
532 case MVT::v64i8:
case MVT::v32i16:
case MVT::v16i32:
case MVT::v8i64:
533 case MVT::v16f32:
case MVT::v8f64:
534 RRC = &X86::VR128XRegClass;
537 return std::make_pair(RRC,
Cost);
540unsigned X86TargetLowering::getAddressSpace()
const {
541 if (Subtarget.is64Bit())
569 if (Subtarget.isTargetFuchsia())
574 int Offset = M->getStackProtectorGuardOffset();
579 Offset = (Subtarget.is64Bit()) ? 0x28 : 0x14;
581 StringRef GuardReg = M->getStackProtectorGuardReg();
582 if (GuardReg ==
"fs")
584 else if (GuardReg ==
"gs")
588 StringRef GuardSymb = M->getStackProtectorGuardSymbol();
589 if (!GuardSymb.
empty()) {
595 nullptr, GuardSymb,
nullptr,
597 if (!Subtarget.isTargetDarwin())
611 RTLIB::LibcallImpl SecurityCheckCookieLibcall =
612 Libcalls.getLibcallImpl(RTLIB::SECURITY_CHECK_COOKIE);
614 RTLIB::LibcallImpl SecurityCookieVar =
615 Libcalls.getLibcallImpl(RTLIB::STACK_CHECK_GUARD);
616 if (SecurityCheckCookieLibcall != RTLIB::Unsupported &&
617 SecurityCookieVar != RTLIB::Unsupported) {
631 F->addParamAttr(0, Attribute::AttrKind::InReg);
636 StringRef GuardMode = M.getStackProtectorGuard();
639 if ((GuardMode ==
"tls" || GuardMode.
empty()) &&
650 if (Subtarget.isTargetAndroid()) {
653 int Offset = (Subtarget.is64Bit()) ? 0x48 : 0x24;
658 if (Subtarget.isTargetFuchsia()) {
670bool X86TargetLowering::CanLowerReturn(
673 const Type *RetTy)
const {
706 if (IsWin64F128StackCC(CallConv) &&
708 Outs, [](
const ISD::OutputArg &Out) {
return Out.
VT == MVT::f128; }))
712 CCState CCInfo(CallConv, isVarArg, MF, RVLocs,
Context);
713 return CCInfo.CheckReturn(Outs,
RetCC_X86);
717 static const MCPhysReg ScratchRegs[] = { X86::R11, 0 };
722 static const MCPhysReg RCRegs[] = {X86::FPCW, X86::MXCSR};
732 if (ValVT == MVT::v1i1)
736 if ((ValVT == MVT::v8i1 && (ValLoc == MVT::i8 || ValLoc == MVT::i32)) ||
737 (ValVT == MVT::v16i1 && (ValLoc == MVT::i16 || ValLoc == MVT::i32))) {
741 EVT TempValLoc = ValVT == MVT::v8i1 ? MVT::i8 : MVT::i16;
743 if (ValLoc == MVT::i32)
748 if ((ValVT == MVT::v32i1 && ValLoc == MVT::i32) ||
749 (ValVT == MVT::v64i1 && ValLoc == MVT::i64)) {
763 assert(Subtarget.hasBWI() &&
"Expected AVX512BW target!");
764 assert(Subtarget.is32Bit() &&
"Expecting 32 bit target");
767 "The value should reside in two registers");
777 RegsToPass.push_back(std::make_pair(VA.
getLocReg(),
Lo));
778 RegsToPass.push_back(std::make_pair(NextVA.
getLocReg(),
Hi));
788 X86MachineFunctionInfo *FuncInfo = MF.
getInfo<X86MachineFunctionInfo>();
793 bool ShouldDisableCalleeSavedRegister =
801 CCState CCInfo(CallConv, isVarArg, MF, RVLocs, *DAG.
getContext());
805 for (
unsigned I = 0, OutsIndex = 0,
E = RVLocs.
size();
I !=
E;
807 CCValAssign &VA = RVLocs[
I];
811 if (ShouldDisableCalleeSavedRegister)
814 SDValue ValToCopy = OutVals[OutsIndex];
832 "Unexpected FP-extend for return value.");
836 if (!Subtarget.hasSSE1() && X86::FR32XRegClass.contains(VA.
getLocReg())) {
839 }
else if (!Subtarget.hasSSE2() &&
840 X86::FR64XRegClass.contains(VA.
getLocReg()) &&
863 if (Subtarget.is64Bit()) {
864 if (ValVT == MVT::x86mmx) {
866 ValToCopy = DAG.
getBitcast(MVT::i64, ValToCopy);
871 if (!Subtarget.hasSSE2())
872 ValToCopy = DAG.
getBitcast(MVT::v4f32, ValToCopy);
879 "Currently the only custom case is when we split v64i1 to 2 regs");
885 if (ShouldDisableCalleeSavedRegister)
900 for (
auto &RetVal : RetVals) {
901 if (RetVal.first == X86::FP0 || RetVal.first == X86::FP1) {
906 Chain = DAG.
getCopyToReg(Chain, dl, RetVal.first, RetVal.second, Glue);
909 DAG.
getRegister(RetVal.first, RetVal.second.getValueType()));
948 = (Subtarget.is64Bit() && !Subtarget.isTarget64BitILP32()) ?
950 Chain = DAG.
getCopyToReg(Chain, dl, RetValReg, Val, Glue);
960 if (ShouldDisableCalleeSavedRegister &&
966 const X86RegisterInfo *
TRI = Subtarget.getRegisterInfo();
984 unsigned RetOpcode = X86ISD::RET_GLUE;
986 RetOpcode = X86ISD::IRET;
987 return DAG.
getNode(RetOpcode, dl, MVT::Other, RetOps);
990bool X86TargetLowering::isUsedByReturnOnly(
SDNode *
N,
SDValue &Chain)
const {
991 if (
N->getNumValues() != 1 || !
N->hasNUsesOfValue(1, 0))
995 SDNode *
Copy = *
N->user_begin();
999 if (
Copy->getOperand(
Copy->getNumOperands()-1).getValueType() == MVT::Glue)
1001 TCChain =
Copy->getOperand(0);
1005 bool HasRet =
false;
1006 for (
const SDNode *U :
Copy->users()) {
1007 if (
U->getOpcode() != X86ISD::RET_GLUE)
1011 if (
U->getNumOperands() > 4)
1013 if (
U->getNumOperands() == 4 &&
1014 U->getOperand(
U->getNumOperands() - 1).getValueType() != MVT::Glue)
1028 MVT ReturnMVT = MVT::i32;
1030 bool Darwin = Subtarget.getTargetTriple().isOSDarwin();
1031 if (VT == MVT::i1 || (!Darwin && (VT == MVT::i8 || VT == MVT::i16))) {
1037 ReturnMVT = MVT::i8;
1041 return VT.
bitsLT(MinVT) ? MinVT : VT;
1057 assert((Subtarget.hasBWI()) &&
"Expected AVX512BW target!");
1058 assert(Subtarget.is32Bit() &&
"Expecting 32 bit target");
1060 "Expecting first location of 64 bit width type");
1062 "The locations should have the same type");
1064 "The values should reside in two registers");
1067 SDValue ArgValueLo, ArgValueHi;
1073 if (
nullptr == InGlue) {
1109 if (ValVT == MVT::v1i1)
1112 if (ValVT == MVT::v64i1) {
1114 assert(ValLoc == MVT::i64 &&
"Expecting only i64 locations");
1120 MaskLenVT = MVT::i8;
1123 MaskLenVT = MVT::i16;
1126 MaskLenVT = MVT::i32;
1149SDValue X86TargetLowering::LowerCallResult(
1153 uint32_t *RegMask)
const {
1155 const TargetRegisterInfo *
TRI = Subtarget.getRegisterInfo();
1160 CCInfo.AnalyzeCallResult(Ins,
RetCC_X86);
1163 for (
unsigned I = 0, InsIndex = 0,
E = RVLocs.
size();
I !=
E;
1165 CCValAssign &VA = RVLocs[
I];
1172 RegMask[SubReg / 32] &= ~(1u << (SubReg % 32));
1177 if (!Subtarget.hasSSE1() && X86::FR32XRegClass.contains(VA.
getLocReg())) {
1183 }
else if (!Subtarget.hasSSE2() &&
1184 X86::FR64XRegClass.contains(VA.
getLocReg()) &&
1185 CopyVT == MVT::f64) {
1195 bool RoundAfterCopy =
false;
1198 if (!Subtarget.hasX87())
1201 RoundAfterCopy = (CopyVT != VA.
getLocVT());
1207 "Currently the only custom case is when we split v64i1 to 2 regs");
1250template <
typename T>
1255 static_assert(std::is_same_v<T, ISD::OutputArg> ||
1256 std::is_same_v<T, ISD::InputArg>,
1257 "requires ISD::OutputArg or ISD::InputArg");
1263 if (!TT.isX86_32() || TT.isOSMSVCRT() || TT.isOSIAMCU())
1267 bool IsSRetInMem =
false;
1269 IsSRetInMem = Args.front().Flags.isSRet() && ArgLocs.
front().isMemLoc();
1280 Align Alignment = Flags.getNonZeroByValAlign();
1281 return DAG.
getMemcpy(Chain, dl, Dst, Src, SizeNode, Alignment, Alignment,
1322bool X86TargetLowering::mayBeEmittedAsTailCall(
const CallInst *CI)
const {
1340 ISD::ArgFlagsTy
Flags = Ins[i].Flags;
1343 bool isImmutable = !AlwaysUseMutable && !
Flags.isByVal();
1350 bool ExtendedInMem =
1363 if (
Flags.isByVal()) {
1364 unsigned Bytes =
Flags.getByValSize();
1365 if (Bytes == 0) Bytes = 1;
1374 EVT ArgVT = Ins[i].ArgVT;
1385 if (
Flags.isCopyElisionCandidate() &&
1387 !ScalarizedVector) {
1389 if (Ins[i].PartOffset == 0) {
1398 ValVT, dl, Chain, PartAddr,
1412 if (ObjBegin <= PartBegin && PartEnd <= ObjEnd)
1419 return DAG.
getLoad(ValVT, dl, Chain, Addr,
1435 MaybeAlign Alignment;
1436 if (Subtarget.isTargetWindowsMSVC() && !Subtarget.is64Bit() &&
1438 Alignment = MaybeAlign(4);
1441 ValVT, dl, Chain, FIN,
1444 return ExtendedInMem
1454 assert(Subtarget.is64Bit());
1457 static const MCPhysReg GPR64ArgRegsWin64[] = {
1458 X86::RCX, X86::RDX, X86::R8, X86::R9
1460 return GPR64ArgRegsWin64;
1463 static const MCPhysReg GPR64ArgRegs64Bit[] = {
1464 X86::RDI, X86::RSI, X86::RDX, X86::RCX, X86::R8, X86::R9
1466 return GPR64ArgRegs64Bit;
1473 assert(Subtarget.is64Bit());
1482 bool isSoftFloat = Subtarget.useSoftFloat();
1483 if (isSoftFloat || !Subtarget.
hasSSE1())
1488 static const MCPhysReg XMMArgRegs64Bit[] = {
1489 X86::XMM0, X86::XMM1, X86::XMM2, X86::XMM3,
1490 X86::XMM4, X86::XMM5, X86::XMM6, X86::XMM7
1492 return XMMArgRegs64Bit;
1499 return A.getValNo() <
B.getValNo();
1506class VarArgsLoweringHelper {
1508 VarArgsLoweringHelper(X86MachineFunctionInfo *FuncInfo,
const SDLoc &Loc,
1509 SelectionDAG &DAG,
const X86Subtarget &Subtarget,
1510 CallingConv::ID CallConv, CCState &CCInfo)
1511 : FuncInfo(FuncInfo),
DL(Loc), DAG(DAG), Subtarget(Subtarget),
1512 TheMachineFunction(DAG.getMachineFunction()),
1514 FrameInfo(TheMachineFunction.getFrameInfo()),
1515 FrameLowering(*Subtarget.getFrameLowering()),
1516 TargLowering(DAG.getTargetLoweringInfo()), CallConv(CallConv),
1520 void lowerVarArgsParameters(
SDValue &Chain,
unsigned StackSize);
1523 void createVarArgAreaAndStoreRegisters(
SDValue &Chain,
unsigned StackSize);
1525 void forwardMustTailParameters(
SDValue &Chain);
1527 bool is64Bit()
const {
return Subtarget.is64Bit(); }
1528 bool isWin64()
const {
return Subtarget.isCallingConvWin64(CallConv); }
1530 X86MachineFunctionInfo *FuncInfo;
1533 const X86Subtarget &Subtarget;
1534 MachineFunction &TheMachineFunction;
1536 MachineFrameInfo &FrameInfo;
1537 const TargetFrameLowering &FrameLowering;
1538 const TargetLowering &TargLowering;
1539 CallingConv::ID CallConv;
1544void VarArgsLoweringHelper::createVarArgAreaAndStoreRegisters(
1545 SDValue &Chain,
unsigned StackSize) {
1552 FrameInfo.CreateFixedObject(1, StackSize,
true));
1562 unsigned NumIntRegs = CCInfo.getFirstUnallocated(
ArgGPRs);
1563 unsigned NumXMMRegs = CCInfo.getFirstUnallocated(ArgXMMs);
1565 assert(!(NumXMMRegs && !Subtarget.hasSSE1()) &&
1566 "SSE register cannot be used when SSE is disabled!");
1571 int HomeOffset = FrameLowering.getOffsetOfLocalArea() + 8;
1573 FrameInfo.CreateFixedObject(1, NumIntRegs * 8 + HomeOffset,
false));
1595 Register GPR = TheMachineFunction.addLiveIn(
Reg, &X86::GR64RegClass);
1598 const auto &AvailableXmms = ArgXMMs.
slice(NumXMMRegs);
1599 if (!AvailableXmms.empty()) {
1600 Register AL = TheMachineFunction.addLiveIn(X86::AL, &X86::GR8RegClass);
1607 TheMachineFunction.getRegInfo().addLiveIn(
Reg);
1618 for (
SDValue Val : LiveGPRs) {
1632 if (!LiveXMMRegs.
empty()) {
1648 SaveXMMOps, MVT::i8, StoreMMO));
1651 if (!MemOps.
empty())
1656void VarArgsLoweringHelper::forwardMustTailParameters(
SDValue &Chain) {
1658 MVT VecVT = MVT::Other;
1660 if (Subtarget.useAVX512Regs() &&
1663 VecVT = MVT::v16f32;
1664 else if (Subtarget.hasAVX())
1666 else if (Subtarget.hasSSE2())
1673 if (VecVT != MVT::Other)
1679 CCInfo.analyzeMustTailForwardedRegisters(Forwards, RegParmTypes,
CC_X86);
1682 if (
is64Bit() && !isWin64() && !CCInfo.isAllocated(X86::AL)) {
1683 Register ALVReg = TheMachineFunction.addLiveIn(X86::AL, &X86::GR8RegClass);
1691 FR.VReg = TheMachineFunction.getRegInfo().createVirtualRegister(
1692 TargLowering.getRegClassFor(FR.VT));
1697void VarArgsLoweringHelper::lowerVarArgsParameters(
SDValue &Chain,
1698 unsigned StackSize) {
1704 if (FrameInfo.hasVAStart())
1705 createVarArgAreaAndStoreRegisters(Chain, StackSize);
1707 if (FrameInfo.hasMustTailInVarArgFunc())
1708 forwardMustTailParameters(Chain);
1711SDValue X86TargetLowering::LowerFormalArguments(
1716 X86MachineFunctionInfo *FuncInfo = MF.
getInfo<X86MachineFunctionInfo>();
1719 if (
F.hasExternalLinkage() && Subtarget.isTargetCygMing() &&
1720 F.getName() ==
"main")
1724 bool Is64Bit = Subtarget.is64Bit();
1725 bool IsWin64 = Subtarget.isCallingConvWin64(CallConv);
1731 if (Is64Bit && !Subtarget.hasX87()) {
1732 if (
F.getReturnType()->isX86_FP80Ty() ||
1733 any_of(
F.args(), [](
const Argument &Arg) {
1734 return Arg.getType()->isX86_FP80Ty();
1737 "cannot use x86_fp80 type with x87 disabled on x86_64 target");
1742 "Var args not supported with calling conv' regcall, fastcc, ghc or hipe");
1746 CCState CCInfo(CallConv, IsVarArg, MF, ArgLocs, *DAG.
getContext());
1750 CCInfo.AllocateStack(32,
Align(8));
1752 CCInfo.AnalyzeArguments(Ins,
CC_X86);
1757 CCInfo.AnalyzeArgumentsSecondPass(Ins,
CC_X86);
1763 "Argument Location list must be sorted before lowering");
1766 for (
unsigned I = 0, InsIndex = 0,
E = ArgLocs.
size();
I !=
E;
1768 assert(InsIndex < Ins.
size() &&
"Invalid Ins index");
1769 CCValAssign &VA = ArgLocs[
I];
1776 "Currently the only custom case is when we split v64i1 to 2 regs");
1784 if (RegVT == MVT::i8)
1785 RC = &X86::GR8RegClass;
1786 else if (RegVT == MVT::i16)
1787 RC = &X86::GR16RegClass;
1788 else if (RegVT == MVT::i32)
1789 RC = &X86::GR32RegClass;
1790 else if (Is64Bit && RegVT == MVT::i64)
1791 RC = &X86::GR64RegClass;
1792 else if (RegVT == MVT::f16)
1793 RC = Subtarget.hasAVX512() ? &X86::FR16XRegClass : &X86::FR16RegClass;
1794 else if (RegVT == MVT::f32)
1795 RC = Subtarget.hasAVX512() ? &X86::FR32XRegClass : &X86::FR32RegClass;
1796 else if (RegVT == MVT::f64)
1797 RC = Subtarget.hasAVX512() ? &X86::FR64XRegClass : &X86::FR64RegClass;
1798 else if (RegVT == MVT::f80)
1799 RC = &X86::RFP80RegClass;
1800 else if (RegVT == MVT::f128)
1801 RC = &X86::VR128RegClass;
1803 RC = &X86::VR512RegClass;
1805 RC = Subtarget.hasVLX() ? &X86::VR256XRegClass : &X86::VR256RegClass;
1807 RC = Subtarget.hasVLX() ? &X86::VR128XRegClass : &X86::VR128RegClass;
1808 else if (RegVT == MVT::x86mmx)
1809 RC = &X86::VR64RegClass;
1810 else if (RegVT == MVT::v1i1)
1811 RC = &X86::VK1RegClass;
1812 else if (RegVT == MVT::v8i1)
1813 RC = &X86::VK8RegClass;
1814 else if (RegVT == MVT::v16i1)
1815 RC = &X86::VK16RegClass;
1816 else if (RegVT == MVT::v32i1)
1817 RC = &X86::VK32RegClass;
1818 else if (RegVT == MVT::v64i1)
1819 RC = &X86::VK64RegClass;
1855 LowerMemArgument(Chain, CallConv, Ins, dl, DAG, VA, MFI, InsIndex);
1860 !(Ins[
I].Flags.isByVal() && VA.
isRegLoc())) {
1862 DAG.
getLoad(VA.
getValVT(), dl, Chain, ArgValue, MachinePointerInfo());
1868 for (
unsigned I = 0,
E = Ins.
size();
I !=
E; ++
I) {
1869 if (Ins[
I].
Flags.isSwiftAsync()) {
1870 auto X86FI = MF.
getInfo<X86MachineFunctionInfo>();
1872 X86FI->setHasSwiftAsyncContext(
true);
1874 int PtrSize = Subtarget.is64Bit() ? 8 : 4;
1877 X86FI->setSwiftAsyncContextFrameIdx(FI);
1895 if (Ins[
I].
Flags.isSRet()) {
1897 "SRet return has already been set");
1908 unsigned StackSize = CCInfo.getStackSize();
1912 StackSize = GetAlignedArgumentStackSize(StackSize, DAG);
1915 VarArgsLoweringHelper(FuncInfo, dl, DAG, Subtarget, CallConv, CCInfo)
1916 .lowerVarArgsParameters(Chain, StackSize);
1953 EHInfo->PSPSymFrameIdx = PSPSymFI;
1958 F.hasFnAttribute(
"no_caller_saved_registers")) {
1960 for (std::pair<MCRegister, Register> Pair : MRI.
liveins())
1965 for (
const ISD::InputArg &In : Ins) {
1966 if (
In.Flags.isSwiftSelf() ||
In.Flags.isSwiftAsync() ||
1967 In.Flags.isSwiftError()) {
1969 "Swift attributes can't be used with preserve_none");
1982 bool isByVal)
const {
1990 MaybeAlign Alignment;
1991 if (Subtarget.isTargetWindowsMSVC() && !Subtarget.is64Bit() &&
1993 Alignment = MaybeAlign(4);
1995 Chain, dl, Arg, PtrOff,
2002SDValue X86TargetLowering::EmitTailCallLoadRetAddr(
2004 bool Is64Bit,
int FPDiff,
const SDLoc &dl)
const {
2010 OutRetAddr = DAG.
getLoad(VT, dl, Chain, OutRetAddr, MachinePointerInfo());
2018 EVT PtrVT,
unsigned SlotSize,
2019 int FPDiff,
const SDLoc &dl) {
2021 if (!FPDiff)
return Chain;
2023 int NewReturnAddrFI =
2027 Chain = DAG.
getStore(Chain, dl, RetAddrFrIdx, NewRetAddrFrIdx,
2038 SmallVector<int, 8>
Mask;
2039 Mask.push_back(NumElems);
2040 for (
unsigned i = 1; i != NumElems; ++i)
2051X86TargetLowering::ByValCopyKind X86TargetLowering::ByValNeedsCopyForTailCall(
2063 if (!SrcFrameIdxNode || !DstFrameIdxNode)
2066 int SrcFI = SrcFrameIdxNode->getIndex();
2067 int DstFI = DstFrameIdxNode->getIndex();
2069 "byval passed in non-fixed stack slot");
2077 if (!FixedSrc || (FixedSrc && SrcOffset < 0))
2082 if (SrcOffset == DstOffset)
2091 SelectionDAG &DAG = CLI.
DAG;
2093 SmallVectorImpl<ISD::OutputArg> &Outs = CLI.
Outs;
2094 SmallVectorImpl<SDValue> &OutVals = CLI.
OutVals;
2095 SmallVectorImpl<ISD::InputArg> &Ins = CLI.
Ins;
2101 const auto *CB = CLI.
CB;
2104 bool Is64Bit = Subtarget.is64Bit();
2105 bool IsWin64 = Subtarget.isCallingConvWin64(CallConv);
2108 X86MachineFunctionInfo *X86Info = MF.
getInfo<X86MachineFunctionInfo>();
2110 CB->hasFnAttr(
"no_caller_saved_registers"));
2119 bool IsNoTrackIndirectCall =
IsIndirectCall && CB->doesNoCfCheck() &&
2120 M->getModuleFlag(
"cf-protection-branch");
2121 if (IsNoTrackIndirectCall)
2124 MachineFunction::CallSiteInfo CSInfo;
2132 M->getModuleFlag(
"import-call-optimization"))
2134 "Indirect calls must have a normal calling convention if "
2135 "Import Call Optimization is enabled");
2139 CCState CCInfo(CallConv, isVarArg, MF, ArgLocs, *DAG.
getContext());
2143 CCInfo.AllocateStack(32,
Align(8));
2145 CCInfo.AnalyzeArguments(Outs,
CC_X86);
2150 CCInfo.AnalyzeArgumentsSecondPass(Outs,
CC_X86);
2154 if (isTailCall && ShouldGuaranteeTCO) {
2156 isTailCall = (CallConv == CallerCC);
2164 bool IsSibcall =
false;
2166 IsSibcall = isEligibleForSiblingCallOpt(CLI, CCInfo, ArgLocs);
2167 isTailCall = IsSibcall || IsMustTail || ShouldGuaranteeTCO;
2173 if (IsMustTail && !isTailCall)
2175 "site marked musttail");
2178 "Var args not supported with calling convention fastcc, ghc or hipe");
2181 unsigned NumBytes = CCInfo.getAlignedCallFrameSize();
2187 NumBytes = GetAlignedArgumentStackSize(NumBytes, DAG);
2191 if (isTailCall && ShouldGuaranteeTCO && !IsSibcall) {
2195 FPDiff = NumBytesCallerPushed - NumBytes;
2199 if (FPDiff < X86Info->getTCReturnAddrDelta())
2203 unsigned NumBytesToPush = NumBytes;
2204 unsigned NumBytesToPop = NumBytes;
2207 const X86RegisterInfo *RegInfo = Subtarget.getRegisterInfo();
2224 for (
const CCValAssign &VA : ArgLocs) {
2226 SDValue Src = OutVals[ArgIdx];
2227 ISD::ArgFlagsTy
Flags = Outs[ArgIdx].Flags;
2229 if (!
Flags.isByVal())
2246 ByValCopyKind
Copy = ByValNeedsCopyForTailCall(DAG, Src, Dst, Flags);
2248 if (Copy == NoCopy) {
2253 }
else if (Copy == CopyOnce) {
2257 ByValTemporaries[ArgIdx] = Src;
2259 assert(Copy == CopyViaTemp &&
"unexpected enum value");
2265 Flags.getNonZeroByValAlign(),
2273 ByValTemporaries[ArgIdx] = Temp;
2276 if (!ByValCopyChains.
empty())
2284 if (!Outs.
empty() && Outs.
back().Flags.isInAlloca()) {
2286 if (!ArgLocs.back().isMemLoc())
2289 if (ArgLocs.back().getLocMemOffset() != 0)
2291 "the only memory argument");
2293 assert(ArgLocs.back().isMemLoc() &&
2294 "cannot use preallocated attribute on a register "
2297 for (
size_t i = 0; i < CLI.
OutVals.size(); ++i) {
2299 PreallocatedOffsets.
push_back(ArgLocs[i].getLocMemOffset());
2303 size_t PreallocatedId = MFI->getPreallocatedIdForCallSite(CLI.
CB);
2304 MFI->setPreallocatedStackSize(PreallocatedId, NumBytes);
2305 MFI->setPreallocatedArgOffsets(PreallocatedId, PreallocatedOffsets);
2309 if (!IsSibcall && !IsMustTail)
2311 NumBytes - NumBytesToPush, dl);
2315 if (isTailCall && FPDiff)
2316 Chain = EmitTailCallLoadRetAddr(DAG, RetAddrFrIdx, Chain, isTailCall,
2317 Is64Bit, FPDiff, dl);
2325 "Argument Location list must be sorted before lowering");
2329 for (
unsigned I = 0, OutIndex = 0,
E = ArgLocs.size();
I !=
E;
2331 assert(OutIndex < Outs.
size() &&
"Invalid Out index");
2333 ISD::ArgFlagsTy
Flags = Outs[OutIndex].Flags;
2334 if (
Flags.isInAlloca() ||
Flags.isPreallocated())
2337 CCValAssign &VA = ArgLocs[
I];
2339 SDValue Arg = OutVals[OutIndex];
2340 bool isByVal =
Flags.isByVal();
2360 Arg = getMOVL(DAG, dl, MVT::v2i64, DAG.
getUNDEF(MVT::v2i64), Arg);
2373 Flags.getByValSize(),
2374 std::max(
Align(16),
Flags.getNonZeroByValAlign()),
false);
2387 Chain, dl, Arg, SpillSlot,
2397 "Currently the only custom case is when we split v64i1 to 2 regs");
2405 if (isVarArg && IsWin64) {
2410 case X86::XMM0: ShadowReg = X86::RCX;
break;
2411 case X86::XMM1: ShadowReg = X86::RDX;
break;
2412 case X86::XMM2: ShadowReg = X86::R8;
break;
2413 case X86::XMM3: ShadowReg = X86::R9;
break;
2416 RegsToPass.
push_back(std::make_pair(ShadowReg, Arg));
2418 }
else if (!IsSibcall && (!isTailCall || (isByVal && !IsMustTail))) {
2423 MemOpChains.
push_back(LowerMemOpCallTo(Chain, StackPtr, Arg,
2424 dl, DAG, VA, Flags, isByVal));
2428 if (!MemOpChains.
empty())
2431 if (Subtarget.isPICStyleGOT()) {
2454 if (
G && !
G->getGlobal()->hasLocalLinkage() &&
2455 G->getGlobal()->hasDefaultVisibility())
2456 Callee = LowerGlobalAddress(Callee, DAG);
2458 Callee = LowerExternalSymbol(Callee, DAG);
2462 if (Is64Bit && isVarArg && !IsWin64 && !IsMustTail &&
2463 (Subtarget.hasSSE1() || !
M->getModuleFlag(
"SkipRaxSetup"))) {
2474 X86::XMM0, X86::XMM1, X86::XMM2, X86::XMM3,
2475 X86::XMM4, X86::XMM5, X86::XMM6, X86::XMM7
2477 unsigned NumXMMRegs = CCInfo.getFirstUnallocated(XMMArgRegs);
2478 assert((Subtarget.hasSSE1() || !NumXMMRegs)
2479 &&
"SSE registers cannot be used when SSE is disabled");
2485 if (isVarArg && IsMustTail) {
2487 for (
const auto &
F : Forwards) {
2489 RegsToPass.
push_back(std::make_pair(
F.PReg, Val));
2496 if (isTailCall && !IsSibcall) {
2513 for (
unsigned I = 0, OutsIndex = 0,
E = ArgLocs.size();
I !=
E;
2515 CCValAssign &VA = ArgLocs[
I];
2520 "Expecting custom case only in regcall calling convention");
2530 SDValue Arg = OutVals[OutsIndex];
2531 ISD::ArgFlagsTy
Flags = Outs[OutsIndex].Flags;
2533 if (
Flags.isInAlloca() ||
Flags.isPreallocated())
2537 uint32_t OpSize = (VA.
getLocVT().getSizeInBits()+7)/8;
2541 if (
Flags.isByVal()) {
2542 if (
SDValue ByValSrc = ByValTemporaries[OutsIndex]) {
2547 ByValSrc, DstAddr, Chain, Flags, DAG, dl));
2552 Chain, dl, Arg, FIN,
2557 if (!MemOpChains2.
empty())
2569 for (
const auto &[
Reg,
N] : RegsToPass) {
2574 bool IsImpCall =
false;
2575 bool IsCFGuardCall =
false;
2577 assert(Is64Bit &&
"Large code model is only legal in 64-bit mode.");
2588 Callee = LowerGlobalOrExternal(Callee, DAG,
true, &IsImpCall);
2589 }
else if (Subtarget.isTarget64BitILP32() &&
2590 Callee.getValueType() == MVT::i32) {
2598 IsCFGuardCall =
true;
2600 GlobalAddressSDNode *GA =
2603 "CFG Call should be to a guard function");
2604 assert(LoadNode->getOffset()->isUndef() &&
2605 "CFG Function load should not have an offset");
2612 if (!IsSibcall && isTailCall && !IsMustTail) {
2617 Ops.push_back(Chain);
2618 Ops.push_back(Callee);
2625 for (
const auto &[
Reg,
N] : RegsToPass)
2629 const uint32_t *
Mask = [&]() {
2630 auto AdaptedCC = CallConv;
2638 if (CB && CB->hasFnAttr(
"no_callee_saved_registers"))
2642 assert(Mask &&
"Missing call preserved mask for calling convention");
2671 uint32_t *RegMask =
nullptr;
2679 const TargetRegisterInfo *
TRI = Subtarget.getRegisterInfo();
2684 memcpy(RegMask, Mask,
sizeof(RegMask[0]) * RegMaskSize);
2688 if (ShouldDisableArgRegs) {
2689 for (
auto const &RegPair : RegsToPass)
2690 for (
MCPhysReg SubReg :
TRI->subregs_inclusive(RegPair.first))
2691 RegMask[SubReg / 32] &= ~(1u << (SubReg % 32));
2702 Ops.push_back(InGlue);
2713 IsCFGuardCall ? X86ISD::TC_RETURN_GLOBALADDR : X86ISD::TC_RETURN;
2725 SDVTList NodeTys = DAG.
getVTList(MVT::Other, MVT::Glue);
2727 Chain = DAG.
getNode(X86ISD::IMP_CALL, dl, NodeTys,
Ops);
2728 }
else if (IsNoTrackIndirectCall) {
2729 Chain = DAG.
getNode(X86ISD::NT_CALL, dl, NodeTys,
Ops);
2730 }
else if (IsCFGuardCall) {
2731 Chain = DAG.
getNode(X86ISD::CALL_GLOBALADDR, dl, NodeTys,
Ops);
2737 "tail calls cannot be marked with clang.arc.attachedcall");
2738 assert(Is64Bit &&
"clang.arc.attachedcall is only supported in 64bit mode");
2745 Ops.insert(
Ops.begin() + 1, GA);
2746 Chain = DAG.
getNode(X86ISD::CALL_RVMARKER, dl, NodeTys,
Ops);
2748 Chain = DAG.
getNode(X86ISD::CALL, dl, NodeTys,
Ops);
2760 if (MDNode *HeapAlloc = CLI.
CB->
getMetadata(
"heapallocsite"))
2764 unsigned NumBytesForCalleeToPop = 0;
2767 NumBytesForCalleeToPop = NumBytes;
2771 NumBytesForCalleeToPop = 4;
2776 Chain = DAG.
getCALLSEQ_END(Chain, NumBytesToPop, NumBytesForCalleeToPop,
2782 for (
const ISD::OutputArg &Out : Outs) {
2786 "Swift attributes can't be used with preserve_none");
2793 return LowerCallResult(Chain, InGlue, CallConv, isVarArg, Ins, dl, DAG,
2831X86TargetLowering::GetAlignedArgumentStackSize(
const unsigned StackSize,
2833 const Align StackAlignment = Subtarget.getFrameLowering()->getStackAlign();
2834 const uint64_t SlotSize = Subtarget.getRegisterInfo()->getSlotSize();
2835 assert(StackSize % SlotSize == 0 &&
2836 "StackSize must be a multiple of SlotSize");
2837 return alignTo(StackSize + SlotSize, StackAlignment) - SlotSize;
2876 if (!Flags.isByVal()) {
2877 if (!
TII->isLoadFromStackSlot(*Def, FI))
2880 unsigned Opcode = Def->getOpcode();
2881 if ((Opcode == X86::LEA32r || Opcode == X86::LEA64r ||
2882 Opcode == X86::LEA64_32r) &&
2883 Def->getOperand(1).isFI()) {
2884 FI = Def->getOperand(1).getIndex();
2885 Bytes = Flags.getByValSize();
2890 if (Flags.isByVal())
2897 SDValue Ptr = Ld->getBasePtr();
2905 Bytes = Flags.getByValSize();
2939 const auto &Outs = CLI.
Outs;
2940 const auto &OutVals = CLI.
OutVals;
2945 for (
unsigned E = Outs.size(); Pos !=
E; ++Pos)
2946 if (Outs[Pos].Flags.isSRet())
2949 if (Pos == Outs.size())
2956 SDValue SRetArgVal = OutVals[Pos];
2977bool X86TargetLowering::isEligibleForSiblingCallOpt(
2980 SelectionDAG &DAG = CLI.
DAG;
2981 const SmallVectorImpl<ISD::OutputArg> &Outs = CLI.
Outs;
2982 const SmallVectorImpl<SDValue> &OutVals = CLI.
OutVals;
2983 const SmallVectorImpl<ISD::InputArg> &Ins = CLI.
Ins;
2993 X86MachineFunctionInfo *FuncInfo = MF.
getInfo<X86MachineFunctionInfo>();
3006 bool IsCalleeWin64 = Subtarget.isCallingConvWin64(CalleeCC);
3007 bool IsCallerWin64 = Subtarget.isCallingConvWin64(CallerCC);
3008 if (IsCalleeWin64 != IsCallerWin64)
3013 if (Subtarget.isLFI() && ArgLocs.
size() > 5)
3021 if (Subtarget.isPICStyleGOT()) {
3025 if (!
G->getGlobal()->hasLocalLinkage() &&
3026 G->getGlobal()->hasDefaultVisibility())
3036 const X86RegisterInfo *RegInfo = Subtarget.getRegisterInfo();
3037 if (RegInfo->hasStackRealignment(MF))
3057 if (isVarArg && !Outs.
empty()) {
3060 if (IsCalleeWin64 || IsCallerWin64)
3063 for (
const auto &VA : ArgLocs)
3072 for (
const auto &In : Ins) {
3080 CCState RVCCInfo(CalleeCC,
false, MF, RVLocs,
C);
3081 RVCCInfo.AnalyzeCallResult(Ins,
RetCC_X86);
3082 for (
const auto &VA : RVLocs) {
3093 const X86RegisterInfo *
TRI = Subtarget.getRegisterInfo();
3094 const uint32_t *CallerPreserved =
TRI->getCallPreservedMask(MF, CallerCC);
3095 if (CallerCC != CalleeCC) {
3096 const uint32_t *CalleePreserved =
TRI->getCallPreservedMask(MF, CalleeCC);
3097 if (!
TRI->regmaskSubsetEqual(CallerPreserved, CalleePreserved))
3105 if (CallerF.hasFnAttribute(
"no_caller_saved_registers"))
3112 if (!Outs.
empty()) {
3113 if (StackArgsSize > 0) {
3117 const MachineRegisterInfo *MRI = &MF.
getRegInfo();
3118 const X86InstrInfo *
TII = Subtarget.getInstrInfo();
3119 for (
unsigned I = 0,
E = ArgLocs.size();
I !=
E; ++
I) {
3120 const CCValAssign &VA = ArgLocs[
I];
3122 ISD::ArgFlagsTy
Flags = Outs[
I].Flags;
3141 PositionIndependent)) {
3142 unsigned NumInRegs = 0;
3145 unsigned MaxInRegs = PositionIndependent ? 2 : 3;
3147 for (
const auto &VA : ArgLocs) {
3153 case X86::EAX:
case X86::EDX:
case X86::ECX:
3154 if (++NumInRegs == MaxInRegs)
3161 const MachineRegisterInfo &MRI = MF.
getRegInfo();
3166 bool CalleeWillPop =
3172 bool CalleePopMatches = CalleeWillPop && BytesToPop == StackArgsSize;
3173 if (!CalleePopMatches)
3175 }
else if (CalleeWillPop && StackArgsSize > 0) {
3186 bool is64Bit,
bool IsVarArg,
bool GuaranteeTCO) {
static bool canGuaranteeTCO(CallingConv::ID CC, bool GuaranteeTailCalls)
Return true if the calling convention is one that we can guarantee TCO for.
static bool mayTailCallThisCC(CallingConv::ID CC)
Return true if we might ever do TCO for calls with this calling convention.
assert(UImm &&(UImm !=~static_cast< T >(0)) &&"Invalid immediate!")
MachineBasicBlock MachineBasicBlock::iterator DebugLoc DL
static GCRegistry::Add< ErlangGC > A("erlang", "erlang-compatible garbage collector")
static GCRegistry::Add< CoreCLRGC > E("coreclr", "CoreCLR-compatible GC")
static GCRegistry::Add< OcamlGC > B("ocaml", "ocaml 3.10-compatible GC")
const HexagonInstrInfo * TII
static bool IsIndirectCall(const MachineInstr *MI)
static SDValue CreateCopyOfByValArgument(SDValue Src, SDValue Dst, SDValue Chain, ISD::ArgFlagsTy Flags, SelectionDAG &DAG, const SDLoc &dl)
CreateCopyOfByValArgument - Make a copy of an aggregate at address specified by "Src" to address "Dst...
Module.h This file contains the declarations for the Module class.
const AbstractManglingParser< Derived, Alloc >::OperatorInfo AbstractManglingParser< Derived, Alloc >::Ops[]
const MCPhysReg ArgGPRs[]
static bool shouldGuaranteeTCO(CallingConv::ID CC, bool GuaranteedTailCallOpt)
Return true if the function is being made into a tailcall target by changing its ABI.
static bool MatchingStackOffset(SDValue Arg, unsigned Offset, ISD::ArgFlagsTy Flags, MachineFrameInfo &MFI, const MachineRegisterInfo *MRI, const M68kInstrInfo *TII, const CCValAssign &VA)
Return true if the given stack call argument is already available in the same position (relatively) o...
Machine Check Debug Module
Register const TargetRegisterInfo * TRI
Promote Memory to Register
This file defines ARC utility functions which are used by various parts of the compiler.
static CodeModel::Model getCodeModel(const PPCSubtarget &S, const TargetMachine &TM, const MachineOperand &MO)
static void getMaxByValAlign(Type *Ty, Align &MaxAlign, Align MaxMaxAlign)
getMaxByValAlign - Helper for getByValTypeAlignment to determine the desired ByVal argument alignment...
static bool contains(SmallPtrSetImpl< ConstantExpr * > &Cache, ConstantExpr *Expr, Constant *C)
This file defines the 'Statistic' class, which is designed to be an easy way to expose various metric...
#define STATISTIC(VARNAME, DESC)
static Function * getFunction(FunctionType *Ty, const Twine &Name, Module *M)
static bool is64Bit(const char *name)
static SDValue lowerMasksToReg(const SDValue &ValArg, const EVT &ValLoc, const SDLoc &DL, SelectionDAG &DAG)
Lowers masks values (v*i1) to the local register values.
static void Passv64i1ArgInRegs(const SDLoc &DL, SelectionDAG &DAG, SDValue &Arg, SmallVectorImpl< std::pair< Register, SDValue > > &RegsToPass, CCValAssign &VA, CCValAssign &NextVA, const X86Subtarget &Subtarget)
Breaks v64i1 value into two registers and adds the new node to the DAG.
static SDValue getv64i1Argument(CCValAssign &VA, CCValAssign &NextVA, SDValue &Root, SelectionDAG &DAG, const SDLoc &DL, const X86Subtarget &Subtarget, SDValue *InGlue=nullptr)
Reads two 32 bit registers and creates a 64 bit mask value.
static ArrayRef< MCPhysReg > get64BitArgumentXMMs(MachineFunction &MF, CallingConv::ID CallConv, const X86Subtarget &Subtarget)
static bool isSortedByValueNo(ArrayRef< CCValAssign > ArgLocs)
static ArrayRef< MCPhysReg > get64BitArgumentGPRs(CallingConv::ID CallConv, const X86Subtarget &Subtarget)
static SDValue getPopFromX87Reg(SelectionDAG &DAG, SDValue Chain, const SDLoc &dl, Register Reg, EVT VT, SDValue Glue)
static bool mayBeSRetTailCallCompatible(const TargetLowering::CallLoweringInfo &CLI, Register CallerSRetReg)
static std::pair< MVT, unsigned > handleMaskRegisterForCallingConv(unsigned NumElts, CallingConv::ID CC, const X86Subtarget &Subtarget)
static bool shouldDisableRetRegFromCSR(CallingConv::ID CC)
Returns true if a CC can dynamically exclude a register from the list of callee-saved-registers (Targ...
static void errorUnsupported(SelectionDAG &DAG, const SDLoc &dl, const char *Msg)
Call this when the user attempts to do something unsupported, like returning a double without SSE2 en...
static SDValue EmitTailCallStoreRetAddr(SelectionDAG &DAG, MachineFunction &MF, SDValue Chain, SDValue RetAddrFrIdx, EVT PtrVT, unsigned SlotSize, int FPDiff, const SDLoc &dl)
Emit a store of the return address if tail call optimization is performed and it is required (FPDiff!...
static bool shouldDisableArgRegFromCSR(CallingConv::ID CC)
Returns true if a CC can dynamically exclude a register from the list of callee-saved-registers (Targ...
static bool hasStackGuardSlotTLS(const Triple &TargetTriple)
static SDValue lowerRegToMasks(const SDValue &ValArg, const EVT &ValVT, const EVT &ValLoc, const SDLoc &DL, SelectionDAG &DAG)
The function will lower a register of various sizes (8/16/32/64) to a mask value of the expected size...
static Constant * SegmentOffset(IRBuilderBase &IRB, int Offset, unsigned AddressSpace)
static bool hasCalleePopSRet(const SmallVectorImpl< T > &Args, const SmallVectorImpl< CCValAssign > &ArgLocs, const X86Subtarget &Subtarget)
Determines whether Args, either a set of outgoing arguments to a call, or a set of incoming args of a...
static bool isBitAligned(Align Alignment, uint64_t SizeInBits)
Represent a constant reference to an array (0 or more elements consecutively in memory),...
size_t size() const
Get the array size.
ArrayRef< T > slice(size_t N, size_t M) const
slice(n, m) - Chop off the first N elements of the array, and keep M elements in the array.
const Function * getParent() const
Return the enclosing method, or null if none.
CCState - This class holds information needed while lowering arguments and return values.
static LLVM_ABI bool resultsCompatible(CallingConv::ID CalleeCC, CallingConv::ID CallerCC, MachineFunction &MF, LLVMContext &C, const SmallVectorImpl< ISD::InputArg > &Ins, CCAssignFn CalleeFn, CCAssignFn CallerFn)
Returns true if the results of the two calling conventions are compatible.
uint64_t getStackSize() const
Returns the size of the currently allocated portion of the stack.
CCValAssign - Represent assignment of one arg/retval to a location.
void convertToReg(MCRegister Reg)
Register getLocReg() const
LocInfo getLocInfo() const
int64_t getLocMemOffset() const
unsigned getValNo() const
CallingConv::ID getCallingConv() const
LLVM_ABI bool paramHasAttr(unsigned ArgNo, Attribute::AttrKind Kind) const
Determine whether the argument or parameter has the given attribute.
LLVM_ABI bool isMustTailCall() const
Tests if this call site must be tail call optimized.
This class represents a function call, abstracting a target machine's calling convention.
static LLVM_ABI Constant * getIntToPtr(Constant *C, Type *Ty, bool OnlyIfReduced=false)
static ConstantInt * getSigned(IntegerType *Ty, int64_t V, bool ImplicitTrunc=false)
Return a ConstantInt with the specified value for the specified type.
uint64_t getZExtValue() const
Return the constant as a 64-bit unsigned integer value after it has been zero extended as appropriate...
This is an important base class in LLVM.
A parsed version of the target data layout string in and methods for querying it.
LLVM_ABI TypeSize getTypeAllocSize(Type *Ty) const
Returns the offset in bytes between successive objects of the specified type, including alignment pad...
Diagnostic information for unsupported feature in backend.
A handy container for a FunctionType+Callee-pointer pair, which can be passed around as a single enti...
CallingConv::ID getCallingConv() const
getCallingConv()/setCallingConv(CC) - These method get and set the calling convention of this functio...
bool hasPersonalityFn() const
Check whether this function has a personality function.
Constant * getPersonalityFn() const
Get the personality function associated with this function.
bool hasFnAttribute(Attribute::AttrKind Kind) const
Return true if the function has the attribute.
const GlobalValue * getGlobal() const
Module * getParent()
Get the module that this global value is contained inside of...
void setDSOLocal(bool Local)
@ ExternalLinkage
Externally visible function.
Common base class shared among various IRBuilders.
BasicBlock * GetInsertBlock() const
LLVMContext & getContext() const
PointerType * getPtrTy(unsigned AddrSpace=0)
Fetch the type representing a pointer.
MDNode * getMetadata(unsigned KindID) const
Get the metadata of given kind attached to this Instruction.
This is an important class for using LLVM in a threaded context.
LLVM_ABI void diagnose(const DiagnosticInfo &DI)
Report a message to the currently installed diagnostic handler.
Tracks which library functions to use for a particular subtarget.
This class is used to represent ISD::LOAD nodes.
Context object for machine code objects.
Base class for the full range of assembler expressions which are needed for parsing.
static const MCSymbolRefExpr * create(const MCSymbol *Symbol, MCContext &Ctx, SMLoc Loc=SMLoc())
@ INVALID_SIMPLE_VALUE_TYPE
unsigned getVectorNumElements() const
bool isVector() const
Return true if this is a vector value type.
bool is512BitVector() const
Return true if this is a 512-bit vector type.
TypeSize getSizeInBits() const
Returns the size of the specified MVT in bits.
uint64_t getFixedSizeInBits() const
Return the size of the specified fixed width value type in bits.
MVT getVectorElementType() const
MVT getScalarType() const
If this is a vector, return the element type, otherwise return this.
The MachineFrameInfo class represents an abstract stack frame until prolog/epilog code is inserted.
LLVM_ABI int CreateFixedObject(uint64_t Size, int64_t SPOffset, bool IsImmutable, bool isAliased=false)
Create a new object at a fixed location on the stack.
void setObjectZExt(int ObjectIdx, bool IsZExt)
LLVM_ABI int CreateStackObject(uint64_t Size, Align Alignment, bool isSpillSlot, const AllocaInst *Alloca=nullptr, uint8_t ID=0)
Create a new statically sized stack object, returning a nonnegative identifier to represent it.
void setObjectSExt(int ObjectIdx, bool IsSExt)
bool isImmutableObjectIndex(int ObjectIdx) const
Returns true if the specified index corresponds to an immutable object.
void setHasTailCall(bool V=true)
bool isObjectZExt(int ObjectIdx) const
int64_t getObjectSize(int ObjectIdx) const
Return the size of the specified object.
bool isObjectSExt(int ObjectIdx) const
int64_t getObjectOffset(int ObjectIdx) const
Return the assigned stack offset of the specified object from the incoming stack pointer.
bool isFixedObjectIndex(int ObjectIdx) const
Returns true if the specified index corresponds to a fixed stack object.
int getObjectIndexBegin() const
Return the minimum frame object index.
const WinEHFuncInfo * getWinEHFuncInfo() const
getWinEHFuncInfo - Return information about how the current function uses Windows exception handling.
MCSymbol * getPICBaseSymbol() const
getPICBaseSymbol - Return a function-local symbol to represent the PIC base.
MachineMemOperand * getMachineMemOperand(MachinePointerInfo PtrInfo, MachineMemOperand::Flags f, LLT MemTy, Align base_alignment, const AAMDNodes &AAInfo=AAMDNodes(), const MDNode *Ranges=nullptr, SyncScope::ID SSID=SyncScope::System, AtomicOrdering Ordering=AtomicOrdering::NotAtomic, AtomicOrdering FailureOrdering=AtomicOrdering::NotAtomic)
getMachineMemOperand - Allocate a new MachineMemOperand.
MachineFrameInfo & getFrameInfo()
getFrameInfo - Return the frame info object for the current function.
uint32_t * allocateRegMask()
Allocate and initialize a register mask with NumRegister bits.
MachineRegisterInfo & getRegInfo()
getRegInfo - Return information about the registers currently in use.
const DataLayout & getDataLayout() const
Return the DataLayout attached to the Module associated to this MF.
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...
Register addLiveIn(MCRegister PReg, const TargetRegisterClass *RC)
addLiveIn - Add the specified physical register as a live-in value and create a corresponding virtual...
const TargetMachine & getTarget() const
getTarget - Return the target machine this machine code is compiled with
Representation of each machine instruction.
@ EK_Custom32
EK_Custom32 - Each entry is a 32-bit value that is custom lowered by the TargetLowering::LowerCustomJ...
@ EK_LabelDifference64
EK_LabelDifference64 - Each entry is the address of the block minus the address of the jump table.
A description of a memory reference used in the backend.
Flags
Flags values. These may be or'd together.
@ MOLoad
The memory access reads data.
@ MONonTemporal
The memory access is non-temporal.
@ MOStore
The memory access writes data.
static unsigned getRegMaskSize(unsigned NumRegs)
Returns number of elements needed for a regmask array.
static bool clobbersPhysReg(const uint32_t *RegMask, MCRegister PhysReg)
clobbersPhysReg - Returns true if this RegMask clobbers PhysReg.
MachineRegisterInfo - Keep track of information for virtual and physical registers,...
LLVM_ABI MachineInstr * getVRegDef(Register Reg) const
getVRegDef - Return the machine instr that defines the specified virtual register or null if none is ...
LLVM_ABI Register createVirtualRegister(const TargetRegisterClass *RegClass, StringRef Name="")
createVirtualRegister - Create and return a new virtual register in the function with the specified r...
ArrayRef< std::pair< MCRegister, Register > > liveins() const
LLVM_ABI void disableCalleeSavedRegister(MCRegister Reg)
Disables the register from the list of CSRs.
A Module instance is used to store all the information related to an LLVM module.
static PointerType * getUnqual(Type *ElementType)
This constructs a pointer to an object of the specified type in the default address space (address sp...
Wrapper class representing virtual and physical registers.
constexpr bool isVirtual() const
Return true if the specified register number is in the virtual register namespace.
Wrapper class for IR location info (IR ordering and DebugLoc) to be passed into SDNode creation funct...
const DebugLoc & getDebugLoc() const
Represents one node in the SelectionDAG.
EVT getValueType(unsigned ResNo) const
Return the type of a specified result.
void setCFIType(uint32_t Type)
iterator_range< user_iterator > users()
Unlike LLVM values, Selection DAG nodes may return multiple values as the result of a computation.
SDNode * getNode() const
get the SDNode which holds the desired result
SDValue getValue(unsigned R) const
EVT getValueType() const
Return the ValueType of the referenced return value.
TypeSize getValueSizeInBits() const
Returns the size of the value in bits.
const SDValue & getOperand(unsigned i) const
MVT getSimpleValueType() const
Return the simple ValueType of the referenced return value.
unsigned getOpcode() const
This is used to represent a portion of an LLVM function in a low-level Data Dependence DAG representa...
SDValue getTargetGlobalAddress(const GlobalValue *GV, const SDLoc &DL, EVT VT, int64_t offset=0, unsigned TargetFlags=0)
LLVM_ABI SDValue getStackArgumentTokenFactor(SDValue Chain)
Compute a TokenFactor to force all the incoming stack arguments to be loaded from the stack.
SDValue getCopyToReg(SDValue Chain, const SDLoc &dl, Register Reg, SDValue N)
LLVM_ABI SDVTList getVTList(EVT VT)
Return an SDVTList that represents the list of values specified.
LLVM_ABI SDValue getRegister(Register Reg, EVT VT)
LLVM_ABI SDValue getLoad(EVT VT, const SDLoc &dl, SDValue Chain, SDValue Ptr, MachinePointerInfo PtrInfo, MaybeAlign Alignment=MaybeAlign(), MachineMemOperand::Flags MMOFlags=MachineMemOperand::MONone, const AAMDNodes &AAInfo=AAMDNodes(), const MDNode *Ranges=nullptr)
Loads are not normal binary operators: their result type is not determined by their operands,...
LLVM_ABI SDValue getMemIntrinsicNode(unsigned Opcode, const SDLoc &dl, SDVTList VTList, ArrayRef< SDValue > Ops, EVT MemVT, MachinePointerInfo PtrInfo, Align Alignment, MachineMemOperand::Flags Flags=MachineMemOperand::MOLoad|MachineMemOperand::MOStore, LocationSize Size=LocationSize::precise(0), const AAMDNodes &AAInfo=AAMDNodes())
Creates a MemIntrinsicNode that may produce a result and takes a list of operands.
void addNoMergeSiteInfo(const SDNode *Node, bool NoMerge)
Set NoMergeSiteInfo to be associated with Node if NoMerge is true.
LLVM_ABI SDValue getMemcpy(SDValue Chain, const SDLoc &dl, SDValue Dst, SDValue Src, SDValue Size, Align DstAlign, Align SrcAlign, bool isVol, bool AlwaysInline, const CallInst *CI, std::optional< bool > OverrideTailCall, MachinePointerInfo DstPtrInfo, MachinePointerInfo SrcPtrInfo, const AAMDNodes &AAInfo=AAMDNodes(), BatchAAResults *BatchAA=nullptr)
SDValue getUNDEF(EVT VT)
Return an UNDEF node. UNDEF does not have a useful SDLoc.
SDValue getCALLSEQ_END(SDValue Chain, SDValue Op1, SDValue Op2, SDValue InGlue, const SDLoc &DL)
Return a new CALLSEQ_END node, which always must have a glue result (to ensure it's not CSE'd).
LLVM_ABI SDValue getBitcast(EVT VT, SDValue V)
Return a bitcast using the SDLoc of the value operand, and casting to the provided type.
SDValue getCopyFromReg(SDValue Chain, const SDLoc &dl, Register Reg, EVT VT)
const DataLayout & getDataLayout() const
void addHeapAllocSite(const SDNode *Node, MDNode *MD)
Set HeapAllocSite to be associated with Node.
LLVM_ABI SDValue getConstant(uint64_t Val, const SDLoc &DL, EVT VT, bool isTarget=false, bool isOpaque=false)
Create a ConstantSDNode wrapping a constant value.
SDValue getSignedTargetConstant(int64_t Val, const SDLoc &DL, EVT VT, bool isOpaque=false)
LLVM_ABI SDValue getStore(SDValue Chain, const SDLoc &dl, SDValue Val, SDValue Ptr, MachinePointerInfo PtrInfo, Align Alignment, MachineMemOperand::Flags MMOFlags=MachineMemOperand::MONone, const AAMDNodes &AAInfo=AAMDNodes())
Helper function to build ISD::STORE nodes.
SDValue getCALLSEQ_START(SDValue Chain, uint64_t InSize, uint64_t OutSize, const SDLoc &DL)
Return a new CALLSEQ_START node, that starts new call frame, in which InSize bytes are set up inside ...
const TargetMachine & getTarget() const
LLVM_ABI SDValue getIntPtrConstant(uint64_t Val, const SDLoc &DL, bool isTarget=false)
LLVM_ABI SDValue getValueType(EVT)
LLVM_ABI SDValue getNode(unsigned Opcode, const SDLoc &DL, EVT VT, ArrayRef< SDUse > Ops)
Gets or creates the specified node.
SDValue getTargetConstant(uint64_t Val, const SDLoc &DL, EVT VT, bool isOpaque=false)
MachineFunction & getMachineFunction() const
LLVM_ABI SDValue getFrameIndex(int FI, EVT VT, bool isTarget=false)
LLVM_ABI SDValue getRegisterMask(const uint32_t *RegMask)
void addCallSiteInfo(const SDNode *Node, CallSiteInfo &&CallInfo)
Set CallSiteInfo to be associated with Node.
LLVMContext * getContext() const
LLVM_ABI SDValue CreateStackTemporary(TypeSize Bytes, Align Alignment)
Create a stack temporary based on the size in bytes and the alignment.
SDValue getEntryNode() const
Return the token chain corresponding to the entry of the function.
LLVM_ABI std::pair< SDValue, SDValue > SplitScalar(const SDValue &N, const SDLoc &DL, const EVT &LoVT, const EVT &HiVT)
Split the scalar node with EXTRACT_ELEMENT using the provided VTs and return the low/high part.
LLVM_ABI SDValue getVectorShuffle(EVT VT, const SDLoc &dl, SDValue N1, SDValue N2, ArrayRef< int > Mask)
Return an ISD::VECTOR_SHUFFLE node.
This class consists of common code factored out of the SmallVector class to reduce code duplication b...
void assign(size_type NumElts, ValueParamT Elt)
void push_back(const T &Elt)
This is a 'vector' (really, a variable-sized array), optimized for the case when the array is small.
Represent a constant reference to a string, i.e.
constexpr bool empty() const
Check if the string is empty.
Class to represent struct types.
virtual const TargetRegisterClass * getRegClassFor(MVT VT, bool isDivergent=false) const
Return the register class that should be used for the specified value type.
virtual Value * getIRStackGuard(IRBuilderBase &IRB, const LibcallLoweringInfo &Libcalls) const
If the target has a standard location for the stack protector guard, returns the address of that loca...
const TargetMachine & getTargetMachine() const
virtual unsigned getNumRegistersForCallingConv(LLVMContext &Context, CallingConv::ID CC, EVT VT) const
Certain targets require unusual breakdowns of certain types.
virtual MVT getRegisterTypeForCallingConv(LLVMContext &Context, CallingConv::ID CC, EVT VT) const
Certain combinations of ABIs, Targets and features require that types are legal for some operations a...
virtual void insertSSPDeclarations(Module &M, const LibcallLoweringInfo &Libcalls) const
Inserts necessary declarations for SSP (stack protection) purpose.
virtual unsigned getVectorTypeBreakdownForCallingConv(LLVMContext &Context, CallingConv::ID CC, EVT VT, EVT &IntermediateVT, unsigned &NumIntermediates, MVT &RegisterVT) const
Certain targets such as MIPS require that some types such as vectors are always broken down into scal...
bool isTypeLegal(EVT VT) const
Return true if the target has native support for the specified value type.
virtual MVT getPointerTy(const DataLayout &DL, uint32_t AS=0) const
Return the pointer type for the given address space, defaults to the pointer type from the data layou...
virtual std::pair< const TargetRegisterClass *, uint8_t > findRepresentativeClass(const TargetRegisterInfo *TRI, MVT VT) const
Return the largest legal super-reg register class of the register class for the specified type and it...
static StringRef getLibcallImplName(RTLIB::LibcallImpl Call)
Get the libcall routine name for the specified libcall implementation.
virtual Value * getSafeStackPointerLocation(IRBuilderBase &IRB, const LibcallLoweringInfo &Libcalls) const
Returns the target-specific address of the unsafe stack pointer.
LegalizeTypeAction getTypeAction(LLVMContext &Context, EVT VT) const
Return how we should legalize values of this type, either it is already legal (return 'Legal') or we ...
std::vector< ArgListEntry > ArgListTy
MVT getRegisterType(MVT VT) const
Return the type of registers that this ValueType will eventually require.
virtual const MCExpr * getPICJumpTableRelocBaseExpr(const MachineFunction *MF, unsigned JTI, MCContext &Ctx) const
This returns the relocation base for the given PIC jumptable, the same as getPICJumpTableRelocBase,...
bool parametersInCSRMatch(const MachineRegisterInfo &MRI, const uint32_t *CallerPreservedMask, const SmallVectorImpl< CCValAssign > &ArgLocs, const SmallVectorImpl< SDValue > &OutVals) const
Check whether parameters to a call that are passed in callee saved registers are the same as from the...
bool isPositionIndependent() const
virtual ArrayRef< MCPhysReg > getRoundingControlRegisters() const
Returns a 0 terminated array of rounding control registers that can be attached into strict FP call.
virtual unsigned getJumpTableEncoding() const
Return the entry encoding for a jump table in the current function.
void setTypeIdForCallsiteInfo(const CallBase *CB, MachineFunction &MF, MachineFunction::CallSiteInfo &CSInfo) const
CodeModel::Model getCodeModel() const
Returns the code model.
unsigned GuaranteedTailCallOpt
GuaranteedTailCallOpt - This flag is enabled when -tailcallopt is specified on the commandline.
TargetRegisterInfo base class - We assume that the target defines a static array of TargetRegisterDes...
Triple - Helper class for working with autoconf configuration names.
bool isAndroid() const
Tests whether the target is Android.
bool isMusl() const
Tests whether the environment is musl-libc.
bool isOSGlibc() const
Tests whether the OS uses glibc.
The instances of the Type class are immutable: once they are created, they are never changed.
static LLVM_ABI IntegerType * getInt64Ty(LLVMContext &C)
bool isX86_FP80Ty() const
Return true if this is x86 long double.
static LLVM_ABI IntegerType * getInt32Ty(LLVMContext &C)
static LLVM_ABI Type * getVoidTy(LLVMContext &C)
Value * getOperand(unsigned i) const
LLVM Value Representation.
void setBytesToPopOnReturn(unsigned bytes)
void setBPClobberedByCall(bool C)
void setFPClobberedByCall(bool C)
unsigned getVarArgsGPOffset() const
int getRegSaveFrameIndex() const
Register getSRetReturnReg() const
void setVarArgsGPOffset(unsigned Offset)
void setRegSaveFrameIndex(int Idx)
void setForceFramePointer(bool forceFP)
void setSRetReturnReg(Register Reg)
unsigned getVarArgsFPOffset() const
void setArgumentStackSize(unsigned size)
SmallVectorImpl< ForwardedRegister > & getForwardedMustTailRegParms()
void setTCReturnAddrDelta(int delta)
void setVarArgsFrameIndex(int Idx)
void setBPClobberedByInvoke(bool C)
void setFPClobberedByInvoke(bool C)
unsigned getBytesToPopOnReturn() const
void setVarArgsFPOffset(unsigned Offset)
const uint32_t * getCallPreservedMask(const MachineFunction &MF, CallingConv::ID) const override
Register getStackRegister() const
unsigned getSlotSize() const
Register getFramePtr() const
Returns physical register used as frame pointer.
Register getBaseRegister() const
const uint32_t * getNoPreservedMask() const override
const Triple & getTargetTriple() const
bool useAVX512Regs() const
bool isCallingConvWin64(CallingConv::ID CC) const
bool isOSWindowsOrUEFI() const
std::pair< const TargetRegisterClass *, uint8_t > findRepresentativeClass(const TargetRegisterInfo *TRI, MVT VT) const override
Return the largest legal super-reg register class of the register class for the specified type and it...
SDValue getPICJumpTableRelocBase(SDValue Table, SelectionDAG &DAG) const override
Returns relocation base for the given PIC jumptable.
unsigned getJumpTableEncoding() const override
Return the entry encoding for a jump table in the current function.
bool isMemoryAccessFast(EVT VT, Align Alignment) const
Value * getIRStackGuard(IRBuilderBase &IRB, const LibcallLoweringInfo &Libcalls) const override
If the target has a standard location for the stack protector cookie, returns the address of that loc...
bool useSoftFloat() const override
Value * getSafeStackPointerLocation(IRBuilderBase &IRB, const LibcallLoweringInfo &Libcalls) const override
Return true if the target stores SafeStack pointer at a fixed offset in some non-standard address spa...
const MCExpr * getPICJumpTableRelocBaseExpr(const MachineFunction *MF, unsigned JTI, MCContext &Ctx) const override
This returns the relocation base for the given PIC jumptable, the same as getPICJumpTableRelocBase,...
bool isSafeMemOpType(MVT VT) const override
Returns true if it's safe to use load / store of the specified type to expand memcpy / memset inline.
bool functionArgumentNeedsConsecutiveRegisters(Type *Ty, CallingConv::ID CallConv, bool isVarArg, const DataLayout &DL) const override
For some targets, an LLVM struct type must be broken down into multiple simple types,...
Align getByValTypeAlignment(Type *Ty, const DataLayout &DL) const override
Return the desired alignment for ByVal aggregate function arguments in the caller parameter area.
MVT getRegisterTypeForCallingConv(LLVMContext &Context, CallingConv::ID CC, EVT VT) const override
Certain combinations of ABIs, Targets and features require that types are legal for some operations a...
bool allowsMisalignedMemoryAccesses(EVT VT, unsigned AS, Align Alignment, MachineMemOperand::Flags Flags, unsigned *Fast) const override
Returns true if the target allows unaligned memory accesses of the specified type.
EVT getOptimalMemOpType(LLVMContext &Context, const MemOp &Op, const AttributeList &FuncAttributes) const override
It returns EVT::Other if the type should be determined using generic target-independent logic.
unsigned getVectorTypeBreakdownForCallingConv(LLVMContext &Context, CallingConv::ID CC, EVT VT, EVT &IntermediateVT, unsigned &NumIntermediates, MVT &RegisterVT) const override
Certain targets such as MIPS require that some types such as vectors are always broken down into scal...
void markLibCallAttributes(MachineFunction *MF, unsigned CC, ArgListTy &Args) const override
void insertSSPDeclarations(Module &M, const LibcallLoweringInfo &Libcalls) const override
Inserts necessary declarations for SSP (stack protection) purpose.
bool isScalarFPTypeInSSEReg(EVT VT) const
Return true if the specified scalar FP type is computed in an SSE register, not on the X87 floating p...
unsigned getNumRegistersForCallingConv(LLVMContext &Context, CallingConv::ID CC, EVT VT) const override
Certain targets require unusual breakdowns of certain types.
bool allowsMemoryAccess(LLVMContext &Context, const DataLayout &DL, EVT VT, unsigned AddrSpace, Align Alignment, MachineMemOperand::Flags Flags=MachineMemOperand::MONone, unsigned *Fast=nullptr) const override
This function returns true if the memory access is aligned or if the target allows this specific unal...
SDValue getReturnAddressFrameIndex(SelectionDAG &DAG) const
SDValue unwrapAddress(SDValue N) const override
EVT getSetCCResultType(const DataLayout &DL, LLVMContext &Context, EVT VT) const override
Return the value type to use for ISD::SETCC.
EVT getTypeToTransformTo(LLVMContext &Context, EVT VT) const override
For types supported by the target, this is an identity function.
const MCExpr * LowerCustomJumpTableEntry(const MachineJumpTableInfo *MJTI, const MachineBasicBlock *MBB, unsigned uid, MCContext &Ctx) const override
constexpr ScalarTy getFixedValue() const
#define llvm_unreachable(msg)
Marks that the current location is not supposed to be reachable.
constexpr char Align[]
Key for Kernel::Arg::Metadata::mAlign.
constexpr std::underlying_type_t< E > Mask()
Get a bitmask with 1s in all places up to the high-order bit of E's largest value.
CallingConv Namespace - This namespace contains an enum with a value for the well-known calling conve...
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).
@ Swift
Calling convention for Swift.
@ PreserveMost
Used for runtime calls that preserves most registers.
@ X86_INTR
x86 hardware interrupt context.
@ GHC
Used by the Glasgow Haskell Compiler (GHC).
@ X86_ThisCall
Similar to X86_StdCall.
@ PreserveAll
Used for runtime calls that preserves (almost) all registers.
@ X86_StdCall
stdcall is mostly used by the Win32 API.
@ Fast
Attempts to make calls as fast as possible (e.g.
@ X86_VectorCall
MSVC calling convention that passes vectors and vector aggregates in SSE registers.
@ Intel_OCL_BI
Used for Intel OpenCL built-ins.
@ PreserveNone
Used for runtime calls that preserves none general registers.
@ Tail
Attemps to make calls as fast as possible while guaranteeing that tail call optimization can always b...
@ 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 ...
@ X86_RegCall
Register calling convention used for parameters transfer optimization.
@ C
The default llvm calling convention, compatible with C.
@ X86_FastCall
'fast' analog of X86_StdCall.
NodeType
ISD::NodeType enum - This enum defines the target-independent operators for a SelectionDAG.
@ ADD
Simple integer binary arithmetic operators.
@ ANY_EXTEND
ANY_EXTEND - Used for integer types. The high bits are undefined.
@ CONCAT_VECTORS
CONCAT_VECTORS(VECTOR0, VECTOR1, ...) - Given a number of values of vector type with the same length ...
@ BITCAST
BITCAST - This operator converts between integer, vector and FP values, as if the value was stored to...
@ SIGN_EXTEND
Conversion operators.
@ SCALAR_TO_VECTOR
SCALAR_TO_VECTOR(VAL) - This represents the operation of loading a scalar value into element 0 of the...
@ CopyFromReg
CopyFromReg - This node indicates that the input value is a virtual or physical register that is defi...
@ EXTRACT_VECTOR_ELT
EXTRACT_VECTOR_ELT(VECTOR, IDX) - Returns a single element from VECTOR identified by the (potentially...
@ CopyToReg
CopyToReg - This node has three operands: a chain, a register number to set to this value,...
@ ZERO_EXTEND
ZERO_EXTEND - Used for integer types, zeroing the new bits.
@ FP_EXTEND
X = FP_EXTEND(Y) - Extend a smaller FP type into a larger FP type.
@ TokenFactor
TokenFactor - This node takes multiple tokens as input and produces a single token result.
@ FP_ROUND
X = FP_ROUND(Y, TRUNC) - Rounding 'Y' from a larger floating point type down to the precision of the ...
@ TRUNCATE
TRUNCATE - Completely drop the high bits.
@ AssertSext
AssertSext, AssertZext - These nodes record if a register contains a value that has already been zero...
LLVM_ABI LegalityPredicate isVector(unsigned TypeIdx)
True iff the specified type index is a vector.
@ MO_NO_FLAG
MO_NO_FLAG - No flag for the operand.
@ GlobalBaseReg
On Darwin, this node represents the result of the popl at function entry, used for PIC code.
@ POP_FROM_X87_REG
The same as ISD::CopyFromReg except that this node makes it explicit that it may lower to an x87 FPU ...
bool isExtendedSwiftAsyncFrameSupported(const X86Subtarget &Subtarget, const MachineFunction &MF)
True if the target supports the extended frame for async Swift functions.
bool isCalleePop(CallingConv::ID CallingConv, bool is64Bit, bool IsVarArg, bool GuaranteeTCO)
Determines whether the callee is required to pop its own arguments.
std::optional< Function * > getAttachedARCFunction(const CallBase *CB)
This function returns operand bundle clang_arc_attachedcall's argument, which is the address of the A...
bool hasAttachedCallOpBundle(const CallBase *CB)
This is an optimization pass for GlobalISel generic memory operations.
LLVM_ABI bool isCFGuardCall(const CallBase *CB)
@ Unknown
Not known to have no common set bits.
decltype(auto) dyn_cast(const From &Val)
dyn_cast<X> - Return the argument parameter cast to the specified type.
LLVM_ABI bool isCFGuardFunction(const GlobalValue *GV)
@ Store
The extracted value is stored (ExtractElement only).
void append_range(Container &C, Range &&R)
Wrapper function to append range R to container C.
bool any_of(R &&range, UnaryPredicate P)
Provide wrappers to std::any_of which take ranges instead of having to pass begin/end explicitly.
constexpr bool isPowerOf2_32(uint32_t Value)
Return true if the argument is a power of two > 0.
LLVM_ABI void report_fatal_error(Error Err, bool gen_crash_diag=true)
constexpr uint64_t alignTo(uint64_t Size, Align A)
Returns a multiple of A needed to store Size bytes.
bool is_sorted(R &&Range, Compare C)
Wrapper function around std::is_sorted to check if elements in a range R are sorted with respect to a...
LLVM_ABI EHPersonality classifyEHPersonality(const Value *Pers)
See if the given exception handling personality function is one that we understand.
class LLVM_GSL_OWNER SmallVector
Forward declaration of SmallVector so that calculateSmallVectorDefaultInlinedElements can reference s...
bool isa(const From &Val)
isa<X> - Return true if the parameter to the template is an instance of one of the template type argu...
bool isFuncletEHPersonality(EHPersonality Pers)
Returns true if this is a personality function that invokes handler funclets (which must return to it...
uint16_t MCPhysReg
An unsigned integer type large enough to represent all physical registers, but not necessarily virtua...
DWARFExpression::Operation Op
ArrayRef(const T &OneElt) -> ArrayRef< T >
bool CC_X86(unsigned ValNo, MVT ValVT, MVT LocVT, CCValAssign::LocInfo LocInfo, ISD::ArgFlagsTy ArgFlags, Type *OrigTy, CCState &State)
bool RetCC_X86(unsigned ValNo, MVT ValVT, MVT LocVT, CCValAssign::LocInfo LocInfo, ISD::ArgFlagsTy ArgFlags, Type *OrigTy, CCState &State)
decltype(auto) cast(const From &Val)
cast<X> - Return the argument parameter cast to the specified type.
MCRegisterClass TargetRegisterClass
LLVM_ABI void reportFatalUsageError(Error Err)
Report a fatal error that does not indicate a bug in LLVM.
This struct is a compact representation of a valid (non-zero power of two) alignment.
constexpr uint64_t value() const
This is a hole in the type system and should not be abused.
static constexpr Align Constant()
Allow constructions of constexpr Align.
EVT changeVectorElementTypeToInteger() const
Return a vector with the same number of elements as this vector, but with the element type converted ...
TypeSize getStoreSize() const
Return the number of bytes overwritten by a store of the specified value type.
static EVT getVectorVT(LLVMContext &Context, EVT VT, unsigned NumElements, bool IsScalable=false)
Returns the EVT that represents a vector NumElements in length, where each element is of type VT.
bool bitsLT(EVT VT) const
Return true if this has less bits than VT.
ElementCount getVectorElementCount() const
TypeSize getSizeInBits() const
Return the size of the specified value type in bits.
EVT changeVectorElementType(LLVMContext &Context, EVT EltVT) const
Return a VT for a vector type whose attributes match ourselves with the exception of the element type...
MVT getSimpleVT() const
Return the SimpleValueType held in the specified simple EVT.
bool is128BitVector() const
Return true if this is a 128-bit vector type.
bool is512BitVector() const
Return true if this is a 512-bit vector type.
bool isVector() const
Return true if this is a vector value type.
bool is256BitVector() const
Return true if this is a 256-bit vector type.
EVT getVectorElementType() const
Given a vector type, return the type of each element.
bool isVectorOf(EVT EltVT) const
Return true if this is a vector with matching element type.
unsigned getVectorNumElements() const
Given a vector type, return the number of elements it contains.
Describes a register that needs to be forwarded from the prologue to a musttail call.
bool isSwiftError() const
bool isSwiftAsync() const
SmallVector< ArgRegPair, 1 > ArgRegPairs
Vector of call argument and its forwarding register.
This class contains a discriminated union of information about pointers in memory operands,...
static LLVM_ABI MachinePointerInfo getStack(MachineFunction &MF, int64_t Offset, uint8_t ID=0)
Stack pointer relative access.
static LLVM_ABI MachinePointerInfo getFixedStack(MachineFunction &MF, int FI, int64_t Offset=0)
Return a MachinePointerInfo record that refers to the specified FrameIndex.
This represents a list of ValueType's that has been intern'd by a SelectionDAG.
This structure contains all information that is necessary for lowering calls.
SmallVector< ISD::InputArg, 32 > Ins
const ConstantInt * CFIType
SmallVector< ISD::OutputArg, 32 > Outs
SmallVector< SDValue, 32 > OutVals
Type * RetTy
Same as OrigRetTy, or partially legalized for soft float libcalls.