94 void SelectionDAG::DAGNodeDeletedListener::anchor() {}
96 #define DEBUG_TYPE "selectiondag" 100 cl::desc(
"Gang up loads and stores generated by inlining of memcpy"));
103 cl::desc(
"Number limit for gluing ld/st of memcpy."),
119 return getValueAPF().bitwiseIsEqual(V);
145 unsigned SplatBitSize;
148 return BV->isConstantSplat(SplatVal, SplatUndef, SplatBitSize, HasUndefs,
150 EltSize == SplatBitSize;
170 if (i ==
e)
return false;
183 if (CN->getAPIntValue().countTrailingOnes() < EltSize)
186 if (CFPN->getValueAPF().bitcastToAPInt().countTrailingOnes() < EltSize)
194 for (++i; i !=
e; ++i)
207 bool IsAllUndef =
true;
222 if (CN->getAPIntValue().countTrailingZeros() < EltSize)
225 if (CFPN->getValueAPF().bitcastToAPInt().countTrailingZeros() < EltSize)
244 if (!isa<ConstantSDNode>(
Op))
257 if (!isa<ConstantFPSDNode>(
Op))
276 if (
auto *Cst = dyn_cast<ConstantSDNode>(Op))
292 if (!Cst || Cst->getValueType(0) != SVT || !
Match(Cst))
301 bool AllowUndefs,
bool AllowTypeMismatch) {
306 if (
auto *LHSCst = dyn_cast<ConstantSDNode>(LHS))
307 if (
auto *RHSCst = dyn_cast<ConstantSDNode>(RHS))
308 return Match(LHSCst, RHSCst);
319 bool LHSUndef = AllowUndefs && LHSOp.
isUndef();
320 bool RHSUndef = AllowUndefs && RHSOp.
isUndef();
323 if ((!LHSCst && !LHSUndef) || (!RHSCst && !RHSUndef))
325 if (!AllowTypeMismatch && (LHSOp.
getValueType() != SVT ||
328 if (!
Match(LHSCst, RHSCst))
352 unsigned OldL = (Operation >> 2) & 1;
353 unsigned OldG = (Operation >> 1) & 1;
377 bool isIntegerLike) {
407 unsigned Op = Op1 | Op2;
464 for (
auto& Op : Ops) {
473 for (
auto& Op : Ops) {
503 ID.
AddPointer(cast<ConstantFPSDNode>(N)->getConstantFPValue());
522 ID.
AddPointer(cast<RegisterMaskSDNode>(N)->getRegMask());
525 ID.
AddPointer(cast<SrcValueSDNode>(N)->getValue());
529 ID.
AddInteger(cast<FrameIndexSDNode>(N)->getIndex());
533 if (cast<LifetimeSDNode>(N)->hasOffset()) {
534 ID.
AddInteger(cast<LifetimeSDNode>(N)->getSize());
540 ID.
AddInteger(cast<JumpTableSDNode>(N)->getIndex());
541 ID.
AddInteger(cast<JumpTableSDNode>(N)->getTargetFlags());
650 ID.
AddInteger(cast<MemSDNode>(N)->getPointerInfo().getAddrSpace());
701 if (Node.use_empty())
716 while (!DeadNodes.
empty()) {
725 DUL->NodeDeleted(N,
nullptr);
728 RemoveNodeFromCSEMaps(N);
759 RemoveNodeFromCSEMaps(N);
763 DeleteNodeNotInCSEMaps(N);
766 void SelectionDAG::DeleteNodeNotInCSEMaps(
SDNode *
N) {
768 "Cannot delete the entry node!");
779 if (I == DbgValMap.end())
781 for (
auto &Val: I->second)
782 Val->setIsInvalidated();
786 void SelectionDAG::DeallocateNode(
SDNode *N) {
790 NodeAllocator.Deallocate(AllNodes.remove(N));
814 "Wrong return type!");
817 "Mismatched operand types!");
819 "Wrong operand type!");
821 "Wrong return type size");
828 "Wrong number of operands!");
831 assert((
I->getValueType() == EltVT ||
832 (EltVT.isInteger() &&
I->getValueType().isInteger() &&
833 EltVT.bitsLE(
I->getValueType()))) &&
834 "Wrong operand type!");
836 "Operands must all have the same type");
848 void SelectionDAG::InsertNode(
SDNode *N) {
849 AllNodes.push_back(N);
855 DUL->NodeInserted(N);
862 bool SelectionDAG::RemoveNodeFromCSEMaps(
SDNode *N) {
867 assert(CondCodeNodes[cast<CondCodeSDNode>(N)->
get()] &&
868 "Cond code doesn't exist!");
869 Erased = CondCodeNodes[cast<CondCodeSDNode>(
N)->
get()] !=
nullptr;
870 CondCodeNodes[cast<CondCodeSDNode>(
N)->
get()] =
nullptr;
873 Erased = ExternalSymbols.erase(cast<ExternalSymbolSDNode>(N)->getSymbol());
877 Erased = TargetExternalSymbols.erase(std::pair<std::string, unsigned>(
882 auto *MCSN = cast<MCSymbolSDNode>(
N);
883 Erased = MCSymbols.erase(MCSN->getMCSymbol());
887 EVT VT = cast<VTSDNode>(
N)->getVT();
889 Erased = ExtendedValueTypeNodes.erase(VT);
900 Erased = CSEMap.RemoveNode(N);
922 SelectionDAG::AddModifiedNodeToCSEMaps(
SDNode *N) {
926 SDNode *Existing = CSEMap.GetOrInsertNode(N);
935 DUL->NodeDeleted(N, Existing);
936 DeleteNodeNotInCSEMaps(N);
959 SDNode *Node = FindNodeOrInsertPos(ID,
SDLoc(N), InsertPos);
979 SDNode *Node = FindNodeOrInsertPos(ID,
SDLoc(N), InsertPos);
997 SDNode *Node = FindNodeOrInsertPos(ID,
SDLoc(N), InsertPos);
1013 : TM(tm), OptLevel(OL),
1016 InsertNode(&EntryNode);
1027 SDAGISelPass = PassPtr;
1031 LibInfo = LibraryInfo;
1039 assert(!UpdateListeners &&
"Dangling registered DAGUpdateListeners");
1041 OperandRecycler.clear(OperandAllocator);
1050 void SelectionDAG::allnodes_clear() {
1051 assert(&*AllNodes.begin() == &EntryNode);
1052 AllNodes.remove(AllNodes.begin());
1053 while (!AllNodes.empty())
1054 DeallocateNode(&AllNodes.front());
1056 NextPersistentId = 0;
1062 SDNode *N = CSEMap.FindNodeOrInsertPos(ID, InsertPos);
1069 "debug location. Use another overload.");
1076 const SDLoc &DL,
void *&InsertPos) {
1077 SDNode *N = CSEMap.FindNodeOrInsertPos(ID, InsertPos);
1102 OperandRecycler.clear(OperandAllocator);
1103 OperandAllocator.
Reset();
1106 ExtendedValueTypeNodes.clear();
1107 ExternalSymbols.clear();
1108 TargetExternalSymbols.clear();
1110 SDCallSiteDbgInfo.clear();
1111 std::fill(CondCodeNodes.begin(), CondCodeNodes.end(),
1113 std::fill(ValueTypeNodes.begin(), ValueTypeNodes.end(),
1114 static_cast<SDNode*
>(
nullptr));
1116 EntryNode.UseList =
nullptr;
1117 InsertNode(&EntryNode);
1128 std::pair<SDValue, SDValue>
1132 "Strict no-op FP extend/round not allowed.");
1139 return std::pair<SDValue, SDValue>(Res,
SDValue(Res.getNode(), 1));
1171 "getZeroExtendInReg should use the vector element type instead of " 1172 "the vector type!");
1222 bool isT,
bool isO) {
1225 (uint64_t)((int64_t)Val >> EltVT.
getSizeInBits()) + 1 < 2) &&
1226 "getConstant with a uint64_t value that doesn't fit in the type!");
1231 bool isT,
bool isO) {
1236 EVT VT,
bool isT,
bool isO) {
1264 unsigned ViaVecNumElts = VT.
getSizeInBits() / ViaEltSizeInBits;
1276 ViaEltVT, isT, isO));
1293 Ops.
insert(Ops.
end(), EltParts.begin(), EltParts.end());
1300 "APInt size does not match type size!");
1308 if ((N = FindNodeOrInsertPos(ID, DL, IP)))
1313 N = newSDNode<ConstantSDNode>(isT, isO, Elt, EltVT);
1314 CSEMap.InsertNode(N, IP);
1334 const SDLoc &DL,
bool LegalTypes) {
1345 EVT VT,
bool isTarget) {
1359 if ((N = FindNodeOrInsertPos(ID, DL, IP)))
1364 N = newSDNode<ConstantFPSDNode>(isTarget, &V, EltVT);
1365 CSEMap.InsertNode(N, IP);
1395 EVT VT, int64_t
Offset,
bool isTargetGA,
1396 unsigned TargetFlags) {
1397 assert((TargetFlags == 0 || isTargetGA) &&
1398 "Cannot set target flags on target-independent globals");
1417 if (
SDNode *
E = FindNodeOrInsertPos(ID, DL, IP))
1420 auto *N = newSDNode<GlobalAddressSDNode>(
1422 CSEMap.InsertNode(N, IP);
1433 if (
SDNode *
E = FindNodeOrInsertPos(ID, IP))
1436 auto *N = newSDNode<FrameIndexSDNode>(FI, VT, isTarget);
1437 CSEMap.InsertNode(N, IP);
1443 unsigned TargetFlags) {
1444 assert((TargetFlags == 0 || isTarget) &&
1445 "Cannot set target flags on target-independent jump tables");
1452 if (
SDNode *
E = FindNodeOrInsertPos(ID, IP))
1455 auto *N = newSDNode<JumpTableSDNode>(JTI, VT, isTarget, TargetFlags);
1456 CSEMap.InsertNode(N, IP);
1462 unsigned Alignment,
int Offset,
1464 unsigned TargetFlags) {
1465 assert((TargetFlags == 0 || isTarget) &&
1466 "Cannot set target flags on target-independent globals");
1479 if (
SDNode *
E = FindNodeOrInsertPos(ID, IP))
1482 auto *N = newSDNode<ConstantPoolSDNode>(isTarget,
C, VT,
Offset, Alignment,
1484 CSEMap.InsertNode(N, IP);
1490 unsigned Alignment,
int Offset,
1492 unsigned TargetFlags) {
1493 assert((TargetFlags == 0 || isTarget) &&
1494 "Cannot set target flags on target-independent globals");
1505 if (
SDNode *
E = FindNodeOrInsertPos(ID, IP))
1508 auto *N = newSDNode<ConstantPoolSDNode>(isTarget,
C, VT,
Offset, Alignment,
1510 CSEMap.InsertNode(N, IP);
1516 unsigned TargetFlags) {
1523 if (
SDNode *
E = FindNodeOrInsertPos(ID, IP))
1526 auto *N = newSDNode<TargetIndexSDNode>(
Index, VT,
Offset, TargetFlags);
1527 CSEMap.InsertNode(N, IP);
1537 if (
SDNode *
E = FindNodeOrInsertPos(ID, IP))
1540 auto *N = newSDNode<BasicBlockSDNode>(MBB);
1541 CSEMap.InsertNode(N, IP);
1548 ValueTypeNodes.size())
1555 N = newSDNode<VTSDNode>(VT);
1561 SDNode *&N = ExternalSymbols[Sym];
1563 N = newSDNode<ExternalSymbolSDNode>(
false, Sym, 0, VT);
1569 SDNode *&N = MCSymbols[Sym];
1572 N = newSDNode<MCSymbolSDNode>(Sym, VT);
1578 unsigned TargetFlags) {
1580 TargetExternalSymbols[std::pair<std::string, unsigned>(Sym, TargetFlags)];
1582 N = newSDNode<ExternalSymbolSDNode>(
true, Sym, TargetFlags, VT);
1588 if ((
unsigned)Cond >= CondCodeNodes.size())
1589 CondCodeNodes.resize(Cond+1);
1591 if (!CondCodeNodes[Cond]) {
1592 auto *N = newSDNode<CondCodeSDNode>(Cond);
1593 CondCodeNodes[Cond] =
N;
1597 return SDValue(CondCodeNodes[Cond], 0);
1610 "Must have the same number of vector elements as mask elements!");
1612 "Invalid VECTOR_SHUFFLE");
1620 int NElts = Mask.
size();
1622 [&](
int M) {
return M < (NElts * 2) && M >= -1; }) &&
1623 "Index out of range");
1631 for (
int i = 0; i != NElts; ++i)
1632 if (MaskVec[i] >= NElts) MaskVec[i] -= NElts;
1648 for (
int i = 0; i < NElts; ++i) {
1649 if (MaskVec[i] <
Offset || MaskVec[i] >= (
Offset + NElts))
1653 if (UndefElements[MaskVec[i] -
Offset]) {
1659 if (!UndefElements[i])
1663 if (
auto *N1BV = dyn_cast<BuildVectorSDNode>(N1))
1664 BlendSplat(N1BV, 0);
1665 if (
auto *N2BV = dyn_cast<BuildVectorSDNode>(N2))
1666 BlendSplat(N2BV, NElts);
1671 bool AllLHS =
true, AllRHS =
true;
1673 for (
int i = 0; i != NElts; ++i) {
1674 if (MaskVec[i] >= NElts) {
1679 }
else if (MaskVec[i] >= 0) {
1683 if (AllLHS && AllRHS)
1685 if (AllLHS && !N2Undef)
1698 bool Identity =
true, AllSame =
true;
1699 for (
int i = 0; i != NElts; ++i) {
1700 if (MaskVec[i] >= 0 && MaskVec[i] != i) Identity =
false;
1701 if (MaskVec[i] != MaskVec[0]) AllSame =
false;
1703 if (Identity && NElts)
1716 if (
auto *BV = dyn_cast<BuildVectorSDNode>(V)) {
1718 SDValue Splat = BV->getSplatValue(&UndefElements);
1728 if (Splat && UndefElements.
none()) {
1733 if (
auto *
C = dyn_cast<ConstantSDNode>(Splat))
1734 if (
C->isNullValue())
1739 if (AllSame && SameNumElts) {
1740 EVT BuildVT = BV->getValueType(0);
1756 for (
int i = 0; i != NElts; ++i)
1760 if (
SDNode *
E = FindNodeOrInsertPos(ID, dl, IP))
1766 int *MaskAlloc = OperandAllocator.
Allocate<
int>(NElts);
1769 auto *N = newSDNode<ShuffleVectorSDNode>(VT, dl.
getIROrder(),
1771 createOperands(N, Ops);
1773 CSEMap.InsertNode(N, IP);
1795 if (
SDNode *
E = FindNodeOrInsertPos(ID, IP))
1798 auto *N = newSDNode<RegisterSDNode>(RegNo, VT);
1800 CSEMap.InsertNode(N, IP);
1810 if (
SDNode *
E = FindNodeOrInsertPos(ID, IP))
1813 auto *N = newSDNode<RegisterMaskSDNode>(RegMask);
1814 CSEMap.InsertNode(N, IP);
1831 if (
SDNode *
E = FindNodeOrInsertPos(ID, IP))
1836 createOperands(N, Ops);
1838 CSEMap.InsertNode(N, IP);
1844 int64_t
Offset,
bool isTarget,
1845 unsigned TargetFlags) {
1854 if (
SDNode *
E = FindNodeOrInsertPos(ID, IP))
1857 auto *N = newSDNode<BlockAddressSDNode>(Opc, VT, BA,
Offset, TargetFlags);
1858 CSEMap.InsertNode(N, IP);
1865 "SrcValue is not a pointer?");
1872 if (
SDNode *
E = FindNodeOrInsertPos(ID, IP))
1875 auto *N = newSDNode<SrcValueSDNode>(V);
1876 CSEMap.InsertNode(N, IP);
1887 if (
SDNode *
E = FindNodeOrInsertPos(ID, IP))
1890 auto *N = newSDNode<MDNodeSDNode>(MD);
1891 CSEMap.InsertNode(N, IP);
1904 unsigned SrcAS,
unsigned DestAS) {
1912 if (
SDNode *
E = FindNodeOrInsertPos(ID, dl, IP))
1917 createOperands(N, Ops);
1919 CSEMap.InsertNode(N, IP);
1929 if (OpTy == ShTy || OpTy.
isVector())
return Op;
1937 const Value *V = cast<SrcValueSDNode>(Node->
getOperand(2))->getValue();
1949 getConstant(MA->value() - 1, dl, VAList.getValueType()));
1953 getConstant(-(int64_t)MA->value(), dl, VAList.getValueType()));
1960 dl, VAList.getValueType()));
1973 const Value *VD = cast<SrcValueSDNode>(Node->
getOperand(3))->getValue();
1986 unsigned StackAlign =
2053 const APInt &C2 = N2C->getAPIntValue();
2055 const APInt &C1 = N1C->getAPIntValue();
2076 if (N1CFP && N2CFP) {
2137 return getSetCC(dl, VT, N2, N1, SwappedCond);
2138 }
else if ((N2CFP && N2CFP->getValueAPF().isNaN()) ||
2179 const APInt &DemandedElts) {
2184 auto *CV = cast<ConstantSDNode>(V.
getNode());
2185 assert(CV &&
"Const value should be ConstSDNode.");
2186 const APInt &CVal = CV->getAPIntValue();
2187 APInt NewVal = CVal & DemandedBits;
2201 if (
auto *RHSC = dyn_cast<ConstantSDNode>(V.
getOperand(1))) {
2203 unsigned Amt = RHSC->getZExtValue();
2208 APInt SrcDemandedBits = DemandedBits << Amt;
2219 const APInt &AndVal = RHSC->getAPIntValue();
2235 APInt SrcDemandedBits = DemandedBits.
trunc(SrcBitWidth);
2255 unsigned Depth)
const {
2267 const APInt &DemandedElts,
2268 unsigned Depth)
const {
2274 unsigned Depth)
const {
2295 for (
unsigned i = 0; i != NumElts; ++i) {
2298 UndefElts.setBit(i);
2301 if (!DemandedElts[i])
2303 if (Scl && Scl != Op)
2312 int SplatIndex = -1;
2314 for (
int i = 0; i != (int)NumElts; ++i) {
2317 UndefElts.setBit(i);
2320 if (!DemandedElts[i])
2322 if (0 <= SplatIndex && SplatIndex != M)
2338 UndefElts = UndefSrcElts.
extractBits(NumElts, Idx);
2347 APInt UndefLHS, UndefRHS;
2352 UndefElts = UndefLHS | UndefRHS;
2371 (AllowUndefs || !UndefElts);
2398 auto *SVN = cast<ShuffleVectorSDNode>(V);
2399 if (!SVN->isSplat())
2401 int Idx = SVN->getSplatIndex();
2403 SplatIdx = Idx % NumElts;
2415 SrcVector.getValueType().getScalarType(), SrcVector,
2423 const APInt &DemandedElts) {
2427 const APInt &ShAmt = SA->getAPIntValue();
2428 if (ShAmt.
ult(BitWidth))
2436 static const APInt *
2442 const APInt *MinShAmt =
nullptr;
2443 for (
unsigned i = 0,
e = BV->getNumOperands(); i !=
e; ++i) {
2444 if (!DemandedElts[i])
2450 const APInt &ShAmt = SA->getAPIntValue();
2451 if (ShAmt.
uge(BitWidth))
2453 if (MinShAmt && MinShAmt->
ule(ShAmt))
2462 static const APInt *
2468 const APInt *MaxShAmt =
nullptr;
2469 for (
unsigned i = 0,
e = BV->getNumOperands(); i !=
e; ++i) {
2470 if (!DemandedElts[i])
2476 const APInt &ShAmt = SA->getAPIntValue();
2477 if (ShAmt.
uge(BitWidth))
2479 if (MaxShAmt && MaxShAmt->
uge(ShAmt))
2501 unsigned Depth)
const {
2506 if (
auto *
C = dyn_cast<ConstantSDNode>(Op)) {
2508 Known.
One =
C->getAPIntValue();
2512 if (
auto *
C = dyn_cast<ConstantFPSDNode>(Op)) {
2514 Known.
One =
C->getValueAPF().bitcastToAPInt();
2526 "Unexpected vector size");
2537 if (!DemandedElts[i])
2546 "Expected BUILD_VECTOR implicit truncation");
2547 Known2 = Known2.
trunc(BitWidth);
2562 APInt DemandedLHS(NumElts, 0), DemandedRHS(NumElts, 0);
2566 for (
unsigned i = 0; i != NumElts; ++i) {
2567 if (!DemandedElts[i])
2575 DemandedLHS.clearAllBits();
2580 if ((
unsigned)M < NumElts)
2581 DemandedLHS.setBit((
unsigned)M % NumElts);
2583 DemandedRHS.
setBit((
unsigned)M % NumElts);
2586 if (!!DemandedLHS) {
2595 if (!!DemandedRHS) {
2609 for (
unsigned i = 0; i != NumSubVectors; ++i) {
2610 APInt DemandedSub = DemandedElts.
lshr(i * NumSubVectorElts);
2611 DemandedSub = DemandedSub.
trunc(NumSubVectorElts);
2612 if (!!DemandedSub) {
2636 if (!!DemandedSubElts) {
2642 APInt DemandedSrcElts = DemandedElts & ~SubMask;
2643 if (!!DemandedSrcElts) {
2676 if (DemandedElts != 1)
2682 Known = Known.
trunc(BitWidth);
2696 if (BitWidth == SubBitWidth) {
2704 if ((BitWidth % SubBitWidth) == 0) {
2711 unsigned SubScale = BitWidth / SubBitWidth;
2712 APInt SubDemandedElts(NumElts * SubScale, 0);
2713 for (
unsigned i = 0; i != NumElts; ++i)
2714 if (DemandedElts[i])
2715 SubDemandedElts.
setBit(i * SubScale);
2717 for (
unsigned i = 0; i != SubScale; ++i) {
2720 unsigned Shifts = IsLE ? i : SubScale - 1 - i;
2721 Known.
One |= Known2.
One.
zext(BitWidth).
shl(SubBitWidth * Shifts);
2727 if ((SubBitWidth % BitWidth) == 0) {
2733 unsigned SubScale = SubBitWidth / BitWidth;
2734 APInt SubDemandedElts(NumElts / SubScale, 0);
2735 for (
unsigned i = 0; i != NumElts; ++i)
2736 if (DemandedElts[i])
2737 SubDemandedElts.
setBit(i / SubScale);
2742 for (
unsigned i = 0; i != NumElts; ++i)
2743 if (DemandedElts[i]) {
2744 unsigned Shifts = IsLE ? i : NumElts - 1 - i;
2745 unsigned Offset = (Shifts % SubScale) * BitWidth;
2761 Known.
One &= Known2.One;
2763 Known.
Zero |= Known2.Zero;
2770 Known.
Zero &= Known2.Zero;
2772 Known.
One |= Known2.One;
2779 APInt KnownZeroOut = (Known.
Zero & Known2.Zero) | (Known.
One & Known2.One);
2781 Known.
One = (Known.
Zero & Known2.One) | (Known.
One & Known2.Zero);
2782 Known.
Zero = KnownZeroOut;
2794 Known2.countMinTrailingZeros();
2796 Known2.countMinLeadingZeros(),
2797 BitWidth) - BitWidth;
2813 if (RHSMaxLeadingZeros != BitWidth)
2814 LeadZ = std::min(BitWidth, LeadZ + BitWidth - RHSMaxLeadingZeros - 1);
2828 Known.
One &= Known2.One;
2829 Known.
Zero &= Known2.Zero;
2839 Known.
One &= Known2.One;
2840 Known.
Zero &= Known2.Zero;
2871 unsigned Shift = ShAmt->getZExtValue();
2872 Known.
Zero <<= Shift;
2873 Known.
One <<= Shift;
2884 if (
const APInt *ShMinAmt =
2892 unsigned Shift = ShAmt->getZExtValue();
2905 if (
const APInt *ShMinAmt =
2912 unsigned Shift = ShAmt->getZExtValue();
2921 unsigned Amt =
C->getAPIntValue().urem(BitWidth);
2927 DemandedElts, Depth + 1);
2938 Known2.One.lshrInPlace(BitWidth - Amt);
2939 Known2.Zero.lshrInPlace(BitWidth - Amt);
2941 Known.
One <<= BitWidth - Amt;
2942 Known.
Zero <<= BitWidth - Amt;
2943 Known2.One.lshrInPlace(Amt);
2944 Known2.Zero.lshrInPlace(Amt);
2946 Known.
One |= Known2.One;
2947 Known.
Zero |= Known2.Zero;
2963 InSignMask = InSignMask.
zext(BitWidth);
2965 InputDemandedBits |= InSignMask;
2968 Known.
One &= InputDemandedBits;
2969 Known.
Zero &= InputDemandedBits;
2974 Known.
Zero |= NewBits;
2975 Known.
One &= ~NewBits;
2977 Known.
One |= NewBits;
2978 Known.
Zero &= ~NewBits;
2980 Known.
Zero &= ~NewBits;
2981 Known.
One &= ~NewBits;
2990 unsigned LowBits =
Log2_32(PossibleTZ) + 1;
2999 unsigned LowBits =
Log2_32(PossibleLZ) + 1;
3015 Type *CstTy = Cst->getType();
3022 CstTy = Cst->getType();
3030 for (
unsigned i = 0; i != NumElts; ++i) {
3031 if (!DemandedElts[i])
3034 if (
auto *CInt = dyn_cast<ConstantInt>(Elt)) {
3037 Known.
Zero &= ~Value;
3040 if (
auto *CFP = dyn_cast<ConstantFP>(Elt)) {
3041 APInt Value = CFP->getValueAPF().bitcastToAPInt();
3043 Known.
Zero &= ~Value;
3052 if (
auto *CInt = dyn_cast<ConstantInt>(Cst)) {
3055 Known.
Zero = ~Value;
3056 }
else if (
auto *CFP = dyn_cast<ConstantFP>(Cst)) {
3057 APInt Value = CFP->getValueAPF().bitcastToAPInt();
3059 Known.
Zero = ~Value;
3078 Known = Known.
zext(BitWidth,
true );
3083 Known = Known.
zext(BitWidth,
true );
3092 Known = Known.
sext(BitWidth);
3099 Known = Known.
sext(BitWidth);
3104 Known = Known.
zext(BitWidth,
false );
3109 Known = Known.
trunc(BitWidth);
3116 Known.
Zero |= (~InMask);
3117 Known.One &= (~Known.Zero);
3158 assert(Op.
getResNo() == 0 &&
"We only compute knownbits for the sum here.");
3182 const APInt &
RA = Rem->getAPIntValue().abs();
3184 APInt LowBits = RA - 1;
3188 Known.
Zero = Known2.Zero & LowBits;
3189 Known.
One = Known2.One & LowBits;
3193 if (Known2.isNonNegative() || LowBits.
isSubsetOf(Known2.Zero))
3194 Known.
Zero |= ~LowBits;
3198 if (Known2.isNegative() && LowBits.
intersects(Known2.One))
3199 Known.
One |= ~LowBits;
3200 assert((Known.
Zero & Known.
One) == 0&&
"Bits known to be one AND zero?");
3206 const APInt &
RA = Rem->getAPIntValue();
3208 APInt LowBits = (RA - 1);
3212 Known.
Zero = Known2.Zero | ~LowBits;
3213 Known.
One = Known2.One & LowBits;
3239 Known = Known.
trunc(EltBitWidth);
3250 if (BitWidth > EltBitWidth)
3251 Known = Known.
trunc(EltBitWidth);
3262 if (BitWidth > EltBitWidth)
3263 Known = Known.
zext(BitWidth,
false );
3279 if (DemandedElts[EltIdx]) {
3290 Known.
One &= Known2.One;
3291 Known.
Zero &= Known2.Zero;
3318 if (Known2.isNonNegative()) {
3319 Known.
Zero = Known2.Zero;
3320 Known.
One = Known2.One;
3327 if (Known2.One.getBoolValue()) {
3340 LeadZero =
std::max(LeadZero, Known2.countMinLeadingZeros());
3342 Known.
Zero &= Known2.Zero;
3343 Known.
One &= Known2.One;
3354 LeadOne =
std::max(LeadOne, Known2.countMinLeadingOnes());
3356 Known.
Zero &= Known2.Zero;
3357 Known.
One &= Known2.One;
3371 if (CstLow && CstHigh) {
3376 const APInt &ValueHigh = CstHigh->getAPIntValue();
3377 if (ValueLow.
sle(ValueHigh)) {
3380 unsigned MinSignBits = std::min(LowSignBits, HighSignBits);
3396 Known.
Zero &= Known2.Zero;
3397 Known.
One &= Known2.One;
3458 return Const->getAPIntValue().zextOrTrunc(BitWidth).isPowerOf2();
3464 if (
C &&
C->getAPIntValue() == 1)
3472 if (
C &&
C->getAPIntValue().isSignMask())
3480 return C->getAPIntValue().zextOrTrunc(BitWidth).isPowerOf2();
3502 unsigned Depth)
const {
3508 unsigned FirstAnswer = 1;
3510 if (
auto *
C = dyn_cast<ConstantSDNode>(Op)) {
3511 const APInt &Val =
C->getAPIntValue();
3525 Tmp = cast<VTSDNode>(Op.
getOperand(1))->getVT().getSizeInBits();
3526 return VTBits-Tmp+1;
3528 Tmp = cast<VTSDNode>(Op.
getOperand(1))->getVT().getSizeInBits();
3533 for (
unsigned i = 0,
e = Op.
getNumOperands(); (i < e) && (Tmp > 1); ++i) {
3534 if (!DemandedElts[i])
3543 "Expected BUILD_VECTOR implicit truncation");
3545 Tmp2 = (Tmp2 > ExtraBits ? Tmp2 - ExtraBits : 1);
3547 Tmp = std::min(Tmp, Tmp2);
3554 APInt DemandedLHS(NumElts, 0), DemandedRHS(NumElts, 0);
3557 for (
unsigned i = 0; i != NumElts; ++i) {
3559 if (!DemandedElts[i])
3565 if ((
unsigned)M < NumElts)
3566 DemandedLHS.setBit((
unsigned)M % NumElts);
3568 DemandedRHS.
setBit((
unsigned)M % NumElts);
3573 if (!!DemandedRHS) {
3575 Tmp = std::min(Tmp, Tmp2);
3580 assert(Tmp <= VTBits &&
"Failed to determine minimum sign bits");
3594 if (VTBits == SrcBits)
3600 if ((SrcBits % VTBits) == 0) {
3603 unsigned Scale = SrcBits / VTBits;
3604 APInt SrcDemandedElts(NumElts / Scale, 0);
3605 for (
unsigned i = 0; i != NumElts; ++i)
3606 if (DemandedElts[i])
3607 SrcDemandedElts.
setBit(i / Scale);
3616 for (
unsigned i = 0; i != NumElts; ++i)
3617 if (DemandedElts[i]) {
3618 unsigned SubOffset = i % Scale;
3619 SubOffset = (IsLE ? ((Scale - 1) - SubOffset) : SubOffset);
3620 SubOffset = SubOffset * VTBits;
3621 if (Tmp <= SubOffset)
3623 Tmp2 = std::min(Tmp2, Tmp - SubOffset);
3635 Tmp = cast<VTSDNode>(Op.
getOperand(1))->getVT().getScalarSizeInBits();
3650 Tmp = std::min<uint64_t>(Tmp + ShAmt->getZExtValue(), VTBits);
3651 else if (
const APInt *ShAmt =
3653 Tmp = std::min<uint64_t>(Tmp + ShAmt->getZExtValue(), VTBits);
3659 if (ShAmt->ult(Tmp))
3660 return Tmp - ShAmt->getZExtValue();
3661 }
else if (
const APInt *ShAmt =
3664 if (ShAmt->ult(Tmp))
3665 return Tmp - ShAmt->getZExtValue();
3675 FirstAnswer = std::min(Tmp, Tmp2);
3685 if (Tmp == 1)
return 1;
3687 return std::min(Tmp, Tmp2);
3690 if (Tmp == 1)
return 1;
3692 return std::min(Tmp, Tmp2);
3704 if (CstLow && CstHigh) {
3709 Tmp2 = CstHigh->getAPIntValue().getNumSignBits();
3710 return std::min(Tmp, Tmp2);
3719 return std::min(Tmp, Tmp2);
3727 return std::min(Tmp, Tmp2);
3757 unsigned RotAmt =
C->getAPIntValue().urem(VTBits);
3761 RotAmt = (VTBits - RotAmt) % VTBits;
3766 if (Tmp > (RotAmt + 1))
return (Tmp - RotAmt);
3774 if (Tmp == 1)
return 1;
3778 if (CRHS->isAllOnesValue()) {
3783 if ((Known.
Zero | 1).isAllOnesValue())
3793 if (Tmp2 == 1)
return 1;
3794 return std::min(Tmp, Tmp2)-1;
3798 if (Tmp2 == 1)
return 1;
3802 if (CLHS->isNullValue()) {
3806 if ((Known.
Zero | 1).isAllOnesValue())
3820 if (Tmp == 1)
return 1;
3821 return std::min(Tmp, Tmp2)-1;
3825 if (SignBitsOp0 == 1)
3828 if (SignBitsOp1 == 1)
3830 unsigned OutValidBits =
3831 (VTBits - SignBitsOp0 + 1) + (VTBits - SignBitsOp1 + 1);
3832 return OutValidBits > VTBits ? 1 : VTBits - OutValidBits + 1;
3838 if (NumSrcSignBits > (NumSrcBits - VTBits))
3839 return NumSrcSignBits - (NumSrcBits - VTBits);
3853 return std::max(std::min(KnownSign - rIndex * BitWidth, BitWidth), 0);
3868 if (DemandedElts[EltIdx]) {
3877 APInt VectorElts = DemandedElts;
3881 Tmp = std::min(Tmp, Tmp2);
3887 Tmp = std::min(Tmp, Tmp2);
3889 assert(Tmp <= VTBits &&
"Failed to determine minimum sign bits");
3903 if (BitWidth != EltBitWidth)
3937 for (
unsigned i = 0; (i < NumSubVectors) && (Tmp > 1); ++i) {
3938 APInt DemandedSub = DemandedElts.
lshr(i * NumSubVectorElts);
3939 DemandedSub = DemandedSub.
trunc(NumSubVectorElts);
3943 Tmp = std::min(Tmp, Tmp2);
3945 assert(Tmp <= VTBits &&
"Failed to determine minimum sign bits");
3955 if (SubIdx && SubIdx->getAPIntValue().ule(NumElts - NumSubElts)) {
3957 uint64_t Idx = SubIdx->getZExtValue();
3959 if (!!DemandedSubElts) {
3961 if (Tmp == 1)
return 1;
3964 APInt DemandedSrcElts = DemandedElts & ~SubMask;
3965 if (!!DemandedSrcElts) {
3967 Tmp = std::min(Tmp, Tmp2);
3969 assert(Tmp <= VTBits &&
"Failed to determine minimum sign bits");
3975 if (Tmp == 1)
return 1;
3977 Tmp = std::min(Tmp, Tmp2);
3978 assert(Tmp <= VTBits &&
"Failed to determine minimum sign bits");
3987 unsigned ExtType =
LD->getExtensionType();
3991 Tmp =
LD->getMemoryVT().getScalarSizeInBits();
3992 return VTBits - Tmp + 1;
3994 Tmp =
LD->getMemoryVT().getScalarSizeInBits();
3995 return VTBits - Tmp;
4000 Type *CstTy = Cst->getType();
4004 for (
unsigned i = 0; i != NumElts; ++i) {
4005 if (!DemandedElts[i])
4008 if (
auto *CInt = dyn_cast<ConstantInt>(Elt)) {
4013 if (
auto *CFP = dyn_cast<ConstantFP>(Elt)) {
4014 APInt Value = CFP->getValueAPF().bitcastToAPInt();
4038 FirstAnswer =
std::max(FirstAnswer, NumBits);
4087 return !
C->getValueAPF().isNaN() ||
4088 (SNaN && !
C->getValueAPF().isSignaling());
4195 "Floating point type expected");
4200 return !
C->isZero();
4206 "Floating point types unsupported - use isKnownNeverZeroFloat");
4228 if (A == B)
return true;
4233 if (CA->isZero() && CB->isZero())
return true;
4243 "Values must have the same type");
4250 int NumOps = Ops.
size();
4251 assert(NumOps != 0 &&
"Can't build an empty vector!");
4253 "Incorrect element count in BUILD_VECTOR!");
4261 bool IsIdentity =
true;
4262 for (
int i = 0; i != NumOps; ++i) {
4265 (IdentitySrc && Ops[i].getOperand(0) != IdentitySrc) ||
4266 !isa<ConstantSDNode>(Ops[i].getOperand(1)) ||
4267 cast<ConstantSDNode>(Ops[i].getOperand(1))->getAPIntValue() != i) {
4271 IdentitySrc = Ops[i].getOperand(0);
4284 assert(!Ops.
empty() &&
"Can't concatenate an empty list of vectors!");
4289 "Concatenation of vectors with inconsistent value types!");
4290 assert((Ops.
size() * Ops[0].getValueType().getVectorNumElements()) ==
4292 "Incorrect element count in vector concatenation!");
4294 if (Ops.
size() == 1)
4305 bool IsIdentity =
true;
4306 for (
unsigned i = 0,
e = Ops.
size(); i !=
e; ++i) {
4311 (IdentitySrc && Op.
getOperand(0) != IdentitySrc) ||
4318 "Unexpected identity source vector for concat of extracts");
4322 assert(IdentitySrc &&
"Failed to set source vector of extracts");
4362 if (
SDNode *
E = FindNodeOrInsertPos(ID, DL, IP))
4367 CSEMap.InsertNode(N, IP);
4383 const APInt &Val =
C->getAPIntValue();
4388 C->isTargetOpcode(),
C->isOpaque());
4396 C->isTargetOpcode(),
C->isOpaque());
4518 if (BV->isConstant()) {
4575 "Vector element count mismatch!");
4577 "Invalid fpext node, dst < src!");
4594 "Invalid SIGN_EXTEND!");
4596 "SIGN_EXTEND result type type should be vector iff the operand " 4602 "Vector element count mismatch!");
4604 "Invalid sext node, dst < src!");
4613 "Invalid ZERO_EXTEND!");
4615 "ZERO_EXTEND result type type should be vector iff the operand " 4621 "Vector element count mismatch!");
4623 "Invalid zext node, dst < src!");
4632 "Invalid ANY_EXTEND!");
4634 "ANY_EXTEND result type type should be vector iff the operand " 4640 "Vector element count mismatch!");
4642 "Invalid anyext node, dst < src!");
4662 "Invalid TRUNCATE!");
4664 "TRUNCATE result type type should be vector iff the operand " 4670 "Vector element count mismatch!");
4672 "Invalid truncate node, src < dst!");
4691 assert(VT.
isVector() &&
"This DAG node is restricted to vector types.");
4693 "The input must be the same size or smaller than the result.");
4696 "The destination vector type must have fewer lanes than the input.");
4708 "BSWAP types must be a multiple of 16 bits!");
4714 "Invalid BITREVERSE!");
4721 "Cannot BITCAST between types of different sizes!");
4734 "Illegal SCALAR_TO_VECTOR node!");
4739 isa<ConstantSDNode>(Operand.
getOperand(1)) &&
4765 if (
SDNode *
E = FindNodeOrInsertPos(ID, DL, IP)) {
4766 E->intersectFlagsWith(Flags);
4772 createOperands(N, Ops);
4773 CSEMap.InsertNode(N, IP);
4776 createOperands(N, Ops);
4808 if (!C2.getBoolValue())
4812 if (!C2.getBoolValue())
4816 if (!C2.getBoolValue())
4820 if (!C2.getBoolValue())
4848 int64_t
Offset = C2->getSExtValue();
4851 case ISD::SUB: Offset = -uint64_t(Offset);
break;
4866 assert(Ops.
size() == 2 &&
"Div/rem should have 2 operands");
4873 [](
SDValue V) {
return V.isUndef() ||
4895 if (
auto *C1 = dyn_cast<ConstantSDNode>(N1)) {
4896 if (
auto *C2 = dyn_cast<ConstantSDNode>(N2)) {
4899 "Can't fold vectors ops with scalar operands");
4923 assert((!BV1 || !BV2 || BV1->getNumOperands() == BV2->getNumOperands()) &&
4924 "Vector binop with different number of elements in operands?");
4930 if (LegalSVT.
bitsLT(SVT))
4934 unsigned NumOps = BV1 ? BV1->getNumOperands() : BV2->getNumOperands();
4935 for (
unsigned I = 0;
I != NumOps; ++
I) {
4950 if (LegalSVT != SVT)
4961 "Vector size mismatch!");
4990 auto IsScalarOrSameVectorSize = [&](
const SDValue &
Op) {
4995 auto IsConstantBuildVectorOrUndef = [&](
const SDValue &
Op) {
5004 if (!
llvm::all_of(Ops, IsConstantBuildVectorOrUndef) ||
5023 for (
unsigned i = 0; i != NumElts; i++) {
5049 SDValue ScalarResult =
getNode(Opcode, DL, SVT, ScalarOps, Flags);
5052 if (LegalSVT != SVT)
5075 if (N1CFP && N2CFP) {
5076 APFloat C1 = N1CFP->getValueAPF(), C2 = N2CFP->getValueAPF();
5100 APFloat C1 = N1CFP->getValueAPF();
5137 }
else if (N1CFP && !N2CFP) {
5151 if (N1 == N2)
return N1;
5167 assert(VT.
isInteger() &&
"This operator does not apply to FP types!");
5169 N1.
getValueType() == VT &&
"Binary operator types must match!");
5172 if (N2C && N2C->isNullValue())
5174 if (N2C && N2C->isAllOnesValue())
5181 assert(VT.
isInteger() &&
"This operator does not apply to FP types!");
5183 N1.
getValueType() == VT &&
"Binary operator types must match!");
5186 if (N2C && N2C->isNullValue())
5204 assert(VT.
isInteger() &&
"This operator does not apply to FP types!");
5206 N1.
getValueType() == VT &&
"Binary operator types must match!");
5215 N1.
getValueType() == VT &&
"Binary operator types must match!");
5223 "Invalid FCOPYSIGN!");
5234 "Shift operators return type must be the same as their first arg");
5236 "Shifts only work on integers");
5238 "Vector shift amounts must be in the same as their first arg");
5244 "Invalid use of small shift amount with oversized value!");
5251 if (N2C && N2C->isNullValue())
5258 N2C && (N2C->getZExtValue() == 0 || N2C->getZExtValue() == 1) &&
5259 "Invalid FP_ROUND!");
5264 EVT EVT = cast<VTSDNode>(N2)->getVT();
5267 "Cannot *_EXTEND_INREG FP types");
5269 "AssertSExt/AssertZExt type should be the vector element type " 5270 "rather than the vector type!");
5276 EVT EVT = cast<VTSDNode>(N2)->getVT();
5279 "Cannot *_EXTEND_INREG FP types");
5281 "SIGN_EXTEND_INREG type should be vector iff the operand " 5285 "Vector element counts must match in SIGN_EXTEND_INREG");
5287 if (EVT == VT)
return N1;
5298 return SignExtendInReg(Val, VT);
5311 Ops.
push_back(SignExtendInReg(Val, OpVT));
5319 "The result of EXTRACT_VECTOR_ELT must be at least as wide as the \ 5320 element type of the vector.");
5366 if (N1Op2C && N2C) {
5388 assert(N2C && (
unsigned)N2C->getZExtValue() < 2 &&
"Bad EXTRACT_ELEMENT!");
5392 "Wrong types for EXTRACT_ELEMENT!");
5403 unsigned Shift = ElementSize * N2C->getZExtValue();
5411 "Extract subvector VTs must be a vectors!");
5414 "Extract subvector VTs must have the same element type!");
5416 "Extract subvector must be from larger vector to smaller vector!");
5421 &&
"Extract subvector overflow!");
5438 return N1.
getOperand(N2C->getZExtValue() / Factor);
5514 if (
SDNode *
E = FindNodeOrInsertPos(ID, DL, IP)) {
5515 E->intersectFlagsWith(Flags);
5521 createOperands(N, Ops);
5522 CSEMap.InsertNode(N, IP);
5525 createOperands(N, Ops);
5546 if (N1CFP && N2CFP && N3CFP) {
5547 APFloat V1 = N1CFP->getValueAPF();
5548 const APFloat &
V2 = N2CFP->getValueAPF();
5549 const APFloat &V3 = N3CFP->getValueAPF();
5571 "SETCC operands must have the same type!");
5573 "SETCC type should be vector iff the operand type is vector!");
5576 "SETCC vector element counts must match!");
5578 if (
SDValue V =
FoldSetCC(VT, N1, N2, cast<CondCodeSDNode>(N3)->
get(), DL))
5620 "Insert subvector VTs must be a vectors");
5622 "Dest and insert subvector source types must match!");
5624 "Insert subvector must be from smaller vector to larger vector!");
5625 if (isa<ConstantSDNode>(Index)) {
5627 cast<ConstantSDNode>(
Index)->getZExtValue()
5629 &&
"Insert subvector overflow!");
5659 if (
SDNode *
E = FindNodeOrInsertPos(ID, DL, IP)) {
5660 E->intersectFlagsWith(Flags);
5666 createOperands(N, Ops);
5667 CSEMap.InsertNode(N, IP);
5670 createOperands(N, Ops);
5681 SDValue Ops[] = { N1, N2, N3, N4 };
5682 return getNode(Opcode, DL, VT, Ops);
5688 SDValue Ops[] = { N1, N2, N3, N4, N5 };
5689 return getNode(Opcode, DL, VT, Ops);
5705 if (
LoadSDNode *L = dyn_cast<LoadSDNode>(*U))
5707 if (FI->getIndex() < 0)
5722 assert(
C->getAPIntValue().getBitWidth() == 8);
5727 return DAG.
getConstant(Val, dl, VT,
false, IsOpaque);
5735 if (!IntVT.isInteger())
5762 if (Slice.
Array ==
nullptr) {
5780 unsigned NumVTBytes = NumVTBits / 8;
5781 unsigned NumBytes = std::min(NumVTBytes,
unsigned(Slice.
Length));
5783 APInt Val(NumVTBits, 0);
5785 for (
unsigned i = 0; i != NumBytes; ++i)
5786 Val |= (uint64_t)(
unsigned char)Slice[i] << i*8;
5788 for (
unsigned i = 0; i != NumBytes; ++i)
5789 Val |= (uint64_t)(
unsigned char)Slice[i] << (NumVTBytes-i-1)*8;
5817 uint64_t SrcDelta = 0;
5820 G = cast<GlobalAddressSDNode>(Src);
5824 G = cast<GlobalAddressSDNode>(Src.
getOperand(0));
5825 SrcDelta = cast<ConstantSDNode>(Src.
getOperand(1))->getZExtValue();
5847 assert(OutLoadChains.
size() &&
"Missing loads in memcpy inlining");
5848 assert(OutStoreChains.
size() &&
"Missing stores in memcpy inlining");
5850 for (
unsigned i = From; i < To; ++i) {
5852 GluedLoadChains.push_back(OutLoadChains[i]);
5859 for (
unsigned i = From; i < To; ++i) {
5870 uint64_t
Size,
unsigned Alignment,
5871 bool isVol,
bool AlwaysInline,
5886 std::vector<EVT> MemOps;
5887 bool DstAlignCanChange =
false;
5893 DstAlignCanChange =
true;
5895 if (Alignment > SrcAlign)
5896 SrcAlign = Alignment;
5899 bool isZeroConstant = CopyFromConstant && Slice.
Array ==
nullptr;
5903 MemOps, Limit, Size, (DstAlignCanChange ? 0 : Alignment),
5904 (isZeroConstant ? 0 : SrcAlign),
false,
5905 false, CopyFromConstant,
5910 if (DstAlignCanChange) {
5911 Type *Ty = MemOps[0].getTypeForEVT(C);
5918 while (NewAlign > Alignment &&
5922 if (NewAlign > Alignment) {
5926 Alignment = NewAlign;
5935 unsigned NumMemOps = MemOps.
size();
5936 uint64_t SrcOff = 0, DstOff = 0;
5937 for (
unsigned i = 0; i != NumMemOps; ++i) {
5942 if (VTSize > Size) {
5945 assert(i == NumMemOps-1 && i != 0);
5946 SrcOff -= VTSize -
Size;
5947 DstOff -= VTSize -
Size;
5950 if (CopyFromConstant &&
5958 if (SrcOff < Slice.
Length) {
5960 SubSlice.
move(SrcOff);
5963 SubSlice.
Array =
nullptr;
5965 SubSlice.
Length = VTSize;
5985 bool isDereferenceable =
5988 if (isDereferenceable)
5994 MinAlign(SrcAlign, SrcOff), SrcMMOFlags);
6009 unsigned NumLdStInMemcpy = OutStoreChains.
size();
6011 if (NumLdStInMemcpy) {
6017 for (
unsigned i = 0; i < NumLdStInMemcpy; ++i) {
6023 if (NumLdStInMemcpy <= GluedLdStLimit) {
6025 NumLdStInMemcpy, OutLoadChains,
6028 unsigned NumberLdChain = NumLdStInMemcpy / GluedLdStLimit;
6029 unsigned RemainingLdStInMemcpy = NumLdStInMemcpy % GluedLdStLimit;
6030 unsigned GlueIter = 0;
6032 for (
unsigned cnt = 0; cnt < NumberLdChain; ++cnt) {
6033 unsigned IndexFrom = NumLdStInMemcpy - GlueIter - GluedLdStLimit;
6034 unsigned IndexTo = NumLdStInMemcpy - GlueIter;
6037 OutLoadChains, OutStoreChains);
6038 GlueIter += GluedLdStLimit;
6042 if (RemainingLdStInMemcpy) {
6044 RemainingLdStInMemcpy, OutLoadChains,
6056 bool isVol,
bool AlwaysInline,
6069 std::vector<EVT> MemOps;
6070 bool DstAlignCanChange =
false;
6076 DstAlignCanChange =
true;
6078 if (Align > SrcAlign)
6084 bool AllowOverlap =
false;
6086 MemOps, Limit, Size, (DstAlignCanChange ? 0 : Align), SrcAlign,
6087 false,
false,
false,
6092 if (DstAlignCanChange) {
6093 Type *Ty = MemOps[0].getTypeForEVT(C);
6095 if (NewAlign > Align) {
6105 uint64_t SrcOff = 0, DstOff = 0;
6109 unsigned NumMemOps = MemOps.
size();
6110 for (
unsigned i = 0; i < NumMemOps; i++) {
6115 bool isDereferenceable =
6118 if (isDereferenceable)
6130 for (
unsigned i = 0; i < NumMemOps; i++) {
6135 Store = DAG.
getStore(Chain, dl, LoadValues[i],
6165 uint64_t
Size,
unsigned Align,
bool isVol,
6175 std::vector<EVT> MemOps;
6176 bool DstAlignCanChange =
false;
6182 DstAlignCanChange =
true;
6184 isa<ConstantSDNode>(Src) && cast<ConstantSDNode>(Src)->isNullValue();
6187 (DstAlignCanChange ? 0 :
Align), 0,
true,
6193 if (DstAlignCanChange) {
6196 if (NewAlign > Align) {
6205 uint64_t DstOff = 0;
6206 unsigned NumMemOps = MemOps.
size();
6209 EVT LargestVT = MemOps[0];
6210 for (
unsigned i = 1; i < NumMemOps; i++)
6211 if (MemOps[i].bitsGT(LargestVT))
6212 LargestVT = MemOps[i];
6215 for (
unsigned i = 0; i < NumMemOps; i++) {
6218 if (VTSize > Size) {
6221 assert(i == NumMemOps-1 && i != 0);
6222 DstOff -= VTSize -
Size;
6228 if (VT.
bitsLT(LargestVT)) {
6260 bool isVol,
bool AlwaysInline,
bool isTailCall,
6263 assert(Align &&
"The SDAG layer expects explicit alignment and reserves 0");
6275 isVol,
false, DstPtrInfo, SrcPtrInfo);
6284 *
this, dl, Chain, Dst, Src, Size, Align, isVol, AlwaysInline,
6285 DstPtrInfo, SrcPtrInfo);
6293 assert(ConstantSize &&
"AlwaysInline requires a constant size!");
6296 true, DstPtrInfo, SrcPtrInfo);
6312 Entry.
Node = Dst; Args.push_back(Entry);
6313 Entry.
Node = Src; Args.push_back(Entry);
6316 Entry.
Node =
Size; Args.push_back(Entry);
6329 std::pair<SDValue,SDValue> CallResult = TLI->
LowerCallTo(CLI);
6330 return CallResult.second;
6334 SDValue Dst,
unsigned DstAlign,
6335 SDValue Src,
unsigned SrcAlign,
6337 unsigned ElemSz,
bool isTailCall,
6345 Args.push_back(Entry);
6348 Args.push_back(Entry);
6352 Args.push_back(Entry);
6356 if (LibraryCall == RTLIB::UNKNOWN_LIBCALL)
6370 std::pair<SDValue, SDValue> CallResult = TLI->
LowerCallTo(CLI);
6371 return CallResult.second;
6376 bool isVol,
bool isTailCall,
6379 assert(Align &&
"The SDAG layer expects explicit alignment and reserves 0");
6392 false, DstPtrInfo, SrcPtrInfo);
6401 *
this, dl, Chain, Dst, Src, Size, Align, isVol, DstPtrInfo, SrcPtrInfo);
6416 Entry.
Node = Dst; Args.push_back(Entry);
6417 Entry.
Node = Src; Args.push_back(Entry);
6420 Entry.
Node =
Size; Args.push_back(Entry);
6433 std::pair<SDValue,SDValue> CallResult = TLI->
LowerCallTo(CLI);
6434 return CallResult.second;
6438 SDValue Dst,
unsigned DstAlign,
6439 SDValue Src,
unsigned SrcAlign,
6441 unsigned ElemSz,
bool isTailCall,
6449 Args.push_back(Entry);
6452 Args.push_back(Entry);
6456 Args.push_back(Entry);
6460 if (LibraryCall == RTLIB::UNKNOWN_LIBCALL)
6474 std::pair<SDValue, SDValue> CallResult = TLI->
LowerCallTo(CLI);
6475 return CallResult.second;
6480 bool isVol,
bool isTailCall,
6482 assert(Align &&
"The SDAG layer expects explicit alignment and reserves 0");
6494 Align, isVol, DstPtrInfo);
6504 *
this, dl, Chain, Dst, Src, Size, Align, isVol, DstPtrInfo);
6515 Args.push_back(Entry);
6518 Args.push_back(Entry);
6521 Args.push_back(Entry);
6535 std::pair<SDValue,SDValue> CallResult = TLI->
LowerCallTo(CLI);
6536 return CallResult.second;
6540 SDValue Dst,
unsigned DstAlign,
6542 unsigned ElemSz,
bool isTailCall,
6549 Args.push_back(Entry);
6553 Args.push_back(Entry);
6557 Args.push_back(Entry);
6561 if (LibraryCall == RTLIB::UNKNOWN_LIBCALL)
6575 std::pair<SDValue, SDValue> CallResult = TLI->
LowerCallTo(CLI);
6576 return CallResult.second;
6587 if (
SDNode *
E = FindNodeOrInsertPos(ID, dl, IP)) {
6588 cast<AtomicSDNode>(
E)->refineAlignment(MMO);
6593 VTList, MemVT, MMO);
6594 createOperands(N, Ops);
6596 CSEMap.InsertNode(N, IP);
6609 SDValue Ops[] = {Chain, Ptr, Cmp, Swp};
6610 return getAtomic(Opcode, dl, MemVT, VTs, Ops, MMO);
6631 "Invalid Atomic Op");
6637 SDValue Ops[] = {Chain, Ptr, Val};
6638 return getAtomic(Opcode, dl, MemVT, VTs, Ops, MMO);
6648 return getAtomic(Opcode, dl, MemVT, VTs, Ops, MMO);
6653 if (Ops.
size() == 1)
6658 for (
unsigned i = 0; i < Ops.
size(); ++i)
6693 "Opcode is not a memory-accessing opcode!");
6700 ID.
AddInteger(getSyntheticNodeSubclassData<MemIntrinsicSDNode>(
6701 Opcode, dl.
getIROrder(), VTList, MemVT, MMO));
6704 if (
SDNode *
E = FindNodeOrInsertPos(ID, dl, IP)) {
6705 cast<MemIntrinsicSDNode>(
E)->refineAlignment(MMO);
6710 VTList, MemVT, MMO);
6711 createOperands(N, Ops);
6713 CSEMap.InsertNode(N, IP);
6716 VTList, MemVT, MMO);
6717 createOperands(N, Ops);
6742 if (
SDNode *
E = FindNodeOrInsertPos(ID, dl, IP))
6747 createOperands(N, Ops);
6748 CSEMap.InsertNode(N, IP);
6773 int FI = cast<FrameIndexSDNode>(Ptr.
getOperand(0))->getIndex();
6787 if (
ConstantSDNode *OffsetNode = dyn_cast<ConstantSDNode>(OffsetOp))
6802 "Invalid chain type");
6815 PtrInfo, MMOFlags, MemVT.
getStoreSize(), Alignment, AAInfo, Ranges);
6816 return getLoad(AM, ExtType, VT, dl, Chain, Ptr, Offset, MemVT, MMO);
6826 assert(VT == MemVT &&
"Non-extending load from different memory type!");
6830 "Should only be an extending load, not truncating!");
6832 "Cannot convert from FP to Int or Int -> FP!");
6834 "Cannot use an ext load to convert to or from a vector!");
6837 "Cannot use an ext load to change the number of vector elements!");
6841 assert((Indexed || Offset.
isUndef()) &&
"Unindexed load with an offset!");
6845 SDValue Ops[] = { Chain, Ptr, Offset };
6849 ID.
AddInteger(getSyntheticNodeSubclassData<LoadSDNode>(
6853 if (
SDNode *
E = FindNodeOrInsertPos(ID, dl, IP)) {
6854 cast<LoadSDNode>(
E)->refineAlignment(MMO);
6859 createOperands(N, Ops);
6861 CSEMap.InsertNode(N, IP);
6875 PtrInfo, VT, Alignment, MMOFlags, AAInfo, Ranges);
6893 MemVT, Alignment, MMOFlags, AAInfo);
6937 return getStore(Chain, dl, Val, Ptr, MMO);
6943 "Invalid chain type");
6947 SDValue Ops[] = { Chain, Val, Ptr, Undef };
6951 ID.
AddInteger(getSyntheticNodeSubclassData<StoreSDNode>(
6955 if (
SDNode *
E = FindNodeOrInsertPos(ID, dl, IP)) {
6956 cast<StoreSDNode>(
E)->refineAlignment(MMO);
6961 createOperands(N, Ops);
6963 CSEMap.InsertNode(N, IP);
6972 EVT SVT,
unsigned Alignment,
6976 "Invalid chain type");
6988 PtrInfo, MMOFlags, SVT.
getStoreSize(), Alignment, AAInfo);
6998 "Invalid chain type");
7000 return getStore(Chain, dl, Val, Ptr, MMO);
7003 "Should only be a truncating store, not extending!");
7005 "Can't do FP-INT conversion!");
7007 "Cannot use trunc store to convert to or from a vector!");
7010 "Cannot use trunc store to change the number of vector elements!");
7014 SDValue Ops[] = { Chain, Val, Ptr, Undef };
7018 ID.
AddInteger(getSyntheticNodeSubclassData<StoreSDNode>(
7022 if (
SDNode *
E = FindNodeOrInsertPos(ID, dl, IP)) {
7023 cast<StoreSDNode>(
E)->refineAlignment(MMO);
7028 createOperands(N, Ops);
7030 CSEMap.InsertNode(N, IP);
7050 if (
SDNode *
E = FindNodeOrInsertPos(ID, dl, IP))
7056 createOperands(N, Ops);
7058 CSEMap.InsertNode(N, IP);
7073 "Unindexed masked load with an offset!");
7080 ID.
AddInteger(getSyntheticNodeSubclassData<MaskedLoadSDNode>(
7081 dl.
getIROrder(), VTs, AM, ExtTy, isExpanding, MemVT, MMO));
7084 if (
SDNode *
E = FindNodeOrInsertPos(ID, dl, IP)) {
7085 cast<MaskedLoadSDNode>(
E)->refineAlignment(MMO);
7089 AM, ExtTy, isExpanding, MemVT, MMO);
7090 createOperands(N, Ops);
7092 CSEMap.InsertNode(N, IP);
7115 bool IsCompressing) {
7117 "Invalid chain type");
7120 "Unindexed masked store with an offset!");
7127 ID.
AddInteger(getSyntheticNodeSubclassData<MaskedStoreSDNode>(
7128 dl.
getIROrder(), VTs, AM, IsTruncating, IsCompressing, MemVT, MMO));
7131 if (
SDNode *
E = FindNodeOrInsertPos(ID, dl, IP)) {
7132 cast<MaskedStoreSDNode>(
E)->refineAlignment(MMO);
7137 IsTruncating, IsCompressing, MemVT, MMO);
7138 createOperands(N, Ops);
7140 CSEMap.InsertNode(N, IP);
7152 "Masked store is already a indexed store!");
7162 assert(Ops.
size() == 6 &&
"Incompatible number of operands");
7167 ID.AddInteger(getSyntheticNodeSubclassData<MaskedGatherSDNode>(
7169 ID.AddInteger(MMO->getPointerInfo().getAddrSpace());
7171 if (
SDNode *
E = FindNodeOrInsertPos(ID, dl, IP)) {
7172 cast<MaskedGatherSDNode>(
E)->refineAlignment(MMO);
7177 VTs, VT, MMO, IndexType);
7178 createOperands(N, Ops);
7181 "Incompatible type of the PassThru value in MaskedGatherSDNode");
7184 "Vector width mismatch between mask and data");
7187 "Vector width mismatch between index and data");
7188 assert(isa<ConstantSDNode>(N->getScale()) &&
7189 cast<ConstantSDNode>(N->getScale())->getAPIntValue().isPowerOf2() &&
7190 "Scale should be a constant power of 2");
7192 CSEMap.InsertNode(N, IP);
7203 assert(Ops.
size() == 6 &&
"Incompatible number of operands");
7208 ID.AddInteger(getSyntheticNodeSubclassData<MaskedScatterSDNode>(
7210 ID.AddInteger(MMO->getPointerInfo().getAddrSpace());
7212 if (
SDNode *
E = FindNodeOrInsertPos(ID, dl, IP)) {
7213 cast<MaskedScatterSDNode>(
E)->refineAlignment(MMO);
7217 VTs, VT, MMO, IndexType);
7218 createOperands(N, Ops);
7222 "Vector width mismatch between mask and data");
7225 "Vector width mismatch between index and data");
7226 assert(isa<ConstantSDNode>(N->getScale()) &&
7227 cast<ConstantSDNode>(N->getScale())->getAPIntValue().isPowerOf2() &&
7228 "Scale should be a constant power of 2");
7230 CSEMap.InsertNode(N, IP);
7250 if (
auto *CondC = dyn_cast<ConstantSDNode>(Cond))
7251 return CondC->isNullValue() ?
F :
T;
7324 switch (Ops.
size()) {
7325 case 0:
return getNode(Opcode, DL, VT);
7326 case 1:
return getNode(Opcode, DL, VT, static_cast<const SDValue>(Ops[0]));
7327 case 2:
return getNode(Opcode, DL, VT, Ops[0], Ops[1]);
7328 case 3:
return getNode(Opcode, DL, VT, Ops[0], Ops[1], Ops[2]);
7335 return getNode(Opcode, DL, VT, NewOps);
7340 unsigned NumOps = Ops.
size();
7342 case 0:
return getNode(Opcode, DL, VT);
7343 case 1:
return getNode(Opcode, DL, VT, Ops[0], Flags);
7344 case 2:
return getNode(Opcode, DL, VT, Ops[0], Ops[1], Flags);
7345 case 3:
return getNode(Opcode, DL, VT, Ops[0], Ops[1], Ops[2], Flags);
7361 assert(NumOps == 5 &&
"SELECT_CC takes 5 operands!");
7363 "LHS and RHS of condition must have same type!");
7365 "True and False arms of SelectCC must have same type!");
7367 "select_cc node must be of same type as true and false value!");
7370 assert(NumOps == 5 &&
"BR_CC takes 5 operands!");
7372 "LHS/RHS of comparison should match types!");
7385 if (
SDNode *
E = FindNodeOrInsertPos(ID, DL, IP))
7389 createOperands(N, Ops);
7391 CSEMap.InsertNode(N, IP);
7394 createOperands(N, Ops);
7411 return getNode(Opcode, DL, VTList.
VTs[0], Ops);
7416 "Invalid STRICT_FP_EXTEND!");
7418 Ops[1].getValueType().isFloatingPoint() &&
"Invalid FP cast!");
7420 "STRICT_FP_EXTEND result type should be vector iff the operand " 7424 Ops[1].getValueType().getVectorNumElements()) &&
7425 "Vector element count mismatch!");
7427 "Invalid fpext node, dst <= src!");
7430 assert(VTList.
NumVTs == 2 && Ops.
size() == 3 &&
"Invalid STRICT_FP_ROUND!");
7432 "STRICT_FP_ROUND result type should be vector iff the operand " 7436 Ops[1].getValueType().getVectorNumElements()) &&
7437 "Vector element count mismatch!");
7439 Ops[1].getValueType().isFloatingPoint() &&
7441 isa<ConstantSDNode>(Ops[2]) &&
7442 (cast<ConstantSDNode>(Ops[2])->getZExtValue() == 0 ||
7443 cast<ConstantSDNode>(Ops[2])->getZExtValue() == 1) &&
7444 "Invalid STRICT_FP_ROUND!");
7454 cast<VTSDNode>(N3.getOperand(1))->getVT() !=
MVT::i1)
7455 return getNode(Opcode, DL, VT, N1, N2, N3.getOperand(0));
7456 else if (N3.getOpcode() ==
ISD::AND)
7457 if (
ConstantSDNode *AndRHS = dyn_cast<ConstantSDNode>(N3.getOperand(1))) {
7460 unsigned NumBits = VT.getScalarSizeInBits()*2;
7461 if ((AndRHS->getValue() & (NumBits-1)) == NumBits-1)
7462 return getNode(Opcode, DL, VT, N1, N2, N3.getOperand(0));
7474 if (
SDNode *
E = FindNodeOrInsertPos(ID, DL, IP))
7478 createOperands(N, Ops);
7479 CSEMap.InsertNode(N, IP);
7482 createOperands(N, Ops);
7498 return getNode(Opcode, DL, VTList, Ops);
7504 return getNode(Opcode, DL, VTList, Ops);
7509 SDValue Ops[] = { N1, N2, N3 };
7510 return getNode(Opcode, DL, VTList, Ops);
7515 SDValue Ops[] = { N1, N2, N3, N4 };
7516 return getNode(Opcode, DL, VTList, Ops);
7522 SDValue Ops[] = { N1, N2, N3, N4, N5 };
7523 return getNode(Opcode, DL, VTList, Ops);
7527 return makeVTList(SDNode::getValueTypeList(VT), 1);
7537 SDVTListNode *Result = VTListMap.FindNodeOrInsertPos(ID, IP);
7543 VTListMap.InsertNode(Result, IP);
7556 SDVTListNode *Result = VTListMap.FindNodeOrInsertPos(ID, IP);
7563 VTListMap.InsertNode(Result, IP);
7577 SDVTListNode *Result = VTListMap.FindNodeOrInsertPos(ID, IP);
7585 VTListMap.InsertNode(Result, IP);
7591 unsigned NumVTs = VTs.
size();
7594 for (
unsigned index = 0; index < NumVTs; index++) {
7599 SDVTListNode *Result = VTListMap.FindNodeOrInsertPos(ID, IP);
7604 VTListMap.InsertNode(Result, IP);
7623 void *InsertPos =
nullptr;
7624 if (
SDNode *Existing = FindModifiedNodeSlot(N, Op, InsertPos))
7629 if (!RemoveNodeFromCSEMaps(N))
7630 InsertPos =
nullptr;
7633 N->OperandList[0].set(Op);
7637 if (InsertPos) CSEMap.InsertNode(N, InsertPos);
7649 void *InsertPos =
nullptr;
7650 if (
SDNode *Existing = FindModifiedNodeSlot(N, Op1, Op2, InsertPos))
7655 if (!RemoveNodeFromCSEMaps(N))
7656 InsertPos =
nullptr;
7659 if (N->OperandList[0] != Op1)
7660 N->OperandList[0].set(Op1);
7661 if (N->OperandList[1] != Op2)
7662 N->OperandList[1].set(Op2);
7666 if (InsertPos) CSEMap.InsertNode(N, InsertPos);
7672 SDValue Ops[] = { Op1, Op2, Op3 };
7679 SDValue Ops[] = { Op1, Op2, Op3, Op4 };
7686 SDValue Ops[] = { Op1, Op2, Op3, Op4, Op5 };
7692 unsigned NumOps = Ops.
size();
7694 "Update with wrong number of operands");
7701 void *InsertPos =
nullptr;
7702 if (
SDNode *Existing = FindModifiedNodeSlot(N, Ops, InsertPos))
7707 if (!RemoveNodeFromCSEMaps(N))
7708 InsertPos =
nullptr;
7711 for (
unsigned i = 0; i != NumOps; ++i)
7712 if (N->OperandList[i] != Ops[i])
7713 N->OperandList[i].set(Ops[i]);
7717 if (InsertPos) CSEMap.InsertNode(N, InsertPos);
7734 if (NewMemRefs.
empty()) {
7740 if (NewMemRefs.
size() == 1) {
7741 N->MemRefs = NewMemRefs[0];
7747 Allocator.template Allocate<MachineMemOperand *>(NewMemRefs.
size());
7749 N->MemRefs = MemRefsBuffer;
7750 N->NumMemRefs =
static_cast<int>(NewMemRefs.
size());
7781 SDValue Ops[] = { Op1, Op2, Op3 };
7870 if (
SDNode *ON = FindNodeOrInsertPos(ID,
SDLoc(N), IP))
7871 return UpdateSDLocOnMergeSDNode(ON,
SDLoc(N));
7874 if (!RemoveNodeFromCSEMaps(N))
7879 N->ValueList = VTs.
VTs;
7880 N->NumValues = VTs.
NumVTs;
7890 DeadNodeSet.
insert(Used);
7899 createOperands(N, Ops);
7903 if (!DeadNodeSet.
empty()) {
7905 for (
SDNode *N : DeadNodeSet)
7912 CSEMap.InsertNode(N, IP);
7922 #define INSTRUCTION(NAME, NARG, ROUND_MODE, INTRINSIC, DAGN) \ 7923 case ISD::STRICT_##DAGN: NewOpc = ISD::DAGN; break; 7924 #define CMP_INSTRUCTION(NAME, NARG, ROUND_MODE, INTRINSIC, DAGN) \ 7925 case ISD::STRICT_##DAGN: NewOpc = ISD::SETCC; break; 7926 #include "llvm/IR/ConstrainedOps.def" 7988 SDValue Ops[] = { Op1, Op2, Op3 };
8010 SDValue Ops[] = { Op1, Op2, Op3 };
8034 SDValue Ops[] = { Op1, Op2, Op3 };
8063 if (
SDNode *
E = FindNodeOrInsertPos(ID, DL, IP)) {
8064 return cast<MachineSDNode>(UpdateSDLocOnMergeSDNode(
E, DL));
8070 createOperands(N, Ops);
8073 CSEMap.InsertNode(N, IP);
8086 VT, Operand, SRIdxVal);
8096 VT, Operand, Subreg, SRIdxVal);
8109 if (
SDNode *
E = FindNodeOrInsertPos(ID,
SDLoc(), IP)) {
8110 E->intersectFlagsWith(Flags);
8121 SDNode *N,
unsigned R,
bool IsIndirect,
8123 assert(cast<DILocalVariable>(Var)->isValidLocationForIntrinsic(DL) &&
8124 "Expected inlined-at fields to agree");
8126 SDDbgValue(Var, Expr, N, R, IsIndirect, DL, O);
8134 assert(cast<DILocalVariable>(Var)->isValidLocationForIntrinsic(DL) &&
8135 "Expected inlined-at fields to agree");
8145 assert(cast<DILocalVariable>(Var)->isValidLocationForIntrinsic(DL) &&
8146 "Expected inlined-at fields to agree");
8154 unsigned VReg,
bool IsIndirect,
8156 assert(cast<DILocalVariable>(Var)->isValidLocationForIntrinsic(DL) &&
8157 "Expected inlined-at fields to agree");
8163 unsigned OffsetInBits,
unsigned SizeInBits,
8164 bool InvalidateDbg) {
8167 assert(FromNode && ToNode &&
"Can't modify dbg values");
8172 if (From == To || FromNode == ToNode)
8186 if (Dbg->getResNo() != From.
getResNo())
8190 auto *Expr = Dbg->getExpression();
8196 if (
auto FI = Expr->getFragmentInfo())
8197 if (OffsetInBits + SizeInBits > FI->SizeInBits)
8207 Var, Expr, ToNode, To.
getResNo(), Dbg->isIndirect(), Dbg->getDebugLoc(),
8211 if (InvalidateDbg) {
8213 Dbg->setIsInvalidated();
8214 Dbg->setIsEmitted();
8228 if (DV->isInvalidated())
8243 auto *DIExpr = DV->getExpression();
8248 DV->isIndirect(), DV->getDebugLoc(), DV->getOrder());
8250 DV->setIsInvalidated();
8254 dbgs() <<
" into " << *DIExpr <<
'\n');
8266 assert(cast<DILabel>(Label)->isValidLocationForIntrinsic(DL) &&
8267 "Expected inlined-at fields to agree");
8283 while (UI != UE && N == *UI)
8304 "Cannot replace with this method!");
8305 assert(From != To.
getNode() &&
"Cannot replace uses of with self");
8318 RAUWUpdateListener Listener(*
this, UI, UE);
8323 RemoveNodeFromCSEMaps(User);
8335 }
while (UI != UE && *UI == User);
8338 AddModifiedNodeToCSEMaps(User);
8357 "Cannot use this version of ReplaceAllUsesWith!");
8367 assert((i < To->getNumValues()) &&
"Invalid To location");
8374 RAUWUpdateListener Listener(*
this, UI, UE);
8379 RemoveNodeFromCSEMaps(User);
8391 }
while (UI != UE && *UI == User);
8395 AddModifiedNodeToCSEMaps(User);
8419 RAUWUpdateListener Listener(*
this, UI, UE);
8424 RemoveNodeFromCSEMaps(User);
8430 bool To_IsDivergent =
false;
8437 }
while (UI != UE && *UI == User);
8444 AddModifiedNodeToCSEMaps(User);
8457 if (From == To)
return;
8472 RAUWUpdateListener Listener(*
this, UI, UE);
8475 bool UserRemovedFromCSEMaps =
false;
8492 if (!UserRemovedFromCSEMaps) {
8493 RemoveNodeFromCSEMaps(User);
8494 UserRemovedFromCSEMaps =
true;
8501 }
while (UI != UE && *UI == User);
8504 if (!UserRemovedFromCSEMaps)
8509 AddModifiedNodeToCSEMaps(User);
8528 bool operator<(
const UseMemo &L,
const UseMemo &R) {
8536 if (TLI->isSDNodeAlwaysUniform(N))
8538 bool IsDivergent = TLI->isSDNodeSourceOfDivergence(N, FLI, DA);
8539 for (
auto &Op : N->
ops()) {
8543 if (N->
SDNodeBits.IsDivergent != IsDivergent) {
8545 for (
auto U : N->
uses()) {
8551 void SelectionDAG::CreateTopologicalOrder(std::vector<SDNode *> &Order) {
8553 Order.
reserve(AllNodes.size());
8558 Order.push_back(&N);
8560 for (
size_t I = 0;
I != Order.size(); ++
I) {
8562 for (
auto U : N->
uses()) {
8563 unsigned &UnsortedOps = Degree[U];
8564 if (0 == --UnsortedOps)
8572 std::vector<SDNode *> TopoOrder;
8573 CreateTopologicalOrder(TopoOrder);
8577 DivergenceMap[&
N] =
false;
8579 for (
auto N : TopoOrder) {
8580 bool IsDivergent = DivergenceMap[
N];
8582 for (
auto &Op : N->
ops()) {
8584 IsSDNodeDivergent |= DivergenceMap[Op.
getNode()];
8587 DivergenceMap[
N] =
true;
8593 "Divergence bit inconsistency detected\n");
8615 for (
unsigned i = 0; i != Num; ++i) {
8616 unsigned FromResNo = From[i].
getResNo();
8619 E = FromNode->
use_end(); UI !=
E; ++UI) {
8622 UseMemo Memo = { *UI, i, &Use };
8631 for (
unsigned UseIndex = 0, UseIndexEnd = Uses.
size();
8632 UseIndex != UseIndexEnd; ) {
8638 RemoveNodeFromCSEMaps(User);
8645 unsigned i = Uses[UseIndex].Index;
8650 }
while (UseIndex != UseIndexEnd && Uses[UseIndex].User == User);
8654 AddModifiedNodeToCSEMaps(User);
8662 unsigned DAGSize = 0;
8685 SortedPos = AllNodes.insert(SortedPos, AllNodes.remove(Q));
8686 assert(SortedPos != AllNodes.end() &&
"Overran node list");
8705 assert(Degree != 0 &&
"Invalid node degree");
8711 SortedPos = AllNodes.insert(SortedPos, AllNodes.remove(P));
8712 assert(SortedPos != AllNodes.end() &&
"Overran node list");
8719 if (Node.getIterator() == SortedPos) {
8723 dbgs() <<
"Overran sorted position:\n";
8725 dbgs() <<
"Checking if this is due to cycles\n";
8732 assert(SortedPos == AllNodes.end() &&
8733 "Topological sort incomplete!");
8735 "First node in topological sort is not the entry token!");
8736 assert(AllNodes.front().getNodeId() == 0 &&
8737 "First node in topological sort has non-zero id!");
8738 assert(AllNodes.front().getNumOperands() == 0 &&
8739 "First node in topological sort has operands!");
8740 assert(AllNodes.back().getNodeId() == (int)DAGSize-1 &&
8741 "Last node in topologic sort has unexpected id!");
8742 assert(AllNodes.back().use_empty() &&
8743 "Last node in topologic sort has users!");
8755 DbgInfo->add(DB, SD, isParameter);
8764 assert(isa<MemSDNode>(NewMemOp.
getNode()) &&
"Expected a memop node");
8783 assert(isa<ExternalSymbolSDNode>(Op) &&
"Node should be an ExternalSymbol");
8785 auto *
Symbol = cast<ExternalSymbolSDNode>(
Op)->getSymbol();
8789 if (OutFunction !=
nullptr)
8797 std::string ErrorStr;
8800 ErrorFormatter <<
"Undefined external symbol ";
8801 ErrorFormatter <<
'"' <<
Symbol <<
'"';
8802 ErrorFormatter.
flush();
8828 return Const !=
nullptr && Const->
isOne();
8860 bool AllowTruncation) {
8870 if (CN && (UndefElements.
none() || AllowUndefs)) {
8873 assert(CVT.
bitsGE(NSVT) &&
"Illegal build vector element extension");
8874 if (AllowTruncation || (CVT == NSVT))
8884 bool AllowTruncation) {
8890 ConstantSDNode *CN = BV->getConstantSplatNode(DemandedElts, &UndefElements);
8894 if (CN && (UndefElements.
none() || AllowUndefs)) {
8897 assert(CVT.
bitsGE(NSVT) &&
"Illegal build vector element extension");
8898 if (AllowTruncation || (CVT == NSVT))
8913 if (CN && (UndefElements.
none() || AllowUndefs))
8921 const APInt &DemandedElts,
8929 BV->getConstantFPSplatNode(DemandedElts, &UndefElements);
8930 if (CN && (UndefElements.
none() || AllowUndefs))
8961 GlobalAddressSDNode::GlobalAddressSDNode(
unsigned Opc,
unsigned Order,
8964 int64_t o,
unsigned TF)
8965 :
SDNode(Opc, Order, DL, getSDVTList(VT)),
Offset(o), TargetFlags(TF) {
8970 EVT VT,
unsigned SrcAS,
8973 SrcAddrSpace(SrcAS), DestAddrSpace(DestAS) {}
8977 :
SDNode(Opc, Order, dl, VTs), MemoryVT(memvt), MMO(mmo) {
9000 std::vector<EVT> VTs;
9017 const EVT *SDNode::getValueTypeList(
EVT VT) {
9020 return &(*EVTs->insert(VT).first);
9023 "Value type out of range!");
9036 if (UI.getUse().getResNo() ==
Value) {
9053 if (UI.getUse().getResNo() ==
Value)
9109 unsigned Depth)
const {
9110 if (*
this == Dest)
return true;
9114 if (Depth == 0)
return false;
9139 if (
LoadSDNode *Ld = dyn_cast<LoadSDNode>(*
this)) {
9140 if (Ld->isUnordered())
9141 return Ld->getChain().reachesChainWithoutSideEffects(Dest, Depth-1);
9160 bool AllowPartials) {
9175 unsigned CandidateBinOp = Op.
getOpcode();
9178 switch (CandidateBinOp) {
9190 auto PartialReduction = [&](
SDValue Op,
unsigned NumSubElts) {
9191 if (!AllowPartials || !Op)
9196 if (!TLI->isExtractSubvectorCheap(SubVT, OpVT, 0))
9201 getConstant(0,
SDLoc(Op), TLI->getVectorIdxTy(getDataLayout())));
9219 for (
unsigned i = 0; i < Stages; ++i) {
9220 unsigned MaskEnd = (1 << i);
9223 return PartialReduction(PrevOp, MaskEnd);
9239 return PartialReduction(PrevOp, MaskEnd);
9244 return PartialReduction(PrevOp, MaskEnd);
9255 "Can't unroll a vector with multiple results!");
9258 unsigned NE = VT.getVectorNumElements();
9268 else if (NE > ResNE)
9272 for (i= 0; i !=
NE; ++i) {
9281 getConstant(i, dl, TLI->getVectorIdxTy(getDataLayout())));
9315 for (; i < ResNE; ++i)
9319 return getBuildVector(VecVT, dl, Scalars);
9323 SDNode *N,
unsigned ResNE) {
9328 "Expected an overflow opcode");
9340 else if (NE > ResNE)
9345 ExtractVectorElements(N->
getOperand(0), LHSScalars, 0,
NE);
9346 ExtractVectorElements(N->
getOperand(1), RHSScalars, 0,
NE);
9348 EVT SVT = TLI->getSetCCResultType(getDataLayout(), *getContext(), ResEltVT);
9352 for (
unsigned i = 0; i <
NE; ++i) {
9353 SDValue Res = getNode(Opcode, dl, VTs, LHSScalars[i], RHSScalars[i]);
9355 getSelect(dl, OvEltVT, Res.
getValue(1),
9356 getBoolConstant(
true, dl, OvEltVT, ResVT),
9357 getConstant(0, dl, OvEltVT));
9363 ResScalars.
append(ResNE - NE, getUNDEF(ResEltVT));
9364 OvScalars.
append(ResNE - NE, getUNDEF(OvEltVT));
9368 return std::make_pair(getBuildVector(NewResVT, dl, ResScalars),
9369 getBuildVector(NewOvVT, dl, OvScalars));
9393 if (BaseLocDecomp.equalBaseIndex(LocDecomp, *
this, Offset))
9394 return (Dist * Bytes == Offset);
9403 int64_t GVOffset = 0;
9404 if (TLI->isGAPlusOffset(Ptr.
getNode(), GV, GVOffset)) {
9405 unsigned PtrWidth = getDataLayout().getPointerTypeSizeInBits(GV->
getType());
9409 unsigned Align = AlignBits ? 1 << std::min(31U, AlignBits) : 0;
9416 int FrameIdx = INT_MIN;
9417 int64_t FrameOffset = 0;
9419 FrameIdx = FI->getIndex();
9420 }
else if (isBaseWithConstantOffset(Ptr) &&
9423 FrameIdx = cast<FrameIndexSDNode>(Ptr.
getOperand(0))->getIndex();
9427 if (FrameIdx != INT_MIN) {
9443 LoVT = HiVT = TLI->getTypeToTransformTo(*getContext(), VT);
9447 return std::make_pair(LoVT, HiVT);
9452 std::pair<SDValue, SDValue>
9457 "More vector elements requested than available!");
9460 getConstant(0, DL, TLI->getVectorIdxTy(getDataLayout())));
9463 TLI->getVectorIdxTy(getDataLayout())));
9464 return std::make_pair(Lo, Hi);
9473 getConstant(0, DL, TLI->getVectorIdxTy(getDataLayout())));
9478 unsigned Start,
unsigned Count) {
9484 EVT IdxTy = TLI->getVectorIdxTy(getDataLayout());
9486 for (
unsigned i = Start,
e = Start + Count; i !=
e; ++i) {
9488 Op, getConstant(i, SL, IdxTy)));
9494 return getGlobal()->getType()->getAddressSpace();
9498 if (isMachineConstantPoolEntry())
9499 return Val.MachineCPVal->getType();
9500 return Val.ConstVal->getType();
9504 unsigned &SplatBitSize,
9506 unsigned MinSplatBits,
9507 bool IsBigEndian)
const {
9511 if (MinSplatBits > VecWidth)
9516 SplatValue =
APInt(VecWidth, 0);
9517 SplatUndef =
APInt(VecWidth, 0);
9524 assert(NumOps > 0 &&
"isConstantSplat has 0-size build vector");
9527 for (
unsigned j = 0; j < NumOps; ++j) {
9528 unsigned i = IsBigEndian ? NumOps - 1 - j : j;
9530 unsigned BitPos = j * EltWidth;
9533 SplatUndef.
setBits(BitPos, BitPos + EltWidth);
9534 else if (
auto *CN = dyn_cast<ConstantSDNode>(OpVal))
9535 SplatValue.
insertBits(CN->getAPIntValue().zextOrTrunc(EltWidth), BitPos);
9536 else if (
auto *CN = dyn_cast<ConstantFPSDNode>(OpVal))
9537 SplatValue.
insertBits(CN->getValueAPF().bitcastToAPInt(), BitPos);
9544 HasAnyUndefs = (SplatUndef != 0);
9547 while (VecWidth > 8) {
9548 unsigned HalfSize = VecWidth / 2;
9555 if ((HighValue & ~LowUndef) != (LowValue & ~HighUndef) ||
9556 MinSplatBits > HalfSize)
9559 SplatValue = HighValue | LowValue;
9560 SplatUndef = HighUndef & LowUndef;
9562 VecWidth = HalfSize;
9565 SplatBitSize = VecWidth;
9571 if (UndefElements) {
9572 UndefElements->
clear();
9576 "Unexpected vector size");
9581 if (!DemandedElts[i])
9586 (*UndefElements)[i] =
true;
9587 }
else if (!Splatted) {
9589 }
else if (Splatted != Op) {
9597 "Can only have a splat without a constant for all undefs.");
9612 return dyn_cast_or_null<ConstantSDNode>(
9618 return dyn_cast_or_null<ConstantSDNode>(
getSplatValue(UndefElements));
9624 return dyn_cast_or_null<ConstantFPSDNode>(
9630 return dyn_cast_or_null<ConstantFPSDNode>(
getSplatValue(UndefElements));
9637 dyn_cast_or_null<ConstantFPSDNode>(
getSplatValue(UndefElements))) {
9640 const APFloat &APF = CN->getValueAPF();
9673 for (
int Idx = Mask[i]; i !=
e; ++i)
9674 if (Mask[i] >= 0 && Mask[i] != Idx)
9682 if (isa<ConstantSDNode>(N))
9690 TLI->isOffsetFoldingLegal(GA))
9696 if (isa<ConstantFPSDNode>(N))
9706 assert(!Node->OperandList &&
"Node already has operands");
9708 "too many operands to fit into SDNode");
9709 SDUse *Ops = OperandRecycler.allocate(
9712 bool IsDivergent =
false;
9713 for (
unsigned I = 0;
I != Vals.
size(); ++
I) {
9714 Ops[
I].setUser(Node);
9715 Ops[
I].setInitial(Vals[
I]);
9717 IsDivergent = IsDivergent || Ops[I].getNode()->isDivergent();
9719 Node->NumOperands = Vals.
size();
9720 Node->OperandList = Ops;
9721 IsDivergent |= TLI->isSDNodeSourceOfDivergence(Node, FLI, DA);
9722 if (!TLI->isSDNodeAlwaysUniform(Node))
9730 while (Vals.
size() > Limit) {
9731 unsigned SliceIdx = Vals.
size() - Limit;
9746 if (Checked.
count(N))
9751 if (!Visited.
insert(N).second) {
9752 errs() <<
"Detected cycle in SelectionDAG\n";
9753 dbgs() <<
"Offending node:\n";
9771 #ifdef EXPENSIVE_CHECKS 9773 #endif // EXPENSIVE_CHECKS 9775 assert(N &&
"Checking nonexistent SDNode");
void clearAllBits()
Set every bit to 0.
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.
APInt abs() const
Get the absolute value;.
Pass interface - Implemented by all 'passes'.
SDNode * MorphNodeTo(SDNode *N, unsigned Opc, SDVTList VTs, ArrayRef< SDValue > Ops)
This mutates the specified node to have the specified return type, opcode, and operands.
bool isMachineConstantPoolEntry() const
void resize(unsigned N, bool t=false)
resize - Grow or shrink the bitvector.
opStatus roundToIntegral(roundingMode RM)
static APFloat getNaN(const fltSemantics &Sem, bool Negative=false, uint64_t payload=0)
Factory for NaN values.
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 ...
static const fltSemantics & IEEEquad() LLVM_READNONE
bool isEqualTo(SDValue A, SDValue B) const
Test whether two SDValues are known to compare equal.
void computeKnownBits(const Value *V, KnownBits &Known, const DataLayout &DL, unsigned Depth=0, AssumptionCache *AC=nullptr, const Instruction *CxtI=nullptr, const DominatorTree *DT=nullptr, OptimizationRemarkEmitter *ORE=nullptr, bool UseInstrInfo=true)
Determine which bits of V are known to be either zero or one and return them in the KnownZero/KnownOn...
bool isOSDarwin() const
isOSDarwin - Is this a "Darwin" OS (macOS, iOS, tvOS or watchOS).
void AddPointer(const void *Ptr)
Add* - Add various data types to Bit data.
unsigned Log2_32_Ceil(uint32_t Value)
Return the ceil log base 2 of the specified value, 32 if the value is zero.
SDNode * SelectNodeTo(SDNode *N, unsigned MachineOpc, EVT VT)
These are used for target selectors to mutate the specified node to have the specified return type...
BUILTIN_OP_END - This must be the last enum value in this list.
A parsed version of the target data layout string in and methods for querying it. ...
reference emplace_back(ArgTypes &&... Args)
constexpr char Align[]
Key for Kernel::Arg::Metadata::mAlign.
FMINNUM/FMAXNUM - Perform floating-point minimum or maximum on two values.
EVT getValueType() const
Return the ValueType of the referenced return value.
OverflowKind
Used to represent the possible overflow behavior of an operation.
static void commuteMask(MutableArrayRef< int > Mask)
Change values in a shuffle permute mask assuming the two vector operands have swapped position...
static GCMetadataPrinterRegistry::Add< ErlangGCPrinter > X("erlang", "erlang-compatible garbage collector")
const SDValue & getOffset() const
void setFlags(SDNodeFlags NewFlags)
raw_ostream & errs()
This returns a reference to a raw_ostream for standard error.
opStatus convertFromAPInt(const APInt &Input, bool IsSigned, roundingMode RM)
bool hasNoSignedZeros() const
This SDNode is used for target intrinsics that touch memory and need an associated MachineMemOperand...
SDValue getBoolExtOrTrunc(SDValue Op, const SDLoc &SL, EVT VT, EVT OpVT)
Convert Op, which must be of integer type, to the integer type VT, by using an extension appropriate ...
const GlobalValue * getGlobal() const
EXTRACT_ELEMENT - This is used to get the lower or upper (determined by a Constant, which is required to be operand #1) half of the integer or float value specified as operand #0.
uint64_t getZExtValue() const
Get zero extended value.
static APInt getAllOnesValue(unsigned numBits)
Get the all-ones value.
unsigned getOpcode() const
Return the SelectionDAG opcode value for this node.
Keeps track of dbg_value information through SDISel.
bool isBuildVectorOfConstantSDNodes(const SDNode *N)
Return true if the specified node is a BUILD_VECTOR node of all ConstantSDNode or undef...
void setBits(unsigned loBit, unsigned hiBit)
Set the bits from loBit (inclusive) to hiBit (exclusive) to 1.
SDValue UnrollVectorOp(SDNode *N, unsigned ResNE=0)
Utility function used by legalize and lowering to "unroll" a vector operation by splitting out the sc...
bool isIndexed() const
Return true if this is a pre/post inc/dec load/store.
SDValue getIndexedLoad(SDValue OrigLoad, const SDLoc &dl, SDValue Base, SDValue Offset, ISD::MemIndexedMode AM)
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...
NodeType getExtForLoadExtType(bool IsFP, LoadExtType)
DELETED_NODE - This is an illegal value that is used to catch errors.
MDNODE_SDNODE - This is a node that holdes an MDNode*, which is used to reference metadata in the IR...
EXTRACT_SUBVECTOR(VECTOR, IDX) - Returns a subvector from VECTOR (an vector value) starting with the ...
CondCode getSetCCInverse(CondCode Operation, EVT Type)
Return the operation corresponding to !(X op Y), where 'op' is a valid SetCC operation.
BR_CC - Conditional branch.
LLVM_ATTRIBUTE_NORETURN void report_fatal_error(Error Err, bool gen_crash_diag=true)
Report a serious error, calling any installed error handler.
This class represents lattice values for constants.
SDValue simplifyShift(SDValue X, SDValue Y)
Try to simplify a shift into 1 of its operands or a constant.
void intersectWith(const SDNodeFlags Flags)
Clear any flags in this flag set that aren't also set in Flags.
FMINIMUM/FMAXIMUM - NaN-propagating minimum/maximum that also treat -0.0 as less than 0...
void VerifyDAGDiverence()
unsigned countMinPopulation() const
Returns the number of bits known to be one.
VECTOR_SHUFFLE(VEC1, VEC2) - Returns a vector, of the same type as VEC1/VEC2.
CondCode getSetCCInverse(CondCode Operation, bool isIntegerLike)
Return the operation corresponding to !(X op Y), where 'op' is a valid SetCC operation.
EVT getScalarType() const
If this is a vector type, return the element type, otherwise return this.
MCSymbol - Instances of this class represent a symbol name in the MC file, and MCSymbols are created ...
SDValue getIndexedMaskedStore(SDValue OrigStore, const SDLoc &dl, SDValue Base, SDValue Offset, ISD::MemIndexedMode AM)
A Module instance is used to store all the information related to an LLVM module. ...
bool hasOptSize() const
Optimize this function for size (-Os) or minimum size (-Oz).
SDValue getPtrExtendInReg(SDValue Op, const SDLoc &DL, EVT VT)
Return the expression required to extend the Op as a pointer value assuming it was the smaller SrcTy ...
APInt sdiv(const APInt &RHS) const
Signed division function for APInt.
SDValue getAtomicMemcpy(SDValue Chain, const SDLoc &dl, SDValue Dst, unsigned DstAlign, SDValue Src, unsigned SrcAlign, SDValue Size, Type *SizeTy, unsigned ElemSz, bool isTailCall, MachinePointerInfo DstPtrInfo, MachinePointerInfo SrcPtrInfo)
bool hasConflict() const
Returns true if there is conflicting information.
virtual const TargetRegisterInfo * getRegisterInfo() const
getRegisterInfo - If register information is available, return it.
ZERO_EXTEND_VECTOR_INREG(Vector) - This operator represents an in-register zero-extension of the low ...
const Value * getSplatValue(const Value *V)
Get splat value if the input is a splat vector or return nullptr.
unsigned getIROrder() const
Return the node ordering.
SDValue getMaskedLoad(EVT VT, const SDLoc &dl, SDValue Chain, SDValue Base, SDValue Offset, SDValue Mask, SDValue Src0, EVT MemVT, MachineMemOperand *MMO, ISD::MemIndexedMode AM, ISD::LoadExtType, bool IsExpanding=false)
bool isNegative() const
Return true if the value is negative.
bool isTargetMemoryOpcode() const
Test if this node has a target-specific memory-referencing opcode (in the <target>ISD namespace and g...
Carry-setting nodes for multiple precision addition and subtraction.
void push_back(const T &Elt)
EVT getValueType(unsigned ResNo) const
Return the type of a specified result.
Clients of various APIs that cause global effects on the DAG can optionally implement this interface...
Analysis providing profile information.
EVT getHalfNumVectorElementsVT(LLVMContext &Context) const
SDValue makeEquivalentMemoryOrdering(LoadSDNode *Old, SDValue New)
If an existing load has uses of its chain, create a token factor node with that chain and the new mem...
APInt zext(unsigned width) const
Zero extend to a new width.
friend struct DAGUpdateListener
DAGUpdateListener is a friend so it can manipulate the listener stack.
APInt uadd_sat(const APInt &RHS) const
bool slt(const APInt &RHS) const
Signed less than comparison.
const SDValue & getValue() const
APInt udiv(const APInt &RHS) const
Unsigned division operation.
SDVTList getVTList() const
SDValue getTargetExternalSymbol(const char *Sym, EVT VT, unsigned TargetFlags=0)
bool isCompressingStore() const
Returns true if the op does a compression to the vector before storing.
static APInt getLowBitsSet(unsigned numBits, unsigned loBitsSet)
Get a value with low bits set.
static void commuteShuffle(SDValue &N1, SDValue &N2, MutableArrayRef< int > M)
Swaps the values of N1 and N2.
MVT getSimpleVT() const
Return the SimpleValueType held in the specified simple EVT.
virtual void addSelectionDAGCSEId(FoldingSetNodeID &ID)=0
Libcall
RTLIB::Libcall enum - This enum defines all of the runtime library calls the backend can emit...
virtual const TargetLowering * getTargetLowering() const
static PointerType * get(Type *ElementType, unsigned AddressSpace)
This constructs a pointer to an object of the specified type in a numbered address space...
SDValue getBasicBlock(MachineBasicBlock *MBB)
AAMDNodes getAAInfo() const
Returns the AA info that describes the dereference.
RESULT, BOOL = [SU]ADDO(LHS, RHS) - Overflow-aware nodes for addition.
FoldingSetNodeIDRef Intern(BumpPtrAllocator &Allocator) const
Intern - Copy this node's data to a memory region allocated from the given allocator and return a Fol...
Completely target-dependent object reference.
bool isSubsetOf(const APInt &RHS) const
This operation checks that all bits set in this APInt are also set in RHS.
static ISD::NodeType getExtendForContent(BooleanContent Content)
static const APInt * getValidMinimumShiftAmountConstant(SDValue V, const APInt &DemandedElts)
If a SHL/SRA/SRL node has constant vector shift amounts that are all less than the element bit-width ...
const SDValue & getChain() const
unsigned getResNo() const
Convenience function for get().getResNo().
bool NewNodesMustHaveLegalTypes
When true, additional steps are taken to ensure that getConstant() and similar functions return DAG n...
SDValue getTokenFactor(const SDLoc &DL, SmallVectorImpl< SDValue > &Vals)
Creates a new TokenFactor containing Vals.
uint64_t getSize() const
Return the size in bytes of the memory reference.
TargetGlobalAddress - Like GlobalAddress, but the DAG does no folding or anything else with this node...
virtual bool isCommutativeBinOp(unsigned Opcode) const
Returns true if the opcode is a commutative binary operation.
static const fltSemantics & EVTToAPFloatSemantics(EVT VT)
Returns an APFloat semantics tag appropriate for the given type.
unsigned getAlignment() const
unsigned getMaxStoresPerMemset(bool OptSize) const
Get maximum # of store operations permitted for llvm.memset.
Recycle small arrays allocated from a BumpPtrAllocator.
virtual void NodeInserted(SDNode *N)
The node N that was inserted.
bool isScalableVector() const
Return true if this is a vector type where the runtime length is machine dependent.
bool sgt(const APInt &RHS) const
Signed greater than comparison.
Val, Success, OUTCHAIN = ATOMIC_CMP_SWAP_WITH_SUCCESS(INCHAIN, ptr, cmp, swap) N.b.
bool isAllOnesOrAllOnesSplat(SDValue V)
Return true if the value is a constant -1 integer or a splatted vector of a constant -1 integer (with...
bool all_of(R &&range, UnaryPredicate P)
Provide wrappers to std::all_of which take ranges instead of having to pass begin/end explicitly...
SDValue getIndexedStore(SDValue OrigStore, const SDLoc &dl, SDValue Base, SDValue Offset, ISD::MemIndexedMode AM)
APInt trunc(unsigned width) const
Truncate to new width.
void setAllBits()
Set every bit to 1.
unsigned const TargetRegisterInfo * TRI
bool isInteger() const
Return true if this is an integer or a vector integer type.
void updateDivergence(SDNode *N)
TypeSize getScalarValueSizeInBits() const
CallLoweringInfo & setDebugLoc(const SDLoc &dl)
SIGN_EXTEND_VECTOR_INREG(Vector) - This operator represents an in-register sign-extension of the low ...
unsigned getTargetFlags() const
[US]{MIN/MAX} - Binary minimum or maximum or signed or unsigned integers.
APInt zextOrTrunc(unsigned width) const
Zero extend or truncate to width.
const SDNodeFlags getFlags() const
SDNode * isConstantFPBuildVectorOrConstantFP(SDValue N)
Test whether the given value is a constant FP or similar node.
void setNodeId(int Id)
Set unique node id.
BooleanContent getBooleanContents(bool isVec, bool isFloat) const
For targets without i1 registers, this gives the nature of the high-bits of boolean values held in ty...
SDNode * getNode() const
get the SDNode which holds the desired result
void setBitsFrom(unsigned loBit)
Set the top bits starting from loBit.
unsigned countMaxTrailingZeros() const
Returns the maximum number of trailing zero bits possible.
SDValue getNode(unsigned Opcode, const SDLoc &DL, EVT VT, ArrayRef< SDUse > Ops)
Gets or creates the specified node.
bool isVectorTy() const
True if this is an instance of VectorType.
bool exceedsNaturalStackAlignment(Align Alignment) const
Returns true if the given alignment exceeds the natural stack alignment.
virtual bool isZExtFree(Type *FromTy, Type *ToTy) const
Return true if any actual instruction that defines a value of type FromTy implicitly zero-extends the...
SDValue getConstantPool(const Constant *C, EVT VT, unsigned Align=0, int Offs=0, bool isT=false, unsigned TargetFlags=0)
const SDValue & setRoot(SDValue N)
Set the current root tag of the SelectionDAG.
void reserve(size_type N)
uint64_t Offset
Slice starts at this Offset.
bool sle(const APInt &RHS) const
Signed less or equal comparison.
MachineMemOperand * getMemOperand() const
Return a MachineMemOperand object describing the memory reference performed by operation.
bool isTrueWhenEqual(CondCode Cond)
Return true if the specified condition returns true if the two operands to the condition are equal...
void DeleteNode(SDNode *N)
Remove the specified node from the system.
INSERT_SUBVECTOR(VECTOR1, VECTOR2, IDX) - Returns a vector with VECTOR2 inserted into VECTOR1 at the ...
void intersectFlagsWith(const SDNodeFlags Flags)
Clear any flags in this node that aren't also set in Flags.
unsigned getBitWidth() const
Get the bit width of this value.
uint16_t PersistentId
Unique and persistent id per SDNode in the DAG.
SDValue SimplifyMultipleUseDemandedBits(SDValue Op, const APInt &DemandedBits, const APInt &DemandedElts, SelectionDAG &DAG, unsigned Depth) const
More limited version of SimplifyDemandedBits that can be used to "look through" ops that don't contri...
const DebugLoc & getDebugLoc() const
Return the source location info.
EntryToken - This is the marker used to indicate the start of a region.
virtual SDValue EmitTargetCodeForMemset(SelectionDAG &DAG, const SDLoc &dl, SDValue Chain, SDValue Op1, SDValue Op2, SDValue Op3, unsigned Align, bool isVolatile, MachinePointerInfo DstPtrInfo) const
Emit target-specific code that performs a memset.
void AddDbgValue(SDDbgValue *DB, SDNode *SD, bool isParameter)
Add a dbg_value SDNode.
unsigned getBitWidth() const
getBitWidth - Return the bitwidth of this constant.
SDValue WidenVector(const SDValue &N, const SDLoc &DL)
Widen the vector up to the next power of two using INSERT_SUBVECTOR.
Select with condition operator - This selects between a true value and a false value (ops #2 and #3) ...
bool hasOneUse() const
Return true if there is exactly one node using value ResNo of Node.
NodeType
ISD::NodeType enum - This enum defines the target-independent operators for a SelectionDAG.
SDValue getMCSymbol(MCSymbol *Sym, EVT VT)
void ReplaceAllUsesOfValuesWith(const SDValue *From, const SDValue *To, unsigned Num)
Like ReplaceAllUsesOfValueWith, but for multiple values at once.
virtual void NodeUpdated(SDNode *N)
The node N that was updated.
Value is a virtual register.
INT = FGETSIGN(FP) - Return the sign bit of the specified floating point value as an integer 0/1 valu...
static bool areOnlyUsersOf(ArrayRef< const SDNode *> Nodes, const SDNode *N)
Return true if all the users of N are contained in Nodes.
unsigned getBitWidth() const
Return the number of bits in the APInt.
This SDNode is used to implement the code generator support for the llvm IR shufflevector instruction...
SDValue getExternalSymbol(const char *Sym, EVT VT)
bool isAllOnesValue() const
bool isCondCodeLegal(ISD::CondCode CC, MVT VT) const
Return true if the specified condition code is legal on this target.
void transferDbgValues(SDValue From, SDValue To, unsigned OffsetInBits=0, unsigned SizeInBits=0, bool InvalidateDbg=true)
Transfer debug values from one node to another, while optionally generating fragment expressions for ...
RESULT,OUTCHAIN = INTRINSIC_W_CHAIN(INCHAIN, INTRINSICID, arg1, ...) This node represents a target in...
bool isTruncatingStore() const
Return true if the op does a truncation before store.
SDValue getAtomicMemset(SDValue Chain, const SDLoc &dl, SDValue Dst, unsigned DstAlign, SDValue Value, SDValue Size, Type *SizeTy, unsigned ElemSz, bool isTailCall, MachinePointerInfo DstPtrInfo)
unsigned countMinTrailingZeros() const
Returns the minimum number of trailing zero bits.
static bool hasPredecessorHelper(const SDNode *N, SmallPtrSetImpl< const SDNode *> &Visited, SmallVectorImpl< const SDNode *> &Worklist, unsigned int MaxSteps=0, bool TopologicalPrune=false)
Returns true if N is a predecessor of any node in Worklist.
A templated base class for SmallPtrSet which provides the typesafe interface that is common across al...
bool findOptimalMemOpLowering(std::vector< EVT > &MemOps, unsigned Limit, uint64_t Size, unsigned DstAlign, unsigned SrcAlign, bool IsMemset, bool ZeroMemset, bool MemcpyStrSrc, bool AllowOverlap, unsigned DstAS, unsigned SrcAS, const AttributeList &FuncAttributes) const
Determines the optimal series of memory ops to replace the memset / memcpy.
unsigned getAddrSpace() const
Return the LLVM IR address space number that this pointer points into.
static DIExpression * prepend(const DIExpression *Expr, uint8_t Flags, int64_t Offset=0)
Prepend DIExpr with a deref and offset operation and optionally turn it into a stack value or/and an ...
bool isFloatingPoint() const
Return true if this is a FP or a vector FP type.
SI optimize exec mask operations pre RA
opStatus convertToInteger(MutableArrayRef< integerPart > Input, unsigned int Width, bool IsSigned, roundingMode RM, bool *IsExact) const
SHL_PARTS/SRA_PARTS/SRL_PARTS - These operators are used for expanded integer shift operations...
unsigned countTrailingZeros() const
Count the number of trailing zero bits.
static GCMetadataPrinterRegistry::Add< OcamlGCMetadataPrinter > Y("ocaml", "ocaml 3.10-compatible collector")
SDValue getIntPtrConstant(uint64_t Val, const SDLoc &DL, bool isTarget=false)
virtual unsigned ComputeNumSignBitsForTargetNode(SDValue Op, const APInt &DemandedElts, const SelectionDAG &DAG, unsigned Depth=0) const
This method can be implemented by targets that want to expose additional information about sign bits ...
unsigned getTargetFlags() const
opStatus divide(const APFloat &RHS, roundingMode RM)
The address of a basic block.
void clear()
Clear state and free memory necessary to make this SelectionDAG ready to process a new block...
std::pair< SDValue, SDValue > getStrictFPExtendOrRound(SDValue Op, SDValue Chain, const SDLoc &DL, EVT VT)
Convert Op, which must be a STRICT operation of float type, to the float type VT, by either extending...
bool hasOneUse() const
Return true if there is exactly one use of this node.
A description of a memory reference used in the backend.
void clear()
clear - Removes all bits from the bitvector. Does not change capacity.
OverflowKind computeOverflowKind(SDValue N0, SDValue N1) const
Determine if the result of the addition of 2 node can overflow.
SDValue FoldSymbolOffset(unsigned Opcode, EVT VT, const GlobalAddressSDNode *GA, const SDNode *N2)
void setBit(unsigned BitPosition)
Set a given bit to 1.
AddrSpaceCastSDNode(unsigned Order, const DebugLoc &dl, EVT VT, unsigned SrcAS, unsigned DestAS)
This file declares the MachineConstantPool class which is an abstract constant pool to keep track of ...
Twine - A lightweight data structure for efficiently representing the concatenation of temporary valu...
void Reset()
Deallocate all but the current slab and reset the current pointer to the beginning of it...
SDValue getBlockAddress(const BlockAddress *BA, EVT VT, int64_t Offset=0, bool isTarget=false, unsigned TargetFlags=0)
void setHighBits(unsigned hiBits)
Set the top hiBits bits.
bool isUndef(unsigned Opcode, ArrayRef< SDValue > Ops)
Return true if the result of this operation is always undefined.
ConstantSDNode * isConstOrConstSplat(SDValue N, bool AllowUndefs=false, bool AllowTruncation=false)
Returns the SDNode if it is a constant splat BuildVector or constant int.
SDValue getSplatSourceVector(SDValue V, int &SplatIndex)
If V is a splatted value, return the source vector and its splat index.
bool isNonNegative() const
Determine if this APInt Value is non-negative (>= 0)
unsigned getPointerTypeSizeInBits(Type *) const
Layout pointer size, in bits, based on the type.
bool isNonTemporal() const
static KnownBits computeForAddSub(bool Add, bool NSW, const KnownBits &LHS, KnownBits RHS)
Compute known bits resulting from adding LHS and RHS.
APInt shl(unsigned shiftAmt) const
Left-shift function.
Shift and rotation operations.
bool matchUnaryPredicate(SDValue Op, std::function< bool(ConstantSDNode *)> Match, bool AllowUndefs=false)
Attempt to match a unary predicate against a scalar/splat constant or every element of a constant BUI...
Type * getTypeForEVT(LLVMContext &Context) const
This method returns an LLVM type corresponding to the specified EVT.
APInt zextOrSelf(unsigned width) const
Zero extend or truncate to width.
bool isBuildVectorAllZeros(const SDNode *N)
Return true if the specified node is a BUILD_VECTOR where all of the elements are 0 or undef...
APInt rotr(unsigned rotateAmt) const
Rotate right by rotateAmt.
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.
SDValue getTargetExtractSubreg(int SRIdx, const SDLoc &DL, EVT VT, SDValue Operand)
A convenience function for creating TargetInstrInfo::EXTRACT_SUBREG nodes.
MachineSDNode * getMachineNode(unsigned Opcode, const SDLoc &dl, EVT VT)
These are used for target selectors to create a new node with specified return type(s), MachineInstr opcode, and operands.
static SDValue FoldBUILD_VECTOR(const SDLoc &DL, EVT VT, ArrayRef< SDValue > Ops, SelectionDAG &DAG)
static Optional< unsigned > getOpcode(ArrayRef< VPValue *> Values)
Returns the opcode of Values or ~0 if they do not all agree.
CallLoweringInfo & setChain(SDValue InChain)
BUILD_PAIR - This is the opposite of EXTRACT_ELEMENT in some ways.
This class consists of common code factored out of the SmallVector class to reduce code duplication b...
SDValue getLifetimeNode(bool IsStart, const SDLoc &dl, SDValue Chain, int FrameIndex, int64_t Size, int64_t Offset=-1)
Creates a LifetimeSDNode that starts (IsStart==true) or ends (IsStart==false) the lifetime of the por...
op_iterator op_end() const
uint64_t getConstantOperandVal(unsigned i) const
ISD::LoadExtType getExtensionType() const
Return whether this is a plain node, or one of the varieties of value-extending loads.
bool isZEXTLoad(const SDNode *N)
Returns true if the specified node is a ZEXTLOAD.
bool none_of(R &&Range, UnaryPredicate P)
Provide wrappers to std::none_of which take ranges instead of having to pass begin/end explicitly...
static void checkAddrSpaceIsValidForLibcall(const TargetLowering *TLI, unsigned AS)
void AddInteger(signed I)
The memory access is dereferenceable (i.e., doesn't trap).
virtual const Constant * getTargetConstantFromLoad(LoadSDNode *LD) const
This method returns the constant pool value that will be loaded by LD.
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.
const SDValue & getValue() const
SDValue getEntryNode() const
Return the token chain corresponding to the entry of the function.
TypeSize getValueSizeInBits() const
Returns the size of the value in bits.
const DataLayout & getDataLayout() const
SDVTList getVTList(EVT VT)
Return an SDVTList that represents the list of values specified.
mir Rename Register Operands
APInt getHiBits(unsigned numBits) const
Compute an APInt containing numBits highbits from this APInt.
const BlockAddress * getBlockAddress() const
CondCode getSetCCAndOperation(CondCode Op1, CondCode Op2, EVT Type)
Return the result of a logical AND between different comparisons of identical values: ((X op1 Y) & (X...
This is an SDNode representing atomic operations.
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.
void lshrInPlace(unsigned ShiftAmt)
Logical right-shift this APInt by ShiftAmt in place.
SDValue FoldSetCC(EVT VT, SDValue N1, SDValue N2, ISD::CondCode Cond, const SDLoc &dl)
Constant fold a setcc to true or false.
This class defines information used to lower LLVM code to legal SelectionDAG operators that the targe...
This file implements a class to represent arbitrary precision integral constant values and operations...
SDValue matchBinOpReduction(SDNode *Extract, ISD::NodeType &BinOp, ArrayRef< ISD::NodeType > CandidateBinOps, bool AllowPartials=false)
Match a binop + shuffle pyramid that represents a horizontal reduction over the elements of a vector ...
This represents a list of ValueType's that has been intern'd by a SelectionDAG.
iterator_range< allnodes_iterator > allnodes()
SDValue getExtLoad(ISD::LoadExtType ExtType, const SDLoc &dl, EVT VT, SDValue Chain, SDValue Ptr, MachinePointerInfo PtrInfo, EVT MemVT, unsigned Alignment=0, MachineMemOperand::Flags MMOFlags=MachineMemOperand::MONone, const AAMDNodes &AAInfo=AAMDNodes())
bool isConstantSplatVector(const SDNode *N, APInt &SplatValue)
Node predicates.
virtual bool isTruncateFree(Type *FromTy, Type *ToTy) const
Return true if it's free to truncate a value of type FromTy to type ToTy.
This class is used to represent an MSTORE node.
SDValue getMergeValues(ArrayRef< SDValue > Ops, const SDLoc &dl)
Create a MERGE_VALUES node from the given operands.
Align getMinStackArgumentAlignment() const
Return the minimum stack alignment of an argument.
unsigned AssignTopologicalOrder()
Topological-sort the AllNodes list and a assign a unique node id for each node in the DAG based on th...
static void VerifySDNode(SDNode *N)
VerifySDNode - Sanity check the given SDNode. Aborts if it is invalid.
auto reverse(ContainerTy &&C, typename std::enable_if< has_rbegin< ContainerTy >::value >::type *=nullptr) -> decltype(make_range(C.rbegin(), C.rend()))
unsigned getActiveBits() const
Compute the number of active bits in the value.
unsigned countMaxPopulation() const
Returns the maximum number of bits that could be one.
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 ashrInPlace(unsigned ShiftAmt)
Arithmetic right-shift this APInt by ShiftAmt in place.
void dumprFull(const SelectionDAG *G=nullptr) const
printrFull to dbgs().
static SDValue getMemsetValue(SDValue Value, EVT VT, SelectionDAG &DAG, const SDLoc &dl)
getMemsetValue - Vectorized representation of the memset value operand.
STRICT_FSETCC/STRICT_FSETCCS - Constrained versions of SETCC, used for floating-point operands only...
static SDValue getMemsetStores(SelectionDAG &DAG, const SDLoc &dl, SDValue Chain, SDValue Dst, SDValue Src, uint64_t Size, unsigned Align, bool isVol, MachinePointerInfo DstPtrInfo)
Lower the call to 'memset' intrinsic function into a series of store operations.
Value is contents of a stack location.
bool isNull() const
Test if the pointer held in the union is null, regardless of which type it is.
void checkForCycles(const SelectionDAG *DAG, bool force=false)
Type * getType() const
All values are typed, get the type of this value.
bool getBoolValue() const
Convert APInt to a boolean value.
MachineFunction & getMachineFunction() const
[SU]INT_TO_FP - These operators convert integers (whose interpreted sign depends on the first letter)...
bool isOneOrOneSplat(SDValue V)
Return true if the value is a constant 1 integer or a splatted vector of a constant 1 integer (with n...
const ConstantDataArray * Array
ConstantDataArray pointer.
opStatus convert(const fltSemantics &ToSemantics, roundingMode RM, bool *losesInfo)
void clearMemRefs()
Clear out the memory reference descriptor list.
static KnownBits computeForAddCarry(const KnownBits &LHS, const KnownBits &RHS, const KnownBits &Carry)
Compute known bits resulting from adding LHS, RHS and a 1-bit Carry.
SDValue getRegisterMask(const uint32_t *RegMask)
DAGUpdateListener *const Next
int64_t getOffset() const
bool isKnownNeverZero(SDValue Op) const
Test whether the given SDValue is known to contain non-zero value(s).
static cl::opt< int > MaxLdStGlue("ldstmemcpy-glue-max", cl::desc("Number limit for gluing ld/st of memcpy."), cl::Hidden, cl::init(0))
SDNode * mutateStrictFPToFP(SDNode *Node)
Mutate the specified strict FP node to its non-strict equivalent, unlinking the node from its chain a...
const TargetMachine & getTarget() const
CallingConv::ID getLibcallCallingConv(RTLIB::Libcall Call) const
Get the CallingConv that should be used for the specified libcall.
void init(MachineFunction &NewMF, OptimizationRemarkEmitter &NewORE, Pass *PassPtr, const TargetLibraryInfo *LibraryInfo, LegacyDivergenceAnalysis *Divergence, ProfileSummaryInfo *PSIin, BlockFrequencyInfo *BFIin)
Prepare this SelectionDAG to process code in the given MachineFunction.
Select with a vector condition (op #0) and two vector operands (ops #1 and #2), returning a vector re...
void clearBit(unsigned BitPosition)
Set a given bit to 0.
SDValue peekThroughBitcasts(SDValue V)
Return the non-bitcasted source operand of V if it exists.
APInt sextOrTrunc(unsigned width) const
Sign extend or truncate to width.
Simple integer binary arithmetic operators.
bool isOperandOf(const SDNode *N) const
Return true if this node is an operand of N.
int32_t exactLogBase2() const
APInt extractBits(unsigned numBits, unsigned bitPosition) const
Return an APInt with the extracted bits [bitPosition,bitPosition+numBits).
SDValue getSetCC(const SDLoc &DL, EVT VT, SDValue LHS, SDValue RHS, ISD::CondCode Cond, SDValue Chain=SDValue(), bool IsSignaling=false)
Helper function to make it easier to build SetCC's if you just have an ISD::CondCode instead of an SD...
ArrayRef - Represent a constant reference to an array (0 or more elements consecutively in memory)...
MemIndexType
MemIndexType enum - This enum defines how to interpret MGATHER/SCATTER's index parameter when calcula...
unsigned getTargetFlags() const
const APInt & getValue() const
Return the constant as an APInt value reference.
bool isLittleEndian() const
Layout endianness...
opStatus subtract(const APFloat &RHS, roundingMode RM)
virtual SDValue EmitTargetCodeForMemmove(SelectionDAG &DAG, const SDLoc &dl, SDValue Chain, SDValue Op1, SDValue Op2, SDValue Op3, unsigned Align, bool isVolatile, MachinePointerInfo DstPtrInfo, MachinePointerInfo SrcPtrInfo) const
Emit target-specific code that performs a memmove.
SDValue getUNDEF(EVT VT)
Return an UNDEF node. UNDEF does not have a useful SDLoc.
AttributeList getAttributes() const
Return the attribute list for this Function.
cmpResult
IEEE-754R 5.11: Floating Point Comparison Relations.
bool isKnownNeverNaN(SDValue Op, bool SNaN=false, unsigned Depth=0) const
Test whether the given SDValue is known to never be NaN.
SDDbgValue * getVRegDbgValue(DIVariable *Var, DIExpression *Expr, unsigned VReg, bool IsIndirect, const DebugLoc &DL, unsigned O)
Creates a VReg SDDbgValue node.
CondCode
ISD::CondCode enum - These are ordered carefully to make the bitfields below work out...
static Error getOffset(const SymbolRef &Sym, SectionRef Sec, uint64_t &Result)
op_iterator op_begin() const
X = STRICT_FP_EXTEND(Y) - Extend a smaller FP type into a larger FP type.
static const fltSemantics & IEEEdouble() LLVM_READNONE
TargetConstant* - Like Constant*, but the DAG does not do any folding, simplification, or lowering of the constant.
bool isKnownNeverZeroFloat(SDValue Op) const
Test whether the given floating point SDValue is known to never be positive or negative zero...
SDValue getTargetConstant(uint64_t Val, const SDLoc &DL, EVT VT, bool isOpaque=false)
ANY_EXTEND_VECTOR_INREG(Vector) - This operator represents an in-register any-extension of the low la...
SDValue getSplatBuildVector(EVT VT, const SDLoc &DL, SDValue Op)
Return a splat ISD::BUILD_VECTOR node, consisting of Op splatted to all elements. ...
ArrayRef< SDUse > ops() const
SDValue getLabelNode(unsigned Opcode, const SDLoc &dl, SDValue Root, MCSymbol *Label)
void setIROrder(unsigned Order)
Set the node ordering.
const SDValue & getMask() const
bool getHasDebugValue() const
RESULT = INTRINSIC_WO_CHAIN(INTRINSICID, arg1, arg2, ...) This node represents a target intrinsic fun...
SDValue getAtomic(unsigned Opcode, const SDLoc &dl, EVT MemVT, SDValue Chain, SDValue Ptr, SDValue Val, MachineMemOperand *MMO)
Gets a node for an atomic op, produces result (if relevant) and chain and takes 2 operands...
APInt reverseBits() const
SDNodeBitfields SDNodeBits
Analysis containing CSE Info
ConstantFPSDNode * getConstantFPSplatNode(const APInt &DemandedElts, BitVector *UndefElements=nullptr) const
Returns the demanded splatted constant FP or null if this is not a constant FP splat.
std::pair< EVT, EVT > GetSplitDestVTs(const EVT &VT) const
Compute the VTs needed for the low/hi parts of a type which is split (or expanded) into two not neces...
const char * getSymbol() const
UNDEF - An undefined node.
This class is used to represent ISD::STORE nodes.
FP_TO_[US]INT - Convert a floating point value to a signed or unsigned integer.
static void AddNodeIDValueTypes(FoldingSetNodeID &ID, SDVTList VTList)
AddNodeIDValueTypes - Value type lists are intern'd so we can represent them solely with their pointe...
BUILD_VECTOR(ELT0, ELT1, ELT2, ELT3,...) - Return a vector with the specified, possibly variable...
bool isOneConstant(SDValue V)
Returns true if V is a constant integer one.
Constant * getAggregateElement(unsigned Elt) const
For aggregates (struct/array/vector) return the constant that corresponds to the specified element if...
This corresponds to the llvm.lifetime.
MVT getSimpleValueType() const
Return the simple ValueType of the referenced return value.
SDValue getSplatValue(SDValue V)
If V is a splat vector, return its scalar source operand by extracting that element from the source v...
bool isNegative() const
Returns true if this value is known to be negative.
static APInt getHighBitsSet(unsigned numBits, unsigned hiBitsSet)
Get a value with high bits set.
bool bitsGT(EVT VT) const
Return true if this has more bits than VT.
unsigned ComputeNumSignBits(SDValue Op, unsigned Depth=0) const
Return the number of times the sign bit of the register is replicated into the other bits...
bool getConstantDataArrayInfo(const Value *V, ConstantDataArraySlice &Slice, unsigned ElementSize, uint64_t Offset=0)
Returns true if the value V is a pointer into a ConstantDataArray.
Constant * getSplatValue(bool AllowUndefs=false) const
If all elements of the vector constant have the same value, return that value.
bool isZero() const
Return true if the value is positive or negative zero.
FoldingSetNodeID - This class is used to gather all the unique data bits of a node.
The memory access is volatile.
bool MaskedValueIsAllOnes(SDValue Op, const APInt &Mask, unsigned Depth=0) const
Return true if '(Op & Mask) == Mask'.
constexpr uint64_t MinAlign(uint64_t A, uint64_t B)
A and B are either alignments or offsets.
unsigned getNumValues() const
Return the number of values defined/returned by this operator.
IntegerType * getIntPtrType(LLVMContext &C, unsigned AddressSpace=0) const
Returns an integer type with size at least as big as that of a pointer in the given address space...
SDDbgValue * getConstantDbgValue(DIVariable *Var, DIExpression *Expr, const Value *C, const DebugLoc &DL, unsigned O)
Creates a constant SDDbgValue node.
unsigned getObjectAlignment(int ObjectIdx) const
Return the alignment of the specified stack object.
void insertBits(const APInt &SubBits, unsigned bitPosition)
Insert the bits from a smaller APInt starting at bitPosition.
BlockFrequencyInfo pass uses BlockFrequencyInfoImpl implementation to estimate IR basic block frequen...
SDValue getMDNode(const MDNode *MD)
Return an MDNodeSDNode which holds an MDNode.
bool isNegative() const
Determine sign of this APInt.
const SDValue & getBasePtr() const
static void chainLoadsAndStoresForMemcpy(SelectionDAG &DAG, const SDLoc &dl, SmallVector< SDValue, 32 > &OutChains, unsigned From, unsigned To, SmallVector< SDValue, 16 > &OutLoadChains, SmallVector< SDValue, 16 > &OutStoreChains)
bool isSimple() const
Returns true if the memory operation is neither atomic or volatile.
initializer< Ty > init(const Ty &Val)
bool bitsGE(EVT VT) const
Return true if this has no less bits than VT.
SDValue getVectorShuffle(EVT VT, const SDLoc &dl, SDValue N1, SDValue N2, ArrayRef< int > Mask)
Return an ISD::VECTOR_SHUFFLE node.
int64_t getOffset() const
OUTCHAIN = INTRINSIC_VOID(INCHAIN, INTRINSICID, arg1, arg2, ...) This node represents a target intrin...
static SDValue getMemmoveLoadsAndStores(SelectionDAG &DAG, const SDLoc &dl, SDValue Chain, SDValue Dst, SDValue Src, uint64_t Size, unsigned Align, bool isVol, bool AlwaysInline, MachinePointerInfo DstPtrInfo, MachinePointerInfo SrcPtrInfo)
SDValue getCommutedVectorShuffle(const ShuffleVectorSDNode &SV)
Returns an ISD::VECTOR_SHUFFLE node semantically equivalent to the shuffle node in input but with swa...
static GCRegistry::Add< OcamlGC > B("ocaml", "ocaml 3.10-compatible GC")
* if(!EatIfPresent(lltok::kw_thread_local)) return false
ParseOptionalThreadLocal := /*empty.
APInt urem(const APInt &RHS) const
Unsigned remainder operation.
bool SignBitIsZero(SDValue Op, unsigned Depth=0) const
Return true if the sign bit of Op is known to be zero.
MutableArrayRef - Represent a mutable reference to an array (0 or more elements consecutively in memo...
#define __asan_unpoison_memory_region(p, size)
unsigned countPopulation() const
Count the number of bits set.
SDValue FoldConstantArithmetic(unsigned Opcode, const SDLoc &DL, EVT VT, SDNode *N1, SDNode *N2)
use_iterator use_begin() const
Provide iteration support to walk over all uses of an SDNode.
SelectionDAG(const TargetMachine &TM, CodeGenOpt::Level)
bool isExpandingLoad() const
static void AddNodeIDNode(FoldingSetNodeID &ID, unsigned short OpC, SDVTList VTList, ArrayRef< SDValue > OpList)
TypeSize getPrimitiveSizeInBits() const LLVM_READONLY
Return the basic size of this type if it is a primitive type.
const TargetSubtargetInfo & getSubtarget() const
getSubtarget - Return the subtarget for which this machine code is being compiled.
The instances of the Type class are immutable: once they are created, they are never changed...
This is an important class for using LLVM in a threaded context.
Simple binary floating point operators.
KnownBits zext(unsigned BitWidth, bool ExtendedBitsAreKnownZero) const
Extends the underlying known Zero and One bits.
PowerPC Reduce CR logical Operation
SDValue getTargetIndex(int Index, EVT VT, int64_t Offset=0, unsigned TargetFlags=0)
bool hasAnyUseOfValue(unsigned Value) const
Return true if there are any use of the indicated value.
static bool doNotCSE(SDNode *N)
doNotCSE - Return true if CSE should not be performed for this node.
MachineFrameInfo & getFrameInfo()
getFrameInfo - Return the frame info object for the current function.
void DropOperands()
Release the operands and set this node to have zero operands.
unsigned getVectorNumElements() const
Given a vector type, return the number of elements it contains.
bool ult(const APInt &RHS) const
Unsigned less than comparison.
size_t size() const
size - Get the array size.
PointerUnion< const Value *, const PseudoSourceValue * > V
This is the IR pointer value for the access, or it is null if unknown.
static GCRegistry::Add< CoreCLRGC > E("coreclr", "CoreCLR-compatible GC")
This is an important base class in LLVM.
void resetAll()
Resets the known state of all bits.
virtual bool shouldConvertConstantLoadToIntImm(const APInt &Imm, Type *Ty) const
Return true if it is beneficial to convert a load of a constant to just the constant itself...
iterator_range< value_op_iterator > op_values() const
LLVM_NODISCARD bool empty() const
static SDValue getMemsetStringVal(EVT VT, const SDLoc &dl, SelectionDAG &DAG, const TargetLowering &TLI, const ConstantDataArraySlice &Slice)
getMemsetStringVal - Similar to getMemsetValue.
const SDValue & getOperand(unsigned Num) const
Libcall getMEMMOVE_ELEMENT_UNORDERED_ATOMIC(uint64_t ElementSize)
getMEMMOVE_ELEMENT_UNORDERED_ATOMIC - Return MEMMOVE_ELEMENT_UNORDERED_ATOMIC_* value for the given e...
SDValue getIndexedMaskedLoad(SDValue OrigLoad, const SDLoc &dl, SDValue Base, SDValue Offset, ISD::MemIndexedMode AM)
LoadExtType
LoadExtType enum - This enum defines the three variants of LOADEXT (load with extension).
This SDNode is used for LIFETIME_START/LIFETIME_END values, which indicate the offet and size that ar...
INSERT_VECTOR_ELT(VECTOR, VAL, IDX) - Returns VECTOR with the element at IDX replaced with VAL...
This file contains the declarations for the subclasses of Constant, which represent the different fla...
bool isFixedObjectIndex(int ObjectIdx) const
Returns true if the specified index corresponds to a fixed stack object.
bool isPointerTy() const
True if this is an instance of PointerType.
bool bitsLE(EVT VT) const
Return true if this has no more bits than VT.
Carry-using nodes for multiple precision addition and subtraction.
bool isKnownNeverSNaN(SDValue Op, unsigned Depth=0) const
ConstantFP - Floating Point Values [float, double].
std::pair< iterator, bool > insert(PtrType Ptr)
Inserts Ptr if and only if there is no element in the container equal to Ptr.
SDValue getAddrSpaceCast(const SDLoc &dl, EVT VT, SDValue Ptr, unsigned SrcAS, unsigned DestAS)
Return an AddrSpaceCastSDNode.
DAGUpdateListener(SelectionDAG &D)
virtual void computeKnownBitsForFrameIndex(const SDValue FIOp, KnownBits &Known, const APInt &DemandedElts, const SelectionDAG &DAG, unsigned Depth=0) const
Determine which of the bits of FrameIndex FIOp are known to be 0.
bool isOperandOf(const SDNode *N) const
Return true if this node is an operand of N.
const SDValue & getOffset() const
static APInt getOneBitSet(unsigned numBits, unsigned BitNo)
Return an APInt with exactly one bit set in the result.
SDValue getMaskedScatter(SDVTList VTs, EVT VT, const SDLoc &dl, ArrayRef< SDValue > Ops, MachineMemOperand *MMO, ISD::MemIndexType IndexType)
const SDValue & getOffset() const
unsigned getPrefTypeAlignment(Type *Ty) const
Returns the preferred stack/global alignment for the specified type.
void RemoveDeadNodes()
This method deletes all unreachable nodes in the SelectionDAG.
bool isExactlyValue(double V) const
We don't rely on operator== working on double values, as it returns true for things that are clearly ...
static void AddNodeIDOperands(FoldingSetNodeID &ID, ArrayRef< SDValue > Ops)
AddNodeIDOperands - Various routines for adding operands to the NodeID data.
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.
bool isExactlyValue(double V) const
We don't rely on operator== working on double values, as it returns true for things that are clearly ...
BumpPtrAllocator & getAlloc()
bool any_of(R &&range, UnaryPredicate P)
Provide wrappers to std::any_of which take ranges instead of having to pass begin/end explicitly...
bool isBaseWithConstantOffset(SDValue Op) const
Return true if the specified operand is an ISD::ADD with a ConstantSDNode on the right-hand side...
static ManagedStatic< std::set< EVT, EVT::compareRawBits > > EVTs
unsigned getAddressSpace() const
virtual SDValue EmitTargetCodeForMemcpy(SelectionDAG &DAG, const SDLoc &dl, SDValue Chain, SDValue Op1, SDValue Op2, SDValue Op3, unsigned Align, bool isVolatile, bool AlwaysInline, MachinePointerInfo DstPtrInfo, MachinePointerInfo SrcPtrInfo) const
Emit target-specific code that performs a memcpy.
void ReplaceAllUsesWith(SDValue From, SDValue To)
Modify anything using 'From' to use 'To' instead.
opStatus multiply(const APFloat &RHS, roundingMode RM)
TypeSize getStoreSize() const
Return the number of bytes overwritten by a store of the specified value type.
const APInt & getAPIntValue() const
TargetIndex - Like a constant pool entry, but with completely target-dependent semantics.
static cl::opt< bool > EnableMemCpyDAGOpt("enable-memcpy-dag-opt", cl::Hidden, cl::init(true), cl::desc("Gang up loads and stores generated by inlining of memcpy"))
const Triple & getTargetTriple() const
AssertSext, AssertZext - These nodes record if a register contains a value that has already been zero...
Base class for variables.
void RemoveDeadNode(SDNode *N)
Remove the specified node from the system.
void reserve(size_type NumEntries)
Grow the densemap so that it can contain at least NumEntries items before resizing again...
size_type count(ConstPtrType Ptr) const
count - Return 1 if the specified pointer is in the set, 0 otherwise.
unsigned getUnorderedFlavor(CondCode Cond)
This function returns 0 if the condition is always false if an operand is a NaN, 1 if the condition i...
self_iterator getIterator()
bool hasNUsesOfValue(unsigned NUses, unsigned Value) const
Return true if there are exactly NUSES uses of the indicated value.
CondCode getSetCCSwappedOperands(CondCode Operation)
Return the operation corresponding to (Y op X) when given the operation for (X op Y)...
VAARG - VAARG has four operands: an input chain, a pointer, a SRCVALUE, and the alignment.
Represents offset+length into a ConstantDataArray.
SDValue getSplatVector(EVT VT, const SDLoc &DL, SDValue Op)
unsigned getTargetFlags() const
void clearSignBit()
Set the sign bit to 0.
SDValue getAtomicCmpSwap(unsigned Opcode, const SDLoc &dl, EVT MemVT, SDVTList VTs, SDValue Chain, SDValue Ptr, SDValue Cmp, SDValue Swp, MachineMemOperand *MMO)
Gets a node for an atomic cmpxchg op.
static bool isValueValidForType(EVT VT, const APFloat &Val)
Bit counting operators with an undefined result for zero inputs.
ConstantSDNode * getConstantSplatNode(const APInt &DemandedElts, BitVector *UndefElements=nullptr) const
Returns the demanded splatted constant or null if this is not a constant splat.
Val, OUTCHAIN = ATOMIC_CMP_SWAP(INCHAIN, ptr, cmp, swap) For double-word atomic operations: ValLo...
LLVMContext & getContext() const
getContext - Return a reference to the LLVMContext associated with this function. ...
X = FP_EXTEND(Y) - Extend a smaller FP type into a larger FP type.
virtual bool hasVectorBlend() const
Return true if the target has a vector blend instruction.
static ManagedStatic< sys::SmartMutex< true > > VTMutex
virtual MVT getPointerTy(const DataLayout &DL, uint32_t AS=0) const
Return the pointer type for the given address space, defaults to the pointer type from the data layou...
std::vector< ArgListEntry > ArgListTy
unsigned getAlignment() const
uint64_t NextPowerOf2(uint64_t A)
Returns the next power of two (in 64-bits) that is strictly greater than A.
iterator erase(const_iterator CI)
bool haveNoCommonBitsSet(SDValue A, SDValue B) const
Return true if A and B have no common bits set.
TargetRegisterInfo base class - We assume that the target defines a static array of TargetRegisterDes...
TypeSize getSizeInBits() const
Return the size of the specified value type in bits.
Libcall getMEMCPY_ELEMENT_UNORDERED_ATOMIC(uint64_t ElementSize)
getMEMCPY_ELEMENT_UNORDERED_ATOMIC - Return MEMCPY_ELEMENT_UNORDERED_ATOMIC_* value for the given ele...
Abstract base class for all machine specific constantpool value subclasses.
This structure contains all information that is necessary for lowering calls.
SDValue getAllOnesConstant(const SDLoc &DL, EVT VT, bool IsTarget=false, bool IsOpaque=false)
APInt uadd_ov(const APInt &RHS, bool &Overflow) const
static PointerType * getInt8PtrTy(LLVMContext &C, unsigned AS=0)
This class contains a discriminated union of information about pointers in memory operands...
bool isMachineOpcode() const
Test if this node has a post-isel opcode, directly corresponding to a MachineInstr opcode...
APInt ssub_sat(const APInt &RHS) const
unsigned getNumOperands() const
Return the number of values used by this operation.
#define llvm_unreachable(msg)
Marks that the current location is not supposed to be reachable.
HANDLENODE node - Used as a handle for various purposes.
void copySign(const APFloat &RHS)
This struct is a compact representation of a valid (non-zero power of two) alignment.
SDValue getZeroExtendInReg(SDValue Op, const SDLoc &DL, EVT VT)
Return the expression required to zero extend the Op value assuming it was the smaller SrcTy value...
APInt lshr(unsigned shiftAmt) const
Logical right-shift function.
SDValue getBoolConstant(bool V, const SDLoc &DL, EVT VT, EVT OpVT)
Create a true or false constant of type VT using the target's BooleanContent for type OpVT...
MachineBasicBlock * MBB
MBB - The current block.
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...
SDValue CreateStackTemporary(EVT VT, unsigned minAlign=1)
Create a stack temporary, suitable for holding the specified value type.
unsigned getMaxStoresPerMemcpy(bool OptSize) const
Get maximum # of store operations permitted for llvm.memcpy.
EH_LABEL - Represents a label in mid basic block used to track locations needed for debug and excepti...
SDValue getSplatValue(const APInt &DemandedElts, BitVector *UndefElements=nullptr) const
Returns the demanded splatted value or a null value if this is not a splat.
ConstantFPSDNode * isConstOrConstSplatFP(SDValue N, bool AllowUndefs=false)
Returns the SDNode if it is a constant splat BuildVector or constant float.
MachineMemOperand * MMO
Memory reference information.
void sort(IteratorTy Start, IteratorTy End)
static const char *const Magic
unsigned getAddressSpace() const
The memory access writes data.
SDDbgValue * getDbgValue(DIVariable *Var, DIExpression *Expr, SDNode *N, unsigned R, bool IsIndirect, const DebugLoc &DL, unsigned O)
Creates a SDDbgValue node.
const APInt & getConstantOperandAPInt(unsigned i) const
SDValue getBitcast(EVT VT, SDValue V)
Return a bitcast using the SDLoc of the value operand, and casting to the provided type...
bool use_empty() const
Return true if there are no uses of this node.
SDNode * getNode() const
Convenience function for get().getNode().
static APInt getSignMask(unsigned BitWidth)
Get the SignMask for a specific bit width.
APInt ashr(unsigned ShiftAmt) const
Arithmetic right-shift function.
RESULT = [US]ADDSAT(LHS, RHS) - Perform saturation addition on 2 integers with the same bit width (W)...
TokenFactor - This node takes multiple tokens as input and produces a single token result...
bool areNonVolatileConsecutiveLoads(LoadSDNode *LD, LoadSDNode *Base, unsigned Bytes, int Dist) const
Return true if loads are next to each other and can be merged.
SDValue expandVACopy(SDNode *Node)
Expand the specified ISD::VACOPY node as the Legalize pass would.
bool isBuildVectorAllOnes(const SDNode *N)
Return true if the specified node is a BUILD_VECTOR where all of the elements are ~0 or undef...
void dump() const
Dump this node, for debugging.
static const fltSemantics & IEEEsingle() LLVM_READNONE
const TargetLowering & getTargetLoweringInfo() const
Iterator for intrusive lists based on ilist_node.
unsigned countMaxLeadingZeros() const
Returns the maximum number of leading zero bits possible.
SmallPtrSet - This class implements a set which is optimized for holding SmallSize or less elements...
SDValue getMemBasePlusOffset(SDValue Base, int64_t Offset, const SDLoc &DL, const SDNodeFlags Flags=SDNodeFlags())
Returns sum of the base pointer and offset.
This is the shared class of boolean and integer constants.
BlockVerifier::State From
static const fltSemantics & IEEEhalf() LLVM_READNONE
Returns platform specific canonical encoding of a floating point number.
bool isNullOrNullSplat(SDValue V, bool AllowUndefs=false)
Return true if the value is a constant 0 integer or a splatted vector of a constant 0 integer (with n...
virtual void NodeDeleted(SDNode *N, SDNode *E)
The node N that was deleted and, if E is not null, an equivalent node E that replaced it...
Align max(MaybeAlign Lhs, Align Rhs)
bool erase(PtrType Ptr)
erase - If the set contains the specified pointer, remove it and return true, otherwise return false...
ilist< SDNode >::size_type allnodes_size() const
EXTRACT_VECTOR_ELT(VECTOR, IDX) - Returns a single element from VECTOR identified by the (potentially...
EVT getVectorElementType() const
Given a vector type, return the type of each element.
std::pair< SDValue, SDValue > SplitVector(const SDValue &N, const SDLoc &DL, const EVT &LoVT, const EVT &HiVT)
Split the vector with EXTRACT_SUBVECTOR using the provides VTs and return the low/high part...
SDNode * UpdateNodeOperands(SDNode *N, SDValue Op)
Mutate the specified node in-place to have the specified operands.
unsigned getScalarSizeInBits() const LLVM_READONLY
If this is a vector type, return the getPrimitiveSizeInBits value for the element type...
This struct is a compact representation of a valid (power of two) or undefined (0) alignment...
static MachinePointerInfo InferPointerInfo(const MachinePointerInfo &Info, SelectionDAG &DAG, SDValue Ptr, int64_t Offset=0)
InferPointerInfo - If the specified ptr/offset is a frame index, infer a MachinePointerInfo record fr...
This is used to represent a portion of an LLVM function in a low-level Data Dependence DAG representa...
SDDbgValue * getFrameIndexDbgValue(DIVariable *Var, DIExpression *Expr, unsigned FI, bool IsIndirect, const DebugLoc &DL, unsigned O)
Creates a FrameIndex SDDbgValue node.
const SDValue & getMask() const
SDValue getZExtOrTrunc(SDValue Op, const SDLoc &DL, EVT VT)
Convert Op, which must be of integer type, to the integer type VT, by either zero-extending or trunca...
ADDRSPACECAST - This operator converts between pointers of different address spaces.
This is a 'vector' (really, a variable-sized array), optimized for the case when the array is small...
uint64_t Length
Length of the slice.
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.
static APInt getSplat(unsigned NewLen, const APInt &V)
Return a value containing V broadcasted over NewLen bits.
const DebugLoc & getDebugLoc() const
SDValue getMemcpy(SDValue Chain, const SDLoc &dl, SDValue Dst, SDValue Src, SDValue Size, unsigned Align, bool isVol, bool AlwaysInline, bool isTailCall, MachinePointerInfo DstPtrInfo, MachinePointerInfo SrcPtrInfo)
bool allOperandsUndef(const SDNode *N)
Return true if the node has at least one operand and all operands of the specified node are ISD::UNDE...
unsigned getABITypeAlignment(Type *Ty) const
Returns the minimum ABI-required alignment for the specified type.
FMINNUM_IEEE/FMAXNUM_IEEE - Perform floating-point minimum or maximum on two values, following the IEEE-754 2008 definition.
An SDNode that represents everything that will be needed to construct a MachineInstr.
const SDValue & getPassThru() const
A collection of metadata nodes that might be associated with a memory access used by the alias-analys...
Byte Swap and Counting operators.
APInt rotl(unsigned rotateAmt) const
Rotate left by rotateAmt.
FP16_TO_FP, FP_TO_FP16 - These operators are used to perform promotions and truncation for half-preci...
LLVM_NODISCARD T pop_back_val()
This is an abstract virtual class for memory operations.
const Constant * getConstVal() const
SDValue getMemmove(SDValue Chain, const SDLoc &dl, SDValue Dst, SDValue Src, SDValue Size, unsigned Align, bool isVol, bool isTailCall, MachinePointerInfo DstPtrInfo, MachinePointerInfo SrcPtrInfo)
Wrapper class for IR location info (IR ordering and DebugLoc) to be passed into SDNode creation funct...
void ExtractVectorElements(SDValue Op, SmallVectorImpl< SDValue > &Args, unsigned Start=0, unsigned Count=0)
Append the extracted elements from Start to Count out of the vector Op in Args.
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.
static const int FIRST_TARGET_MEMORY_OPCODE
FIRST_TARGET_MEMORY_OPCODE - Target-specific pre-isel operations which do not reference a specific me...
unsigned getTargetFlags() const
Represents one node in the SelectionDAG.
void computeKnownBitsFromRangeMetadata(const MDNode &Ranges, KnownBits &Known)
Compute known bits from the range metadata.
virtual void computeKnownBitsForTargetNode(const SDValue Op, KnownBits &Known, const APInt &DemandedElts, const SelectionDAG &DAG, unsigned Depth=0) const
Determine which of the bits specified in Mask are known to be either zero or one and return them in t...
static Constant * get(Type *Ty, double V)
This returns a ConstantFP, or a vector containing a splat of a ConstantFP, for the specified value in...
bool uge(const APInt &RHS) const
Unsigned greater or equal comparison.
allnodes_const_iterator allnodes_begin() const
SDValue getNOT(const SDLoc &DL, SDValue Val, EVT VT)
Create a bitwise NOT operation as (XOR Val, -1).
bool isBitwiseNot(SDValue V, bool AllowUndefs=false)
Returns true if V is a bitwise not operation.
unsigned getEVTAlignment(EVT MemoryVT) const
Compute the default alignment value for the given type.
KnownBits sext(unsigned BitWidth) const
Sign extends the underlying known Zero and One bits.
const Function & getFunction() const
Return the LLVM function that this machine code represents.
KnownBits trunc(unsigned BitWidth) const
Truncate the underlying known Zero and One bits.
raw_ostream & dbgs()
dbgs() - This returns a reference to a raw_ostream for debugging messages.
MachinePointerInfo getWithOffset(int64_t O) const
unsigned Log2_32(uint32_t Value)
Return the floor log base 2 of the specified value, -1 if the value is zero.
Function * getFunction(StringRef Name) const
Look up the specified function in the module symbol table.
void swap(llvm::BitVector &LHS, llvm::BitVector &RHS)
Implement std::swap in terms of BitVector swap.
TypeSize getValueSizeInBits(unsigned ResNo) const
Returns MVT::getSizeInBits(getValueType(ResNo)).
SDValue getPtrExtOrTrunc(SDValue Op, const SDLoc &DL, EVT VT)
Convert Op, which must be of integer type, to the integer type VT, by either truncating it or perform...
static const APInt * getValidShiftAmountConstant(SDValue V, const APInt &DemandedElts)
If a SHL/SRA/SRL node has a constant or splat constant shift amount that is less than the element bit...
unsigned countTrailingOnes() const
Count the number of trailing one bits.
SDValue simplifyFPBinop(unsigned Opcode, SDValue X, SDValue Y)
Try to simplify a floating-point binary operation into 1 of its operands or a constant.
SDNode * isConstantIntBuildVectorOrConstantInt(SDValue N)
Test whether the given value is a constant int or similar node.
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...
EVT getMemoryVT() const
Return the type of the in-memory value.
Class for arbitrary precision integers.
bool isBuildVectorOfConstantFPSDNodes(const SDNode *N)
Return true if the specified node is a BUILD_VECTOR node of all ConstantFPSDNode or undef...
LLVM_ATTRIBUTE_RETURNS_NONNULL LLVM_ATTRIBUTE_RETURNS_NOALIAS void * Allocate(size_t Size, Align Alignment)
Allocate space at the specified alignment.
SDValue getConstantFP(double Val, const SDLoc &DL, EVT VT, bool isTarget=false)
Create a ConstantFPSDNode wrapping a constant value.
bool ule(const APInt &RHS) const
Unsigned less or equal comparison.
iterator_range< use_iterator > uses()
static unsigned getReg(const void *D, unsigned RC, unsigned RegNo)
static SDValue foldCONCAT_VECTORS(const SDLoc &DL, EVT VT, ArrayRef< SDValue > Ops, SelectionDAG &DAG)
Try to simplify vector concatenation to an input value, undef, or build vector.
CondCode getSetCCOrOperation(CondCode Op1, CondCode Op2, EVT Type)
Return the result of a logical OR between different comparisons of identical values: ((X op1 Y) | (X ...
A "pseudo-class" with methods for operating on BUILD_VECTORs.
Select(COND, TRUEVAL, FALSEVAL).
SDValue peekThroughOneUseBitcasts(SDValue V)
Return the non-bitcasted and one-use source operand of V if it exists.
bool bitsLT(EVT VT) const
Return true if this has less bits than VT.
bool isPowerOf2() const
Check if this APInt's value is a power of two greater than zero.
bool sge(const APInt &RHS) const
Signed greater or equal comparison.
static use_iterator use_end()
bool shouldOptimizeForSize(const MachineFunction *MF, ProfileSummaryInfo *PSI, const MachineBlockFrequencyInfo *BFI, PGSOQueryType QueryType=PGSOQueryType::Other)
Returns true if machine function MF is suggested to be size-optimized based on the profile...
bool isNullFPConstant(SDValue V)
Returns true if V is an FP constant with a value of positive zero.
ZERO_EXTEND - Used for integer types, zeroing the new bits.
void AddDbgLabel(SDDbgLabel *DB)
Add a dbg_label SDNode.
std::lock_guard< SmartMutex< mt_only > > SmartScopedLock
ANY_EXTEND - Used for integer types. The high bits are undefined.
SDValue getGlobalAddress(const GlobalValue *GV, const SDLoc &DL, EVT VT, int64_t offset=0, bool isTargetGA=false, unsigned TargetFlags=0)
opStatus mod(const APFloat &RHS)
iterator insert(iterator I, T &&Elt)
FCOPYSIGN(X, Y) - Return the value of X with the sign of Y.
unsigned countMinLeadingOnes() const
Returns the minimum number of leading one bits.
int getMaskElt(unsigned Idx) const
void append(in_iter in_start, in_iter in_end)
Add the specified range to the end of the SmallVector.
SDValue getShiftAmountOperand(EVT LHSTy, SDValue Op)
Return the specified value casted to the target's desired shift amount type.
SDValue FoldConstantVectorArithmetic(unsigned Opcode, const SDLoc &DL, EVT VT, ArrayRef< SDValue > Ops, const SDNodeFlags Flags=SDNodeFlags())
static ISD::CondCode getSetCCInverseImpl(ISD::CondCode Op, bool isIntegerLike)
static APInt getBitsSet(unsigned numBits, unsigned loBit, unsigned hiBit)
Get a value with a block of bits set.
Flags
Flags values. These may be or'd together.
bool isUnknown() const
Returns true if we don't know any bits.
The memory access reads data.
bool none() const
none - Returns true if none of the bits are set.
int getNodeId() const
Return the unique node id.
SDDbgLabel * getDbgLabel(DILabel *Label, const DebugLoc &DL, unsigned O)
Creates a SDDbgLabel node.
bool isConstantValueOfAnyType(SDValue N)
std::pair< SDValue, SDValue > LowerCallTo(CallLoweringInfo &CLI) const
This function lowers an abstract call to a function into an actual call.
static MachinePointerInfo getFixedStack(MachineFunction &MF, int FI, int64_t Offset=0)
Return a MachinePointerInfo record that refers to the specified FrameIndex.
CallLoweringInfo & setTailCall(bool Value=true)
bool matchBinaryPredicate(SDValue LHS, SDValue RHS, std::function< bool(ConstantSDNode *, ConstantSDNode *)> Match, bool AllowUndefs=false, bool AllowTypeMismatch=false)
Attempt to match a binary predicate against a pair of scalar/splat constants or every element of a pa...
opStatus add(const APFloat &RHS, roundingMode RM)
bool ugt(const APInt &RHS) const
Unsigned greater than comparison.
SDValue getStackArgumentTokenFactor(SDValue Chain)
Compute a TokenFactor to force all the incoming stack arguments to be loaded from the stack...
opStatus
IEEE-754R 7: Default exception handling.
These are IR-level optimization flags that may be propagated to SDNodes.
allnodes_const_iterator allnodes_end() const
Represents a use of a SDNode.
const MachinePointerInfo & getPointerInfo() const
bool isVector() const
Return true if this is a vector value type.
static void checkForCyclesHelper(const SDNode *N, SmallPtrSetImpl< const SDNode *> &Visited, SmallPtrSetImpl< const SDNode *> &Checked, const llvm::SelectionDAG *DAG)
const SDValue & getValue() const
bool intersects(const APInt &RHS) const
This operation tests if there are any pairs of corresponding bits between this APInt and RHS that are...
Bitwise operators - logical and, logical or, logical xor.
Value is the result of an expression.
Holds the information from a dbg_label node through SDISel.
bool isOnlyUserOf(const SDNode *N) const
Return true if this node is the only use of N.
int32_t getConstantFPSplatPow2ToLog2Int(BitVector *UndefElements, uint32_t BitWidth) const
If this is a constant FP splat and the splatted constant FP is an exact power or 2, return the log base 2 integer value.
virtual bool isSDNodeSourceOfDivergence(const SDNode *N, FunctionLoweringInfo *FLI, LegacyDivergenceAnalysis *DA) const
LLVM_NODISCARD bool empty() const
bool isKnownToBeAPowerOfTwo(SDValue Val) const
Test if the given value is known to have exactly one bit set.
SIGN_EXTEND_INREG - This operator atomically performs a SHL/SRA pair to sign extend a small value in ...
This file provides utility analysis objects describing memory locations.
uint64_t getKnownMinSize() const
virtual bool isKnownNeverNaNForTargetNode(SDValue Op, const SelectionDAG &DAG, bool SNaN=false, unsigned Depth=0) const
If SNaN is false,.
static bool isMemSrcFromConstant(SDValue Src, ConstantDataArraySlice &Slice)
Returns true if memcpy source is constant data.
LOAD and STORE have token chains as their first operand, then the same operands as an LLVM load/store...
APInt srem(const APInt &RHS) const
Function for signed remainder operation.
LegalizeTypeAction getTypeAction(LLVMContext &Context, EVT VT) const
Return how we should legalize values of this type, either it is already legal (return 'Legal') or we ...
int64_t getOffset() const
static bool shouldLowerMemFuncForSize(const MachineFunction &MF, SelectionDAG &DAG)
const ConstantInt * getConstantIntValue() const
const TargetSubtargetInfo & getSubtarget() const
Flags getFlags() const
Return the raw flags of the source value,.
bool hasMinSize() const
Optimize this function for minimum size (-Oz).
The memory access always returns the same value (or traps).
bool isDereferenceable() const
unsigned InferPtrAlignment(SDValue Ptr) const
Infer alignment of a load / store address.
const BasicBlock * getBasicBlock() const
Return the LLVM basic block that this instance corresponded to originally.
SDValue getShiftAmountConstant(uint64_t Val, EVT VT, const SDLoc &DL, bool LegalTypes=true)
static void NewSDValueDbgMsg(SDValue V, StringRef Msg, SelectionDAG *G)
LLVM_NODISCARD std::enable_if<!is_simple_type< Y >::value, typename cast_retty< X, const Y >::ret_type >::type dyn_cast(const Y &Val)
RESULT = [US]SUBSAT(LHS, RHS) - Perform saturation subtraction on 2 integers with the same bit width ...
X = STRICT_FP_ROUND(Y, TRUNC) - Rounding 'Y' from a larger floating point type down to the precision ...
MemSDNode(unsigned Opc, unsigned Order, const DebugLoc &dl, SDVTList VTs, EVT memvt, MachineMemOperand *MMO)
void Profile(FoldingSetNodeID &ID) const
Gather unique data for the node.
static constexpr unsigned MaxRecursionDepth
bool isNON_EXTLoad(const SDNode *N)
Returns true if the specified node is a non-extending load.
SDValue peekThroughExtractSubvectors(SDValue V)
Return the non-extracted vector source operand of V if it exists.
unsigned getOpcode() const
SDValue getValue(unsigned R) const
static int isSignedOp(ISD::CondCode Opcode)
For an integer comparison, return 1 if the comparison is a signed operation and 2 if the result is an...
Type * getType() const
getType - get type of this MachineConstantPoolValue.
const LLVMTargetMachine & getTarget() const
getTarget - Return the target machine this machine code is compiled with
This class is used to represent an MSCATTER node.
bool reachesChainWithoutSideEffects(SDValue Dest, unsigned Depth=2) const
Return true if this operand (which must be a chain) reaches the specified operand without crossing an...
constexpr int64_t SignExtend64(uint64_t x)
Sign-extend the number in the bottom B bits of X to a 64-bit integer.
static BaseIndexOffset match(const SDNode *N, const SelectionDAG &DAG)
Parses tree in N for base, index, offset addresses.
SDValue foldConstantFPMath(unsigned Opcode, const SDLoc &DL, EVT VT, SDValue N1, SDValue N2)
Fold floating-point operations with 2 operands when both operands are constants and/or undefined...
SDValue getAtomicMemmove(SDValue Chain, const SDLoc &dl, SDValue Dst, unsigned DstAlign, SDValue Src, unsigned SrcAlign, SDValue Size, Type *SizeTy, unsigned ElemSz, bool isTailCall, MachinePointerInfo DstPtrInfo, MachinePointerInfo SrcPtrInfo)
const SDValue & getRoot() const
Return the root tag of the SelectionDAG.
SDValue getConstant(uint64_t Val, const SDLoc &DL, EVT VT, bool isTarget=false, bool isOpaque=false)
Create a ConstantSDNode wrapping a constant value.
SDValue getCondCode(ISD::CondCode Cond)
SDValue getVAArg(EVT VT, const SDLoc &dl, SDValue Chain, SDValue Ptr, SDValue SV, unsigned Align)
VAArg produces a result and token chain, and takes a pointer and a source value as input...
unsigned getMaxStoresPerMemmove(bool OptSize) const
Get maximum # of store operations permitted for llvm.memmove.
const MachinePointerInfo & getPointerInfo() const
SDValue getMemIntrinsicNode(unsigned Opcode, const SDLoc &dl, SDVTList VTList, ArrayRef< SDValue > Ops, EVT MemVT, MachinePointerInfo PtrInfo, unsigned Align=0, MachineMemOperand::Flags Flags=MachineMemOperand::MOLoad|MachineMemOperand::MOStore, uint64_t Size=0, const AAMDNodes &AAInfo=AAMDNodes())
Creates a MemIntrinsicNode that may produce a result and takes a list of operands.
CONCAT_VECTORS(VECTOR0, VECTOR1, ...) - Given a number of values of vector type with the same length ...
bool MaskedValueIsZero(SDValue Op, const APInt &Mask, unsigned Depth=0) const
Return true if 'Op & Mask' is known to be zero.
MachineConstantPoolValue * getMachineCPVal() const
bool isSplatValue(SDValue V, const APInt &DemandedElts, APInt &UndefElts)
Test whether V has a splatted value for all the demanded elements.
This class is used to form a handle around another node that is persistent and is updated across invo...
assert(ImpDefSCC.getReg()==AMDGPU::SCC &&ImpDefSCC.isDef())
SDValue getTruncStore(SDValue Chain, const SDLoc &dl, SDValue Val, SDValue Ptr, MachinePointerInfo PtrInfo, EVT SVT, unsigned Alignment=0, MachineMemOperand::Flags MMOFlags=MachineMemOperand::MONone, const AAMDNodes &AAInfo=AAMDNodes())
opStatus fusedMultiplyAdd(const APFloat &Multiplicand, const APFloat &Addend, roundingMode RM)
SDValue simplifySelect(SDValue Cond, SDValue TVal, SDValue FVal)
Try to simplify a select/vselect into 1 of its operands or a constant.
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)
This class is used to represent an MLOAD node.
unsigned getRawSubclassData() const
Return the SubclassData value, without HasDebugValue.
bool operator<(int64_t V1, const APSInt &V2)
int CreateStackObject(uint64_t Size, Align Alignment, bool isSpillSlot, const AllocaInst *Alloca=nullptr, uint8_t ID=0)
Create a new statically sized stack object, returning a nonnegative identifier to represent it...
unsigned getNumSignBits() const
Computes the number of leading bits of this APInt that are equal to its sign bit. ...
A raw_ostream that writes to an std::string.
TypeSize getScalarSizeInBits() const
SDValue getSymbolFunctionGlobalAddress(SDValue Op, Function **TargetFunction=nullptr)
Returs an GlobalAddress of the function from the current module with name matching the given External...
ArrayRef< int > getMask() const
Module * getParent()
Get the module that this global value is contained inside of...
bool needsStackRealignment(const MachineFunction &MF) const
True if storage within the function requires the stack pointer to be aligned more than the normal cal...
LLVM Value Representation.
uint64_t getConstantOperandVal(unsigned Num) const
Helper method returns the integer value of a ConstantSDNode operand.
FMA - Perform a * b + c with no intermediate rounding step.
SDValue getLogicalNOT(const SDLoc &DL, SDValue Val, EVT VT)
Create a logical NOT operation as (XOR Val, BooleanOne).
SDValue getRegister(unsigned Reg, EVT VT)
unsigned getResNo() const
get the index which selects a specific result in the SDNode
SDValue getAnyExtOrTrunc(SDValue Op, const SDLoc &DL, EVT VT)
Convert Op, which must be of integer type, to the integer type VT, by either any-extending or truncat...
const MDNode * getRanges() const
Returns the Ranges that describes the dereference.
unsigned countTrailingOnes(T Value, ZeroBehavior ZB=ZB_Width)
Count the number of ones from the least significant bit to the first zero bit.
MemSDNodeBitfields MemSDNodeBits
bool isTruncatingStore() const
Return true if the op does a truncation before store.
bool isNullConstant(SDValue V)
Returns true if V is a constant integer zero.
SDValue getJumpTable(int JTI, EVT VT, bool isTarget=false, unsigned TargetFlags=0)
#define LLVM_FALLTHROUGH
LLVM_FALLTHROUGH - Mark fallthrough cases in switch statements.
void setDebugLoc(DebugLoc dl)
Set source location info.
This class is used to represent an MGATHER node.
intptr_t getRawBits() const
SDValue getValueType(EVT)
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.
SDValue getFPExtendOrRound(SDValue Op, const SDLoc &DL, EVT VT)
Convert Op, which must be of float type, to the float type VT, by either extending or rounding (by tr...
PREFETCH - This corresponds to a prefetch intrinsic.
bool isDereferenceable(unsigned Size, LLVMContext &C, const DataLayout &DL) const
Return true if memory region [V, V+Offset+Size) is known to be dereferenceable.
void setHasDebugValue(bool b)
SDValue getMaskedStore(SDValue Chain, const SDLoc &dl, SDValue Val, SDValue Base, SDValue Offset, SDValue Mask, EVT MemVT, MachineMemOperand *MMO, ISD::MemIndexedMode AM, bool IsTruncating=false, bool IsCompressing=false)
bool isUndef() const
Return true if the type of the node type undefined.
static llvm::Optional< APInt > FoldValue(unsigned Opcode, const APInt &C1, const APInt &C2)
const SDValue & getOffset() const
MVT getFrameIndexTy(const DataLayout &DL) const
Return the type for frame index, which is determined by the alloca address space specified through th...
void ReplaceAllUsesOfValueWith(SDValue From, SDValue To)
Replace any uses of From with To, leaving uses of other values produced by From.getNode() alone...
SDValue getEHLabel(const SDLoc &dl, SDValue Root, MCSymbol *Label)
Primary interface to the complete machine description for the target machine.
unsigned countMinLeadingZeros() const
Returns the minimum number of leading zero bits.
bool hasAllowReassociation() const
bool isThreadLocal() const
If the value is "Thread Local", its value isn't shared by the threads.
SDValue getSrcValue(const Value *v)
Construct a node to track a Value* through the backend.
print Print MemDeps of function
ArrayRef< SDDbgValue * > GetDbgValues(const SDNode *SD) const
Get the debug values which reference the given SDNode.
const APFloat & getValueAPF() const
APInt usub_sat(const APInt &RHS) const
virtual const SelectionDAGTargetInfo * getSelectionDAGInfo() const
ISD::LoadExtType getExtensionType() const
StringRef - Represent a constant reference to a string, i.e.
FMAD - Perform a * b + c, while getting the same result as the separately rounded operations...
bool isNonNegative() const
Returns true if this value is known to be non-negative.
SetCC operator - This evaluates to a true value iff the condition is true.
virtual bool isOffsetFoldingLegal(const GlobalAddressSDNode *GA) const
Return true if folding a constant offset with the given GlobalAddress is legal.
APInt bitcastToAPInt() const
APInt getMaxValue() const
Return the maximal value possible given these KnownBits.
ManagedStatic - This transparently changes the behavior of global statics to be lazily constructed on...
static constexpr size_t getMaxNumOperands()
Return the maximum number of operands that a SDNode can hold.
void salvageDebugInfo(SDNode &N)
To be invoked on an SDNode that is slated to be erased.
unsigned countLeadingZeros() const
The APInt version of the countLeadingZeros functions in MathExtras.h.
bool bitsEq(EVT VT) const
Return true if this has the same number of bits as VT.
void move(uint64_t Delta)
Moves the Offset and adjusts Length accordingly.
KnownBits computeKnownBits(SDValue Op, unsigned Depth=0) const
Determine which bits of Op are known to be either zero or one and return them in Known.
MERGE_VALUES - This node takes multiple discrete operands and returns them all as its individual resu...
unsigned getNumOperands() const
bool isStrictFPOpcode()
Test if this node is a strict floating point pseudo-op.
BooleanContent
Enum that describes how the target represents true/false values.
static void AddNodeIDOpcode(FoldingSetNodeID &ID, unsigned OpC)
AddNodeIDOpcode - Add the node opcode to the NodeID data.
static APInt getNullValue(unsigned numBits)
Get the '0' value.
const SDValue & getOperand(unsigned i) const
static ManagedStatic< EVTArray > SimpleVTArray
OUTCHAIN = ATOMIC_STORE(INCHAIN, ptr, val) This corresponds to "store atomic" instruction.
SDValue getMaskedGather(SDVTList VTs, EVT VT, const SDLoc &dl, ArrayRef< SDValue > Ops, MachineMemOperand *MMO, ISD::MemIndexType IndexType)
uint64_t getZExtValue() const
SDValue getTargetInsertSubreg(int SRIdx, const SDLoc &DL, EVT VT, SDValue Operand, SDValue Subreg)
A convenience function for creating TargetInstrInfo::INSERT_SUBREG nodes.
SDNode * getNodeIfExists(unsigned Opcode, SDVTList VTList, ArrayRef< SDValue > Ops, const SDNodeFlags Flags=SDNodeFlags())
Get the specified node if it's already available, or else return NULL.
TRUNCATE - Completely drop the high bits.
bool isSimple() const
Test if the given EVT is simple (as opposed to being extended).
bool hasPredecessor(const SDNode *N) const
Return true if N is a predecessor of this node.
APInt sadd_sat(const APInt &RHS) const
Libcall getMEMSET_ELEMENT_UNORDERED_ATOMIC(uint64_t ElementSize)
getMEMSET_ELEMENT_UNORDERED_ATOMIC - Return MEMSET_ELEMENT_UNORDERED_ATOMIC_* value for the given ele...
void setNodeMemRefs(MachineSDNode *N, ArrayRef< MachineMemOperand *> NewMemRefs)
Mutate the specified machine node's memory references to the provided list.
void erase(const SDNode *Node)
Invalidate all DbgValues attached to the node and remove it from the Node-to-DbgValues map...
OutputIt copy(R &&Range, OutputIt Out)
Unlike LLVM values, Selection DAG nodes may return multiple values as the result of a computation...
Holds the information from a dbg_value node through SDISel.
virtual unsigned getMaxGluedStoresPerMemcpy() const
Get maximum # of store operations to be glued together.
Perform various unary floating-point operations inspired by libm.
static SDValue getMemcpyLoadsAndStores(SelectionDAG &DAG, const SDLoc &dl, SDValue Chain, SDValue Dst, SDValue Src, uint64_t Size, unsigned Alignment, bool isVol, bool AlwaysInline, MachinePointerInfo DstPtrInfo, MachinePointerInfo SrcPtrInfo)
void setObjectAlignment(int ObjectIdx, unsigned Align)
setObjectAlignment - Change the alignment of the specified stack object.
std::pair< SDValue, SDValue > UnrollVectorOverflowOp(SDNode *N, unsigned ResNE=0)
Like UnrollVectorOp(), but for the [US](ADD|SUB|MUL)O family of opcodes.
static EVT getIntegerVT(LLVMContext &Context, unsigned BitWidth)
Returns the EVT that represents an integer with the given number of bits.
EVT getTypeToTransformTo(LLVMContext &Context, EVT VT) const
For types supported by the target, this is an identity function.
static void AddNodeIDCustom(FoldingSetNodeID &ID, const SDNode *N)
If this is an SDNode with special info, add this info to the NodeID data.
virtual bool isNoopAddrSpaceCast(unsigned SrcAS, unsigned DestAS) const
Returns true if a cast between SrcAS and DestAS is a noop.
static IntegerType * getInt8Ty(LLVMContext &C)
SDValue getMemset(SDValue Chain, const SDLoc &dl, SDValue Dst, SDValue Src, SDValue Size, unsigned Align, bool isVol, bool isTailCall, MachinePointerInfo DstPtrInfo)
bool shouldOptForSize() const
Val, OUTCHAIN = ATOMIC_LOAD(INCHAIN, ptr) This corresponds to "load atomic" instruction.
static const APInt * getValidMaximumShiftAmountConstant(SDValue V, const APInt &DemandedElts)
If a SHL/SRA/SRL node has constant vector shift amounts that are all less than the element bit-width ...
bool isExtended() const
Test if the given EVT is extended (as opposed to being simple).
LLVMContext * getContext() const
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)
virtual bool isSDNodeAlwaysUniform(const SDNode *N) const
constexpr char Args[]
Key for Kernel::Metadata::mArgs.
void setLowBits(unsigned loBits)
Set the bottom loBits bits.
CallLoweringInfo & setLibCallee(CallingConv::ID CC, Type *ResultType, SDValue Target, ArgListTy &&ArgsList)
EVT getShiftAmountTy(EVT LHSTy, const DataLayout &DL, bool LegalTypes=true) const
PointerType * getType() const
Global values are always pointers.
Carry-using nodes for multiple precision addition and subtraction.
bool empty() const
empty - Check if the array is empty.
unsigned getIROrder() const
static Optional< DIExpression * > createFragmentExpression(const DIExpression *Expr, unsigned OffsetInBits, unsigned SizeInBits)
Create a DIExpression to describe one part of an aggregate variable that is fragmented across multipl...
SDValue expandVAArg(SDNode *Node)
Expand the specified ISD::VAARG node as the Legalize pass would.
SDValue GetDemandedBits(SDValue V, const APInt &DemandedBits)
See if the specified operand can be simplified with the knowledge that only the bits specified by Dem...
This file describes how to lower LLVM code to machine code.
virtual bool isLegalStoreImmediate(int64_t Value) const
Return true if the specified immediate is legal for the value input of a store instruction.
const char * getLibcallName(RTLIB::Libcall Call) const
Get the libcall routine name for the specified libcall.
MemIndexedMode
MemIndexedMode enum - This enum defines the load / store indexed addressing modes.
MULHU/MULHS - Multiply high - Multiply two integers of type iN, producing an unsigned/signed value of...
static SDVTList makeVTList(const EVT *VTs, unsigned NumVTs)
makeVTList - Return an instance of the SDVTList struct initialized with the specified members...
SRCVALUE - This is a node type that holds a Value* that is used to make reference to a value in the L...
This class is used to represent ISD::LOAD nodes.
bool is_contained(R &&Range, const E &Element)
Wrapper function around std::find to detect if an element exists in a container.