115 using namespace llvm;
117 #define DEBUG_TYPE "arm-isel" 119 STATISTIC(NumTailCalls,
"Number of tail calls");
120 STATISTIC(NumMovwMovt,
"Number of GAs materialized with movw + movt");
121 STATISTIC(NumLoopByVals,
"Number of loops generated for byval arguments");
123 "Number of constants with their storage promoted into constant pools");
127 cl::desc(
"Enable / disable ARM interworking (for debugging only)"),
132 cl::desc(
"Enable / disable promotion of unnamed_addr constants into " 137 cl::desc(
"Maximum size of constant to promote into a constant pool"),
141 cl::desc(
"Maximum size of ALL constants to promote into a constant pool"),
146 ARM::R0, ARM::R1,
ARM::R2, ARM::R3
149 void ARMTargetLowering::addTypeForNEON(
MVT VT,
MVT PromotedLdStVT,
150 MVT PromotedBitwiseVT) {
151 if (VT != PromotedLdStVT) {
190 if (VT.
isInteger() && VT != PromotedBitwiseVT) {
213 void ARMTargetLowering::addDRTypeForNEON(
MVT VT) {
218 void ARMTargetLowering::addQRTypeForNEON(
MVT VT) {
235 for (
int LCID = 0; LCID < RTLIB::UNKNOWN_LIBCALL; ++LCID)
245 static const struct {
247 const char *
const Name;
252 { RTLIB::SUB_F32,
"__subsf3vfp", ISD::SETCC_INVALID },
253 { RTLIB::MUL_F32,
"__mulsf3vfp", ISD::SETCC_INVALID },
254 { RTLIB::DIV_F32,
"__divsf3vfp", ISD::SETCC_INVALID },
257 { RTLIB::ADD_F64,
"__adddf3vfp", ISD::SETCC_INVALID },
258 { RTLIB::SUB_F64,
"__subdf3vfp", ISD::SETCC_INVALID },
259 { RTLIB::MUL_F64,
"__muldf3vfp", ISD::SETCC_INVALID },
260 { RTLIB::DIV_F64,
"__divdf3vfp", ISD::SETCC_INVALID },
264 { RTLIB::UNE_F32,
"__nesf2vfp", ISD::SETNE },
265 { RTLIB::OLT_F32,
"__ltsf2vfp", ISD::SETNE },
266 { RTLIB::OLE_F32,
"__lesf2vfp", ISD::SETNE },
267 { RTLIB::OGE_F32,
"__gesf2vfp", ISD::SETNE },
268 { RTLIB::OGT_F32,
"__gtsf2vfp", ISD::SETNE },
269 { RTLIB::UO_F32,
"__unordsf2vfp", ISD::SETNE },
270 { RTLIB::O_F32,
"__unordsf2vfp",
ISD::SETEQ },
273 { RTLIB::OEQ_F64,
"__eqdf2vfp", ISD::SETNE },
274 { RTLIB::UNE_F64,
"__nedf2vfp", ISD::SETNE },
275 { RTLIB::OLT_F64,
"__ltdf2vfp", ISD::SETNE },
276 { RTLIB::OLE_F64,
"__ledf2vfp", ISD::SETNE },
277 { RTLIB::OGE_F64,
"__gedf2vfp", ISD::SETNE },
278 { RTLIB::OGT_F64,
"__gtdf2vfp", ISD::SETNE },
279 { RTLIB::UO_F64,
"__unorddf2vfp", ISD::SETNE },
280 { RTLIB::O_F64,
"__unorddf2vfp", ISD::SETEQ },
285 { RTLIB::FPTOSINT_F64_I32,
"__fixdfsivfp", ISD::SETCC_INVALID },
286 { RTLIB::FPTOUINT_F64_I32,
"__fixunsdfsivfp", ISD::SETCC_INVALID },
287 { RTLIB::FPTOSINT_F32_I32,
"__fixsfsivfp", ISD::SETCC_INVALID },
288 { RTLIB::FPTOUINT_F32_I32,
"__fixunssfsivfp", ISD::SETCC_INVALID },
291 { RTLIB::FPROUND_F64_F32,
"__truncdfsf2vfp", ISD::SETCC_INVALID },
292 { RTLIB::FPEXT_F32_F64,
"__extendsfdf2vfp", ISD::SETCC_INVALID },
299 { RTLIB::SINTTOFP_I32_F64,
"__floatsidfvfp", ISD::SETCC_INVALID },
300 { RTLIB::UINTTOFP_I32_F64,
"__floatunssidfvfp", ISD::SETCC_INVALID },
301 { RTLIB::SINTTOFP_I32_F32,
"__floatsisfvfp", ISD::SETCC_INVALID },
302 { RTLIB::UINTTOFP_I32_F32,
"__floatunssisfvfp", ISD::SETCC_INVALID },
305 for (
const auto &LC : LibraryCalls) {
322 static const struct {
324 const char *
const Name;
411 for (
const auto &LC : LibraryCalls) {
421 static const struct {
423 const char *
const Name;
426 } MemOpsLibraryCalls[] = {
434 for (
const auto &LC : MemOpsLibraryCalls) {
444 static const struct {
446 const char *
const Name;
450 { RTLIB::FPTOSINT_F64_I64,
"__dtoi64", CallingConv::ARM_AAPCS_VFP },
451 { RTLIB::FPTOUINT_F32_I64,
"__stou64", CallingConv::ARM_AAPCS_VFP },
452 { RTLIB::FPTOUINT_F64_I64,
"__dtou64", CallingConv::ARM_AAPCS_VFP },
453 { RTLIB::SINTTOFP_I64_F32,
"__i64tos", CallingConv::ARM_AAPCS_VFP },
454 { RTLIB::SINTTOFP_I64_F64,
"__i64tod", CallingConv::ARM_AAPCS_VFP },
455 { RTLIB::UINTTOFP_I64_F32,
"__u64tos", CallingConv::ARM_AAPCS_VFP },
456 { RTLIB::UINTTOFP_I64_F64,
"__u64tod", CallingConv::ARM_AAPCS_VFP },
459 for (
const auto &LC : LibraryCalls) {
491 static const struct {
493 const char *
const Name;
497 { RTLIB::FPROUND_F64_F16,
"__aeabi_d2h", CallingConv::ARM_AAPCS },
498 { RTLIB::FPEXT_F16_F32,
"__aeabi_h2f", CallingConv::ARM_AAPCS },
501 for (
const auto &LC : LibraryCalls) {
888 HasStandaloneRem =
false;
893 const char *
const Name;
897 { RTLIB::SDIVREM_I16,
"__rt_sdiv", CallingConv::ARM_AAPCS },
898 { RTLIB::SDIVREM_I32,
"__rt_sdiv", CallingConv::ARM_AAPCS },
899 { RTLIB::SDIVREM_I64,
"__rt_sdiv64", CallingConv::ARM_AAPCS },
901 { RTLIB::UDIVREM_I8,
"__rt_udiv", CallingConv::ARM_AAPCS },
902 { RTLIB::UDIVREM_I16,
"__rt_udiv", CallingConv::ARM_AAPCS },
903 { RTLIB::UDIVREM_I32,
"__rt_udiv", CallingConv::ARM_AAPCS },
904 { RTLIB::UDIVREM_I64,
"__rt_udiv64", CallingConv::ARM_AAPCS },
907 for (
const auto &LC : LibraryCalls) {
914 const char *
const Name;
918 { RTLIB::SDIVREM_I16,
"__aeabi_idivmod", CallingConv::ARM_AAPCS },
919 { RTLIB::SDIVREM_I32,
"__aeabi_idivmod", CallingConv::ARM_AAPCS },
920 { RTLIB::SDIVREM_I64,
"__aeabi_ldivmod", CallingConv::ARM_AAPCS },
922 { RTLIB::UDIVREM_I8,
"__aeabi_uidivmod", CallingConv::ARM_AAPCS },
923 { RTLIB::UDIVREM_I16,
"__aeabi_uidivmod", CallingConv::ARM_AAPCS },
924 { RTLIB::UDIVREM_I32,
"__aeabi_uidivmod", CallingConv::ARM_AAPCS },
925 { RTLIB::UDIVREM_I64,
"__aeabi_uldivmod", CallingConv::ARM_AAPCS },
928 for (
const auto &LC : LibraryCalls) {
969 InsertFencesForAtomic =
false;
982 InsertFencesForAtomic =
true;
989 InsertFencesForAtomic =
true;
1009 if (!InsertFencesForAtomic) {
1201 std::pair<const TargetRegisterClass *, uint8_t>
1214 RRC = &ARM::DPRRegClass;
1224 RRC = &ARM::DPRRegClass;
1228 RRC = &ARM::DPRRegClass;
1232 RRC = &ARM::DPRRegClass;
1236 return std::make_pair(RRC, Cost);
1409 return &ARM::QQPRRegClass;
1411 return &ARM::QQQQPRRegClass;
1420 unsigned &PrefAlign)
const {
1421 if (!isa<MemIntrinsic>(CI))
1442 for (
unsigned i = 0; i != NumVals; ++i) {
1474 if (
auto Const = dyn_cast<ConstantSDNode>(Op.
getOperand(1)))
1475 return Const->getZExtValue() == 16;
1482 if (
auto Const = dyn_cast<ConstantSDNode>(Op.
getOperand(1)))
1483 return Const->getZExtValue() == 16;
1490 if (
auto Const = dyn_cast<ConstantSDNode>(Op.
getOperand(1)))
1491 return Const->getZExtValue() == 16;
1526 InvalidOnQNaN =
true;
1532 InvalidOnQNaN =
false;
1543 InvalidOnQNaN =
false;
1550 InvalidOnQNaN =
false;
1561 InvalidOnQNaN =
false;
1570 #include "ARMGenCallingConv.inc" 1577 bool isVarArg)
const {
1613 bool isVarArg)
const {
1614 return CCAssignFnForNode(CC,
false, isVarArg);
1618 bool isVarArg)
const {
1619 return CCAssignFnForNode(CC,
true, isVarArg);
1626 bool isVarArg)
const {
1627 switch (getEffectiveCallingConv(CC, isVarArg)) {
1631 return (Return ? RetCC_ARM_APCS : CC_ARM_APCS);
1633 return (Return ? RetCC_ARM_AAPCS : CC_ARM_AAPCS);
1635 return (Return ? RetCC_ARM_AAPCS_VFP : CC_ARM_AAPCS_VFP);
1637 return (Return ? RetFastCC_ARM_APCS : FastCC_ARM_APCS);
1639 return (Return ? RetCC_ARM_APCS : CC_ARM_APCS_GHC);
1641 return (Return ? RetCC_ARM_AAPCS : CC_ARM_AAPCS);
1647 SDValue ARMTargetLowering::LowerCallResult(
1659 for (
unsigned i = 0; i != RVLocs.
size(); ++i) {
1664 if (i == 0 && isThisReturn) {
1666 "unexpected return calling convention register assignment");
1738 Chain, dl, Arg, PtrOff,
1751 unsigned id = Subtarget->
isLittle() ? 0 : 1;
1787 bool isStructRet = (Outs.
empty()) ?
false : Outs[0].Flags.
isSRet();
1788 bool isThisReturn =
false;
1789 bool isSibCall =
false;
1798 isTailCall = IsEligibleForTailCallOptimization(Callee, CallConv,
1800 Outs, OutVals,
Ins, DAG);
1803 "site marked musttail");
1819 unsigned NumBytes = CCInfo.getNextStackOffset();
1838 for (
unsigned i = 0, realArgIdx = 0, e = ArgLocs.
size();
1840 ++i, ++realArgIdx) {
1842 SDValue Arg = OutVals[realArgIdx];
1844 bool isByVal = Flags.
isByVal();
1872 PassF64ArgInRegs(dl, DAG, Chain, Op0, RegsToPass,
1873 VA, ArgLocs[++i], StackPtr, MemOpChains, Flags);
1877 PassF64ArgInRegs(dl, DAG, Chain, Op1, RegsToPass,
1878 VA, ArgLocs[++i], StackPtr, MemOpChains, Flags);
1882 MemOpChains.
push_back(LowerMemOpCallTo(Chain, StackPtr, Op1,
1883 dl, DAG, VA, Flags));
1886 PassF64ArgInRegs(dl, DAG, Chain, Arg, RegsToPass, VA, ArgLocs[++i],
1887 StackPtr, MemOpChains, Flags);
1893 "unexpected calling convention register assignment");
1895 "unexpected use of 'returned'");
1896 isThisReturn =
true;
1899 }
else if (isByVal) {
1901 unsigned offset = 0;
1905 unsigned ByValArgsCount = CCInfo.getInRegsParamsCount();
1906 unsigned CurByValIdx = CCInfo.getInRegsParamsProcessed();
1908 if (CurByValIdx < ByValArgsCount) {
1910 unsigned RegBegin, RegEnd;
1911 CCInfo.getInRegsParamInfo(CurByValIdx, RegBegin, RegEnd);
1916 for (i = 0, j = RegBegin; j < RegEnd; i++, j++) {
1923 RegsToPass.
push_back(std::make_pair(j, Load));
1928 offset = RegEnd - RegBegin;
1930 CCInfo.nextInRegsParam();
1946 SDValue Ops[] = { Chain, Dst, Src, SizeNode, AlignNode};
1950 }
else if (!isSibCall) {
1953 MemOpChains.
push_back(LowerMemOpCallTo(Chain, StackPtr, Arg,
1954 dl, DAG, VA, Flags));
1958 if (!MemOpChains.
empty())
1967 for (
unsigned i = 0, e = RegsToPass.
size(); i != e; ++i) {
1969 RegsToPass[i].
second, InFlag);
1984 for (
unsigned i = 0, e = RegsToPass.
size(); i != e; ++i) {
1986 RegsToPass[i].
second, InFlag);
1995 bool isDirect =
false;
2001 GV =
G->getGlobal();
2005 bool isARMFunc = !Subtarget->
isThumb() || (isStub && !Subtarget->
isMClass());
2006 bool isLocalARMFunc =
false;
2012 "long-calls codegen is not position independent!");
2016 if (isa<GlobalAddressSDNode>(Callee)) {
2029 const char *Sym = S->getSymbol();
2035 ARMPCLabelIndex, 0);
2043 }
else if (isa<GlobalAddressSDNode>(Callee)) {
2047 auto *GV = cast<GlobalAddressSDNode>(
Callee)->getGlobal();
2049 bool PreferIndirect =
2052 return isa<Instruction>(U) && cast<Instruction>(U)->getParent() == BB;
2055 if (!PreferIndirect) {
2074 "Windows is the only supported COFF target");
2092 const char *Sym = S->getSymbol();
2097 ARMPCLabelIndex, 4);
2113 if ((!isDirect || isARMFunc) && !Subtarget->
hasV5TOps())
2118 if (!isDirect && !Subtarget->
hasV5TOps())
2129 std::vector<SDValue> Ops;
2130 Ops.push_back(Chain);
2131 Ops.push_back(Callee);
2135 for (
unsigned i = 0, e = RegsToPass.
size(); i != e; ++i)
2136 Ops.push_back(DAG.
getRegister(RegsToPass[i].first,
2137 RegsToPass[i].second.getValueType()));
2150 isThisReturn =
false;
2156 assert(Mask &&
"Missing call preserved mask for calling convention");
2161 Ops.push_back(InFlag);
2170 Chain = DAG.
getNode(CallOpc, dl, NodeTys, Ops);
2180 return LowerCallResult(Chain, InFlag, CallConv, isVarArg, Ins, dl, DAG,
2181 InVals, isThisReturn,
2182 isThisReturn ? OutVals[0] :
SDValue());
2189 void ARMTargetLowering::HandleByVal(
CCState *State,
unsigned &
Size,
2190 unsigned Align)
const {
2198 unsigned AlignInRegs = Align / 4;
2199 unsigned Waste = (
ARM::R4 -
Reg) % AlignInRegs;
2200 for (
unsigned i = 0; i < Waste; ++i)
2213 if (NSAAOffset != 0 && Size > Excess) {
2225 unsigned ByValRegBegin =
Reg;
2226 unsigned ByValRegEnd = std::min<unsigned>(Reg + Size / 4,
ARM::R4);
2230 for (
unsigned i = Reg + 1; i != ByValRegEnd; ++i)
2236 Size = std::max<int>(Size - Excess, 0);
2261 }
else if (
LoadSDNode *Ld = dyn_cast<LoadSDNode>(Arg)) {
2287 ARMTargetLowering::IsEligibleForTailCallOptimization(
SDValue Callee,
2290 bool isCalleeStructRet,
2291 bool isCallerStructRet,
2306 !isa<GlobalAddressSDNode>(Callee.
getNode()))
2320 if (isCalleeStructRet || isCallerStructRet)
2347 if (CalleeCC != CallerCC) {
2349 if (!TRI->regmaskSubsetEqual(CallerPreserved, CalleePreserved))
2362 if (!Outs.
empty()) {
2366 CCState CCInfo(CalleeCC, isVarArg, MF, ArgLocs, C);
2374 for (
unsigned i = 0, realArgIdx = 0, e = ArgLocs.
size();
2376 ++i, ++realArgIdx) {
2379 SDValue Arg = OutVals[realArgIdx];
2390 if (!ArgLocs[++i].isRegLoc())
2393 if (!ArgLocs[++i].isRegLoc())
2395 if (!ArgLocs[++i].isRegLoc())
2420 CCState CCInfo(CallConv, isVarArg, MF, RVLocs, Context);
2442 if (IntKind ==
"" || IntKind ==
"IRQ" || IntKind ==
"FIQ" ||
2445 else if (IntKind ==
"SWI" || IntKind ==
"UNDEF")
2449 "must be one of: IRQ, FIQ, SWI, ABORT or UNDEF");
2476 bool isLittleEndian = Subtarget->
isLittle();
2483 for (
unsigned i = 0, realRVLocIdx = 0;
2485 ++i, ++realRVLocIdx) {
2489 SDValue Arg = OutVals[realRVLocIdx];
2490 bool ReturnF16 =
false;
2533 HalfGPRs.
getValue(isLittleEndian ? 0 : 1),
2539 HalfGPRs.
getValue(isLittleEndian ? 1 : 0),
2554 fmrrd.
getValue(isLittleEndian ? 0 : 1),
2560 fmrrd.
getValue(isLittleEndian ? 1 : 0),
2578 else if (ARM::DPRRegClass.
contains(*I))
2606 bool ARMTargetLowering::isUsedByReturnOnly(
SDNode *
N,
SDValue &Chain)
const {
2630 if (Copies.
size() > 2)
2665 bool HasRet =
false;
2681 bool ARMTargetLowering::mayBeEmittedAsTailCall(
const CallInst *CI)
const {
2687 if (!CI->
isTailCall() || Attr.getValueAsString() ==
"true")
2701 &&
"LowerWRITE_REGISTER called for non-i64 type argument.");
2739 Twine(AFI->createPICLabelUId())
2743 return LowerGlobalAddress(GA, DAG);
2763 unsigned ARMPCLabelIndex = 0;
2766 const BlockAddress *BA = cast<BlockAddressSDNode>(
Op)->getBlockAddress();
2769 if (!IsPositionIndependent) {
2772 unsigned PCAdj = Subtarget->
isThumb() ? 4 : 8;
2783 if (!IsPositionIndependent)
2814 ARMTargetLowering::LowerGlobalTLSAddressDarwin(
SDValue Op,
2817 "This function expects a Darwin target");
2822 SDValue DescAddr = LowerGlobalAddressDarwin(Op, DAG);
2859 ARMTargetLowering::LowerGlobalTLSAddressWindows(
SDValue Op,
2903 const auto *GA = cast<GlobalAddressSDNode>(
Op);
2919 unsigned char PCAdj = Subtarget->
isThumb() ? 4 : 8;
2939 Entry.
Node = Argument;
2941 Args.push_back(Entry);
2949 std::pair<SDValue, SDValue> CallResult =
LowerCallTo(CLI);
2950 return CallResult.first;
2972 unsigned char PCAdj = Subtarget->
isThumb() ? 4 : 8;
2980 PtrVT, dl, Chain, Offset,
2988 PtrVT, dl, Chain, Offset,
2998 PtrVT, dl, Chain, Offset,
3014 return LowerGlobalTLSAddressDarwin(Op, DAG);
3017 return LowerGlobalTLSAddressWindows(Op, DAG);
3026 return LowerToTLSGeneralDynamicModel(GA, DAG);
3029 return LowerToTLSExecModels(GA, DAG, model);
3038 for (
auto *U : V->
users())
3040 while (!Worklist.
empty()) {
3042 if (isa<ConstantExpr>(U)) {
3043 for (
auto *UU : U->users())
3049 if (!
I ||
I->getParent()->getParent() !=
F)
3059 for (
auto *U : V->
users())
3061 while (!Worklist.
empty()) {
3063 if (isa<ConstantExpr>(U)) {
3064 for (
auto *UU : U->users())
3069 if (!isa<Instruction>(U))
3079 Type *SubT =
nullptr;
3111 if (!GVar || !GVar->hasInitializer() ||
3112 !GVar->isConstant() || !GVar->hasGlobalUnnamedAddr() ||
3113 !GVar->hasLocalLinkage())
3119 auto *
Init = GVar->getInitializer();
3131 unsigned Align = GVar->getAlignment();
3132 unsigned RequiredPadding = 4 - (Size % 4);
3133 bool PaddingPossible =
3134 RequiredPadding == 4 || (CDAInit && CDAInit->isString());
3139 unsigned PaddedSize = Size + ((RequiredPadding == 4) ? 0 : RequiredPadding);
3161 if (RequiredPadding != 4) {
3166 while (RequiredPadding--)
3179 ++NumConstpoolPromoted;
3184 if (
const GlobalAlias *GA = dyn_cast<GlobalAlias>(GV))
3185 GV = GA->getBaseObject();
3186 return (isa<GlobalVariable>(GV) && cast<GlobalVariable>(GV)->
isConstant()) ||
3195 return LowerGlobalAddressWindows(Op, DAG);
3197 return LowerGlobalAddressELF(Op, DAG);
3199 return LowerGlobalAddressDarwin(Op, DAG);
3207 const GlobalValue *GV = cast<GlobalAddressSDNode>(
Op)->getGlobal();
3226 }
else if (Subtarget->
isROPI() && IsRO) {
3231 }
else if (Subtarget->
isRWPI() && !IsRO) {
3272 "ROPI/RWPI not currently supported for Darwin");
3275 const GlobalValue *GV = cast<GlobalAddressSDNode>(
Op)->getGlobal();
3298 "Windows on ARM expects to use movw/movt");
3300 "ROPI/RWPI not currently supported for Windows");
3302 const GlobalValue *GV = cast<GlobalAddressSDNode>(
Op)->getGlobal();
3316 if (GV->hasDLLImportStorageClass())
3338 SDValue ARMTargetLowering::LowerEH_SJLJ_SETUP_DISPATCH(
SDValue Op,
3348 unsigned IntNo = cast<ConstantSDNode>(Op.
getOperand(0))->getZExtValue();
3352 case Intrinsic::thread_pointer: {
3356 case Intrinsic::eh_sjlj_lsda: {
3363 unsigned PCAdj = IsPositionIndependent ? (Subtarget->
isThumb() ? 4 : 8) : 0;
3373 if (IsPositionIndependent) {
3379 case Intrinsic::arm_neon_vabs:
3382 case Intrinsic::arm_neon_vmulls:
3383 case Intrinsic::arm_neon_vmullu: {
3384 unsigned NewOpc = (IntNo == Intrinsic::arm_neon_vmulls)
3389 case Intrinsic::arm_neon_vminnm:
3390 case Intrinsic::arm_neon_vmaxnm: {
3391 unsigned NewOpc = (IntNo == Intrinsic::arm_neon_vminnm)
3396 case Intrinsic::arm_neon_vminu:
3397 case Intrinsic::arm_neon_vmaxu: {
3400 unsigned NewOpc = (IntNo == Intrinsic::arm_neon_vminu)
3405 case Intrinsic::arm_neon_vmins:
3406 case Intrinsic::arm_neon_vmaxs: {
3409 unsigned NewOpc = (IntNo == Intrinsic::arm_neon_vmins)
3414 unsigned NewOpc = (IntNo == Intrinsic::arm_neon_vmins)
3419 case Intrinsic::arm_neon_vtbl1:
3422 case Intrinsic::arm_neon_vtbl2:
3441 "Unexpected ISD::ATOMIC_FENCE encountered. Should be libcall!");
3474 unsigned isRead = ~cast<ConstantSDNode>(Op.
getOperand(2))->getZExtValue() & 1;
3480 unsigned isData = cast<ConstantSDNode>(Op.
getOperand(4))->getZExtValue();
3483 isRead = ~isRead & 1;
3484 isData = ~isData & 1;
3510 const SDLoc &dl)
const {
3516 RC = &ARM::tGPRRegClass;
3518 RC = &ARM::GPRRegClass;
3553 const Value *OrigArg,
3554 unsigned InRegsParamRecordIdx,
3555 int ArgOffset,
unsigned ArgSize)
const {
3570 unsigned RBegin, REnd;
3580 ArgOffset = -4 * (
ARM::R4 - RBegin);
3590 for (
unsigned Reg = RBegin, i = 0;
Reg < REnd; ++
Reg, ++i) {
3599 if (!MemOps.
empty())
3608 unsigned TotalArgRegsSaveSize,
3609 bool ForceMutable)
const {
3618 int FrameIndex = StoreByValRegs(CCInfo, DAG, dl, Chain,
nullptr,
3624 SDValue ARMTargetLowering::LowerFormalArguments(
3642 unsigned CurArgIdx = 0;
3654 unsigned ArgRegBegin =
ARM::R4;
3655 for (
unsigned i = 0, e = ArgLocs.size(); i != e; ++i) {
3666 unsigned RBegin, REnd;
3668 ArgRegBegin = std::min(ArgRegBegin, RBegin);
3674 int lastInsIndex = -1;
3678 ArgRegBegin = std::min(ArgRegBegin, (
unsigned)GPRArgRegs[RegIdx]);
3681 unsigned TotalArgRegsSaveSize = 4 * (
ARM::R4 - ArgRegBegin);
3685 for (
unsigned i = 0, e = ArgLocs.size(); i != e; ++i) {
3687 if (Ins[VA.
getValNo()].isOrigArg()) {
3688 std::advance(CurOrigArg,
3689 Ins[VA.
getValNo()].getOrigArgIndex() - CurArgIdx);
3690 CurArgIdx = Ins[VA.
getValNo()].getOrigArgIndex();
3700 SDValue ArgValue1 = GetF64FormalArgument(VA, ArgLocs[++i],
3711 ArgValue2 = GetF64FormalArgument(VA, ArgLocs[++i],
3716 ArgValue, ArgValue1,
3719 ArgValue, ArgValue2,
3722 ArgValue = GetF64FormalArgument(VA, ArgLocs[++i], Chain, DAG, dl);
3728 RC = &ARM::HPRRegClass;
3730 RC = &ARM::SPRRegClass;
3732 RC = &ARM::DPRRegClass;
3734 RC = &ARM::QPRRegClass;
3737 : &ARM::GPRRegClass;
3777 if (index != lastInsIndex)
3786 assert(Ins[index].isOrigArg() &&
3787 "Byval arguments cannot be implicit");
3791 CCInfo, DAG, dl, Chain, &*CurOrigArg, CurByValIndex,
3806 lastInsIndex = index;
3813 VarArgStyleRegisters(CCInfo, DAG, dl, Chain,
3815 TotalArgRegsSaveSize);
3825 return CFP->getValueAPF().isPosZero();
3831 if (
const ConstantFP *CFP = dyn_cast<ConstantFP>(
CP->getConstVal()))
3832 return CFP->getValueAPF().isPosZero();
3850 const SDLoc &dl)
const {
3852 unsigned C = RHSC->getZExtValue();
3914 bool InvalidOnQNaN)
const {
3952 std::pair<SDValue, SDValue>
4019 return std::make_pair(Value, OverflowCmp);
4030 std::tie(Value, OverflowCmp) = getARMXALUOOp(Op, DAG, ARMcc);
4039 ARMcc, CCR, OverflowCmp);
4047 SDLoc DL(BoolCarry);
4121 std::tie(Value, OverflowCmp) = getARMXALUOOp(Cond, DAG, ARMcc);
4125 return getCMOV(dl, VT, SelectTrue, SelectFalse, ARMcc, CCR,
4140 if (CMOVTrue && CMOVFalse) {
4142 unsigned CMOVFalseVal = CMOVFalse->getZExtValue();
4146 if (CMOVTrueVal == 1 && CMOVFalseVal == 0) {
4148 False = SelectFalse;
4149 }
else if (CMOVTrueVal == 0 && CMOVFalseVal == 1) {
4160 return getCMOV(dl, VT, True, False, ARMcc, CCR, Cmp, DAG);
4176 bool &swpCmpOps,
bool &swpVselOps) {
4204 swpCmpOps = !swpCmpOps;
4205 swpVselOps = !swpVselOps;
4241 ARMcc, CCR, duplicateCmp(Cmp, DAG));
4268 ((K == LHS && K == TrueVal) || (K == RHS && K == FalseVal))) ||
4270 ((K == RHS && K == TrueVal) || (K == LHS && K == FalseVal)));
4278 ((K == RHS && K == TrueVal) || (K == LHS && K == FalseVal))) ||
4280 ((K == LHS && K == TrueVal) || (K == RHS && K == FalseVal)));
4301 uint64_t &K,
bool &usat) {
4308 const SDValue Op2 = isa<ConstantSDNode>(TrueVal1) ? FalseVal1 : TrueVal1;
4320 SDValue *K1 = isa<ConstantSDNode>(LHS1) ? &LHS1 : isa<ConstantSDNode>(RHS1)
4323 SDValue *K2 = isa<ConstantSDNode>(LHS2) ? &LHS2 : isa<ConstantSDNode>(RHS2)
4326 SDValue K2Tmp = isa<ConstantSDNode>(TrueVal2) ? TrueVal2 : FalseVal2;
4327 SDValue V1Tmp = (K1 && *K1 == LHS1) ? RHS1 : LHS1;
4328 SDValue V2Tmp = (K2 && *K2 == LHS2) ? RHS2 : LHS2;
4329 SDValue V2 = (K2Tmp == TrueVal2) ? FalseVal2 : TrueVal2;
4341 if (!K1 || !K2 || *K1 == Op2 || *K2 != K2Tmp || V1Tmp != V2Tmp ||
4359 if (!UpperCheckOp || !LowerCheckOp || LowerCheckOp == UpperCheckOp)
4365 int64_t Val1 = cast<ConstantSDNode>(*K1)->getSExtValue();
4366 int64_t Val2 = cast<ConstantSDNode>(*K2)->getSExtValue();
4367 int64_t PosVal =
std::max(Val1, Val2);
4368 int64_t NegVal = std::min(Val1, Val2);
4370 if (((Val1 > Val2 && UpperCheckOp == &Op) ||
4371 (Val1 < Val2 && UpperCheckOp == &Op2)) &&
4377 else if (NegVal == 0)
4383 K = (uint64_t)PosVal;
4408 SDValue *K = isa<ConstantSDNode>(LHS) ? &LHS : isa<ConstantSDNode>(RHS)
4416 SDValue KTmp = isa<ConstantSDNode>(TrueVal) ? TrueVal : FalseVal;
4417 V = (KTmp == TrueVal) ? FalseVal : TrueVal;
4418 SDValue VTmp = (K && *K == LHS) ? RHS : LHS;
4422 if (*K != KTmp || V != VTmp)
4439 uint64_t SatConstant;
4511 SDValue Cmp = getARMCmp(LHS, RHS, CC, ARMcc, DAG, dl);
4512 return getCMOV(dl, VT, FalseVal, TrueVal, ARMcc, CCR, Cmp, DAG);
4517 FPCCToARMCC(CC, CondCode, CondCode2, InvalidOnQNaN);
4525 bool swpCmpOps =
false;
4526 bool swpVselOps =
false;
4539 SDValue Cmp = getVFPCmp(LHS, RHS, DAG, dl, InvalidOnQNaN);
4541 SDValue Result = getCMOV(dl, VT, FalseVal, TrueVal, ARMcc, CCR, Cmp, DAG);
4545 SDValue Cmp2 = getVFPCmp(LHS, RHS, DAG, dl, InvalidOnQNaN);
4546 Result = getCMOV(dl, VT, Result, TrueVal, ARMcc2, CCR, Cmp2, DAG);
4578 if (
LoadSDNode *Ld = dyn_cast<LoadSDNode>(Op))
4580 Ld->getPointerInfo(), Ld->getAlignment(),
4581 Ld->getMemOperand()->getFlags());
4596 if (
LoadSDNode *Ld = dyn_cast<LoadSDNode>(Op)) {
4600 Ld->getAlignment(), Ld->getMemOperand()->
getFlags());
4603 unsigned NewAlign =
MinAlign(Ld->getAlignment(), 4);
4607 Ld->getPointerInfo().getWithOffset(4), NewAlign,
4608 Ld->getMemOperand()->getFlags());
4626 bool LHSSeenZero =
false;
4628 bool RHSSeenZero =
false;
4630 if (LHSOk && RHSOk && (LHSSeenZero || RHSSeenZero)) {
4646 SDValue Cmp = getARMCmp(LHS, RHS, CC, ARMcc, DAG, dl);
4649 Chain, Dest, ARMcc, CCR, Cmp);
4661 SDValue Ops[] = { Chain, ARMcc, LHS1, LHS2, RHS1, RHS2, Dest };
4689 std::tie(Value, OverflowCmp) = getARMXALUOOp(Cond, DAG, ARMcc);
4741 std::tie(Value, OverflowCmp) = getARMXALUOOp(LHS.
getValue(0), DAG, ARMcc);
4758 SDValue Cmp = getARMCmp(LHS, RHS, CC, ARMcc, DAG, dl);
4761 Chain, Dest, ARMcc, CCR, Cmp);
4773 FPCCToARMCC(CC, CondCode, CondCode2, InvalidOnQNaN);
4776 SDValue Cmp = getVFPCmp(LHS, RHS, DAG, dl, InvalidOnQNaN);
4779 SDValue Ops[] = { Chain, Dest, ARMcc, CCR, Cmp };
4818 DAG.
getLoad(PTy, dl, Chain, Addr,
4836 "Invalid type for custom lowering!");
4874 "Invalid type for custom lowering!");
4893 return DAG.
getNode(Opc, dl, VT, Op);
4924 bool UseNEON = !InGPR && Subtarget->
hasNEON();
5007 unsigned Depth = cast<ConstantSDNode>(Op.
getOperand(0))->getZExtValue();
5009 SDValue FrameAddr = LowerFRAMEADDR(Op, DAG);
5030 unsigned Depth = cast<ConstantSDNode>(Op.
getOperand(0))->getZExtValue();
5041 unsigned ARMTargetLowering::getRegisterByName(
const char* RegName,
EVT VT,
5044 .Case(
"sp", ARM::SP)
5060 &&
"ExpandREAD_REGISTER called for non-i64 type result.");
5105 NewIndex *= APIntIndex;
5107 if (NewIndex.getBitWidth() > 32)
5137 const bool HasFullFP16 = Subtarget->
hasFullFP16();
5194 ZeroExtend->getValueType(0) !=
MVT::i32)
5197 auto Copy = ZeroExtend->use_begin();
5282 SDValue LoBigShift = DAG.
getNode(Opc, dl, VT, ShOpHi, ExtraShAmt);
5290 ? DAG.getNode(Opc, dl, VT, ShOpHi,
5291 DAG.getConstant(VTBits - 1, dl, VT))
5292 : DAG.getConstant(0, dl, VT);
5293 SDValue CmpHi = getARMCmp(ExtraShAmt, DAG.getConstant(0, dl,
MVT::i32),
5299 return DAG.getMergeValues(Ops, dl);
5331 SDValue CmpLo = getARMCmp(ExtraShAmt, DAG.getConstant(0, dl,
MVT::i32),
5335 DAG.getConstant(0, dl, VT), ARMcc, CCR, CmpLo);
5338 return DAG.getMergeValues(Ops, dl);
5543 assert(ST->
hasNEON() &&
"Custom ctpop lowering requires NEON.");
5546 "Unexpected type for custom ctpop lowering");
5583 Intrinsic::arm_neon_vshifts :
5584 Intrinsic::arm_neon_vshiftu);
5600 "Unknown shift to lower!");
5629 bool Invert =
false;
5638 ISD::CondCode SetCCOpcode = cast<CondCodeSDNode>(CC)->
get();
5655 Merged = DAG.
getNOT(dl, Merged, CmpVT);
5665 switch (SetCCOpcode) {
5706 switch (SetCCOpcode) {
5771 Result = DAG.
getNode(Opc, dl, CmpVT, Op0, Op1);
5774 Result = DAG.
getNode(Opc, dl, CmpVT, Op0, Op1);
5780 Result = DAG.
getNOT(dl, Result, VT);
5820 const SDLoc &dl,
EVT &VT,
bool is128Bits,
5822 unsigned OpCmode, Imm;
5832 switch (SplatBitSize) {
5837 assert((SplatBits & ~0xff) == 0 &&
"one byte splat value is too big");
5846 if ((SplatBits & ~0xff) == 0) {
5852 if ((SplatBits & ~0xff00) == 0) {
5855 Imm = SplatBits >> 8;
5866 if ((SplatBits & ~0xff) == 0) {
5872 if ((SplatBits & ~0xff00) == 0) {
5875 Imm = SplatBits >> 8;
5878 if ((SplatBits & ~0xff0000) == 0) {
5881 Imm = SplatBits >> 16;
5884 if ((SplatBits & ~0xff000000) == 0) {
5887 Imm = SplatBits >> 24;
5894 if ((SplatBits & ~0xffff) == 0 &&
5895 ((SplatBits | SplatUndef) & 0xff) == 0xff) {
5898 Imm = SplatBits >> 8;
5902 if ((SplatBits & ~0xffffff) == 0 &&
5903 ((SplatBits | SplatUndef) & 0xffff) == 0xffff) {
5906 Imm = SplatBits >> 16;
5921 uint64_t BitMask = 0xff;
5925 for (
int ByteNum = 0; ByteNum < 8; ++ByteNum) {
5926 if (((SplatBits | SplatUndef) & BitMask) == BitMask) {
5929 }
else if ((SplatBits & BitMask) != 0) {
5938 Imm = ((Imm & 0xf) << 4) | ((Imm & 0xf0) >> 4);
5968 APInt INTVal = FPVal.bitcastToAPInt();
6021 uint64_t iVal = FPVal.bitcastToAPInt().getZExtValue();
6026 if (IsDouble && (iVal & 0xffffffff) != (iVal >> 32))
6080 unsigned ExpectedElt = Imm;
6081 for (
unsigned i = 1; i < NumElts; ++i) {
6085 if (ExpectedElt == NumElts)
6088 if (M[i] < 0)
continue;
6089 if (ExpectedElt != static_cast<unsigned>(M[i]))
6097 bool &ReverseVEXT,
unsigned &Imm) {
6099 ReverseVEXT =
false;
6110 unsigned ExpectedElt = Imm;
6111 for (
unsigned i = 1; i < NumElts; ++i) {
6115 if (ExpectedElt == NumElts * 2) {
6120 if (M[i] < 0)
continue;
6121 if (ExpectedElt != static_cast<unsigned>(M[i]))
6136 assert((BlockSize==16 || BlockSize==32 || BlockSize==64) &&
6137 "Only possible block sizes for VREV are: 16, 32, 64");
6144 unsigned BlockElts = M[0] + 1;
6147 BlockElts = BlockSize / EltSz;
6149 if (BlockSize <= EltSz || BlockSize != BlockElts * EltSz)
6152 for (
unsigned i = 0; i < NumElts; ++i) {
6153 if (M[i] < 0)
continue;
6154 if ((
unsigned) M[i] != (i - i%BlockElts) + (BlockElts - 1 - i%BlockElts))
6170 if (Mask.
size() == Elements * 2)
6171 return Index / Elements;
6172 return Mask[
Index] == 0 ? 0 : 1;
6202 if (M.
size() != NumElts && M.
size() != NumElts*2)
6210 for (
unsigned i = 0; i < M.
size(); i += NumElts) {
6212 for (
unsigned j = 0; j < NumElts; j += 2) {
6213 if ((M[i+j] >= 0 && (
unsigned) M[i+j] != j + WhichResult) ||
6214 (M[i+j+1] >= 0 && (
unsigned) M[i+j+1] != j + NumElts + WhichResult))
6219 if (M.
size() == NumElts*2)
6234 if (M.
size() != NumElts && M.
size() != NumElts*2)
6237 for (
unsigned i = 0; i < M.
size(); i += NumElts) {
6239 for (
unsigned j = 0; j < NumElts; j += 2) {
6240 if ((M[i+j] >= 0 && (
unsigned) M[i+j] != j + WhichResult) ||
6241 (M[i+j+1] >= 0 && (
unsigned) M[i+j+1] != j + WhichResult))
6246 if (M.
size() == NumElts*2)
6266 if (M.
size() != NumElts && M.
size() != NumElts*2)
6269 for (
unsigned i = 0; i < M.
size(); i += NumElts) {
6271 for (
unsigned j = 0; j < NumElts; ++j) {
6272 if (M[i+j] >= 0 && (
unsigned) M[i+j] != 2 * j + WhichResult)
6277 if (M.
size() == NumElts*2)
6296 if (M.
size() != NumElts && M.
size() != NumElts*2)
6299 unsigned Half = NumElts / 2;
6300 for (
unsigned i = 0; i < M.
size(); i += NumElts) {
6302 for (
unsigned j = 0; j < NumElts; j += Half) {
6303 unsigned Idx = WhichResult;
6304 for (
unsigned k = 0; k < Half; ++k) {
6305 int MIdx = M[i + j + k];
6306 if (MIdx >= 0 && (
unsigned) MIdx != Idx)
6313 if (M.
size() == NumElts*2)
6337 if (M.
size() != NumElts && M.
size() != NumElts*2)
6340 for (
unsigned i = 0; i < M.
size(); i += NumElts) {
6342 unsigned Idx = WhichResult * NumElts / 2;
6343 for (
unsigned j = 0; j < NumElts; j += 2) {
6344 if ((M[i+j] >= 0 && (
unsigned) M[i+j] != Idx) ||
6345 (M[i+j+1] >= 0 && (
unsigned) M[i+j+1] != Idx + NumElts))
6351 if (M.
size() == NumElts*2)
6370 if (M.
size() != NumElts && M.
size() != NumElts*2)
6373 for (
unsigned i = 0; i < M.
size(); i += NumElts) {
6375 unsigned Idx = WhichResult * NumElts / 2;
6376 for (
unsigned j = 0; j < NumElts; j += 2) {
6377 if ((M[i+j] >= 0 && (
unsigned) M[i+j] != Idx) ||
6378 (M[i+j+1] >= 0 && (
unsigned) M[i+j+1] != Idx))
6384 if (M.
size() == NumElts*2)
6397 unsigned &WhichResult,
6400 if (
isVTRNMask(ShuffleMask, VT, WhichResult))
6402 if (
isVUZPMask(ShuffleMask, VT, WhichResult))
6404 if (
isVZIPMask(ShuffleMask, VT, WhichResult))
6422 if (NumElts != M.
size())
6426 for (
unsigned i = 0; i != NumElts; ++i)
6427 if (M[i] >= 0 && M[i] != (
int) (NumElts - 1 - i))
6439 if (!isa<ConstantSDNode>(N))
6441 Val = cast<ConstantSDNode>(
N)->getZExtValue();
6444 if (Val <= 255 || ~Val <= 255)
6461 APInt SplatBits, SplatUndef;
6462 unsigned SplatBitSize;
6464 if (BVN->
isConstantSplat(SplatBits, SplatUndef, SplatBitSize, HasAnyUndefs)) {
6468 if (SplatBitSize <= 64) {
6481 uint64_t NegatedImm = (~SplatBits).getZExtValue();
6510 bool isOnlyLowElement =
true;
6511 bool usesOnlyOneValue =
true;
6512 bool hasDominantValue =
false;
6519 for (
unsigned i = 0; i < NumElts; ++i) {
6524 isOnlyLowElement =
false;
6525 if (!isa<ConstantFPSDNode>(V) && !isa<ConstantSDNode>(V))
6528 ValueCounts.
insert(std::make_pair(V, 0));
6529 unsigned &Count = ValueCounts[V];
6532 if (++Count > (NumElts / 2)) {
6533 hasDominantValue =
true;
6537 if (ValueCounts.
size() != 1)
6538 usesOnlyOneValue =
false;
6540 Value = ValueCounts.
begin()->first;
6542 if (ValueCounts.
empty())
6554 if (hasDominantValue && EltSize <= 32) {
6583 if (!usesOnlyOneValue) {
6586 for (
unsigned I = 0;
I < NumElts; ++
I) {
6600 for (
unsigned i = 0; i < NumElts; ++i)
6605 Val = LowerBUILD_VECTOR(Val, DAG, ST);
6609 if (usesOnlyOneValue) {
6611 if (isConstant && Val.
getNode())
6624 SDValue shuffle = ReconstructShuffle(Op, DAG);
6638 Lower = LowerBUILD_VECTOR(Lower, DAG, ST);
6640 HVT, dl,
makeArrayRef(&Ops[NumElts / 2], NumElts / 2));
6642 Upper = LowerBUILD_VECTOR(Upper, DAG, ST);
6650 if (EltSize >= 32) {
6656 for (
unsigned i = 0; i < NumElts; ++i)
6668 if (!isConstant && !usesOnlyOneValue) {
6670 for (
unsigned i = 0 ; i < NumElts; ++i) {
6692 struct ShuffleSourceInfo {
6695 unsigned MaxElt = 0;
6705 int WindowScale = 1;
6707 ShuffleSourceInfo(
SDValue Vec) : Vec(Vec), ShuffleVec(Vec) {}
6715 for (
unsigned i = 0; i < NumElts; ++i) {
6723 }
else if (!isa<ConstantSDNode>(V.
getOperand(1))) {
6736 unsigned EltNo = cast<ConstantSDNode>(V.
getOperand(1))->getZExtValue();
6743 if (Sources.
size() > 2)
6749 for (
auto &
Source : Sources) {
6750 EVT SrcEltTy =
Source.Vec.getValueType().getVectorElementType();
6751 if (SrcEltTy.
bitsLT(SmallestEltTy))
6752 SmallestEltTy = SrcEltTy;
6754 unsigned ResMultiplier =
6762 for (
auto &Src : Sources) {
6763 EVT SrcVT = Src.ShuffleVec.getValueType();
6781 DAG.
getUNDEF(Src.ShuffleVec.getValueType()));
6788 if (Src.MaxElt - Src.MinElt >= NumSrcElts) {
6793 if (Src.MinElt >= NumSrcElts) {
6798 Src.WindowBase = -NumSrcElts;
6799 }
else if (Src.MaxElt < NumSrcElts) {
6816 Src.WindowBase = -Src.MinElt;
6823 for (
auto &Src : Sources) {
6825 if (SrcEltTy == SmallestEltTy)
6830 Src.WindowBase *= Src.WindowScale;
6836 assert(Src.ShuffleVec.getValueType() == ShuffleVT););
6847 int EltNo = cast<ConstantSDNode>(Entry.
getOperand(1))->getSExtValue();
6855 int LanesDefined = BitsDefined / BitsPerShuffleLane;
6859 int *LaneMask = &
Mask[i * ResMultiplier];
6861 int ExtractBase = EltNo * Src->WindowScale + Src->WindowBase;
6862 ExtractBase += NumElts * (Src - Sources.begin());
6863 for (
int j = 0; j < LanesDefined; ++j)
6864 LaneMask[j] = ExtractBase + j;
6873 assert(Sources.size() <= 2 &&
"Too many sources!");
6876 for (
unsigned i = 0; i < Sources.size(); ++i)
6877 ShuffleOps[i] = Sources[i].ShuffleVec;
6880 ShuffleOps[1],
Mask);
6891 unsigned PFIndexes[4];
6892 for (
unsigned i = 0; i != 4; ++i) {
6896 PFIndexes[i] = M[i];
6900 unsigned PFTableIndex =
6901 PFIndexes[0]*9*9*9+PFIndexes[1]*9*9+PFIndexes[2]*9+PFIndexes[3];
6903 unsigned Cost = (PFEntry >> 30);
6909 bool ReverseVEXT, isV_UNDEF;
6910 unsigned Imm, WhichResult;
6913 return (EltSize >= 32 ||
6929 unsigned OpNum = (PFEntry >> 26) & 0x0F;
6930 unsigned LHSID = (PFEntry >> 13) & ((1 << 13)-1);
6931 unsigned RHSID = (PFEntry >> 0) & ((1 << 13)-1);
6951 if (OpNum == OP_COPY) {
6952 if (LHSID == (1*9+2)*9+3)
return LHS;
6953 assert(LHSID == ((4*9+5)*9+6)*9+7 &&
"Illegal OP_COPY!");
6990 OpLHS, OpRHS).getValue(OpNum-OP_VUZPL);
6994 OpLHS, OpRHS).getValue(OpNum-OP_VZIPL);
6998 OpLHS, OpRHS).getValue(OpNum-OP_VTRNL);
7012 I = ShuffleMask.
begin(),
E = ShuffleMask.
end();
I !=
E; ++
I)
7030 "Expect an v8i16/v16i8 type");
7035 unsigned ExtractNum = (VT ==
MVT::v16i8) ? 8 : 4;
7056 if (EltSize <= 32) {
7060 if (Lane == -1) Lane = 0;
7071 bool IsScalarToVector =
true;
7074 IsScalarToVector =
false;
7077 if (IsScalarToVector)
7086 if (
isVEXTMask(ShuffleMask, VT, ReverseVEXT, Imm)) {
7110 unsigned WhichResult;
7113 ShuffleMask, VT, WhichResult, isV_UNDEF)) {
7117 .getValue(WhichResult);
7143 }) &&
"Unexpected shuffle index into UNDEF operand!");
7146 ShuffleMask, SubVT, WhichResult, isV_UNDEF)) {
7149 assert((WhichResult == 0) &&
7150 "In-place shuffle of concat can only have one result!");
7163 unsigned PFIndexes[4];
7164 for (
unsigned i = 0; i != 4; ++i) {
7165 if (ShuffleMask[i] < 0)
7168 PFIndexes[i] = ShuffleMask[i];
7172 unsigned PFTableIndex =
7173 PFIndexes[0]*9*9*9+PFIndexes[1]*9*9+PFIndexes[2]*9+PFIndexes[3];
7175 unsigned Cost = (PFEntry >> 30);
7182 if (EltSize >= 32) {
7190 for (
unsigned i = 0; i < NumElts; ++i) {
7191 if (ShuffleMask[i] < 0)
7195 ShuffleMask[i] < (
int)NumElts ? V1 : V2,
7216 if (!isa<ConstantSDNode>(Lane))
7225 if (!isa<ConstantSDNode>(Lane))
7241 "unexpected CONCAT_VECTORS");
7270 unsigned HiElt = 1 - LoElt;
7275 if (!Lo0 || !Hi0 || !Lo1 || !Hi1)
7278 if (Hi0->getSExtValue() == Lo0->
getSExtValue() >> 32 &&
7279 Hi1->getSExtValue() == Lo1->getSExtValue() >> 32)
7282 if (Hi0->isNullValue() && Hi1->isNullValue())
7295 unsigned HalfSize = EltSize / 2;
7297 if (!
isIntN(HalfSize,
C->getSExtValue()))
7300 if (!
isUIntN(HalfSize,
C->getZExtValue()))
7338 switch (OrigSimpleTy) {
7354 unsigned ExtOpcode) {
7406 "Expected extending load");
7412 DAG.
getNode(Opcode,
SDLoc(newLoad),
LD->getValueType(0), newLoad);
7433 unsigned NumElts = VT.getVectorNumElements();
7437 for (
unsigned i = 0; i != NumElts; ++i) {
7474 "unexpected type for custom-lowering ISD::MUL");
7477 unsigned NewOpc = 0;
7481 if (isN0SExt && isN1SExt)
7486 if (isN0ZExt && isN1ZExt)
7488 else if (isN1SExt || isN1ZExt) {
7522 "unexpected types for extended operands to VMULL");
7523 return DAG.
getNode(NewOpc, DL, VT, Op0, Op1);
7537 return DAG.
getNode(N0->getOpcode(), DL, VT,
7617 "unexpected type for custom-lowering ISD::SDIV");
7653 "unexpected type for custom-lowering ISD::UDIV");
7788 bool ShouldUseSRet = Subtarget->
isAPCS_ABI();
7790 if (ShouldUseSRet) {
7792 const uint64_t ByteSize = DL.getTypeAllocSize(RetTy);
7793 const unsigned StackAlign = DL.getPrefTypeAlignment(RetTy);
7794 int FrameIdx = MFI.CreateStackObject(ByteSize, StackAlign,
false);
7800 Entry.IsSExt =
false;
7801 Entry.IsZExt =
false;
7802 Entry.IsSRet =
true;
7803 Args.push_back(Entry);
7810 Entry.IsSExt =
false;
7811 Entry.IsZExt =
false;
7812 Args.push_back(Entry);
7815 (ArgVT ==
MVT::f64) ? RTLIB::SINCOS_STRET_F64 : RTLIB::SINCOS_STRET_F32;
7823 .setCallee(CC, RetTy, Callee, std::move(Args))
7824 .setDiscardResult(ShouldUseSRet);
7825 std::pair<SDValue, SDValue> CallResult =
LowerCallTo(CLI);
7828 return CallResult.first;
7849 "unexpected type for custom lowering DIV");
7855 const char *
Name =
nullptr;
7857 Name = (VT ==
MVT::i32) ?
"__rt_sdiv" :
"__rt_sdiv64";
7859 Name = (VT ==
MVT::i32) ?
"__rt_udiv" :
"__rt_udiv64";
7865 for (
auto AI : {1, 0}) {
7869 Args.push_back(Arg);
7872 CallLoweringInfo CLI(DAG);
7876 ES, std::move(Args));
7882 bool Signed)
const {
7884 "unexpected type for custom lowering DIV");
7890 return LowerWindowsDIVLibCall(Op, DAG, Signed, DBZCHK);
7906 void ARMTargetLowering::ExpandDIV_Windows(
7913 "unexpected type for custom lowering DIV");
7918 SDValue Result = LowerWindowsDIVLibCall(Op, DAG, Signed, DBZCHK);
7975 const SDValue Ops[] = { RegClass, VLo, SubReg0, VHi, SubReg1 };
7984 "AtomicCmpSwap on types less than 64 should be legal");
7990 ARM::CMP_SWAP_64,
SDLoc(N),
7995 MemOp[0] = cast<MemSDNode>(
N)->getMemOperand();
7996 cast<MachineSDNode>(CmpSwap)->setMemRefs(MemOp, MemOp + 1);
8014 "Custom lowering is MSVCRT specific!");
8024 TargetLowering::ArgListEntry Entry;
8028 Entry.IsZExt =
true;
8029 Args.push_back(Entry);
8033 Entry.IsZExt =
true;
8034 Args.push_back(Entry);
8045 bool IsTC = TLI.isInTailCallPosition(DAG, Op.
getNode(), TCChain) &&
8055 std::pair<SDValue, SDValue> CI = TLI.LowerCallTo(CLI);
8058 return !CI.second.getNode() ? DAG.
getRoot() : CI.first;
8114 return LowerDIV_Windows(Op, DAG,
true);
8118 return LowerDIV_Windows(Op, DAG,
false);
8124 return LowerSignedALUO(Op, DAG);
8127 return LowerUnsignedALUO(Op, DAG);
8135 return LowerDYNAMIC_STACKALLOC(Op, DAG);
8146 unsigned IntNo = cast<ConstantSDNode>(N->
getOperand(0))->getZExtValue();
8148 if (IntNo == Intrinsic::arm_smlald)
8150 else if (IntNo == Intrinsic::arm_smlaldx)
8152 else if (IntNo == Intrinsic::arm_smlsld)
8154 else if (IntNo == Intrinsic::arm_smlsldx)
8196 Res = LowerREM(N, DAG);
8200 Res = LowerDivRem(
SDValue(N, 0), DAG);
8234 "ROPI/RWPI not currently supported with SjLj");
8244 bool isThumb2 = Subtarget->
isThumb2();
8247 unsigned PCAdj = (isThumb || isThumb2) ? 4 : 8;
8253 : &ARM::GPRRegClass;
8272 BuildMI(*MBB, MI, dl, TII->
get(ARM::t2LDRpci), NewVReg1)
8273 .addConstantPoolIndex(CPI)
8278 BuildMI(*MBB, MI, dl, TII->
get(ARM::t2ORRri), NewVReg2)
8284 BuildMI(*MBB, MI, dl, TII->
get(ARM::tPICADD), NewVReg3)
8287 BuildMI(*MBB, MI, dl, TII->
get(ARM::t2STRi12))
8293 }
else if (isThumb) {
8302 BuildMI(*MBB, MI, dl, TII->
get(ARM::tLDRpci), NewVReg1)
8303 .addConstantPoolIndex(CPI)
8307 BuildMI(*MBB, MI, dl, TII->
get(ARM::tPICADD), NewVReg2)
8312 BuildMI(*MBB, MI, dl, TII->
get(ARM::tMOVi8), NewVReg3)
8317 BuildMI(*MBB, MI, dl, TII->
get(ARM::tORR), NewVReg4)
8323 BuildMI(*MBB, MI, dl, TII->
get(ARM::tADDframe), NewVReg5)
8338 BuildMI(*MBB, MI, dl, TII->
get(ARM::LDRi12), NewVReg1)
8339 .addConstantPoolIndex(CPI)
8344 BuildMI(*MBB, MI, dl, TII->
get(ARM::PICADD), NewVReg2)
8357 void ARMTargetLowering::EmitSjLjDispatchBlock(
MachineInstr &MI,
8367 : &ARM::GPRnopcRegClass;
8372 unsigned MaxCSNum = 0;
8375 if (!BB->isEHPad())
continue;
8380 II = BB->begin(),
IE = BB->end(); II !=
IE; ++II) {
8381 if (!II->isEHLabel())
continue;
8383 MCSymbol *Sym = II->getOperand(0).getMCSymbol();
8388 CSI = CallSiteIdxs.
begin(),
CSE = CallSiteIdxs.
end();
8389 CSI !=
CSE; ++CSI) {
8390 CallSiteNumToLPad[*CSI].push_back(&*BB);
8391 MaxCSNum =
std::max(MaxCSNum, *CSI);
8398 std::vector<MachineBasicBlock*> LPadList;
8400 LPadList.reserve(CallSiteNumToLPad.
size());
8401 for (
unsigned I = 1;
I <= MaxCSNum; ++
I) {
8404 II = MBBList.
begin(),
IE = MBBList.
end(); II !=
IE; ++II) {
8405 LPadList.push_back(*II);
8406 InvokeBBs.
insert((*II)->pred_begin(), (*II)->pred_end());
8410 assert(!LPadList.empty() &&
8411 "No landing pad destinations for the dispatch jump table!");
8425 unsigned trap_opcode;
8427 trap_opcode = ARM::tTRAP;
8444 SetupEntryBlockForSjLj(MI, MBB, DispatchBB, FI);
8451 MIB =
BuildMI(DispatchBB, dl, TII->
get(ARM::Int_eh_sjlj_dispatchsetup));
8463 unsigned NumLPads = LPadList.size();
8466 BuildMI(DispatchBB, dl, TII->
get(ARM::t2LDRi12), NewVReg1)
8472 if (NumLPads < 256) {
8473 BuildMI(DispatchBB, dl, TII->
get(ARM::t2CMPri))
8479 BuildMI(DispatchBB, dl, TII->
get(ARM::t2MOVi16), VReg1)
8480 .addImm(NumLPads & 0xFFFF)
8483 unsigned VReg2 = VReg1;
8484 if ((NumLPads & 0xFFFF0000) != 0) {
8486 BuildMI(DispatchBB, dl, TII->
get(ARM::t2MOVTi16), VReg2)
8492 BuildMI(DispatchBB, dl, TII->
get(ARM::t2CMPrr))
8498 BuildMI(DispatchBB, dl, TII->
get(ARM::t2Bcc))
8504 BuildMI(DispContBB, dl, TII->
get(ARM::t2LEApcrelJT), NewVReg3)
8505 .addJumpTableIndex(MJTI)
8509 BuildMI(DispContBB, dl, TII->
get(ARM::t2ADDrs), NewVReg4)
8516 BuildMI(DispContBB, dl, TII->
get(ARM::t2BR_JT))
8520 }
else if (Subtarget->
isThumb()) {
8522 BuildMI(DispatchBB, dl, TII->
get(ARM::tLDRspi), NewVReg1)
8528 if (NumLPads < 256) {
8529 BuildMI(DispatchBB, dl, TII->
get(ARM::tCMPi8))
8545 BuildMI(DispatchBB, dl, TII->
get(ARM::tLDRpci))
8549 BuildMI(DispatchBB, dl, TII->
get(ARM::tCMPr))
8561 BuildMI(DispContBB, dl, TII->
get(ARM::tLSLri), NewVReg2)
8568 BuildMI(DispContBB, dl, TII->
get(ARM::tLEApcrelJT), NewVReg3)
8569 .addJumpTableIndex(MJTI)
8573 BuildMI(DispContBB, dl, TII->
get(ARM::tADDrr), NewVReg4)
8583 BuildMI(DispContBB, dl, TII->
get(ARM::tLDRi), NewVReg5)
8589 unsigned NewVReg6 = NewVReg5;
8590 if (IsPositionIndependent) {
8592 BuildMI(DispContBB, dl, TII->
get(ARM::tADDrr), NewVReg6)
8599 BuildMI(DispContBB, dl, TII->
get(ARM::tBR_JTr))
8604 BuildMI(DispatchBB, dl, TII->
get(ARM::LDRi12), NewVReg1)
8610 if (NumLPads < 256) {
8611 BuildMI(DispatchBB, dl, TII->
get(ARM::CMPri))
8617 BuildMI(DispatchBB, dl, TII->
get(ARM::MOVi16), VReg1)
8618 .addImm(NumLPads & 0xFFFF)
8621 unsigned VReg2 = VReg1;
8622 if ((NumLPads & 0xFFFF0000) != 0) {
8624 BuildMI(DispatchBB, dl, TII->
get(ARM::MOVTi16), VReg2)
8630 BuildMI(DispatchBB, dl, TII->
get(ARM::CMPrr))
8646 BuildMI(DispatchBB, dl, TII->
get(ARM::LDRcp))
8651 BuildMI(DispatchBB, dl, TII->
get(ARM::CMPrr))
8663 BuildMI(DispContBB, dl, TII->
get(ARM::MOVsi), NewVReg3)
8669 BuildMI(DispContBB, dl, TII->
get(ARM::LEApcrelJT), NewVReg4)
8670 .addJumpTableIndex(MJTI)
8676 BuildMI(DispContBB, dl, TII->
get(ARM::LDRrs), NewVReg5)
8683 if (IsPositionIndependent) {
8684 BuildMI(DispContBB, dl, TII->
get(ARM::BR_JTadd))
8689 BuildMI(DispContBB, dl, TII->
get(ARM::BR_JTr))
8697 for (std::vector<MachineBasicBlock*>::iterator
8698 I = LPadList.begin(),
E = LPadList.end();
I !=
E; ++
I) {
8700 if (SeenMBBs.
insert(CurMBB).second)
8713 while (!Successors.empty()) {
8722 BB->normalizeSuccProbs();
8729 II = BB->rbegin(),
IE = BB->rend(); II !=
IE; ++II) {
8730 if (!II->isCall())
continue;
8734 OI = II->operands_begin(), OE = II->operands_end();
8736 if (!OI->isReg())
continue;
8737 DefRegs[OI->getReg()] =
true;
8742 for (
unsigned i = 0; SavedRegs[i] != 0; ++i) {
8743 unsigned Reg = SavedRegs[i];
8745 !ARM::tGPRRegClass.contains(Reg) &&
8746 !ARM::hGPRRegClass.contains(Reg))
8748 if (Subtarget->
isThumb1Only() && !ARM::tGPRRegClass.contains(Reg))
8750 if (!Subtarget->
isThumb() && !ARM::GPRRegClass.contains(Reg))
8764 (*I)->setIsEHPad(
false);
8781 static unsigned getLdOpcode(
unsigned LdSize,
bool IsThumb1,
bool IsThumb2) {
8783 return LdSize == 16 ? ARM::VLD1q32wb_fixed
8784 : LdSize == 8 ? ARM::VLD1d32wb_fixed : 0;
8786 return LdSize == 4 ? ARM::tLDRi
8787 : LdSize == 2 ? ARM::tLDRHi
8788 : LdSize == 1 ? ARM::tLDRBi : 0;
8790 return LdSize == 4 ? ARM::t2LDR_POST
8791 : LdSize == 2 ? ARM::t2LDRH_POST
8792 : LdSize == 1 ? ARM::t2LDRB_POST : 0;
8793 return LdSize == 4 ? ARM::LDR_POST_IMM
8794 : LdSize == 2 ? ARM::LDRH_POST
8795 : LdSize == 1 ? ARM::LDRB_POST_IMM : 0;
8800 static unsigned getStOpcode(
unsigned StSize,
bool IsThumb1,
bool IsThumb2) {
8802 return StSize == 16 ? ARM::VST1q32wb_fixed
8803 : StSize == 8 ? ARM::VST1d32wb_fixed : 0;
8805 return StSize == 4 ? ARM::tSTRi
8806 : StSize == 2 ? ARM::tSTRHi
8807 : StSize == 1 ? ARM::tSTRBi : 0;
8809 return StSize == 4 ? ARM::t2STR_POST
8810 : StSize == 2 ? ARM::t2STRH_POST
8811 : StSize == 1 ? ARM::t2STRB_POST : 0;
8812 return StSize == 4 ? ARM::STR_POST_IMM
8813 : StSize == 2 ? ARM::STRH_POST
8814 : StSize == 1 ? ARM::STRB_POST_IMM : 0;
8821 unsigned LdSize,
unsigned Data,
unsigned AddrIn,
8822 unsigned AddrOut,
bool IsThumb1,
bool IsThumb2) {
8823 unsigned LdOpc =
getLdOpcode(LdSize, IsThumb1, IsThumb2);
8824 assert(LdOpc != 0 &&
"Should have a load opcode");
8831 }
else if (IsThumb1) {
8837 BuildMI(*BB, Pos, dl, TII->
get(ARM::tADDi8), AddrOut)
8842 }
else if (IsThumb2) {
8862 unsigned StSize,
unsigned Data,
unsigned AddrIn,
8863 unsigned AddrOut,
bool IsThumb1,
bool IsThumb2) {
8864 unsigned StOpc =
getStOpcode(StSize, IsThumb1, IsThumb2);
8865 assert(StOpc != 0 &&
"Should have a store opcode");
8867 BuildMI(*BB, Pos, dl, TII->
get(StOpc), AddrOut)
8872 }
else if (IsThumb1) {
8879 BuildMI(*BB, Pos, dl, TII->
get(ARM::tADDi8), AddrOut)
8884 }
else if (IsThumb2) {
8885 BuildMI(*BB, Pos, dl, TII->
get(StOpc), AddrOut)
8891 BuildMI(*BB, Pos, dl, TII->
get(StOpc), AddrOut)
8918 unsigned UnitSize = 0;
8923 bool IsThumb2 = Subtarget->
isThumb2();
8924 bool IsThumb = Subtarget->
isThumb();
8928 }
else if (Align & 2) {
8934 if ((Align % 16 == 0) && SizeVal >= 16)
8936 else if ((Align % 8 == 0) && SizeVal >= 8)
8945 bool IsNeon = UnitSize >= 8;
8946 TRC = IsThumb ? &ARM::tGPRRegClass : &ARM::GPRRegClass;
8948 VecTRC = UnitSize == 16 ? &ARM::DPairRegClass
8949 : UnitSize == 8 ? &ARM::DPRRegClass
8952 unsigned BytesLeft = SizeVal % UnitSize;
8953 unsigned LoopSize = SizeVal - BytesLeft;
8955 if (SizeVal <= Subtarget->getMaxInlineSizeThreshold()) {
8959 unsigned srcIn = src;
8960 unsigned destIn = dest;
8961 for (
unsigned i = 0; i < LoopSize; i+=UnitSize) {
8965 emitPostLd(BB, MI, TII, dl, UnitSize, scratch, srcIn, srcOut,
8966 IsThumb1, IsThumb2);
8967 emitPostSt(BB, MI, TII, dl, UnitSize, scratch, destIn, destOut,
8968 IsThumb1, IsThumb2);
8976 for (
unsigned i = 0; i < BytesLeft; i++) {
8980 emitPostLd(BB, MI, TII, dl, 1, scratch, srcIn, srcOut,
8981 IsThumb1, IsThumb2);
8982 emitPostSt(BB, MI, TII, dl, 1, scratch, destIn, destOut,
8983 IsThumb1, IsThumb2);
9023 if (Subtarget->
useMovt(*MF)) {
9024 unsigned Vtmp = varEnd;
9025 if ((LoopSize & 0xFFFF0000) != 0)
9027 BuildMI(BB, dl, TII->
get(IsThumb ? ARM::t2MOVi16 : ARM::MOVi16), Vtmp)
9028 .addImm(LoopSize & 0xFFFF)
9031 if ((LoopSize & 0xFFFF0000) != 0)
9032 BuildMI(BB, dl, TII->
get(IsThumb ? ARM::t2MOVTi16 : ARM::MOVTi16), varEnd)
9075 .addReg(varLoop).
addMBB(loopMBB)
9078 .addReg(srcLoop).
addMBB(loopMBB)
9081 .addReg(destLoop).
addMBB(loopMBB)
9088 IsThumb1, IsThumb2);
9090 IsThumb1, IsThumb2);
9102 TII->
get(IsThumb2 ? ARM::t2SUBri : ARM::SUBri), varLoop);
9111 TII->
get(IsThumb1 ? ARM::tBcc : IsThumb2 ? ARM::t2Bcc : ARM::Bcc))
9120 auto StartOfExit = exitMBB->
begin();
9124 unsigned srcIn = srcLoop;
9125 unsigned destIn = destLoop;
9126 for (
unsigned i = 0; i < BytesLeft; i++) {
9130 emitPostLd(BB, StartOfExit, TII, dl, 1, scratch, srcIn, srcOut,
9131 IsThumb1, IsThumb2);
9132 emitPostSt(BB, StartOfExit, TII, dl, 1, scratch, destIn, destOut,
9133 IsThumb1, IsThumb2);
9143 ARMTargetLowering::EmitLowered__chkstk(
MachineInstr &MI,
9150 "__chkstk is only supported on Windows");
9151 assert(Subtarget->
isThumb2() &&
"Windows on ARM requires Thumb-2 mode");
9177 .addExternalSymbol(
"__chkstk")
9190 .addExternalSymbol(
"__chkstk");
9204 BuildMI(*MBB, MI, DL, TII.
get(ARM::t2SUBrr), ARM::SP)
9216 ARMTargetLowering::EmitLowered__dbzchk(
MachineInstr &MI,
9230 BuildMI(TrapBB, DL, TII->
get(ARM::t__brkdiv0));
9252 bool isThumb2 = Subtarget->
isThumb2();
9260 case ARM::tLDR_postidx: {
9262 BuildMI(*BB, MI, dl, TII->
get(ARM::tLDMIA_UPD))
9275 case ARM::t2STR_preidx:
9278 case ARM::t2STRB_preidx:
9281 case ARM::t2STRH_preidx:
9285 case ARM::STRi_preidx:
9286 case ARM::STRBi_preidx: {
9287 unsigned NewOpc = MI.
getOpcode() == ARM::STRi_preidx ? ARM::STR_PRE_IMM
9288 : ARM::STRB_PRE_IMM;
9304 .addMemOperand(MMO);
9308 case ARM::STRr_preidx:
9309 case ARM::STRBr_preidx:
9310 case ARM::STRH_preidx: {
9314 case ARM::STRr_preidx: NewOpc = ARM::STR_PRE_REG;
break;
9315 case ARM::STRBr_preidx: NewOpc = ARM::STRB_PRE_REG;
break;
9316 case ARM::STRH_preidx: NewOpc = ARM::STRH_PRE;
break;
9325 case ARM::tMOVCCr_pseudo: {
9382 case ARM::BCCZi64: {
9388 bool RHSisZero = MI.
getOpcode() == ARM::BCCZi64;
9393 BuildMI(BB, dl, TII->
get(isThumb2 ? ARM::t2CMPri : ARM::CMPri))
9397 BuildMI(BB, dl, TII->
get(isThumb2 ? ARM::t2CMPri : ARM::CMPri))
9403 BuildMI(BB, dl, TII->
get(isThumb2 ? ARM::t2CMPrr : ARM::CMPrr))
9407 BuildMI(BB, dl, TII->
get(isThumb2 ? ARM::t2CMPrr : ARM::CMPrr))
9408 .addReg(LHS2).
addReg(RHS2)
9417 BuildMI(BB, dl, TII->
get(isThumb2 ? ARM::t2Bcc : ARM::Bcc))
9430 case ARM::Int_eh_sjlj_setjmp:
9431 case ARM::Int_eh_sjlj_setjmp_nofp:
9432 case ARM::tInt_eh_sjlj_setjmp:
9433 case ARM::t2Int_eh_sjlj_setjmp:
9434 case ARM::t2Int_eh_sjlj_setjmp_nofp:
9437 case ARM::Int_eh_sjlj_setup_dispatch:
9438 EmitSjLjDispatchBlock(MI, BB);
9466 bool isThumb2 = Subtarget->
isThumb2();
9470 unsigned NewRsbDstReg =
9485 BuildMI(BB, dl, TII->
get(isThumb2 ? ARM::t2CMPri : ARM::CMPri))
9492 TII->
get(isThumb2 ? ARM::t2Bcc : ARM::Bcc)).addMBB(SinkBB)
9499 TII->
get(isThumb2 ? ARM::t2RSBri : ARM::RSBri), NewRsbDstReg)
9508 TII->
get(ARM::PHI), ABSDstReg)
9509 .addReg(NewRsbDstReg).
addMBB(RSBBB)
9518 case ARM::COPY_STRUCT_BYVAL_I32:
9520 return EmitStructByval(MI, BB);
9522 return EmitLowered__chkstk(MI, BB);
9524 return EmitLowered__dbzchk(MI, BB);
9551 : &ARM::GPRRegClass);
9576 MCID = &TII->get(NewOpc);
9580 &&
"converted opcode should be the same except for cc_out" 9581 " (and, on Thumb1, pred)");
9616 assert(!NewOpc &&
"Optional cc_out operand required");
9621 bool definesCPSR =
false;
9622 bool deadCPSR =
false;
9635 assert(!NewOpc &&
"Optional cc_out operand required");
9641 "expect uninitialized optional cc_out operand");
9680 default:
return false;
9751 bool AllOnes =
false) {
9758 NonConstantVal, DAG))
9764 OtherOp, NonConstantVal);
9770 CCOp, TrueVal, FalseVal);
9862 Opcode = Intrinsic::arm_neon_vpaddls;
9864 Opcode = Intrinsic::arm_neon_vpaddlu;
9907 unsigned nextIndex = 0;
9930 || C1->getZExtValue() != nextIndex+1)
9975 return DAG.
getNode(ExtOp, dl, VT, tmp);
9989 if (!Subtarget->
hasDSP())
10015 if (
auto Const = dyn_cast<ConstantSDNode>(SRA.
getOperand(1))) {
10016 if (Const->getZExtValue() != 31)
10025 SDLoc dl(AddcNode);
10026 unsigned Opcode = 0;
10061 SDValue resNode(AddcNode, 0);
10090 "Expect an ADDE or SUBE");
10094 "ADDE node has the wrong inputs");
10111 assert(AddcSubcNode->getNumValues() == 2 &&
10112 AddcSubcNode->getValueType(0) ==
MVT::i32 &&
10113 "Expect ADDC with two result values. First: i32");
10133 bool IsLeftOperandMUL =
false;
10138 IsLeftOperandMUL =
true;
10149 SDValue *LowAddSub =
nullptr;
10152 if ((AddeSubeOp0 != MULOp.
getValue(1)) && (AddeSubeOp1 != MULOp.
getValue(1)))
10155 if (IsLeftOperandMUL)
10156 HiAddSub = &AddeSubeOp1;
10158 HiAddSub = &AddeSubeOp0;
10163 if (AddcSubcOp0 == MULOp.
getValue(0)) {
10164 LoMul = &AddcSubcOp0;
10165 LowAddSub = &AddcSubcOp1;
10167 if (AddcSubcOp1 == MULOp.
getValue(0)) {
10168 LoMul = &AddcSubcOp1;
10169 LowAddSub = &AddcSubcOp0;
10177 if (AddcSubcNode == HiAddSub->getNode() ||
10196 static_cast<ConstantSDNode *
>(LowAddSub->getNode())->getZExtValue() ==
10207 return SDValue(AddeSubeNode, 0);
10228 return SDValue(AddeSubeNode, 0);
10249 SDNode *UmlalNode =
nullptr;
10327 int32_t imm =
C->getSExtValue();
10328 if (imm < 0 && imm > std::numeric_limits<int>::min()) {
10348 int64_t imm =
C->getSExtValue();
10437 for (
auto U : N->
uses()) {
10438 switch(U->getOpcode()) {
10451 if (isa<ConstantSDNode>(U->getOperand(0)) ||
10452 isa<ConstantSDNode>(U->getOperand(1)))
10456 if (U->getOperand(0).getOpcode() ==
ISD::SHL ||
10457 U->getOperand(1).getOpcode() ==
ISD::SHL)
10474 if (!C1ShlC2 || !C2)
10477 APInt C2Int = C2->getAPIntValue();
10478 APInt C1Int = C1ShlC2->getAPIntValue();
10483 if ((C1Int & Mask) != C1Int)
10490 auto LargeImm = [](
const APInt &Imm) {
10491 unsigned Zeros = Imm.countLeadingZeros() + Imm.countTrailingZeros();
10492 return Imm.getBitWidth() - Zeros > 8;
10495 if (LargeImm(C1Int) || LargeImm(C2Int))
10591 return DAG.
getNode(Opcode, DL, VT,
10618 unsigned ShiftAmt = countTrailingZeros<uint64_t>(MulAmt);
10620 ShiftAmt = ShiftAmt & (32 - 1);
10625 MulAmt >>= ShiftAmt;
10647 uint64_t MulAmtAbs = -MulAmt;
10695 if (C1 == 255 || C1 == 65535)
10712 if (!C2 || C2 >= 32)
10742 if (C2 + C3 < 32 && C1 == ((-1U << (C2 + C3)) >> C3)) {
10768 APInt SplatBits, SplatUndef;
10769 unsigned SplatBitSize;
10772 BVN->
isConstantSplat(SplatBits, SplatUndef, SplatBitSize, HasAnyUndefs)) {
10773 if (SplatBitSize <= 64) {
10850 unsigned Opcode = 0;
10851 if (
isS16(OpS16, DAG))
10900 if (Mask == 0xffff)
10907 if ((Val & ~Mask) != Val)
10932 (Mask == ~Mask2)) {
10935 if (Subtarget->
hasDSP() &&
10936 (Mask == 0xffff || Mask == 0xffff0000))
10949 (~Mask == Mask2)) {
10952 if (Subtarget->
hasDSP() &&
10953 (Mask2 == 0xffff || Mask2 == 0xffff0000))
10974 unsigned ShAmtC = cast<ConstantSDNode>(ShAmt)->getZExtValue();
11004 APInt SplatBits, SplatUndef;
11005 unsigned SplatBitSize;
11007 if (BVN && Subtarget->
hasNEON() &&
11008 BVN->
isConstantSplat(SplatBits, SplatUndef, SplatBitSize, HasAnyUndefs)) {
11009 if (SplatBitSize <= 64) {
11046 unsigned SplatBitSize;
11049 APInt SplatBits0, SplatBits1;
11053 if (BVN0 && BVN0->
isConstantSplat(SplatBits0, SplatUndef, SplatBitSize,
11054 HasAnyUndefs) && !HasAnyUndefs) {
11055 if (BVN1 && BVN1->isConstantSplat(SplatBits1, SplatUndef, SplatBitSize,
11056 HasAnyUndefs) && !HasAnyUndefs) {
11061 SplatBits0 == ~SplatBits1) {
11116 ToMask = ~cast<ConstantSDNode>(N->
getOperand(2))->getAPIntValue();
11121 if (From->getOpcode() ==
ISD::SRL &&
11122 isa<ConstantSDNode>(From->getOperand(1))) {
11123 APInt Shift = cast<ConstantSDNode>(From->getOperand(1))->getAPIntValue();
11126 From = From->getOperand(0);
11138 return LastActiveBitInA - 1 == FirstActiveBitInB;
11144 APInt ToMask, FromMask;
11152 APInt CombinedToMask = ToMask;
11154 APInt NewToMask, NewFromMask;
11156 if (NewFrom != From) {
11158 CombinedToMask |= NewToMask;
11164 if ((NewToMask & CombinedToMask).getBoolValue())
11177 CombinedToMask |= NewToMask;
11194 unsigned InvMask = cast<ConstantSDNode>(N->
getOperand(2))->getZExtValue();
11198 static_cast<unsigned>(std::numeric_limits<unsigned>::digits) &&
11199 "undefined behavior");
11200 unsigned Mask = (1u << Width) - 1;
11202 if ((Mask & (~Mask2)) == 0)
11215 APInt ToMask1, FromMask1;
11218 APInt ToMask2, FromMask2;
11226 APInt NewFromMask = FromMask1 | FromMask2;
11227 APInt NewToMask = ToMask1 | ToMask2;
11232 if (NewFromMask[0] == 0)
11269 DAG.getConstant(4, DL,
MVT::i32));
11270 SDValue NewLD2 = DAG.getLoad(
11308 for (
unsigned i = 0; i < NumElts; ++i) {
11338 for (
unsigned i = 0; i < NumElts; ++i) {
11385 unsigned NumOfBitCastedElts = 0;
11387 unsigned NumOfRelevantElts = NumElts;
11388 for (
unsigned Idx = 0; Idx < NumElts; ++Idx) {
11393 ++NumOfBitCastedElts;
11394 }
else if (Elt.
isUndef() || isa<ConstantSDNode>(Elt))
11397 --NumOfRelevantElts;
11401 if (NumOfBitCastedElts <= NumOfRelevantElts / 2)
11409 if (!TLI.isTypeLegal(VecVT))
11419 for (
unsigned Idx = 0 ; Idx < NumElts; ++Idx) {
11504 unsigned HalfElts = NumElts/2;
11506 for (
unsigned n = 0; n < NumElts; ++n) {
11509 if (MaskElt < (
int)HalfElts)
11511 else if (MaskElt >= (
int)NumElts && MaskElt < (
int)(NumElts + HalfElts))
11512 NewElt = HalfElts + MaskElt - NumElts;
11530 const unsigned AddrOpIdx = ((isIntrinsic ||
isStore) ? 2 : 1);
11540 UI.getUse().getResNo() != Addr.
getResNo())
11549 bool isLoadOp =
true;
11550 bool isLaneOp =
false;
11551 unsigned NewOpc = 0;
11552 unsigned NumVecs = 0;
11554 unsigned IntNo = cast<ConstantSDNode>(N->
getOperand(1))->getZExtValue();
11558 NumVecs = 1;
break;
11560 NumVecs = 2;
break;
11562 NumVecs = 3;
break;
11564 NumVecs = 4;
break;
11565 case Intrinsic::arm_neon_vld2dup:
11566 case Intrinsic::arm_neon_vld3dup:
11567 case Intrinsic::arm_neon_vld4dup:
11572 NumVecs = 2; isLaneOp =
true;
break;
11574 NumVecs = 3; isLaneOp =
true;
break;
11576 NumVecs = 4; isLaneOp =
true;
break;
11578 NumVecs = 1; isLoadOp =
false;
break;
11580 NumVecs = 2; isLoadOp =
false;
break;
11582 NumVecs = 3; isLoadOp =
false;
break;
11584 NumVecs = 4; isLoadOp =
false;
break;
11586 NumVecs = 2; isLoadOp =
false; isLaneOp =
true;
break;
11588 NumVecs = 3; isLoadOp =
false; isLaneOp =
true;
break;
11590 NumVecs = 4; isLoadOp =
false; isLaneOp =
true;
break;
11601 NumVecs = 1; isLaneOp =
false;
break;
11603 NumVecs = 1; isLaneOp =
false; isLoadOp =
false;
break;
11611 }
else if (isIntrinsic) {
11614 assert(isStore &&
"Node has to be a load, a store, or an intrinsic!");
11625 if (NumBytes >= 3 * 16 && (!CInc || CInc->
getZExtValue() != NumBytes)) {
11634 EVT AlignedVecTy = VecTy;
11651 if (isa<LSBaseSDNode>(N)) {
11652 if (Alignment == 0)
11656 assert(NumVecs == 1 &&
"Unexpected multi-element generic load/store.");
11657 assert(!isLaneOp &&
"Unexpected generic load/store lane.");
11674 unsigned NumResultVecs = (isLoadOp ? NumVecs : 0);
11676 for (n = 0; n < NumResultVecs; ++n)
11677 Tys[n] = AlignedVecTy;
11688 if (
StoreSDNode *StN = dyn_cast<StoreSDNode>(N)) {
11694 for (
unsigned i = AddrOpIdx + 1; i < N->
getNumOperands() - 1; ++i)
11714 for (
unsigned i = 0; i < NumResultVecs; ++i)
11720 SDValue &LdVal = NewResults[0];
11756 unsigned NumVecs = 0;
11757 unsigned NewOpc = 0;
11758 unsigned IntNo = cast<ConstantSDNode>(VLD->
getOperand(1))->getZExtValue();
11759 if (IntNo == Intrinsic::arm_neon_vld2lane) {
11762 }
else if (IntNo == Intrinsic::arm_neon_vld3lane) {
11765 }
else if (IntNo == Intrinsic::arm_neon_vld4lane) {
11774 unsigned VLDLaneNo =
11775 cast<ConstantSDNode>(VLD->
getOperand(NumVecs+3))->getZExtValue();
11779 if (UI.getUse().getResNo() == NumVecs)
11783 VLDLaneNo != cast<ConstantSDNode>(User->
getOperand(1))->getZExtValue())
11790 for (n = 0; n < NumVecs; ++n)
11803 unsigned ResNo = UI.getUse().
getResNo();
11805 if (ResNo == NumVecs)
11813 std::vector<SDValue> VLDDupResults;
11814 for (
unsigned n = 0; n < NumVecs; ++n)
11815 VLDDupResults.push_back(
SDValue(VLDDup.getNode(), n));
11816 VLDDupResults.push_back(
SDValue(VLDDup.getNode(), NumVecs));
11843 unsigned Imm = cast<ConstantSDNode>(Op.
getOperand(0))->getZExtValue();
11909 assert(StVT != VT &&
"Cannot truncate to the same type");
11918 if (0 != (NumElems * FromEltSz) % ToEltSz)
return SDValue();
11920 unsigned SizeRatio = FromEltSz / ToEltSz;
11925 NumElems*SizeRatio);
11931 for (
unsigned i = 0; i < NumElems; ++i)
11933 ? (i + 1) * SizeRatio - 1
11948 if (TLI.
isTypeLegal(Tp) && Tp.getSizeInBits() <= NumElems * ToEltSz)
11967 for (
unsigned I = 0;
I <
E;
I++) {
11969 StoreType, ShuffWide,
12058 if (!isa<BuildVectorSDNode>(ConstVec))
12066 if (FloatBits != 32 || IntBits > 32 || NumLanes > 4) {
12077 if (C == -1 || C == 0 || C > 32)
12082 unsigned IntrinsicOpcode = isSigned ? Intrinsic::arm_neon_vcvtfp2fxs :
12083 Intrinsic::arm_neon_vcvtfp2fxu;
12089 if (IntBits < FloatBits)
12116 if (!isa<BuildVectorSDNode>(ConstVec))
12124 if (FloatBits != 32 || IntBits > 32 || NumLanes > 4) {
12135 if (C == -1 || C == 0 || C > 32)
12141 if (IntBits < FloatBits)
12146 unsigned IntrinsicOpcode = isSigned ? Intrinsic::arm_neon_vcvtfxs2fp :
12147 Intrinsic::arm_neon_vcvtfxu2fp;
12162 APInt SplatBits, SplatUndef;
12163 unsigned SplatBitSize;
12165 if (! BVN || ! BVN->
isConstantSplat(SplatBits, SplatUndef, SplatBitSize,
12166 HasAnyUndefs, ElementBits) ||
12167 SplatBitSize > ElementBits)
12178 assert(VT.
isVector() &&
"vector shift count is not a vector type");
12182 return (Cnt >= 0 && (isLong ? Cnt-1 : Cnt) < ElementBits);
12193 assert(VT.
isVector() &&
"vector shift count is not a vector type");
12198 return (Cnt >= 1 && Cnt <= (isNarrow ? ElementBits/2 : ElementBits));
12199 if (Cnt >= -(isNarrow ? ElementBits/2 : ElementBits) && Cnt <= -1) {
12208 unsigned IntNo = cast<ConstantSDNode>(N->
getOperand(0))->getZExtValue();
12219 case Intrinsic::arm_neon_vshifts:
12220 case Intrinsic::arm_neon_vshiftu:
12221 case Intrinsic::arm_neon_vrshifts:
12222 case Intrinsic::arm_neon_vrshiftu:
12223 case Intrinsic::arm_neon_vrshiftn:
12224 case Intrinsic::arm_neon_vqshifts:
12225 case Intrinsic::arm_neon_vqshiftu:
12226 case Intrinsic::arm_neon_vqshiftsu:
12227 case Intrinsic::arm_neon_vqshiftns:
12228 case Intrinsic::arm_neon_vqshiftnu:
12229 case Intrinsic::arm_neon_vqshiftnsu:
12230 case Intrinsic::arm_neon_vqrshiftns:
12231 case Intrinsic::arm_neon_vqrshiftnu:
12232 case Intrinsic::arm_neon_vqrshiftnsu: {
12235 unsigned VShiftOpc = 0;
12238 case Intrinsic::arm_neon_vshifts:
12239 case Intrinsic::arm_neon_vshiftu:
12245 VShiftOpc = (IntNo == Intrinsic::arm_neon_vshifts ?
12251 case Intrinsic::arm_neon_vrshifts:
12252 case Intrinsic::arm_neon_vrshiftu:
12257 case Intrinsic::arm_neon_vqshifts:
12258 case Intrinsic::arm_neon_vqshiftu:
12263 case Intrinsic::arm_neon_vqshiftsu:
12268 case Intrinsic::arm_neon_vrshiftn:
12269 case Intrinsic::arm_neon_vqshiftns:
12270 case Intrinsic::arm_neon_vqshiftnu:
12271 case Intrinsic::arm_neon_vqshiftnsu:
12272 case Intrinsic::arm_neon_vqrshiftns:
12273 case Intrinsic::arm_neon_vqrshiftnu:
12274 case Intrinsic::arm_neon_vqrshiftnsu:
12286 case Intrinsic::arm_neon_vshifts:
12287 case Intrinsic::arm_neon_vshiftu:
12290 case Intrinsic::arm_neon_vrshifts:
12292 case Intrinsic::arm_neon_vrshiftu:
12294 case Intrinsic::arm_neon_vrshiftn:
12296 case Intrinsic::arm_neon_vqshifts:
12298 case Intrinsic::arm_neon_vqshiftu:
12300 case Intrinsic::arm_neon_vqshiftsu:
12302 case Intrinsic::arm_neon_vqshiftns:
12304 case Intrinsic::arm_neon_vqshiftnu:
12306 case Intrinsic::arm_neon_vqshiftnsu:
12308 case Intrinsic::arm_neon_vqrshiftns:
12310 case Intrinsic::arm_neon_vqrshiftnu:
12312 case Intrinsic::arm_neon_vqrshiftnsu:
12321 case Intrinsic::arm_neon_vshiftins: {
12324 unsigned VShiftOpc = 0;
12340 case Intrinsic::arm_neon_vqrshifts:
12341 case Intrinsic::arm_neon_vqrshiftu:
12422 isa<ConstantSDNode>(Lane)) {
12466 auto CCNode = cast<ConstantSDNode>(CMOV->
getOperand(2));
12467 auto CC = CCNode->getAPIntValue().getLimitedValue();
12504 unsigned Heuristic = Subtarget->
isThumb() ? 3 : 2;
12512 if ((OrCI & Known.
Zero) != OrCI)
12519 unsigned BitInX = AndC->
logBase2();
12527 for (
unsigned BitInY = 0, NumActiveBits = OrCI.
getActiveBits();
12528 BitInY < NumActiveBits; ++BitInY) {
12529 if (OrCI[BitInY] == 0)
12532 Mask.setBit(BitInY);
12568 if ((LHS00C && LHS00C->getZExtValue() == 0) &&
12569 (LHS01C && LHS01C->getZExtValue() == 1) &&
12570 (LHS1C && LHS1C->getZExtValue() == 1) &&
12571 (RHSC && RHSC->getZExtValue() == 0)) {
12624 if (CC ==
ARMCC::NE && FalseVal == RHS && FalseVal != LHS) {
12627 }
else if (CC ==
ARMCC::EQ && TrueVal == RHS) {
12640 if ((LHS0C && LHS0C->getZExtValue() == 0) &&
12641 (LHS1C && LHS1C->getZExtValue() == 1) &&
12642 (RHSC && RHSC->getZExtValue() == 0)) {
12682 }
else if (CC ==
ARMCC::NE && LHS != RHS &&
12711 const APInt *TrueConst;
12717 unsigned ShiftAmount = TrueConst->
logBase2();
12736 if (Known.
Zero == 0xfffffffe)
12739 else if (Known.
Zero == 0xffffff00)
12742 else if (Known.
Zero == 0xffff0000)
12848 switch (cast<ConstantSDNode>(N->
getOperand(1))->getZExtValue()) {
12849 case Intrinsic::arm_neon_vld1:
12850 case Intrinsic::arm_neon_vld1x2:
12851 case Intrinsic::arm_neon_vld1x3:
12852 case Intrinsic::arm_neon_vld1x4:
12853 case Intrinsic::arm_neon_vld2:
12854 case Intrinsic::arm_neon_vld3:
12855 case Intrinsic::arm_neon_vld4:
12856 case Intrinsic::arm_neon_vld2lane:
12857 case Intrinsic::arm_neon_vld3lane:
12858 case Intrinsic::arm_neon_vld4lane:
12859 case Intrinsic::arm_neon_vld2dup:
12860 case Intrinsic::arm_neon_vld3dup:
12861 case Intrinsic::arm_neon_vld4dup:
12862 case Intrinsic::arm_neon_vst1:
12863 case Intrinsic::arm_neon_vst1x2:
12864 case Intrinsic::arm_neon_vst1x3:
12865 case Intrinsic::arm_neon_vst1x4:
12866 case Intrinsic::arm_neon_vst2:
12867 case Intrinsic::arm_neon_vst3:
12868 case Intrinsic::arm_neon_vst4:
12869 case Intrinsic::arm_neon_vst2lane:
12870 case Intrinsic::arm_neon_vst3lane:
12871 case Intrinsic::arm_neon_vst4lane:
12888 bool *
Fast)
const {
12903 if (AllowsUnaligned) {
12915 if (Subtarget->
hasNEON() && (AllowsUnaligned || Subtarget->
isLittle())) {
12926 unsigned AlignCheck) {
12927 return ((SrcAlign == 0 || SrcAlign % AlignCheck == 0) &&
12928 (DstAlign == 0 || DstAlign % AlignCheck == 0));
12932 unsigned DstAlign,
unsigned SrcAlign,
12933 bool IsMemset,
bool ZeroMemset,
12939 if ((!IsMemset || ZeroMemset) && Subtarget->
hasNEON() &&
12946 }
else if (Size >= 8 &&
12966 return (SrcBits == 64 && DestBits == 32);
12975 return (SrcBits == 64 && DestBits == 32);
13055 unsigned AS)
const {
13058 return AM.
Scale < 0 ? 1 : 0;
13068 unsigned Scale = 1;
13070 default:
return false;
13085 if ((V & (Scale - 1)) != 0)
13088 return V == (V & ((1LL << 5) - 1));
13093 bool isNeg =
false;
13100 default:
return false;
13107 return V == (V & ((1LL << 8) - 1));
13108 return V == (V & ((1LL << 12) - 1));
13117 return V == (V & ((1LL << 8) - 1));
13141 default:
return false;
13146 return V == (V & ((1LL << 12) - 1));
13149 return V == (V & ((1LL << 8) - 1));
13157 return V == (V & ((1LL << 8) - 1));
13163 int Scale = AM.
Scale;
13168 default:
return false;
13176 Scale = Scale & ~1;
13177 return Scale == 2 || Scale == 4 || Scale == 8;
13194 if (Scale & 1)
return false;
13201 const int Scale = AM.
Scale;
13211 return (Scale == 1) || (!AM.
HasBaseReg && Scale == 2);
13227 switch (AM.
Scale) {
13244 int Scale = AM.
Scale;
13246 default:
return false;
13250 if (Scale < 0) Scale = -Scale;
13258 if (Scale == 1 || (AM.
HasBaseReg && Scale == -1))
13271 if (Scale & 1)
return false;
13291 return Imm >= 0 && Imm <= 255;
13306 return AbsImm >= 0 && AbsImm <= 255;
13320 int RHSC = (int)RHS->getZExtValue();
13321 if (RHSC < 0 && RHSC > -256) {
13334 int RHSC = (int)RHS->getZExtValue();
13335 if (RHSC < 0 && RHSC > -0x1000) {
13377 int RHSC = (int)RHS->getZExtValue();
13378 if (RHSC < 0 && RHSC > -0x100) {
13383 }
else if (RHSC > 0 && RHSC < 0x100) {
13408 Ptr =
LD->getBasePtr();
13409 VT =
LD->getMemoryVT();
13411 }
else if (
StoreSDNode *ST = dyn_cast<StoreSDNode>(N)) {
13412 Ptr = ST->getBasePtr();
13413 VT = ST->getMemoryVT();
13418 bool isLegal =
false;
13444 VT =
LD->getMemoryVT();
13445 Ptr =
LD->getBasePtr();
13448 }
else if (
StoreSDNode *ST = dyn_cast<StoreSDNode>(N)) {
13449 VT = ST->getMemoryVT();
13450 Ptr = ST->getBasePtr();
13451 isNonExt = !ST->isTruncatingStore();
13462 if (!RHS || RHS->getZExtValue() != 4)
13472 bool isLegal =
false;
13500 const APInt &DemandedElts,
13502 unsigned Depth)
const {
13532 Known.
One &= KnownRHS.
One;
13540 case Intrinsic::arm_ldaex:
13541 case Intrinsic::arm_ldrex: {
13542 EVT VT = cast<MemIntrinsicSDNode>(
Op)->getMemoryVT();
13579 switch (AsmPieces.
size()) {
13580 default:
return false;
13582 AsmStr = AsmPieces[0];
13587 if (AsmPieces.
size() == 3 &&
13588 AsmPieces[0] ==
"rev" && AsmPieces[1] ==
"$0" && AsmPieces[2] ==
"$1" &&
13624 if (Constraint.
size() == 1) {
13625 switch (Constraint[0]) {
13637 }
else if (Constraint.
size() == 2) {
13638 switch (Constraint[0]) {
13657 if (!CallOperandVal)
13661 switch (*constraint) {
13681 using RCPair = std::pair<unsigned, const TargetRegisterClass *>;
13685 if (Constraint.
size() == 1) {
13687 switch (Constraint[0]) {
13690 return RCPair(0U, &ARM::tGPRRegClass);
13691 return RCPair(0U, &ARM::GPRRegClass);
13694 return RCPair(0U, &ARM::hGPRRegClass);
13698 return RCPair(0U, &ARM::tGPRRegClass);
13699 return RCPair(0U, &ARM::GPRRegClass);
13704 return RCPair(0U, &ARM::SPRRegClass);
13706 return RCPair(0U, &ARM::DPRRegClass);
13708 return RCPair(0U, &ARM::QPRRegClass);
13714 return RCPair(0U, &ARM::SPR_8RegClass);
13716 return RCPair(0U, &ARM::DPR_8RegClass);
13718 return RCPair(0U, &ARM::QPR_8RegClass);
13724 return RCPair(0U, &ARM::SPRRegClass);
13726 return RCPair(0U, &ARM::DPR_VFP2RegClass);
13728 return RCPair(0U, &ARM::QPR_VFP2RegClass);
13733 return std::make_pair(
unsigned(ARM::CPSR), &ARM::CCRRegClass);
13741 std::string &Constraint,
13742 std::vector<SDValue>&Ops,
13747 if (Constraint.length() != 1)
return;
13749 char ConstraintLetter = Constraint[0];
13750 switch (ConstraintLetter) {
13753 case 'I':
case 'J':
case 'K':
case 'L':
13754 case 'M':
case 'N':
case 'O':
13760 int CVal = (int) CVal64;
13763 if (CVal != CVal64)
13766 switch (ConstraintLetter) {
13771 if (CVal >= 0 && CVal <= 65535)
13778 if (CVal >= 0 && CVal <= 255)
13780 }
else if (Subtarget->
isThumb2()) {
13799 if (CVal >= -255 && CVal <= -1)
13805 if (CVal >= -4095 && CVal <= 4095)
13818 }
else if (Subtarget->
isThumb2()) {
13841 if (CVal >= -7 && CVal < 7)
13843 }
else if (Subtarget->
isThumb2()) {
13866 if ((CVal >= 0 && CVal <= 1020) && ((CVal & 3) == 0))
13872 if ((CVal >= 0 && CVal <= 32) || ((CVal & (CVal - 1)) == 0))
13880 if (CVal >= 0 && CVal <= 31)
13889 if ((CVal >= -508 && CVal <= 508) && ((CVal & 3) == 0))
13899 Ops.push_back(Result);
13909 "Unhandled Opcode in getDivRemLibcall");
13915 case MVT::i8: LC = isSigned ? RTLIB::SDIVREM_I8 : RTLIB::UDIVREM_I8;
break;
13916 case MVT::i16: LC = isSigned ? RTLIB::SDIVREM_I16 : RTLIB::UDIVREM_I16;
break;
13917 case MVT::i32: LC = isSigned ? RTLIB::SDIVREM_I32 : RTLIB::UDIVREM_I32;
break;
13918 case MVT::i64: LC = isSigned ? RTLIB::SDIVREM_I64 : RTLIB::UDIVREM_I64;
break;
13927 "Unhandled Opcode in getDivRemArgList");
13931 TargetLowering::ArgListEntry Entry;
13939 Args.push_back(Entry);
13950 "Register-based DivRem lowering only");
13953 "Invalid opcode for Div/Rem lowering");
13971 SDValue Div = DAG.
getNode(DivOpcode, dl, VT, Dividend, Divisor);
13975 SDValue Values[2] = {Div, Rem};
14001 return CallInfo.first;
14008 std::vector<Type*> RetTyParams;
14009 Type *RetTyElement;
14019 RetTyParams.push_back(RetTyElement);
14020 RetTyParams.push_back(RetTyElement);
14037 CallLoweringInfo CLI(DAG);
14038 CLI.setChain(InChain)
14040 .setSExtResult(isSigned).setZExtResult(!isSigned).setDebugLoc(
SDLoc(N));
14041 std::pair<SDValue, SDValue> CallResult =
LowerCallTo(CLI);
14044 SDNode *ResNode = CallResult.first.getNode();
14059 "no-stack-arg-probe")) {
14060 unsigned Align = cast<ConstantSDNode>(Op.
getOperand(2))->getZExtValue();
14068 SDValue Ops[2] = { SP, Chain };
14085 SDValue Ops[2] = { NewSP, Chain };
14091 "Unexpected type for custom-lowering FP_EXTEND");
14104 "Unexpected type for custom-lowering FP_ROUND");
14121 if (v == 0xffffffff)
14150 unsigned Intrinsic)
const {
14151 switch (Intrinsic) {
14152 case Intrinsic::arm_neon_vld1:
14153 case Intrinsic::arm_neon_vld2:
14154 case Intrinsic::arm_neon_vld3:
14155 case Intrinsic::arm_neon_vld4:
14156 case Intrinsic::arm_neon_vld2lane:
14157 case Intrinsic::arm_neon_vld3lane:
14158 case Intrinsic::arm_neon_vld4lane:
14159 case Intrinsic::arm_neon_vld2dup:
14160 case Intrinsic::arm_neon_vld3dup:
14161 case Intrinsic::arm_neon_vld4dup: {
14170 Info.
align = cast<ConstantInt>(AlignArg)->getZExtValue();
14175 case Intrinsic::arm_neon_vld1x2:
14176 case Intrinsic::arm_neon_vld1x3:
14177 case Intrinsic::arm_neon_vld1x4: {
14190 case Intrinsic::arm_neon_vst1:
14191 case Intrinsic::arm_neon_vst2:
14192 case Intrinsic::arm_neon_vst3:
14193 case Intrinsic::arm_neon_vst4:
14194 case Intrinsic::arm_neon_vst2lane:
14195 case Intrinsic::arm_neon_vst3lane:
14196 case Intrinsic::arm_neon_vst4lane: {
14200 unsigned NumElts = 0;
14205 NumElts += DL.getTypeSizeInBits(ArgTy) / 64;
14211 Info.
align = cast<ConstantInt>(AlignArg)->getZExtValue();
14216 case Intrinsic::arm_neon_vst1x2:
14217 case Intrinsic::arm_neon_vst1x3:
14218 case Intrinsic::arm_neon_vst1x4: {
14222 unsigned NumElts = 0;
14227 NumElts += DL.getTypeSizeInBits(ArgTy) / 64;
14237 case Intrinsic::arm_ldaex:
14238 case Intrinsic::arm_ldrex: {
14249 case Intrinsic::arm_stlex:
14250 case Intrinsic::arm_strex: {
14261 case Intrinsic::arm_stlexd:
14262 case Intrinsic::arm_strexd:
14271 case Intrinsic::arm_ldaexd:
14272 case Intrinsic::arm_ldrexd:
14295 if (Bits == 0 || Bits > 32)
14301 unsigned Index)
const {
14387 return (Size == 64) && !Subtarget->
isMClass();
14410 return (Size <= (Subtarget->
isMClass() ? 32U : 64U) && hasAtomicRMW)
14422 bool hasAtomicCmpXchg =
14429 return InsertFencesForAtomic;
14438 unsigned &Cost)
const {
14452 if (!isa<ConstantInt>(Idx))
14456 unsigned BitWidth = cast<VectorType>(VectorTy)->
getBitWidth();
14459 if (BitWidth == 64 || BitWidth == 128) {
14477 Type *ValTy = cast<PointerType>(Addr->
getType())->getElementType();
14485 IsAcquire ? Intrinsic::arm_ldaexd : Intrinsic::arm_ldrexd;
14502 Intrinsic::ID Int = IsAcquire ? Intrinsic::arm_ldaex : Intrinsic::arm_ldrex;
14507 cast<PointerType>(Addr->
getType())->getElementType());
14529 IsRelease ? Intrinsic::arm_stlexd : Intrinsic::arm_strexd;
14541 Intrinsic::ID Int = IsRelease ? Intrinsic::arm_stlex : Intrinsic::arm_strex;
14576 if (ElSize != 8 && ElSize != 16 && ElSize != 32)
14581 return VecSize == 64 || VecSize % 128 == 0;
14599 "Invalid interleave factor");
14600 assert(!Shuffles.
empty() &&
"Empty shufflevector input");
14602 "Unmatched number of shufflevectors and indices");
14628 if (NumLoads > 1) {
14632 VecTy->getVectorNumElements() / NumLoads);
14638 BaseAddr, VecTy->getVectorElementType()->getPointerTo(
14645 Type *Tys[] = {VecTy, Int8Ptr};
14646 static const Intrinsic::ID LoadInts[3] = {Intrinsic::arm_neon_vld2,
14647 Intrinsic::arm_neon_vld3,
14648 Intrinsic::arm_neon_vld4};
14657 for (
unsigned LoadCount = 0; LoadCount < NumLoads; ++LoadCount) {
14662 BaseAddr, VecTy->getVectorNumElements() * Factor);
14672 for (
unsigned i = 0; i < Shuffles.
size(); i++) {
14674 unsigned Index = Indices[i];
14684 SubVecs[SV].push_back(SubVec);
14693 auto &SubVec = SubVecs[SVI];
14696 SVI->replaceAllUsesWith(WideVec);
14730 unsigned Factor)
const {
14732 "Invalid interleave factor");
14736 "Invalid interleaved store");
14773 if (NumStores > 1) {
14776 LaneLen /= NumStores;
14792 Type *Tys[] = {Int8Ptr, SubVecTy};
14793 static const Intrinsic::ID StoreInts[3] = {Intrinsic::arm_neon_vst2,
14794 Intrinsic::arm_neon_vst3,
14795 Intrinsic::arm_neon_vst4};
14797 for (
unsigned StoreCount = 0; StoreCount < NumStores; ++StoreCount) {
14800 if (StoreCount > 0)
14810 for (
unsigned i = 0; i < Factor; i++) {
14811 unsigned IdxI = StoreCount * LaneLen * Factor + i;
14812 if (
Mask[IdxI] >= 0) {
14816 unsigned StartMask = 0;
14817 for (
unsigned j = 1; j < LaneLen; j++) {
14818 unsigned IdxJ = StoreCount * LaneLen * Factor + j;
14819 if (
Mask[IdxJ * Factor + IdxI] >= 0) {
14820 StartMask =
Mask[IdxJ * Factor + IdxI] - IdxJ;
14850 uint64_t &Members) {
14851 if (
auto *ST = dyn_cast<StructType>(Ty)) {
14852 for (
unsigned i = 0; i < ST->getNumElements(); ++i) {
14853 uint64_t SubMembers = 0;
14856 Members += SubMembers;
14858 }
else if (
auto *AT = dyn_cast<ArrayType>(Ty)) {
14859 uint64_t SubMembers = 0;
14862 Members += SubMembers * AT->getNumElements();
14873 }
else if (
auto *VT = dyn_cast<VectorType>(Ty)) {
14880 return VT->getBitWidth() == 64;
14882 return VT->getBitWidth() == 128;
14884 switch (VT->getBitWidth()) {
14897 return (Members > 0 && Members <= 4);
14917 if (getEffectiveCallingConv(CallConv, isVarArg) !=
14922 uint64_t Members = 0;
14927 return IsHA || IsIntArray;
14931 const Constant *PersonalityFn)
const {
14934 return Subtarget->
useSjLjEH() ? ARM::NoRegister : ARM::R0;
14938 const Constant *PersonalityFn)
const {
14941 return Subtarget->
useSjLjEH() ? ARM::NoRegister : ARM::R1;
14950 void ARMTargetLowering::insertCopiesSplitCSR(
14964 RC = &ARM::GPRRegClass;
14965 else if (ARM::DPRRegClass.
contains(*
I))
14966 RC = &ARM::DPRRegClass;
14977 Attribute::NoUnwind) &&
14978 "Function should be nounwind in insertCopiesSplitCSR!");
14984 for (
auto *Exit : Exits)
14986 TII->
get(TargetOpcode::COPY), *
I)
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 SDValue PerformIntrinsicCombine(SDNode *N, SelectionDAG &DAG)
PerformIntrinsicCombine - ARM-specific DAG combining for intrinsics.
static SDValue LowerEXTRACT_VECTOR_ELT(SDValue Op, SelectionDAG &DAG)
static bool isSimpleType(Type *T)
SDValue getStore(SDValue Chain, const SDLoc &dl, SDValue Val, SDValue Ptr, MachinePointerInfo PtrInfo, unsigned Alignment=0, MachineMemOperand::Flags MMOFlags=MachineMemOperand::MONone, const AAMDNodes &AAInfo=AAMDNodes())
Helper function to build ISD::STORE nodes.
static SDValue LowerAtomicLoadStore(SDValue Op, SelectionDAG &DAG)
std::pair< Value *, Value * > ShuffleOps
We are building a shuffle to create V, which is a sequence of insertelement, extractelement pairs...
static unsigned getBitWidth(Type *Ty, const DataLayout &DL)
Returns the bitwidth of the given scalar or pointer type.
bool isMachineConstantPoolEntry() const
Type * getVectorElementType() const
SDValue LowerOperation(SDValue Op, SelectionDAG &DAG) const override
This callback is invoked for operations that are unsupported by the target, which are registered to u...
void setFrameAddressIsTaken(bool T)
BITCAST - This operator converts between integer, vector and FP values, as if the value was stored to...
X = FP_ROUND(Y, TRUNC) - Rounding 'Y' from a larger floating point type down to the precision of the ...
Value * getValueOperand()
MO_DLLIMPORT - On a symbol operand, this represents that the reference to the symbol is for an import...
Synchronized with respect to signal handlers executing in the same thread.
static SDValue CombineVMOVDRRCandidateWithVecOp(const SDNode *BC, SelectionDAG &DAG)
BC is a bitcast that is about to be turned into a VMOVDRR.
unsigned getFirstUnallocated(ArrayRef< MCPhysReg > Regs) const
getFirstUnallocated - Return the index of the first unallocated register in the set, or Regs.size() if they are all allocated.
static MVT getIntegerVT(unsigned BitWidth)
void AnalyzeCallResult(const SmallVectorImpl< ISD::InputArg > &Ins, CCAssignFn Fn)
AnalyzeCallResult - Analyze the return values of a call, incorporating info about the passed values i...
void push_back(const T &Elt)
const MachineInstrBuilder & add(const MachineOperand &MO) const
static SDValue ConvertCarryFlagToBooleanCarry(SDValue Flags, EVT VT, SelectionDAG &DAG)
static SDValue LowerMUL(SDValue Op, SelectionDAG &DAG)
A parsed version of the target data layout string in and methods for querying it. ...
static bool isVZIPMask(ArrayRef< int > M, EVT VT, unsigned &WhichResult)
constexpr char Align[]
Key for Kernel::Arg::Metadata::mAlign.
bool isLegalT2ScaledAddressingMode(const AddrMode &AM, EVT VT) const
FMINNUM/FMAXNUM - Perform floating-point minimum or maximum on two values.
EVT getValueType() const
Return the ValueType of the referenced return value.
Function * getCalledFunction() const
Return the function called, or null if this is an indirect function invocation.
The MachineConstantPool class keeps track of constants referenced by a function which must be spilled...
This represents an addressing mode of: BaseGV + BaseOffs + BaseReg + Scale*ScaleReg If BaseGV is null...
bool isInteger() const
Return true if this is an integer or a vector integer type.
bool isTargetGNUAEABI() const
Value * CreateConstGEP1_32(Value *Ptr, unsigned Idx0, const Twine &Name="")
static SDValue AddCombineToVPADD(SDNode *N, SDValue N0, SDValue N1, TargetLowering::DAGCombinerInfo &DCI, const ARMSubtarget *Subtarget)
static GCMetadataPrinterRegistry::Add< ErlangGCPrinter > X("erlang", "erlang-compatible garbage collector")
void setLoadExtAction(unsigned ExtType, MVT ValVT, MVT MemVT, LegalizeAction Action)
Indicate that the specified load with extension does not work with the specified type and indicate wh...
void markGlobalAsPromotedToConstantPool(const GlobalVariable *GV)
Indicate to the backend that GV has had its storage changed to inside a constant pool.
void finalizeLowering(MachineFunction &MF) const override
Execute target specific actions to finalize target lowering.
static SDValue PerformBUILD_VECTORCombine(SDNode *N, TargetLowering::DAGCombinerInfo &DCI, const ARMSubtarget *Subtarget)
PerformBUILD_VECTORCombine - Target-specific dag combine xforms for ISD::BUILD_VECTOR.
bool hasCallSiteLandingPad(MCSymbol *Sym)
Return true if the landing pad Eh symbol has an associated call site.
static bool isConstant(const MachineInstr &MI)
static bool isVShiftLImm(SDValue Op, EVT VT, bool isLong, int64_t &Cnt)
isVShiftLImm - Check if this is a valid build_vector for the immediate operand of a vector shift left...
raw_ostream & errs()
This returns a reference to a raw_ostream for standard error.
static MachinePointerInfo getJumpTable(MachineFunction &MF)
Return a MachinePointerInfo record that refers to a jump table entry.
static const APInt * isPowerOf2Constant(SDValue V)
This SDNode is used for target intrinsics that touch memory and need an associated MachineMemOperand...
EVT getSetCCResultType(const DataLayout &DL, LLVMContext &Context, EVT VT) const override
getSetCCResultType - Return the value type to use for ISD::SETCC.
const GlobalValue * getGlobal() const
EXTRACT_ELEMENT - This is used to get the lower or upper (determined by a Constant, which is required to be operand #1) half of the integer or float value specified as operand #0.
uint64_t getZExtValue() const
Get zero extended value.
static void FPCCToARMCC(ISD::CondCode CC, ARMCC::CondCodes &CondCode, ARMCC::CondCodes &CondCode2, bool &InvalidOnQNaN)
FPCCToARMCC - Convert a DAG fp condition code to an ARM CC.
GCNRegPressure max(const GCNRegPressure &P1, const GCNRegPressure &P2)
static APInt getAllOnesValue(unsigned numBits)
Get the all-ones value.
unsigned getOpcode() const
Return the SelectionDAG opcode value for this node.
This class represents an incoming formal argument to a Function.
static bool isAddSubSExt(SDNode *N, SelectionDAG &DAG)
SDValue UnrollVectorOp(SDNode *N, unsigned ResNE=0)
Utility function used by legalize and lowering to "unroll" a vector operation by splitting out the sc...
MachineBasicBlock * getMBB() const
bool isOSMSVCRT() const
Is this a "Windows" OS targeting a "MSVCRT.dll" environment.
SDValue CombineTo(SDNode *N, ArrayRef< SDValue > To, bool AddTo=true)
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)...
unsigned getFunctionNumber() const
getFunctionNumber - Return a unique ID for the current function.
static ARMConstantPoolSymbol * Create(LLVMContext &C, StringRef s, unsigned ID, unsigned char PCAdj)
static SDValue WinDBZCheckDenominator(SelectionDAG &DAG, SDNode *N, SDValue InChain)
Atomic ordering constants.
int getFunctionContextIndex() const
Return the index for the function context object.
C - The default llvm calling convention, compatible with C.
bool isConstantSplat(APInt &SplatValue, APInt &SplatUndef, unsigned &SplatBitSize, bool &HasAnyUndefs, unsigned MinSplatBits=0, bool isBigEndian=false) const
Check if this is a constant splat, and if so, find the smallest element size that splats the vector...
static SDValue LowerSDIV(SDValue Op, SelectionDAG &DAG)
void AdjustInstrPostInstrSelection(MachineInstr &MI, SDNode *Node) const override
This method should be implemented by targets that mark instructions with the 'hasPostISelHook' flag...
EXTRACT_SUBVECTOR(VECTOR, IDX) - Returns a subvector from VECTOR (an vector value) starting with the ...
LLVM_ATTRIBUTE_NORETURN void report_fatal_error(Error Err, bool gen_crash_diag=true)
Report a serious error, calling any installed error handler.
BR_CC - Conditional branch.
Compute iterated dominance frontiers using a linear time algorithm.
static SDValue PerformVMULCombine(SDNode *N, TargetLowering::DAGCombinerInfo &DCI, const ARMSubtarget *Subtarget)
PerformVMULCombine Distribute (A + B) * C to (A * C) + (B * C) to take advantage of the special multi...
static SDValue LowerATOMIC_FENCE(SDValue Op, SelectionDAG &DAG, const ARMSubtarget *Subtarget)
bool hasDivideInThumbMode() const
static SDValue LowerReverse_VECTOR_SHUFFLEv16i8_v8i16(SDValue Op, SelectionDAG &DAG)
std::pair< unsigned, const TargetRegisterClass * > RCPair
Type * getParamType(unsigned i) const
Parameter type accessors.
const unsigned char * bytes_end() const
int getFP16Imm(const APInt &Imm)
getFP16Imm - Return an 8-bit floating-point version of the 16-bit floating-point value.
static MVT getVectorVT(MVT VT, unsigned NumElements)
static bool IsVUZPShuffleNode(SDNode *N)
TOF
Target Operand Flag enum.
bool hasVAStart() const
Returns true if the function calls the llvm.va_start intrinsic.
StringRef getPrivateGlobalPrefix() const
VECTOR_SHUFFLE(VEC1, VEC2) - Returns a vector, of the same type as VEC1/VEC2.
EVT getScalarType() const
If this is a vector type, return the element type, otherwise return this.
static void ExpandREAD_REGISTER(SDNode *N, SmallVectorImpl< SDValue > &Results, SelectionDAG &DAG)
MCSymbol - Instances of this class represent a symbol name in the MC file, and MCSymbols are created ...
LLVM_NODISCARD bool equals_lower(StringRef RHS) const
equals_lower - Check for string equality, ignoring case.
unsigned EnableFastISel
EnableFastISel - This flag enables fast-path instruction selection which trades away generated code q...
A Module instance is used to store all the information related to an LLVM module. ...
const char * LowerXConstraint(EVT ConstraintVT) const override
Try to replace an X constraint, which matches anything, with another that has more specific requireme...
static SDValue PerformADDECombine(SDNode *N, TargetLowering::DAGCombinerInfo &DCI, const ARMSubtarget *Subtarget)
PerformADDECombine - Target-specific dag combine transform from ARMISD::ADDC, ARMISD::ADDE, and ISD::MUL_LOHI to MLAL or ARMISD::ADDC, ARMISD::ADDE and ARMISD::UMLAL to ARMISD::UMAAL.
void setIsEHPad(bool V=true)
Indicates the block is a landing pad.
unsigned getNumInterleavedAccesses(VectorType *VecTy, const DataLayout &DL) const
Returns the number of interleaved accesses that will be generated when lowering accesses of the given...
Instruction * emitTrailingFence(IRBuilder<> &Builder, Instruction *Inst, AtomicOrdering Ord) const override
bool isOSBinFormatELF() const
Tests whether the OS uses the ELF binary format.
an instruction that atomically checks whether a specified value is in a memory location, and, if it is, stores a new value there.
int getSplatIndex() const
Sched::Preference getSchedulingPreference() const
Return target scheduling preference.
static SDValue lowerCTPOP32BitElements(SDNode *N, SelectionDAG &DAG)
lowerCTPOP32BitElements - Returns a v2i32/v4i32 vector containing the bit-count for each 32-bit eleme...
const SDValue & getBasePtr() const
static SDValue PerformInsertEltCombine(SDNode *N, TargetLowering::DAGCombinerInfo &DCI)
PerformInsertEltCombine - Target-specific dag combine xforms for ISD::INSERT_VECTOR_ELT.
EABI EABIVersion
EABIVersion - This flag specifies the EABI version.
static bool isVTRNMask(ArrayRef< int > M, EVT VT, unsigned &WhichResult)
ARM_AAPCS - ARM Architecture Procedure Calling Standard calling convention (aka EABI).
static SDValue SkipLoadExtensionForVMULL(LoadSDNode *LD, SelectionDAG &DAG)
SkipLoadExtensionForVMULL - return a load of the original vector size that does not do any sign/zero ...
EVT getValueType(unsigned ResNo) const
Return the type of a specified result.
virtual void LowerAsmOperandForConstraint(SDValue Op, std::string &Constraint, std::vector< SDValue > &Ops, SelectionDAG &DAG) const
Lower the specified operand into the Ops vector.
const DebugLoc & getDebugLoc() const
Returns the debug location id of this MachineInstr.
SDValue PerformCMOVCombine(SDNode *N, SelectionDAG &DAG) const
PerformCMOVCombine - Target-specific DAG combining for ARMISD::CMOV.
ARMConstantPoolValue - ARM specific constantpool value.
static bool isExtendedBUILD_VECTOR(SDNode *N, SelectionDAG &DAG, bool isSigned)
isExtendedBUILD_VECTOR - Check if N is a constant BUILD_VECTOR where each element has been zero/sign-...
unsigned addLiveIn(unsigned PReg, const TargetRegisterClass *RC)
addLiveIn - Add the specified physical register as a live-in value and create a corresponding virtual...
void AnalyzeFormalArguments(const SmallVectorImpl< ISD::InputArg > &Ins, CCAssignFn Fn)
AnalyzeFormalArguments - Analyze an array of argument values, incorporating info about the formals in...
void setIsDef(bool Val=true)
Change a def to a use, or a use to a def.
Describe properties that are true of each instruction in the target description file.
unsigned getReg() const
getReg - Returns the register number.
LLVM_NODISCARD LLVM_ATTRIBUTE_ALWAYS_INLINE size_t size() const
size - Get the string size.
void emitAtomicCmpXchgNoStoreLLBalance(IRBuilder<> &Builder) const override
static bool isHomogeneousAggregate(Type *Ty, HABaseType &Base, uint64_t &Members)
bool getPreIndexedAddressParts(SDNode *N, SDValue &Base, SDValue &Offset, ISD::MemIndexedMode &AM, SelectionDAG &DAG) const override
getPreIndexedAddressParts - returns true by value, base pointer and offset pointer and addressing mod...
MachineMemOperand::Flags flags
Y = RRC X, rotate right via carry.
static bool isVirtualRegister(unsigned Reg)
Return true if the specified register number is in the virtual register namespace.
bool getTgtMemIntrinsic(IntrinsicInfo &Info, const CallInst &I, MachineFunction &MF, unsigned Intrinsic) const override
getTgtMemIntrinsic - Represent NEON load and store intrinsics as MemIntrinsicNodes.
static bool hasNormalLoadOperand(SDNode *N)
hasNormalLoadOperand - Check if any of the operands of a BUILD_VECTOR node are normal, non-volatile loads.
const SDValue & getValue() const
void transferSuccessorsAndUpdatePHIs(MachineBasicBlock *FromMBB)
Transfers all the successors, as in transferSuccessors, and update PHI operands in the successor bloc...
bool isLegalT1ScaledAddressingMode(const AddrMode &AM, EVT VT) const
Returns true if the addresing mode representing by AM is legal for the Thumb1 target, for a load/store of the specified type.
STACKRESTORE has two operands, an input chain and a pointer to restore to it returns an output chain...
SDVTList getVTList() const
unsigned getABIAlignmentForCallingConv(Type *ArgTy, DataLayout DL) const override
Return the correct alignment for the current calling convention.
This class represents a function call, abstracting a target machine's calling convention.
EK_Inline - Jump table entries are emitted inline at their point of use.
static APInt getLowBitsSet(unsigned numBits, unsigned loBitsSet)
Get a value with low bits set.
MVT getSimpleVT() const
Return the SimpleValueType held in the specified simple EVT.
Libcall
RTLIB::Libcall enum - This enum defines all of the runtime library calls the backend can emit...
Global Offset Table, Thread Pointer Offset.
bool CCAssignFn(unsigned ValNo, MVT ValVT, MVT LocVT, CCValAssign::LocInfo LocInfo, ISD::ArgFlagsTy ArgFlags, CCState &State)
CCAssignFn - This function assigns a location for Val, updating State to reflect the change...
static unsigned SelectPairHalf(unsigned Elements, ArrayRef< int > Mask, unsigned Index)
static MVT getFloatingPointVT(unsigned BitWidth)
AAMDNodes getAAInfo() const
Returns the AA info that describes the dereference.
RESULT, BOOL = [SU]ADDO(LHS, RHS) - Overflow-aware nodes for addition.
const std::string & getAsmString() const
const SDValue & getChain() const
static bool isLegalT1AddressImmediate(int64_t V, EVT VT)
static cl::opt< bool > ARMInterworking("arm-interworking", cl::Hidden, cl::desc("Enable / disable ARM interworking (for debugging only)"), cl::init(true))
Function Alias Analysis Results
This instruction constructs a fixed permutation of two input vectors.
bool isTargetCOFF() const
unsigned getValNo() const
CCAssignFn * CCAssignFnForCall(CallingConv::ID CC, bool isVarArg) const
unsigned getAlignment() const
int getFP64Imm(const APInt &Imm)
getFP64Imm - Return an 8-bit floating-point version of the 64-bit floating-point value.
static SDValue SkipExtensionForVMULL(SDNode *N, SelectionDAG &DAG)
SkipExtensionForVMULL - For a node that is a SIGN_EXTEND, ZERO_EXTEND, extending load, or BUILD_VECTOR with extended elements, return the unextended value.
bool hasFnAttribute(Attribute::AttrKind Kind) const
Return true if the function has the attribute.
static SDValue IsSingleInstrConstant(SDValue N, SelectionDAG &DAG, const ARMSubtarget *ST, const SDLoc &dl)
virtual std::pair< unsigned, const TargetRegisterClass * > getRegForInlineAsmConstraint(const TargetRegisterInfo *TRI, StringRef Constraint, MVT VT) const
Given a physical register constraint (e.g.
auto count_if(R &&Range, UnaryPredicate P) -> typename std::iterator_traits< decltype(adl_begin(Range))>::difference_type
Wrapper function around std::count_if to count the number of times an element satisfying a given pred...
MO_GOT - On a symbol operand, this represents a GOT relative relocation.
void setBooleanVectorContents(BooleanContent Ty)
Specify how the target extends the result of a vector boolean value from a vector of i1 to a wider ty...
bool hasDLLImportStorageClass() const
bool all_of(R &&range, UnaryPredicate P)
Provide wrappers to std::all_of which take ranges instead of having to pass begin/end explicitly...
APInt trunc(unsigned width) const
Truncate to new width.
virtual const TargetRegisterClass * getRegClassFor(MVT VT) const
Return the register class that should be used for the specified value type.
STATISTIC(NumFunctions, "Total number of functions")
unsigned const TargetRegisterInfo * TRI
static SDValue combineSelectAndUseCommutative(SDNode *N, bool AllOnes, TargetLowering::DAGCombinerInfo &DCI)
void setIsDead(bool Val=true)
MVT getSimpleValueType(unsigned ResNo) const
Return the type of a specified result as a simple type.
bool isInteger() const
Return true if this is an integer or a vector integer type.
CallLoweringInfo & setDebugLoc(const SDLoc &dl)
An instruction for reading from memory.
static SDValue PerformADDCombineWithOperands(SDNode *N, SDValue N0, SDValue N1, TargetLowering::DAGCombinerInfo &DCI, const ARMSubtarget *Subtarget)
PerformADDCombineWithOperands - Try DAG combinations for an ADD with operands N0 and N1...
bool isThumb1Only() const
static IntegerType * getInt64Ty(LLVMContext &C)
void softenSetCCOperands(SelectionDAG &DAG, EVT VT, SDValue &NewLHS, SDValue &NewRHS, ISD::CondCode &CCCode, const SDLoc &DL) const
Soften the operands of a comparison.
bool hasExternalWeakLinkage() const
bool isTargetMuslAEABI() const
[US]{MIN/MAX} - Binary minimum or maximum or signed or unsigned integers.
const SDNodeFlags getFlags() const
an instruction that atomically reads a memory location, combines it with another value, and then stores the result back.
SDNode * getNode() const
get the SDNode which holds the desired result
SDValue getTargetExternalSymbol(const char *Sym, EVT VT, unsigned char TargetFlags=0)
unsigned createNEONModImm(unsigned OpCmode, unsigned Val)
SDValue getNode(unsigned Opcode, const SDLoc &DL, EVT VT, ArrayRef< SDUse > Ops)
Gets or creates the specified node.
bool isVectorTy() const
True if this is an instance of VectorType.
static SDValue PerformExtendCombine(SDNode *N, SelectionDAG &DAG, const ARMSubtarget *ST)
PerformExtendCombine - Target-specific DAG combining for ISD::SIGN_EXTEND, ISD::ZERO_EXTEND, and ISD::ANY_EXTEND.
AtomicExpansionKind
Enum that specifies what an atomic load/AtomicRMWInst is expanded to, if at all.
Global Offset Table, PC Relative.
Value * CallOperandVal
If this is the result output operand or a clobber, this is null, otherwise it is the incoming operand...
bool isOperationLegalOrCustom(unsigned Op, EVT VT) const
Return true if the specified operation is legal on this target or can be made legal with custom lower...
static IntegerType * getInt16Ty(LLVMContext &C)
FastISel * createFastISel(FunctionLoweringInfo &funcInfo, const TargetLibraryInfo *libInfo) const override
createFastISel - This method returns a target specific FastISel object, or null if the target does no...
MachineMemOperand * getMemOperand() const
Return a MachineMemOperand object describing the memory reference performed by operation.
static SDValue PerformANDCombine(SDNode *N, TargetLowering::DAGCombinerInfo &DCI, const ARMSubtarget *Subtarget)
static SDValue CombineBaseUpdate(SDNode *N, TargetLowering::DAGCombinerInfo &DCI)
CombineBaseUpdate - Target-specific DAG combine function for VLDDUP, NEON load/store intrinsics...
bool isDesirableToTransformToIntegerOp(unsigned Opc, EVT VT) const override
Return true if it is profitable for dag combiner to transform a floating point op of specified opcode...
static SDValue PerformSUBCombine(SDNode *N, TargetLowering::DAGCombinerInfo &DCI)
PerformSUBCombine - Target-specific dag combine xforms for ISD::SUB.
bool allowTruncateForTailCall(Type *Ty1, Type *Ty2) const override
Return true if a truncation from FromTy to ToTy is permitted when deciding whether a call is in tail ...
unsigned getBitWidth() const
Get the bit width of this value.
std::size_t countLeadingZeros(T Val, ZeroBehavior ZB=ZB_Width)
Count number of 0's from the most significant bit to the least stopping at the first 1...
virtual SDValue LowerToTLSEmulatedModel(const GlobalAddressSDNode *GA, SelectionDAG &DAG) const
Lower TLS global address SDNode for target independent emulated TLS model.
bool lowerInterleavedLoad(LoadInst *LI, ArrayRef< ShuffleVectorInst *> Shuffles, ArrayRef< unsigned > Indices, unsigned Factor) const override
Lower an interleaved load into a vldN intrinsic.
bool isTargetHardFloat() const
uint64_t decodeNEONModImm(unsigned ModImm, unsigned &EltBits)
decodeNEONModImm - Decode a NEON modified immediate value into the element value and the element size...
ARM_APCS - ARM Procedure Calling Standard calling convention (obsolete, but still used on some target...
unsigned getValueSizeInBits() const
Returns the size of the value in bits.
constexpr bool isMask_32(uint32_t Value)
Return true if the argument is a non-empty sequence of ones starting at the least significant bit wit...
static bool isThumb(const MCSubtargetInfo &STI)
unsigned createPICLabelUId()
OUTCHAIN = ATOMIC_FENCE(INCHAIN, ordering, scope) This corresponds to the fence instruction.
Select with condition operator - This selects between a true value and a false value (ops #2 and #3) ...
bool hasOneUse() const
Return true if there is exactly one node using value ResNo of Node.
Libcall getFPROUND(EVT OpVT, EVT RetVT)
getFPROUND - Return the FPROUND_*_* value for the given types, or UNKNOWN_LIBCALL if there is none...
INT = FGETSIGN(FP) - Return the sign bit of the specified floating point value as an integer 0/1 valu...
static bool allUsersAreInFunction(const Value *V, const Function *F)
Return true if all users of V are within function F, looking through ConstantExprs.
unsigned getBitWidth() const
Return the number of bits in the APInt.
This SDNode is used to implement the code generator support for the llvm IR shufflevector instruction...
SDValue getExternalSymbol(const char *Sym, EVT VT)
return AArch64::GPR64RegClass contains(Reg)
static MachineOperand CreateReg(unsigned Reg, bool isDef, bool isImp=false, bool isKill=false, bool isDead=false, bool isUndef=false, bool isEarlyClobber=false, unsigned SubReg=0, bool isDebug=false, bool isInternalRead=false, bool isRenamable=false)
void setTruncStoreAction(MVT ValVT, MVT MemVT, LegalizeAction Action)
Indicate that the specified truncating store does not work with the specified type and indicate what ...
LLVMContext & getContext() const
Return the LLVMContext in which this type was uniqued.
RESULT,OUTCHAIN = INTRINSIC_W_CHAIN(INCHAIN, INTRINSICID, arg1, ...) This node represents a target in...
bool isTruncatingStore() const
Return true if the op does a truncation before store.
bool lowerInterleavedStore(StoreInst *SI, ShuffleVectorInst *SVI, unsigned Factor) const override
Lower an interleaved store into a vstN intrinsic.
MachineJumpTableInfo * getOrCreateJumpTableInfo(unsigned JTEntryKind)
getOrCreateJumpTableInfo - Get the JumpTableInfo for this function, if it does already exist...
bool genExecuteOnly() const
Libcall getUINTTOFP(EVT OpVT, EVT RetVT)
getUINTTOFP - Return the UINTTOFP_*_* value for the given types, or UNKNOWN_LIBCALL if there is none...
static SDValue LowerCONCAT_VECTORS(SDValue Op, SelectionDAG &DAG)
const ARMBaseInstrInfo * getInstrInfo() const override
bool hasV8MBaselineOps() const
OUTCHAIN = EH_SJLJ_LONGJMP(INCHAIN, buffer) This corresponds to the eh.sjlj.longjmp intrinsic...
bool hasStructRetAttr() const
Determine if the function returns a structure through first or second pointer argument.
SDIVREM/UDIVREM - Divide two integers and produce both a quotient and remainder result.
bool isFloatingPoint() const
Return true if this is a FP or a vector FP type.
std::pair< iterator, bool > insert(const std::pair< KeyT, ValueT > &KV)
SHL_PARTS/SRA_PARTS/SRL_PARTS - These operators are used for expanded integer shift operations...
unsigned countTrailingZeros() const
Count the number of trailing zero bits.
static GCMetadataPrinterRegistry::Add< OcamlGCMetadataPrinter > Y("ocaml", "ocaml 3.10-compatible collector")
SDValue getIntPtrConstant(uint64_t Val, const SDLoc &DL, bool isTarget=false)
The address of a basic block.
bool isSEXTLoad(const SDNode *N)
Returns true if the specified node is a SEXTLOAD.
void LowerAsmOperandForConstraint(SDValue Op, std::string &Constraint, std::vector< SDValue > &Ops, SelectionDAG &DAG) const override
LowerAsmOperandForConstraint - Lower the specified operand into the Ops vector.
const MCPhysReg * getCalleeSavedRegs(const MachineFunction *MF) const override
Code Generation virtual methods...
bool hasOneUse() const
Return true if there is exactly one use of this node.
bool isOffsetFoldingLegal(const GlobalAddressSDNode *GA) const override
Return true if folding a constant offset with the given GlobalAddress is legal.
bool isBeforeLegalize() const
static bool isFloatingPointZero(SDValue Op)
isFloatingPointZero - Return true if this is +0.0.
bool isLegalInterleavedAccessType(VectorType *VecTy, const DataLayout &DL) const
Returns true if VecTy is a legal interleaved access type.
A description of a memory reference used in the backend.
MO_SBREL - On a symbol operand, this represents a static base relative relocation.
instr_iterator erase(instr_iterator I)
Remove an instruction from the instruction list and delete it.
This file declares the MachineConstantPool class which is an abstract constant pool to keep track of ...
const DataLayout & getDataLayout() const
Get the data layout for the module's target platform.
static SDValue PerformLOADCombine(SDNode *N, TargetLowering::DAGCombinerInfo &DCI)
Twine - A lightweight data structure for efficiently representing the concatenation of temporary valu...
unsigned getNumOperands() const
Return the number of declared MachineOperands for this MachineInstruction.
const HexagonInstrInfo * TII
SDValue PerformDAGCombine(SDNode *N, DAGCombinerInfo &DCI) const override
This method will be invoked for all target nodes and for any target-independent nodes that the target...
static bool CombineVLDDUP(SDNode *N, TargetLowering::DAGCombinerInfo &DCI)
CombineVLDDUP - For a VDUPLANE node N, check if its source operand is a vldN-lane (N > 1) intrinsic...
ArrayRef< T > makeArrayRef(const T &OneElt)
Construct an ArrayRef from a single element.
bool isFloatingPointTy() const
Return true if this is one of the six floating-point types.
Shift and rotation operations.
static bool isVUZPMask(ArrayRef< int > M, EVT VT, unsigned &WhichResult)
unsigned getNumOperands() const
Access to explicit operands of the instruction.
static bool isUpperSaturate(const SDValue LHS, const SDValue RHS, const SDValue TrueVal, const SDValue FalseVal, const ISD::CondCode CC, const SDValue K)
bool isNormalStore(const SDNode *N)
Returns true if the specified node is a non-truncating and unindexed store.
Type * getTypeForEVT(LLVMContext &Context) const
This method returns an LLVM type corresponding to the specified EVT.
std::size_t countTrailingOnes(T Value, ZeroBehavior ZB=ZB_Width)
Count the number of ones from the least significant bit to the first zero bit.
LLVMContext & getContext() const
Get the global data context.
bool isBuildVectorAllZeros(const SDNode *N)
Return true if the specified node is a BUILD_VECTOR where all of the elements are 0 or undef...
ABS - Determine the unsigned absolute value of a signed integer value of the same bitwidth...
A Use represents the edge between a Value definition and its users.
static SDValue findMUL_LOHI(SDValue V)
const TargetMachine & getTarget() const
getTarget - Return the target machine this machine code is compiled with
static bool isVREVMask(ArrayRef< int > M, EVT VT, unsigned BlockSize)
isVREVMask - Check if a vector shuffle corresponds to a VREV instruction with the specified blocksize...
SDValue getTargetExtractSubreg(int SRIdx, const SDLoc &DL, EVT VT, SDValue Operand)
A convenience function for creating TargetInstrInfo::EXTRACT_SUBREG nodes.
MachineSDNode * getMachineNode(unsigned Opcode, const SDLoc &dl, EVT VT)
These are used for target selectors to create a new node with specified return type(s), MachineInstr opcode, and operands.
static bool isVZIP_v_undef_Mask(ArrayRef< int > M, EVT VT, unsigned &WhichResult)
isVZIP_v_undef_Mask - Special case of isVZIPMask for canonical form of "vector_shuffle v...
PointerType * getPointerTo(unsigned AddrSpace=0) const
Return a pointer to the current type.
Value * emitStoreConditional(IRBuilder<> &Builder, Value *Val, Value *Addr, AtomicOrdering Ord) const override
Perform a store-conditional operation to Addr.
unsigned getFrameRegister(const MachineFunction &MF) const override
CallLoweringInfo & setChain(SDValue InChain)
BUILD_PAIR - This is the opposite of EXTRACT_ELEMENT in some ways.
static SDValue PerformVECTOR_SHUFFLECombine(SDNode *N, SelectionDAG &DAG)
PerformVECTOR_SHUFFLECombine - Target-specific dag combine xforms for ISD::VECTOR_SHUFFLE.
This class consists of common code factored out of the SmallVector class to reduce code duplication b...
separate const offset from Split GEPs to a variadic base and a constant offset for better CSE
void eraseFromParent()
Unlink 'this' from the containing basic block and delete it.
CopyToReg - This node has three operands: a chain, a register number to set to this value...
bool isIntegerTy() const
True if this is an instance of IntegerType.
This provides a uniform API for creating instructions and inserting them into a basic block: either a...
unsigned getScalarValueSizeInBits() const
int64_t getObjectOffset(int ObjectIdx) const
Return the assigned stack offset of the specified object from the incoming stack pointer.
ISD::LoadExtType getExtensionType() const
Return whether this is a plain node, or one of the varieties of value-extending loads.
FLT_ROUNDS_ - Returns current rounding mode: -1 Undefined 0 Round to 0 1 Round to nearest 2 Round to ...
bool isZEXTLoad(const SDNode *N)
Returns true if the specified node is a ZEXTLOAD.
EVT getOptimalMemOpType(uint64_t Size, unsigned DstAlign, unsigned SrcAlign, bool IsMemset, bool ZeroMemset, bool MemcpyStrSrc, MachineFunction &MF) const override
Returns the target specific optimal type for load and store operations as a result of memset...
This file contains the simple types necessary to represent the attributes associated with functions a...
static SDValue getZeroVector(EVT VT, SelectionDAG &DAG, const SDLoc &dl)
getZeroVector - Returns a vector of specified type with all zero elements.
unsigned getStoreSize() const
Return the number of bytes overwritten by a store of the specified value type.
The memory access is dereferenceable (i.e., doesn't trap).
The MachineFrameInfo class represents an abstract stack frame until prolog/epilog code is inserted...
Val, OUTCHAIN = ATOMIC_SWAP(INCHAIN, ptr, amt) Val, OUTCHAIN = ATOMIC_LOAD_[OpName](INCHAIN, ptr, amt) For double-word atomic operations: ValLo, ValHi, OUTCHAIN = ATOMIC_SWAP(INCHAIN, ptr, amtLo, amtHi) ValLo, ValHi, OUTCHAIN = ATOMIC_LOAD_[OpName](INCHAIN, ptr, amtLo, amtHi) These correspond to the atomicrmw instruction.
unsigned getOpcode() const
Returns the opcode of this MachineInstr.
SDValue getEntryNode() const
Return the token chain corresponding to the entry of the function.
void setOperationAction(unsigned Op, MVT VT, LegalizeAction Action)
Indicate that the specified operation does not work with the specified type and indicate what to do a...
void ReplaceNodeResults(SDNode *N, SmallVectorImpl< SDValue > &Results, SelectionDAG &DAG) const override
ReplaceNodeResults - Replace the results of node with an illegal result type with new values built ou...
static bool isSingletonVEXTMask(ArrayRef< int > M, EVT VT, unsigned &Imm)
const DataLayout & getDataLayout() const
SDVTList getVTList(EVT VT)
Return an SDVTList that represents the list of values specified.
static bool isZeroExtended(SDNode *N, SelectionDAG &DAG)
isZeroExtended - Check if a node is a vector value that is zero-extended or a constant BUILD_VECTOR w...
static ShiftOpc getShiftOpcForNode(unsigned Opcode)
static bool isVShiftRImm(SDValue Op, EVT VT, bool isNarrow, bool isIntrinsic, int64_t &Cnt)
isVShiftRImm - Check if this is a valid build_vector for the immediate operand of a vector shift righ...
FRAMEADDR, RETURNADDR - These nodes represent llvm.frameaddress and llvm.returnaddress on the DAG...
LLVM_NODISCARD LLVM_ATTRIBUTE_ALWAYS_INLINE R Default(T Value)
uint64_t getNumElements() const
MachineMemOperand * getMachineMemOperand(MachinePointerInfo PtrInfo, MachineMemOperand::Flags f, uint64_t s, unsigned 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.
SmallVectorImpl< unsigned > & getCallSiteLandingPad(MCSymbol *Sym)
Get the call site indexes for a landing pad EH symbol.
LocInfo getLocInfo() const
static SDValue PerformMULCombine(SDNode *N, TargetLowering::DAGCombinerInfo &DCI, const ARMSubtarget *Subtarget)
void lshrInPlace(unsigned ShiftAmt)
Logical right-shift this APInt by ShiftAmt in place.
This class defines information used to lower LLVM code to legal SelectionDAG operators that the targe...
static StructType * get(LLVMContext &Context, ArrayRef< Type *> Elements, bool isPacked=false)
This static method is the primary way to create a literal StructType.
This file implements a class to represent arbitrary precision integral constant values and operations...
void SplitString(StringRef Source, SmallVectorImpl< StringRef > &OutFragments, StringRef Delimiters=" \\\)
SplitString - Split up the specified string according to the specified delimiters, appending the result fragments to the output list.
static unsigned getStOpcode(unsigned StSize, bool IsThumb1, bool IsThumb2)
Return the store opcode for a given store size.
unsigned getArgRegsSaveSize() const
This represents a list of ValueType's that has been intern'd by a SelectionDAG.
SDValue getExtLoad(ISD::LoadExtType ExtType, const SDLoc &dl, EVT VT, SDValue Chain, SDValue Ptr, MachinePointerInfo PtrInfo, EVT MemVT, unsigned Alignment=0, MachineMemOperand::Flags MMOFlags=MachineMemOperand::MONone, const AAMDNodes &AAInfo=AAMDNodes())
bool getPostIndexedAddressParts(SDNode *N, SDNode *Op, SDValue &Base, SDValue &Offset, ISD::MemIndexedMode &AM, SelectionDAG &DAG) const override
getPostIndexedAddressParts - returns true by value, base pointer and offset pointer and addressing mo...
bool isGVIndirectSymbol(const GlobalValue *GV) const
True if the GV will be accessed via an indirect symbol.
SmallVector< ISD::InputArg, 32 > Ins
AtomicOrdering
Atomic ordering for LLVM's memory model.
static SDValue AddCombineTo64bitMLAL(SDNode *AddeSubeNode, TargetLowering::DAGCombinerInfo &DCI, const ARMSubtarget *Subtarget)
STACKSAVE - STACKSAVE has one operand, an input chain.
SDValue getMergeValues(ArrayRef< SDValue > Ops, const SDLoc &dl)
Create a MERGE_VALUES node from the given operands.
bool canCombineStoreAndExtract(Type *VectorTy, Value *Idx, unsigned &Cost) const override
Return true if the target can combine store(extractelement VectorTy, Idx).
unsigned getSizeInBits() const
MachineInstr * getVRegDef(unsigned Reg) const
getVRegDef - Return the machine instr that defines the specified virtual register or null if none is ...
static const unsigned PerfectShuffleTable[6561+1]
Value * CreateIntToPtr(Value *V, Type *DestTy, const Twine &Name="")
static SDValue LowerINSERT_VECTOR_ELT(SDValue Op, SelectionDAG &DAG)
unsigned getActiveBits() const
Compute the number of active bits in the value.
int64_t getSExtValue() const
SDValue getSExtOrTrunc(SDValue Op, const SDLoc &DL, EVT VT)
Convert Op, which must be of integer type, to the integer type VT, by either sign-extending or trunca...
unsigned getPointerAddressSpace() const
Returns the address space of the pointer operand.
unsigned getScalarSizeInBits() const
This is a fast-path instruction selection class that generates poor code and doesn't support illegal ...
Value * emitLoadLinked(IRBuilder<> &Builder, Value *Addr, AtomicOrdering Ord) const override
Perform a load-linked operation on Addr, returning a "Value *" with the corresponding pointee type...
unsigned getSizeInBits() const
Return the size of the specified value type in bits.
unsigned getNextStackOffset() const
getNextStackOffset - Return the next stack offset such that all stack slots satisfy their alignment r...
Value * CreateBitCast(Value *V, Type *DestTy, const Twine &Name="")
int64_t getSExtValue() const
Get sign extended value.
const MCInstrDesc & getDesc() const
Returns the target instruction descriptor of this MachineInstr.
bool shouldConvertConstantLoadToIntImm(const APInt &Imm, Type *Ty) const override
Returns true if it is beneficial to convert a load of a constant to just the constant itself...
Constant * createSequentialMask(IRBuilder<> &Builder, unsigned Start, unsigned NumInts, unsigned NumUndefs)
Create a sequential shuffle mask.
Type * getType() const
All values are typed, get the type of this value.
MachineFunction & getMachineFunction() const
void computeRegisterProperties(const TargetRegisterInfo *TRI)
Once all of the register classes are added, this allows us to compute derived properties we expose...
[SU]INT_TO_FP - These operators convert integers (whose interpreted sign depends on the first letter)...
static std::array< MachineOperand, 2 > predOps(ARMCC::CondCodes Pred, unsigned PredReg=0)
Get the operands corresponding to the given Pred value.
OUTCHAIN = EH_SJLJ_SETUP_DISPATCH(INCHAIN) The target initializes the dispatch table here...
static SDValue LowerVECTOR_SHUFFLE(SDValue Op, SelectionDAG &DAG)
bool useMovt(const MachineFunction &MF) const
SDValue getRegisterMask(const uint32_t *RegMask)
const TargetMachine & getTarget() const
BasicBlock * GetInsertBlock() const
CallingConv::ID getLibcallCallingConv(RTLIB::Libcall Call) const
Get the CallingConv that should be used for the specified libcall.
static SDValue LowerVectorFP_TO_INT(SDValue Op, SelectionDAG &DAG)
Select with a vector condition (op #0) and two vector operands (ops #1 and #2), returning a vector re...
static bool isSRL16(const SDValue &Op)
This contains information for each constraint that we are lowering.
Simple integer binary arithmetic operators.
void addInRegsParamInfo(unsigned RegBegin, unsigned RegEnd)
static bool isStore(int Opcode)
SmallVector< ISD::OutputArg, 32 > Outs
bool useNEONForSinglePrecisionFP() const
ArrayRef - Represent a constant reference to an array (0 or more elements consecutively in memory)...
CallLoweringInfo & setZExtResult(bool Value=true)
bool isTargetDarwin() const
SDValue getUNDEF(EVT VT)
Return an UNDEF node. UNDEF does not have a useful SDLoc.
TLSModel::Model getTLSModel(const GlobalValue *GV) const
Returns the TLS model which should be used for the given global variable.
void setIsSplitCSR(bool s)
An instruction for storing to memory.
static mvt_range integer_vector_valuetypes()
CondCode
ISD::CondCode enum - These are ordered carefully to make the bitfields below work out...
op_iterator op_begin() const
unsigned getStackAlignment() const
Value * CreateZExt(Value *V, Type *DestTy, const Twine &Name="")
SDValue getTargetConstant(uint64_t Val, const SDLoc &DL, EVT VT, bool isOpaque=false)
READCYCLECOUNTER - This corresponds to the readcyclecounter intrinsic.
static SDValue ParseBFI(SDNode *N, APInt &ToMask, APInt &FromMask)
static Function * getFunction(Constant *C)
unsigned getBitWidth() const
Get the number of bits in this IntegerType.
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 isStrongerThanMonotonic(AtomicOrdering ao)
static SDValue LowerVSETCC(SDValue Op, SelectionDAG &DAG)
static const MCPhysReg GPRArgRegs[]
Value * CreateZExtOrBitCast(Value *V, Type *DestTy, const Twine &Name="")
amdgpu Simplify well known AMD library false Value * Callee
RESULT = INTRINSIC_WO_CHAIN(INTRINSICID, arg1, arg2, ...) This node represents a target intrinsic fun...
static SDValue PerformAddeSubeCombine(SDNode *N, TargetLowering::DAGCombinerInfo &DCI, const ARMSubtarget *Subtarget)
Function * getDeclaration(Module *M, ID id, ArrayRef< Type *> Tys=None)
Create or insert an LLVM Function declaration for an intrinsic, and return it.
int64_t getObjectSize(int ObjectIdx) const
Return the size of the specified object.
MachineBasicBlock * CreateMachineBasicBlock(const BasicBlock *bb=nullptr)
CreateMachineBasicBlock - Allocate a new MachineBasicBlock.
MVT getVectorElementType() const
Value * getOperand(unsigned i) const
const DataLayout & getDataLayout() const
Return the DataLayout attached to the Module associated to this MF.
static SDValue FindBFIToCombineWith(SDNode *N)
Class to represent pointers.
unsigned getByValSize() const
UNDEF - An undefined node.
This class is used to represent ISD::STORE nodes.
FP_TO_[US]INT - Convert a floating point value to a signed or unsigned integer.
bool isReadOnly(const GlobalValue *GV) const
uint16_t MCPhysReg
An unsigned integer type large enough to represent all physical registers, but not necessarily virtua...
static SDValue PerformVMOVDRRCombine(SDNode *N, SelectionDAG &DAG)
PerformVMOVDRRCombine - Target-specific dag combine xforms for ARMISD::VMOVDRR.
Flag
These should be considered private to the implementation of the MCInstrDesc class.
BUILD_VECTOR(ELT0, ELT1, ELT2, ELT3,...) - Return a vector with the specified, possibly variable...
unsigned getExceptionSelectorRegister(const Constant *PersonalityFn) const override
If a physical register, this returns the register that receives the exception typeid on entry to a la...
Value * CreateOr(Value *LHS, Value *RHS, const Twine &Name="")
TargetInstrInfo - Interface to description of machine instruction set.
bool isOneConstant(SDValue V)
Returns true if V is a constant integer one.
const uint32_t * getCallPreservedMask(const MachineFunction &MF, CallingConv::ID) const override
MVT getSimpleValueType() const
Return the simple ValueType of the referenced return value.
int getPromotedConstpoolIncrease() const
bool hasDivideInARMMode() const
AddrOpc getAM2Op(unsigned AM2Opc)
bool isTargetWatchABI() const
static APInt getHighBitsSet(unsigned numBits, unsigned hiBitsSet)
Get a value with high bits set.
bool bitsGT(EVT VT) const
Return true if this has more bits than VT.
unsigned ComputeNumSignBits(SDValue Op, unsigned Depth=0) const
Return the number of times the sign bit of the register is replicated into the other bits...
static void emitPostLd(MachineBasicBlock *BB, MachineBasicBlock::iterator Pos, const TargetInstrInfo *TII, const DebugLoc &dl, unsigned LdSize, unsigned Data, unsigned AddrIn, unsigned AddrOut, bool IsThumb1, bool IsThumb2)
Emit a post-increment load operation with given size.
static EVT getExtensionTo64Bits(const EVT &OrigVT)
bool useEmulatedTLS() const
Returns true if this target uses emulated TLS.
bool isOSWindows() const
Tests whether the OS is Windows.
bool isFloatTy() const
Return true if this is 'float', a 32-bit IEEE fp type.
The memory access is volatile.
void setReturnRegsCount(unsigned s)
constexpr uint64_t MinAlign(uint64_t A, uint64_t B)
A and B are either alignments or offsets.
unsigned getNumValues() const
Return the number of values defined/returned by this operator.
IntegerType * getIntPtrType(LLVMContext &C, unsigned AddressSpace=0) const
Returns an integer type with size at least as big as that of a pointer in the given address space...
MachineInstrBuilder BuildMI(MachineFunction &MF, const DebugLoc &DL, const MCInstrDesc &MCID)
Builder interface. Specify how to create the initial instruction itself.
unsigned getSchedClass() const
Return the scheduling class for this instruction.
static MDTuple * get(LLVMContext &Context, ArrayRef< Metadata *> MDs)
const SDValue & getBasePtr() const
A switch()-like statement whose cases are string literals.
static SDValue PerformADDCombine(SDNode *N, TargetLowering::DAGCombinerInfo &DCI, const ARMSubtarget *Subtarget)
PerformADDCombine - Target-specific dag combine xforms for ISD::ADD.
initializer< Ty > init(const Ty &Val)
bool isNormalLoad(const SDNode *N)
Returns true if the specified node is a non-extending and unindexed load.
SDValue getVectorShuffle(EVT VT, const SDLoc &dl, SDValue N1, SDValue N2, ArrayRef< int > Mask)
Return an ISD::VECTOR_SHUFFLE node.
Type * getReturnType() const
Returns the type of the ret val.
OUTCHAIN = INTRINSIC_VOID(INCHAIN, INTRINSICID, arg1, arg2, ...) This node represents a target intrin...
static SDValue PerformBFICombine(SDNode *N, TargetLowering::DAGCombinerInfo &DCI)
void addLiveIn(MCPhysReg PhysReg, LaneBitmask LaneMask=LaneBitmask::getAll())
Adds the specified register as a live in.
bool isAllOnesValue() const
Determine if all bits are set.
READ_REGISTER, WRITE_REGISTER - This node represents llvm.register on the DAG, which implements the n...
bool preferISHSTBarriers() const
static GCRegistry::Add< OcamlGC > B("ocaml", "ocaml 3.10-compatible GC")
int getVarArgsFrameIndex() const
CodeGenOpt::Level getOptLevel() const
Returns the optimization level: None, Less, Default, or Aggressive.
bool useSoftFloat() const override
unsigned const MachineRegisterInfo * MRI
static bool isSignExtended(SDNode *N, SelectionDAG &DAG)
isSignExtended - Check if a node is a vector value that is sign-extended or a constant BUILD_VECTOR w...
std::size_t countTrailingZeros(T Val, ZeroBehavior ZB=ZB_Width)
Count number of 0's from the least significant bit to the most stopping at the first 1...
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...
static bool getT2IndexedAddressParts(SDNode *Ptr, EVT VT, bool isSEXTLoad, SDValue &Base, SDValue &Offset, bool &isInc, SelectionDAG &DAG)
void computeKnownBitsForTargetNode(const SDValue Op, KnownBits &Known, const APInt &DemandedElts, const SelectionDAG &DAG, unsigned Depth) const override
Determine which of the bits specified in Mask are known to be either zero or one and return them in t...
unsigned countPopulation() const
Count the number of bits set.
const uint32_t * getThisReturnPreservedMask(const MachineFunction &MF, CallingConv::ID) const
getThisReturnPreservedMask - Returns a call preserved mask specific to the case that 'returned' is on...
bool shouldAssumeDSOLocal(const Module &M, const GlobalValue *GV) const
use_iterator use_begin() const
Provide iteration support to walk over all uses of an SDNode.
constexpr bool isPowerOf2_32(uint32_t Value)
Return true if the argument is a power of two > 0.
An array constant whose element type is a simple 1/2/4/8-byte integer or float/double, and whose elements are just simple data values (i.e.
static SDValue PerformVDIVCombine(SDNode *N, SelectionDAG &DAG, const ARMSubtarget *Subtarget)
PerformVDIVCombine - VCVT (fixed-point to floating-point, Advanced SIMD) can replace combinations of ...
Value * concatenateVectors(IRBuilder<> &Builder, ArrayRef< Value *> Vecs)
Concatenate a list of vectors.
static SDValue LowerVECTOR_SHUFFLEv8i8(SDValue Op, ArrayRef< int > ShuffleMask, SelectionDAG &DAG)
LLVM Basic Block Representation.
static SDValue combineSelectAndUse(SDNode *N, SDValue Slct, SDValue OtherOp, TargetLowering::DAGCombinerInfo &DCI, bool AllOnes=false)
bool isOptionalDef() const
Set if this operand is a optional def.
The instances of the Type class are immutable: once they are created, they are never changed...
static SDValue PerformVDUPCombine(SDNode *N, TargetLowering::DAGCombinerInfo &DCI)
PerformVDUPCombine - Target-specific dag combine xforms for ARMISD::VDUP.
bool shouldAlignPointerArgs(CallInst *CI, unsigned &MinSize, unsigned &PrefAlign) const override
Return true if the pointer arguments to CI should be aligned by aligning the object whose address is ...
This is an important class for using LLVM in a threaded context.
void addRegisterClass(MVT VT, const TargetRegisterClass *RC)
Add the specified register class as an available regclass for the specified value type...
CCAssignFn * CCAssignFnForReturn(CallingConv::ID CC, bool isVarArg) const
virtual ConstraintType getConstraintType(StringRef Constraint) const
Given a constraint, return the type of constraint it is for this target.
Simple binary floating point operators.
void setTargetDAGCombine(ISD::NodeType NT)
Targets should invoke this method for each target independent node that they want to provide a custom...
bool hasAnyUseOfValue(unsigned Value) const
Return true if there are any use of the indicated value.
bool isThumbImmShiftedVal(unsigned V)
isThumbImmShiftedVal - Return true if the specified value can be obtained by left shifting a 8-bit im...
MachineFrameInfo & getFrameInfo()
getFrameInfo - Return the frame info object for the current function.
unsigned getVectorNumElements() const
Given a vector type, return the number of elements it contains.
size_t size() const
size - Get the array size.
static GCRegistry::Add< CoreCLRGC > E("coreclr", "CoreCLR-compatible GC")
This is an important base class in LLVM.
void resetAll()
Resets the known state of all bits.
const char * getTargetNodeName(unsigned Opcode) const override
This method returns the name of a target specific DAG node.
VAEND, VASTART - VAEND and VASTART have three operands: an input chain, pointer, and a SRCVALUE...
LLVM_ATTRIBUTE_ALWAYS_INLINE iterator begin()
const SDValue & getOperand(unsigned Num) const
static SDValue LowerWRITE_REGISTER(SDValue Op, SelectionDAG &DAG)
INSERT_VECTOR_ELT(VECTOR, VAL, IDX) - Returns VECTOR with the element at IDX replaced with VAL...
This file contains the declarations for the subclasses of Constant, which represent the different fla...
static bool isSHL16(const SDValue &Op)
bool isFixedObjectIndex(int ObjectIdx) const
Returns true if the specified index corresponds to a fixed stack object.
bool isPointerTy() const
True if this is an instance of PointerType.
MachineBasicBlock * EmitInstrWithCustomInserter(MachineInstr &MI, MachineBasicBlock *MBB) const override
This method should be implemented by targets that mark instructions with the 'usesCustomInserter' fla...
static cl::opt< unsigned > ConstpoolPromotionMaxSize("arm-promote-constant-max-size", cl::Hidden, cl::desc("Maximum size of constant to promote into a constant pool"), cl::init(64))
static ManagedStatic< OptionRegistry > OR
bool isTargetWatchOS() const
ConstantFP - Floating Point Values [float, double].
std::pair< iterator, bool > insert(PtrType Ptr)
Inserts Ptr if and only if there is no element in the container equal to Ptr.
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 ...
static bool isReverseMask(ArrayRef< int > M, EVT VT)
void setBooleanContents(BooleanContent Ty)
Specify how the target extends the result of integer and floating point boolean values from i1 to a w...
bool isAcquireOrStronger(AtomicOrdering ao)
Libcall getFPTOSINT(EVT OpVT, EVT RetVT)
getFPTOSINT - Return the FPTOSINT_*_* value for the given types, or UNKNOWN_LIBCALL if there is none...
static bool isZeroOrAllOnes(SDValue N, bool AllOnes)
void AddToWorklist(SDNode *N)
static bool isLowerSaturate(const SDValue LHS, const SDValue RHS, const SDValue TrueVal, const SDValue FalseVal, const ISD::CondCode CC, const SDValue K)
static mvt_range fp_valuetypes()
unsigned getPrefTypeAlignment(Type *Ty) const
Returns the preferred stack/global alignment for the specified type.
static ARMCC::CondCodes IntCCToARMCC(ISD::CondCode CC)
IntCCToARMCC - Convert a DAG integer condition code to an ARM CC.
static bool BitsProperlyConcatenate(const APInt &A, const APInt &B)
constexpr bool isPowerOf2_64(uint64_t Value)
Return true if the argument is a power of two > 0 (64 bit edition.)
This file declares a class to represent arbitrary precision floating point values and provide a varie...
static Type * getVoidTy(LLVMContext &C)
This class provides iterator support for SDUse operands that use a specific SDNode.
static SDValue LowerCTPOP(SDNode *N, SelectionDAG &DAG, const ARMSubtarget *ST)
unsigned getJumpTableEncoding() const override
Return the entry encoding for a jump table in the current function.
static SDValue LowerSDIV_v4i16(SDValue N0, SDValue N1, const SDLoc &dl, SelectionDAG &DAG)
static bool isSRA16(const SDValue &Op)
bool isHalfTy() const
Return true if this is 'half', a 16-bit IEEE fp type.
static EVT getFloatingPointVT(unsigned BitWidth)
Returns the EVT that represents a floating-point type with the given number of bits.
const MachineInstrBuilder & addRegMask(const uint32_t *Mask) const
virtual ConstraintWeight getSingleConstraintMatchWeight(AsmOperandInfo &info, const char *constraint) const
Examine constraint string and operand type and determine a weight value.
static SDValue promoteToConstantPool(const GlobalValue *GV, SelectionDAG &DAG, EVT PtrVT, const SDLoc &dl)
Ty * getInfo()
getInfo - Keep track of various per-function pieces of information for backends that would like to do...
int getT2SOImmVal(unsigned Arg)
getT2SOImmVal - Given a 32-bit immediate, if it is something that can fit into a Thumb-2 shifter_oper...
void ReplaceAllUsesWith(SDValue From, SDValue To)
Modify anything using 'From' to use 'To' instead.
static bool isLowerSaturatingConditional(const SDValue &Op, SDValue &V, SDValue &SatK)
static SDValue AddCombineVUZPToVPADDL(SDNode *N, SDValue N0, SDValue N1, TargetLowering::DAGCombinerInfo &DCI, const ARMSubtarget *Subtarget)
void computeMaxCallFrameSize(const MachineFunction &MF)
Computes the maximum size of a callframe and the AdjustsStack property.
TRAP - Trapping instruction.
const APInt & getAPIntValue() const
const Triple & getTargetTriple() const
unsigned convertAddSubFlagsOpcode(unsigned OldOpc)
Map pseudo instructions that imply an 'S' bit onto real opcodes.
static void expandf64Toi32(SDValue Op, SelectionDAG &DAG, SDValue &RetVal1, SDValue &RetVal2)
Value * getPointerOperand()
AssertSext, AssertZext - These nodes record if a register contains a value that has already been zero...
static 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.
static mvt_range vector_valuetypes()
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...
int getScalingFactorCost(const DataLayout &DL, const AddrMode &AM, Type *Ty, unsigned AS) const override
getScalingFactorCost - Return the cost of the scaling used in addressing mode represented by AM...
SDValue PerformCMOVToBFICombine(SDNode *N, SelectionDAG &DAG) const
bool shouldInsertFencesForAtomic(const Instruction *I) const override
Whether AtomicExpandPass should automatically insert fences and reduce ordering for this atomic...
static SDValue getCTPOP16BitCounts(SDNode *N, SelectionDAG &DAG)
getCTPOP16BitCounts - Returns a v8i8/v16i8 vector containing the bit-count for each 16-bit element fr...
TargetLoweringBase::AtomicExpansionKind shouldExpandAtomicRMWInIR(AtomicRMWInst *AI) const override
Returns how the IR-level AtomicExpand pass should expand the given AtomicRMW, if at all...
size_type count(ConstPtrType Ptr) const
count - Return 1 if the specified pointer is in the set, 0 otherwise.
static cl::opt< bool > EnableConstpoolPromotion("arm-promote-constant", cl::Hidden, cl::desc("Enable / disable promotion of unnamed_addr constants into " "constant pools"), cl::init(false))
self_iterator getIterator()
SDValue getMemIntrinsicNode(unsigned Opcode, const SDLoc &dl, SDVTList VTList, ArrayRef< SDValue > Ops, EVT MemVT, MachinePointerInfo PtrInfo, unsigned Align=0, MachineMemOperand::Flags Flags=MachineMemOperand::MOLoad|MachineMemOperand::MOStore, unsigned Size=0)
Creates a MemIntrinsicNode that may produce a result and takes a list of operands.
The memory access is non-temporal.
bool hasNUsesOfValue(unsigned NUses, unsigned Value) const
Return true if there are exactly NUSES uses of the indicated value.
Class to represent integer types.
CondCode getSetCCSwappedOperands(CondCode Operation)
Return the operation corresponding to (Y op X) when given the operation for (X op Y)...
static MVT getVT(Type *Ty, bool HandleUnknown=false)
Return the value type corresponding to the specified type.
bool allowsUnalignedMem() const
VAARG - VAARG has four operands: an input chain, a pointer, a SRCVALUE, and the alignment.
static void ReplaceCMP_SWAP_64Results(SDNode *N, SmallVectorImpl< SDValue > &Results, SelectionDAG &DAG)
void print(raw_ostream &OS, bool IsStandalone=true, bool SkipOpers=false, bool SkipDebugLoc=false, bool AddNewLine=true, const TargetInstrInfo *TII=nullptr) const
Print this MI to OS.
static SDValue PerformARMBUILD_VECTORCombine(SDNode *N, TargetLowering::DAGCombinerInfo &DCI)
Target-specific dag combine xforms for ARMISD::BUILD_VECTOR.
MachineConstantPool * getConstantPool()
getConstantPool - Return the constant pool object for the current function.
void AddPromotedToType(unsigned Opc, MVT OrigVT, MVT DestVT)
If Opc/OrigVT is specified as being promoted, the promotion code defaults to trying a larger integer/...
unsigned MaxStoresPerMemmove
Specify maximum bytes of store instructions per memmove call.
bool isOSBinFormatMachO() const
Tests whether the environment is MachO.
const MachineInstrBuilder & addFrameIndex(int Idx) const
unsigned getInRegsParamsProcessed() const
bool isThumb1OnlyFunction() const
Bit counting operators with an undefined result for zero inputs.
static SDValue PerformVDUPLANECombine(SDNode *N, TargetLowering::DAGCombinerInfo &DCI)
PerformVDUPLANECombine - Target-specific dag combine xforms for ARMISD::VDUPLANE. ...
Val, OUTCHAIN = ATOMIC_CMP_SWAP(INCHAIN, ptr, cmp, swap) For double-word atomic operations: ValLo...
LLVMContext & getContext() const
getContext - Return a reference to the LLVMContext associated with this function. ...
X = FP_EXTEND(Y) - Extend a smaller FP type into a larger FP type.
bool isCheapToSpeculateCttz() const override
Return true if it is cheap to speculate a call to intrinsic cttz.
SmallPtrSet< const GlobalVariable *, 2 > & getGlobalsPromotedToConstantPool()
succ_iterator succ_begin()
static SDValue LowerCTTZ(SDNode *N, SelectionDAG &DAG, const ARMSubtarget *ST)
ARM_AAPCS_VFP - Same as ARM_AAPCS, but uses hard floating point ABI.
std::vector< ArgListEntry > ArgListTy
static SDValue PerformORCombine(SDNode *N, TargetLowering::DAGCombinerInfo &DCI, const ARMSubtarget *Subtarget)
PerformORCombine - Target-specific dag combine xforms for ISD::OR.
bool isIntN(unsigned N, int64_t x)
Checks if an signed integer fits into the given (dynamic) bit width.
unsigned getAlignment() const
static SDValue AddCombineTo64bitUMAAL(SDNode *AddeNode, TargetLowering::DAGCombinerInfo &DCI, const ARMSubtarget *Subtarget)
TargetRegisterInfo base class - We assume that the target defines a static array of TargetRegisterDes...
Value * CreateExtractValue(Value *Agg, ArrayRef< unsigned > Idxs, const Twine &Name="")
static SDValue PerformORCombineToSMULWBT(SDNode *OR, TargetLowering::DAGCombinerInfo &DCI, const ARMSubtarget *Subtarget)
bool isPositionIndependent() const
This structure contains all information that is necessary for lowering calls.
static bool isLTorLE(ISD::CondCode CC)
SDValue getAllOnesConstant(const SDLoc &DL, EVT VT, bool IsTarget=false, bool IsOpaque=false)
auto find(R &&Range, const T &Val) -> decltype(adl_begin(Range))
Provide wrappers to std::find which take ranges instead of having to pass begin/end explicitly...
PointerType * getInt8PtrTy(unsigned AddrSpace=0)
Fetch the type representing a pointer to an 8-bit integer value.
static PointerType * getInt8PtrTy(LLVMContext &C, unsigned AS=0)
static ARMConstantPoolMBB * Create(LLVMContext &C, const MachineBasicBlock *mbb, unsigned ID, unsigned char PCAdj)
const TargetMachine & getTargetMachine() const
This class contains a discriminated union of information about pointers in memory operands...
bool isMachineOpcode() const
Test if this node has a post-isel opcode, directly corresponding to a MachineInstr opcode...
static SDValue LowerSDIV_v4i8(SDValue X, SDValue Y, const SDLoc &dl, SelectionDAG &DAG)
unsigned getNumOperands() const
Return the number of values used by this operation.
Fast - This calling convention attempts to make calls as fast as possible (e.g.
#define llvm_unreachable(msg)
Marks that the current location is not supposed to be reachable.
void setLibcallCallingConv(RTLIB::Libcall Call, CallingConv::ID CC)
Set the CallingConv that should be used for the specified libcall.
static SDValue lowerCTPOP16BitElements(SDNode *N, SelectionDAG &DAG)
lowerCTPOP16BitElements - Returns a v4i16/v8i16 vector containing the bit-count for each 16-bit eleme...
EVT getValueType(const DataLayout &DL, Type *Ty, bool AllowUnknown=false) const
Return the EVT corresponding to this LLVM type.
const MCPhysReg * getCalleeSavedRegsViaCopy(const MachineFunction *MF) const
Value * CreateTrunc(Value *V, Type *DestTy, const Twine &Name="")
const std::string & getConstraintString() const
APInt lshr(unsigned shiftAmt) const
Logical right-shift function.
SDValue getLoad(EVT VT, const SDLoc &dl, SDValue Chain, SDValue Ptr, MachinePointerInfo PtrInfo, unsigned Alignment=0, 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...
Triple - Helper class for working with autoconf configuration names.
bool isUnindexed() const
Return true if this is NOT a pre/post inc/dec load/store.
bool isEXTLoad(const SDNode *N)
Returns true if the specified node is a EXTLOAD.
void setCmpLibcallCC(RTLIB::Libcall Call, ISD::CondCode CC)
Override the default CondCode to be used to test the result of the comparison libcall against zero...
unsigned getMaxSupportedInterleaveFactor() const override
Get the maximum supported factor for interleaved memory accesses.
The memory access writes data.
static const int BlockSize
bool isReleaseOrStronger(AtomicOrdering ao)
bool use_empty() const
Return true if there are no uses of this node.
bool isFloatingPoint() const
Return true if this is a FP or a vector FP type.
Libcall getFPEXT(EVT OpVT, EVT RetVT)
getFPEXT - Return the FPEXT_*_* value for the given types, or UNKNOWN_LIBCALL if there is none...
static SDValue PerformShiftCombine(SDNode *N, SelectionDAG &DAG, const ARMSubtarget *ST)
PerformShiftCombine - Checks for immediate versions of vector shifts and lowers them.
int getOperandConstraint(unsigned OpNum, MCOI::OperandConstraint Constraint) const
Returns the value of the specific constraint if it is set.
SDValue getTargetConstantPool(const Constant *C, EVT VT, unsigned Align=0, int Offset=0, unsigned char TargetFlags=0)
SDValue getTargetJumpTable(int JTI, EVT VT, unsigned char TargetFlags=0)
TokenFactor - This node takes multiple tokens as input and produces a single token result...
void dump() const
Dump this node, for debugging.
const TargetLowering & getTargetLoweringInfo() const
Iterator for intrusive lists based on ilist_node.
void setPromotedConstpoolIncrease(int Sz)
CCState - This class holds information needed while lowering arguments and return values...
int getSOImmVal(unsigned Arg)
getSOImmVal - Given a 32-bit immediate, if it is something that can fit into an shifter_operand immed...
SmallPtrSet - This class implements a set which is optimized for holding SmallSize or less elements...
static SDValue LowerSETCCCARRY(SDValue Op, SelectionDAG &DAG)
void addSuccessor(MachineBasicBlock *Succ, BranchProbability Prob=BranchProbability::getUnknown())
Add Succ as a successor of this MachineBasicBlock.
void setDesc(const MCInstrDesc &tid)
Replace the instruction descriptor (thus opcode) of the current instruction with a new one...
static SDValue AddCombineTo64BitSMLAL16(SDNode *AddcNode, SDNode *AddeNode, TargetLowering::DAGCombinerInfo &DCI, const ARMSubtarget *Subtarget)
static MachineOperand t1CondCodeOp(bool isDead=false)
Get the operand corresponding to the conditional code result for Thumb1.
void addOperand(MachineFunction &MF, const MachineOperand &Op)
Add the specified operand to the instruction.
bool useSoftFloat() const
mmo_iterator memoperands_begin() const
Access to memory operands of the instruction.
EXTRACT_VECTOR_ELT(VECTOR, IDX) - Returns a single element from VECTOR identified by the (potentially...
static SDValue LowerVectorINT_TO_FP(SDValue Op, SelectionDAG &DAG)
bool isShuffleMaskLegal(ArrayRef< int > M, EVT VT) const override
isShuffleMaskLegal - Targets can use this to indicate that they only support some VECTOR_SHUFFLE oper...
EVT getVectorElementType() const
Given a vector type, return the type of each element.
bool isTargetAEABI() const
Like SetCC, ops #0 and #1 are the LHS and RHS operands to compare, but op #2 is a boolean indicating ...
CallingConv::ID getCallingConv() const
getCallingConv()/setCallingConv(CC) - These method get and set the calling convention of this functio...
This is used to represent a portion of an LLVM function in a low-level Data Dependence DAG representa...
static bool getVShiftImm(SDValue Op, unsigned ElementBits, int64_t &Cnt)
Getvshiftimm - Check if this is a valid build_vector for the immediate operand of a vector shift oper...
ConstraintWeight getSingleConstraintMatchWeight(AsmOperandInfo &info, const char *constraint) const override
Examine constraint string and operand type and determine a weight value.
MachineOperand class - Representation of each machine instruction operand.
CallLoweringInfo & setCallee(CallingConv::ID CC, Type *ResultType, SDValue Target, ArgListTy &&ArgsList)
This is a 'vector' (really, a variable-sized array), optimized for the case when the array is small...
static SDValue LowerShift(SDNode *N, SelectionDAG &DAG, const ARMSubtarget *ST)
Module.h This file contains the declarations for the Module class.
static SDValue AddRequiredExtensionForVMULL(SDValue N, SelectionDAG &DAG, const EVT &OrigTy, const EVT &ExtTy, unsigned ExtOpcode)
AddRequiredExtensionForVMULL - Add a sign/zero extension to extend the total value size to 64 bits...
static void getShuffleMask(const Constant *Mask, SmallVectorImpl< int > &Result)
Convert the input shuffle mask operand to a vector of integers.
bool isFPBrccSlow() const
const InstrItineraryData * getInstrItineraryData() const override
getInstrItins - Return the instruction itineraries based on subtarget selection.
SDValue getBuildVector(EVT VT, const SDLoc &DL, ArrayRef< SDValue > Ops)
Return an ISD::BUILD_VECTOR node.
Provides information about what library functions are available for the current target.
CCValAssign - Represent assignment of one arg/retval to a location.
bool isTargetAndroid() const
constexpr size_t array_lengthof(T(&)[N])
Find the length of an array.
static void ReplaceREADCYCLECOUNTER(SDNode *N, SmallVectorImpl< SDValue > &Results, SelectionDAG &DAG, const ARMSubtarget *Subtarget)
EVT changeVectorElementTypeToInteger() const
Return a vector with the same number of elements as this vector, but with the element type converted ...
unsigned getABITypeAlignment(Type *Ty) const
Returns the minimum ABI-required alignment for the specified type.
bool hasMPExtension() const
BRCOND - Conditional branch.
const MachineInstrBuilder & addMemOperand(MachineMemOperand *MMO) const
const MachineInstrBuilder & addConstantPoolIndex(unsigned Idx, int Offset=0, unsigned char TargetFlags=0) const
Byte Swap and Counting operators.
FP16_TO_FP, FP_TO_FP16 - These operators are used to perform promotions and truncation for half-preci...
LLVM_NODISCARD T pop_back_val()
ConstantInt * getInt32(uint32_t C)
Get a constant 32-bit value.
This is an abstract virtual class for memory operations.
int CreateFixedObject(uint64_t Size, int64_t SPOffset, bool IsImmutable, bool isAliased=false)
Create a new object at a fixed location on the stack.
unsigned getSORegOpc(ShiftOpc ShOp, unsigned Imm)
const Constant * getConstVal() const
static bool isAddSubZExt(SDNode *N, SelectionDAG &DAG)
bool isCalledByLegalizer() const
Value * CreateShuffleVector(Value *V1, Value *V2, Value *Mask, const Twine &Name="")
Wrapper class for IR location info (IR ordering and DebugLoc) to be passed into SDNode creation funct...
CallLoweringInfo & setSExtResult(bool Value=true)
unsigned getAM2Offset(unsigned AM2Opc)
static Constant * get(Type *Ty, uint64_t V, bool isSigned=false)
If Ty is a vector type, return a Constant with a splat of the given value.
bool isFPImmLegal(const APFloat &Imm, EVT VT) const override
isFPImmLegal - Returns true if the target can instruction select the specified FP immediate natively...
unsigned getNumDefs() const
Return the number of MachineOperands that are register definitions.
Represents one node in the SelectionDAG.
CondCode getSetCCInverse(CondCode Operation, bool isInteger)
Return the operation corresponding to !(X op Y), where 'op' is a valid SetCC operation.
static void checkVSELConstraints(ISD::CondCode CC, ARMCC::CondCodes &CondCode, bool &swpCmpOps, bool &swpVselOps)
void setAdjustsStack(bool V)
SDValue getNOT(const SDLoc &DL, SDValue Val, EVT VT)
Create a bitwise NOT operation as (XOR Val, -1).
std::pair< unsigned, const TargetRegisterClass * > getRegForInlineAsmConstraint(const TargetRegisterInfo *TRI, StringRef Constraint, MVT VT) const override
Given a physical register constraint (e.g.
BBTy * getParent() const
Get the basic block containing the call site.
SDValue getCopyToReg(SDValue Chain, const SDLoc &dl, unsigned Reg, SDValue N)
const Function & getFunction() const
Return the LLVM function that this machine code represents.
virtual const TargetSubtargetInfo * getSubtargetImpl(const Function &) const
Virtual method implemented by subclasses that returns a reference to that target's TargetSubtargetInf...
unsigned logBase2() const
raw_ostream & dbgs()
dbgs() - This returns a reference to a raw_ostream for debugging messages.
static mvt_range integer_valuetypes()
The access may modify the value stored in memory.
static bool isS16(const SDValue &Op, SelectionDAG &DAG)
unsigned Log2_32(uint32_t Value)
Return the floor log base 2 of the specified value, -1 if the value is zero.
void swap(llvm::BitVector &LHS, llvm::BitVector &RHS)
Implement std::swap in terms of BitVector swap.
unsigned getVectorNumElements() const
FunctionType * getFunctionType() const
Returns the FunctionType for me.
size_t use_size() const
Return the number of uses of this node.
static unsigned isNEONTwoResultShuffleMask(ArrayRef< int > ShuffleMask, EVT VT, unsigned &WhichResult, bool &isV_UNDEF)
Check if ShuffleMask is a NEON two-result shuffle (VZIP, VUZP, VTRN), and return the corresponding AR...
bool ExpandInlineAsm(CallInst *CI) const override
This hook allows the target to expand an inline asm call to be explicit llvm code if it wants to...
Class to represent vector types.
const Module * getModule() const
Return the module owning the function this instruction belongs to or nullptr it the function does not...
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...
void setIndexedLoadAction(unsigned IdxMode, MVT VT, LegalizeAction Action)
Indicate that the specified indexed load does or does not work with the specified type and indicate w...
EVT getMemoryVT() const
Return the type of the in-memory value.
bool isTypeLegal(EVT VT) const
Return true if the target has native support for the specified value type.
Class for arbitrary precision integers.
unsigned getByValAlign() const
CodeModel::Model getCodeModel() const
Returns the code model.
Instruction * makeDMB(IRBuilder<> &Builder, ARM_MB::MemBOpt Domain) const
iterator_range< use_iterator > uses()
static unsigned getReg(const void *D, unsigned RC, unsigned RegNo)
A "pseudo-class" with methods for operating on BUILD_VECTORs.
Select(COND, TRUEVAL, FALSEVAL).
void setMinFunctionAlignment(unsigned Align)
Set the target's minimum function alignment (in log2(bytes))
bool bitsLT(EVT VT) const
Return true if this has less bits than VT.
bool isPowerOf2() const
Check if this APInt's value is a power of two greater than zero.
static use_iterator use_end()
bool SimplifyDemandedBits(SDNode *User, unsigned OpIdx, const APInt &Demanded, DAGCombinerInfo &DCI, TargetLoweringOpt &TLO) const
Helper for SimplifyDemandedBits that can simplify an operation with multiple uses.
typename SuperClass::iterator iterator
iterator_range< user_iterator > users()
ZERO_EXTEND - Used for integer types, zeroing the new bits.
void AnalyzeCallOperands(const SmallVectorImpl< ISD::OutputArg > &Outs, CCAssignFn Fn)
AnalyzeCallOperands - Analyze the outgoing arguments to a call, incorporating info about the passed v...
static SDValue PerformAddcSubcCombine(SDNode *N, TargetLowering::DAGCombinerInfo &DCI, const ARMSubtarget *Subtarget)
Value * CreateShl(Value *LHS, Value *RHS, const Twine &Name="", bool HasNUW=false, bool HasNSW=false)
ANY_EXTEND - Used for integer types. The high bits are undefined.
bool genLongCalls() const
iterator insert(iterator I, T &&Elt)
FCOPYSIGN(X, Y) - Return the value of X with the sign of Y.
int getMaskElt(unsigned Idx) const
FMINNAN/FMAXNAN - Behave identically to FMINNUM/FMAXNUM, except that when a single input is NaN...
static bool MatchingStackOffset(SDValue Arg, unsigned Offset, ISD::ArgFlagsTy Flags, MachineFrameInfo &MFI, const MachineRegisterInfo *MRI, const TargetInstrInfo *TII)
MatchingStackOffset - Return true if the given stack call argument is already available in the same p...
void setArgumentStackSize(unsigned size)
static SDValue PerformXORCombine(SDNode *N, TargetLowering::DAGCombinerInfo &DCI, const ARMSubtarget *Subtarget)
bool hasVMLxForwarding() const
static bool isVTBLMask(ArrayRef< int > M, EVT VT)
bool isEmpty() const
Returns true if there are no itineraries.
bool isCheapToSpeculateCtlz() const override
Return true if it is cheap to speculate a call to intrinsic ctlz.
amdgpu Simplify well known AMD library false Value Value * Arg
const MachineBasicBlock * getParent() const
static SDValue PerformVCVTCombine(SDNode *N, SelectionDAG &DAG, const ARMSubtarget *Subtarget)
PerformVCVTCombine - VCVT (floating-point to fixed-point, Advanced SIMD) can replace combinations of ...
bool isUnknown() const
Returns true if we don't know any bits.
MachineRegisterInfo - Keep track of information for virtual and physical registers, including vreg register classes, use/def chains for registers, etc.
The memory access reads data.
uint64_t getTypeSizeInBits(Type *Ty) const
Size examples:
std::pair< SDValue, SDValue > LowerCallTo(CallLoweringInfo &CLI) const
This function lowers an abstract call to a function into an actual call.
static MachinePointerInfo getFixedStack(MachineFunction &MF, int FI, int64_t Offset=0)
Return a MachinePointerInfo record that refers to the specified FrameIndex.
CallLoweringInfo & setTailCall(bool Value=true)
bool isLegalAddressingMode(const DataLayout &DL, const AddrMode &AM, Type *Ty, unsigned AS, Instruction *I=nullptr) const override
isLegalAddressingMode - Return true if the addressing mode represented by AM is legal for this target...
const TargetRegisterClass * getRegClassFor(MVT VT) const override
getRegClassFor - Return the register class that should be used for the specified value type...
Value * CreateTruncOrBitCast(Value *V, Type *DestTy, const Twine &Name="")
Section Relative (Windows TLS)
uint64_t getTypeAllocSize(Type *Ty) const
Returns the offset in bytes between successive objects of the specified type, including alignment pad...
BR_JT - Jumptable branch.
static SDValue ConvertBooleanCarryToCarryFlag(SDValue BoolCarry, SelectionDAG &DAG)
Representation of each machine instruction.
VACOPY - VACOPY has 5 operands: an input chain, a destination pointer, a source pointer, a SRCVALUE for the destination, and a SRCVALUE for the source.
const MachineFunction * getParent() const
Return the MachineFunction containing this basic block.
const Triple & getTargetTriple() const
Libcall getFPTOUINT(EVT OpVT, EVT RetVT)
getFPTOUINT - Return the FPTOUINT_*_* value for the given types, or UNKNOWN_LIBCALL if there is none...
static CondCodes getOppositeCondition(CondCodes CC)
static bool canChangeToInt(SDValue Op, bool &SeenZero, const ARMSubtarget *Subtarget)
canChangeToInt - Given the fp compare operand, return true if it is suitable to morph to an integer c...
bool hasRetAddrStack() const
LLVM_ATTRIBUTE_ALWAYS_INLINE iterator end()
void setVarArgsFrameIndex(int Index)
SmallVector< SDValue, 32 > OutVals
bool is64BitVector() const
Return true if this is a 64-bit vector type.
static SDValue PerformVMOVRRDCombine(SDNode *N, TargetLowering::DAGCombinerInfo &DCI, const ARMSubtarget *Subtarget)
PerformVMOVRRDCombine - Target-specific dag combine xforms for ARMISD::VMOVRRD.
static bool LowerToByteSwap(CallInst *CI)
Try to replace a call instruction with a call to a bswap intrinsic.
bool CheckReturn(const SmallVectorImpl< ISD::OutputArg > &Outs, CCAssignFn Fn)
CheckReturn - Analyze the return values of a function, returning true if the return can be performed ...
bool isVector() const
Return true if this is a vector value type.
const uint32_t * getSjLjDispatchPreservedMask(const MachineFunction &MF) const
const MachineInstrBuilder & addImm(int64_t Val) const
Add a new immediate operand.
const unsigned char * bytes_begin() const
Bitwise operators - logical and, logical or, logical xor.
bool isOnlyUserOf(const SDNode *N) const
Return true if this node is the only use of N.
int32_t getConstantFPSplatPow2ToLog2Int(BitVector *UndefElements, uint32_t BitWidth) const
If this is a constant FP splat and the splatted constant FP is an exact power or 2, return the log base 2 integer value.
void splice(iterator Where, MachineBasicBlock *Other, iterator From)
Take an instruction from MBB 'Other' at the position From, and insert it into this MBB right before '...
SDValue getCopyFromReg(SDValue Chain, const SDLoc &dl, unsigned Reg, EVT VT)
unsigned getAlignment() const
Return the alignment of the access that is being performed.
std::pair< SDValue, SDValue > makeLibCall(SelectionDAG &DAG, RTLIB::Libcall LC, EVT RetVT, ArrayRef< SDValue > Ops, bool isSigned, const SDLoc &dl, bool doesNotReturn=false, bool isReturnValueUsed=true) const
Returns a pair of (return value, chain).
static MachineOperand condCodeOp(unsigned CCReg=0)
Get the operand corresponding to the conditional code result.
bool isStrongDefinitionForLinker() const
Returns true if this global's definition will be the one chosen by the linker.
MachineRegisterInfo & getRegInfo()
getRegInfo - Return information about the registers currently in use.
static IntegerType * getInt32Ty(LLVMContext &C)
unsigned getLocMemOffset() const
ObjectFormatType getObjectFormat() const
getFormat - Get the object format for this triple.
const MachineInstrBuilder & setMIFlags(unsigned Flags) const
static bool isVUZP_v_undef_Mask(ArrayRef< int > M, EVT VT, unsigned &WhichResult)
isVUZP_v_undef_Mask - Special case of isVUZPMask for canonical form of "vector_shuffle v...
bool isEHPad() const
Returns true if the block is a landing pad.
SMUL_LOHI/UMUL_LOHI - Multiply two integers of type iN, producing a signed/unsigned value of type i[2...
LLVM_NODISCARD bool empty() const
unsigned getNumArgOperands() const
Return the number of call arguments.
bool is128BitVector() const
Return true if this is a 128-bit vector type.
StringRef getValueAsString() const
Return the attribute's value as a string.
virtual unsigned isLoadFromStackSlot(const MachineInstr &MI, int &FrameIndex) const
If the specified machine instruction is a direct load from a stack slot, return the virtual or physic...
static void attachMEMCPYScratchRegs(const ARMSubtarget *Subtarget, MachineInstr &MI, const SDNode *Node)
Attaches vregs to MEMCPY that it will use as scratch registers when it is expanded into LDM/STM...
static SDValue LowerInterruptReturn(SmallVectorImpl< SDValue > &RetOps, const SDLoc &DL, SelectionDAG &DAG)
uint64_t getLimitedValue(uint64_t Limit=UINT64_MAX) const
If this value is smaller than the specified limit, return it, otherwise return the limit value...
SIGN_EXTEND_INREG - This operator atomically performs a SHL/SRA pair to sign extend a small value in ...
bool isVectorLoadExtDesirable(SDValue ExtVal) const override
Return true if folding a vector load into ExtVal (a sign, zero, or any extend node) is profitable...
void computeKnownBits(SDValue Op, KnownBits &Known, unsigned Depth=0) const
Determine which bits of Op are known to be either zero or one and return them in Known.
ARMFunctionInfo - This class is derived from MachineFunctionInfo and contains private ARM-specific in...
const MCInstrDesc & get(unsigned Opcode) const
Return the machine instruction descriptor that corresponds to the specified instruction opcode...
static bool isLegalT2AddressImmediate(int64_t V, EVT VT, const ARMSubtarget *Subtarget)
LOAD and STORE have token chains as their first operand, then the same operands as an LLVM load/store...
PointerUnion< const Value *, const PseudoSourceValue * > ptrVal
static bool isSigned(Value *V)
Can the given value generate sign bits.
const Function * getParent() const
Return the enclosing method, or null if none.
static bool isLegalAddressImmediate(int64_t V, EVT VT, const ARMSubtarget *Subtarget)
isLegalAddressImmediate - Return true if the integer value can be used as the offset of the target ad...
void setReg(unsigned Reg)
Change the register this operand corresponds to.
void setArgRegsSaveSize(unsigned s)
static MachineOperand CreateImm(int64_t Val)
void AnalyzeReturn(const SmallVectorImpl< ISD::OutputArg > &Outs, CCAssignFn Fn)
AnalyzeReturn - Analyze the returned values of a return, incorporating info about the result values i...
FunctionLoweringInfo - This contains information that is global to a function that is used when lower...
static void emitPostSt(MachineBasicBlock *BB, MachineBasicBlock::iterator Pos, const TargetInstrInfo *TII, const DebugLoc &dl, unsigned StSize, unsigned Data, unsigned AddrIn, unsigned AddrOut, bool IsThumb1, bool IsThumb2)
Emit a post-increment store operation with given size.
Flags getFlags() const
Return the raw flags of the source value,.
APFloat abs(APFloat X)
Returns the absolute value of the argument.
const ARMBaseRegisterInfo * getRegisterInfo() const override
bool optForMinSize() const
Optimize this function for minimum size (-Oz).
The memory access always returns the same value (or traps).
unsigned MaxStoresPerMemmoveOptSize
Maximum number of store instructions that may be substituted for a call to memmove, used for functions with OptSize attribute.
unsigned MaxStoresPerMemcpyOptSize
Maximum number of store operations that may be substituted for a call to memcpy, used for functions w...
static cl::opt< unsigned > ConstpoolPromotionMaxTotal("arm-promote-constant-max-total", cl::Hidden, cl::desc("Maximum size of ALL constants to promote into a constant pool"), cl::init(128))
void setStackPointerRegisterToSaveRestore(unsigned R)
If set to a physical register, this specifies the register that llvm.savestack/llvm.restorestack should save and restore.
unsigned InferPtrAlignment(SDValue Ptr) const
Infer alignment of a load / store address.
const BasicBlock * getBasicBlock() const
Return the LLVM basic block that this instance corresponded to originally.
void setLibcallName(RTLIB::Libcall Call, const char *Name)
Rename the default libcall routine name for the specified libcall.
LLVM_NODISCARD std::enable_if<!is_simple_type< Y >::value, typename cast_retty< X, const Y >::ret_type >::type dyn_cast(const Y &Val)
Rename collisions when linking (static functions).
static SDValue PerformUMLALCombine(SDNode *N, SelectionDAG &DAG, const ARMSubtarget *Subtarget)
bool isLegalAddImmediate(int64_t Imm) const override
isLegalAddImmediate - Return true if the specified immediate is legal add immediate, that is the target has add instructions which can add a register and the immediate without having to materialize the immediate into a register.
static const int LAST_INDEXED_MODE
bool isNON_EXTLoad(const SDNode *N)
Returns true if the specified node is a non-extending load.
const MachineInstrBuilder & addReg(unsigned RegNo, unsigned flags=0, unsigned SubReg=0) const
Add a new virtual register operand.
static bool getARMIndexedAddressParts(SDNode *Ptr, EVT VT, bool isSEXTLoad, SDValue &Base, SDValue &Offset, bool &isInc, SelectionDAG &DAG)
unsigned getOpcode() const
FSINCOS - Compute both fsin and fcos as a single operation.
SDValue getValue(unsigned R) const
unsigned getInRegsParamsCount() const
unsigned MaxStoresPerMemcpy
Specify maximum bytes of store instructions per memcpy call.
constexpr bool isUInt< 16 >(uint64_t x)
static EVT getEVT(Type *Ty, bool HandleUnknown=false)
Return the value type corresponding to the specified type.
static MachinePointerInfo getConstantPool(MachineFunction &MF)
Return a MachinePointerInfo record that refers to the constant pool.
bool shouldExpandAtomicCmpXchgInIR(AtomicCmpXchgInst *AI) const override
Returns true if the given atomic cmpxchg should be expanded by the IR-level AtomicExpand pass into a ...
RESULT, OUTCHAIN = EH_SJLJ_SETJMP(INCHAIN, buffer) This corresponds to the eh.sjlj.setjmp intrinsic.
SDValue PerformBRCONDCombine(SDNode *N, SelectionDAG &DAG) const
PerformBRCONDCombine - Target-specific DAG combining for ARMISD::BRCOND.
unsigned getAlignment() const
Return the alignment of the access that is being performed.
static SDValue Expand64BitShift(SDNode *N, SelectionDAG &DAG, const ARMSubtarget *ST)
void removeSuccessor(MachineBasicBlock *Succ, bool NormalizeSuccProbs=false)
Remove successor from the successors list of this MachineBasicBlock.
LLVM_NODISCARD bool empty() const
CopyFromReg - This node indicates that the input value is a virtual or physical register that is defi...
bool hasOptionalDef(QueryType Type=IgnoreBundle) const
Set if this instruction has an optional definition, e.g.
const SDValue & getRoot() const
Return the root tag of the SelectionDAG.
bool isReg() const
isReg - Tests if this is a MO_Register operand.
Value * CreatePtrToInt(Value *V, Type *DestTy, const Twine &Name="")
SDValue getConstant(uint64_t Val, const SDLoc &DL, EVT VT, bool isTarget=false, bool isOpaque=false)
Create a ConstantSDNode wrapping a constant value.
SDValue getCondCode(ISD::CondCode Cond)
Libcall getSINTTOFP(EVT OpVT, EVT RetVT)
getSINTTOFP - Return the SINTTOFP_*_* value for the given types, or UNKNOWN_LIBCALL if there is none...
static bool isGTorGE(ISD::CondCode CC)
bool isFPOrFPVectorTy() const
Return true if this is a FP type or a vector of FP.
bool isTargetMachO() const
unsigned getPointerAddressSpace() const
Returns the address space of the pointer operand.
const MachineInstrBuilder & addJumpTableIndex(unsigned Idx, unsigned char TargetFlags=0) const
const MachinePointerInfo & getPointerInfo() const
static SDValue PerformVLDCombine(SDNode *N, TargetLowering::DAGCombinerInfo &DCI)
CONCAT_VECTORS(VECTOR0, VECTOR1, ...) - Given a number of values of vector type with the same length ...
bool MaskedValueIsZero(SDValue Op, const APInt &Mask, unsigned Depth=0) const
Return true if 'Op & Mask' is known to be zero.
MachineConstantPoolValue * getMachineCPVal() const
static SDValue PerformORCombineToBFI(SDNode *N, TargetLowering::DAGCombinerInfo &DCI, const ARMSubtarget *Subtarget)
static RTLIB::Libcall getDivRemLibcall(const SDNode *N, MVT::SimpleValueType SVT)
bool isLegalICmpImmediate(int64_t Imm) const override
isLegalICmpImmediate - Return true if the specified immediate is legal icmp immediate, that is the target has icmp instructions which can compare a register against the immediate without having to materialize the immediate into a register.
bool hasAtomicStore() const
Return true if this atomic instruction stores to memory.
static bool isVTRN_v_undef_Mask(ArrayRef< int > M, EVT VT, unsigned &WhichResult)
isVTRN_v_undef_Mask - Special case of isVTRNMask for canonical form of "vector_shuffle v...
assert(ImpDefSCC.getReg()==AMDGPU::SCC &&ImpDefSCC.isDef())
static bool isConditionalZeroOrAllOnes(SDNode *N, bool AllOnes, SDValue &CC, bool &Invert, SDValue &OtherOp, SelectionDAG &DAG)
void insert(iterator MBBI, MachineBasicBlock *MBB)
bool isAllOnesConstant(SDValue V)
Returns true if V is an integer constant with all bits set.
SDValue getFrameIndex(int FI, EVT VT, bool isTarget=false)
void setReturnAddressIsTaken(bool s)
Value * getArgOperand(unsigned i) const
getArgOperand/setArgOperand - Return/set the i-th call argument.
bool isPredecessorOf(const SDNode *N) const
Return true if this node is a predecessor of N.
static SDValue LowerPREFETCH(SDValue Op, SelectionDAG &DAG, const ARMSubtarget *Subtarget)
void getInRegsParamInfo(unsigned InRegsParamRecordIndex, unsigned &BeginReg, unsigned &EndReg) const
void setMinStackArgumentAlignment(unsigned Align)
Set the minimum stack alignment of an argument (in log2(bytes)).
int getFP32Imm(const APInt &Imm)
getFP32Imm - Return an 8-bit floating-point version of the 32-bit floating-point value.
void setSchedulingPreference(Sched::Preference Pref)
Specify the target scheduling preference.
CallLoweringInfo & setInRegister(bool Value=true)
static MachinePointerInfo getGOT(MachineFunction &MF)
Return a MachinePointerInfo record that refers to a GOT entry.
unsigned getPrimitiveSizeInBits() const LLVM_READONLY
Return the basic size of this type if it is a primitive type.
FastISel * createFastISel(FunctionLoweringInfo &funcInfo, const TargetLibraryInfo *libInfo)
ArrayRef< int > getMask() const
Module * getParent()
Get the module that this global value is contained inside of...
LLVM Value Representation.
FMA - Perform a * b + c with no intermediate rounding step.
SDValue getRegister(unsigned Reg, EVT VT)
bool supportsTailCall() const
unsigned getResNo() const
get the index which selects a specific result in the SDNode
SDValue getAnyExtOrTrunc(SDValue Op, const SDLoc &DL, EVT VT)
Convert Op, which must be of integer type, to the integer type VT, by either any-extending or truncat...
unsigned getMachineOpcode() const
This may only be called if isMachineOpcode returns true.
virtual void finalizeLowering(MachineFunction &MF) const
Execute target specific actions to finalize target lowering.
bool useLoadStackGuardNode() const override
If this function returns true, SelectionDAGBuilder emits a LOAD_STACK_GUARD node when it is lowering ...
constexpr char Size[]
Key for Kernel::Arg::Metadata::mSize.
static VectorType * get(Type *ElementType, unsigned NumElements)
This static method is the primary way to construct an VectorType.
static unsigned getLdOpcode(unsigned LdSize, bool IsThumb1, bool IsThumb2)
Return the load opcode for a given load size.
bool isNullConstant(SDValue V)
Returns true if V is a constant integer zero.
void push_back(MachineBasicBlock *MBB)
static SDValue LowerADDSUBCARRY(SDValue Op, SelectionDAG &DAG)
SDValue getSelectCC(const SDLoc &DL, SDValue LHS, SDValue RHS, SDValue True, SDValue False, ISD::CondCode Cond)
Helper function to make it easier to build SelectCC's if you just have an ISD::CondCode instead of an...
ARMTargetLowering(const TargetMachine &TM, const ARMSubtarget &STI)
SDValue getValueType(EVT)
const MCOperandInfo * OpInfo
std::underlying_type< E >::type Mask()
Get a bitmask with 1s in all places up to the high-order bit of E's largest value.
int getOperandCycle(unsigned ItinClassIndx, unsigned OperandIdx) const
Return the cycle for the given class and operand.
PREFETCH - This corresponds to a prefetch intrinsic.
bool functionArgumentNeedsConsecutiveRegisters(Type *Ty, CallingConv::ID CallConv, bool isVarArg) const override
Returns true if an argument of type Ty needs to be passed in a contiguous block of registers in calli...
MO_NONLAZY - This is an independent flag, on a symbol operand "FOO" it represents a symbol which...
bool isUndef() const
Return true if the type of the node type undefined.
Attribute getFnAttribute(Attribute::AttrKind Kind) const
Return the attribute for the given attribute kind.
ConstraintType getConstraintType(StringRef Constraint) const override
getConstraintType - Given a constraint letter, return the type of constraint it is for this target...
Value * CreateLShr(Value *LHS, Value *RHS, const Twine &Name="", bool isExact=false)
static Constant * get(LLVMContext &Context, ArrayRef< ElementTy > Elts)
get() constructor - Return a constant with array type with an element count and element type matching...
const Value * getCalledValue() const
Get a pointer to the function that is invoked by this instruction.
static SDValue PerformSHLSimplify(SDNode *N, TargetLowering::DAGCombinerInfo &DCI, const ARMSubtarget *ST)
unsigned getExceptionPointerRegister(const Constant *PersonalityFn) const override
If a physical register, this returns the register that receives the exception address on entry to an ...
static SDValue LowerVASTART(SDValue Op, SelectionDAG &DAG)
void rewindByValRegsInfo()
void ReplaceAllUsesOfValueWith(SDValue From, SDValue To)
Replace any uses of From with To, leaving uses of other values produced by From.getNode() alone...
bool isTargetWindows() const
Primary interface to the complete machine description for the target machine.
unsigned createJumpTableIndex(const std::vector< MachineBasicBlock *> &DestBBs)
createJumpTableIndex - Create a new jump table.
Type * getElementType() const
static SDValue PerformSTORECombine(SDNode *N, TargetLowering::DAGCombinerInfo &DCI)
PerformSTORECombine - Target-specific dag combine xforms for ISD::STORE.
#define LLVM_FALLTHROUGH
LLVM_FALLTHROUGH - Mark fallthrough cases in switch statements.
const APFloat & getValueAPF() const
static SDValue LowerUDIV(SDValue Op, SelectionDAG &DAG)
static MachinePointerInfo getStack(MachineFunction &MF, int64_t Offset, uint8_t ID=0)
Stack pointer relative access.
constexpr bool isShiftedMask_32(uint32_t Value)
Return true if the argument contains a non-empty sequence of ones with the remainder zero (32 bit ver...
StringRef - Represent a constant reference to a string, i.e.
SetCC operator - This evaluates to a true value iff the condition is true.
void RemoveOperand(unsigned OpNo)
Erase an operand from an instruction, leaving it with one fewer operand than it started with...
bool isOSVersionLT(unsigned Major, unsigned Minor=0, unsigned Micro=0) const
isOSVersionLT - Helper function for doing comparisons against version numbers included in the target ...
unsigned MaxStoresPerMemset
Specify maximum number of store instructions per memset call.
unsigned MaxStoresPerMemsetOptSize
Maximum number of stores operations that may be substituted for the call to memset, used for functions with OptSize attribute.
Type * getArrayElementType() const
static MachineBasicBlock * OtherSucc(MachineBasicBlock *MBB, MachineBasicBlock *Succ)
unsigned countLeadingZeros() const
The APInt version of the countLeadingZeros functions in MathExtras.h.
static BranchProbability getZero()
static SDValue LowerFPOWI(SDValue Op, const ARMSubtarget &Subtarget, SelectionDAG &DAG)
bool isFNegFree(EVT VT) const override
Return true if an fneg operation is free to the point where it is never worthwhile to replace it with...
bool operator==(uint64_t V1, const APInt &V2)
unsigned getNumOperands() const
MERGE_VALUES - This node takes multiple discrete operands and returns them all as its individual resu...
bool hasAnyDataBarrier() const
static bool isVolatile(Instruction *Inst)
bool isExtractSubvectorCheap(EVT ResVT, EVT SrcVT, unsigned Index) const override
Return true if EXTRACT_SUBVECTOR is cheap for this result type with this index.
const SDValue & getOperand(unsigned i) const
bool verifyReturnAddressArgumentIsConstant(SDValue Op, SelectionDAG &DAG) const
OUTCHAIN = ATOMIC_STORE(INCHAIN, ptr, val) This corresponds to "store atomic" instruction.
bool isZExtFree(SDValue Val, EVT VT2) const override
Return true if zero-extending the specific node Val to type VT2 is free (either because it's implicit...
const MachineInstrBuilder & addMBB(MachineBasicBlock *MBB, unsigned char TargetFlags=0) const
unsigned getLocReg() const
uint64_t getZExtValue() const
TRUNCATE - Completely drop the high bits.
bool isSimple() const
Test if the given EVT is simple (as opposed to being extended).
bool isUIntN(unsigned N, uint64_t x)
Checks if an unsigned integer fits into the given (dynamic) bit width.
bool isBitFieldInvertedMask(unsigned v)
static SDValue CombineANDShift(SDNode *N, TargetLowering::DAGCombinerInfo &DCI, const ARMSubtarget *Subtarget)
unsigned AllocateReg(unsigned Reg)
AllocateReg - Attempt to allocate one register.
TargetLoweringBase::AtomicExpansionKind shouldExpandAtomicLoadInIR(LoadInst *LI) const override
Returns how the given (atomic) load should be expanded by the IR-level AtomicExpand pass...
bool hasDataBarrier() const
const MachineOperand & getOperand(unsigned i) const
Instruction * emitLeadingFence(IRBuilder<> &Builder, Instruction *Inst, AtomicOrdering Ord) const override
Inserts in the IR a target-specific intrinsic specifying a fence.
OutputIt copy(R &&Range, OutputIt Out)
static SDValue GeneratePerfectShuffle(unsigned PFEntry, SDValue LHS, SDValue RHS, SelectionDAG &DAG, const SDLoc &dl)
GeneratePerfectShuffle - Given an entry in the perfect-shuffle table, emit the specified operations t...
Unlike LLVM values, Selection DAG nodes may return multiple values as the result of a computation...
bool isMustTailCall() const
Tests if this call site must be tail call optimized.
static SDValue ExpandBITCAST(SDNode *N, SelectionDAG &DAG, const ARMSubtarget *Subtarget)
ExpandBITCAST - If the target supports VFP, this function is called to expand a bit convert where eit...
bool shouldExpandAtomicStoreInIR(StoreInst *SI) const override
Returns true if the given (atomic) store should be expanded by the IR-level AtomicExpand pass into an...
static SDValue AddCombineBUILD_VECTORToVPADDL(SDNode *N, SDValue N0, SDValue N1, TargetLowering::DAGCombinerInfo &DCI, const ARMSubtarget *Subtarget)
bool isDoubleTy() const
Return true if this is 'double', a 64-bit IEEE fp type.
static bool allUsersAreInFunctions(const Value *V)
Return true if all users of V are within some (any) function, looking through ConstantExprs.
FNEG, FABS, FSQRT, FSIN, FCOS, FPOWI, FPOW, FLOG, FLOG2, FLOG10, FEXP, FEXP2, FCEIL, FTRUNC, FRINT, FNEARBYINT, FROUND, FFLOOR - Perform various unary floating point operations.
VectorType * getType() const
Overload to return most specific vector type.
static bool isSaturatingConditional(const SDValue &Op, SDValue &V, uint64_t &K, bool &usat)
Value * getPointerOperand()
MachineInstr::mmo_iterator allocateMemRefsArray(unsigned long Num)
allocateMemRefsArray - Allocate an array to hold MachineMemOperand pointers.
static IntegerType * getInt8Ty(LLVMContext &C)
Val, OUTCHAIN = ATOMIC_LOAD(INCHAIN, ptr) This corresponds to "load atomic" instruction.
LLVMContext * getContext() const
static ARMConstantPoolConstant * Create(const Constant *C, unsigned ID)
bool isTruncateFree(Type *SrcTy, Type *DstTy) const override
Return true if it's free to truncate a value of type FromTy to type ToTy.
SCALAR_TO_VECTOR(VAL) - This represents the operation of loading a scalar value into element 0 of the...
static bool isSplatMask(const int *Mask, EVT VT)
constexpr char Args[]
Key for Kernel::Metadata::mArgs.
unsigned getConstantPoolIndex(const Constant *C, unsigned Alignment)
getConstantPoolIndex - Create a new entry in the constant pool or return an existing one...
static bool isVEXTMask(ArrayRef< int > M, EVT VT, bool &ReverseVEXT, unsigned &Imm)
static bool memOpAlign(unsigned DstAlign, unsigned SrcAlign, unsigned AlignCheck)
Type * getElementType() const
CallLoweringInfo & setLibCallee(CallingConv::ID CC, Type *ResultType, SDValue Target, ArgListTy &&ArgsList)
bool PredictableSelectIsExpensive
Tells the code generator that select is more expensive than a branch if the branch is usually predict...
std::vector< MachineBasicBlock * >::iterator succ_iterator
static SDValue bitcastf32Toi32(SDValue Op, SelectionDAG &DAG)
unsigned createVirtualRegister(const TargetRegisterClass *RegClass, StringRef Name="")
createVirtualRegister - Create and return a new virtual register in the function with the specified r...
Carry-using nodes for multiple precision addition and subtraction.
static void ReplaceLongIntrinsic(SDNode *N, SmallVectorImpl< SDValue > &Results, SelectionDAG &DAG)
bool empty() const
empty - Check if the array is empty.
bool isArrayTy() const
True if this is an instance of ArrayType.
unsigned getSize() const
Return the number of bytes in the encoding of this instruction, or zero if the encoding size cannot b...
This file describes how to lower LLVM code to machine code.
const BasicBlock * getParent() const
const char * getLibcallName(RTLIB::Libcall Call) const
Get the libcall routine name for the specified libcall.
SDValue getTargetGlobalAddress(const GlobalValue *GV, const SDLoc &DL, EVT VT, int64_t offset=0, unsigned char TargetFlags=0)
bool allowsMisalignedMemoryAccesses(EVT VT, unsigned AddrSpace, unsigned Align, bool *Fast) const override
allowsMisalignedMemoryAccesses - Returns true if the target allows unaligned memory accesses of the s...
void setIndexedStoreAction(unsigned IdxMode, MVT VT, LegalizeAction Action)
Indicate that the specified indexed store does or does not work with the specified type and indicate ...
FloatABI::ABIType FloatABIType
FloatABIType - This setting is set by -float-abi=xxx option is specfied on the command line...
CallInst * CreateCall(Value *Callee, ArrayRef< Value *> Args=None, const Twine &Name="", MDNode *FPMathTag=nullptr)
MemIndexedMode
MemIndexedMode enum - This enum defines the load / store indexed addressing modes.
static TargetLowering::ArgListTy getDivRemArgList(const SDNode *N, LLVMContext *Context, const ARMSubtarget *Subtarget)
MULHU/MULHS - Multiply high - Multiply two integers of type iN, producing an unsigned/signed value of...
static SDValue isNEONModifiedImm(uint64_t SplatBits, uint64_t SplatUndef, unsigned SplatBitSize, SelectionDAG &DAG, const SDLoc &dl, EVT &VT, bool is128Bits, NEONModImmType type)
isNEONModifiedImm - Check if the specified splat value corresponds to a valid vector constant for a N...
void tieOperands(unsigned DefIdx, unsigned UseIdx)
Add a tie between the register operands at DefIdx and UseIdx.
This class is used to represent ISD::LOAD nodes.
static SDValue createGPRPairNode(SelectionDAG &DAG, SDValue V)
DYNAMIC_STACKALLOC - Allocate some number of bytes on the stack aligned to a specified boundary...