90 #define DEBUG_TYPE "selectiondag" 94 cl::desc(
"Gang up loads and stores generated by inlining of memcpy"));
97 cl::desc(
"Number limit for gluing ld/st of memcpy."),
113 return getValueAPF().bitwiseIsEqual(V);
139 unsigned SplatBitSize;
142 return BV->isConstantSplat(SplatVal, SplatUndef, SplatBitSize, HasUndefs,
144 EltSize == SplatBitSize;
164 if (i == e)
return false;
177 if (CN->getAPIntValue().countTrailingOnes() < EltSize)
180 if (CFPN->getValueAPF().bitcastToAPInt().countTrailingOnes() < EltSize)
188 for (++i; i != e; ++i)
201 bool IsAllUndef =
true;
216 if (CN->getAPIntValue().countTrailingZeros() < EltSize)
219 if (CFPN->getValueAPF().bitcastToAPInt().countTrailingZeros() < EltSize)
238 if (!isa<ConstantSDNode>(
Op))
251 if (!isa<ConstantFPSDNode>(
Op))
273 if (
auto *Cst = dyn_cast<ConstantSDNode>(Op))
282 if (!Cst || Cst->getValueType(0) != SVT || !
Match(Cst))
294 if (
auto *LHSCst = dyn_cast<ConstantSDNode>(LHS))
295 if (
auto *RHSCst = dyn_cast<ConstantSDNode>(RHS))
296 return Match(LHSCst, RHSCst);
306 if (!LHSCst || !RHSCst)
308 if (LHSCst->getValueType(0) != SVT ||
309 LHSCst->getValueType(0) != RHSCst->getValueType(0))
311 if (!
Match(LHSCst, RHSCst))
335 unsigned OldL = (Operation >> 2) & 1;
336 unsigned OldG = (Operation >> 1) & 1;
380 unsigned Op = Op1 | Op2;
436 for (
auto& Op : Ops) {
445 for (
auto& Op : Ops) {
475 ID.
AddPointer(cast<ConstantFPSDNode>(N)->getConstantFPValue());
494 ID.
AddPointer(cast<RegisterMaskSDNode>(N)->getRegMask());
497 ID.
AddPointer(cast<SrcValueSDNode>(N)->getValue());
501 ID.
AddInteger(cast<FrameIndexSDNode>(N)->getIndex());
505 ID.
AddInteger(cast<JumpTableSDNode>(N)->getIndex());
506 ID.
AddInteger(cast<JumpTableSDNode>(N)->getTargetFlags());
615 ID.
AddInteger(cast<MemSDNode>(N)->getPointerInfo().getAddrSpace());
648 for (
unsigned i = 1, e = N->
getNumValues(); i != e; ++i)
666 if (Node.use_empty())
681 while (!DeadNodes.
empty()) {
690 DUL->NodeDeleted(N,
nullptr);
693 RemoveNodeFromCSEMaps(N);
724 RemoveNodeFromCSEMaps(N);
728 DeleteNodeNotInCSEMaps(N);
731 void SelectionDAG::DeleteNodeNotInCSEMaps(
SDNode *
N) {
733 "Cannot delete the entry node!");
744 if (I == DbgValMap.end())
746 for (
auto &Val: I->second)
747 Val->setIsInvalidated();
751 void SelectionDAG::DeallocateNode(
SDNode *N) {
755 NodeAllocator.Deallocate(AllNodes.remove(N));
779 "Wrong return type!");
782 "Mismatched operand types!");
784 "Wrong operand type!");
786 "Wrong return type size");
793 "Wrong number of operands!");
796 assert((
I->getValueType() == EltVT ||
797 (EltVT.isInteger() &&
I->getValueType().isInteger() &&
798 EltVT.bitsLE(
I->getValueType()))) &&
799 "Wrong operand type!");
801 "Operands must all have the same type");
813 void SelectionDAG::InsertNode(
SDNode *N) {
814 AllNodes.push_back(N);
825 bool SelectionDAG::RemoveNodeFromCSEMaps(
SDNode *N) {
830 assert(CondCodeNodes[cast<CondCodeSDNode>(N)->
get()] &&
831 "Cond code doesn't exist!");
832 Erased = CondCodeNodes[cast<CondCodeSDNode>(
N)->
get()] !=
nullptr;
833 CondCodeNodes[cast<CondCodeSDNode>(
N)->
get()] =
nullptr;
836 Erased = ExternalSymbols.erase(cast<ExternalSymbolSDNode>(N)->
getSymbol());
840 Erased = TargetExternalSymbols.erase(
841 std::pair<std::string,unsigned char>(ESN->
getSymbol(),
846 auto *MCSN = cast<MCSymbolSDNode>(
N);
847 Erased = MCSymbols.erase(MCSN->getMCSymbol());
851 EVT VT = cast<VTSDNode>(
N)->getVT();
853 Erased = ExtendedValueTypeNodes.erase(VT);
864 Erased = CSEMap.RemoveNode(N);
886 SelectionDAG::AddModifiedNodeToCSEMaps(
SDNode *N) {
890 SDNode *Existing = CSEMap.GetOrInsertNode(N);
899 DUL->NodeDeleted(N, Existing);
900 DeleteNodeNotInCSEMaps(N);
923 SDNode *Node = FindNodeOrInsertPos(ID,
SDLoc(N), InsertPos);
943 SDNode *Node = FindNodeOrInsertPos(ID,
SDLoc(N), InsertPos);
961 SDNode *Node = FindNodeOrInsertPos(ID,
SDLoc(N), InsertPos);
977 : TM(tm), OptLevel(OL),
980 InsertNode(&EntryNode);
989 SDAGISelPass = PassPtr;
993 LibInfo = LibraryInfo;
999 assert(!UpdateListeners &&
"Dangling registered DAGUpdateListeners");
1001 OperandRecycler.clear(OperandAllocator);
1005 void SelectionDAG::allnodes_clear() {
1006 assert(&*AllNodes.begin() == &EntryNode);
1007 AllNodes.remove(AllNodes.begin());
1008 while (!AllNodes.empty())
1009 DeallocateNode(&AllNodes.front());
1011 NextPersistentId = 0;
1017 SDNode *N = CSEMap.FindNodeOrInsertPos(ID, InsertPos);
1024 "debug location. Use another overload.");
1031 const SDLoc &DL,
void *&InsertPos) {
1032 SDNode *N = CSEMap.FindNodeOrInsertPos(ID, InsertPos);
1057 OperandRecycler.clear(OperandAllocator);
1058 OperandAllocator.
Reset();
1061 ExtendedValueTypeNodes.clear();
1062 ExternalSymbols.clear();
1063 TargetExternalSymbols.clear();
1065 std::fill(CondCodeNodes.begin(), CondCodeNodes.end(),
1067 std::fill(ValueTypeNodes.begin(), ValueTypeNodes.end(),
1068 static_cast<SDNode*
>(
nullptr));
1070 EntryNode.UseList =
nullptr;
1071 InsertNode(&EntryNode);
1111 "getZeroExtendInReg should use the vector element type instead of " 1112 "the vector type!");
1123 assert(VT.
isVector() &&
"This DAG node is restricted to vector types.");
1125 "The sizes of the input and result must match in order to perform the " 1126 "extend in-register.");
1128 "The destination vector type must have fewer lanes than the input.");
1134 assert(VT.
isVector() &&
"This DAG node is restricted to vector types.");
1136 "The sizes of the input and result must match in order to perform the " 1137 "extend in-register.");
1139 "The destination vector type must have fewer lanes than the input.");
1145 assert(VT.
isVector() &&
"This DAG node is restricted to vector types.");
1147 "The sizes of the input and result must match in order to perform the " 1148 "extend in-register.");
1150 "The destination vector type must have fewer lanes than the input.");
1183 bool isT,
bool isO) {
1186 (uint64_t)((int64_t)Val >> EltVT.
getSizeInBits()) + 1 < 2) &&
1187 "getConstant with a uint64_t value that doesn't fit in the type!");
1192 bool isT,
bool isO) {
1197 EVT VT,
bool isT,
bool isO) {
1225 unsigned ViaVecNumElts = VT.
getSizeInBits() / ViaEltSizeInBits;
1237 ViaEltVT, isT, isO));
1254 Ops.
insert(Ops.
end(), EltParts.begin(), EltParts.end());
1261 "APInt size does not match type size!");
1269 if ((N = FindNodeOrInsertPos(ID, DL, IP)))
1274 N = newSDNode<ConstantSDNode>(isT, isO, Elt, EltVT);
1275 CSEMap.InsertNode(N, IP);
1298 EVT VT,
bool isTarget) {
1312 if ((N = FindNodeOrInsertPos(ID, DL, IP)))
1317 N = newSDNode<ConstantFPSDNode>(isTarget, &V, EltVT);
1318 CSEMap.InsertNode(N, IP);
1348 EVT VT, int64_t
Offset,
bool isTargetGA,
1350 assert((TargetFlags == 0 || isTargetGA) &&
1351 "Cannot set target flags on target-independent globals");
1370 if (
SDNode *
E = FindNodeOrInsertPos(ID, DL, IP))
1373 auto *N = newSDNode<GlobalAddressSDNode>(
1375 CSEMap.InsertNode(N, IP);
1386 if (
SDNode *
E = FindNodeOrInsertPos(ID, IP))
1389 auto *N = newSDNode<FrameIndexSDNode>(FI, VT, isTarget);
1390 CSEMap.InsertNode(N, IP);
1397 assert((TargetFlags == 0 || isTarget) &&
1398 "Cannot set target flags on target-independent jump tables");
1405 if (
SDNode *
E = FindNodeOrInsertPos(ID, IP))
1408 auto *N = newSDNode<JumpTableSDNode>(JTI, VT, isTarget,
TargetFlags);
1409 CSEMap.InsertNode(N, IP);
1415 unsigned Alignment,
int Offset,
1418 assert((TargetFlags == 0 || isTarget) &&
1419 "Cannot set target flags on target-independent globals");
1432 if (
SDNode *
E = FindNodeOrInsertPos(ID, IP))
1435 auto *N = newSDNode<ConstantPoolSDNode>(isTarget,
C, VT,
Offset, Alignment,
1437 CSEMap.InsertNode(N, IP);
1443 unsigned Alignment,
int Offset,
1446 assert((TargetFlags == 0 || isTarget) &&
1447 "Cannot set target flags on target-independent globals");
1458 if (
SDNode *
E = FindNodeOrInsertPos(ID, IP))
1461 auto *N = newSDNode<ConstantPoolSDNode>(isTarget,
C, VT,
Offset, Alignment,
1463 CSEMap.InsertNode(N, IP);
1476 if (
SDNode *
E = FindNodeOrInsertPos(ID, IP))
1480 CSEMap.InsertNode(N, IP);
1490 if (
SDNode *
E = FindNodeOrInsertPos(ID, IP))
1493 auto *N = newSDNode<BasicBlockSDNode>(MBB);
1494 CSEMap.InsertNode(N, IP);
1501 ValueTypeNodes.size())
1508 N = newSDNode<VTSDNode>(VT);
1514 SDNode *&N = ExternalSymbols[Sym];
1516 N = newSDNode<ExternalSymbolSDNode>(
false, Sym, 0, VT);
1522 SDNode *&N = MCSymbols[Sym];
1525 N = newSDNode<MCSymbolSDNode>(Sym, VT);
1533 TargetExternalSymbols[std::pair<std::string,unsigned char>(Sym,
1536 N = newSDNode<ExternalSymbolSDNode>(
true, Sym,
TargetFlags, VT);
1542 if ((
unsigned)Cond >= CondCodeNodes.size())
1543 CondCodeNodes.resize(Cond+1);
1545 if (!CondCodeNodes[Cond]) {
1546 auto *N = newSDNode<CondCodeSDNode>(Cond);
1547 CondCodeNodes[Cond] =
N;
1551 return SDValue(CondCodeNodes[Cond], 0);
1564 "Must have the same number of vector elements as mask elements!");
1566 "Invalid VECTOR_SHUFFLE");
1574 int NElts = Mask.
size();
1576 [&](
int M) {
return M < (NElts * 2) && M >= -1; }) &&
1577 "Index out of range");
1585 for (
int i = 0; i != NElts; ++i)
1586 if (MaskVec[i] >= NElts) MaskVec[i] -= NElts;
1602 for (
int i = 0; i < NElts; ++i) {
1603 if (MaskVec[i] <
Offset || MaskVec[i] >= (
Offset + NElts))
1607 if (UndefElements[MaskVec[i] -
Offset]) {
1613 if (!UndefElements[i])
1617 if (
auto *N1BV = dyn_cast<BuildVectorSDNode>(N1))
1618 BlendSplat(N1BV, 0);
1619 if (
auto *N2BV = dyn_cast<BuildVectorSDNode>(N2))
1620 BlendSplat(N2BV, NElts);
1625 bool AllLHS =
true, AllRHS =
true;
1627 for (
int i = 0; i != NElts; ++i) {
1628 if (MaskVec[i] >= NElts) {
1633 }
else if (MaskVec[i] >= 0) {
1637 if (AllLHS && AllRHS)
1639 if (AllLHS && !N2Undef)
1652 bool Identity =
true, AllSame =
true;
1653 for (
int i = 0; i != NElts; ++i) {
1654 if (MaskVec[i] >= 0 && MaskVec[i] != i) Identity =
false;
1655 if (MaskVec[i] != MaskVec[0]) AllSame =
false;
1657 if (Identity && NElts)
1670 if (
auto *BV = dyn_cast<BuildVectorSDNode>(V)) {
1672 SDValue Splat = BV->getSplatValue(&UndefElements);
1682 if (Splat && UndefElements.
none()) {
1687 if (
auto *
C = dyn_cast<ConstantSDNode>(Splat))
1688 if (
C->isNullValue())
1693 if (AllSame && SameNumElts) {
1694 EVT BuildVT = BV->getValueType(0);
1710 for (
int i = 0; i != NElts; ++i)
1714 if (
SDNode *
E = FindNodeOrInsertPos(ID, dl, IP))
1720 int *MaskAlloc = OperandAllocator.
Allocate<
int>(NElts);
1721 std::copy(MaskVec.begin(), MaskVec.end(), MaskAlloc);
1723 auto *N = newSDNode<ShuffleVectorSDNode>(VT, dl.
getIROrder(),
1725 createOperands(N, Ops);
1727 CSEMap.InsertNode(N, IP);
1749 if (
SDNode *
E = FindNodeOrInsertPos(ID, IP))
1752 auto *N = newSDNode<RegisterSDNode>(RegNo, VT);
1754 CSEMap.InsertNode(N, IP);
1764 if (
SDNode *
E = FindNodeOrInsertPos(ID, IP))
1767 auto *N = newSDNode<RegisterMaskSDNode>(RegMask);
1768 CSEMap.InsertNode(N, IP);
1785 if (
SDNode *
E = FindNodeOrInsertPos(ID, IP))
1789 createOperands(N, Ops);
1791 CSEMap.InsertNode(N, IP);
1808 if (
SDNode *
E = FindNodeOrInsertPos(ID, IP))
1812 CSEMap.InsertNode(N, IP);
1819 "SrcValue is not a pointer?");
1826 if (
SDNode *
E = FindNodeOrInsertPos(ID, IP))
1829 auto *N = newSDNode<SrcValueSDNode>(V);
1830 CSEMap.InsertNode(N, IP);
1841 if (
SDNode *
E = FindNodeOrInsertPos(ID, IP))
1844 auto *N = newSDNode<MDNodeSDNode>(MD);
1845 CSEMap.InsertNode(N, IP);
1858 unsigned SrcAS,
unsigned DestAS) {
1866 if (
SDNode *
E = FindNodeOrInsertPos(ID, dl, IP))
1871 createOperands(N, Ops);
1873 CSEMap.InsertNode(N, IP);
1883 if (OpTy == ShTy || OpTy.
isVector())
return Op;
1891 const Value *V = cast<SrcValueSDNode>(Node->
getOperand(2))->getValue();
1902 assert(((Align & (Align-1)) == 0) &&
"Expected Align to be a power of 2");
1905 getConstant(Align - 1, dl, VAList.getValueType()));
1908 getConstant(-(int64_t)Align, dl, VAList.getValueType()));
1915 dl, VAList.getValueType()));
1928 const Value *VD = cast<SrcValueSDNode>(Node->
getOperand(3))->getValue();
1941 unsigned StackAlign =
1988 const APInt &C2 = N2C->getAPIntValue();
1990 const APInt &C1 = N1C->getAPIntValue();
2071 return getSetCC(dl, VT, N2, N1, SwappedCond);
2087 assert(CV &&
"Const value should be ConstSDNode.");
2108 unsigned Amt = RHSC->getZExtValue();
2113 APInt NewMask = Mask << Amt;
2153 unsigned Depth)
const {
2162 const APInt &DemandedElts) {
2171 for (
unsigned i = 0; i != NumElts; ++i) {
2172 if (!DemandedElts[i])
2188 const APInt &ShAmt = SA->getAPIntValue();
2199 unsigned Depth)
const {
2211 const APInt &DemandedElts,
2212 unsigned Depth)
const {
2217 if (
auto *
C = dyn_cast<ConstantSDNode>(Op)) {
2219 Known.
One =
C->getAPIntValue();
2223 if (
auto *
C = dyn_cast<ConstantFPSDNode>(Op)) {
2225 Known.
One =
C->getValueAPF().bitcastToAPInt();
2244 "Unexpected vector size");
2247 if (!DemandedElts[i])
2256 "Expected BUILD_VECTOR implicit truncation");
2257 Known2 = Known2.
trunc(BitWidth);
2272 APInt DemandedLHS(NumElts, 0), DemandedRHS(NumElts, 0);
2275 assert(NumElts == SVN->
getMask().size() &&
"Unexpected vector size");
2276 for (
unsigned i = 0; i != NumElts; ++i) {
2277 if (!DemandedElts[i])
2285 DemandedLHS.clearAllBits();
2290 if ((
unsigned)M < NumElts)
2291 DemandedLHS.setBit((
unsigned)M % NumElts);
2293 DemandedRHS.
setBit((
unsigned)M % NumElts);
2296 if (!!DemandedLHS) {
2305 if (!!DemandedRHS) {
2319 for (
unsigned i = 0; i != NumSubVectors; ++i) {
2320 APInt DemandedSub = DemandedElts.
lshr(i * NumSubVectorElts);
2321 DemandedSub = DemandedSub.
trunc(NumSubVectorElts);
2322 if (!!DemandedSub) {
2346 if (!!DemandedSubElts) {
2352 APInt DemandedSrcElts = DemandedElts & ~SubMask;
2353 if (!!DemandedSrcElts) {
2394 if (BitWidth == SubBitWidth) {
2402 if ((BitWidth % SubBitWidth) == 0) {
2409 unsigned SubScale = BitWidth / SubBitWidth;
2410 APInt SubDemandedElts(NumElts * SubScale, 0);
2411 for (
unsigned i = 0; i != NumElts; ++i)
2412 if (DemandedElts[i])
2413 SubDemandedElts.
setBit(i * SubScale);
2415 for (
unsigned i = 0; i != SubScale; ++i) {
2418 unsigned Shifts = IsLE ? i : SubScale - 1 - i;
2419 Known.
One |= Known2.
One.
zext(BitWidth).
shl(SubBitWidth * Shifts);
2425 if ((SubBitWidth % BitWidth) == 0) {
2431 unsigned SubScale = SubBitWidth / BitWidth;
2432 APInt SubDemandedElts(NumElts / SubScale, 0);
2433 for (
unsigned i = 0; i != NumElts; ++i)
2434 if (DemandedElts[i])
2435 SubDemandedElts.
setBit(i / SubScale);
2440 for (
unsigned i = 0; i != NumElts; ++i)
2441 if (DemandedElts[i]) {
2442 unsigned Shifts = IsLE ? i : NumElts - 1 - i;
2443 unsigned Offset = (Shifts % SubScale) * BitWidth;
2480 Known.
Zero = KnownZeroOut;
2495 BitWidth) - BitWidth;
2511 if (RHSMaxLeadingZeros != BitWidth)
2512 LeadZ = std::min(BitWidth, LeadZ + BitWidth - RHSMaxLeadingZeros - 1);
2564 unsigned Shift = ShAmt->getZExtValue();
2565 Known.
Zero <<= Shift;
2566 Known.
One <<= Shift;
2574 unsigned Shift = ShAmt->getZExtValue();
2579 }
else if (
auto *BV = dyn_cast<BuildVectorSDNode>(Op.
getOperand(1))) {
2582 unsigned ShiftAmountMin = BitWidth;
2583 for (
unsigned i = 0; i != BV->getNumOperands(); ++i) {
2584 if (
auto *
C = dyn_cast<ConstantSDNode>(BV->getOperand(i))) {
2585 const APInt &ShAmt =
C->getAPIntValue();
2586 if (ShAmt.
ult(BitWidth)) {
2587 ShiftAmountMin = std::min<unsigned>(ShiftAmountMin,
2603 unsigned Shift = ShAmt->getZExtValue();
2622 InSignMask = InSignMask.
zext(BitWidth);
2624 InputDemandedBits |= InSignMask;
2627 Known.
One &= InputDemandedBits;
2628 Known.
Zero &= InputDemandedBits;
2633 Known.
Zero |= NewBits;
2634 Known.
One &= ~NewBits;
2636 Known.
One |= NewBits;
2637 Known.
Zero &= ~NewBits;
2639 Known.
Zero &= ~NewBits;
2640 Known.
One &= ~NewBits;
2649 unsigned LowBits =
Log2_32(PossibleTZ) + 1;
2658 unsigned LowBits =
Log2_32(PossibleLZ) + 1;
2686 Known = Known.
zext(BitWidth);
2693 Known = Known.
zext(BitWidth);
2702 Known = Known.
sext(BitWidth);
2707 Known = Known.
zext(BitWidth);
2712 Known = Known.
trunc(BitWidth);
2719 Known.
Zero |= (~InMask);
2744 if (CLHS->getAPIntValue().isNonNegative()) {
2754 if ((Known2.
Zero & MaskV) == MaskV) {
2755 unsigned NLZ2 = CLHS->getAPIntValue().countLeadingZeros();
2767 if (KnownZeroLow == 0)
2811 if (KnownZeroLow >= 2)
2817 if (KnownZeroHigh > 1)
2823 const APInt &
RA = Rem->getAPIntValue().abs();
2825 APInt LowBits = RA - 1;
2829 Known.
Zero = Known2.
Zero & LowBits;
2830 Known.
One = Known2.
One & LowBits;
2834 if (Known2.
Zero[BitWidth-1] || ((Known2.
Zero & LowBits) == LowBits))
2835 Known.
Zero |= ~LowBits;
2839 if (Known2.
One[BitWidth-1] && ((Known2.
One & LowBits) != 0))
2840 Known.
One |= ~LowBits;
2841 assert((Known.
Zero & Known.
One) == 0&&
"Bits known to be one AND zero?");
2847 const APInt &
RA = Rem->getAPIntValue();
2849 APInt LowBits = (RA - 1);
2853 Known.
Zero = Known2.
Zero | ~LowBits;
2854 Known.
One = Known2.
One & LowBits;
2880 Known = Known.
trunc(BitWidth);
2892 if (BitWidth > EltBitWidth)
2893 Known = Known.
trunc(EltBitWidth);
2904 if (BitWidth > EltBitWidth)
2905 Known = Known.
zext(BitWidth);
2921 if (DemandedElts[EltIdx]) {
3014 if (CstLow && CstHigh) {
3019 const APInt &ValueHigh = CstHigh->getAPIntValue();
3020 if (ValueLow.
sle(ValueHigh)) {
3023 unsigned MinSignBits = std::min(LowSignBits, HighSignBits);
3076 (void)(~N0Known.
Zero).uadd_ov(~N1Known.
Zero, overflow);
3083 (~N1Known.
Zero & 0x01) == ~N1Known.
Zero)
3090 if ((~N0Known.
Zero & 0x01) == ~N0Known.
Zero)
3103 return Const->getAPIntValue().zextOrTrunc(BitWidth).isPowerOf2();
3109 if (
C &&
C->getAPIntValue() == 1)
3117 if (
C &&
C->getAPIntValue().isSignMask())
3125 return C->getAPIntValue().zextOrTrunc(BitWidth).isPowerOf2();
3148 unsigned Depth)
const {
3154 unsigned FirstAnswer = 1;
3156 if (
auto *
C = dyn_cast<ConstantSDNode>(Op)) {
3157 const APInt &Val =
C->getAPIntValue();
3171 Tmp = cast<VTSDNode>(Op.
getOperand(1))->getVT().getSizeInBits();
3172 return VTBits-Tmp+1;
3174 Tmp = cast<VTSDNode>(Op.
getOperand(1))->getVT().getSizeInBits();
3179 for (
unsigned i = 0, e = Op.
getNumOperands(); (i < e) && (Tmp > 1); ++i) {
3180 if (!DemandedElts[i])
3189 "Expected BUILD_VECTOR implicit truncation");
3191 Tmp2 = (Tmp2 > ExtraBits ? Tmp2 - ExtraBits : 1);
3193 Tmp = std::min(Tmp, Tmp2);
3200 APInt DemandedLHS(NumElts, 0), DemandedRHS(NumElts, 0);
3202 assert(NumElts == SVN->
getMask().size() &&
"Unexpected vector size");
3203 for (
unsigned i = 0; i != NumElts; ++i) {
3205 if (!DemandedElts[i])
3211 if ((
unsigned)M < NumElts)
3212 DemandedLHS.setBit((
unsigned)M % NumElts);
3214 DemandedRHS.
setBit((
unsigned)M % NumElts);
3219 if (!!DemandedRHS) {
3221 Tmp = std::min(Tmp, Tmp2);
3226 assert(Tmp <= VTBits &&
"Failed to determine minimum sign bits");
3240 if (VTBits == SrcBits)
3246 if ((SrcBits % VTBits) == 0) {
3260 Tmp = cast<VTSDNode>(Op.
getOperand(1))->getVT().getScalarSizeInBits();
3277 APInt ShiftVal =
C->getAPIntValue();
3287 if (
C->getAPIntValue().uge(VTBits) ||
3288 C->getAPIntValue().uge(Tmp))
break;
3289 return Tmp -
C->getZExtValue();
3299 FirstAnswer = std::min(Tmp, Tmp2);
3309 if (Tmp == 1)
return 1;
3311 return std::min(Tmp, Tmp2);
3314 if (Tmp == 1)
return 1;
3316 return std::min(Tmp, Tmp2);
3328 if (CstLow && CstHigh) {
3333 Tmp2 = CstHigh->getAPIntValue().getNumSignBits();
3334 return std::min(Tmp, Tmp2);
3343 return std::min(Tmp, Tmp2);
3351 return std::min(Tmp, Tmp2);
3377 unsigned RotAmt =
C->getAPIntValue().urem(VTBits);
3381 RotAmt = (VTBits - RotAmt) % VTBits;
3386 if (Tmp > (RotAmt + 1))
return (Tmp - RotAmt);
3394 if (Tmp == 1)
return 1;
3398 if (CRHS->isAllOnesValue()) {
3404 if ((Known.
Zero | 1).isAllOnesValue())
3414 if (Tmp2 == 1)
return 1;
3415 return std::min(Tmp, Tmp2)-1;
3419 if (Tmp2 == 1)
return 1;
3423 if (CLHS->isNullValue()) {
3428 if ((Known.
Zero | 1).isAllOnesValue())
3442 if (Tmp == 1)
return 1;
3443 return std::min(Tmp, Tmp2)-1;
3448 if (NumSrcSignBits > (NumSrcBits - VTBits))
3449 return NumSrcSignBits - (NumSrcBits - VTBits);
3463 return std::max(std::min(KnownSign - rIndex * BitWidth, BitWidth), 0);
3479 if (DemandedElts[EltIdx]) {
3488 APInt VectorElts = DemandedElts;
3492 Tmp = std::min(Tmp, Tmp2);
3498 Tmp = std::min(Tmp, Tmp2);
3500 assert(Tmp <= VTBits &&
"Failed to determine minimum sign bits");
3514 if (BitWidth != EltBitWidth)
3548 for (
unsigned i = 0; (i < NumSubVectors) && (Tmp > 1); ++i) {
3549 APInt DemandedSub = DemandedElts.
lshr(i * NumSubVectorElts);
3550 DemandedSub = DemandedSub.
trunc(NumSubVectorElts);
3554 Tmp = std::min(Tmp, Tmp2);
3556 assert(Tmp <= VTBits &&
"Failed to determine minimum sign bits");
3564 unsigned ExtType =
LD->getExtensionType();
3568 Tmp =
LD->getMemoryVT().getScalarSizeInBits();
3569 return VTBits-Tmp+1;
3571 Tmp =
LD->getMemoryVT().getScalarSizeInBits();
3585 FirstAnswer =
std::max(FirstAnswer, NumBits);
3619 cast<ConstantSDNode>(Op.
getOperand(1))->getAPIntValue()))
3635 return !
C->getValueAPF().isNaN();
3644 "Floating point type expected");
3649 return !
C->isZero();
3655 "Floating point types unsupported - use isKnownNeverZeroFloat");
3677 if (A == B)
return true;
3682 if (CA->isZero() && CB->isZero())
return true;
3692 "Values must have the same type");
3696 return (AKnown.Zero | BKnown.Zero).isAllOnesValue();
3702 assert(!Ops.
empty() &&
"Can't concatenate an empty list of vectors!");
3707 "Concatenation of vectors with inconsistent value types!");
3708 assert((Ops.
size() * Ops[0].getValueType().getVectorNumElements()) ==
3710 "Incorrect element count in vector concatenation!");
3712 if (Ops.
size() == 1)
3755 if (
SDNode *
E = FindNodeOrInsertPos(ID, DL, IP))
3760 CSEMap.InsertNode(N, IP);
3776 const APInt &Val =
C->getAPIntValue();
3781 C->isTargetOpcode(),
C->isOpaque());
3786 C->isTargetOpcode(),
C->isOpaque());
3908 if (BV->isConstant()) {
3958 "Vector element count mismatch!");
3960 "Invalid fpext node, dst < src!");
3966 "Invalid SIGN_EXTEND!");
3971 "Vector element count mismatch!");
3973 "Invalid sext node, dst < src!");
3982 "Invalid ZERO_EXTEND!");
3987 "Vector element count mismatch!");
3989 "Invalid zext node, dst < src!");
3998 "Invalid ANY_EXTEND!");
4003 "Vector element count mismatch!");
4005 "Invalid anyext node, dst < src!");
4025 "Invalid TRUNCATE!");
4030 "Vector element count mismatch!");
4032 "Invalid truncate node, src < dst!");
4058 "BSWAP types must be a multiple of 16 bits!");
4064 "Invalid BITREVERSE!");
4071 "Cannot BITCAST between types of different sizes!");
4084 "Illegal SCALAR_TO_VECTOR node!");
4089 isa<ConstantSDNode>(Operand.
getOperand(1)) &&
4116 if (
SDNode *
E = FindNodeOrInsertPos(ID, DL, IP)) {
4117 E->intersectFlagsWith(Flags);
4123 createOperands(N, Ops);
4124 CSEMap.InsertNode(N, IP);
4127 createOperands(N, Ops);
4139 case ISD::ADD:
return std::make_pair(C1 + C2,
true);
4140 case ISD::SUB:
return std::make_pair(C1 - C2,
true);
4141 case ISD::MUL:
return std::make_pair(C1 * C2,
true);
4142 case ISD::AND:
return std::make_pair(C1 & C2,
true);
4143 case ISD::OR:
return std::make_pair(C1 | C2,
true);
4144 case ISD::XOR:
return std::make_pair(C1 ^ C2,
true);
4145 case ISD::SHL:
return std::make_pair(C1 << C2,
true);
4146 case ISD::SRL:
return std::make_pair(C1.
lshr(C2),
true);
4147 case ISD::SRA:
return std::make_pair(C1.
ashr(C2),
true);
4150 case ISD::SMIN:
return std::make_pair(C1.
sle(C2) ? C1 : C2,
true);
4151 case ISD::SMAX:
return std::make_pair(C1.
sge(C2) ? C1 : C2,
true);
4152 case ISD::UMIN:
return std::make_pair(C1.
ule(C2) ? C1 : C2,
true);
4153 case ISD::UMAX:
return std::make_pair(C1.
uge(C2) ? C1 : C2,
true);
4155 if (!C2.getBoolValue())
4157 return std::make_pair(C1.
udiv(C2),
true);
4159 if (!C2.getBoolValue())
4161 return std::make_pair(C1.
urem(C2),
true);
4163 if (!C2.getBoolValue())
4165 return std::make_pair(C1.
sdiv(C2),
true);
4167 if (!C2.getBoolValue())
4169 return std::make_pair(C1.
srem(C2),
true);
4171 return std::make_pair(
APInt(1, 0),
false);
4200 case ISD::SUB: Offset = -uint64_t(Offset);
break;
4215 assert(Ops.
size() == 2 &&
"Div/rem should have 2 operands");
4222 [](
SDValue V) {
return V.isUndef() ||
4245 if (
const ConstantSDNode *Scalar1 = dyn_cast<ConstantSDNode>(Cst1)) {
4246 if (
const ConstantSDNode *Scalar2 = dyn_cast<ConstantSDNode>(Cst2)) {
4249 "Can't fold vectors ops with scalar operands");
4274 if (LegalSVT.
bitsLT(SVT))
4282 if (SVT.isInteger()) {
4294 if (LegalSVT != SVT)
4305 "Vector size mismatch!");
4334 auto IsScalarOrSameVectorSize = [&](
const SDValue &
Op) {
4339 auto IsConstantBuildVectorOrUndef = [&](
const SDValue &
Op) {
4348 if (!
llvm::all_of(Ops, IsConstantBuildVectorOrUndef) ||
4367 for (
unsigned i = 0; i != NumElts; i++) {
4393 SDValue ScalarResult =
getNode(Opcode, DL, SVT, ScalarOps, Flags);
4396 if (LegalSVT != SVT)
4423 }
else if (N1CFP && !N2CFP) {
4437 if (N1 == N2)
return N1;
4447 assert(VT.
isInteger() &&
"This operator does not apply to FP types!");
4449 N1.
getValueType() == VT &&
"Binary operator types must match!");
4452 if (N2C && N2C->isNullValue())
4454 if (N2C && N2C->isAllOnesValue())
4461 assert(VT.
isInteger() &&
"This operator does not apply to FP types!");
4463 N1.
getValueType() == VT &&
"Binary operator types must match!");
4466 if (N2C && N2C->isNullValue())
4480 assert(VT.
isInteger() &&
"This operator does not apply to FP types!");
4482 N1.
getValueType() == VT &&
"Binary operator types must match!");
4491 N1.
getValueType() == VT &&
"Binary operator types must match!");
4497 "Invalid FCOPYSIGN!");
4505 "Shift operators return type must be the same as their first arg");
4507 "Shifts only work on integers");
4509 "Vector shift amounts must be in the same as their first arg");
4515 "Invalid use of small shift amount with oversized value!");
4522 if (N2C && N2C->isNullValue())
4526 EVT EVT = cast<VTSDNode>(N2)->getVT();
4529 "Cannot FP_ROUND_INREG integer types");
4531 "FP_ROUND_INREG type should be vector iff the operand " 4535 "Vector element counts must match in FP_ROUND_INREG");
4538 if (cast<VTSDNode>(N2)->getVT() == VT)
return N1;
4545 N2C && (N2C->getZExtValue() == 0 || N2C->getZExtValue() == 1) &&
4546 "Invalid FP_ROUND!");
4551 EVT EVT = cast<VTSDNode>(N2)->getVT();
4554 "Cannot *_EXTEND_INREG FP types");
4556 "AssertSExt/AssertZExt type should be the vector element type " 4557 "rather than the vector type!");
4559 if (VT == EVT)
return N1;
4563 EVT EVT = cast<VTSDNode>(N2)->getVT();
4566 "Cannot *_EXTEND_INREG FP types");
4568 "SIGN_EXTEND_INREG type should be vector iff the operand " 4572 "Vector element counts must match in SIGN_EXTEND_INREG");
4574 if (EVT == VT)
return N1;
4585 return SignExtendInReg(Val, VT);
4598 Ops.
push_back(SignExtendInReg(Val, OpVT));
4606 "The result of EXTRACT_VECTOR_ELT must be at least as wide as the \ 4607 element type of the vector.");
4653 if (N1Op2C && N2C) {
4675 assert(N2C && (
unsigned)N2C->getZExtValue() < 2 &&
"Bad EXTRACT_ELEMENT!");
4679 "Wrong types for EXTRACT_ELEMENT!");
4690 unsigned Shift = ElementSize * N2C->getZExtValue();
4698 "Extract subvector VTs must be a vectors!");
4701 "Extract subvector VTs must have the same element type!");
4703 "Extract subvector must be from larger vector to smaller vector!");
4708 &&
"Extract subvector overflow!");
4725 return N1.
getOperand(N2C->getZExtValue() / Factor);
4746 APFloat V1 = N1CFP->getValueAPF(),
V2 = N2CFP->getValueAPF();
4786 APFloat V = N1CFP->getValueAPF();
4867 if (
SDNode *
E = FindNodeOrInsertPos(ID, DL, IP)) {
4868 E->intersectFlagsWith(Flags);
4874 createOperands(N, Ops);
4875 CSEMap.InsertNode(N, IP);
4878 createOperands(N, Ops);
4899 if (N1CFP && N2CFP && N3CFP) {
4900 APFloat V1 = N1CFP->getValueAPF();
4901 const APFloat &
V2 = N2CFP->getValueAPF();
4902 const APFloat &V3 = N3CFP->getValueAPF();
4919 if (
SDValue V =
FoldSetCC(VT, N1, N2, cast<CondCodeSDNode>(N3)->
get(), DL))
4931 if (N1C->getZExtValue())
4936 if (N2 == N3)
return N2;
4953 "Insert subvector VTs must be a vectors");
4955 "Dest and insert subvector source types must match!");
4957 "Insert subvector must be from smaller vector to larger vector!");
4958 if (isa<ConstantSDNode>(Index)) {
4960 cast<ConstantSDNode>(
Index)->getZExtValue()
4962 &&
"Insert subvector overflow!");
4986 if (
SDNode *
E = FindNodeOrInsertPos(ID, DL, IP)) {
4987 E->intersectFlagsWith(Flags);
4993 createOperands(N, Ops);
4994 CSEMap.InsertNode(N, IP);
4997 createOperands(N, Ops);
5008 SDValue Ops[] = { N1, N2, N3, N4 };
5009 return getNode(Opcode, DL, VT, Ops);
5015 SDValue Ops[] = { N1, N2, N3, N4, N5 };
5016 return getNode(Opcode, DL, VT, Ops);
5032 if (
LoadSDNode *L = dyn_cast<LoadSDNode>(*U))
5034 if (FI->getIndex() < 0)
5049 assert(
C->getAPIntValue().getBitWidth() == 8);
5059 if (!IntVT.isInteger())
5086 if (Slice.
Array ==
nullptr) {
5104 unsigned NumVTBytes = NumVTBits / 8;
5105 unsigned NumBytes = std::min(NumVTBytes,
unsigned(Slice.
Length));
5107 APInt Val(NumVTBits, 0);
5109 for (
unsigned i = 0; i != NumBytes; ++i)
5110 Val |= (uint64_t)(
unsigned char)Slice[i] << i*8;
5112 for (
unsigned i = 0; i != NumBytes; ++i)
5113 Val |= (uint64_t)(
unsigned char)Slice[i] << (NumVTBytes-i-1)*8;
5132 uint64_t SrcDelta = 0;
5135 G = cast<GlobalAddressSDNode>(Src);
5139 G = cast<GlobalAddressSDNode>(Src.
getOperand(0));
5140 SrcDelta = cast<ConstantSDNode>(Src.
getOperand(1))->getZExtValue();
5154 unsigned Limit, uint64_t
Size,
5155 unsigned DstAlign,
unsigned SrcAlign,
5160 unsigned DstAS,
unsigned SrcAS,
5163 assert((SrcAlign == 0 || SrcAlign >= DstAlign) &&
5164 "Expecting memcpy / memset source to meet alignment requirement!");
5173 IsMemset, ZeroMemset, MemcpyStrSrc,
5198 unsigned NumMemOps = 0;
5201 while (VTSize > Size) {
5235 if (NumMemOps && AllowOverlap &&
5236 VTSize >= 8 && NewVTSize < Size &&
5245 if (++NumMemOps > Limit)
5248 MemOps.push_back(VT);
5267 assert(OutLoadChains.
size() &&
"Missing loads in memcpy inlining");
5268 assert(OutStoreChains.
size() &&
"Missing stores in memcpy inlining");
5270 for (
unsigned i = From; i < To; ++i) {
5272 GluedLoadChains.push_back(OutLoadChains[i]);
5279 for (
unsigned i = From; i < To; ++i) {
5291 bool isVol,
bool AlwaysInline,
5305 std::vector<EVT> MemOps;
5306 bool DstAlignCanChange =
false;
5312 DstAlignCanChange =
true;
5314 if (Align > SrcAlign)
5318 bool isZeroConstant = CopyFromConstant && Slice.
Array ==
nullptr;
5322 (DstAlignCanChange ? 0 : Align),
5323 (isZeroConstant ? 0 : SrcAlign),
5324 false,
false, CopyFromConstant,
true,
5330 if (DstAlignCanChange) {
5331 Type *Ty = MemOps[0].getTypeForEVT(C);
5338 while (NewAlign > Align &&
5342 if (NewAlign > Align) {
5355 unsigned NumMemOps = MemOps.
size();
5356 uint64_t SrcOff = 0, DstOff = 0;
5357 for (
unsigned i = 0; i != NumMemOps; ++i) {
5362 if (VTSize > Size) {
5365 assert(i == NumMemOps-1 && i != 0);
5366 SrcOff -= VTSize -
Size;
5367 DstOff -= VTSize -
Size;
5370 if (CopyFromConstant &&
5378 if (SrcOff < Slice.
Length) {
5380 SubSlice.
move(SrcOff);
5383 SubSlice.
Array =
nullptr;
5385 SubSlice.
Length = VTSize;
5389 Store = DAG.
getStore(Chain, dl, Value,
5406 bool isDereferenceable =
5409 if (isDereferenceable)
5415 MinAlign(SrcAlign, SrcOff), SrcMMOFlags);
5430 unsigned NumLdStInMemcpy = OutStoreChains.
size();
5432 if (NumLdStInMemcpy) {
5438 for (
unsigned i = 0; i < NumLdStInMemcpy; ++i) {
5444 if (NumLdStInMemcpy <= GluedLdStLimit) {
5446 NumLdStInMemcpy, OutLoadChains,
5449 unsigned NumberLdChain = NumLdStInMemcpy / GluedLdStLimit;
5450 unsigned RemainingLdStInMemcpy = NumLdStInMemcpy % GluedLdStLimit;
5451 unsigned GlueIter = 0;
5453 for (
unsigned cnt = 0; cnt < NumberLdChain; ++cnt) {
5454 unsigned IndexFrom = NumLdStInMemcpy - GlueIter - GluedLdStLimit;
5455 unsigned IndexTo = NumLdStInMemcpy - GlueIter;
5458 OutLoadChains, OutStoreChains);
5459 GlueIter += GluedLdStLimit;
5463 if (RemainingLdStInMemcpy) {
5465 RemainingLdStInMemcpy, OutLoadChains,
5477 bool isVol,
bool AlwaysInline,
5489 std::vector<EVT> MemOps;
5490 bool DstAlignCanChange =
false;
5496 DstAlignCanChange =
true;
5498 if (Align > SrcAlign)
5503 (DstAlignCanChange ? 0 : Align), SrcAlign,
5504 false,
false,
false,
false,
5510 if (DstAlignCanChange) {
5511 Type *Ty = MemOps[0].getTypeForEVT(C);
5513 if (NewAlign > Align) {
5523 uint64_t SrcOff = 0, DstOff = 0;
5527 unsigned NumMemOps = MemOps.
size();
5528 for (
unsigned i = 0; i < NumMemOps; i++) {
5533 bool isDereferenceable =
5536 if (isDereferenceable)
5548 for (
unsigned i = 0; i < NumMemOps; i++) {
5553 Store = DAG.
getStore(Chain, dl, LoadValues[i],
5583 uint64_t
Size,
unsigned Align,
bool isVol,
5592 std::vector<EVT> MemOps;
5593 bool DstAlignCanChange =
false;
5599 DstAlignCanChange =
true;
5601 isa<ConstantSDNode>(Src) && cast<ConstantSDNode>(Src)->isNullValue();
5603 Size, (DstAlignCanChange ? 0 :
Align), 0,
5604 true, IsZeroVal,
false,
true,
5609 if (DstAlignCanChange) {
5610 Type *Ty = MemOps[0].getTypeForEVT(*DAG.getContext());
5611 unsigned NewAlign = (
unsigned)DAG.getDataLayout().getABITypeAlignment(Ty);
5612 if (NewAlign > Align) {
5621 uint64_t DstOff = 0;
5622 unsigned NumMemOps = MemOps.
size();
5625 EVT LargestVT = MemOps[0];
5626 for (
unsigned i = 1; i < NumMemOps; i++)
5627 if (MemOps[i].bitsGT(LargestVT))
5628 LargestVT = MemOps[i];
5631 for (
unsigned i = 0; i < NumMemOps; i++) {
5634 if (VTSize > Size) {
5637 assert(i == NumMemOps-1 && i != 0);
5638 DstOff -= VTSize -
Size;
5644 if (VT.
bitsLT(LargestVT)) {
5653 Chain, dl, Value, DAG.getMemBasePlusOffset(Dst, DstOff, dl),
5676 bool isVol,
bool AlwaysInline,
bool isTailCall,
5679 assert(Align &&
"The SDAG layer expects explicit alignment and reserves 0");
5691 isVol,
false, DstPtrInfo, SrcPtrInfo);
5700 *
this, dl, Chain, Dst, Src, Size, Align, isVol, AlwaysInline,
5701 DstPtrInfo, SrcPtrInfo);
5709 assert(ConstantSize &&
"AlwaysInline requires a constant size!");
5712 true, DstPtrInfo, SrcPtrInfo);
5728 Entry.
Node = Dst; Args.push_back(Entry);
5729 Entry.
Node = Src; Args.push_back(Entry);
5730 Entry.
Node =
Size; Args.push_back(Entry);
5743 std::pair<SDValue,SDValue> CallResult = TLI->
LowerCallTo(CLI);
5744 return CallResult.second;
5748 SDValue Dst,
unsigned DstAlign,
5749 SDValue Src,
unsigned SrcAlign,
5751 unsigned ElemSz,
bool isTailCall,
5759 Args.push_back(Entry);
5762 Args.push_back(Entry);
5766 Args.push_back(Entry);
5770 if (LibraryCall == RTLIB::UNKNOWN_LIBCALL)
5784 std::pair<SDValue, SDValue> CallResult = TLI->
LowerCallTo(CLI);
5785 return CallResult.second;
5790 bool isVol,
bool isTailCall,
5793 assert(Align &&
"The SDAG layer expects explicit alignment and reserves 0");
5806 false, DstPtrInfo, SrcPtrInfo);
5815 *
this, dl, Chain, Dst, Src, Size, Align, isVol, DstPtrInfo, SrcPtrInfo);
5830 Entry.
Node = Dst; Args.push_back(Entry);
5831 Entry.
Node = Src; Args.push_back(Entry);
5832 Entry.
Node =
Size; Args.push_back(Entry);
5845 std::pair<SDValue,SDValue> CallResult = TLI->
LowerCallTo(CLI);
5846 return CallResult.second;
5850 SDValue Dst,
unsigned DstAlign,
5851 SDValue Src,
unsigned SrcAlign,
5853 unsigned ElemSz,
bool isTailCall,
5861 Args.push_back(Entry);
5864 Args.push_back(Entry);
5868 Args.push_back(Entry);
5872 if (LibraryCall == RTLIB::UNKNOWN_LIBCALL)
5886 std::pair<SDValue, SDValue> CallResult = TLI->
LowerCallTo(CLI);
5887 return CallResult.second;
5892 bool isVol,
bool isTailCall,
5894 assert(Align &&
"The SDAG layer expects explicit alignment and reserves 0");
5906 Align, isVol, DstPtrInfo);
5916 *
this, dl, Chain, Dst, Src, Size, Align, isVol, DstPtrInfo);
5927 Entry.
Node = Dst; Entry.
Ty = IntPtrTy;
5928 Args.push_back(Entry);
5931 Args.push_back(Entry);
5933 Entry.
Ty = IntPtrTy;
5934 Args.push_back(Entry);
5948 std::pair<SDValue,SDValue> CallResult = TLI->
LowerCallTo(CLI);
5949 return CallResult.second;
5953 SDValue Dst,
unsigned DstAlign,
5955 unsigned ElemSz,
bool isTailCall,
5962 Args.push_back(Entry);
5966 Args.push_back(Entry);
5970 Args.push_back(Entry);
5974 if (LibraryCall == RTLIB::UNKNOWN_LIBCALL)
5988 std::pair<SDValue, SDValue> CallResult = TLI->
LowerCallTo(CLI);
5989 return CallResult.second;
6000 if (
SDNode *
E = FindNodeOrInsertPos(ID, dl, IP)) {
6001 cast<AtomicSDNode>(
E)->refineAlignment(MMO);
6006 VTList, MemVT, MMO);
6007 createOperands(N, Ops);
6009 CSEMap.InsertNode(N, IP);
6034 AAMDNodes(),
nullptr, SSID, SuccessOrdering,
6037 return getAtomicCmpSwap(Opcode, dl, MemVT, VTs, Chain, Ptr, Cmp, Swp, MMO);
6048 SDValue Ops[] = {Chain, Ptr, Cmp, Swp};
6049 return getAtomic(Opcode, dl, MemVT, VTs, Ops, MMO);
6054 const Value *PtrVal,
unsigned Alignment,
6076 nullptr, SSID, Ordering);
6078 return getAtomic(Opcode, dl, MemVT, Chain, Ptr, Val, MMO);
6097 "Invalid Atomic Op");
6103 SDValue Ops[] = {Chain, Ptr, Val};
6104 return getAtomic(Opcode, dl, MemVT, VTs, Ops, MMO);
6114 return getAtomic(Opcode, dl, MemVT, VTs, Ops, MMO);
6119 if (Ops.
size() == 1)
6124 for (
unsigned i = 0; i < Ops.
size(); ++i)
6157 "Opcode is not a memory-accessing opcode!");
6164 ID.
AddInteger(getSyntheticNodeSubclassData<MemIntrinsicSDNode>(
6165 Opcode, dl.
getIROrder(), VTList, MemVT, MMO));
6168 if (
SDNode *
E = FindNodeOrInsertPos(ID, dl, IP)) {
6169 cast<MemIntrinsicSDNode>(
E)->refineAlignment(MMO);
6174 VTList, MemVT, MMO);
6175 createOperands(N, Ops);
6177 CSEMap.InsertNode(N, IP);
6180 VTList, MemVT, MMO);
6181 createOperands(N, Ops);
6205 int FI = cast<FrameIndexSDNode>(Ptr.
getOperand(0))->getIndex();
6219 if (
ConstantSDNode *OffsetNode = dyn_cast<ConstantSDNode>(OffsetOp))
6234 "Invalid chain type");
6247 PtrInfo, MMOFlags, MemVT.
getStoreSize(), Alignment, AAInfo, Ranges);
6248 return getLoad(AM, ExtType, VT, dl, Chain, Ptr, Offset, MemVT, MMO);
6258 assert(VT == MemVT &&
"Non-extending load from different memory type!");
6262 "Should only be an extending load, not truncating!");
6264 "Cannot convert from FP to Int or Int -> FP!");
6266 "Cannot use an ext load to convert to or from a vector!");
6269 "Cannot use an ext load to change the number of vector elements!");
6273 assert((Indexed || Offset.
isUndef()) &&
"Unindexed load with an offset!");
6277 SDValue Ops[] = { Chain, Ptr, Offset };
6281 ID.
AddInteger(getSyntheticNodeSubclassData<LoadSDNode>(
6285 if (
SDNode *
E = FindNodeOrInsertPos(ID, dl, IP)) {
6286 cast<LoadSDNode>(
E)->refineAlignment(MMO);
6291 createOperands(N, Ops);
6293 CSEMap.InsertNode(N, IP);
6307 PtrInfo, VT, Alignment, MMOFlags, AAInfo, Ranges);
6325 MemVT, Alignment, MMOFlags, AAInfo);
6369 return getStore(Chain, dl, Val, Ptr, MMO);
6375 "Invalid chain type");
6379 SDValue Ops[] = { Chain, Val, Ptr, Undef };
6383 ID.
AddInteger(getSyntheticNodeSubclassData<StoreSDNode>(
6387 if (
SDNode *
E = FindNodeOrInsertPos(ID, dl, IP)) {
6388 cast<StoreSDNode>(
E)->refineAlignment(MMO);
6393 createOperands(N, Ops);
6395 CSEMap.InsertNode(N, IP);
6404 EVT SVT,
unsigned Alignment,
6408 "Invalid chain type");
6420 PtrInfo, MMOFlags, SVT.
getStoreSize(), Alignment, AAInfo);
6430 "Invalid chain type");
6432 return getStore(Chain, dl, Val, Ptr, MMO);
6435 "Should only be a truncating store, not extending!");
6437 "Can't do FP-INT conversion!");
6439 "Cannot use trunc store to convert to or from a vector!");
6442 "Cannot use trunc store to change the number of vector elements!");
6446 SDValue Ops[] = { Chain, Val, Ptr, Undef };
6450 ID.
AddInteger(getSyntheticNodeSubclassData<StoreSDNode>(
6454 if (
SDNode *
E = FindNodeOrInsertPos(ID, dl, IP)) {
6455 cast<StoreSDNode>(
E)->refineAlignment(MMO);
6460 createOperands(N, Ops);
6462 CSEMap.InsertNode(N, IP);
6482 if (
SDNode *
E = FindNodeOrInsertPos(ID, dl, IP))
6488 createOperands(N, Ops);
6490 CSEMap.InsertNode(N, IP);
6506 ID.
AddInteger(getSyntheticNodeSubclassData<MaskedLoadSDNode>(
6507 dl.
getIROrder(), VTs, ExtTy, isExpanding, MemVT, MMO));
6510 if (
SDNode *
E = FindNodeOrInsertPos(ID, dl, IP)) {
6511 cast<MaskedLoadSDNode>(
E)->refineAlignment(MMO);
6515 ExtTy, isExpanding, MemVT, MMO);
6516 createOperands(N, Ops);
6518 CSEMap.InsertNode(N, IP);
6528 bool IsTruncating,
bool IsCompressing) {
6530 "Invalid chain type");
6537 ID.
AddInteger(getSyntheticNodeSubclassData<MaskedStoreSDNode>(
6538 dl.
getIROrder(), VTs, IsTruncating, IsCompressing, MemVT, MMO));
6541 if (
SDNode *
E = FindNodeOrInsertPos(ID, dl, IP)) {
6542 cast<MaskedStoreSDNode>(
E)->refineAlignment(MMO);
6546 IsTruncating, IsCompressing, MemVT, MMO);
6547 createOperands(N, Ops);
6549 CSEMap.InsertNode(N, IP);
6559 assert(Ops.
size() == 6 &&
"Incompatible number of operands");
6564 ID.AddInteger(getSyntheticNodeSubclassData<MaskedGatherSDNode>(
6568 if (
SDNode *
E = FindNodeOrInsertPos(ID, dl, IP)) {
6569 cast<MaskedGatherSDNode>(
E)->refineAlignment(MMO);
6575 createOperands(N, Ops);
6578 "Incompatible type of the PassThru value in MaskedGatherSDNode");
6581 "Vector width mismatch between mask and data");
6584 "Vector width mismatch between index and data");
6585 assert(isa<ConstantSDNode>(N->getScale()) &&
6586 cast<ConstantSDNode>(N->getScale())->getAPIntValue().isPowerOf2() &&
6587 "Scale should be a constant power of 2");
6589 CSEMap.InsertNode(N, IP);
6599 assert(Ops.
size() == 6 &&
"Incompatible number of operands");
6604 ID.AddInteger(getSyntheticNodeSubclassData<MaskedScatterSDNode>(
6608 if (
SDNode *
E = FindNodeOrInsertPos(ID, dl, IP)) {
6609 cast<MaskedScatterSDNode>(
E)->refineAlignment(MMO);
6614 createOperands(N, Ops);
6618 "Vector width mismatch between mask and data");
6621 "Vector width mismatch between index and data");
6622 assert(isa<ConstantSDNode>(N->getScale()) &&
6623 cast<ConstantSDNode>(N->getScale())->getAPIntValue().isPowerOf2() &&
6624 "Scale should be a constant power of 2");
6626 CSEMap.InsertNode(N, IP);
6641 switch (Ops.
size()) {
6642 case 0:
return getNode(Opcode, DL, VT);
6643 case 1:
return getNode(Opcode, DL, VT, static_cast<const SDValue>(Ops[0]));
6644 case 2:
return getNode(Opcode, DL, VT, Ops[0], Ops[1]);
6645 case 3:
return getNode(Opcode, DL, VT, Ops[0], Ops[1], Ops[2]);
6652 return getNode(Opcode, DL, VT, NewOps);
6657 unsigned NumOps = Ops.
size();
6659 case 0:
return getNode(Opcode, DL, VT);
6660 case 1:
return getNode(Opcode, DL, VT, Ops[0], Flags);
6661 case 2:
return getNode(Opcode, DL, VT, Ops[0], Ops[1], Flags);
6662 case 3:
return getNode(Opcode, DL, VT, Ops[0], Ops[1], Ops[2]);
6674 assert(NumOps == 5 &&
"SELECT_CC takes 5 operands!");
6676 "LHS and RHS of condition must have same type!");
6678 "True and False arms of SelectCC must have same type!");
6680 "select_cc node must be of same type as true and false value!");
6683 assert(NumOps == 5 &&
"BR_CC takes 5 operands!");
6685 "LHS/RHS of comparison should match types!");
6698 if (
SDNode *
E = FindNodeOrInsertPos(ID, DL, IP))
6702 createOperands(N, Ops);
6704 CSEMap.InsertNode(N, IP);
6707 createOperands(N, Ops);
6724 return getNode(Opcode, DL, VTList.
VTs[0], Ops);
6735 cast<VTSDNode>(N3.getOperand(1))->getVT() !=
MVT::i1)
6736 return getNode(Opcode, DL, VT, N1, N2, N3.getOperand(0));
6737 else if (N3.getOpcode() ==
ISD::AND)
6738 if (
ConstantSDNode *AndRHS = dyn_cast<ConstantSDNode>(N3.getOperand(1))) {
6741 unsigned NumBits = VT.getScalarSizeInBits()*2;
6742 if ((AndRHS->getValue() & (NumBits-1)) == NumBits-1)
6743 return getNode(Opcode, DL, VT, N1, N2, N3.getOperand(0));
6755 if (
SDNode *
E = FindNodeOrInsertPos(ID, DL, IP))
6759 createOperands(N, Ops);
6760 CSEMap.InsertNode(N, IP);
6763 createOperands(N, Ops);
6779 return getNode(Opcode, DL, VTList, Ops);
6785 return getNode(Opcode, DL, VTList, Ops);
6790 SDValue Ops[] = { N1, N2, N3 };
6791 return getNode(Opcode, DL, VTList, Ops);
6796 SDValue Ops[] = { N1, N2, N3, N4 };
6797 return getNode(Opcode, DL, VTList, Ops);
6803 SDValue Ops[] = { N1, N2, N3, N4, N5 };
6804 return getNode(Opcode, DL, VTList, Ops);
6808 return makeVTList(SDNode::getValueTypeList(VT), 1);
6824 VTListMap.InsertNode(Result, IP);
6844 VTListMap.InsertNode(Result, IP);
6866 VTListMap.InsertNode(Result, IP);
6872 unsigned NumVTs = VTs.
size();
6875 for (
unsigned index = 0; index < NumVTs; index++) {
6885 VTListMap.InsertNode(Result, IP);
6904 void *InsertPos =
nullptr;
6905 if (
SDNode *Existing = FindModifiedNodeSlot(N, Op, InsertPos))
6910 if (!RemoveNodeFromCSEMaps(N))
6911 InsertPos =
nullptr;
6914 N->OperandList[0].set(Op);
6918 if (InsertPos) CSEMap.InsertNode(N, InsertPos);
6930 void *InsertPos =
nullptr;
6931 if (
SDNode *Existing = FindModifiedNodeSlot(N, Op1, Op2, InsertPos))
6936 if (!RemoveNodeFromCSEMaps(N))
6937 InsertPos =
nullptr;
6940 if (N->OperandList[0] != Op1)
6941 N->OperandList[0].set(Op1);
6942 if (N->OperandList[1] != Op2)
6943 N->OperandList[1].set(Op2);
6947 if (InsertPos) CSEMap.InsertNode(N, InsertPos);
6953 SDValue Ops[] = { Op1, Op2, Op3 };
6960 SDValue Ops[] = { Op1, Op2, Op3, Op4 };
6967 SDValue Ops[] = { Op1, Op2, Op3, Op4, Op5 };
6973 unsigned NumOps = Ops.
size();
6975 "Update with wrong number of operands");
6982 void *InsertPos =
nullptr;
6983 if (
SDNode *Existing = FindModifiedNodeSlot(N, Ops, InsertPos))
6988 if (!RemoveNodeFromCSEMaps(N))
6989 InsertPos =
nullptr;
6992 for (
unsigned i = 0; i != NumOps; ++i)
6993 if (N->OperandList[i] != Ops[i])
6994 N->OperandList[i].set(Ops[i]);
6998 if (InsertPos) CSEMap.InsertNode(N, InsertPos);
7041 SDValue Ops[] = { Op1, Op2, Op3 };
7130 if (
SDNode *ON = FindNodeOrInsertPos(ID,
SDLoc(N), IP))
7131 return UpdateSDLocOnMergeSDNode(ON,
SDLoc(N));
7134 if (!RemoveNodeFromCSEMaps(N))
7139 N->ValueList = VTs.
VTs;
7140 N->NumValues = VTs.
NumVTs;
7150 DeadNodeSet.
insert(Used);
7155 MN->setMemRefs(
nullptr,
nullptr);
7159 createOperands(N, Ops);
7163 if (!DeadNodeSet.
empty()) {
7165 for (
SDNode *N : DeadNodeSet)
7172 CSEMap.InsertNode(N, IP);
7179 bool IsUnary =
false;
7180 bool IsTernary =
false;
7269 SDValue Ops[] = { Op1, Op2, Op3 };
7291 SDValue Ops[] = { Op1, Op2, Op3 };
7315 SDValue Ops[] = { Op1, Op2, Op3 };
7344 if (
SDNode *
E = FindNodeOrInsertPos(ID, DL, IP)) {
7345 return cast<MachineSDNode>(UpdateSDLocOnMergeSDNode(
E, DL));
7351 createOperands(N, Ops);
7354 CSEMap.InsertNode(N, IP);
7366 VT, Operand, SRIdxVal);
7376 VT, Operand, Subreg, SRIdxVal);
7389 if (
SDNode *
E = FindNodeOrInsertPos(ID,
SDLoc(), IP)) {
7390 E->intersectFlagsWith(Flags);
7401 SDNode *N,
unsigned R,
bool IsIndirect,
7403 assert(cast<DILocalVariable>(Var)->isValidLocationForIntrinsic(DL) &&
7404 "Expected inlined-at fields to agree");
7406 SDDbgValue(Var, Expr, N, R, IsIndirect, DL, O);
7414 assert(cast<DILocalVariable>(Var)->isValidLocationForIntrinsic(DL) &&
7415 "Expected inlined-at fields to agree");
7425 assert(cast<DILocalVariable>(Var)->isValidLocationForIntrinsic(DL) &&
7426 "Expected inlined-at fields to agree");
7434 unsigned VReg,
bool IsIndirect,
7436 assert(cast<DILocalVariable>(Var)->isValidLocationForIntrinsic(DL) &&
7437 "Expected inlined-at fields to agree");
7443 unsigned OffsetInBits,
unsigned SizeInBits,
7444 bool InvalidateDbg) {
7447 assert(FromNode && ToNode &&
"Can't modify dbg values");
7452 if (From == To || FromNode == ToNode)
7466 if (Dbg->getResNo() != From.
getResNo())
7470 auto *Expr = Dbg->getExpression();
7476 if (
auto FI = Expr->getFragmentInfo())
7477 if (OffsetInBits + SizeInBits > FI->SizeInBits)
7488 Dbg->getDebugLoc(), Dbg->getOrder());
7492 Dbg->setIsInvalidated();
7505 if (DV->isInvalidated())
7520 auto *DIExpr = DV->getExpression();
7526 DV->isIndirect(), DV->getDebugLoc(), DV->getOrder());
7528 DV->setIsInvalidated();
7531 dbgs() <<
" into " << *DIExpr <<
'\n');
7543 assert(cast<DILabel>(Label)->isValidLocationForIntrinsic(DL) &&
7544 "Expected inlined-at fields to agree");
7560 while (UI != UE && N == *UI)
7581 "Cannot replace with this method!");
7582 assert(From != To.
getNode() &&
"Cannot replace uses of with self");
7595 RAUWUpdateListener Listener(*
this, UI, UE);
7600 RemoveNodeFromCSEMaps(User);
7612 }
while (UI != UE && *UI == User);
7615 AddModifiedNodeToCSEMaps(User);
7631 for (
unsigned i = 0, e = From->
getNumValues(); i != e; ++i)
7634 "Cannot use this version of ReplaceAllUsesWith!");
7642 for (
unsigned i = 0, e = From->
getNumValues(); i != e; ++i)
7644 assert((i < To->getNumValues()) &&
"Invalid To location");
7651 RAUWUpdateListener Listener(*
this, UI, UE);
7656 RemoveNodeFromCSEMaps(User);
7668 }
while (UI != UE && *UI == User);
7672 AddModifiedNodeToCSEMaps(User);
7690 for (
unsigned i = 0, e = From->
getNumValues(); i != e; ++i)
7696 RAUWUpdateListener Listener(*
this, UI, UE);
7701 RemoveNodeFromCSEMaps(User);
7714 }
while (UI != UE && *UI == User);
7717 AddModifiedNodeToCSEMaps(User);
7730 if (From == To)
return;
7745 RAUWUpdateListener Listener(*
this, UI, UE);
7748 bool UserRemovedFromCSEMaps =
false;
7765 if (!UserRemovedFromCSEMaps) {
7766 RemoveNodeFromCSEMaps(User);
7767 UserRemovedFromCSEMaps =
true;
7774 }
while (UI != UE && *UI == User);
7777 if (!UserRemovedFromCSEMaps)
7782 AddModifiedNodeToCSEMaps(User);
7801 bool operator<(
const UseMemo &L,
const UseMemo &R) {
7809 if (TLI->isSDNodeAlwaysUniform(N))
7811 bool IsDivergent = TLI->isSDNodeSourceOfDivergence(N, FLI, DA);
7812 for (
auto &Op : N->
ops()) {
7816 if (N->
SDNodeBits.IsDivergent != IsDivergent) {
7818 for (
auto U : N->
uses()) {
7825 void SelectionDAG::CreateTopologicalOrder(std::vector<SDNode*>& Order) {
7827 Order.
reserve(AllNodes.size());
7832 Order.push_back(&N);
7834 for (std::vector<SDNode *>::iterator
I = Order.begin();
7835 I!=Order.end();++
I) {
7837 for (
auto U : N->
uses()) {
7838 unsigned &UnsortedOps = Degree[U];
7839 if (0 == --UnsortedOps)
7847 std::vector<SDNode*> TopoOrder;
7848 CreateTopologicalOrder(TopoOrder);
7852 DivergenceMap[&
N] =
false;
7854 for (
auto N : TopoOrder) {
7855 bool IsDivergent = DivergenceMap[
N];
7857 for (
auto &Op : N->
ops()) {
7859 IsSDNodeDivergent |= DivergenceMap[Op.
getNode()];
7862 DivergenceMap[
N] =
true;
7868 "Divergence bit inconsistency detected\n");
7890 for (
unsigned i = 0; i != Num; ++i) {
7891 unsigned FromResNo = From[i].
getResNo();
7894 E = FromNode->
use_end(); UI !=
E; ++UI) {
7897 UseMemo Memo = { *UI, i, &Use };
7906 for (
unsigned UseIndex = 0, UseIndexEnd = Uses.
size();
7907 UseIndex != UseIndexEnd; ) {
7913 RemoveNodeFromCSEMaps(User);
7920 unsigned i = Uses[UseIndex].Index;
7925 }
while (UseIndex != UseIndexEnd && Uses[UseIndex].User == User);
7929 AddModifiedNodeToCSEMaps(User);
7937 unsigned DAGSize = 0;
7960 SortedPos = AllNodes.insert(SortedPos, AllNodes.remove(Q));
7961 assert(SortedPos != AllNodes.end() &&
"Overran node list");
7980 assert(Degree != 0 &&
"Invalid node degree");
7986 SortedPos = AllNodes.insert(SortedPos, AllNodes.remove(P));
7987 assert(SortedPos != AllNodes.end() &&
"Overran node list");
7994 if (Node.getIterator() == SortedPos) {
7998 dbgs() <<
"Overran sorted position:\n";
8000 dbgs() <<
"Checking if this is due to cycles\n";
8007 assert(SortedPos == AllNodes.end() &&
8008 "Topological sort incomplete!");
8010 "First node in topological sort is not the entry token!");
8011 assert(AllNodes.front().getNodeId() == 0 &&
8012 "First node in topological sort has non-zero id!");
8013 assert(AllNodes.front().getNumOperands() == 0 &&
8014 "First node in topological sort has operands!");
8015 assert(AllNodes.back().getNodeId() == (int)DAGSize-1 &&
8016 "Last node in topologic sort has unexpected id!");
8017 assert(AllNodes.back().use_empty() &&
8018 "Last node in topologic sort has users!");
8030 DbgInfo->add(DB, SD, isParameter);
8039 assert(isa<MemSDNode>(NewMemOp.
getNode()) &&
"Expected a memop node");
8077 return Const !=
nullptr && Const->
isOne();
8095 if (CN && UndefElements.
none() &&
8111 if (CN && UndefElements.
none())
8122 GlobalAddressSDNode::GlobalAddressSDNode(
unsigned Opc,
unsigned Order,
8125 int64_t o,
unsigned char TF)
8131 EVT VT,
unsigned SrcAS,
8134 SrcAddrSpace(SrcAS), DestAddrSpace(DestAS) {}
8138 :
SDNode(Opc, Order, dl, VTs), MemoryVT(memvt), MMO(mmo) {
8159 std::vector<EVT> VTs;
8176 const EVT *SDNode::getValueTypeList(
EVT VT) {
8179 return &(*EVTs->insert(VT).first);
8182 "Value type out of range!");
8195 if (UI.getUse().getResNo() == Value) {
8212 if (UI.getUse().getResNo() == Value)
8273 unsigned Depth)
const {
8274 if (*
this == Dest)
return true;
8278 if (Depth == 0)
return false;
8303 if (
LoadSDNode *Ld = dyn_cast<LoadSDNode>(*
this)) {
8304 if (!Ld->isVolatile())
8305 return Ld->getChain().reachesChainWithoutSideEffects(Dest, Depth-1);
8323 "Can't unroll a vector with multiple results!");
8326 unsigned NE = VT.getVectorNumElements();
8336 else if (NE > ResNE)
8340 for (i= 0; i !=
NE; ++i) {
8349 getConstant(i, dl, TLI->getVectorIdxTy(getDataLayout())));
8352 Operands[j] = Operand;
8384 for (; i < ResNE; ++i)
8388 return getBuildVector(VecVT, dl, Scalars);
8409 if (BaseLocDecomp.equalBaseIndex(LocDecomp, *
this, Offset))
8410 return (Dist * Bytes == Offset);
8419 int64_t GVOffset = 0;
8420 if (TLI->isGAPlusOffset(Ptr.
getNode(), GV, GVOffset)) {
8421 unsigned IdxWidth = getDataLayout().getIndexTypeSizeInBits(GV->
getType());
8425 unsigned Align = AlignBits ? 1 << std::min(31U, AlignBits) : 0;
8432 int FrameIdx = 1 << 31;
8433 int64_t FrameOffset = 0;
8435 FrameIdx = FI->getIndex();
8436 }
else if (isBaseWithConstantOffset(Ptr) &&
8439 FrameIdx = cast<FrameIndexSDNode>(Ptr.
getOperand(0))->getIndex();
8443 if (FrameIdx != (1 << 31)) {
8459 LoVT = HiVT = TLI->getTypeToTransformTo(*getContext(), VT);
8463 return std::make_pair(LoVT, HiVT);
8468 std::pair<SDValue, SDValue>
8473 "More vector elements requested than available!");
8476 getConstant(0, DL, TLI->getVectorIdxTy(getDataLayout())));
8479 TLI->getVectorIdxTy(getDataLayout())));
8480 return std::make_pair(Lo, Hi);
8485 unsigned Start,
unsigned Count) {
8491 EVT IdxTy = TLI->getVectorIdxTy(getDataLayout());
8493 for (
unsigned i = Start, e = Start + Count; i != e; ++i) {
8501 return getGlobal()->getType()->getAddressSpace();
8505 if (isMachineConstantPoolEntry())
8506 return Val.MachineCPVal->getType();
8507 return Val.ConstVal->getType();
8511 unsigned &SplatBitSize,
8513 unsigned MinSplatBits,
8514 bool IsBigEndian)
const {
8518 if (MinSplatBits > VecWidth)
8523 SplatValue =
APInt(VecWidth, 0);
8524 SplatUndef =
APInt(VecWidth, 0);
8531 assert(NumOps > 0 &&
"isConstantSplat has 0-size build vector");
8534 for (
unsigned j = 0; j < NumOps; ++j) {
8535 unsigned i = IsBigEndian ? NumOps - 1 - j : j;
8537 unsigned BitPos = j * EltWidth;
8540 SplatUndef.
setBits(BitPos, BitPos + EltWidth);
8541 else if (
auto *CN = dyn_cast<ConstantSDNode>(OpVal))
8542 SplatValue.
insertBits(CN->getAPIntValue().zextOrTrunc(EltWidth), BitPos);
8543 else if (
auto *CN = dyn_cast<ConstantFPSDNode>(OpVal))
8544 SplatValue.
insertBits(CN->getValueAPF().bitcastToAPInt(), BitPos);
8551 HasAnyUndefs = (SplatUndef != 0);
8554 while (VecWidth > 8) {
8555 unsigned HalfSize = VecWidth / 2;
8562 if ((HighValue & ~LowUndef) != (LowValue & ~HighUndef) ||
8563 MinSplatBits > HalfSize)
8566 SplatValue = HighValue | LowValue;
8567 SplatUndef = HighUndef & LowUndef;
8569 VecWidth = HalfSize;
8572 SplatBitSize = VecWidth;
8577 if (UndefElements) {
8578 UndefElements->
clear();
8586 (*UndefElements)[i] =
true;
8587 }
else if (!Splatted) {
8589 }
else if (Splatted != Op) {
8596 "Can only have a splat without a constant for all undefs.");
8605 return dyn_cast_or_null<ConstantSDNode>(
getSplatValue(UndefElements));
8610 return dyn_cast_or_null<ConstantFPSDNode>(
getSplatValue(UndefElements));
8617 dyn_cast_or_null<ConstantFPSDNode>(
getSplatValue(UndefElements))) {
8620 const APFloat &APF = CN->getValueAPF();
8646 assert(i != e &&
"VECTOR_SHUFFLE node with all undef indices!");
8650 for (
int Idx = Mask[i]; i != e; ++i)
8651 if (Mask[i] >= 0 && Mask[i] != Idx)
8659 if (isa<ConstantSDNode>(N))
8667 TLI->isOffsetFoldingLegal(GA))
8673 if (isa<ConstantFPSDNode>(N))
8683 assert(!Node->OperandList &&
"Node already has operands");
8684 SDUse *Ops = OperandRecycler.allocate(
8687 bool IsDivergent =
false;
8688 for (
unsigned I = 0;
I != Vals.
size(); ++
I) {
8689 Ops[
I].setUser(Node);
8690 Ops[
I].setInitial(Vals[
I]);
8692 IsDivergent = IsDivergent || Ops[I].getNode()->isDivergent();
8694 Node->NumOperands = Vals.
size();
8695 Node->OperandList = Ops;
8696 IsDivergent |= TLI->isSDNodeSourceOfDivergence(Node, FLI, DA);
8697 if (!TLI->isSDNodeAlwaysUniform(Node))
8708 if (Checked.
count(N))
8713 if (!Visited.
insert(N).second) {
8714 errs() <<
"Detected cycle in SelectionDAG\n";
8715 dbgs() <<
"Offending node:\n";
8733 #ifdef EXPENSIVE_CHECKS 8735 #endif // EXPENSIVE_CHECKS 8737 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)
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.
SDValue getGlobalAddress(const GlobalValue *GV, const SDLoc &DL, EVT VT, int64_t offset=0, bool isTargetGA=false, unsigned char TargetFlags=0)
bool isOSDarwin() const
isOSDarwin - Is this a "Darwin" OS (OS X, iOS, or watchOS).
void AddPointer(const void *Ptr)
Add* - Add various data types to Bit data.
void push_back(const T &Elt)
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.
virtual bool isSDNodeSourceOfDivergence(const SDNode *N, FunctionLoweringInfo *FLI, DivergenceAnalysis *DA) const
A parsed version of the target data layout string in and methods for querying it. ...
constexpr char Align[]
Key for Kernel::Arg::Metadata::mAlign.
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...
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
Constrained versions of libm-equivalent floating point intrinsics.
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.
GCNRegPressure max(const GCNRegPressure &P1, const GCNRegPressure &P2)
static APInt getAllOnesValue(unsigned numBits)
Get the all-ones value.
unsigned getOpcode() const
Return the SelectionDAG opcode value for this node.
SDValue getTargetIndex(int Index, EVT VT, int64_t Offset=0, unsigned char TargetFlags=0)
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...
SDValue getSetCC(const SDLoc &DL, EVT VT, SDValue LHS, SDValue RHS, ISD::CondCode Cond)
Helper function to make it easier to build SetCC's if you just have an ISD::CondCode instead of an SD...
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...
unsigned char getTargetFlags() const
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...
ConstantSDNode * isConstOrConstSplat(SDValue N)
Returns the SDNode if it is a constant splat BuildVector or constant int.
EXTRACT_SUBVECTOR(VECTOR, IDX) - Returns a subvector from VECTOR (an vector value) starting with the ...
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.
Compute iterated dominance frontiers using a linear time algorithm.
void intersectWith(const SDNodeFlags Flags)
Clear any flags in this flag set that aren't also set in Flags.
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.
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 ...
APInt sdiv(const APInt &RHS) const
Signed division function for APInt.
bool exceedsNaturalStackAlignment(unsigned Align) const
Returns true if the given alignment exceeds the natural stack alignment.
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.
SDValue getSignExtendVectorInReg(SDValue Op, const SDLoc &DL, EVT VT)
Return an operation which will sign extend the low lanes of the operand into the specified vector typ...
unsigned getIROrder() const
Return the node ordering.
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.
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...
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.
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
CondCode getSetCCAndOperation(CondCode Op1, CondCode Op2, bool isInteger)
Return the result of a logical AND between different comparisons of identical values: ((X op1 Y) & (X...
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 SDValue FoldCONCAT_VECTORS(const SDLoc &DL, EVT VT, ArrayRef< SDValue > Ops, SelectionDAG &DAG)
static ISD::NodeType getExtendForContent(BooleanContent Content)
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...
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.
bool isBitwiseNot(SDValue V)
Returns true if V is a bitwise not operation.
virtual bool isSafeMemOpType(MVT) const
Returns true if it's safe to use load / store of the specified type to expand memcpy / memset inline...
bool sgt(const APInt &RHS) const
Signed greather than comparison.
Val, Success, OUTCHAIN = ATOMIC_CMP_SWAP_WITH_SUCCESS(INCHAIN, ptr, cmp, swap) N.b.
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.
Constrained versions of the binary floating point operators.
unsigned const TargetRegisterInfo * TRI
bool isInteger() const
Return true if this is an integer or a vector integer type.
void updateDivergence(SDNode *N)
CallLoweringInfo & setDebugLoc(const SDLoc &dl)
SIGN_EXTEND_VECTOR_INREG(Vector) - This operator represents an in-register sign-extension of the low ...
[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
ConstantFPSDNode * isConstOrConstSplatFP(SDValue N)
Returns the SDNode if it is a constant splat BuildVector or constant float.
void setBitsFrom(unsigned loBit)
Set the top bits starting from loBit.
SDValue getTargetExternalSymbol(const char *Sym, EVT VT, unsigned char TargetFlags=0)
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.
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...
const SDValue & setRoot(SDValue N)
Set the current root tag of the SelectionDAG.
void reserve(size_type N)
#define __asan_unpoison_memory_region(p, size)
uint64_t Offset
Slice starts at this Offset.
bool sle(const APInt &RHS) const
Signed less or equal comparison.
bool isOperationLegalOrCustom(unsigned Op, EVT VT) const
Return true if the specified operation is legal on this target or can be made legal with custom lower...
MachineMemOperand * getMemOperand() const
Return a MachineMemOperand object describing the memory reference performed by operation.
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 ...
SDValue getConstantPool(const Constant *C, EVT VT, unsigned Align=0, int Offs=0, bool isT=false, unsigned char TargetFlags=0)
void intersectFlagsWith(const SDNodeFlags Flags)
Clear any flags in this node that aren't also set in Flags.
std::size_t countLeadingZeros(T Val, ZeroBehavior ZB=ZB_Width)
Count number of 0's from the most significant bit to the least stopping at the first 1...
uint16_t PersistentId
Unique and persistent id per SDNode in the DAG.
const DebugLoc & getDebugLoc() const
Return the source location info.
unsigned getValueSizeInBits() const
Returns the size of the value in bits.
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.
int CreateStackObject(uint64_t Size, unsigned 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...
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.
bool isNull() const
Test if the pointer held in the union is null, regardless of which type it is.
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 ...
static DIExpression * prepend(const DIExpression *Expr, bool DerefBefore, int64_t Offset=0, bool DerefAfter=false, bool StackValue=false)
Prepend DIExpr with a deref and offset operation and optionally turn it into a stack value...
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...
SDValue getMemBasePlusOffset(SDValue Base, unsigned Offset, const SDLoc &DL)
Returns sum of the base pointer and offset.
unsigned char getTargetFlags() const
SDValue getAnyExtendVectorInReg(SDValue Op, const SDLoc &DL, EVT VT)
Return an operation which will any-extend the low lanes of the operand into the specified vector type...
unsigned getAddrSpace() const
Return the LLVM IR address space number that this pointer points into.
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.
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 ...
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...
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...
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.
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
APInt shl(unsigned shiftAmt) const
Left-shift function.
Shift and rotation operations.
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.
const TargetMachine & getTarget() const
getTarget - Return the target machine this machine code is compiled with
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.
SDValue getMaskedScatter(SDVTList VTs, EVT VT, const SDLoc &dl, ArrayRef< SDValue > Ops, MachineMemOperand *MMO)
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...
op_iterator op_end() const
unsigned getScalarValueSizeInBits() 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.
static void checkAddrSpaceIsValidForLibcall(const TargetLowering *TLI, unsigned AS)
unsigned getStoreSize() const
Return the number of bytes overwritten by a store of the specified value type.
void AddInteger(signed I)
The memory access is dereferenceable (i.e., doesn't trap).
The MachineFrameInfo class represents an abstract stack frame until prolog/epilog code is inserted...
Val, OUTCHAIN = ATOMIC_SWAP(INCHAIN, ptr, amt) Val, OUTCHAIN = ATOMIC_LOAD_[OpName](INCHAIN, ptr, amt) For double-word atomic operations: ValLo, ValHi, OUTCHAIN = ATOMIC_SWAP(INCHAIN, ptr, amtLo, amtHi) ValLo, ValHi, OUTCHAIN = ATOMIC_LOAD_[OpName](INCHAIN, ptr, amtLo, amtHi) These correspond to the atomicrmw instruction.
SDValue getEntryNode() const
Return the token chain corresponding to the entry of the function.
const DataLayout & getDataLayout() const
SDVTList getVTList(EVT VT)
Return an SDVTList that represents the list of values specified.
APInt getHiBits(unsigned numBits) const
Compute an APInt containing numBits highbits from this APInt.
const BlockAddress * getBlockAddress() const
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.
KnownBits zext(unsigned BitWidth)
Zero extends the underlying known Zero and One bits.
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...
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.
AtomicOrdering
Atomic ordering for LLVM's memory model.
SDValue getMergeValues(ArrayRef< SDValue > Ops, const SDLoc &dl)
Create a MERGE_VALUES node from the given operands.
static int64_t getConstant(const MachineInstr *MI)
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.
int64_t getSExtValue() const
static BaseIndexOffset match(LSBaseSDNode *N, const SelectionDAG &DAG)
Parses tree in Ptr for base, index, offset addresses.
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.
unsigned getScalarSizeInBits() const
unsigned getSizeInBits() const
Return the size of the specified value type in bits.
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.
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)...
SDValue getMaskedGather(SDVTList VTs, EVT VT, const SDLoc &dl, ArrayRef< SDValue > Ops, MachineMemOperand *MMO)
const ConstantDataArray * Array
ConstantDataArray pointer.
opStatus convert(const fltSemantics &ToSemantics, roundingMode RM, bool *losesInfo)
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.
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.
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).
virtual EVT getOptimalMemOpType(uint64_t, unsigned, unsigned, bool, bool, bool, MachineFunction &) const
Returns the target specific optimal type for load and store operations as a result of memset...
ArrayRef - Represent a constant reference to an array (0 or more elements consecutively in memory)...
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.
cmpResult
IEEE-754R 5.11: Floating Point Comparison Relations.
SDDbgValue * getVRegDbgValue(DIVariable *Var, DIExpression *Expr, unsigned VReg, bool IsIndirect, const DebugLoc &DL, unsigned O)
Creates a VReg SDDbgValue node.
SDValue getMaskedStore(SDValue Chain, const SDLoc &dl, SDValue Val, SDValue Ptr, SDValue Mask, EVT MemVT, MachineMemOperand *MMO, bool IsTruncating=false, bool IsCompressing=false)
CondCode
ISD::CondCode enum - These are ordered carefully to make the bitfields below work out...
op_iterator op_begin() const
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.
bool getHasDebugValue() const
RESULT = INTRINSIC_WO_CHAIN(INTRINSICID, arg1, arg2, ...) This node represents a target intrinsic fun...
Expected< const typename ELFT::Sym * > getSymbol(typename ELFT::SymRange Symbols, uint32_t Index)
APInt reverseBits() const
SDNodeBitfields SDNodeBits
SDValue GetDemandedBits(SDValue V, const APInt &Mask)
See if the specified operand can be simplified with the knowledge that only the bits specified by Mas...
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.
This corresponds to the llvm.lifetime.
MVT getSimpleValueType() const
Return the simple ValueType of the referenced return value.
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.
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.
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.
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)
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...
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...
unsigned countPopulation() const
Count the number of bits set.
use_iterator use_begin() const
Provide iteration support to walk over all uses of an SDNode.
SelectionDAG(const TargetMachine &TM, CodeGenOpt::Level)
static void AddNodeIDNode(FoldingSetNodeID &ID, unsigned short OpC, SDVTList VTList, ArrayRef< SDValue > OpList)
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.
PowerPC Reduce CR logical Operation
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.
bool matchUnaryPredicate(SDValue Op, std::function< bool(ConstantSDNode *)> Match)
Attempt to match a unary predicate against a scalar/splat constant or every element of a constant BUI...
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.
LLVM_ATTRIBUTE_ALWAYS_INLINE iterator begin()
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...
LoadExtType
LoadExtType enum - This enum defines the three variants of LOADEXT (load with extension).
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.
LLVM_ATTRIBUTE_RETURNS_NONNULL LLVM_ATTRIBUTE_RETURNS_NOALIAS void * Allocate(size_t Size, size_t Alignment)
Allocate space at the specified alignment.
bool bitsLE(EVT VT) const
Return true if this has no more bits than VT.
SDValue getSplatValue(BitVector *UndefElements=nullptr) const
Returns the splatted value or a null value if this is not a splat.
Carry-using nodes for multiple precision addition and subtraction.
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.
unsigned char getTargetFlags() const
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.
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.
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...
ArrayRef< SDDbgValue * > GetDbgValues(const SDNode *SD)
Get the debug values which reference the given SDNode.
bool optForSize() const
Optimize this function for size (-Os) or minimum size (-Oz).
static ManagedStatic< std::set< EVT, EVT::compareRawBits > > EVTs
KnownBits trunc(unsigned BitWidth)
Truncate the underlying known Zero and One bits.
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)
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.
self_iterator getIterator()
SDValue getMemIntrinsicNode(unsigned Opcode, const SDLoc &dl, SDVTList VTList, ArrayRef< SDValue > Ops, EVT MemVT, MachinePointerInfo PtrInfo, unsigned Align=0, MachineMemOperand::Flags Flags=MachineMemOperand::MOLoad|MachineMemOperand::MOStore, unsigned Size=0)
Creates a MemIntrinsicNode that may produce a result and takes a list of operands.
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 getMaskedLoad(EVT VT, const SDLoc &dl, SDValue Chain, SDValue Ptr, SDValue Mask, SDValue Src0, EVT MemVT, MachineMemOperand *MMO, ISD::LoadExtType, bool IsExpanding=false)
void clearSignBit()
Set the sign bit to 0.
static bool isValueValidForType(EVT VT, const APFloat &Val)
Bit counting operators with an undefined result for zero inputs.
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. ...
unsigned char getTargetFlags() const
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
std::vector< ArgListEntry > ArgListTy
unsigned getAlignment() const
bool haveNoCommonBitsSet(SDValue A, SDValue B) const
Return true if A and B have no common bits set.
static const APInt * getValidShiftAmountConstant(SDValue V)
If a SHL/SRA/SRL node has a constant or splat constant shift amount that is less than the element bit...
TargetRegisterInfo base class - We assume that the target defines a static array of TargetRegisterDes...
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)
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...
unsigned getNumOperands() const
Return the number of values used by this operation.
Fast - This calling convention attempts to make calls as fast as possible (e.g.
#define llvm_unreachable(msg)
Marks that the current location is not supposed to be reachable.
HANDLENODE node - Used as a handle for various purposes.
void copySign(const APFloat &RHS)
SDValue getAtomicCmpSwap(unsigned Opcode, const SDLoc &dl, EVT MemVT, SDVTList VTs, SDValue Chain, SDValue Ptr, SDValue Cmp, SDValue Swp, MachinePointerInfo PtrInfo, unsigned Alignment, AtomicOrdering SuccessOrdering, AtomicOrdering FailureOrdering, SyncScope::ID SSID)
Gets a node for an atomic cmpxchg op.
bool isKnownNeverNaN(SDValue Op) const
Test whether the given SDValue is known to never be NaN.
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...
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.
ConstantFPSDNode * getConstantFPSplatNode(BitVector *UndefElements=nullptr) const
Returns the splatted constant FP or null if this is not a constant FP splat.
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...
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.
SDValue getZeroExtendVectorInReg(SDValue Op, const SDLoc &DL, EVT VT)
Return an operation which will zero extend the low lanes of the operand into the specified vector typ...
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.
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...
This is the shared class of boolean and integer constants.
static const fltSemantics & IEEEhalf() LLVM_READNONE
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...
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
virtual bool allowsMisalignedMemoryAccesses(EVT, unsigned AddrSpace=0, unsigned Align=1, bool *=nullptr) const
Determine if the target supports unaligned memory accesses.
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.
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...
bool hasFloatingPointExceptions() const
Return true if target supports floating point exceptions.
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.
X = FP_ROUND_INREG(Y, VT) - This operator takes an FP register, and rounds it to a floating point val...
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.
An SDNode that represents everything that will be needed to construct a MachineInstr.
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...
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...
CondCode getSetCCInverse(CondCode Operation, bool isInteger)
Return the operation corresponding to !(X op Y), where 'op' is a valid SetCC operation.
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).
unsigned getEVTAlignment(EVT MemoryVT) const
Compute the default alignment value for the given type.
static SDValue getMemcpyLoadsAndStores(SelectionDAG &DAG, const SDLoc &dl, SDValue Chain, SDValue Dst, SDValue Src, uint64_t Size, unsigned Align, bool isVol, bool AlwaysInline, MachinePointerInfo DstPtrInfo, MachinePointerInfo SrcPtrInfo)
unsigned char getTargetFlags() const
const Function & getFunction() const
Return the LLVM function that this machine code represents.
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.
void swap(llvm::BitVector &LHS, llvm::BitVector &RHS)
Implement std::swap in terms of BitVector swap.
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.
bool isTypeLegal(EVT VT) const
Return true if the target has native support for the specified value type.
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...
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)
SDValue FoldConstantArithmetic(unsigned Opcode, const SDLoc &DL, EVT VT, SDNode *Cst1, SDNode *Cst2)
A "pseudo-class" with methods for operating on BUILD_VECTORs.
Select(COND, TRUEVAL, FALSEVAL).
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 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.
ANY_EXTEND - Used for integer types. The high bits are undefined.
opStatus mod(const APFloat &RHS)
iterator insert(iterator I, T &&Elt)
CondCode getSetCCOrOperation(CondCode Op1, CondCode Op2, bool isInteger)
Return the result of a logical OR between different comparisons of identical values: ((X op1 Y) | (X ...
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())
SDValue getBlockAddress(const BlockAddress *BA, EVT VT, int64_t Offset=0, bool isTarget=false, unsigned char TargetFlags=0)
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.
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)
opStatus add(const APFloat &RHS, roundingMode RM)
bool ugt(const APInt &RHS) const
Unsigned greather than comparison.
SDValue getStackArgumentTokenFactor(SDValue Chain)
Compute a TokenFactor to force all the incoming stack arguments to be loaded from the stack...
static APFloat getNaN(const fltSemantics &Sem, bool Negative=false, unsigned type=0)
Factory for NaN values.
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.
LLVM_ATTRIBUTE_ALWAYS_INLINE iterator end()
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.
static bool shouldLowerMemFuncForSize(const MachineFunction &MF)
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.
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 ...
void computeKnownBits(SDValue Op, KnownBits &Known, unsigned Depth=0) const
Determine which bits of Op are known to be either zero or one and return them in Known.
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...
void init(MachineFunction &NewMF, OptimizationRemarkEmitter &NewORE, Pass *PassPtr, const TargetLibraryInfo *LibraryInfo, DivergenceAnalysis *Divergence)
Prepare this SelectionDAG to process code in the given MachineFunction.
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
const ConstantInt * getConstantIntValue() const
const TargetSubtargetInfo & getSubtarget() const
Flags getFlags() const
Return the raw flags of the source value,.
bool optForMinSize() 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.
static std::pair< APInt, bool > FoldValue(unsigned Opcode, const APInt &C1, const APInt &C2)
EVT getValueType() const
Convenience function for get().getValueType().
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)
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.
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.
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.
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 getAtomic(unsigned Opcode, const SDLoc &dl, EVT MemVT, SDValue Chain, SDValue Ptr, SDValue Val, const Value *PtrVal, unsigned Alignment, AtomicOrdering Ordering, SyncScope::ID SSID)
Gets a node for an atomic op, produces result (if relevant) and chain and takes 2 operands...
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
ConstantSDNode * getConstantSplatNode(BitVector *UndefElements=nullptr) const
Returns the splatted constant or null if this is not a constant splat.
CONCAT_VECTORS(VECTOR0, VECTOR1, ...) - Given a number of values of vector type with the same length ...
bool MaskedValueIsZero(SDValue Op, const APInt &Mask, unsigned Depth=0) const
Return true if 'Op & Mask' is known to be zero.
MachineConstantPoolValue * getMachineCPVal() const
static 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, SelectionDAG &DAG, const TargetLowering &TLI)
Determines the optimal series of memory ops to replace the memset / memcpy.
SDValue getJumpTable(int JTI, EVT VT, bool isTarget=false, unsigned char TargetFlags=0)
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)
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)
unsigned getNumSignBits() const
Computes the number of leading bits of this APInt that are equal to its sign bit. ...
ArrayRef< int > getMask() const
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.
MemSDNodeBitfields MemSDNodeBits
constexpr char Size[]
Key for Kernel::Arg::Metadata::mSize.
static ConstantSDNode * isConstOrDemandedConstSplat(SDValue N, const APInt &DemandedElts)
Helper function that checks to see if a node is a constant or a build vector of splat constants at le...
bool isNullConstant(SDValue V)
Returns true if V is a constant integer zero.
void setDebugLoc(DebugLoc dl)
Set source location info.
This class is used to represent an MGATHER node.
intptr_t getRawBits() const
SDValue getValueType(EVT)
KnownBits sext(unsigned BitWidth)
Sign extends the underlying known Zero and One bits.
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)
bool isUndef() const
Return true if the type of the node type undefined.
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 matchBinaryPredicate(SDValue LHS, SDValue RHS, std::function< bool(ConstantSDNode *, ConstantSDNode *)> Match)
Attempt to match a binary predicate against a pair of scalar/splat constants or every element of a pa...
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
#define LLVM_FALLTHROUGH
LLVM_FALLTHROUGH - Mark fallthrough cases in switch statements.
virtual const SelectionDAGTargetInfo * getSelectionDAGInfo() const
StringRef - Represent a constant reference to a string, i.e.
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
ManagedStatic - This transparently changes the behavior of global statics to be lazily constructed on...
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.
void move(uint64_t Delta)
Moves the Offset and adjusts Length accordingly.
MERGE_VALUES - This node takes multiple discrete operands and returns them all as its individual resu...
unsigned getNumOperands() const
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.
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.
Libcall getMEMSET_ELEMENT_UNORDERED_ATOMIC(uint64_t ElementSize)
getMEMSET_ELEMENT_UNORDERED_ATOMIC - Return MEMSET_ELEMENT_UNORDERED_ATOMIC_* value for the given ele...
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...
unsigned getMinStackArgumentAlignment() const
Return the minimum stack alignment of an argument.
Holds the information from a dbg_value node through SDISel.
virtual unsigned getMaxGluedStoresPerMemcpy() const
Get maximum # of store operations to be glued together.
FNEG, FABS, FSQRT, FSIN, FCOS, FPOWI, FPOW, FLOG, FLOG2, FLOG10, FEXP, FEXP2, FCEIL, FTRUNC, FRINT, FNEARBYINT, FROUND, FFLOOR - Perform various unary floating point operations.
void setObjectAlignment(int ObjectIdx, unsigned Align)
setObjectAlignment - Change the alignment of the specified stack object.
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.
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)
Determine which bits of V are known to be either zero or one and return them in the KnownZero/KnownOn...
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)
Val, OUTCHAIN = ATOMIC_LOAD(INCHAIN, ptr) This corresponds to "load atomic" instruction.
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.
This file describes how to lower LLVM code to machine code.
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.