110 using namespace llvm;
112 #define DEBUG_TYPE "arm-isel"
114 STATISTIC(NumTailCalls,
"Number of tail calls");
115 STATISTIC(NumMovwMovt,
"Number of GAs materialized with movw + movt");
116 STATISTIC(NumLoopByVals,
"Number of loops generated for byval arguments");
118 "Number of constants with their storage promoted into constant pools");
122 cl::desc(
"Enable / disable ARM interworking (for debugging only)"),
127 cl::desc(
"Enable / disable promotion of unnamed_addr constants into "
132 cl::desc(
"Maximum size of constant to promote into a constant pool"),
136 cl::desc(
"Maximum size of ALL constants to promote into a constant pool"),
141 ARM::R0, ARM::R1,
ARM::R2, ARM::R3
144 void ARMTargetLowering::addTypeForNEON(
MVT VT,
MVT PromotedLdStVT,
145 MVT PromotedBitwiseVT) {
146 if (VT != PromotedLdStVT) {
185 if (VT.
isInteger() && VT != PromotedBitwiseVT) {
208 void ARMTargetLowering::addDRTypeForNEON(
MVT VT) {
213 void ARMTargetLowering::addQRTypeForNEON(
MVT VT) {
247 static const struct {
249 const char *
const Name;
307 for (
const auto &LC : LibraryCalls) {
331 static const struct {
333 const char *
const Name;
420 for (
const auto &LC : LibraryCalls) {
430 static const struct {
432 const char *
const Name;
435 } MemOpsLibraryCalls[] = {
443 for (
const auto &LC : MemOpsLibraryCalls) {
453 static const struct {
455 const char *
const Name;
468 for (
const auto &LC : LibraryCalls) {
500 static const struct {
502 const char *
const Name;
510 for (
const auto &LC : LibraryCalls) {
877 HasStandaloneRem =
false;
882 const char *
const Name;
896 for (
const auto &LC : LibraryCalls) {
903 const char *
const Name;
917 for (
const auto &LC : LibraryCalls) {
958 InsertFencesForAtomic =
false;
971 InsertFencesForAtomic =
true;
978 InsertFencesForAtomic =
true;
998 if (!InsertFencesForAtomic) {
1192 std::pair<const TargetRegisterClass *, uint8_t>
1205 RRC = &ARM::DPRRegClass;
1215 RRC = &ARM::DPRRegClass;
1219 RRC = &ARM::DPRRegClass;
1223 RRC = &ARM::DPRRegClass;
1227 return std::make_pair(RRC, Cost);
1394 return &ARM::QQPRRegClass;
1396 return &ARM::QQQQPRRegClass;
1405 unsigned &PrefAlign)
const {
1406 if (!isa<MemIntrinsic>(CI))
1427 for (
unsigned i = 0; i != NumVals; ++i) {
1459 if (
auto Const = dyn_cast<ConstantSDNode>(Op.
getOperand(1)))
1460 return Const->getZExtValue() == 16;
1467 if (
auto Const = dyn_cast<ConstantSDNode>(Op.
getOperand(1)))
1468 return Const->getZExtValue() == 16;
1475 if (
auto Const = dyn_cast<ConstantSDNode>(Op.
getOperand(1)))
1476 return Const->getZExtValue() == 16;
1511 InvalidOnQNaN =
true;
1517 InvalidOnQNaN =
false;
1528 InvalidOnQNaN =
false;
1535 InvalidOnQNaN =
false;
1546 InvalidOnQNaN =
false;
1555 #include "ARMGenCallingConv.inc"
1562 bool isVarArg)
const {
1598 bool isVarArg)
const {
1599 return CCAssignFnForNode(CC,
false, isVarArg);
1603 bool isVarArg)
const {
1604 return CCAssignFnForNode(CC,
true, isVarArg);
1611 bool isVarArg)
const {
1612 switch (getEffectiveCallingConv(CC, isVarArg)) {
1616 return (Return ? RetCC_ARM_APCS : CC_ARM_APCS);
1618 return (Return ? RetCC_ARM_AAPCS : CC_ARM_AAPCS);
1620 return (Return ? RetCC_ARM_AAPCS_VFP : CC_ARM_AAPCS_VFP);
1622 return (Return ? RetFastCC_ARM_APCS : FastCC_ARM_APCS);
1624 return (Return ? RetCC_ARM_APCS : CC_ARM_APCS_GHC);
1626 return (Return ? RetCC_ARM_AAPCS : CC_ARM_AAPCS);
1632 SDValue ARMTargetLowering::LowerCallResult(
1645 for (
unsigned i = 0; i != RVLocs.
size(); ++i) {
1650 if (i == 0 && isThisReturn) {
1652 "unexpected return calling convention register assignment");
1724 Chain, dl, Arg, PtrOff,
1730 RegsToPassVector &RegsToPass,
1738 unsigned id = Subtarget->
isLittle() ? 0 : 1;
1774 bool isStructRet = (Outs.
empty()) ?
false : Outs[0].Flags.
isSRet();
1775 bool isThisReturn =
false;
1776 bool isSibCall =
false;
1785 isTailCall = IsEligibleForTailCallOptimization(Callee, CallConv,
1787 Outs, OutVals,
Ins, DAG);
1790 "site marked musttail");
1806 unsigned NumBytes = CCInfo.getNextStackOffset();
1820 RegsToPassVector RegsToPass;
1825 for (
unsigned i = 0, realArgIdx = 0, e = ArgLocs.
size();
1827 ++i, ++realArgIdx) {
1829 SDValue Arg = OutVals[realArgIdx];
1831 bool isByVal = Flags.
isByVal();
1859 PassF64ArgInRegs(dl, DAG, Chain, Op0, RegsToPass,
1860 VA, ArgLocs[++i], StackPtr, MemOpChains, Flags);
1864 PassF64ArgInRegs(dl, DAG, Chain, Op1, RegsToPass,
1865 VA, ArgLocs[++i], StackPtr, MemOpChains, Flags);
1869 MemOpChains.
push_back(LowerMemOpCallTo(Chain, StackPtr, Op1,
1870 dl, DAG, VA, Flags));
1873 PassF64ArgInRegs(dl, DAG, Chain, Arg, RegsToPass, VA, ArgLocs[++i],
1874 StackPtr, MemOpChains, Flags);
1880 "unexpected calling convention register assignment");
1882 "unexpected use of 'returned'");
1883 isThisReturn =
true;
1885 RegsToPass.push_back(std::make_pair(VA.
getLocReg(), Arg));
1886 }
else if (isByVal) {
1888 unsigned offset = 0;
1892 unsigned ByValArgsCount = CCInfo.getInRegsParamsCount();
1893 unsigned CurByValIdx = CCInfo.getInRegsParamsProcessed();
1895 if (CurByValIdx < ByValArgsCount) {
1897 unsigned RegBegin, RegEnd;
1898 CCInfo.getInRegsParamInfo(CurByValIdx, RegBegin, RegEnd);
1903 for (i = 0, j = RegBegin; j < RegEnd; i++, j++) {
1910 RegsToPass.push_back(std::make_pair(j, Load));
1915 offset = RegEnd - RegBegin;
1917 CCInfo.nextInRegsParam();
1933 SDValue Ops[] = { Chain, Dst, Src, SizeNode, AlignNode};
1937 }
else if (!isSibCall) {
1940 MemOpChains.
push_back(LowerMemOpCallTo(Chain, StackPtr, Arg,
1941 dl, DAG, VA, Flags));
1945 if (!MemOpChains.
empty())
1954 for (
unsigned i = 0, e = RegsToPass.size(); i != e; ++i) {
1956 RegsToPass[i].
second, InFlag);
1971 for (
unsigned i = 0, e = RegsToPass.size(); i != e; ++i) {
1972 Chain = DAG.
getCopyToReg(Chain, dl, RegsToPass[i].first,
1973 RegsToPass[i].second, InFlag);
1982 bool isDirect =
false;
1988 GV =
G->getGlobal();
1992 bool isARMFunc = !Subtarget->
isThumb() || (isStub && !Subtarget->
isMClass());
1993 bool isLocalARMFunc =
false;
1999 "long-calls codegen is not position independent!");
2003 if (isa<GlobalAddressSDNode>(Callee)) {
2016 const char *Sym = S->getSymbol();
2022 ARMPCLabelIndex, 0);
2030 }
else if (isa<GlobalAddressSDNode>(Callee)) {
2034 auto *GV = cast<GlobalAddressSDNode>(Callee)->getGlobal();
2036 bool PreferIndirect =
2039 return isa<Instruction>(U) && cast<Instruction>(U)->getParent() == BB;
2042 if (!PreferIndirect) {
2061 "Windows is the only supported COFF target");
2079 const char *Sym = S->getSymbol();
2084 ARMPCLabelIndex, 4);
2100 if ((!isDirect || isARMFunc) && !Subtarget->
hasV5TOps())
2105 if (!isDirect && !Subtarget->
hasV5TOps())
2116 std::vector<SDValue> Ops;
2117 Ops.push_back(Chain);
2118 Ops.push_back(Callee);
2122 for (
unsigned i = 0, e = RegsToPass.size(); i != e; ++i)
2123 Ops.push_back(DAG.
getRegister(RegsToPass[i].first,
2124 RegsToPass[i].second.getValueType()));
2137 isThisReturn =
false;
2143 assert(Mask &&
"Missing call preserved mask for calling convention");
2148 Ops.push_back(InFlag);
2157 Chain = DAG.
getNode(CallOpc, dl, NodeTys, Ops);
2167 return LowerCallResult(Chain, InFlag, CallConv, isVarArg, Ins, dl, DAG,
2168 InVals, isThisReturn,
2169 isThisReturn ? OutVals[0] :
SDValue());
2176 void ARMTargetLowering::HandleByVal(
CCState *State,
unsigned &
Size,
2177 unsigned Align)
const {
2185 unsigned AlignInRegs = Align / 4;
2186 unsigned Waste = (
ARM::R4 -
Reg) % AlignInRegs;
2187 for (
unsigned i = 0; i < Waste; ++i)
2200 if (NSAAOffset != 0 && Size > Excess) {
2212 unsigned ByValRegBegin =
Reg;
2213 unsigned ByValRegEnd = std::min<unsigned>(Reg + Size / 4,
ARM::R4);
2217 for (
unsigned i = Reg + 1; i != ByValRegEnd; ++i)
2223 Size = std::max<int>(Size - Excess, 0);
2248 }
else if (
LoadSDNode *Ld = dyn_cast<LoadSDNode>(Arg)) {
2274 ARMTargetLowering::IsEligibleForTailCallOptimization(
SDValue Callee,
2277 bool isCalleeStructRet,
2278 bool isCallerStructRet,
2300 if (isCalleeStructRet || isCallerStructRet)
2327 if (CalleeCC != CallerCC) {
2329 if (!TRI->regmaskSubsetEqual(CallerPreserved, CalleePreserved))
2342 if (!Outs.
empty()) {
2346 CCState CCInfo(CalleeCC, isVarArg, MF, ArgLocs, C);
2348 if (CCInfo.getNextStackOffset()) {
2354 for (
unsigned i = 0, realArgIdx = 0, e = ArgLocs.
size();
2356 ++i, ++realArgIdx) {
2359 SDValue Arg = OutVals[realArgIdx];
2370 if (!ArgLocs[++i].isRegLoc())
2373 if (!ArgLocs[++i].isRegLoc())
2375 if (!ArgLocs[++i].isRegLoc())
2400 CCState CCInfo(CallConv, isVarArg, MF, RVLocs, Context);
2422 if (IntKind ==
"" || IntKind ==
"IRQ" || IntKind ==
"FIQ" ||
2425 else if (IntKind ==
"SWI" || IntKind ==
"UNDEF")
2429 "must be one of: IRQ, FIQ, SWI, ABORT or UNDEF");
2457 bool isLittleEndian = Subtarget->
isLittle();
2464 for (
unsigned i = 0, realRVLocIdx = 0;
2466 ++i, ++realRVLocIdx) {
2470 SDValue Arg = OutVals[realRVLocIdx];
2489 HalfGPRs.
getValue(isLittleEndian ? 0 : 1),
2495 HalfGPRs.
getValue(isLittleEndian ? 1 : 0),
2510 fmrrd.
getValue(isLittleEndian ? 0 : 1),
2516 fmrrd.
getValue(isLittleEndian ? 1 : 0),
2533 else if (ARM::DPRRegClass.
contains(*I))
2561 bool ARMTargetLowering::isUsedByReturnOnly(
SDNode *
N,
SDValue &Chain)
const {
2585 if (Copies.
size() > 2)
2620 bool HasRet =
false;
2636 bool ARMTargetLowering::mayBeEmittedAsTailCall(
const CallInst *CI)
const {
2642 if (!CI->
isTailCall() || Attr.getValueAsString() ==
"true")
2656 &&
"LowerWRITE_REGISTER called for non-i64 type argument.");
2689 getFunction()->getParent());
2698 return LowerGlobalAddress(GA, DAG);
2718 unsigned ARMPCLabelIndex = 0;
2721 const BlockAddress *BA = cast<BlockAddressSDNode>(
Op)->getBlockAddress();
2724 if (!IsPositionIndependent) {
2727 unsigned PCAdj = Subtarget->
isThumb() ? 4 : 8;
2738 if (!IsPositionIndependent)
2769 ARMTargetLowering::LowerGlobalTLSAddressDarwin(
SDValue Op,
2776 SDValue DescAddr = LowerGlobalAddressDarwin(Op, DAG);
2813 ARMTargetLowering::LowerGlobalTLSAddressWindows(
SDValue Op,
2857 const auto *GA = cast<GlobalAddressSDNode>(
Op);
2873 unsigned char PCAdj = Subtarget->
isThumb() ? 4 : 8;
2893 Entry.Node = Argument;
2895 Args.push_back(Entry);
2903 std::pair<SDValue, SDValue> CallResult =
LowerCallTo(CLI);
2904 return CallResult.first;
2926 unsigned char PCAdj = Subtarget->
isThumb() ? 4 : 8;
2934 PtrVT, dl, Chain, Offset,
2942 PtrVT, dl, Chain, Offset,
2952 PtrVT, dl, Chain, Offset,
2964 return LowerGlobalTLSAddressDarwin(Op, DAG);
2967 return LowerGlobalTLSAddressWindows(Op, DAG);
2980 return LowerToTLSGeneralDynamicModel(GA, DAG);
2983 return LowerToTLSExecModels(GA, DAG, model);
2992 for (
auto *U : V->
users())
2994 while (!Worklist.
empty()) {
2996 if (isa<ConstantExpr>(U)) {
2997 for (
auto *UU : U->users())
3003 if (!I || I->getParent()->getParent() !=
F)
3013 for (
auto *U : V->
users())
3015 while (!Worklist.
empty()) {
3017 if (isa<ConstantExpr>(U)) {
3018 for (
auto *UU : U->users())
3023 if (!isa<Instruction>(U))
3033 Type *SubT =
nullptr;
3065 if (!GVar || !GVar->hasInitializer() ||
3066 !GVar->isConstant() || !GVar->hasGlobalUnnamedAddr() ||
3067 !GVar->hasLocalLinkage())
3073 auto *
Init = GVar->getInitializer();
3085 unsigned Align = GVar->getAlignment();
3086 unsigned RequiredPadding = 4 - (Size % 4);
3087 bool PaddingPossible =
3088 RequiredPadding == 4 || (CDAInit && CDAInit->isString());
3093 unsigned PaddedSize = Size + ((RequiredPadding == 4) ? 0 : RequiredPadding);
3115 if (RequiredPadding != 4) {
3120 while (RequiredPadding--)
3133 ++NumConstpoolPromoted;
3138 if (
const GlobalAlias *GA = dyn_cast<GlobalAlias>(GV))
3140 return (isa<GlobalVariable>(GV) && cast<GlobalVariable>(GV)->
isConstant()) ||
3149 return LowerGlobalAddressWindows(Op, DAG);
3151 return LowerGlobalAddressELF(Op, DAG);
3153 return LowerGlobalAddressDarwin(Op, DAG);
3161 const GlobalValue *GV = cast<GlobalAddressSDNode>(
Op)->getGlobal();
3178 unsigned PCAdj = Subtarget->
isThumb() ? 4 : 8;
3180 GV, ARMPCLabelIndex, ARMCP::CPValue, PCAdj,
3193 DAG.
getLoad(PtrVT, dl, Chain, Result,
3196 }
else if (Subtarget->
isROPI() && IsRO) {
3201 }
else if (Subtarget->
isRWPI() && !IsRO) {
3242 "ROPI/RWPI not currently supported for Darwin");
3245 const GlobalValue *GV = cast<GlobalAddressSDNode>(
Op)->getGlobal();
3268 "Windows on ARM expects to use movw/movt");
3270 "ROPI/RWPI not currently supported for Windows");
3272 const GlobalValue *GV = cast<GlobalAddressSDNode>(
Op)->getGlobal();
3286 if (GV->hasDLLImportStorageClass())
3308 SDValue ARMTargetLowering::LowerEH_SJLJ_SETUP_DISPATCH(
SDValue Op,
3318 unsigned IntNo = cast<ConstantSDNode>(Op.
getOperand(0))->getZExtValue();
3322 case Intrinsic::thread_pointer: {
3326 case Intrinsic::eh_sjlj_lsda: {
3333 unsigned PCAdj = IsPositionIndependent ? (Subtarget->
isThumb() ? 4 : 8) : 0;
3343 if (IsPositionIndependent) {
3349 case Intrinsic::arm_neon_vabs:
3352 case Intrinsic::arm_neon_vmulls:
3353 case Intrinsic::arm_neon_vmullu: {
3354 unsigned NewOpc = (IntNo == Intrinsic::arm_neon_vmulls)
3359 case Intrinsic::arm_neon_vminnm:
3360 case Intrinsic::arm_neon_vmaxnm: {
3361 unsigned NewOpc = (IntNo == Intrinsic::arm_neon_vminnm)
3366 case Intrinsic::arm_neon_vminu:
3367 case Intrinsic::arm_neon_vmaxu: {
3370 unsigned NewOpc = (IntNo == Intrinsic::arm_neon_vminu)
3375 case Intrinsic::arm_neon_vmins:
3376 case Intrinsic::arm_neon_vmaxs: {
3379 unsigned NewOpc = (IntNo == Intrinsic::arm_neon_vmins)
3384 unsigned NewOpc = (IntNo == Intrinsic::arm_neon_vmins)
3389 case Intrinsic::arm_neon_vtbl1:
3392 case Intrinsic::arm_neon_vtbl2:
3411 "Unexpected ISD::ATOMIC_FENCE encountered. Should be libcall!");
3444 unsigned isRead = ~cast<ConstantSDNode>(Op.
getOperand(2))->getZExtValue() & 1;
3450 unsigned isData = cast<ConstantSDNode>(Op.
getOperand(4))->getZExtValue();
3453 isRead = ~isRead & 1;
3454 isData = ~isData & 1;
3480 const SDLoc &dl)
const {
3486 RC = &ARM::tGPRRegClass;
3488 RC = &ARM::GPRRegClass;
3523 const Value *OrigArg,
3524 unsigned InRegsParamRecordIdx,
3525 int ArgOffset,
unsigned ArgSize)
const {
3540 unsigned RBegin, REnd;
3550 ArgOffset = -4 * (
ARM::R4 - RBegin);
3560 for (
unsigned Reg = RBegin, i = 0; Reg < REnd; ++
Reg, ++i) {
3569 if (!MemOps.
empty())
3578 unsigned TotalArgRegsSaveSize,
3579 bool ForceMutable)
const {
3588 int FrameIndex = StoreByValRegs(CCInfo, DAG, dl, Chain,
nullptr,
3594 SDValue ARMTargetLowering::LowerFormalArguments(
3612 unsigned CurArgIdx = 0;
3624 unsigned ArgRegBegin =
ARM::R4;
3625 for (
unsigned i = 0, e = ArgLocs.size(); i != e; ++i) {
3636 unsigned RBegin, REnd;
3638 ArgRegBegin =
std::min(ArgRegBegin, RBegin);
3644 int lastInsIndex = -1;
3651 unsigned TotalArgRegsSaveSize = 4 * (
ARM::R4 - ArgRegBegin);
3655 for (
unsigned i = 0, e = ArgLocs.size(); i != e; ++i) {
3657 if (Ins[VA.
getValNo()].isOrigArg()) {
3658 std::advance(CurOrigArg,
3659 Ins[VA.
getValNo()].getOrigArgIndex() - CurArgIdx);
3660 CurArgIdx = Ins[VA.
getValNo()].getOrigArgIndex();
3670 SDValue ArgValue1 = GetF64FormalArgument(VA, ArgLocs[++i],
3681 ArgValue2 = GetF64FormalArgument(VA, ArgLocs[++i],
3686 ArgValue, ArgValue1,
3689 ArgValue, ArgValue2,
3692 ArgValue = GetF64FormalArgument(VA, ArgLocs[++i], Chain, DAG, dl);
3698 RC = &ARM::SPRRegClass;
3700 RC = &ARM::DPRRegClass;
3702 RC = &ARM::QPRRegClass;
3705 : &ARM::GPRRegClass;
3746 if (index != lastInsIndex)
3755 assert(Ins[index].isOrigArg() &&
3756 "Byval arguments cannot be implicit");
3759 int FrameIndex = StoreByValRegs(
3760 CCInfo, DAG, dl, Chain, &*CurOrigArg, CurByValIndex,
3775 lastInsIndex = index;
3782 VarArgStyleRegisters(CCInfo, DAG, dl, Chain,
3784 TotalArgRegsSaveSize);
3794 return CFP->getValueAPF().isPosZero();
3801 return CFP->getValueAPF().isPosZero();
3819 const SDLoc &dl)
const {
3821 unsigned C = RHSC->getZExtValue();
3877 bool InvalidOnQNaN)
const {
3911 std::pair<SDValue, SDValue>
3951 return std::make_pair(Value, OverflowCmp);
3962 std::tie(Value, OverflowCmp) = getARMXALUOOp(Op, DAG, ARMcc);
3971 ARMcc, CCR, OverflowCmp);
3992 std::tie(Value, OverflowCmp) = getARMXALUOOp(Cond, DAG, ARMcc);
3996 return getCMOV(dl, VT, SelectTrue, SelectFalse, ARMcc, CCR,
4011 if (CMOVTrue && CMOVFalse) {
4013 unsigned CMOVFalseVal = CMOVFalse->getZExtValue();
4017 if (CMOVTrueVal == 1 && CMOVFalseVal == 0) {
4019 False = SelectFalse;
4020 }
else if (CMOVTrueVal == 0 && CMOVFalseVal == 1) {
4031 return getCMOV(dl, VT, True, False, ARMcc, CCR, Cmp, DAG);
4047 bool &swpCmpOps,
bool &swpVselOps) {
4075 swpCmpOps = !swpCmpOps;
4076 swpVselOps = !swpVselOps;
4112 ARMcc, CCR, duplicateCmp(Cmp, DAG));
4139 ((K == LHS && K == TrueVal) || (K == RHS && K == FalseVal))) ||
4141 ((K == RHS && K == TrueVal) || (K == LHS && K == FalseVal)));
4149 ((K == RHS && K == TrueVal) || (K == LHS && K == FalseVal))) ||
4151 ((K == LHS && K == TrueVal) || (K == RHS && K == FalseVal)));
4175 const SDValue Op2 = isa<ConstantSDNode>(TrueVal1) ? FalseVal1 : TrueVal1;
4187 SDValue *K1 = isa<ConstantSDNode>(LHS1) ? &LHS1 : isa<ConstantSDNode>(RHS1)
4190 SDValue *K2 = isa<ConstantSDNode>(LHS2) ? &LHS2 : isa<ConstantSDNode>(RHS2)
4193 SDValue K2Tmp = isa<ConstantSDNode>(TrueVal2) ? TrueVal2 : FalseVal2;
4194 SDValue V1Tmp = (K1 && *K1 == LHS1) ? RHS1 : LHS1;
4195 SDValue V2Tmp = (K2 && *K2 == LHS2) ? RHS2 : LHS2;
4196 SDValue V2 = (K2Tmp == TrueVal2) ? FalseVal2 : TrueVal2;
4208 if (!K1 || !K2 || *K1 == Op2 || *K2 != K2Tmp || V1Tmp != V2Tmp ||
4226 if (!UpperCheckOp || !LowerCheckOp || LowerCheckOp == UpperCheckOp)
4232 int64_t Val1 = cast<ConstantSDNode>(*K1)->getSExtValue();
4233 int64_t Val2 = cast<ConstantSDNode>(*K2)->getSExtValue();
4234 int64_t PosVal =
std::max(Val1, Val2);
4236 if (((Val1 > Val2 && UpperCheckOp == &Op) ||
4237 (Val1 < Val2 && UpperCheckOp == &Op2)) &&
4241 K = (uint64_t)PosVal;
4254 uint64_t SatConstant;
4301 SDValue Cmp = getARMCmp(LHS, RHS, CC, ARMcc, DAG, dl);
4302 return getCMOV(dl, VT, FalseVal, TrueVal, ARMcc, CCR, Cmp, DAG);
4307 FPCCToARMCC(CC, CondCode, CondCode2, InvalidOnQNaN);
4312 bool swpCmpOps =
false;
4313 bool swpVselOps =
false;
4326 SDValue Cmp = getVFPCmp(LHS, RHS, DAG, dl, InvalidOnQNaN);
4328 SDValue Result = getCMOV(dl, VT, FalseVal, TrueVal, ARMcc, CCR, Cmp, DAG);
4332 SDValue Cmp2 = getVFPCmp(LHS, RHS, DAG, dl, InvalidOnQNaN);
4333 Result = getCMOV(dl, VT, Result, TrueVal, ARMcc2, CCR, Cmp2, DAG);
4365 if (
LoadSDNode *Ld = dyn_cast<LoadSDNode>(Op))
4367 Ld->getPointerInfo(), Ld->getAlignment(),
4368 Ld->getMemOperand()->getFlags());
4383 if (
LoadSDNode *Ld = dyn_cast<LoadSDNode>(Op)) {
4387 Ld->getAlignment(), Ld->getMemOperand()->getFlags());
4390 unsigned NewAlign =
MinAlign(Ld->getAlignment(), 4);
4394 Ld->getPointerInfo().getWithOffset(4), NewAlign,
4395 Ld->getMemOperand()->getFlags());
4413 bool LHSSeenZero =
false;
4415 bool RHSSeenZero =
false;
4417 if (LHSOk && RHSOk && (LHSSeenZero || RHSSeenZero)) {
4433 SDValue Cmp = getARMCmp(LHS, RHS, CC, ARMcc, DAG, dl);
4436 Chain, Dest, ARMcc, CCR, Cmp);
4448 SDValue Ops[] = { Chain, ARMcc, LHS1, LHS2, RHS1, RHS2, Dest };
4477 SDValue Cmp = getARMCmp(LHS, RHS, CC, ARMcc, DAG, dl);
4480 Chain, Dest, ARMcc, CCR, Cmp);
4488 if (
SDValue Result = OptimizeVFPBrcond(Op, DAG))
4494 FPCCToARMCC(CC, CondCode, CondCode2, InvalidOnQNaN);
4497 SDValue Cmp = getVFPCmp(LHS, RHS, DAG, dl, InvalidOnQNaN);
4500 SDValue Ops[] = { Chain, Dest, ARMcc, CCR, Cmp };
4539 DAG.
getLoad(PTy, dl, Chain, Addr,
4557 "Invalid type for custom lowering!");
4578 false,
SDLoc(Op)).first;
4595 "Invalid type for custom lowering!");
4614 return DAG.
getNode(Opc, dl, VT, Op);
4630 false,
SDLoc(Op)).first;
4645 bool UseNEON = !InGPR && Subtarget->
hasNEON();
4728 unsigned Depth = cast<ConstantSDNode>(Op.
getOperand(0))->getZExtValue();
4730 SDValue FrameAddr = LowerFRAMEADDR(Op, DAG);
4751 unsigned Depth = cast<ConstantSDNode>(Op.
getOperand(0))->getZExtValue();
4762 unsigned ARMTargetLowering::getRegisterByName(
const char* RegName,
EVT VT,
4765 .Case(
"sp", ARM::SP)
4781 &&
"ExpandREAD_REGISTER called for non-i64 type result.");
4826 NewIndex *= APIntIndex;
4828 if (NewIndex.getBitWidth() > 32)
4858 "ExpandBITCAST called for non-i64 type");
4932 SDValue LoBigShift = DAG.
getNode(Opc, dl, VT, ShOpHi, ExtraShAmt);
4941 ? DAG.getNode(Opc, dl, VT, ShOpHi,
4942 DAG.getConstant(VTBits - 1, dl, VT))
4943 : DAG.getConstant(0, dl, VT);
4944 SDValue CmpHi = getARMCmp(ExtraShAmt, DAG.getConstant(0, dl, MVT::i32),
4950 return DAG.getMergeValues(Ops, dl);
4959 unsigned VTBits = VT.getSizeInBits();
4982 SDValue CmpLo = getARMCmp(ExtraShAmt, DAG.getConstant(0, dl, MVT::i32),
4986 DAG.getConstant(0, dl, VT), ARMcc, CCR, CmpLo);
4989 return DAG.getMergeValues(Ops, dl);
5000 DAG.
getConstant(Intrinsic::arm_get_fpscr, dl, MVT::i32) };
5033 if ((ElemTy ==
MVT::i16 || ElemTy == MVT::i32) &&
5080 if (ElemTy == MVT::i32)
5194 assert(ST->
hasNEON() &&
"Custom ctpop lowering requires NEON.");
5197 "Unexpected type for custom ctpop lowering");
5234 Intrinsic::arm_neon_vshifts :
5235 Intrinsic::arm_neon_vshiftu);
5251 "Unknown shift to lower!");
5280 bool Invert =
false;
5289 ISD::CondCode SetCCOpcode = cast<CondCodeSDNode>(CC)->
get();
5306 Merged = DAG.
getNOT(dl, Merged, CmpVT);
5316 switch (SetCCOpcode) {
5357 switch (SetCCOpcode) {
5423 Result = DAG.
getNode(Opc, dl, CmpVT, Op0, Op1);
5426 Result = DAG.
getNode(Opc, dl, CmpVT, Op0, Op1);
5432 Result = DAG.
getNOT(dl, Result, VT);
5453 IntCCToARMCC(cast<CondCodeSDNode>(Cond)->
get()), DL, MVT::i32);
5466 const SDLoc &dl,
EVT &VT,
bool is128Bits,
5468 unsigned OpCmode, Imm;
5478 switch (SplatBitSize) {
5483 assert((SplatBits & ~0xff) == 0 &&
"one byte splat value is too big");
5492 if ((SplatBits & ~0xff) == 0) {
5498 if ((SplatBits & ~0xff00) == 0) {
5501 Imm = SplatBits >> 8;
5512 if ((SplatBits & ~0xff) == 0) {
5518 if ((SplatBits & ~0xff00) == 0) {
5521 Imm = SplatBits >> 8;
5524 if ((SplatBits & ~0xff0000) == 0) {
5527 Imm = SplatBits >> 16;
5530 if ((SplatBits & ~0xff000000) == 0) {
5533 Imm = SplatBits >> 24;
5540 if ((SplatBits & ~0xffff) == 0 &&
5541 ((SplatBits | SplatUndef) & 0xff) == 0xff) {
5544 Imm = SplatBits >> 8;
5548 if ((SplatBits & ~0xffffff) == 0 &&
5549 ((SplatBits | SplatUndef) & 0xffff) == 0xffff) {
5552 Imm = SplatBits >> 16;
5567 uint64_t BitMask = 0xff;
5571 for (
int ByteNum = 0; ByteNum < 8; ++ByteNum) {
5572 if (((SplatBits | SplatUndef) & BitMask) == BitMask) {
5575 }
else if ((SplatBits & BitMask) != 0) {
5584 Imm = ((Imm & 0xf) << 4) | ((Imm & 0xf0) >> 4);
5609 APInt INTVal = FPVal.bitcastToAPInt();
5656 uint64_t iVal = FPVal.bitcastToAPInt().getZExtValue();
5661 if (IsDouble && (iVal & 0xffffffff) != (iVal >> 32))
5715 unsigned ExpectedElt = Imm;
5716 for (
unsigned i = 1; i < NumElts; ++i) {
5720 if (ExpectedElt == NumElts)
5723 if (M[i] < 0)
continue;
5724 if (ExpectedElt != static_cast<unsigned>(M[i]))
5732 bool &ReverseVEXT,
unsigned &Imm) {
5734 ReverseVEXT =
false;
5745 unsigned ExpectedElt = Imm;
5746 for (
unsigned i = 1; i < NumElts; ++i) {
5750 if (ExpectedElt == NumElts * 2) {
5755 if (M[i] < 0)
continue;
5756 if (ExpectedElt != static_cast<unsigned>(M[i]))
5771 assert((BlockSize==16 || BlockSize==32 || BlockSize==64) &&
5772 "Only possible block sizes for VREV are: 16, 32, 64");
5779 unsigned BlockElts = M[0] + 1;
5782 BlockElts = BlockSize / EltSz;
5784 if (BlockSize <= EltSz || BlockSize != BlockElts * EltSz)
5787 for (
unsigned i = 0; i < NumElts; ++i) {
5788 if (M[i] < 0)
continue;
5789 if ((
unsigned) M[i] != (i - i%BlockElts) + (BlockElts - 1 - i%BlockElts))
5830 if (M.
size() != NumElts && M.
size() != NumElts*2)
5838 for (
unsigned i = 0; i < M.
size(); i += NumElts) {
5839 if (M.
size() == NumElts * 2)
5840 WhichResult = i / NumElts;
5842 WhichResult = M[i] == 0 ? 0 : 1;
5843 for (
unsigned j = 0; j < NumElts; j += 2) {
5844 if ((M[i+j] >= 0 && (
unsigned) M[i+j] != j + WhichResult) ||
5845 (M[i+j+1] >= 0 && (
unsigned) M[i+j+1] != j + NumElts + WhichResult))
5850 if (M.
size() == NumElts*2)
5865 if (M.
size() != NumElts && M.
size() != NumElts*2)
5868 for (
unsigned i = 0; i < M.
size(); i += NumElts) {
5869 if (M.
size() == NumElts * 2)
5870 WhichResult = i / NumElts;
5872 WhichResult = M[i] == 0 ? 0 : 1;
5873 for (
unsigned j = 0; j < NumElts; j += 2) {
5874 if ((M[i+j] >= 0 && (
unsigned) M[i+j] != j + WhichResult) ||
5875 (M[i+j+1] >= 0 && (
unsigned) M[i+j+1] != j + WhichResult))
5880 if (M.
size() == NumElts*2)
5900 if (M.
size() != NumElts && M.
size() != NumElts*2)
5903 for (
unsigned i = 0; i < M.
size(); i += NumElts) {
5904 if (M.
size() == NumElts * 2)
5905 WhichResult = i / NumElts;
5907 WhichResult = M[i] == 0 ? 0 : 1;
5908 for (
unsigned j = 0; j < NumElts; ++j) {
5909 if (M[i+j] >= 0 && (
unsigned) M[i+j] != 2 * j + WhichResult)
5914 if (M.
size() == NumElts*2)
5933 if (M.
size() != NumElts && M.
size() != NumElts*2)
5936 unsigned Half = NumElts / 2;
5937 for (
unsigned i = 0; i < M.
size(); i += NumElts) {
5938 if (M.
size() == NumElts * 2)
5939 WhichResult = i / NumElts;
5941 WhichResult = M[i] == 0 ? 0 : 1;
5942 for (
unsigned j = 0; j < NumElts; j += Half) {
5943 unsigned Idx = WhichResult;
5944 for (
unsigned k = 0; k < Half; ++k) {
5945 int MIdx = M[i + j + k];
5946 if (MIdx >= 0 && (
unsigned) MIdx != Idx)
5953 if (M.
size() == NumElts*2)
5977 if (M.
size() != NumElts && M.
size() != NumElts*2)
5980 for (
unsigned i = 0; i < M.
size(); i += NumElts) {
5981 if (M.
size() == NumElts * 2)
5982 WhichResult = i / NumElts;
5984 WhichResult = M[i] == 0 ? 0 : 1;
5985 unsigned Idx = WhichResult * NumElts / 2;
5986 for (
unsigned j = 0; j < NumElts; j += 2) {
5987 if ((M[i+j] >= 0 && (
unsigned) M[i+j] != Idx) ||
5988 (M[i+j+1] >= 0 && (
unsigned) M[i+j+1] != Idx + NumElts))
5994 if (M.
size() == NumElts*2)
6013 if (M.
size() != NumElts && M.
size() != NumElts*2)
6016 for (
unsigned i = 0; i < M.
size(); i += NumElts) {
6017 if (M.
size() == NumElts * 2)
6018 WhichResult = i / NumElts;
6020 WhichResult = M[i] == 0 ? 0 : 1;
6021 unsigned Idx = WhichResult * NumElts / 2;
6022 for (
unsigned j = 0; j < NumElts; j += 2) {
6023 if ((M[i+j] >= 0 && (
unsigned) M[i+j] != Idx) ||
6024 (M[i+j+1] >= 0 && (
unsigned) M[i+j+1] != Idx))
6030 if (M.
size() == NumElts*2)
6043 unsigned &WhichResult,
6046 if (
isVTRNMask(ShuffleMask, VT, WhichResult))
6048 if (
isVUZPMask(ShuffleMask, VT, WhichResult))
6050 if (
isVZIPMask(ShuffleMask, VT, WhichResult))
6068 if (NumElts != M.
size())
6072 for (
unsigned i = 0; i != NumElts; ++i)
6073 if (M[i] >= 0 && M[i] != (
int) (NumElts - 1 - i))
6085 if (!isa<ConstantSDNode>(N))
6087 Val = cast<ConstantSDNode>(
N)->getZExtValue();
6090 if (Val <= 255 || ~Val <= 255)
6107 APInt SplatBits, SplatUndef;
6108 unsigned SplatBitSize;
6110 if (BVN->
isConstantSplat(SplatBits, SplatUndef, SplatBitSize, HasAnyUndefs)) {
6114 if (SplatBitSize <= 64) {
6127 uint64_t NegatedImm = (~SplatBits).getZExtValue();
6141 SDValue Val = DAG.getTargetConstant(ImmVal, dl, MVT::i32);
6156 bool isOnlyLowElement =
true;
6157 bool usesOnlyOneValue =
true;
6158 bool hasDominantValue =
false;
6165 for (
unsigned i = 0; i < NumElts; ++i) {
6170 isOnlyLowElement =
false;
6171 if (!isa<ConstantFPSDNode>(V) && !isa<ConstantSDNode>(V))
6174 ValueCounts.
insert(std::make_pair(V, 0));
6175 unsigned &Count = ValueCounts[V];
6178 if (++Count > (NumElts / 2)) {
6179 hasDominantValue =
true;
6183 if (ValueCounts.
size() != 1)
6184 usesOnlyOneValue =
false;
6186 Value = ValueCounts.
begin()->first;
6188 if (ValueCounts.
empty())
6189 return DAG.getUNDEF(VT);
6200 if (hasDominantValue && EltSize <= 32) {
6221 Value, DAG.getConstant(index, dl, MVT::i32)),
6222 DAG.getConstant(index, dl, MVT::i32));
6229 if (!usesOnlyOneValue) {
6232 for (
unsigned I = 0; I < NumElts; ++
I) {
6238 Ops.
push_back(DAG.getConstant(I, dl, MVT::i32));
6246 for (
unsigned i = 0; i < NumElts; ++i)
6250 SDValue Val = DAG.getBuildVector(VecVT, dl, Ops);
6251 Val = LowerBUILD_VECTOR(Val, DAG, ST);
6255 if (usesOnlyOneValue) {
6257 if (isConstant && Val.
getNode())
6270 SDValue shuffle = ReconstructShuffle(Op, DAG);
6282 DAG.getBuildVector(HVT, dl,
makeArrayRef(&Ops[0], NumElts / 2));
6284 Lower = LowerBUILD_VECTOR(Lower, DAG, ST);
6286 HVT, dl,
makeArrayRef(&Ops[NumElts / 2], NumElts / 2));
6288 Upper = LowerBUILD_VECTOR(Upper, DAG, ST);
6296 if (EltSize >= 32) {
6302 for (
unsigned i = 0; i < NumElts; ++i)
6314 if (!isConstant && !usesOnlyOneValue) {
6315 SDValue Vec = DAG.getUNDEF(VT);
6316 for (
unsigned i = 0 ; i < NumElts; ++i) {
6320 SDValue LaneIdx = DAG.getConstant(i, dl, MVT::i32);
6338 struct ShuffleSourceInfo {
6341 unsigned MaxElt = 0;
6351 int WindowScale = 1;
6353 ShuffleSourceInfo(
SDValue Vec) : Vec(Vec), ShuffleVec(Vec) {}
6361 for (
unsigned i = 0; i < NumElts; ++i) {
6369 }
else if (!isa<ConstantSDNode>(V.
getOperand(1))) {
6382 unsigned EltNo = cast<ConstantSDNode>(V.
getOperand(1))->getZExtValue();
6389 if (Sources.
size() > 2)
6395 for (
auto &
Source : Sources) {
6396 EVT SrcEltTy =
Source.Vec.getValueType().getVectorElementType();
6397 if (SrcEltTy.
bitsLT(SmallestEltTy))
6398 SmallestEltTy = SrcEltTy;
6400 unsigned ResMultiplier =
6408 for (
auto &Src : Sources) {
6434 if (Src.MaxElt - Src.MinElt >= NumSrcElts) {
6439 if (Src.MinElt >= NumSrcElts) {
6444 Src.WindowBase = -NumSrcElts;
6445 }
else if (Src.MaxElt < NumSrcElts) {
6462 Src.WindowBase = -Src.MinElt;
6469 for (
auto &Src : Sources) {
6471 if (SrcEltTy == SmallestEltTy)
6476 Src.WindowBase *= Src.WindowScale;
6481 for (
auto Src : Sources)
6494 int EltNo = cast<ConstantSDNode>(Entry.
getOperand(1))->getSExtValue();
6502 int LanesDefined = BitsDefined / BitsPerShuffleLane;
6506 int *LaneMask = &Mask[i * ResMultiplier];
6508 int ExtractBase = EltNo * Src->WindowScale + Src->WindowBase;
6509 ExtractBase += NumElts * (Src - Sources.begin());
6510 for (
int j = 0; j < LanesDefined; ++j)
6511 LaneMask[j] = ExtractBase + j;
6520 assert(Sources.size() <= 2 &&
"Too many sources!");
6523 for (
unsigned i = 0; i < Sources.size(); ++i)
6524 ShuffleOps[i] = Sources[i].ShuffleVec;
6527 ShuffleOps[1], Mask);
6540 unsigned PFIndexes[4];
6541 for (
unsigned i = 0; i != 4; ++i) {
6545 PFIndexes[i] = M[i];
6549 unsigned PFTableIndex =
6550 PFIndexes[0]*9*9*9+PFIndexes[1]*9*9+PFIndexes[2]*9+PFIndexes[3];
6552 unsigned Cost = (PFEntry >> 30);
6558 bool ReverseVEXT, isV_UNDEF;
6559 unsigned Imm, WhichResult;
6562 return (EltSize >= 32 ||
6578 unsigned OpNum = (PFEntry >> 26) & 0x0F;
6579 unsigned LHSID = (PFEntry >> 13) & ((1 << 13)-1);
6580 unsigned RHSID = (PFEntry >> 0) & ((1 << 13)-1);
6600 if (OpNum == OP_COPY) {
6601 if (LHSID == (1*9+2)*9+3)
return LHS;
6602 assert(LHSID == ((4*9+5)*9+6)*9+7 &&
"Illegal OP_COPY!");
6629 OpLHS, DAG.
getConstant(OpNum-OP_VDUP0, dl, MVT::i32));
6635 DAG.
getConstant(OpNum - OP_VEXT1 + 1, dl, MVT::i32));
6639 OpLHS, OpRHS).getValue(OpNum-OP_VUZPL);
6643 OpLHS, OpRHS).getValue(OpNum-OP_VZIPL);
6647 OpLHS, OpRHS).getValue(OpNum-OP_VTRNL);
6661 I = ShuffleMask.
begin(),
E = ShuffleMask.
end(); I !=
E; ++
I)
6679 "Expect an v8i16/v16i8 type");
6684 unsigned ExtractNum = (VT ==
MVT::v16i8) ? 8 : 4;
6705 if (EltSize <= 32) {
6709 if (Lane == -1) Lane = 0;
6720 bool IsScalarToVector =
true;
6723 IsScalarToVector =
false;
6726 if (IsScalarToVector)
6735 if (
isVEXTMask(ShuffleMask, VT, ReverseVEXT, Imm)) {
6759 unsigned WhichResult;
6762 ShuffleMask, VT, WhichResult, isV_UNDEF)) {
6766 .getValue(WhichResult);
6792 }) &&
"Unexpected shuffle index into UNDEF operand!");
6795 ShuffleMask, SubVT, WhichResult, isV_UNDEF)) {
6798 assert((WhichResult == 0) &&
6799 "In-place shuffle of concat can only have one result!");
6812 unsigned PFIndexes[4];
6813 for (
unsigned i = 0; i != 4; ++i) {
6814 if (ShuffleMask[i] < 0)
6817 PFIndexes[i] = ShuffleMask[i];
6821 unsigned PFTableIndex =
6822 PFIndexes[0]*9*9*9+PFIndexes[1]*9*9+PFIndexes[2]*9+PFIndexes[3];
6824 unsigned Cost = (PFEntry >> 30);
6831 if (EltSize >= 32) {
6839 for (
unsigned i = 0; i < NumElts; ++i) {
6840 if (ShuffleMask[i] < 0)
6844 ShuffleMask[i] < (
int)NumElts ? V1 : V2,
6865 if (!isa<ConstantSDNode>(Lane))
6874 if (!isa<ConstantSDNode>(Lane))
6890 "unexpected CONCAT_VECTORS");
6919 unsigned HiElt = 1 - LoElt;
6924 if (!Lo0 || !Hi0 || !Lo1 || !Hi1)
6927 if (Hi0->getSExtValue() == Lo0->
getSExtValue() >> 32 &&
6928 Hi1->getSExtValue() == Lo1->getSExtValue() >> 32)
6931 if (Hi0->isNullValue() && Hi1->isNullValue())
6944 unsigned HalfSize = EltSize / 2;
6946 if (!
isIntN(HalfSize, C->getSExtValue()))
6949 if (!
isUIntN(HalfSize, C->getZExtValue()))
6987 switch (OrigSimpleTy) {
7003 unsigned ExtOpcode) {
7055 "Expected extending load");
7061 DAG.
getNode(Opcode,
SDLoc(newLoad),
LD->getValueType(0), newLoad);
7081 unsigned EltSize = VT.getScalarSizeInBits() / 2;
7082 unsigned NumElts = VT.getVectorNumElements();
7086 for (
unsigned i = 0; i != NumElts; ++i) {
7123 "unexpected type for custom-lowering ISD::MUL");
7126 unsigned NewOpc = 0;
7130 if (isN0SExt && isN1SExt)
7135 if (isN0ZExt && isN1ZExt)
7137 else if (isN1SExt || isN1ZExt) {
7171 "unexpected types for extended operands to VMULL");
7172 return DAG.
getNode(NewOpc, DL, VT, Op0, Op1);
7186 return DAG.
getNode(N0->getOpcode(),
DL, VT,
7207 DAG.
getConstant(Intrinsic::arm_neon_vrecpe, dl, MVT::i32),
7241 DAG.
getConstant(Intrinsic::arm_neon_vrecpe, dl, MVT::i32),
7244 DAG.
getConstant(Intrinsic::arm_neon_vrecps, dl, MVT::i32),
7266 "unexpected type for custom-lowering ISD::SDIV");
7302 "unexpected type for custom-lowering ISD::UDIV");
7348 DAG.
getConstant(Intrinsic::arm_neon_vrecpe, dl, MVT::i32),
7351 DAG.
getConstant(Intrinsic::arm_neon_vrecps, dl, MVT::i32),
7355 DAG.
getConstant(Intrinsic::arm_neon_vrecps, dl, MVT::i32),
7379 bool ExtraOp =
false;
7414 bool ShouldUseSRet = Subtarget->
isAPCS_ABI();
7416 if (ShouldUseSRet) {
7420 int FrameIdx = MFI.CreateStackObject(ByteSize, StackAlign,
false);
7426 Entry.IsSExt =
false;
7427 Entry.IsZExt =
false;
7428 Entry.IsSRet =
true;
7429 Args.push_back(Entry);
7436 Entry.IsSExt =
false;
7437 Entry.IsZExt =
false;
7438 Args.push_back(Entry);
7440 const char *LibcallName =
7441 (ArgVT ==
MVT::f64) ?
"__sincos_stret" :
"__sincosf_stret";
7450 .setCallee(CC, RetTy, Callee, std::move(Args))
7451 .setDiscardResult(ShouldUseSRet);
7452 std::pair<SDValue, SDValue> CallResult =
LowerCallTo(CLI);
7455 return CallResult.first;
7476 "unexpected type for custom lowering DIV");
7482 const char *
Name =
nullptr;
7484 Name = (VT ==
MVT::i32) ?
"__rt_sdiv" :
"__rt_sdiv64";
7486 Name = (VT ==
MVT::i32) ?
"__rt_udiv" :
"__rt_udiv64";
7492 for (
auto AI : {1, 0}) {
7496 Args.push_back(Arg);
7499 CallLoweringInfo CLI(DAG);
7503 ES, std::move(Args));
7509 bool Signed)
const {
7511 "unexpected type for custom lowering DIV");
7517 return LowerWindowsDIVLibCall(Op, DAG, Signed, DBZCHK);
7533 void ARMTargetLowering::ExpandDIV_Windows(
7540 "unexpected type for custom lowering DIV");
7545 SDValue Result = LowerWindowsDIVLibCall(Op, DAG, Signed, DBZCHK);
7574 DAG.
getConstant(Intrinsic::arm_mrc, DL, MVT::i32),
7602 const SDValue Ops[] = { RegClass, VLo, SubReg0, VHi, SubReg1 };
7611 "AtomicCmpSwap on types less than 64 should be legal");
7617 ARM::CMP_SWAP_64,
SDLoc(N),
7622 MemOp[0] = cast<MemSDNode>(
N)->getMemOperand();
7623 cast<MachineSDNode>(CmpSwap)->setMemRefs(MemOp, MemOp + 1);
7641 "Custom lowering is MSVCRT specific!");
7651 TargetLowering::ArgListEntry Entry;
7655 Entry.IsZExt =
true;
7656 Args.push_back(Entry);
7658 Entry.Node = Exponent;
7660 Entry.IsZExt =
true;
7661 Args.push_back(Entry);
7673 F->getReturnType() == LCRTy;
7682 std::pair<SDValue, SDValue> CI = TLI.
LowerCallTo(CLI);
7685 return !CI.second.getNode() ? DAG.
getRoot() : CI.first;
7739 return LowerDIV_Windows(Op, DAG,
true);
7743 return LowerDIV_Windows(Op, DAG,
false);
7753 return LowerXALUO(Op, DAG);
7761 return LowerDYNAMIC_STACKALLOC(Op, DAG);
7772 unsigned IntNo = cast<ConstantSDNode>(N->
getOperand(0))->getZExtValue();
7774 if (IntNo == Intrinsic::arm_smlald)
7776 else if (IntNo == Intrinsic::arm_smlaldx)
7778 else if (IntNo == Intrinsic::arm_smlsld)
7780 else if (IntNo == Intrinsic::arm_smlsldx)
7822 Res = LowerREM(N, DAG);
7826 Res = LowerDivRem(
SDValue(N, 0), DAG);
7860 "ROPI/RWPI not currently supported with SjLj");
7870 bool isThumb2 = Subtarget->
isThumb2();
7873 unsigned PCAdj = (isThumb || isThumb2) ? 4 : 8;
7879 : &ARM::GPRRegClass;
7898 BuildMI(*MBB, MI, dl, TII->
get(ARM::t2LDRpci), NewVReg1)
7899 .addConstantPoolIndex(CPI)
7904 BuildMI(*MBB, MI, dl, TII->
get(ARM::t2ORRri), NewVReg2)
7910 BuildMI(*MBB, MI, dl, TII->
get(ARM::tPICADD), NewVReg3)
7913 BuildMI(*MBB, MI, dl, TII->
get(ARM::t2STRi12))
7919 }
else if (isThumb) {
7928 BuildMI(*MBB, MI, dl, TII->
get(ARM::tLDRpci), NewVReg1)
7929 .addConstantPoolIndex(CPI)
7933 BuildMI(*MBB, MI, dl, TII->
get(ARM::tPICADD), NewVReg2)
7938 BuildMI(*MBB, MI, dl, TII->
get(ARM::tMOVi8), NewVReg3)
7943 BuildMI(*MBB, MI, dl, TII->
get(ARM::tORR), NewVReg4)
7949 BuildMI(*MBB, MI, dl, TII->
get(ARM::tADDframe), NewVReg5)
7964 BuildMI(*MBB, MI, dl, TII->
get(ARM::LDRi12), NewVReg1)
7965 .addConstantPoolIndex(CPI)
7970 BuildMI(*MBB, MI, dl, TII->
get(ARM::PICADD), NewVReg2)
7983 void ARMTargetLowering::EmitSjLjDispatchBlock(
MachineInstr &MI,
7993 : &ARM::GPRnopcRegClass;
7998 unsigned MaxCSNum = 0;
8001 if (!BB->isEHPad())
continue;
8006 II = BB->begin(),
IE = BB->end(); II !=
IE; ++II) {
8007 if (!II->isEHLabel())
continue;
8009 MCSymbol *Sym = II->getOperand(0).getMCSymbol();
8014 CSI = CallSiteIdxs.
begin(),
CSE = CallSiteIdxs.
end();
8015 CSI !=
CSE; ++CSI) {
8016 CallSiteNumToLPad[*CSI].push_back(&*BB);
8017 MaxCSNum =
std::max(MaxCSNum, *CSI);
8024 std::vector<MachineBasicBlock*> LPadList;
8026 LPadList.reserve(CallSiteNumToLPad.
size());
8027 for (
unsigned I = 1; I <= MaxCSNum; ++
I) {
8030 II = MBBList.
begin(),
IE = MBBList.
end(); II !=
IE; ++II) {
8031 LPadList.push_back(*II);
8032 InvokeBBs.
insert((*II)->pred_begin(), (*II)->pred_end());
8036 assert(!LPadList.empty() &&
8037 "No landing pad destinations for the dispatch jump table!");
8051 unsigned trap_opcode;
8053 trap_opcode = ARM::tTRAP;
8070 SetupEntryBlockForSjLj(MI, MBB, DispatchBB, FI);
8077 MIB =
BuildMI(DispatchBB, dl, TII->
get(ARM::Int_eh_sjlj_dispatchsetup));
8089 unsigned NumLPads = LPadList.size();
8092 BuildMI(DispatchBB, dl, TII->
get(ARM::t2LDRi12), NewVReg1)
8098 if (NumLPads < 256) {
8099 BuildMI(DispatchBB, dl, TII->
get(ARM::t2CMPri))
8105 BuildMI(DispatchBB, dl, TII->
get(ARM::t2MOVi16), VReg1)
8106 .addImm(NumLPads & 0xFFFF)
8109 unsigned VReg2 = VReg1;
8110 if ((NumLPads & 0xFFFF0000) != 0) {
8112 BuildMI(DispatchBB, dl, TII->
get(ARM::t2MOVTi16), VReg2)
8118 BuildMI(DispatchBB, dl, TII->
get(ARM::t2CMPrr))
8124 BuildMI(DispatchBB, dl, TII->
get(ARM::t2Bcc))
8130 BuildMI(DispContBB, dl, TII->
get(ARM::t2LEApcrelJT), NewVReg3)
8131 .addJumpTableIndex(MJTI)
8135 BuildMI(DispContBB, dl, TII->
get(ARM::t2ADDrs), NewVReg4)
8142 BuildMI(DispContBB, dl, TII->
get(ARM::t2BR_JT))
8146 }
else if (Subtarget->
isThumb()) {
8148 BuildMI(DispatchBB, dl, TII->
get(ARM::tLDRspi), NewVReg1)
8154 if (NumLPads < 256) {
8155 BuildMI(DispatchBB, dl, TII->
get(ARM::tCMPi8))
8171 BuildMI(DispatchBB, dl, TII->
get(ARM::tLDRpci))
8175 BuildMI(DispatchBB, dl, TII->
get(ARM::tCMPr))
8187 BuildMI(DispContBB, dl, TII->
get(ARM::tLSLri), NewVReg2)
8194 BuildMI(DispContBB, dl, TII->
get(ARM::tLEApcrelJT), NewVReg3)
8195 .addJumpTableIndex(MJTI)
8199 BuildMI(DispContBB, dl, TII->
get(ARM::tADDrr), NewVReg4)
8209 BuildMI(DispContBB, dl, TII->
get(ARM::tLDRi), NewVReg5)
8215 unsigned NewVReg6 = NewVReg5;
8216 if (IsPositionIndependent) {
8218 BuildMI(DispContBB, dl, TII->
get(ARM::tADDrr), NewVReg6)
8225 BuildMI(DispContBB, dl, TII->
get(ARM::tBR_JTr))
8230 BuildMI(DispatchBB, dl, TII->
get(ARM::LDRi12), NewVReg1)
8236 if (NumLPads < 256) {
8237 BuildMI(DispatchBB, dl, TII->
get(ARM::CMPri))
8243 BuildMI(DispatchBB, dl, TII->
get(ARM::MOVi16), VReg1)
8244 .addImm(NumLPads & 0xFFFF)
8247 unsigned VReg2 = VReg1;
8248 if ((NumLPads & 0xFFFF0000) != 0) {
8250 BuildMI(DispatchBB, dl, TII->
get(ARM::MOVTi16), VReg2)
8256 BuildMI(DispatchBB, dl, TII->
get(ARM::CMPrr))
8272 BuildMI(DispatchBB, dl, TII->
get(ARM::LDRcp))
8277 BuildMI(DispatchBB, dl, TII->
get(ARM::CMPrr))
8289 BuildMI(DispContBB, dl, TII->
get(ARM::MOVsi), NewVReg3)
8295 BuildMI(DispContBB, dl, TII->
get(ARM::LEApcrelJT), NewVReg4)
8296 .addJumpTableIndex(MJTI)
8302 BuildMI(DispContBB, dl, TII->
get(ARM::LDRrs), NewVReg5)
8309 if (IsPositionIndependent) {
8310 BuildMI(DispContBB, dl, TII->
get(ARM::BR_JTadd))
8315 BuildMI(DispContBB, dl, TII->
get(ARM::BR_JTr))
8323 for (std::vector<MachineBasicBlock*>::iterator
8324 I = LPadList.begin(),
E = LPadList.end(); I !=
E; ++
I) {
8326 if (SeenMBBs.
insert(CurMBB).second)
8339 while (!Successors.empty()) {
8348 BB->normalizeSuccProbs();
8355 II = BB->rbegin(),
IE = BB->rend(); II !=
IE; ++II) {
8356 if (!II->isCall())
continue;
8360 OI = II->operands_begin(), OE = II->operands_end();
8362 if (!OI->isReg())
continue;
8363 DefRegs[OI->getReg()] =
true;
8368 for (
unsigned i = 0; SavedRegs[i] != 0; ++i) {
8369 unsigned Reg = SavedRegs[i];
8371 !ARM::tGPRRegClass.contains(Reg) &&
8372 !ARM::hGPRRegClass.contains(Reg))
8374 if (Subtarget->
isThumb1Only() && !ARM::tGPRRegClass.contains(Reg))
8376 if (!Subtarget->
isThumb() && !ARM::GPRRegClass.contains(Reg))
8389 I = MBBLPads.
begin(),
E = MBBLPads.
end(); I !=
E; ++
I)
8390 (*I)->setIsEHPad(
false);
8407 static unsigned getLdOpcode(
unsigned LdSize,
bool IsThumb1,
bool IsThumb2) {
8409 return LdSize == 16 ? ARM::VLD1q32wb_fixed
8410 : LdSize == 8 ? ARM::VLD1d32wb_fixed : 0;
8412 return LdSize == 4 ? ARM::tLDRi
8413 : LdSize == 2 ? ARM::tLDRHi
8414 : LdSize == 1 ? ARM::tLDRBi : 0;
8416 return LdSize == 4 ? ARM::t2LDR_POST
8417 : LdSize == 2 ? ARM::t2LDRH_POST
8418 : LdSize == 1 ? ARM::t2LDRB_POST : 0;
8419 return LdSize == 4 ? ARM::LDR_POST_IMM
8420 : LdSize == 2 ? ARM::LDRH_POST
8421 : LdSize == 1 ? ARM::LDRB_POST_IMM : 0;
8426 static unsigned getStOpcode(
unsigned StSize,
bool IsThumb1,
bool IsThumb2) {
8428 return StSize == 16 ? ARM::VST1q32wb_fixed
8429 : StSize == 8 ? ARM::VST1d32wb_fixed : 0;
8431 return StSize == 4 ? ARM::tSTRi
8432 : StSize == 2 ? ARM::tSTRHi
8433 : StSize == 1 ? ARM::tSTRBi : 0;
8435 return StSize == 4 ? ARM::t2STR_POST
8436 : StSize == 2 ? ARM::t2STRH_POST
8437 : StSize == 1 ? ARM::t2STRB_POST : 0;
8438 return StSize == 4 ? ARM::STR_POST_IMM
8439 : StSize == 2 ? ARM::STRH_POST
8440 : StSize == 1 ? ARM::STRB_POST_IMM : 0;
8447 unsigned LdSize,
unsigned Data,
unsigned AddrIn,
8448 unsigned AddrOut,
bool IsThumb1,
bool IsThumb2) {
8449 unsigned LdOpc =
getLdOpcode(LdSize, IsThumb1, IsThumb2);
8450 assert(LdOpc != 0 &&
"Should have a load opcode");
8457 }
else if (IsThumb1) {
8463 BuildMI(*BB, Pos, dl, TII->
get(ARM::tADDi8), AddrOut)
8468 }
else if (IsThumb2) {
8488 unsigned StSize,
unsigned Data,
unsigned AddrIn,
8489 unsigned AddrOut,
bool IsThumb1,
bool IsThumb2) {
8490 unsigned StOpc =
getStOpcode(StSize, IsThumb1, IsThumb2);
8491 assert(StOpc != 0 &&
"Should have a store opcode");
8493 BuildMI(*BB, Pos, dl, TII->
get(StOpc), AddrOut)
8498 }
else if (IsThumb1) {
8505 BuildMI(*BB, Pos, dl, TII->
get(ARM::tADDi8), AddrOut)
8510 }
else if (IsThumb2) {
8511 BuildMI(*BB, Pos, dl, TII->
get(StOpc), AddrOut)
8517 BuildMI(*BB, Pos, dl, TII->
get(StOpc), AddrOut)
8544 unsigned UnitSize = 0;
8549 bool IsThumb2 = Subtarget->
isThumb2();
8550 bool IsThumb = Subtarget->
isThumb();
8554 }
else if (Align & 2) {
8560 if ((Align % 16 == 0) && SizeVal >= 16)
8562 else if ((Align % 8 == 0) && SizeVal >= 8)
8571 bool IsNeon = UnitSize >= 8;
8572 TRC = IsThumb ? &ARM::tGPRRegClass : &ARM::GPRRegClass;
8574 VecTRC = UnitSize == 16 ? &ARM::DPairRegClass
8575 : UnitSize == 8 ? &ARM::DPRRegClass
8578 unsigned BytesLeft = SizeVal % UnitSize;
8579 unsigned LoopSize = SizeVal - BytesLeft;
8581 if (SizeVal <= Subtarget->getMaxInlineSizeThreshold()) {
8585 unsigned srcIn = src;
8586 unsigned destIn = dest;
8587 for (
unsigned i = 0; i < LoopSize; i+=UnitSize) {
8591 emitPostLd(BB, MI, TII, dl, UnitSize, scratch, srcIn, srcOut,
8592 IsThumb1, IsThumb2);
8593 emitPostSt(BB, MI, TII, dl, UnitSize, scratch, destIn, destOut,
8594 IsThumb1, IsThumb2);
8602 for (
unsigned i = 0; i < BytesLeft; i++) {
8606 emitPostLd(BB, MI, TII, dl, 1, scratch, srcIn, srcOut,
8607 IsThumb1, IsThumb2);
8608 emitPostSt(BB, MI, TII, dl, 1, scratch, destIn, destOut,
8609 IsThumb1, IsThumb2);
8649 if (Subtarget->
useMovt(*MF)) {
8650 unsigned Vtmp = varEnd;
8651 if ((LoopSize & 0xFFFF0000) != 0)
8653 BuildMI(BB, dl, TII->
get(IsThumb ? ARM::t2MOVi16 : ARM::MOVi16), Vtmp)
8654 .addImm(LoopSize & 0xFFFF)
8657 if ((LoopSize & 0xFFFF0000) != 0)
8658 BuildMI(BB, dl, TII->
get(IsThumb ? ARM::t2MOVTi16 : ARM::MOVTi16), varEnd)
8701 .addReg(varLoop).
addMBB(loopMBB)
8704 .addReg(srcLoop).
addMBB(loopMBB)
8707 .addReg(destLoop).
addMBB(loopMBB)
8714 IsThumb1, IsThumb2);
8716 IsThumb1, IsThumb2);
8728 TII->
get(IsThumb2 ? ARM::t2SUBri : ARM::SUBri), varLoop);
8737 TII->
get(IsThumb1 ? ARM::tBcc : IsThumb2 ? ARM::t2Bcc : ARM::Bcc))
8746 auto StartOfExit = exitMBB->
begin();
8750 unsigned srcIn = srcLoop;
8751 unsigned destIn = destLoop;
8752 for (
unsigned i = 0; i < BytesLeft; i++) {
8756 emitPostLd(BB, StartOfExit, TII, dl, 1, scratch, srcIn, srcOut,
8757 IsThumb1, IsThumb2);
8758 emitPostSt(BB, StartOfExit, TII, dl, 1, scratch, destIn, destOut,
8759 IsThumb1, IsThumb2);
8769 ARMTargetLowering::EmitLowered__chkstk(
MachineInstr &MI,
8776 "__chkstk is only supported on Windows");
8777 assert(Subtarget->
isThumb2() &&
"Windows on ARM requires Thumb-2 mode");
8804 .addExternalSymbol(
"__chkstk")
8818 .addExternalSymbol(
"__chkstk");
8832 BuildMI(*MBB, MI, DL, TII.
get(ARM::t2SUBrr), ARM::SP)
8844 ARMTargetLowering::EmitLowered__dbzchk(
MachineInstr &MI,
8858 BuildMI(TrapBB, DL, TII->
get(ARM::t__brkdiv0));
8880 bool isThumb2 = Subtarget->
isThumb2();
8888 case ARM::tLDR_postidx: {
8889 BuildMI(*BB, MI, dl, TII->
get(ARM::tLDMIA_UPD))
8902 case ARM::t2STR_preidx:
8905 case ARM::t2STRB_preidx:
8908 case ARM::t2STRH_preidx:
8912 case ARM::STRi_preidx:
8913 case ARM::STRBi_preidx: {
8914 unsigned NewOpc = MI.
getOpcode() == ARM::STRi_preidx ? ARM::STR_PRE_IMM
8915 : ARM::STRB_PRE_IMM;
8931 .addMemOperand(MMO);
8935 case ARM::STRr_preidx:
8936 case ARM::STRBr_preidx:
8937 case ARM::STRH_preidx: {
8941 case ARM::STRr_preidx: NewOpc = ARM::STR_PRE_REG;
break;
8942 case ARM::STRBr_preidx: NewOpc = ARM::STRB_PRE_REG;
break;
8943 case ARM::STRH_preidx: NewOpc = ARM::STRH_PRE;
break;
8952 case ARM::tMOVCCr_pseudo: {
9009 case ARM::BCCZi64: {
9015 bool RHSisZero = MI.
getOpcode() == ARM::BCCZi64;
9020 BuildMI(BB, dl, TII->
get(isThumb2 ? ARM::t2CMPri : ARM::CMPri))
9024 BuildMI(BB, dl, TII->
get(isThumb2 ? ARM::t2CMPri : ARM::CMPri))
9030 BuildMI(BB, dl, TII->
get(isThumb2 ? ARM::t2CMPrr : ARM::CMPrr))
9034 BuildMI(BB, dl, TII->
get(isThumb2 ? ARM::t2CMPrr : ARM::CMPrr))
9035 .addReg(LHS2).
addReg(RHS2)
9044 BuildMI(BB, dl, TII->
get(isThumb2 ? ARM::t2Bcc : ARM::Bcc))
9057 case ARM::Int_eh_sjlj_setjmp:
9058 case ARM::Int_eh_sjlj_setjmp_nofp:
9059 case ARM::tInt_eh_sjlj_setjmp:
9060 case ARM::t2Int_eh_sjlj_setjmp:
9061 case ARM::t2Int_eh_sjlj_setjmp_nofp:
9064 case ARM::Int_eh_sjlj_setup_dispatch:
9065 EmitSjLjDispatchBlock(MI, BB);
9093 bool isThumb2 = Subtarget->
isThumb2();
9097 unsigned NewRsbDstReg =
9112 BuildMI(BB, dl, TII->
get(isThumb2 ? ARM::t2CMPri : ARM::CMPri))
9119 TII->
get(isThumb2 ? ARM::t2Bcc : ARM::Bcc)).addMBB(SinkBB)
9126 TII->
get(isThumb2 ? ARM::t2RSBri : ARM::RSBri), NewRsbDstReg)
9135 TII->
get(ARM::PHI), ABSDstReg)
9136 .addReg(NewRsbDstReg).
addMBB(RSBBB)
9145 case ARM::COPY_STRUCT_BYVAL_I32:
9147 return EmitStructByval(MI, BB);
9149 return EmitLowered__chkstk(MI, BB);
9151 return EmitLowered__dbzchk(MI, BB);
9178 : &ARM::GPRRegClass);
9203 MCID = &TII->get(NewOpc);
9207 &&
"converted opcode should be the same except for cc_out"
9208 " (and, on Thumb1, pred)");
9243 assert(!NewOpc &&
"Optional cc_out operand required");
9248 bool definesCPSR =
false;
9249 bool deadCPSR =
false;
9262 assert(!NewOpc &&
"Optional cc_out operand required");
9268 "expect uninitialized optional cc_out operand");
9307 default:
return false;
9378 bool AllOnes =
false) {
9385 NonConstantVal, DAG))
9391 OtherOp, NonConstantVal);
9397 CCOp, TrueVal, FalseVal);
9489 Opcode = Intrinsic::arm_neon_vpaddls;
9491 Opcode = Intrinsic::arm_neon_vpaddlu;
9534 unsigned nextIndex = 0;
9557 || C1->getZExtValue() != nextIndex+1)
9602 return DAG.
getNode(ExtOp, dl, VT, tmp);
9617 if (!Subtarget->
hasDSP())
9643 if (
auto Const = dyn_cast<ConstantSDNode>(SRA.
getOperand(1))) {
9644 if (Const->getZExtValue() != 31)
9654 unsigned Opcode = 0;
9714 "ADDE node has the wrong inputs");
9728 assert(AddcNode->getNumValues() == 2 &&
9729 AddcNode->getValueType(0) == MVT::i32 &&
9730 "Expect ADDC with two result values. First: i32");
9749 bool IsLeftOperandMUL =
false;
9754 IsLeftOperandMUL =
true;
9771 if (IsLeftOperandMUL)
9780 if (AddcOp0 == MULOp.
getValue(0)) {
9784 if (AddcOp1 == MULOp.
getValue(0)) {
9803 DAG.
getVTList(MVT::i32, MVT::i32), Ops);
9834 SDNode *UmlalNode =
nullptr;
9860 DAG.
getVTList(MVT::i32, MVT::i32), Ops);
9899 int32_t imm = C->getSExtValue();
9900 if (imm < 0 && imm > INT_MIN) {
9917 int64_t imm = C->getSExtValue();
10049 return DAG.
getNode(Opcode, DL, VT,
10068 if (VT != MVT::i32)
10076 unsigned ShiftAmt = countTrailingZeros<uint64_t>(MulAmt);
10078 ShiftAmt = ShiftAmt & (32 - 1);
10083 MulAmt >>= ShiftAmt;
10105 uint64_t MulAmtAbs = -MulAmt;
10150 APInt SplatBits, SplatUndef;
10151 unsigned SplatBitSize;
10154 BVN->
isConstantSplat(SplatBits, SplatUndef, SplatBitSize, HasAnyUndefs)) {
10155 if (SplatBitSize <= 64) {
10225 unsigned Opcode = 0;
10226 if (
isS16(OpS16, DAG))
10253 APInt SplatBits, SplatUndef;
10254 unsigned SplatBitSize;
10256 if (BVN && Subtarget->
hasNEON() &&
10257 BVN->
isConstantSplat(SplatBits, SplatUndef, SplatBitSize, HasAnyUndefs)) {
10258 if (SplatBitSize <= 64) {
10293 unsigned SplatBitSize;
10296 APInt SplatBits0, SplatBits1;
10300 if (BVN0 && BVN0->
isConstantSplat(SplatBits0, SplatUndef, SplatBitSize,
10301 HasAnyUndefs) && !HasAnyUndefs) {
10302 if (BVN1 && BVN1->isConstantSplat(SplatBits1, SplatUndef, SplatBitSize,
10303 HasAnyUndefs) && !HasAnyUndefs) {
10308 SplatBits0 == ~SplatBits1) {
10340 if (VT != MVT::i32)
10353 if (Mask == 0xffff)
10360 if ((Val & ~Mask) != Val)
10384 (Mask == ~Mask2)) {
10387 if (Subtarget->
hasDSP() &&
10388 (Mask == 0xffff || Mask == 0xffff0000))
10400 (~Mask == Mask2)) {
10403 if (Subtarget->
hasDSP() &&
10404 (Mask2 == 0xffff || Mask2 == 0xffff0000))
10424 unsigned ShAmtC = cast<ConstantSDNode>(ShAmt)->getZExtValue();
10464 ToMask = ~cast<ConstantSDNode>(N->
getOperand(2))->getAPIntValue();
10469 if (From->getOpcode() ==
ISD::SRL &&
10470 isa<ConstantSDNode>(From->getOperand(1))) {
10471 APInt Shift = cast<ConstantSDNode>(From->getOperand(1))->getAPIntValue();
10474 From = From->getOperand(0);
10486 return LastActiveBitInA - 1 == FirstActiveBitInB;
10492 APInt ToMask, FromMask;
10500 APInt CombinedToMask = ToMask;
10502 APInt NewToMask, NewFromMask;
10504 if (NewFrom != From) {
10506 CombinedToMask |= NewToMask;
10512 if ((NewToMask & CombinedToMask).getBoolValue())
10525 CombinedToMask |= NewToMask;
10542 unsigned InvMask = cast<ConstantSDNode>(N->
getOperand(2))->getZExtValue();
10546 static_cast<unsigned>(std::numeric_limits<unsigned>::digits) &&
10547 "undefined behavior");
10548 unsigned Mask = (1u << Width) - 1;
10550 if ((Mask & (~Mask2)) == 0)
10563 APInt ToMask1, FromMask1;
10566 APInt ToMask2, FromMask2;
10574 APInt NewFromMask = FromMask1 | FromMask2;
10575 APInt NewToMask = ToMask1 | ToMask2;
10580 if (NewFromMask[0] == 0)
10617 DAG.getConstant(4, DL, MVT::i32));
10618 SDValue NewLD2 = DAG.getLoad(
10656 for (
unsigned i = 0; i < NumElts; ++i) {
10686 for (
unsigned i = 0; i < NumElts; ++i) {
10733 unsigned NumOfBitCastedElts = 0;
10735 unsigned NumOfRelevantElts = NumElts;
10736 for (
unsigned Idx = 0; Idx < NumElts; ++Idx) {
10741 ++NumOfBitCastedElts;
10742 }
else if (Elt.
isUndef() || isa<ConstantSDNode>(Elt))
10745 --NumOfRelevantElts;
10749 if (NumOfBitCastedElts <= NumOfRelevantElts / 2)
10757 if (!TLI.isTypeLegal(VecVT))
10767 for (
unsigned Idx = 0 ; Idx < NumElts; ++Idx) {
10852 unsigned HalfElts = NumElts/2;
10854 for (
unsigned n = 0; n < NumElts; ++n) {
10857 if (MaskElt < (
int)HalfElts)
10859 else if (MaskElt >= (
int)NumElts && MaskElt < (
int)(NumElts + HalfElts))
10860 NewElt = HalfElts + MaskElt - NumElts;
10878 const unsigned AddrOpIdx = ((isIntrinsic || isStore) ? 2 : 1);
10888 UI.getUse().getResNo() != Addr.
getResNo())
10897 bool isLoadOp =
true;
10898 bool isLaneOp =
false;
10899 unsigned NewOpc = 0;
10900 unsigned NumVecs = 0;
10902 unsigned IntNo = cast<ConstantSDNode>(N->
getOperand(1))->getZExtValue();
10906 NumVecs = 1;
break;
10908 NumVecs = 2;
break;
10910 NumVecs = 3;
break;
10912 NumVecs = 4;
break;
10914 NumVecs = 2; isLaneOp =
true;
break;
10916 NumVecs = 3; isLaneOp =
true;
break;
10918 NumVecs = 4; isLaneOp =
true;
break;
10920 NumVecs = 1; isLoadOp =
false;
break;
10922 NumVecs = 2; isLoadOp =
false;
break;
10924 NumVecs = 3; isLoadOp =
false;
break;
10926 NumVecs = 4; isLoadOp =
false;
break;
10928 NumVecs = 2; isLoadOp =
false; isLaneOp =
true;
break;
10930 NumVecs = 3; isLoadOp =
false; isLaneOp =
true;
break;
10932 NumVecs = 4; isLoadOp =
false; isLaneOp =
true;
break;
10943 NumVecs = 1; isLaneOp =
false;
break;
10945 NumVecs = 1; isLaneOp =
false; isLoadOp =
false;
break;
10953 }
else if (isIntrinsic) {
10956 assert(isStore &&
"Node has to be a load, a store, or an intrinsic!");
10967 if (NumBytes >= 3 * 16 && (!CInc || CInc->
getZExtValue() != NumBytes)) {
10976 EVT AlignedVecTy = VecTy;
10993 if (isa<LSBaseSDNode>(N)) {
10994 if (Alignment == 0)
10998 assert(NumVecs == 1 &&
"Unexpected multi-element generic load/store.");
10999 assert(!isLaneOp &&
"Unexpected generic load/store lane.");
11016 unsigned NumResultVecs = (isLoadOp ? NumVecs : 0);
11018 for (n = 0; n < NumResultVecs; ++n)
11019 Tys[n] = AlignedVecTy;
11030 if (
StoreSDNode *StN = dyn_cast<StoreSDNode>(N)) {
11036 for (
unsigned i = AddrOpIdx + 1; i < N->
getNumOperands() - 1; ++i)
11056 for (
unsigned i = 0; i < NumResultVecs; ++i)
11062 SDValue &LdVal = NewResults[0];
11098 unsigned NumVecs = 0;
11099 unsigned NewOpc = 0;
11100 unsigned IntNo = cast<ConstantSDNode>(VLD->
getOperand(1))->getZExtValue();
11101 if (IntNo == Intrinsic::arm_neon_vld2lane) {
11104 }
else if (IntNo == Intrinsic::arm_neon_vld3lane) {
11107 }
else if (IntNo == Intrinsic::arm_neon_vld4lane) {
11116 unsigned VLDLaneNo =
11117 cast<ConstantSDNode>(VLD->
getOperand(NumVecs+3))->getZExtValue();
11121 if (UI.getUse().getResNo() == NumVecs)
11125 VLDLaneNo != cast<ConstantSDNode>(User->
getOperand(1))->getZExtValue())
11132 for (n = 0; n < NumVecs; ++n)
11145 unsigned ResNo = UI.getUse().
getResNo();
11147 if (ResNo == NumVecs)
11155 std::vector<SDValue> VLDDupResults;
11156 for (
unsigned n = 0; n < NumVecs; ++n)
11157 VLDDupResults.push_back(
SDValue(VLDDup.getNode(), n));
11158 VLDDupResults.push_back(
SDValue(VLDDup.getNode(), NumVecs));
11185 unsigned Imm = cast<ConstantSDNode>(Op.
getOperand(0))->getZExtValue();
11251 assert(StVT != VT &&
"Cannot truncate to the same type");
11260 if (0 != (NumElems * FromEltSz) % ToEltSz)
return SDValue();
11262 unsigned SizeRatio = FromEltSz / ToEltSz;
11267 NumElems*SizeRatio);
11273 for (
unsigned i = 0; i < NumElems; ++i)
11275 ? (i + 1) * SizeRatio - 1
11290 if (TLI.
isTypeLegal(Tp) && Tp.getSizeInBits() <= NumElems * ToEltSz)
11309 for (
unsigned I = 0; I <
E; I++) {
11311 StoreType, ShuffWide,
11400 if (!isa<BuildVectorSDNode>(ConstVec))
11408 if (FloatBits != 32 || IntBits > 32 || NumLanes > 4) {
11419 if (C == -1 || C == 0 || C > 32)
11424 unsigned IntrinsicOpcode = isSigned ? Intrinsic::arm_neon_vcvtfp2fxs :
11425 Intrinsic::arm_neon_vcvtfp2fxu;
11431 if (IntBits < FloatBits)
11458 if (!isa<BuildVectorSDNode>(ConstVec))
11466 if (FloatBits != 32 || IntBits > 32 || NumLanes > 4) {
11477 if (C == -1 || C == 0 || C > 32)
11483 if (IntBits < FloatBits)
11488 unsigned IntrinsicOpcode = isSigned ? Intrinsic::arm_neon_vcvtfxs2fp :
11489 Intrinsic::arm_neon_vcvtfxu2fp;
11504 APInt SplatBits, SplatUndef;
11505 unsigned SplatBitSize;
11507 if (! BVN || ! BVN->
isConstantSplat(SplatBits, SplatUndef, SplatBitSize,
11508 HasAnyUndefs, ElementBits) ||
11509 SplatBitSize > ElementBits)
11511 Cnt = SplatBits.getSExtValue();
11520 assert(VT.
isVector() &&
"vector shift count is not a vector type");
11524 return (Cnt >= 0 && (isLong ? Cnt-1 : Cnt) < ElementBits);
11535 assert(VT.
isVector() &&
"vector shift count is not a vector type");
11540 return (Cnt >= 1 && Cnt <= (isNarrow ? ElementBits/2 : ElementBits));
11541 if (Cnt >= -(isNarrow ? ElementBits/2 : ElementBits) && Cnt <= -1) {
11550 unsigned IntNo = cast<ConstantSDNode>(N->
getOperand(0))->getZExtValue();
11561 case Intrinsic::arm_neon_vshifts:
11562 case Intrinsic::arm_neon_vshiftu:
11563 case Intrinsic::arm_neon_vrshifts:
11564 case Intrinsic::arm_neon_vrshiftu:
11565 case Intrinsic::arm_neon_vrshiftn:
11566 case Intrinsic::arm_neon_vqshifts:
11567 case Intrinsic::arm_neon_vqshiftu:
11568 case Intrinsic::arm_neon_vqshiftsu:
11569 case Intrinsic::arm_neon_vqshiftns:
11570 case Intrinsic::arm_neon_vqshiftnu:
11571 case Intrinsic::arm_neon_vqshiftnsu:
11572 case Intrinsic::arm_neon_vqrshiftns:
11573 case Intrinsic::arm_neon_vqrshiftnu:
11574 case Intrinsic::arm_neon_vqrshiftnsu: {
11577 unsigned VShiftOpc = 0;
11580 case Intrinsic::arm_neon_vshifts:
11581 case Intrinsic::arm_neon_vshiftu:
11587 VShiftOpc = (IntNo == Intrinsic::arm_neon_vshifts ?
11593 case Intrinsic::arm_neon_vrshifts:
11594 case Intrinsic::arm_neon_vrshiftu:
11599 case Intrinsic::arm_neon_vqshifts:
11600 case Intrinsic::arm_neon_vqshiftu:
11605 case Intrinsic::arm_neon_vqshiftsu:
11610 case Intrinsic::arm_neon_vrshiftn:
11611 case Intrinsic::arm_neon_vqshiftns:
11612 case Intrinsic::arm_neon_vqshiftnu:
11613 case Intrinsic::arm_neon_vqshiftnsu:
11614 case Intrinsic::arm_neon_vqrshiftns:
11615 case Intrinsic::arm_neon_vqrshiftnu:
11616 case Intrinsic::arm_neon_vqrshiftnsu:
11628 case Intrinsic::arm_neon_vshifts:
11629 case Intrinsic::arm_neon_vshiftu:
11632 case Intrinsic::arm_neon_vrshifts:
11634 case Intrinsic::arm_neon_vrshiftu:
11636 case Intrinsic::arm_neon_vrshiftn:
11638 case Intrinsic::arm_neon_vqshifts:
11640 case Intrinsic::arm_neon_vqshiftu:
11642 case Intrinsic::arm_neon_vqshiftsu:
11644 case Intrinsic::arm_neon_vqshiftns:
11646 case Intrinsic::arm_neon_vqshiftnu:
11648 case Intrinsic::arm_neon_vqshiftnsu:
11650 case Intrinsic::arm_neon_vqrshiftns:
11652 case Intrinsic::arm_neon_vqrshiftnu:
11654 case Intrinsic::arm_neon_vqrshiftnsu:
11663 case Intrinsic::arm_neon_vshiftins: {
11666 unsigned VShiftOpc = 0;
11682 case Intrinsic::arm_neon_vqrshifts:
11683 case Intrinsic::arm_neon_vqrshiftu:
11761 if (VT == MVT::i32 &&
11764 isa<ConstantSDNode>(Lane)) {
11800 auto CCNode = cast<ConstantSDNode>(CMOV->
getOperand(2));
11801 auto CC = CCNode->getAPIntValue().getLimitedValue();
11838 unsigned Heuristic = Subtarget->
isThumb() ? 3 : 2;
11846 if ((OrCI & Known.
Zero) != OrCI)
11861 for (
unsigned BitInY = 0, NumActiveBits = OrCI.
getActiveBits();
11862 BitInY < NumActiveBits; ++BitInY) {
11863 if (OrCI[BitInY] == 0)
11866 Mask.setBit(BitInY);
11902 if ((LHS00C && LHS00C->getZExtValue() == 0) &&
11903 (LHS01C && LHS01C->getZExtValue() == 1) &&
11904 (LHS1C && LHS1C->getZExtValue() == 1) &&
11905 (RHSC && RHSC->getZExtValue() == 0)) {
11958 if (CC ==
ARMCC::NE && FalseVal == RHS && FalseVal != LHS) {
11961 }
else if (CC ==
ARMCC::EQ && TrueVal == RHS) {
11974 if ((LHS0C && LHS0C->getZExtValue() == 0) &&
11975 (LHS1C && LHS1C->getZExtValue() == 1) &&
11976 (RHSC && RHSC->getZExtValue() == 0)) {
11987 if (Known.
Zero == 0xfffffffe)
11990 else if (Known.
Zero == 0xffffff00)
11993 else if (Known.
Zero == 0xffff0000)
12099 switch (cast<ConstantSDNode>(N->
getOperand(1))->getZExtValue()) {
12100 case Intrinsic::arm_neon_vld1:
12101 case Intrinsic::arm_neon_vld2:
12102 case Intrinsic::arm_neon_vld3:
12103 case Intrinsic::arm_neon_vld4:
12104 case Intrinsic::arm_neon_vld2lane:
12105 case Intrinsic::arm_neon_vld3lane:
12106 case Intrinsic::arm_neon_vld4lane:
12107 case Intrinsic::arm_neon_vst1:
12108 case Intrinsic::arm_neon_vst2:
12109 case Intrinsic::arm_neon_vst3:
12110 case Intrinsic::arm_neon_vst4:
12111 case Intrinsic::arm_neon_vst2lane:
12112 case Intrinsic::arm_neon_vst3lane:
12113 case Intrinsic::arm_neon_vst4lane:
12130 bool *
Fast)
const {
12141 if (AllowsUnaligned) {
12153 if (Subtarget->
hasNEON() && (AllowsUnaligned || Subtarget->
isLittle())) {
12164 unsigned AlignCheck) {
12165 return ((SrcAlign == 0 || SrcAlign % AlignCheck == 0) &&
12166 (DstAlign == 0 || DstAlign % AlignCheck == 0));
12170 unsigned DstAlign,
unsigned SrcAlign,
12171 bool IsMemset,
bool ZeroMemset,
12177 if ((!IsMemset || ZeroMemset) && Subtarget->
hasNEON() &&
12184 }
else if (Size >= 8 &&
12255 unsigned AS)
const {
12258 return AM.
Scale < 0 ? 1 : 0;
12269 unsigned Scale = 1;
12271 default:
return false;
12286 if ((V & (Scale - 1)) != 0)
12289 return V == (V & ((1LL << 5) - 1));
12294 bool isNeg =
false;
12301 default:
return false;
12308 return V == (V & ((1LL << 8) - 1));
12309 return V == (V & ((1LL << 12) - 1));
12318 return V == (V & ((1LL << 8) - 1));
12342 default:
return false;
12347 return V == (V & ((1LL << 12) - 1));
12350 return V == (V & ((1LL << 8) - 1));
12358 return V == (V & ((1LL << 8) - 1));
12364 int Scale = AM.
Scale;
12369 default:
return false;
12377 Scale = Scale & ~1;
12378 return Scale == 2 || Scale == 4 || Scale == 8;
12390 if (Scale & 1)
return false;
12399 unsigned AS)
const {
12408 switch (AM.
Scale) {
12426 int Scale = AM.
Scale;
12428 default:
return false;
12432 if (Scale < 0) Scale = -Scale;
12450 if (Scale & 1)
return false;
12468 return Imm >= 0 && Imm <= 255;
12483 return AbsImm >= 0 && AbsImm <= 255;
12488 SDValue &Offset,
bool &isInc,
12497 int RHSC = (int)RHS->getZExtValue();
12498 if (RHSC < 0 && RHSC > -256) {
12511 int RHSC = (int)RHS->getZExtValue();
12512 if (RHSC < 0 && RHSC > -0x1000) {
12547 SDValue &Offset,
bool &isInc,
12554 int RHSC = (int)RHS->getZExtValue();
12555 if (RHSC < 0 && RHSC > -0x100) {
12560 }
else if (RHSC > 0 && RHSC < 0x100) {
12584 if (
LoadSDNode *LD = dyn_cast<LoadSDNode>(N)) {
12588 }
else if (
StoreSDNode *ST = dyn_cast<StoreSDNode>(N)) {
12589 Ptr = ST->getBasePtr();
12590 VT = ST->getMemoryVT();
12595 bool isLegal =
false;
12620 if (
LoadSDNode *LD = dyn_cast<LoadSDNode>(N)) {
12625 }
else if (
StoreSDNode *ST = dyn_cast<StoreSDNode>(N)) {
12626 VT = ST->getMemoryVT();
12627 Ptr = ST->getBasePtr();
12628 isNonExt = !ST->isTruncatingStore();
12639 if (!RHS || RHS->getZExtValue() != 4)
12649 bool isLegal =
false;
12677 const APInt &DemandedElts,
12679 unsigned Depth)
const {
12702 Known.
One &= KnownRHS.
One;
12710 case Intrinsic::arm_ldaex:
12711 case Intrinsic::arm_ldrex: {
12712 EVT VT = cast<MemIntrinsicSDNode>(
Op)->getMemoryVT();
12749 switch (AsmPieces.
size()) {
12750 default:
return false;
12752 AsmStr = AsmPieces[0];
12757 if (AsmPieces.
size() == 3 &&
12758 AsmPieces[0] ==
"rev" && AsmPieces[1] ==
"$0" && AsmPieces[2] ==
"$1" &&
12794 if (Constraint.
size() == 1) {
12795 switch (Constraint[0]) {
12807 }
else if (Constraint.
size() == 2) {
12808 switch (Constraint[0]) {
12827 if (!CallOperandVal)
12831 switch (*constraint) {
12851 typedef std::pair<unsigned, const TargetRegisterClass*>
RCPair;
12854 if (Constraint.
size() == 1) {
12856 switch (Constraint[0]) {
12859 return RCPair(0U, &ARM::tGPRRegClass);
12860 return RCPair(0U, &ARM::GPRRegClass);
12863 return RCPair(0U, &ARM::hGPRRegClass);
12867 return RCPair(0U, &ARM::tGPRRegClass);
12868 return RCPair(0U, &ARM::GPRRegClass);
12873 return RCPair(0U, &ARM::SPRRegClass);
12875 return RCPair(0U, &ARM::DPRRegClass);
12877 return RCPair(0U, &ARM::QPRRegClass);
12883 return RCPair(0U, &ARM::SPR_8RegClass);
12885 return RCPair(0U, &ARM::DPR_8RegClass);
12887 return RCPair(0U, &ARM::QPR_8RegClass);
12891 return RCPair(0U, &ARM::SPRRegClass);
12895 if (
StringRef(
"{cc}").equals_lower(Constraint))
12896 return std::make_pair(
unsigned(ARM::CPSR), &ARM::CCRRegClass);
12904 std::string &Constraint,
12905 std::vector<SDValue>&Ops,
12910 if (Constraint.length() != 1)
return;
12912 char ConstraintLetter = Constraint[0];
12913 switch (ConstraintLetter) {
12916 case 'I':
case 'J':
case 'K':
case 'L':
12917 case 'M':
case 'N':
case 'O':
12923 int CVal = (int) CVal64;
12926 if (CVal != CVal64)
12929 switch (ConstraintLetter) {
12934 if (CVal >= 0 && CVal <= 65535)
12941 if (CVal >= 0 && CVal <= 255)
12943 }
else if (Subtarget->
isThumb2()) {
12962 if (CVal >= -255 && CVal <= -1)
12968 if (CVal >= -4095 && CVal <= 4095)
12981 }
else if (Subtarget->
isThumb2()) {
13004 if (CVal >= -7 && CVal < 7)
13006 }
else if (Subtarget->
isThumb2()) {
13029 if ((CVal >= 0 && CVal <= 1020) && ((CVal & 3) == 0))
13035 if ((CVal >= 0 && CVal <= 32) || ((CVal & (CVal - 1)) == 0))
13043 if (CVal >= 0 && CVal <= 31)
13052 if ((CVal >= -508 && CVal <= 508) && ((CVal & 3) == 0))
13062 Ops.push_back(Result);
13072 "Unhandled Opcode in getDivRemLibcall");
13090 "Unhandled Opcode in getDivRemArgList");
13094 TargetLowering::ArgListEntry Entry;
13100 Entry.IsSExt = isSigned;
13101 Entry.IsZExt = !isSigned;
13102 Args.push_back(Entry);
13113 "Register-based DivRem lowering only");
13116 "Invalid opcode for Div/Rem lowering");
13134 SDValue Div = DAG.
getNode(DivOpcode, dl, VT, Dividend, Divisor);
13138 SDValue Values[2] = {Div, Rem};
13164 return CallInfo.first;
13171 std::vector<Type*> RetTyParams;
13172 Type *RetTyElement;
13182 RetTyParams.push_back(RetTyElement);
13183 RetTyParams.push_back(RetTyElement);
13200 CallLoweringInfo CLI(DAG);
13204 std::pair<SDValue, SDValue> CallResult =
LowerCallTo(CLI);
13207 SDNode *ResNode = CallResult.first.getNode();
13234 SDValue Ops[2] = { NewSP, Chain };
13240 "Unexpected type for custom-lowering FP_EXTEND");
13253 "Unexpected type for custom-lowering FP_ROUND");
13270 if (v == 0xffffffff)
13287 return ARM_AM::getFP64Imm(Imm) != -1;
13296 unsigned Intrinsic)
const {
13297 switch (Intrinsic) {
13298 case Intrinsic::arm_neon_vld1:
13299 case Intrinsic::arm_neon_vld2:
13300 case Intrinsic::arm_neon_vld3:
13301 case Intrinsic::arm_neon_vld4:
13302 case Intrinsic::arm_neon_vld2lane:
13303 case Intrinsic::arm_neon_vld3lane:
13304 case Intrinsic::arm_neon_vld4lane: {
13308 uint64_t NumElts = DL.getTypeSizeInBits(I.
getType()) / 64;
13313 Info.
align = cast<ConstantInt>(AlignArg)->getZExtValue();
13319 case Intrinsic::arm_neon_vst1:
13320 case Intrinsic::arm_neon_vst2:
13321 case Intrinsic::arm_neon_vst3:
13322 case Intrinsic::arm_neon_vst4:
13323 case Intrinsic::arm_neon_vst2lane:
13324 case Intrinsic::arm_neon_vst3lane:
13325 case Intrinsic::arm_neon_vst4lane: {
13329 unsigned NumElts = 0;
13334 NumElts += DL.getTypeSizeInBits(ArgTy) / 64;
13340 Info.
align = cast<ConstantInt>(AlignArg)->getZExtValue();
13346 case Intrinsic::arm_ldaex:
13347 case Intrinsic::arm_ldrex: {
13360 case Intrinsic::arm_stlex:
13361 case Intrinsic::arm_strex: {
13374 case Intrinsic::arm_stlexd:
13375 case Intrinsic::arm_strexd:
13386 case Intrinsic::arm_ldaexd:
13387 case Intrinsic::arm_ldrexd:
13412 if (Bits == 0 || Bits > 32)
13418 unsigned Index)
const {
13504 return (Size == 64) && !Subtarget->
isMClass();
13527 return (Size <= (Subtarget->
isMClass() ? 32U : 64U) && hasAtomicRMW)
13539 bool hasAtomicCmpXchg =
13546 return InsertFencesForAtomic;
13555 unsigned &Cost)
const {
13569 if (!isa<ConstantInt>(Idx))
13573 unsigned BitWidth = cast<VectorType>(VectorTy)->
getBitWidth();
13576 if (BitWidth == 64 || BitWidth == 128) {
13594 Type *ValTy = cast<PointerType>(Addr->
getType())->getElementType();
13602 IsAcquire ? Intrinsic::arm_ldaexd : Intrinsic::arm_ldrexd;
13606 Value *LoHi = Builder.
CreateCall(Ldrex, Addr,
"lohi");
13619 Intrinsic::ID Int = IsAcquire ? Intrinsic::arm_ldaex : Intrinsic::arm_ldrex;
13624 cast<PointerType>(Addr->
getType())->getElementType());
13646 IsRelease ? Intrinsic::arm_stlexd : Intrinsic::arm_strexd;
13650 Value *Lo = Builder.
CreateTrunc(Val, Int32Ty,
"lo");
13658 Intrinsic::ID Int = IsRelease ? Intrinsic::arm_stlex : Intrinsic::arm_strex;
13693 if (ElSize != 8 && ElSize != 16 && ElSize != 32)
13698 return VecSize == 64 || VecSize % 128 == 0;
13716 "Invalid interleave factor");
13717 assert(!Shuffles.
empty() &&
"Empty shufflevector input");
13719 "Unmatched number of shufflevectors and indices");
13745 if (NumLoads > 1) {
13749 VecTy->getVectorNumElements() / NumLoads);
13755 BaseAddr, VecTy->getVectorElementType()->getPointerTo(
13762 Type *Tys[] = {VecTy, Int8Ptr};
13763 static const Intrinsic::ID LoadInts[3] = {Intrinsic::arm_neon_vld2,
13764 Intrinsic::arm_neon_vld3,
13765 Intrinsic::arm_neon_vld4};
13774 for (
unsigned LoadCount = 0; LoadCount < NumLoads; ++LoadCount) {
13780 BaseAddr, VecTy->getVectorNumElements() * Factor);
13790 for (
unsigned i = 0; i < Shuffles.
size(); i++) {
13792 unsigned Index = Indices[i];
13802 SubVecs[SV].push_back(SubVec);
13811 auto &SubVec = SubVecs[SVI];
13814 SVI->replaceAllUsesWith(WideVec);
13848 unsigned Factor)
const {
13850 "Invalid interleave factor");
13854 "Invalid interleaved store");
13891 if (NumStores > 1) {
13894 LaneLen /= NumStores;
13910 Type *Tys[] = {Int8Ptr, SubVecTy};
13911 static const Intrinsic::ID StoreInts[3] = {Intrinsic::arm_neon_vst2,
13912 Intrinsic::arm_neon_vst3,
13913 Intrinsic::arm_neon_vst4};
13915 for (
unsigned StoreCount = 0; StoreCount < NumStores; ++StoreCount) {
13919 if (StoreCount > 0)
13929 for (
unsigned i = 0; i < Factor; i++) {
13930 unsigned IdxI = StoreCount * LaneLen * Factor + i;
13931 if (Mask[IdxI] >= 0) {
13935 unsigned StartMask = 0;
13936 for (
unsigned j = 1; j < LaneLen; j++) {
13937 unsigned IdxJ = StoreCount * LaneLen * Factor + j;
13938 if (Mask[IdxJ * Factor + IdxI] >= 0) {
13939 StartMask = Mask[IdxJ * Factor + IdxI] - IdxJ;
13969 uint64_t &Members) {
13970 if (
auto *ST = dyn_cast<StructType>(Ty)) {
13971 for (
unsigned i = 0; i < ST->getNumElements(); ++i) {
13972 uint64_t SubMembers = 0;
13975 Members += SubMembers;
13977 }
else if (
auto *AT = dyn_cast<ArrayType>(Ty)) {
13978 uint64_t SubMembers = 0;
13981 Members += SubMembers * AT->getNumElements();
13992 }
else if (
auto *VT = dyn_cast<VectorType>(Ty)) {
13999 return VT->getBitWidth() == 64;
14001 return VT->getBitWidth() == 128;
14003 switch (VT->getBitWidth()) {
14016 return (Members > 0 && Members <= 4);
14024 if (getEffectiveCallingConv(CallConv, isVarArg) !=
14029 uint64_t Members = 0;
14034 return IsHA || IsIntArray;
14038 const Constant *PersonalityFn)
const {
14041 return Subtarget->
useSjLjEH() ? ARM::NoRegister : ARM::R0;
14045 const Constant *PersonalityFn)
const {
14048 return Subtarget->
useSjLjEH() ? ARM::NoRegister : ARM::R1;
14057 void ARMTargetLowering::insertCopiesSplitCSR(
14070 if (ARM::GPRRegClass.
contains(*I))
14071 RC = &ARM::GPRRegClass;
14072 else if (ARM::DPRRegClass.
contains(*I))
14073 RC = &ARM::DPRRegClass;
14084 Attribute::NoUnwind) &&
14085 "Function should be nounwind in insertCopiesSplitCSR!");
14091 for (
auto *Exit : Exits)
14093 TII->
get(TargetOpcode::COPY), *
I)
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)
MVT getSimpleValueType() const
Return the simple ValueType of the referenced return value.
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)
static unsigned getBitWidth(Type *Ty, const DataLayout &DL)
Returns the bitwidth of the given scalar or pointer type.
int getFunctionContextIndex() const
Return the index for the function context object.
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)
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...
int getPromotedConstpoolIncrease() const
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...
static SDValue CombineVMOVDRRCandidateWithVecOp(const SDNode *BC, SelectionDAG &DAG)
BC is a bitcast that is about to be turned into a VMOVDRR.
bool use_empty() const
Return true if there are no uses of this node.
const Value * getCalledValue() const
Get a pointer to the function that is invoked by this instruction.
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 MachineFunction * getParent() const
Return the MachineFunction containing this basic block.
bool isEHPad() const
Returns true if the block is a landing pad.
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)
CallingConv::ID getLibcallCallingConv(RTLIB::Libcall Call) const
Get the CallingConv that should be used for the specified libcall.
FMINNUM/FMAXNUM - Perform floating-point minimum or maximum on two values.
The MachineConstantPool class keeps track of constants referenced by a function which must be spilled...
SDValue getValue(unsigned R) const
This represents an addressing mode of: BaseGV + BaseOffs + BaseReg + Scale*ScaleReg If BaseGV is null...
StringRef getPrivateGlobalPrefix() 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)
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.
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.
virtual ConstraintType getConstraintType(StringRef Constraint) const
Given a constraint, return the type of constraint it is for this target.
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.
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.
LLVMContext & getContext() const
getContext - Return a reference to the LLVMContext associated with this function. ...
Flags getFlags() const
Return the raw flags of the source value,.
GCNRegPressure max(const GCNRegPressure &P1, const GCNRegPressure &P2)
static APInt getAllOnesValue(unsigned numBits)
Get the all-ones value.
LLVMContext * getContext() const
This class represents an incoming formal argument to a Function.
bool isOSBinFormatMachO() const
Tests whether the environment is MachO.
bool isLegalAddressingMode(const DataLayout &DL, const AddrMode &AM, Type *Ty, unsigned AS) const override
isLegalAddressingMode - Return true if the addressing mode represented by AM is legal for this target...
static bool isAddSubSExt(SDNode *N, SelectionDAG &DAG)
uint64_t getZExtValue() const
Get zero extended value.
SDValue UnrollVectorOp(SDNode *N, unsigned ResNE=0)
Utility function used by legalize and lowering to "unroll" a vector operation by splitting out the sc...
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)...
static ARMConstantPoolSymbol * Create(LLVMContext &C, StringRef s, unsigned ID, unsigned char PCAdj)
static SDValue WinDBZCheckDenominator(SelectionDAG &DAG, SDNode *N, SDValue InChain)
Atomic ordering constants.
static SDValue LowerSDIV(SDValue Op, SelectionDAG &DAG)
STATISTIC(NumFunctions,"Total number of functions")
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.
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)
static SDValue LowerReverse_VECTOR_SHUFFLEv16i8_v8i16(SDValue Op, SelectionDAG &DAG)
LocInfo getLocInfo() const
static MVT getVectorVT(MVT VT, unsigned NumElements)
static bool IsVUZPShuffleNode(SDNode *N)
TOF
Target Operand Flag enum.
bool hasOneUse() const
Return true if there is exactly one use of this node.
bool hasNUsesOfValue(unsigned NUses, unsigned Value) const
Return true if there are exactly NUSES uses of the indicated value.
VECTOR_SHUFFLE(VEC1, VEC2) - Returns a vector, of the same type as VEC1/VEC2.
MachineBasicBlock * getMBB() const
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 ...
const MCPhysReg * getCalleeSavedRegsViaCopy(const MachineFunction *MF) const
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. ...
bool hasOneUse() const
Return true if there is exactly one node using value ResNo of Node.
void getInRegsParamInfo(unsigned InRegsParamRecordIndex, unsigned &BeginReg, unsigned &EndReg) const
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.
const TargetMachine & getTargetMachine() const
SDVTList getVTList() const
Instruction * emitTrailingFence(IRBuilder<> &Builder, Instruction *Inst, AtomicOrdering Ord) const override
an instruction that atomically checks whether a specified value is in a memory location, and, if it is, stores a new value there.
unsigned getNumDefs() const
Return the number of MachineOperands that are register definitions.
unsigned createVirtualRegister(const TargetRegisterClass *RegClass)
createVirtualRegister - Create and return a new virtual register in the function with the specified r...
Maximum length of the test input libFuzzer tries to guess a good value based on the corpus and reports it always prefer smaller inputs during the corpus shuffle When libFuzzer itself reports a bug this exit code will be used If indicates the maximal total time in seconds to run the fuzzer minimizes the provided crash input Use with tries to cleanse the provided crash input to make it contain fewer original bytes Use with exact_artifact_path to specify the output Experimental Use value profile to guide fuzzing Number of jobs to run If min(jobs, NumberOfCpuCores()/2)\" is used.") FUZZER_FLAG_INT(reload
static unsigned getSORegOpc(ShiftOpc ShOp, unsigned Imm)
bool isCalledByLegalizer() const
static SDValue lowerCTPOP32BitElements(SDNode *N, SelectionDAG &DAG)
lowerCTPOP32BitElements - Returns a v2i32/v4i32 vector containing the bit-count for each 32-bit eleme...
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)
static SDValue SkipLoadExtensionForVMULL(LoadSDNode *LD, SelectionDAG &DAG)
SkipLoadExtensionForVMULL - return a load of the original vector size that does not do any sign/zero ...
int getSplatIndex() const
Carry-setting nodes for multiple precision addition and subtraction.
const TargetMachine & getTarget() const
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...
unsigned getPrefTypeAlignment(Type *Ty) const
Returns the preferred stack/global alignment for the specified type.
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.
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...
BBTy * getParent() const
Get the basic block containing the call site.
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.
static bool hasNormalLoadOperand(SDNode *N)
hasNormalLoadOperand - Check if any of the operands of a BUILD_VECTOR node are normal, non-volatile loads.
void transferSuccessorsAndUpdatePHIs(MachineBasicBlock *FromMBB)
Transfers all the successors, as in transferSuccessors, and update PHI operands in the successor bloc...
const MachineInstrBuilder & add(const MachineOperand &MO) const
STACKRESTORE has two operands, an input chain and a pointer to restore to it returns an output chain...
This class represents a function call, abstracting a target machine's calling convention.
unsigned InferPtrAlignment(SDValue Ptr) const
Infer alignment of a load / store address.
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.
const GlobalValue * getGlobal() const
Libcall
RTLIB::Libcall enum - This enum defines all of the runtime library calls the backend can emit...
const std::string & getAsmString() const
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 MVT getFloatingPointVT(unsigned BitWidth)
RESULT, BOOL = [SU]ADDO(LHS, RHS) - Overflow-aware nodes for addition.
unsigned getOpcode() const
Return the SelectionDAG opcode value for this node.
bool verifyReturnAddressArgumentIsConstant(SDValue Op, SelectionDAG &DAG) const
std::pair< Value *, Value * > ShuffleOps
We are building a shuffle to create V, which is a sequence of insertelement, extractelement pairs...
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
Type * getTypeForEVT(LLVMContext &Context) const
This method returns an LLVM type corresponding to the specified EVT.
unsigned getSizeInBits() const
This instruction constructs a fixed permutation of two input vectors.
const unsigned char * bytes_end() const
bool isDoubleTy() const
Return true if this is 'double', a 64-bit IEEE fp type.
unsigned getByValSize() const
bool isUnindexed() const
Return true if this is NOT a pre/post inc/dec load/store.
unsigned getInRegsParamsCount() const
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.
static SDValue IsSingleInstrConstant(SDValue N, SelectionDAG &DAG, const ARMSubtarget *ST, const SDLoc &dl)
const MCInstrDesc & getDesc() const
Returns the target instruction descriptor of this MachineInstr.
unsigned getNumOperands() const
Return the number of values used by this operation.
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 all_of(R &&range, UnaryPredicate P)
Provide wrappers to std::all_of which take ranges instead of having to pass begin/end explicitly...
const std::string & getConstraintString() const
const Function * getParent() const
Return the enclosing method, or null if none.
unsigned getNumOperands() const
unsigned getValueSizeInBits() const
Returns the size of the value in bits.
static SDValue combineSelectAndUseCommutative(SDNode *N, bool AllOnes, TargetLowering::DAGCombinerInfo &DCI)
const SDValue & getOperand(unsigned Num) const
void setIsDead(bool Val=true)
Attribute getFnAttribute(Attribute::AttrKind Kind) const
Return the attribute for the given attribute kind.
const Function * getFunction() const
getFunction - Return the LLVM function that this machine code represents
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...
unsigned getBitWidth() const
Get the number of bits in this IntegerType.
static IntegerType * getInt64Ty(LLVMContext &C)
bool isUnknown() const
Returns true if we don't know any bits.
[US]{MIN/MAX} - Binary minimum or maximum or signed or unsigned integers.
an instruction that atomically reads a memory location, combines it with another value, and then stores the result back.
SDValue getTargetExternalSymbol(const char *Sym, EVT VT, unsigned char TargetFlags=0)
bool isMustTailCall() const
Tests if this call site must be tail call optimized.
SDValue getNode(unsigned Opcode, const SDLoc &DL, EVT VT, ArrayRef< SDUse > Ops)
Gets or creates the specified node.
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.
void print(raw_ostream &OS, bool SkipOpers=false, bool SkipDebugLoc=false, const TargetInstrInfo *TII=nullptr) const
Debugging supportPrint this MI to OS.
bool isLegalInterleavedAccessType(VectorType *VecTy, const DataLayout &DL) const
Returns true if VecTy is a legal interleaved access type.
AtomicExpansionKind
Enum that specifies what an atomic load/AtomicRMWInst is expanded to, if at all.
Type * getElementType() const
unsigned getFunctionNumber() const
getFunctionNumber - Return a unique ID for the current function.
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...
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...
bool isThumb1Only() const
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...
unsigned getValNo() const
const SDValue & getBasePtr() const
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 ...
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...
static bool isThumb(const MCSubtargetInfo &STI)
unsigned createPICLabelUId()
OUTCHAIN = ATOMIC_FENCE(INCHAIN, ordering, scope) This corresponds to the fence instruction.
CCAssignFn * CCAssignFnForCall(CallingConv::ID CC, bool isVarArg) const
Select with condition operator - This selects between a true value and a false value (ops #2 and #3) ...
unsigned getResNo() const
get the index which selects a specific result in the SDNode
Libcall getFPROUND(EVT OpVT, EVT RetVT)
getFPROUND - Return the FPROUND_*_* value for the given types, or UNKNOWN_LIBCALL if there is none...
bool bitsLT(EVT VT) const
Return true if this has less bits than VT.
bool isUndef() const
Return true if the type of the node type undefined.
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.
bool optForMinSize() const
Optimize this function for minimum size (-Oz).
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)
CallingConv::ID getCallingConv() const
getCallingConv()/setCallingConv(CC) - These method get and set the calling convention of this functio...
bool isOSWindows() const
Tests whether the OS is Windows.
void setTruncStoreAction(MVT ValVT, MVT MemVT, LegalizeAction Action)
Indicate that the specified truncating store does not work with the specified type and indicate what ...
RESULT,OUTCHAIN = INTRINSIC_W_CHAIN(INCHAIN, INTRINSICID, arg1, ...) This node represents a target in...
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...
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 Triple & getTargetTriple() const
const ARMBaseInstrInfo * getInstrInfo() const override
OUTCHAIN = EH_SJLJ_LONGJMP(INCHAIN, buffer) This corresponds to the eh.sjlj.longjmp intrinsic...
SDIVREM/UDIVREM - Divide two integers and produce both a quotient and remainder result.
ARM_AAPCS_VFP - Same as ARM_AAPCS, but uses hard floating point ABI.
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...
bool isVector() const
Return true if this is a vector value type.
SDValue getIntPtrConstant(uint64_t Val, const SDLoc &DL, bool isTarget=false)
The address of a basic block.
bool isTargetAEABI() const
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 useSoftFloat() const
bool isOffsetFoldingLegal(const GlobalAddressSDNode *GA) const override
Return true if folding a constant offset with the given GlobalAddress is legal.
int getOperandCycle(unsigned ItinClassIndx, unsigned OperandIdx) const
Return the cycle for the given class and operand.
static bool isFloatingPointZero(SDValue Op)
isFloatingPointZero - Return true if this is +0.0.
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 ...
static SDValue PerformLOADCombine(SDNode *N, TargetLowering::DAGCombinerInfo &DCI)
Twine - A lightweight data structure for efficiently representing the concatenation of temporary valu...
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.
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)
Shift and rotation operations.
static bool isVUZPMask(ArrayRef< int > M, EVT VT, unsigned &WhichResult)
bool isTargetDarwin() const
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.
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.
static Constant * get(LLVMContext &Context, ArrayRef< uint8_t > Elts)
get() constructors - Return a constant with array type with an element count and element type matchin...
bool isBuildVectorAllZeros(const SDNode *N)
Return true if the specified node is a BUILD_VECTOR where all of the elements are 0 or undef...
Type * getArrayElementType() const
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...
EVT getValueType(unsigned ResNo) const
Return the type of a specified result.
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)
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.
MachineFunction & getMachineFunction() const
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...
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.
separate const offset from Split GEPs to a variadic base and a constant offset for better CSE
bool isReg() const
isReg - Tests if this is a MO_Register operand.
unsigned getNumArgOperands() const
Return the number of call arguments.
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...
This provides a uniform API for creating instructions and inserting them into a basic block: either a...
unsigned getArgRegsSaveSize() const
ARM_APCS - ARM Procedure Calling Standard calling convention (obsolete, but still used on some target...
LLVM_ATTRIBUTE_ALWAYS_INLINE R Default(const T &Value) const
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...
Reg
All possible values of the reg field in the ModR/M byte.
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.
The memory access is dereferenceable (i.e., doesn't trap).
EVT getScalarType() const
If this is a vector type, return the element type, otherwise return this.
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.
ObjectFormatType getObjectFormat() const
getFormat - Get the object format for this triple.
const GlobalObject * getBaseObject() const
bool isFixedObjectIndex(int ObjectIdx) const
Returns true if the specified index corresponds to a fixed stack object.
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...
bool hasMPExtension() const
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...
bool isStrongDefinitionForLinker() const
Returns true if this global's definition will be the one chosen by the linker.
int getMaskElt(unsigned Idx) const
static bool isSingletonVEXTMask(ArrayRef< int > M, EVT VT, unsigned &Imm)
bool isPositionIndependent() 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...
bool isFPBrccSlow() const
Type * getVectorElementType() const
CCAssignFn * CCAssignFnForReturn(CallingConv::ID CC, bool isVarArg) 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.
static SDValue PerformMULCombine(SDNode *N, TargetLowering::DAGCombinerInfo &DCI, const ARMSubtarget *Subtarget)
const MachineInstrBuilder & addImm(int64_t Val) const
Add a new immediate operand.
This class defines information used to lower LLVM code to legal SelectionDAG operators that the targe...
Sched::Preference getSchedulingPreference() const
Return target scheduling preference.
bool isInteger() const
Return true if this is an integer or a vector integer type.
This file implements a class to represent arbitrary precision integral constant values and operations...
static unsigned getStOpcode(unsigned StSize, bool IsThumb1, bool IsThumb2)
Return the store opcode for a given store size.
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())
LLVM_NODISCARD bool empty() const
unsigned getNumOperands() const
Access to explicit operands of the instruction.
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...
SmallVector< ISD::InputArg, 32 > Ins
AtomicOrdering
Atomic ordering for LLVM's memory model.
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).
EVT getVectorElementType() const
Given a vector type, return the type of each element.
unsigned getPointerAddressSpace() const
Returns the address space of the pointer operand.
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 const unsigned PerfectShuffleTable[6561+1]
Value * CreateIntToPtr(Value *V, Type *DestTy, const Twine &Name="")
static SDValue LowerINSERT_VECTOR_ELT(SDValue Op, SelectionDAG &DAG)
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...
void RemoveOperand(unsigned i)
Erase an operand from an instruction, leaving it with one fewer operand than it started with...
bool lowerInterleavedLoad(LoadInst *LI, ArrayRef< ShuffleVectorInst * > Shuffles, ArrayRef< unsigned > Indices, unsigned Factor) const override
Lower an interleaved load into a vldN intrinsic.
unsigned getLocReg() 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...
Value * CreateBitCast(Value *V, Type *DestTy, const Twine &Name="")
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.
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.
const Triple & getTargetTriple() const
LLVMContext & getContext() const
Return the LLVMContext in which this type was uniqued.
const uint32_t * getThisReturnPreservedMask(const MachineFunction &MF, CallingConv::ID) const
getThisReturnPreservedMask - Returns a call preserved mask specific to the case that 'returned' is on...
OUTCHAIN = EH_SJLJ_SETUP_DISPATCH(INCHAIN) The target initializes the dispatch table here...
static SDValue LowerVECTOR_SHUFFLE(SDValue Op, SelectionDAG &DAG)
static unsigned createNEONModImm(unsigned OpCmode, unsigned Val)
unsigned createJumpTableIndex(const std::vector< MachineBasicBlock * > &DestBBs)
createJumpTableIndex - Create a new jump table.
std::pair< SDValue, SDValue > LowerCallTo(CallLoweringInfo &CLI) const
This function lowers an abstract call to a function into an actual call.
Value * concatenateVectors(IRBuilder<> &Builder, ArrayRef< Value * > Vecs)
Concatenate a list of vectors.
unsigned getNumValues() const
Return the number of values defined/returned by this operator.
bool isTargetCOFF() const
SDValue getRegisterMask(const uint32_t *RegMask)
bool hasStructRetAttr() const
Determine if the function returns a structure through first or second pointer argument.
bool isHalfTy() const
Return true if this is 'half', a 16-bit IEEE fp type.
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)
bool isTargetMachO() const
This contains information for each constraint that we are lowering.
Simple integer binary arithmetic operators.
static int getT2SOImmVal(unsigned Arg)
getT2SOImmVal - Given a 32-bit immediate, if it is something that can fit into a Thumb-2 shifter_oper...
void addInRegsParamInfo(unsigned RegBegin, unsigned RegEnd)
SmallVector< ISD::OutputArg, 32 > Outs
ArrayRef - Represent a constant reference to an array (0 or more elements consecutively in memory)...
unsigned getActiveBits() const
Compute the number of active bits in the value.
CallLoweringInfo & setZExtResult(bool Value=true)
bool isFloatingPointTy() const
Return true if this is one of the six floating-point types.
bool hasAnyDataBarrier() const
Function * getDeclaration(Module *M, ID id, ArrayRef< Type * > Tys=None)
Create or insert an LLVM Function declaration for an intrinsic, and return it.
const SDValue & getBasePtr() const
MachineConstantPoolValue * getMachineCPVal() const
SDValue getUNDEF(EVT VT)
Return an UNDEF node. UNDEF does not have a useful SDLoc.
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...
const APInt & getAPIntValue() const
EVT getValueType(const DataLayout &DL, Type *Ty, bool AllowUnknown=false) const
Return the EVT corresponding to this LLVM type.
bool isArrayTy() const
True if this is an instance of ArrayType.
static int getFP32Imm(const APInt &Imm)
getFP32Imm - Return an 8-bit floating-point version of the 32-bit floating-point value.
EVT getMemoryVT() const
Return the type of the in-memory value.
CodeGenOpt::Level getOptLevel() const
Returns the optimization level: None, Less, Default, or Aggressive.
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)
unsigned getBitWidth() const
Get the bit width of this value.
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))
bool isTargetWatchOS() const
const DataLayout & getDataLayout() const
Return the DataLayout attached to the Module associated to this MF.
LLVM_NODISCARD LLVM_ATTRIBUTE_ALWAYS_INLINE size_t size() const
size - Get the string size.
bool isThumb1OnlyFunction() const
static SDValue LowerVSETCC(SDValue Op, SelectionDAG &DAG)
static const MCPhysReg GPRArgRegs[]
Value * CreateZExtOrBitCast(Value *V, Type *DestTy, const Twine &Name="")
RESULT = INTRINSIC_WO_CHAIN(INTRINSICID, arg1, arg2, ...) This node represents a target intrinsic fun...
const uint32_t * getSjLjDispatchPreservedMask(const MachineFunction &MF) const
Type * getElementType() const
size_t size() const
size - Get the array size.
MachineBasicBlock * CreateMachineBasicBlock(const BasicBlock *bb=nullptr)
CreateMachineBasicBlock - Allocate a new MachineBasicBlock.
const DataLayout & getDataLayout() const
static MachinePointerInfo getStack(MachineFunction &MF, int64_t Offset)
Stack pointer relative access.
static SDValue FindBFIToCombineWith(SDNode *N)
Class to represent pointers.
const BasicBlock * getBasicBlock() const
Return the LLVM basic block that this instance corresponded to originally.
UNDEF - An undefined node.
This class is used to represent ISD::STORE nodes.
unsigned getOpcode() const
Returns the opcode of this MachineInstr.
FP_TO_[US]INT - Convert a floating point value to a signed or unsigned integer.
static bool isThumbImmShiftedVal(unsigned V)
isThumbImmShiftedVal - Return true if the specified value can be obtained by left shifting a 8-bit im...
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.
const MachineBasicBlock * getParent() const
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
static APInt getHighBitsSet(unsigned numBits, unsigned hiBitsSet)
Get a value with high bits set.
INITIALIZE_PASS(HexagonEarlyIfConversion,"hexagon-eif","Hexagon early if conversion", false, false) bool HexagonEarlyIfConversion MachineBasicBlock * SB
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.
void softenSetCCOperands(SelectionDAG &DAG, EVT VT, SDValue &NewLHS, SDValue &NewRHS, ISD::CondCode &CCCode, const SDLoc &DL) const
Soften the operands of a comparison.
static EVT getExtensionTo64Bits(const EVT &OrigVT)
bool hasDivideInThumbMode() const
SDNode * getNode() const
get the SDNode which holds the desired result
The memory access is volatile.
void setReturnRegsCount(unsigned s)
bool isExtractSubvectorCheap(EVT ResVT, unsigned Index) const override
Return true if EXTRACT_SUBVECTOR is cheap for this result type with this index.
constexpr uint64_t MinAlign(uint64_t A, uint64_t B)
A and B are either alignments or offsets.
virtual void finalizeLowering(MachineFunction &MF) const
Execute target specific actions to finalize target lowering.
MachineInstrBuilder BuildMI(MachineFunction &MF, const DebugLoc &DL, const MCInstrDesc &MCID)
Builder interface. Specify how to create the initial instruction itself.
unsigned getScalarSizeInBits() const
unsigned getStoreSize() const
Return the number of bytes overwritten by a store of the specified value type.
bool isTypeLegal(EVT VT) const
Return true if the target has native support for the specified value type.
A switch()-like statement whose cases are string literals.
Type * getParamType(unsigned i) const
Parameter type accessors.
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 SDValue PerformADDCombine(SDNode *N, TargetLowering::DAGCombinerInfo &DCI, const ARMSubtarget *Subtarget)
PerformADDCombine - Target-specific dag combine xforms for ISD::ADD.
bool isOnlyUserOf(const SDNode *N) const
Return true if this node is the only use of N.
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.
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.
unsigned UnsafeFPMath
UnsafeFPMath - This flag is enabled when the -enable-unsafe-fp-math flag is specified on the command ...
bool isInteger() const
Return true if this is an integer or a vector integer type.
READ_REGISTER, WRITE_REGISTER - This node represents llvm.register on the DAG, which implements the n...
unsigned getAlignment() const
Return the alignment of the access that is being performed.
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...
static int getFP32Imm(const APInt &Imm)
getFP32Imm - Return an 8-bit floating-point version of the 32-bit floating-point value.
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...
APInt trunc(unsigned width) const
Truncate to new width.
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.
bool isMachineConstantPoolEntry() const
SDValue PerformCMOVToBFICombine(SDNode *N, SelectionDAG &DAG) const
static SDValue PerformVDIVCombine(SDNode *N, SelectionDAG &DAG, const ARMSubtarget *Subtarget)
PerformVDIVCombine - VCVT (fixed-point to floating-point, Advanced SIMD) can replace combinations of ...
CodeModel::Model getCodeModel() const
Returns the code model.
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)
const SDValue & getOperand(unsigned i) const
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.
FunctionType * getFunctionType() const
Returns the FunctionType for me.
void addRegisterClass(MVT VT, const TargetRegisterClass *RC)
Add the specified register class as an available regclass for the specified value type...
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 isVectorTy() const
True if this is an instance of VectorType.
SDValue getMemIntrinsicNode(unsigned Opcode, const SDLoc &dl, SDVTList VTList, ArrayRef< SDValue > Ops, EVT MemVT, MachinePointerInfo PtrInfo, unsigned Align=0, bool Vol=false, bool ReadMem=true, bool WriteMem=true, unsigned Size=0)
Creates a MemIntrinsicNode that may produce a result and takes a list of operands.
bool supportsTailCall() const
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...
bool isOptionalDef() const
Set if this operand is a optional def.
MachineFrameInfo & getFrameInfo()
getFrameInfo - Return the frame info object for the current function.
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()
static SDValue LowerWRITE_REGISTER(SDValue Op, SelectionDAG &DAG)
INSERT_VECTOR_ELT(VECTOR, VAL, IDX) - Returns VECTOR with the element at IDX replaced with VAL...
const Constant * getConstVal() const
constexpr char Args[]
Key for Kernel::Metadata::mArgs.
This file contains the declarations for the subclasses of Constant, which represent the different fla...
static bool isSHL16(const SDValue &Op)
bool isFloatingPoint() const
Return true if this is a FP or a vector FP type.
const MachineOperand & getOperand(unsigned i) const
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))
Carry-using nodes for multiple precision addition and subtraction.
bool isFloatTy() const
Return true if this is 'float', a 32-bit IEEE fp type.
static ManagedStatic< OptionRegistry > OR
ConstantFP - Floating Point Values [float, double].
unsigned getSize() const
Return the number of bytes in the encoding of this instruction, or zero if the encoding size cannot b...
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)
unsigned getInRegsParamsProcessed() const
unsigned getScalarValueSizeInBits() const
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)
bool hasVAStart() const
Returns true if the function calls the llvm.va_start intrinsic.
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()
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)
virtual std::pair< unsigned, const TargetRegisterClass * > getRegForInlineAsmConstraint(const TargetRegisterInfo *TRI, StringRef Constraint, MVT VT) const
Given a physical register constraint (e.g.
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)
const MachineInstrBuilder & setMIFlags(unsigned Flags) const
bool isBeforeLegalize() const
static bool isSRA16(const SDValue &Op)
static GCMetadataPrinterRegistry::Add< ErlangGCPrinter > X("erlang","erlang-compatible garbage collector")
static EVT getFloatingPointVT(unsigned BitWidth)
Returns the EVT that represents a floating-point type with the given number of bits.
static SDValue promoteToConstantPool(const GlobalValue *GV, SelectionDAG &DAG, EVT PtrVT, const SDLoc &dl)
unsigned getBitWidth() const
Return the number of bits in the APInt.
Ty * getInfo()
getInfo - Keep track of various per-function pieces of information for backends that would like to do...
unsigned getOpcode() const
uint64_t getNumElements() const
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.
Thread Local Storage (General Dynamic Mode)
bool isTargetWatchABI() const
Value * getOperand(unsigned i) 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 PerformCMOVCombine(SDNode *N, SelectionDAG &DAG) const
PerformCMOVCombine - Target-specific DAG combining for ARMISD::CMOV.
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...
bool hasVMLxForwarding() const
self_iterator getIterator()
The memory access is non-temporal.
Class to represent integer types.
static MVT getVT(Type *Ty, bool HandleUnknown=false)
Return the value type corresponding to the specified type.
int CreateFixedObject(uint64_t Size, int64_t SPOffset, bool Immutable, bool isAliased=false)
Create a new object at a fixed location on the stack.
unsigned countPopulation() const
Count the number of bits set.
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)
static SDValue PerformARMBUILD_VECTORCombine(SDNode *N, TargetLowering::DAGCombinerInfo &DCI)
Target-specific dag combine xforms for ARMISD::BUILD_VECTOR.
bool useNEONForSinglePrecisionFP() const
bool empty() const
empty - Check if the array is empty.
use_iterator use_begin() const
Provide iteration support to walk over all uses of an SDNode.
bool hasV8MBaselineOps() const
MachineConstantPool * getConstantPool()
getConstantPool - Return the constant pool object for the current function.
const SDValue & getValue() const
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.
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...
bool MaskedValueIsZero(SDValue Op, const APInt &Mask, unsigned Depth=0) const
Return true if 'Op & Mask' is known to be zero.
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)
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.
bool isPointerTy() const
True if this is an instance of PointerType.
static SDValue AddCombineTo64bitUMAAL(SDNode *AddeNode, TargetLowering::DAGCombinerInfo &DCI, const ARMSubtarget *Subtarget)
const APFloat & getValueAPF() const
unsigned getNextStackOffset() const
getNextStackOffset - Return the next stack offset such that all stack slots satisfy their alignment r...
bool hasSinCos() const
This function returns true if the target has sincos() routine in its compiler runtime or math librari...
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)
This structure contains all information that is necessary for lowering calls.
bool shouldAssumeDSOLocal(const Module &M, const GlobalValue *GV) const
static bool isLTorLE(ISD::CondCode CC)
bool isFPOrFPVectorTy() const
Return true if this is a FP type or a vector of FP.
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)
bool hasRetAddrStack() const
static ARMConstantPoolMBB * Create(LLVMContext &C, const MachineBasicBlock *mbb, unsigned ID, unsigned char PCAdj)
unsigned countTrailingZeros() const
Count the number of trailing zero bits.
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).
This class contains a discriminated union of information about pointers in memory operands...
bool isPowerOf2() const
Check if this APInt's value is a power of two greater than zero.
static SDValue LowerSDIV_v4i8(SDValue X, SDValue Y, const SDLoc &dl, SelectionDAG &DAG)
void setLibcallCallingConv(RTLIB::Libcall Call, CallingConv::ID CC)
Set the CallingConv that should be used for the specified libcall.
int getOperandConstraint(unsigned OpNum, MCOI::OperandConstraint Constraint) const
Returns the value of the specific constraint if it is set.
std::pair< unsigned, const TargetRegisterClass * > RCPair
static SDValue lowerCTPOP16BitElements(SDNode *N, SelectionDAG &DAG)
lowerCTPOP16BitElements - Returns a v4i16/v8i16 vector containing the bit-count for each 16-bit eleme...
Value * CreateTrunc(Value *V, Type *DestTy, const Twine &Name="")
const SDValue & getRoot() const
Return the root tag of the SelectionDAG.
const MCInstrDesc & get(unsigned Opcode) const
Return the machine instruction descriptor that corresponds to the specified instruction opcode...
bool genExecuteOnly() const
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 isEXTLoad(const SDNode *N)
Returns true if the specified node is a EXTLOAD.
static bool isReleaseOrStronger(AtomicOrdering ao)
const MachinePointerInfo & getPointerInfo() const
ARM_AAPCS - ARM Architecture Procedure Calling Standard calling convention (aka EABI).
int64_t getObjectOffset(int ObjectIdx) const
Return the assigned stack offset of the specified object from the incoming stack pointer.
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 getByValAlign() const
unsigned getMaxSupportedInterleaveFactor() const override
Get the maximum supported factor for interleaved memory accesses.
The memory access writes data.
static const int BlockSize
void SplitString(StringRef Source, SmallVectorImpl< StringRef > &OutFragments, StringRef Delimiters=" \t\n\v\f\r")
SplitString - Split up the specified string according to the specified delimiters, appending the result fragments to the output list.
bool bitsGT(EVT VT) const
Return true if this has more bits than VT.
bool genLongCalls() const
virtual const TargetSubtargetInfo * getSubtargetImpl(const Function &) const
Virtual method implemented by subclasses that returns a reference to that target's TargetSubtargetInf...
ArrayRef< int > getMask() const
Libcall getFPEXT(EVT OpVT, EVT RetVT)
getFPEXT - Return the FPEXT_*_* value for the given types, or UNKNOWN_LIBCALL if there is none...
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...
static SDValue PerformShiftCombine(SDNode *N, SelectionDAG &DAG, const ARMSubtarget *ST)
PerformShiftCombine - Checks for immediate versions of vector shifts and lowers them.
static AddrOpc getAM2Op(unsigned AM2Opc)
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)
bool hasExternalWeakLinkage() const
TokenFactor - This node takes multiple tokens as input and produces a single token result...
bool hasDLLImportStorageClass() const
static int getFP64Imm(const APInt &Imm)
getFP64Imm - Return an 8-bit floating-point version of the 64-bit floating-point value.
Iterator for intrusive lists based on ilist_node.
void setPromotedConstpoolIncrease(int Sz)
CCState - This class holds information needed while lowering arguments and return values...
SmallPtrSet - This class implements a set which is optimized for holding SmallSize or less elements...
void addSuccessor(MachineBasicBlock *Succ, BranchProbability Prob=BranchProbability::getUnknown())
Add Succ as a successor of this MachineBasicBlock.
bool isGVIndirectSymbol(const GlobalValue *GV) const
True if the GV will be accessed via an indirect symbol.
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.
auto find(R &&Range, const T &Val) -> decltype(std::begin(Range))
Provide wrappers to std::find which take ranges instead of having to pass begin/end explicitly...
void addOperand(MachineFunction &MF, const MachineOperand &Op)
Add the specified operand to the instruction.
static bool isStrongerThanMonotonic(AtomicOrdering ao)
const char * getLibcallName(RTLIB::Libcall Call) const
Get the libcall routine name for the specified libcall.
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.
EXTRACT_VECTOR_ELT(VECTOR, IDX) - Returns a single element from VECTOR identified by the (potentially...
uint64_t getTypeAllocSize(Type *Ty) const
Returns the offset in bytes between successive objects of the specified type, including alignment pad...
static StructType * get(LLVMContext &Context, ArrayRef< Type * > Elements, bool isPacked=false)
This static method is the primary way to create a literal StructType.
static SDValue LowerVectorINT_TO_FP(SDValue Op, SelectionDAG &DAG)
static unsigned getAM2Offset(unsigned AM2Opc)
This is used to represent a portion of an LLVM function in a low-level Data Dependence DAG representa...
const Module * getModule() const
Return the module owning the function this instruction belongs to or nullptr it the function does not...
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.
unsigned logBase2() const
const MachineInstrBuilder & addJumpTableIndex(unsigned Idx, unsigned char TargetFlags=0) const
MachineOperand class - Representation of each machine instruction operand.
bool isPredecessorOf(const SDNode *N) const
Return true if this node is a predecessor of N.
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 bool isReadOnly(const GlobalValue *GV)
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...
Type * getType() const
All values are typed, get the type of this value.
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.
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)
size_type count(ConstPtrType Ptr) const
count - Return 1 if the specified pointer is in the set, 0 otherwise.
BRCOND - Conditional branch.
const SDValue & getChain() 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.
MachineMemOperand * getMemOperand() const
Return a MachineMemOperand object describing the memory reference performed by operation.
This is an abstract virtual class for memory operations.
BasicBlock * GetInsertBlock() const
bool isTargetAndroid() const
static bool isAddSubZExt(SDNode *N, SelectionDAG &DAG)
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)
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.
Function * getCalledFunction() const
Return the function called, or null if this is an indirect function invocation.
bool isFPImmLegal(const APFloat &Imm, EVT VT) const override
isFPImmLegal - Returns true if the target can instruction select the specified FP immediate natively...
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.
const MachineInstrBuilder & addFrameIndex(int Idx) const
static void checkVSELConstraints(ISD::CondCode CC, ARMCC::CondCodes &CondCode, bool &swpCmpOps, bool &swpVselOps)
unsigned getPointerAddressSpace() const
Returns the address space of the pointer operand.
void setAdjustsStack(bool V)
SDValue getNOT(const SDLoc &DL, SDValue Val, EVT VT)
Create a bitwise NOT operation as (XOR Val, -1).
static SDValue ExpandBITCAST(SDNode *N, SelectionDAG &DAG)
ExpandBITCAST - If the target supports VFP, this function is called to expand a bit convert where eit...
std::pair< unsigned, const TargetRegisterClass * > getRegForInlineAsmConstraint(const TargetRegisterInfo *TRI, StringRef Constraint, MVT VT) const override
Given a physical register constraint (e.g.
AAMDNodes getAAInfo() const
Returns the AA info that describes the dereference.
SDValue getCopyToReg(SDValue Chain, const SDLoc &dl, unsigned Reg, SDValue N)
raw_ostream & dbgs()
dbgs() - This returns a reference to a raw_ostream for debugging messages.
static mvt_range integer_valuetypes()
static bool isS16(const SDValue &Op, SelectionDAG &DAG)
bool isInTailCallPosition(SelectionDAG &DAG, SDNode *Node, SDValue &Chain) const
Check whether a given call node is in tail position within its function.
C - The default llvm calling convention, compatible with C.
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.
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...
Value * getArgOperand(unsigned i) const
getArgOperand/setArgOperand - Return/set the i-th call argument.
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...
ISD::LoadExtType getExtensionType() const
Return whether this is a plain node, or one of the varieties of value-extending loads.
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.
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...
Class for arbitrary precision integers.
Synchronized with respect to signal handlers executing in the same thread.
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))
int64_t getSExtValue() const
op_iterator op_begin() const
bool isIntegerTy() const
True if this is an instance of IntegerType.
unsigned EmulatedTLS
EmulatedTLS - This flag enables emulated TLS model, using emutls function in the runtime library...
virtual const TargetRegisterClass * getRegClassFor(MVT VT) const
Return the register class that should be used for the specified value type.
static use_iterator use_end()
typename SuperClass::iterator iterator
iterator_range< user_iterator > users()
ZERO_EXTEND - Used for integer types, zeroing the new bits.
bool hasAtomicStore() const
Return true if this atomic instruction stores to memory.
unsigned getVectorNumElements() const
void AnalyzeCallOperands(const SmallVectorImpl< ISD::OutputArg > &Outs, CCAssignFn Fn)
AnalyzeCallOperands - Analyze the outgoing arguments to a call, incorporating info about the passed v...
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.
const DebugLoc & getDebugLoc() const
Returns the debug location id of this MachineInstr.
iterator insert(iterator I, T &&Elt)
FCOPYSIGN(X, Y) - Return the value of X with the sign of Y.
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...
bool isTargetGNUAEABI() const
static int getSOImmVal(unsigned Arg)
getSOImmVal - Given a 32-bit immediate, if it is something that can fit into an shifter_operand immed...
void setArgumentStackSize(unsigned size)
bool isOSVersionLT(unsigned Major, unsigned Minor=0, unsigned Micro=0) const
isOSVersionLT - Helper function for doing comparisons against version numbers included in the target ...
static SDValue PerformXORCombine(SDNode *N, TargetLowering::DAGCombinerInfo &DCI, const ARMSubtarget *Subtarget)
static bool isVTBLMask(ArrayRef< int > M, EVT VT)
constexpr char Size[]
Key for Kernel::Arg::Metadata::mSize.
static bool isAcquireOrStronger(AtomicOrdering ao)
bool isCheapToSpeculateCtlz() const override
Return true if it is cheap to speculate a call to intrinsic ctlz.
llvm_unreachable("Unknown RegBank!")
static SDValue PerformVCVTCombine(SDNode *N, SelectionDAG &DAG, const ARMSubtarget *Subtarget)
PerformVCVTCombine - VCVT (floating-point to fixed-point, Advanced SIMD) can replace combinations of ...
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.
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)
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)
static MDTuple * get(LLVMContext &Context, ArrayRef< Metadata * > MDs)
BR_JT - Jumptable branch.
static std::vector< std::string > Flags
bool getTgtMemIntrinsic(IntrinsicInfo &Info, const CallInst &I, unsigned Intrinsic) const override
getTgtMemIntrinsic - Represent NEON load and store intrinsics as MemIntrinsicNodes.
bool isAllOnesValue() const
Determine if all bits are set.
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.
static SDValue PerformAddcSubcCombine(SDNode *N, SelectionDAG &DAG, const ARMSubtarget *Subtarget)
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)
const DataLayout & getDataLayout() const
Get the data layout for the module's target platform.
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...
LLVM_ATTRIBUTE_ALWAYS_INLINE iterator end()
void setVarArgsFrameIndex(int Index)
SmallVector< SDValue, 32 > OutVals
unsigned getSchedClass() const
Return the scheduling class for this instruction.
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)
LowerToByteSwap - Replace a call instruction into a call to bswap intrinsic.
bool isOSBinFormatELF() const
Tests whether the OS uses the ELF binary format.
Bitwise operators - logical and, logical or, logical xor.
bool hasAnyUseOfValue(unsigned Value) const
Return true if there are any use of the indicated value.
bool hasFnAttribute(Attribute::AttrKind Kind) const
Return true if the function has the attribute.
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)
static MachineOperand condCodeOp(unsigned CCReg=0)
Get the operand corresponding to the conditional code result.
MachineRegisterInfo & getRegInfo()
getRegInfo - Return information about the registers currently in use.
static IntegerType * getInt32Ty(LLVMContext &C)
virtual void LowerAsmOperandForConstraint(SDValue Op, std::string &Constraint, std::vector< SDValue > &Ops, SelectionDAG &DAG) const
Lower the specified operand into the Ops vector.
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...
SMUL_LOHI/UMUL_LOHI - Multiply two integers of type iN, producing a signed/unsigned value of type i[2...
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)
SIGN_EXTEND_INREG - This operator atomically performs a SHL/SRA pair to sign extend a small value in ...
unsigned getAlignment() const
Return the alignment of the access that is being performed.
bool isVectorLoadExtDesirable(SDValue ExtVal) const override
Return true if folding a vector load into ExtVal (a sign, zero, or any extend node) is profitable...
ARMFunctionInfo - This class is derived from MachineFunctionInfo and contains private ARM-specific in...
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...
unsigned getSizeInBits() const
Return the size of the specified value type in bits.
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 ReplaceAllUsesWith(SDValue From, SDValue Op)
Modify anything using 'From' to use 'To' instead.
void setReg(unsigned Reg)
Change the register this operand corresponds to.
const MachineInstrBuilder & addConstantPoolIndex(unsigned Idx, int Offset=0, unsigned char TargetFlags=0) const
void setArgRegsSaveSize(unsigned s)
const MachineInstrBuilder & addMemOperand(MachineMemOperand *MMO) const
static MachineOperand CreateImm(int64_t Val)
bool isOSMSVCRT() const
Is this a "Windows" OS targeting a "MSVCRT.dll" environment.
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...
void AnalyzeReturn(const SmallVectorImpl< ISD::OutputArg > &Outs, CCAssignFn Fn)
AnalyzeReturn - Analyze the returned values of a return, incorporating info about the result values i...
LLVM_ATTRIBUTE_ALWAYS_INLINE size_type size() const
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.
APFloat abs(APFloat X)
Returns the absolute value of the argument.
const ARMBaseRegisterInfo * getRegisterInfo() const override
constexpr char Align[]
Key for Kernel::Arg::Metadata::mAlign.
The memory access always returns the same value (or traps).
CallInst * CreateCall(Value *Callee, ArrayRef< Value * > Args=None, const Twine &Name="", MDNode *FPMathTag=nullptr)
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.
bool allowsUnalignedMem() const
const TargetMachine & getTarget() const
getTarget - Return the target machine this machine code is compiled with
Fast - This calling convention attempts to make calls as fast as possible (e.g.
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)
VectorType * getType() const
Overload to return most specific vector type.
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.
static bool getARMIndexedAddressParts(SDNode *Ptr, EVT VT, bool isSEXTLoad, SDValue &Base, SDValue &Offset, bool &isInc, SelectionDAG &DAG)
static SDValue LowerSETCCE(SDValue Op, SelectionDAG &DAG)
FSINCOS - Compute both fsin and fcos as a single operation.
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.
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.
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.
CopyFromReg - This node indicates that the input value is a virtual or physical register that is defi...
EVT getValueType() const
Return the ValueType of the referenced return value.
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.
MachineInstr * getVRegDef(unsigned Reg) const
getVRegDef - Return the machine instr that defines the specified virtual register or null if none is ...
bool useMovt(const MachineFunction &MF) const
SDValue getCondCode(ISD::CondCode Cond)
LLVM_NODISCARD bool empty() const
EnvironmentType getEnvironment() const
getEnvironment - Get the parsed environment type of this triple.
Like SetCC, ops #0 and #1 are the LHS and RHS operands to compare, and op #2 is a carry value...
Libcall getSINTTOFP(EVT OpVT, EVT RetVT)
getSINTTOFP - Return the SINTTOFP_*_* value for the given types, or UNKNOWN_LIBCALL if there is none...
bool is128BitVector() const
Return true if this is a 128-bit vector type.
TLSModel::Model getTLSModel(const GlobalValue *GV) const
Returns the TLS model which should be used for the given global variable.
static bool isGTorGE(ISD::CondCode CC)
static SDValue PerformVLDCombine(SDNode *N, TargetLowering::DAGCombinerInfo &DCI)
CONCAT_VECTORS(VECTOR0, VECTOR1, ...) - Given a number of values of vector type with the same length ...
unsigned getReg() const
getReg - Returns the register number.
StringRef getValueAsString() const
Return the attribute's value as a string.
bool isFloatingPoint() const
Return true if this is a FP or a vector FP type.
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 isTargetMuslAEABI() const
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)
SDValue PerformBRCONDCombine(SDNode *N, SelectionDAG &DAG) const
PerformBRCONDCombine - Target-specific DAG combining for ARMISD::BRCOND.
void setReturnAddressIsTaken(bool s)
bool isSimple() const
Test if the given EVT is simple (as opposed to being extended).
const unsigned char * bytes_begin() const
unsigned getAlignment() const
static SDValue LowerPREFETCH(SDValue Op, SelectionDAG &DAG, const ARMSubtarget *Subtarget)
void setMinStackArgumentAlignment(unsigned Align)
Set the minimum stack alignment of an argument (in log2(bytes)).
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...
void setSchedulingPreference(Sched::Preference Pref)
Specify the target scheduling preference.
unsigned getNumInterleavedAccesses(VectorType *VecTy, const DataLayout &DL) const
Returns the number of interleaved accesses that will be generated when lowering accesses of the given...
bool isShuffleMaskLegal(const SmallVectorImpl< int > &M, EVT VT) const override
isShuffleMaskLegal - Targets can use this to indicate that they only support some VECTOR_SHUFFLE oper...
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)
static SDValue PerformAddeSubeCombine(SDNode *N, SelectionDAG &DAG, const ARMSubtarget *Subtarget)
static bool isSaturatingConditional(const SDValue &Op, SDValue &V, uint64_t &K)
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.
int getVarArgsFrameIndex() const
SDValue getRegister(unsigned Reg, EVT VT)
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...
bool useLoadStackGuardNode() const override
If this function returns true, SelectionDAGBuilder emits a LOAD_STACK_GUARD node when it is lowering ...
const MachineInstrBuilder & addMBB(MachineBasicBlock *MBB, unsigned char TargetFlags=0) const
Instruction * makeDMB(IRBuilder<> &Builder, ARM_MB::MemBOpt Domain) const
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.
bool isTruncatingStore() const
Return true if the op does a truncation before store.
void push_back(MachineBasicBlock *MBB)
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...
#define LLVM_FALLTHROUGH
LLVM_FALLTHROUGH - Mark fallthrough cases in switch statements.
ARMTargetLowering(const TargetMachine &TM, const ARMSubtarget &STI)
unsigned getNumOperands() const
Return the number of declared MachineOperands for this MachineInstruction.
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.
bool isWindowsItaniumEnvironment() const
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...
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...
ConstraintType getConstraintType(StringRef Constraint) const override
getConstraintType - Given a constraint letter, return the type of constraint it is for this target...
uint64_t getTypeSizeInBits(Type *Ty) const
Size examples:
Value * CreateLShr(Value *LHS, Value *RHS, const Twine &Name="", bool isExact=false)
const TargetLowering & getTargetLoweringInfo() const
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.Val alone...
bool preferISHSTBarriers() const
unsigned countLeadingZeros() const
The APInt version of the countLeadingZeros functions in MathExtras.h.
Primary interface to the complete machine description for the target machine.
bool hasDataBarrier() const
PointerType * getPointerTo(unsigned AddrSpace=0) const
Return a pointer to the current type.
static SDValue PerformSTORECombine(SDNode *N, TargetLowering::DAGCombinerInfo &DCI)
PerformSTORECombine - Target-specific dag combine xforms for ISD::STORE.
bool hasDivideInARMMode() const
static SDValue LowerUDIV(SDValue Op, SelectionDAG &DAG)
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.
virtual SDValue LowerToTLSEmulatedModel(const GlobalAddressSDNode *GA, SelectionDAG &DAG) const
Lower TLS global address SDNode for target independent emulated TLS model.
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.
static MachineBasicBlock * OtherSucc(MachineBasicBlock *MBB, MachineBasicBlock *Succ)
static BranchProbability getZero()
static GCMetadataPrinterRegistry::Add< OcamlGCMetadataPrinter > Y("ocaml","ocaml 3.10-compatible collector")
static SDValue AddCombineTo64bitMLAL(SDNode *AddeNode, TargetLowering::DAGCombinerInfo &DCI, const ARMSubtarget *Subtarget)
static SDValue LowerFPOWI(SDValue Op, const ARMSubtarget &Subtarget, SelectionDAG &DAG)
bool operator==(uint64_t V1, const APInt &V2)
bool hasOptionalDef(QueryType Type=IgnoreBundle) const
Set if this instruction has an optional definition, e.g.
MERGE_VALUES - This node takes multiple discrete operands and returns them all as its individual resu...
unsigned getLocMemOffset() const
MVT getVectorElementType() const
static bool isVolatile(Instruction *Inst)
SDValue getEntryNode() const
Return the token chain corresponding to the entry of the function.
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...
static SDValue LowerADDC_ADDE_SUBC_SUBE(SDValue Op, SelectionDAG &DAG)
TRUNCATE - Completely drop the high bits.
bool isUIntN(unsigned N, uint64_t x)
Checks if an unsigned integer fits into the given (dynamic) bit width.
unsigned getAlignment() const
bool isBitFieldInvertedMask(unsigned v)
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...
static void getShuffleMask(Constant *Mask, SmallVectorImpl< int > &Result)
Convert the input shuffle mask operand to a vector of integers.
const MachineInstrBuilder & addRegMask(const uint32_t *Mask) const
Instruction * emitLeadingFence(IRBuilder<> &Builder, Instruction *Inst, AtomicOrdering Ord) const override
Inserts in the IR a target-specific intrinsic specifying a fence.
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...
virtual ConstraintWeight getSingleConstraintMatchWeight(AsmOperandInfo &info, const char *constraint) const
Examine constraint string and operand type and determine a weight value.
Unlike LLVM values, Selection DAG nodes may return multiple values as the result of a computation...
const MachineInstrBuilder & addReg(unsigned RegNo, unsigned flags=0, unsigned SubReg=0) const
Add a new virtual register operand.
bool shouldExpandAtomicStoreInIR(StoreInst *SI) const override
Returns true if the given (atomic) store should be expanded by the IR-level AtomicExpand pass into an...
MVT getSimpleValueType(unsigned ResNo) const
Return the type of a specified result as a simple type.
static SDValue AddCombineBUILD_VECTORToVPADDL(SDNode *N, SDValue N0, SDValue N1, TargetLowering::DAGCombinerInfo &DCI, const ARMSubtarget *Subtarget)
bool isLegalT2ScaledAddressingMode(const AddrMode &AM, EVT VT) const
static bool allUsersAreInFunctions(const Value *V)
Return true if all users of V are within some (any) function, looking through ConstantExprs.
bool is64BitVector() const
Return true if this is a 64-bit vector type.
FNEG, FABS, FSQRT, FSIN, FCOS, FPOWI, FPOW, FLOG, FLOG2, FLOG10, FEXP, FEXP2, FCEIL, FTRUNC, FRINT, FNEARBYINT, FROUND, FFLOOR - Perform various unary floating point operations.
APInt lshr(unsigned shiftAmt) const
Logical right-shift function.
bool isEmpty() const
Returns true if there are no itineraries.
Value * getPointerOperand()
MachineInstr::mmo_iterator allocateMemRefsArray(unsigned long Num)
allocateMemRefsArray - Allocate an array to hold MachineMemOperand pointers.
static IntegerType * getInt8Ty(LLVMContext &C)
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.
Val, OUTCHAIN = ATOMIC_LOAD(INCHAIN, ptr) This corresponds to "load atomic" instruction.
bool isTargetWindows() const
const BasicBlock * getParent() const
int64_t getObjectSize(int ObjectIdx) const
Return the size of the specified object.
static ARMConstantPoolConstant * Create(const Constant *C, unsigned ID)
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)
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)
EVT changeVectorElementTypeToInteger() const
Return a vector with the same number of elements as this vector, but with the element type converted ...
static bool memOpAlign(unsigned DstAlign, unsigned SrcAlign, unsigned AlignCheck)
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
const uint32_t * getTLSCallPreservedMask(const MachineFunction &MF) const
static SDValue bitcastf32Toi32(SDValue Op, SelectionDAG &DAG)
auto count_if(R &&Range, UnaryPredicate P) -> typename std::iterator_traits< decltype(std::begin(Range))>::difference_type
Wrapper function around std::count_if to count the number of times an element satisfying a given pred...
MVT getSimpleVT() const
Return the SimpleValueType held in the specified simple EVT.
static void ReplaceLongIntrinsic(SDNode *N, SmallVectorImpl< SDValue > &Results, SelectionDAG &DAG)
CARRY_FALSE - This node is used when folding other nodes, like ADDC/SUBC, which indicate the carry re...
bool isMachineOpcode() const
Test if this node has a post-isel opcode, directly corresponding to a MachineInstr opcode...
LLVMContext & getContext() const
Get the global data context.
unsigned getMachineOpcode() const
This may only be called if isMachineOpcode returns true.
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...
uint64_t getZExtValue() const
static uint64_t decodeNEONModImm(unsigned ModImm, unsigned &EltBits)
decodeNEONModImm - Decode a NEON modified immediate value into the element value and the element size...
MemIndexedMode
MemIndexedMode enum - This enum defines the load / store indexed addressing modes.
mmo_iterator memoperands_begin() const
Access to memory operands of the instruction.
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...
unsigned getVectorNumElements() const
Given a vector type, return the number of elements it contains.
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...