65 .removeAttribute(Attribute::NonNull)
82 for (
unsigned I = 0,
E = ArgLocs.
size();
I !=
E; ++
I) {
110 IsSRet = Call->
paramHasAttr(ArgIdx, Attribute::StructRet);
113 IsInAlloca = Call->
paramHasAttr(ArgIdx, Attribute::InAlloca);
114 IsReturned = Call->
paramHasAttr(ArgIdx, Attribute::Returned);
115 IsSwiftSelf = Call->
paramHasAttr(ArgIdx, Attribute::SwiftSelf);
116 IsSwiftError = Call->
paramHasAttr(ArgIdx, Attribute::SwiftError);
125 std::pair<SDValue, SDValue>
135 Args.reserve(Ops.
size());
138 for (
unsigned i = 0; i < Ops.
size(); ++i) {
150 Args.push_back(Entry);
153 if (LC == RTLIB::UNKNOWN_LIBCALL)
161 bool zeroExtend = !signExtend;
165 signExtend = zeroExtend =
false;
181 unsigned Limit, uint64_t
Size,
182 unsigned DstAlign,
unsigned SrcAlign,
187 unsigned DstAS,
unsigned SrcAS,
196 if (!(SrcAlign == 0 || SrcAlign >= DstAlign))
200 IsMemset, ZeroMemset, MemcpyStrSrc,
225 unsigned NumMemOps = 0;
228 while (VTSize > Size) {
260 if (NumMemOps && AllowOverlap && NewVTSize < Size &&
271 if (++NumMemOps > Limit)
274 MemOps.push_back(VT);
299 bool IsSignaling)
const {
305 &&
"Unsupported setcc type!");
308 RTLIB::Libcall LC1 = RTLIB::UNKNOWN_LIBCALL, LC2 = RTLIB::UNKNOWN_LIBCALL;
309 bool ShouldInvertCC =
false;
313 LC1 = (VT ==
MVT::f32) ? RTLIB::OEQ_F32 :
315 (VT ==
MVT::f128) ? RTLIB::OEQ_F128 : RTLIB::OEQ_PPCF128;
319 LC1 = (VT ==
MVT::f32) ? RTLIB::UNE_F32 :
321 (VT ==
MVT::f128) ? RTLIB::UNE_F128 : RTLIB::UNE_PPCF128;
325 LC1 = (VT ==
MVT::f32) ? RTLIB::OGE_F32 :
327 (VT ==
MVT::f128) ? RTLIB::OGE_F128 : RTLIB::OGE_PPCF128;
331 LC1 = (VT ==
MVT::f32) ? RTLIB::OLT_F32 :
333 (VT ==
MVT::f128) ? RTLIB::OLT_F128 : RTLIB::OLT_PPCF128;
337 LC1 = (VT ==
MVT::f32) ? RTLIB::OLE_F32 :
339 (VT ==
MVT::f128) ? RTLIB::OLE_F128 : RTLIB::OLE_PPCF128;
343 LC1 = (VT ==
MVT::f32) ? RTLIB::OGT_F32 :
345 (VT ==
MVT::f128) ? RTLIB::OGT_F128 : RTLIB::OGT_PPCF128;
348 ShouldInvertCC =
true;
351 LC1 = (VT ==
MVT::f32) ? RTLIB::UO_F32 :
353 (VT ==
MVT::f128) ? RTLIB::UO_F128 : RTLIB::UO_PPCF128;
357 ShouldInvertCC =
true;
360 LC1 = (VT ==
MVT::f32) ? RTLIB::UO_F32 :
362 (VT ==
MVT::f128) ? RTLIB::UO_F128 : RTLIB::UO_PPCF128;
363 LC2 = (VT ==
MVT::f32) ? RTLIB::OEQ_F32 :
365 (VT ==
MVT::f128) ? RTLIB::OEQ_F128 : RTLIB::OEQ_PPCF128;
369 ShouldInvertCC =
true;
372 LC1 = (VT ==
MVT::f32) ? RTLIB::OGE_F32 :
374 (VT ==
MVT::f128) ? RTLIB::OGE_F128 : RTLIB::OGE_PPCF128;
377 LC1 = (VT ==
MVT::f32) ? RTLIB::OGT_F32 :
379 (VT ==
MVT::f128) ? RTLIB::OGT_F128 : RTLIB::OGT_PPCF128;
382 LC1 = (VT ==
MVT::f32) ? RTLIB::OLE_F32 :
384 (VT ==
MVT::f128) ? RTLIB::OLE_F128 : RTLIB::OLE_PPCF128;
387 LC1 = (VT ==
MVT::f32) ? RTLIB::OLT_F32 :
389 (VT ==
MVT::f128) ? RTLIB::OLT_F128 : RTLIB::OLT_PPCF128;
397 SDValue Ops[2] = {NewLHS, NewRHS};
402 auto Call =
makeLibCall(DAG, LC1, RetVT, Ops, CallOptions, dl, Chain);
407 if (ShouldInvertCC) {
412 if (LC2 == RTLIB::UNKNOWN_LIBCALL) {
419 auto Call2 =
makeLibCall(DAG, LC2, RetVT, Ops, CallOptions, dl, Chain);
423 NewLHS = DAG.
getSetCC(dl, SetCCVT, Call2.first, NewRHS, CCCode);
428 Tmp.getValueType(), Tmp, NewLHS);
515 const APInt &
C = Op1C->getAPIntValue();
537 const APInt &Demanded,
540 "ShrinkDemandedOp only supports binary operators!");
542 "ShrinkDemandedOp only supports nodes with one result!");
560 unsigned SmallVTBits = DemandedSize;
563 for (; SmallVTBits < BitWidth; SmallVTBits =
NextPowerOf2(SmallVTBits)) {
572 assert(DemandedSize <= SmallVTBits &&
"Narrowed below demanded bits?");
599 bool AssumeSingleUse)
const {
622 if (DemandedBits == 0 || DemandedElts == 0)
635 if (NumSrcEltBits == NumDstEltBits)
637 Src, DemandedBits, DemandedElts, DAG, Depth + 1))
641 if (SrcVT.isVector() && (NumDstEltBits % NumSrcEltBits) == 0 &&
643 unsigned Scale = NumDstEltBits / NumSrcEltBits;
644 unsigned NumSrcElts = SrcVT.getVectorNumElements();
647 for (
unsigned i = 0; i != Scale; ++i) {
648 unsigned Offset = i * NumSrcEltBits;
651 DemandedSrcBits |= Sub;
652 for (
unsigned j = 0; j != NumElts; ++j)
654 DemandedSrcElts.
setBit((j * Scale) + i);
659 Src, DemandedSrcBits, DemandedSrcElts, DAG, Depth + 1))
664 if ((NumSrcEltBits % NumDstEltBits) == 0 &&
666 unsigned Scale = NumSrcEltBits / NumDstEltBits;
667 unsigned NumSrcElts = SrcVT.isVector() ? SrcVT.getVectorNumElements() : 1;
670 for (
unsigned i = 0; i != NumElts; ++i)
671 if (DemandedElts[i]) {
672 unsigned Offset = (i % Scale) * NumDstEltBits;
673 DemandedSrcBits.
insertBits(DemandedBits, Offset);
674 DemandedSrcElts.
setBit(i / Scale);
678 Src, DemandedSrcBits, DemandedSrcElts, DAG, Depth + 1))
732 BooleanContent::ZeroOrNegativeOneBooleanContent) {
755 if (CIdx && CIdx->getAPIntValue().ult(VecVT.getVectorNumElements()) &&
756 !DemandedElts[CIdx->getZExtValue()])
765 bool AllUndef =
true, IdentityLHS =
true, IdentityRHS =
true;
766 for (
unsigned i = 0; i != NumElts; ++i) {
767 int M = ShuffleMask[i];
768 if (M < 0 || !DemandedElts[i])
771 IdentityLHS &= (M == (int)i);
772 IdentityRHS &= ((M - NumElts) == i);
786 Op, DemandedBits, DemandedElts, DAG, Depth))
803 unsigned Depth,
bool AssumeSingleUse)
const {
804 unsigned BitWidth = OriginalDemandedBits.
getBitWidth();
806 "Mask size mismatches value type size!");
808 unsigned NumElts = OriginalDemandedElts.
getBitWidth();
811 "Unexpected vector size");
814 APInt DemandedElts = OriginalDemandedElts;
827 Known.
One = cast<ConstantSDNode>(
Op)->getAPIntValue();
845 }
else if (OriginalDemandedBits == 0 || OriginalDemandedElts == 0) {
858 if (!DemandedElts[0])
891 APInt DemandedVecElts(DemandedElts);
892 if (CIdx && CIdx->getAPIntValue().ult(VecVT.getVectorNumElements())) {
893 unsigned Idx = CIdx->getZExtValue();
897 if (!DemandedElts[Idx])
914 if (!!DemandedVecElts) {
915 Known.
One &= KnownVec.
One;
929 APInt BaseElts = DemandedElts;
933 if (Idx.
ule(NumElts - NumSubElts)) {
935 SubElts = DemandedElts.
extractBits(NumSubElts, SubIdx);
951 Known.
One &= KnownSub.
One;
955 Known.
One &= KnownBase.
One;
981 for (
unsigned i = 0; i != NumSubVecs; ++i) {
982 APInt DemandedSubElts =
983 DemandedElts.
extractBits(NumSubElts, i * NumSubElts);
985 Known2, TLO, Depth + 1))
988 if (!!DemandedSubElts) {
989 Known.
One &= Known2.One;
990 Known.
Zero &= Known2.Zero;
999 APInt DemandedLHS(NumElts, 0);
1000 APInt DemandedRHS(NumElts, 0);
1001 for (
unsigned i = 0; i != NumElts; ++i) {
1002 if (!DemandedElts[i])
1004 int M = ShuffleMask[i];
1012 assert(0 <= M && M < (
int)(2 * NumElts) &&
"Shuffle index out of range");
1013 if (M < (
int)NumElts)
1016 DemandedRHS.
setBit(M - NumElts);
1019 if (!!DemandedLHS || !!DemandedRHS) {
1025 if (!!DemandedLHS) {
1032 if (!!DemandedRHS) {
1042 Op0, DemandedBits, DemandedLHS, TLO.
DAG, Depth + 1);
1044 Op1, DemandedBits, DemandedRHS, TLO.
DAG, Depth + 1);
1045 if (DemandedOp0 || DemandedOp1) {
1046 Op0 = DemandedOp0 ? DemandedOp0 : Op0;
1047 Op1 = DemandedOp1 ? DemandedOp1 : Op1;
1066 if ((LHSKnown.
Zero & DemandedBits) ==
1067 (~RHSC->getAPIntValue() & DemandedBits))
1081 LHSKnown.
One == ~RHSC->getAPIntValue()) {
1092 Known2, TLO, Depth + 1))
1099 Op0, DemandedBits, DemandedElts, TLO.
DAG, Depth + 1);
1101 Op1, DemandedBits, DemandedElts, TLO.
DAG, Depth + 1);
1102 if (DemandedOp0 || DemandedOp1) {
1103 Op0 = DemandedOp0 ? DemandedOp0 : Op0;
1104 Op1 = DemandedOp1 ? DemandedOp1 : Op1;
1141 Known2, TLO, Depth + 1))
1148 Op0, DemandedBits, DemandedElts, TLO.
DAG, Depth + 1);
1150 Op1, DemandedBits, DemandedElts, TLO.
DAG, Depth + 1);
1151 if (DemandedOp0 || DemandedOp1) {
1152 Op0 = DemandedOp0 ? DemandedOp0 : Op0;
1153 Op1 = DemandedOp1 ? DemandedOp1 : Op1;
1194 Op0, DemandedBits, DemandedElts, TLO.
DAG, Depth + 1);
1196 Op1, DemandedBits, DemandedElts, TLO.
DAG, Depth + 1);
1197 if (DemandedOp0 || DemandedOp1) {
1198 Op0 = DemandedOp0 ? DemandedOp0 : Op0;
1199 Op1 = DemandedOp1 ? DemandedOp1 : Op1;
1232 if (
C->getAPIntValue() == Known2.
One) {
1241 if (!
C->isAllOnesValue()) {
1242 if (DemandedBits.
isSubsetOf(
C->getAPIntValue())) {
1253 Known = std::move(KnownOut);
1263 assert(!Known.hasConflict() &&
"Bits known to be one AND zero?");
1264 assert(!Known2.hasConflict() &&
"Bits known to be one AND zero?");
1271 Known.One &= Known2.One;
1272 Known.Zero &= Known2.Zero;
1281 assert(!Known.hasConflict() &&
"Bits known to be one AND zero?");
1282 assert(!Known2.hasConflict() &&
"Bits known to be one AND zero?");
1289 Known.One &= Known2.One;
1290 Known.Zero &= Known2.Zero;
1302 BooleanContent::ZeroOrNegativeOneBooleanContent) {
1309 return TLO.CombineTo(Op, Op0);
1317 Known.Zero.setBitsFrom(1);
1326 if (SA->getAPIntValue().uge(BitWidth))
1329 unsigned ShAmt = SA->getZExtValue();
1331 return TLO.CombineTo(Op, Op0);
1341 if (SA2->getAPIntValue().ult(BitWidth)) {
1342 unsigned C1 = SA2->getZExtValue();
1344 int Diff = ShAmt - C1;
1351 return TLO.CombineTo(
1352 Op, TLO.DAG.getNode(Opc, dl, VT, Op0.
getOperand(0), NewSA));
1359 Known, TLO, Depth + 1))
1374 if (ShAmt < InnerBits && DemandedBits.
getActiveBits() <= InnerBits &&
1381 TLO.DAG.getConstant(ShAmt, dl, ShTy));
1382 return TLO.CombineTo(
1394 unsigned InnerShAmt = SA2->getLimitedValue(InnerBits);
1395 if (InnerShAmt < ShAmt && InnerShAmt < InnerBits &&
1397 (InnerBits - InnerShAmt + ShAmt) &&
1399 SDValue NewSA = TLO.DAG.getConstant(ShAmt - InnerShAmt, dl,
1403 return TLO.CombineTo(
1410 Known.Zero <<= ShAmt;
1411 Known.One <<= ShAmt;
1413 Known.Zero.setLowBits(ShAmt);
1423 if (SA->getAPIntValue().uge(BitWidth))
1426 unsigned ShAmt = SA->getZExtValue();
1428 return TLO.CombineTo(Op, Op0);
1431 APInt InDemandedMask = (DemandedBits << ShAmt);
1447 if (SA2->getAPIntValue().ult(BitWidth)) {
1448 unsigned C1 = SA2->getZExtValue();
1450 int Diff = ShAmt - C1;
1456 SDValue NewSA = TLO.DAG.getConstant(Diff, dl, ShiftVT);
1457 return TLO.CombineTo(
1458 Op, TLO.DAG.getNode(Opc, dl, VT, Op0.
getOperand(0), NewSA));
1468 assert(!Known.hasConflict() &&
"Bits known to be one AND zero?");
1469 Known.Zero.lshrInPlace(ShAmt);
1470 Known.One.lshrInPlace(ShAmt);
1472 Known.Zero.setHighBits(ShAmt);
1485 return TLO.CombineTo(Op, TLO.DAG.getNode(
ISD::SRL, dl, VT, Op0, Op1));
1489 if (SA->getAPIntValue().uge(BitWidth))
1492 unsigned ShAmt = SA->getZExtValue();
1494 return TLO.CombineTo(Op, Op0);
1496 APInt InDemandedMask = (DemandedBits << ShAmt);
1511 assert(!Known.hasConflict() &&
"Bits known to be one AND zero?");
1512 Known.Zero.lshrInPlace(ShAmt);
1513 Known.One.lshrInPlace(ShAmt);
1517 if (Known.Zero[BitWidth - ShAmt - 1] ||
1521 return TLO.CombineTo(
1522 Op, TLO.DAG.getNode(
ISD::SRL, dl, VT, Op0, Op1, Flags));
1529 TLO.DAG.getConstant(BitWidth - 1 - Log2, dl, Op1.
getValueType());
1530 return TLO.CombineTo(Op, TLO.DAG.getNode(
ISD::SRL, dl, VT, Op0, NewSA));
1533 if (Known.One[BitWidth - ShAmt - 1])
1535 Known.One.setHighBits(ShAmt);
1547 unsigned Amt = SA->getAPIntValue().urem(BitWidth);
1553 Known, TLO, Depth + 1))
1560 APInt Demanded0 = DemandedBits.
lshr(IsFSHL ? Amt : (BitWidth - Amt));
1561 APInt Demanded1 = DemandedBits << (IsFSHL ? (BitWidth - Amt) : Amt);
1569 Known2.One <<= (IsFSHL ? Amt : (BitWidth - Amt));
1570 Known2.Zero <<= (IsFSHL ? Amt : (BitWidth - Amt));
1571 Known.One.lshrInPlace(IsFSHL ? (BitWidth - Amt) : Amt);
1572 Known.Zero.lshrInPlace(IsFSHL ? (BitWidth - Amt) : Amt);
1573 Known.One |= Known2.One;
1574 Known.Zero |= Known2.Zero;
1584 Known.One = Known2.One.reverseBits();
1585 Known.Zero = Known2.Zero.reverseBits();
1594 Known.One = Known2.One.byteSwap();
1595 Known.Zero = Known2.Zero.byteSwap();
1605 unsigned NumSignBits = TLO.DAG.ComputeNumSignBits(Op0);
1606 bool AlreadySignExtended = NumSignBits >= BitWidth - ExVTBits + 1;
1609 if (!AlreadySignExtended) {
1612 EVT ShiftAmtTy = VT;
1613 if (TLO.LegalTypes() && !ShiftAmtTy.
isVector())
1617 TLO.DAG.getConstant(BitWidth - ExVTBits, dl, ShiftAmtTy);
1618 return TLO.CombineTo(Op,
1619 TLO.DAG.getNode(
ISD::SHL, dl, VT, Op0, ShiftAmt));
1625 return TLO.CombineTo(Op, Op0);
1631 InputDemandedBits.
setBit(ExVTBits - 1);
1635 assert(!Known.hasConflict() &&
"Bits known to be one AND zero?");
1641 if (Known.Zero[ExVTBits - 1])
1642 return TLO.CombineTo(
1643 Op, TLO.DAG.getZeroExtendInReg(Op0, dl, ExVT.
getScalarType()));
1646 if (Known.One[ExVTBits - 1]) {
1647 Known.One.setBitsFrom(ExVTBits);
1670 Known.Zero = KnownLo.Zero.zext(BitWidth) |
1671 KnownHi.Zero.zext(BitWidth).shl(HalfBitWidth);
1673 Known.One = KnownLo.One.zext(BitWidth) |
1674 KnownHi.One.zext(BitWidth).shl(HalfBitWidth);
1689 if (IsVecInReg && DemandedElts == 1 &&
1691 TLO.DAG.getDataLayout().isLittleEndian())
1692 return TLO.CombineTo(Op, TLO.DAG.getBitcast(VT, Src));
1697 return TLO.CombineTo(Op, TLO.DAG.getNode(Opc, dl, VT, Src));
1700 APInt InDemandedBits = DemandedBits.
trunc(InBits);
1705 assert(!Known.hasConflict() &&
"Bits known to be one AND zero?");
1706 assert(Known.getBitWidth() == InBits &&
"Src width has changed?");
1707 Known = Known.zext(BitWidth,
true );
1722 if (IsVecInReg && DemandedElts == 1 &&
1724 TLO.DAG.getDataLayout().isLittleEndian())
1725 return TLO.CombineTo(Op, TLO.DAG.getBitcast(VT, Src));
1730 return TLO.CombineTo(Op, TLO.DAG.getNode(Opc, dl, VT, Src));
1733 APInt InDemandedBits = DemandedBits.
trunc(InBits);
1738 InDemandedBits.
setBit(InBits - 1);
1743 assert(!Known.hasConflict() &&
"Bits known to be one AND zero?");
1744 assert(Known.getBitWidth() == InBits &&
"Src width has changed?");
1747 Known = Known.sext(BitWidth);
1750 if (Known.isNonNegative()) {
1754 return TLO.CombineTo(Op, TLO.DAG.getNode(Opc, dl, VT, Src));
1768 if (IsVecInReg && DemandedElts == 1 &&
1770 TLO.DAG.getDataLayout().isLittleEndian())
1771 return TLO.CombineTo(Op, TLO.DAG.getBitcast(VT, Src));
1773 APInt InDemandedBits = DemandedBits.
trunc(InBits);
1778 assert(!Known.hasConflict() &&
"Bits known to be one AND zero?");
1779 assert(Known.getBitWidth() == InBits &&
"Src width has changed?");
1780 Known = Known.zext(BitWidth,
false );
1789 APInt TruncMask = DemandedBits.
zext(OperandBitWidth);
1792 Known = Known.trunc(BitWidth);
1796 Src, TruncMask, DemandedElts, TLO.DAG, Depth + 1))
1797 return TLO.CombineTo(Op, TLO.DAG.getNode(
ISD::TRUNCATE, dl, VT, NewSrc));
1815 if (!ShAmtC || ShAmtC->getAPIntValue().uge(BitWidth))
1822 HighBits = HighBits.
trunc(BitWidth);
1824 if (!(HighBits & DemandedBits)) {
1827 if (TLO.LegalTypes())
1831 return TLO.CombineTo(
1832 Op, TLO.DAG.getNode(
ISD::SRL, dl, VT, NewTrunc, ShAmt));
1838 assert(!Known.hasConflict() &&
"Bits known to be one AND zero?");
1849 assert(!Known.hasConflict() &&
"Bits known to be one AND zero?");
1851 Known.Zero |= ~InMask;
1862 if (
auto *CIdx = dyn_cast<ConstantSDNode>(Idx))
1863 if (CIdx->getAPIntValue().ult(NumSrcElts))
1868 APInt DemandedSrcBits = DemandedBits;
1869 if (BitWidth > EltBitWidth)
1870 DemandedSrcBits = DemandedSrcBits.
trunc(EltBitWidth);
1880 Src, DemandedSrcBits, DemandedSrcElts, TLO.DAG, Depth + 1)) {
1882 TLO.DAG.getNode(Op.
getOpcode(), dl, VT, DemandedSrc, Idx);
1883 return TLO.CombineTo(Op, NewOp);
1888 if (BitWidth > EltBitWidth)
1889 Known = Known.zext(BitWidth,
false );
1912 if (!OpVTLegal && OpVTSizeInBits > 32)
1915 SDValue ShAmt = TLO.DAG.getConstant(ShVal, dl, VT);
1916 return TLO.CombineTo(Op,
1917 TLO.DAG.getNode(
ISD::SHL, dl, VT, Sign, ShAmt));
1924 if (SrcVT.
isVector() && (BitWidth % NumSrcEltBits) == 0 &&
1925 TLO.DAG.getDataLayout().isLittleEndian()) {
1926 unsigned Scale = BitWidth / NumSrcEltBits;
1930 for (
unsigned i = 0; i != Scale; ++i) {
1931 unsigned Offset = i * NumSrcEltBits;
1934 DemandedSrcBits |= Sub;
1935 for (
unsigned j = 0; j != NumElts; ++j)
1936 if (DemandedElts[j])
1937 DemandedSrcElts.
setBit((j * Scale) + i);
1941 APInt KnownSrcUndef, KnownSrcZero;
1943 KnownSrcZero, TLO, Depth + 1))
1948 KnownSrcBits, TLO, Depth + 1))
1950 }
else if ((NumSrcEltBits % BitWidth) == 0 &&
1951 TLO.DAG.getDataLayout().isLittleEndian()) {
1952 unsigned Scale = NumSrcEltBits / BitWidth;
1956 for (
unsigned i = 0; i != NumElts; ++i)
1957 if (DemandedElts[i]) {
1958 unsigned Offset = (i % Scale) * BitWidth;
1959 DemandedSrcBits.
insertBits(DemandedBits, Offset);
1960 DemandedSrcElts.
setBit(i / Scale);
1964 APInt KnownSrcUndef, KnownSrcZero;
1966 KnownSrcZero, TLO, Depth + 1))
1972 KnownSrcBits, TLO, Depth + 1))
1979 Known = TLO.DAG.computeKnownBits(Op, DemandedElts, Depth);
2005 TLO.DAG.getNode(Op.
getOpcode(), dl, VT, Op0, Op1, Flags);
2006 return TLO.CombineTo(Op, NewOp);
2014 Op0, LoMask, DemandedElts, TLO.DAG, Depth + 1);
2016 Op1, LoMask, DemandedElts, TLO.DAG, Depth + 1);
2017 if (DemandedOp0 || DemandedOp1) {
2020 Op0 = DemandedOp0 ? DemandedOp0 : Op0;
2021 Op1 = DemandedOp1 ? DemandedOp1 : Op1;
2023 TLO.DAG.getNode(Op.
getOpcode(), dl, VT, Op0, Op1, Flags);
2024 return TLO.CombineTo(Op, NewOp);
2037 SDValue Neg1 = TLO.DAG.getAllOnesConstant(dl, VT);
2043 return TLO.CombineTo(Op, NewOp);
2057 Known = TLO.DAG.computeKnownBits(Op, DemandedElts, Depth);
2083 const APInt &DemandedElts,
2104 const APInt &UndefOp0,
2105 const APInt &UndefOp1) {
2108 "Vector binop only");
2113 UndefOp1.
getBitWidth() == NumElts &&
"Bad type for undef analysis");
2115 auto getUndefOrConstantElt = [&](
SDValue V,
unsigned Index,
2116 const APInt &UndefVals) {
2117 if (UndefVals[Index])
2120 if (
auto *BV = dyn_cast<BuildVectorSDNode>(V)) {
2125 if (isa<ConstantFPSDNode>(Elt) || Elt.
isUndef() || (
C && !
C->isOpaque()))
2133 for (
unsigned i = 0; i != NumElts; ++i) {
2142 if (C0 && C1 && C0.
getValueType() == EltVT && C1.getValueType() == EltVT)
2152 bool AssumeSingleUse)
const {
2154 APInt DemandedElts = OriginalDemandedElts;
2158 "Mask size mismatches value type element count!");
2164 KnownUndef.setAllBits();
2173 if (DemandedElts == 0) {
2174 KnownUndef.setAllBits();
2187 if (!DemandedElts[0]) {
2188 KnownUndef.setAllBits();
2191 KnownUndef.setHighBits(NumElts - 1);
2205 if (NumSrcElts == NumElts)
2207 KnownZero, TLO, Depth + 1);
2209 APInt SrcZero, SrcUndef;
2214 if ((NumElts % NumSrcElts) == 0) {
2215 unsigned Scale = NumElts / NumSrcElts;
2216 for (
unsigned i = 0; i != NumElts; ++i)
2217 if (DemandedElts[i])
2218 SrcDemandedElts.
setBit(i / Scale);
2230 for (
unsigned i = 0; i != NumElts; ++i)
2231 if (DemandedElts[i]) {
2232 unsigned Ofs = (i % Scale) * EltSizeInBits;
2233 SrcDemandedBits.
setBits(Ofs, Ofs + EltSizeInBits);
2243 for (
unsigned i = 0; i != NumSrcElts; ++i) {
2244 if (SrcDemandedElts[i]) {
2246 KnownZero.
setBits(i * Scale, (i + 1) * Scale);
2248 KnownUndef.setBits(i * Scale, (i + 1) * Scale);
2256 if ((NumSrcElts % NumElts) == 0) {
2257 unsigned Scale = NumSrcElts / NumElts;
2258 for (
unsigned i = 0; i != NumElts; ++i)
2259 if (DemandedElts[i])
2260 SrcDemandedElts.
setBits(i * Scale, (i + 1) * Scale);
2268 for (
unsigned i = 0; i != NumElts; ++i) {
2269 if (DemandedElts[i]) {
2273 KnownUndef.setBit(i);
2286 bool Updated =
false;
2287 for (
unsigned i = 0; i != NumElts; ++i) {
2288 if (!DemandedElts[i] && !Ops[i].
isUndef()) {
2290 KnownUndef.setBit(i);
2298 for (
unsigned i = 0; i != NumElts; ++i) {
2301 KnownUndef.setBit(i);
2313 for (
unsigned i = 0; i != NumSubVecs; ++i) {
2316 APInt SubUndef, SubZero;
2320 KnownUndef.
insertBits(SubUndef, i * NumSubElts);
2321 KnownZero.
insertBits(SubZero, i * NumSubElts);
2333 if (Idx.
ugt(NumElts - NumSubElts))
2337 APInt SubUndef, SubZero;
2341 APInt BaseElts = DemandedElts;
2345 if (!BaseElts && !Base.
isUndef())
2355 KnownUndef.insertBits(SubUndef, SubIdx);
2367 APInt SrcUndef, SrcZero;
2383 if (CIdx && CIdx->getAPIntValue().ult(NumElts)) {
2385 if (!DemandedElts[Idx])
2388 APInt DemandedVecElts(DemandedElts);
2391 KnownZero, TLO, Depth + 1))
2394 KnownUndef.clearBit(Idx);
2396 KnownUndef.setBit(Idx);
2404 APInt VecUndef, VecZero;
2418 APInt UnusedUndef, UnusedZero;
2420 UnusedZero, TLO, Depth + 1))
2424 APInt DemandedLHS(DemandedElts);
2425 APInt DemandedRHS(DemandedElts);
2426 APInt UndefLHS, ZeroLHS;
2427 APInt UndefRHS, ZeroRHS;
2429 ZeroLHS, TLO, Depth + 1))
2432 ZeroRHS, TLO, Depth + 1))
2435 KnownUndef = UndefLHS & UndefRHS;
2436 KnownZero = ZeroLHS & ZeroRHS;
2443 APInt DemandedLHS(NumElts, 0);
2444 APInt DemandedRHS(NumElts, 0);
2445 for (
unsigned i = 0; i != NumElts; ++i) {
2446 int M = ShuffleMask[i];
2447 if (M < 0 || !DemandedElts[i])
2449 assert(0 <= M && M < (
int)(2 * NumElts) &&
"Shuffle index out of range");
2450 if (M < (
int)NumElts)
2453 DemandedRHS.
setBit(M - NumElts);
2457 APInt UndefLHS, ZeroLHS;
2458 APInt UndefRHS, ZeroRHS;
2460 ZeroLHS, TLO, Depth + 1))
2463 ZeroRHS, TLO, Depth + 1))
2467 bool Updated =
false;
2468 bool IdentityLHS =
true, IdentityRHS =
true;
2470 for (
unsigned i = 0; i != NumElts; ++i) {
2471 int &M = NewMask[i];
2474 if (!DemandedElts[i] || (M < (
int)NumElts && UndefLHS[M]) ||
2475 (M >= (int)NumElts && UndefRHS[M - NumElts])) {
2479 IdentityLHS &= (M < 0) || (M == (
int)i);
2480 IdentityRHS &= (M < 0) || ((M - NumElts) == i);
2485 if (Updated && !IdentityLHS && !IdentityRHS && !TLO.LegalOps) {
2490 return TLO.CombineTo(Op, LegalShuffle);
2494 for (
unsigned i = 0; i != NumElts; ++i) {
2495 int M = ShuffleMask[i];
2497 KnownUndef.setBit(i);
2498 }
else if (M < (
int)NumElts) {
2500 KnownUndef.setBit(i);
2504 if (UndefRHS[M - NumElts])
2505 KnownUndef.setBit(i);
2506 if (ZeroRHS[M - NumElts])
2515 APInt SrcUndef, SrcZero;
2536 KnownUndef.clearAllBits();
2552 APInt UndefRHS, ZeroRHS;
2554 ZeroRHS, TLO, Depth + 1))
2556 APInt UndefLHS, ZeroLHS;
2558 ZeroLHS, TLO, Depth + 1))
2561 KnownZero = ZeroLHS & ZeroRHS;
2570 APInt UndefRHS, ZeroRHS;
2572 ZeroRHS, TLO, Depth + 1))
2574 APInt UndefLHS, ZeroLHS;
2576 ZeroLHS, TLO, Depth + 1))
2579 KnownZero = ZeroLHS;
2580 KnownUndef = UndefLHS & UndefRHS;
2585 APInt SrcUndef, SrcZero;
2587 SrcZero, TLO, Depth + 1))
2590 KnownZero, TLO, Depth + 1))
2597 KnownZero |= SrcZero;
2598 KnownUndef &= SrcUndef;
2599 KnownUndef &= ~KnownZero;
2606 KnownZero, TLO, Depth + 1))
2612 return TLO.CombineTo(Op, TLO.DAG.getConstant(0,
SDLoc(Op), VT));
2613 KnownUndef.clearAllBits();
2619 KnownZero, TLO, Depth))
2625 TLO, Depth, AssumeSingleUse))
2631 assert((KnownUndef & KnownZero) == 0 &&
"Elements flagged as undef AND zero");
2645 const APInt &DemandedElts,
2647 unsigned Depth)
const {
2652 "Should use MaskedValueIsZero if you don't know whether Op" 2653 " is a target node!");
2660 unsigned Depth)
const {
2666 const APInt &DemandedElts,
2668 unsigned Depth)
const {
2669 assert(isa<FrameIndexSDNode>(Op) &&
"expected FrameIndex");
2682 unsigned Depth)
const {
2687 "Should use ComputeNumSignBits if you don't know whether Op" 2688 " is a target node!");
2699 "Should use SimplifyDemandedVectorElts if you don't know whether Op" 2700 " is a target node!");
2711 "Should use SimplifyDemandedBits if you don't know whether Op" 2712 " is a target node!");
2725 "Should use SimplifyMultipleUseDemandedBits if you don't know whether Op" 2726 " is a target node!");
2754 unsigned Depth)
const {
2759 "Should use isKnownNeverNaN if you don't know whether Op" 2760 " is a target node!");
2772 if (
auto *CN = dyn_cast<ConstantSDNode>(N)) {
2773 CVal = CN->getAPIntValue();
2774 }
else if (
auto *BV = dyn_cast<BuildVectorSDNode>(N)) {
2775 auto *CN = BV->getConstantSplatNode();
2781 unsigned BVEltWidth = BV->getValueType(0).getScalarSizeInBits();
2782 CVal = CN->getAPIntValue();
2784 CVal = CVal.
trunc(BVEltWidth);
2881 return DAG.
getSetCC(DL, VT, N0, Zero, Cond);
2892 if (YConst && YConst->isNullValue())
2898 return DAG.
getSetCC(DL, VT, NewAnd, Zero, Cond);
2914 SDValue TargetLowering::optimizeSetCCOfSignedTruncationCheck(
2916 const SDLoc &DL)
const {
2919 if (!(C1 = dyn_cast<ConstantSDNode>(N1)))
2928 if (!(C01 = dyn_cast<ConstantSDNode>(N0->
getOperand(1))))
2956 auto checkConstants = [&I1, &I01]() ->
bool {
2961 if (checkConstants()) {
2969 if (!checkConstants())
2975 const unsigned KeptBits = I1.
logBase2();
2976 const unsigned KeptBitsMinusOne = I01.
logBase2();
2979 if (KeptBits != (KeptBitsMinusOne + 1))
2985 if (!DAG.getTargetLoweringInfo().shouldTransformSignedTruncationCheck(
2994 SDValue ShiftAmt = DAG.getConstant(MaskedBits, DL, XVT);
2997 SDValue T2 = DAG.getSetCC(DL, SCCVT, T1, X, NewCond);
3003 SDValue TargetLowering::optimizeSetCCByHoistingAndByConstFromLogicalShift(
3008 "Should be a comparison with 0.");
3010 "Valid only for [in]equality comparisons.");
3012 unsigned NewShiftOpcode;
3023 unsigned OldShiftOpcode = V.getOpcode();
3024 switch (OldShiftOpcode) {
3036 C = V.getOperand(0);
3041 Y = V.getOperand(1);
3045 return TLI.shouldProduceAndByConstByHoistingConstFromShiftsLHSOfAnd(
3046 X, XC, CC, Y, OldShiftOpcode, NewShiftOpcode, DAG);
3063 EVT VT = X.getValueType();
3081 "Unexpected binop");
3113 return DAG.
getSetCC(DL, VT, X, YShl1, Cond);
3121 const SDLoc &dl)
const {
3136 return DAG.
getSetCC(dl, VT, N1, N0, SwappedCC);
3147 return DAG.
getSetCC(dl, VT, N1, N0, SwappedCC);
3149 if (
auto *N1C = dyn_cast<ConstantSDNode>(N1.
getNode())) {
3150 const APInt &C1 = N1C->getAPIntValue();
3211 return DAG.
getNode(LogicOpcode, dl, VT, LHS, RHS);
3224 MinBits = N0->getOperand(0).getValueSizeInBits();
3226 }
else if (N0->getOpcode() ==
ISD::AND) {
3228 if (
auto *
C = dyn_cast<ConstantSDNode>(N0->getOperand(1)))
3229 if ((
C->getAPIntValue()+1).isPowerOf2()) {
3230 MinBits =
C->getAPIntValue().countTrailingOnes();
3235 MinBits = N0->getOperand(0).getValueSizeInBits();
3238 }
else if (
auto *LN0 = dyn_cast<LoadSDNode>(N0)) {
3241 MinBits = LN0->getMemoryVT().getSizeInBits();
3245 MinBits = LN0->getMemoryVT().getSizeInBits();
3251 unsigned ReqdBits = Signed ?
3258 MinBits >= ReqdBits) {
3263 if (MinBits == 1 && C1 == 1)
3268 return DAG.
getSetCC(dl, VT, Trunc, C, Cond);
3295 cast<CondCodeSDNode>(TopSetCC.
getOperand(2))->
get(),
3309 N0.getOpcode() ==
ISD::AND && C1 == 0 &&
3310 N0.getNode()->hasOneUse() &&
3311 isa<LoadSDNode>(N0.getOperand(0)) &&
3312 N0.getOperand(0).getNode()->hasOneUse() &&
3313 isa<ConstantSDNode>(N0.getOperand(1))) {
3314 LoadSDNode *Lod = cast<LoadSDNode>(N0.getOperand(0));
3316 unsigned bestWidth = 0, bestOffset = 0;
3318 unsigned origWidth = N0.getValueSizeInBits();
3319 unsigned maskWidth = origWidth;
3324 const APInt &
Mask = N0.getConstantOperandAPInt(1);
3325 for (
unsigned width = origWidth / 2; width>=8; width /= 2) {
3327 for (
unsigned offset=0; offset<origWidth/width; offset++) {
3330 bestOffset = (uint64_t)offset * (width/8);
3332 bestOffset = (origWidth/width - offset - 1) * (width/8);
3333 bestMask = Mask.
lshr(offset * (width/8) * 8);
3346 if (bestOffset != 0)
3368 C1.getBitWidth() - InSize))) {
3385 return DAG.
getConstant(C1.isNonNegative(), dl, VT);
3399 EVT newVT = N0.getOperand(0).getValueType();
3417 EVT ExtSrcTy = cast<VTSDNode>(N0.getOperand(1))->getVT();
3419 EVT ExtDstTy = N0.getValueType();
3424 if (C1.getMinSignedBits() > ExtSrcTyBits)
3428 EVT Op0Ty = N0.getOperand(0).getValueType();
3429 if (Op0Ty == ExtSrcTy) {
3439 return DAG.
getSetCC(dl, VT, ZextOp,
3445 }
else if ((N1C->isNullValue() || N1C->isOne()) &&
3450 (N0.getValueType() ==
MVT::i1 ||
3453 bool TrueWhenTrue = (Cond ==
ISD::SETEQ) ^ (!N1C->isOne());
3457 ISD::CondCode CC = cast<CondCodeSDNode>(N0.getOperand(2))->
get();
3461 return DAG.
getSetCC(dl, VT, N0.getOperand(0), N0.getOperand(1), CC);
3466 N0.getOperand(0).getOpcode() ==
ISD::XOR &&
3467 N0.getOperand(1) == N0.getOperand(0).getOperand(1))) &&
3468 isa<ConstantSDNode>(N0.getOperand(1)) &&
3469 cast<ConstantSDNode>(N0.getOperand(1))->isOne()) {
3482 N0.getOperand(0).getOpcode() ==
ISD::XOR);
3485 N0.getOperand(0).getOperand(0),
3489 return DAG.
getSetCC(dl, VT, Val, N1,
3492 }
else if (N1C->isOne()) {
3510 return DAG.
getSetCC(dl, VT, XorLHS, XorRHS, Cond);
3515 cast<ConstantSDNode>(Op0.
getOperand(1))->isOne()) {
3542 if (N0.getOpcode() ==
ISD::UREM && N1C->isNullValue() &&
3547 return DAG.
getSetCC(dl, VT, N0.getOperand(0), N1, Cond);
3551 optimizeSetCCOfSignedTruncationCheck(VT, N0, N1, Cond, DCI, dl))
3558 const APInt &C1 = N1C->getAPIntValue();
3560 APInt MinVal, MaxVal;
3650 if (
SDValue CC = optimizeSetCCByHoistingAndByConstFromLogicalShift(
3651 VT, N0, N1, Cond, DCI, dl))
3679 if (
auto *N1C = dyn_cast<ConstantSDNode>(N1.
getNode())) {
3681 const APInt &C1 = N1C->getAPIntValue();
3688 if (
auto *AndRHS = dyn_cast<ConstantSDNode>(N0.
getOperand(1))) {
3693 unsigned ShCt = AndRHS->getAPIntValue().logBase2();
3694 if (AndRHS->getAPIntValue().isPowerOf2() &&
3700 }
else if (Cond ==
ISD::SETEQ && C1 == AndRHS->getAPIntValue()) {
3720 if (
auto *AndRHS = dyn_cast<ConstantSDNode>(N0.
getOperand(1))) {
3721 const APInt &AndRHSC = AndRHS->getAPIntValue();
3722 if ((-AndRHSC).isPowerOf2() && (AndRHSC & C1) == C1) {
3729 return DAG.
getSetCC(dl, VT, Shift, CmpRHS, Cond);
3757 return DAG.
getSetCC(dl, VT, Shift, CmpRHS, NewCond);
3763 if (!isa<ConstantFPSDNode>(N0) && isa<ConstantFPSDNode>(N1)) {
3764 auto *CFP = cast<ConstantFPSDNode>(N1);
3765 assert(!CFP->getValueAPF().isNaN() &&
"Unexpected NaN value");
3772 return DAG.
getSetCC(dl, VT, N0, N0, Cond);
3790 if (CFP->getValueAPF().isInfinity()) {
3791 if (CFP->getValueAPF().isNegative()) {
3826 "Integer types should be handled by FoldSetCC");
3832 if (UOF ==
unsigned(EqTrue))
3837 if (NewCond != Cond &&
3840 return DAG.
getSetCC(dl, VT, N0, N1, NewCond);
3866 bool LegalRHSImm =
false;
3868 if (
auto *RHSC = dyn_cast<ConstantSDNode>(N1)) {
3869 if (
auto *LHSR = dyn_cast<ConstantSDNode>(N0.
getOperand(1))) {
3874 LHSR->getAPIntValue(),
3886 RHSC->getAPIntValue(),
3897 RHSC->getAPIntValue(),
3904 if (RHSC->getValueType(0).getSizeInBits() <= 64)
3913 if (
SDValue V = foldSetCCWithBinOp(VT, N0, N1, Cond, dl, DCI))
3919 if (
SDValue V = foldSetCCWithBinOp(VT, N1, N0, Cond, dl, DCI))
3922 if (
SDValue V = foldSetCCWithAnd(VT, N0, N1, Cond, dl, DCI))
3935 if (
SDValue Folded = buildUREMEqFold(VT, N0, N1, Cond, DCI, dl))
3938 if (
SDValue Folded = buildSREMEqFold(VT, N0, N1, Cond, DCI, dl))
3951 N0 = DAG.
getNOT(dl, Temp, OpVT);
3960 Temp = DAG.
getNOT(dl, N0, OpVT);
3967 Temp = DAG.
getNOT(dl, N1, OpVT);
3974 Temp = DAG.
getNOT(dl, N0, OpVT);
3981 Temp = DAG.
getNOT(dl, N1, OpVT);
3990 N0 = DAG.
getNode(ExtendCode, dl, VT, N0);
4006 if (
auto *GASD = dyn_cast<GlobalAddressSDNode>(N)) {
4007 GA = GASD->getGlobal();
4008 Offset += GASD->getOffset();
4016 if (
auto *V = dyn_cast<ConstantSDNode>(N2)) {
4017 Offset += V->getSExtValue();
4021 if (
auto *V = dyn_cast<ConstantSDNode>(N1)) {
4022 Offset += V->getSExtValue();
4043 unsigned S = Constraint.
size();
4046 switch (Constraint[0]) {
4076 if (S > 1 && Constraint[0] ==
'{' && Constraint[S - 1] ==
'}') {
4077 if (S == 8 && Constraint.
substr(1, 6) ==
"memory")
4104 std::string &Constraint,
4105 std::vector<SDValue> &Ops,
4108 if (Constraint.length() > 1)
return;
4110 char ConstraintLetter = Constraint[0];
4111 switch (ConstraintLetter) {
4135 if ((GA = dyn_cast<GlobalAddressSDNode>(Op)) && ConstraintLetter !=
'n') {
4140 }
else if ((C = dyn_cast<ConstantSDNode>(Op)) &&
4141 ConstraintLetter !=
's') {
4154 }
else if ((BA = dyn_cast<BlockAddressSDNode>(Op)) &&
4155 ConstraintLetter !=
'n') {
4163 if ((C = dyn_cast<ConstantSDNode>(Op.
getOperand(0))))
4167 (C = dyn_cast<ConstantSDNode>(Op.
getOperand(1))))
4182 std::pair<unsigned, const TargetRegisterClass *>
4186 if (Constraint.
empty() || Constraint[0] !=
'{')
4187 return std::make_pair(0u, static_cast<TargetRegisterClass *>(
nullptr));
4188 assert(*(Constraint.
end() - 1) ==
'}' &&
"Not a brace enclosed constraint?");
4193 std::pair<unsigned, const TargetRegisterClass *> R =
4194 std::make_pair(0u, static_cast<const TargetRegisterClass *>(
nullptr));
4206 std::pair<unsigned, const TargetRegisterClass *> S =
4207 std::make_pair(*
I, RC);
4229 assert(!ConstraintCode.empty() &&
"No known constraint!");
4230 return isdigit(static_cast<unsigned char>(ConstraintCode[0]));
4236 assert(!ConstraintCode.empty() &&
"No known constraint!");
4237 return atoi(ConstraintCode.c_str());
4252 unsigned maCount = 0;
4260 ConstraintOperands.emplace_back(std::move(CI));
4270 switch (OpInfo.
Type) {
4286 assert(ResNo == 0 &&
"Asm only has one result!");
4309 if (
StructType *STy = dyn_cast<StructType>(OpTy))
4310 if (STy->getNumElements() == 1)
4311 OpTy = STy->getElementType(0);
4329 }
else if (
PointerType *PT = dyn_cast<PointerType>(OpTy)) {
4339 if (!ConstraintOperands.empty()) {
4341 unsigned bestMAIndex = 0;
4342 int bestWeight = -1;
4348 for (maIndex = 0; maIndex < maCount; ++maIndex) {
4350 for (
unsigned cIndex = 0, eIndex = ConstraintOperands.size();
4351 cIndex != eIndex; ++cIndex) {
4377 weightSum += weight;
4380 if (weightSum > bestWeight) {
4381 bestWeight = weightSum;
4382 bestMAIndex = maIndex;
4387 for (
unsigned cIndex = 0, eIndex = ConstraintOperands.size();
4388 cIndex != eIndex; ++cIndex) {
4398 for (
unsigned cIndex = 0, eIndex = ConstraintOperands.size();
4399 cIndex != eIndex; ++cIndex) {
4410 std::pair<unsigned, const TargetRegisterClass *> MatchRC =
4413 std::pair<unsigned, const TargetRegisterClass *> InputRC =
4418 (MatchRC.second != InputRC.second)) {
4420 " with a matching output constraint of" 4421 " incompatible type!");
4427 return ConstraintOperands;
4455 rCodes = &info.
Codes;
4461 for (
unsigned i = 0,
e = rCodes->size(); i !=
e; ++i) {
4464 if (weight > BestWeight)
4465 BestWeight = weight;
4481 if (!CallOperandVal)
4484 switch (*constraint) {
4487 if (isa<ConstantInt>(CallOperandVal))
4491 if (isa<GlobalValue>(CallOperandVal))
4496 if (isa<ConstantFP>(CallOperandVal))
4543 assert(OpInfo.
Codes.size() > 1 &&
"Doesn't have multiple constraint options");
4544 unsigned BestIdx = 0;
4546 int BestGenerality = -1;
4549 for (
unsigned i = 0,
e = OpInfo.
Codes.size(); i !=
e; ++i) {
4566 "Unhandled multi-letter 'other' constraint");
4567 std::vector<SDValue> ResultOps;
4570 if (!ResultOps.empty()) {
4584 if (Generality > BestGenerality) {
4587 BestGenerality = Generality;
4600 assert(!OpInfo.
Codes.empty() &&
"Must have at least one constraint");
4603 if (OpInfo.
Codes.size() == 1) {
4616 if (isa<BasicBlock>(v) || isa<ConstantInt>(v) || isa<Function>(v)) {
4645 bool UseSRA =
false;
4649 if (
C->isNullValue())
4651 APInt Divisor =
C->getAPIntValue();
4659 APInt Factor = Divisor;
4660 while ((t = Divisor * Factor) != 1)
4677 Factor = Factors[0];
4709 bool IsAfterLegalization,
4730 if (
C->isNullValue())
4733 const APInt &Divisor =
C->getAPIntValue();
4735 int NumeratorFactor = 0;
4746 NumeratorFactor = 1;
4749 NumeratorFactor = -1;
4766 SDValue MagicFactor, Factor, Shift, ShiftMask;
4773 MagicFactor = MagicFactors[0];
4774 Factor = Factors[0];
4776 ShiftMask = ShiftMasks[0];
4805 SDValue SignShift = DAG.
getConstant(EltBits - 1, dl, ShVT);
4818 bool IsAfterLegalization,
4832 bool UseNPQ =
false;
4836 if (
C->isNullValue())
4840 APInt Divisor =
C->getAPIntValue();
4842 unsigned PreShift = 0, PostShift = 0;
4846 if (magics.
a != 0 && !Divisor[0]) {
4849 magics = Divisor.
lshr(PreShift).
magicu(PreShift);
4850 assert(magics.
a == 0 &&
"Should use cheap fixup now");
4858 "We shouldn't generate an undefined shift!");
4859 PostShift = magics.
s;
4862 PostShift = magics.
s - 1;
4884 SDValue PreShift, PostShift, MagicFactor, NPQFactor;
4891 PreShift = PreShifts[0];
4892 MagicFactor = MagicFactors[0];
4893 PostShift = PostShifts[0];
4915 Q = GetMULHU(Q, MagicFactor);
4928 NPQ = GetMULHU(NPQ, NPQFactor);
4943 return DAG.
getSelect(dl, VT, IsOne, N0, Q);
4957 if (SplatValue != Values.
end()) {
4960 return Value == *SplatValue ||
Predicate(Value);
4962 Replacement = *SplatValue;
4966 if (!AlternativeReplacement)
4969 Replacement = AlternativeReplacement;
4982 DAGCombinerInfo &DCI,
4983 const SDLoc &DL)
const {
4985 if (
SDValue Folded = prepareUREMEqFold(SETCCVT, REMNode, CompTargetNode, Cond,
4988 DCI.AddToWorklist(
N);
4996 TargetLowering::prepareUREMEqFold(
EVT SETCCVT,
SDValue REMNode,
4998 DAGCombinerInfo &DCI,
const SDLoc &DL,
5006 "Only applicable for (in)equality comparisons.");
5019 bool ComparingWithAllZeros =
true;
5020 bool AllComparisonsWithNonZerosAreTautological =
true;
5021 bool HadTautologicalLanes =
false;
5022 bool AllLanesAreTautological =
true;
5023 bool HadEvenDivisor =
false;
5024 bool AllDivisorsArePowerOfTwo =
true;
5025 bool HadTautologicalInvertedLanes =
false;
5034 const APInt &Cmp = CCmp->getAPIntValue();
5042 bool TautologicalInvertedLane = D.
ule(Cmp);
5043 HadTautologicalInvertedLanes |= TautologicalInvertedLane;
5048 bool TautologicalLane = D.
isOneValue() || TautologicalInvertedLane;
5049 HadTautologicalLanes |= TautologicalLane;
5050 AllLanesAreTautological &= TautologicalLane;
5056 AllComparisonsWithNonZerosAreTautological &= TautologicalLane;
5060 assert((!D.
isOneValue() || (K == 0)) &&
"For divisor '1' we won't rotate.");
5064 HadEvenDivisor |= (K != 0);
5067 AllDivisorsArePowerOfTwo &= D0.isOneValue();
5076 assert((D0 * P).isOneValue() &&
"Multiplicative inverse sanity check.");
5089 "We are expecting that K is always less than all-ones for ShSVT");
5092 if (TautologicalLane) {
5116 if (AllLanesAreTautological)
5121 if (AllDivisorsArePowerOfTwo)
5126 if (HadTautologicalLanes) {
5145 if (!ComparingWithAllZeros && !AllComparisonsWithNonZerosAreTautological) {
5149 "Expecting that the types on LHS and RHS of comparisons match.");
5159 if (HadEvenDivisor) {
5172 DAG.
getSetCC(DL, SETCCVT, Op0, QVal,
5174 if (!HadTautologicalInvertedLanes)
5180 assert(VT.
isVector() &&
"Can/should only get here for vectors.");
5187 SDValue TautologicalInvertedChannels =
5195 DL, SETCCVT, SETCCVT);
5197 Replacement, NewCC);
5203 TautologicalInvertedChannels);
5216 DAGCombinerInfo &DCI,
5217 const SDLoc &DL)
const {
5219 if (
SDValue Folded = prepareSREMEqFold(SETCCVT, REMNode, CompTargetNode, Cond,
5221 assert(Built.
size() <= 7 &&
"Max size prediction failed.");
5223 DCI.AddToWorklist(
N);
5231 TargetLowering::prepareSREMEqFold(
EVT SETCCVT,
SDValue REMNode,
5233 DAGCombinerInfo &DCI,
const SDLoc &DL,
5246 "Only applicable for (in)equality comparisons.");
5264 bool HadIntMinDivisor =
false;
5265 bool HadOneDivisor =
false;
5266 bool AllDivisorsAreOnes =
true;
5267 bool HadEvenDivisor =
false;
5268 bool NeedToApplyOffset =
false;
5269 bool AllDivisorsArePowerOfTwo =
true;
5274 if (
C->isNullValue())
5292 assert((!D.
isOneValue() || (K == 0)) &&
"For divisor '1' we won't rotate.");
5298 HadEvenDivisor |= (K != 0);
5303 AllDivisorsArePowerOfTwo &= D0.isOneValue();
5312 assert((D0 * P).isOneValue() &&
"Multiplicative inverse sanity check.");
5321 NeedToApplyOffset |= A != 0;
5328 "We are expecting that A is always less than all-ones for SVT");
5330 "We are expecting that K is always less than all-ones for ShSVT");
5360 if (AllDivisorsAreOnes)
5365 if (AllDivisorsArePowerOfTwo)
5368 SDValue PVal, AVal, KVal, QVal;
5370 if (HadOneDivisor) {
5399 if (NeedToApplyOffset) {
5411 if (HadEvenDivisor) {
5424 DAG.
getSetCC(DL, SETCCVT, Op0, QVal,
5428 if (!HadIntMinDivisor)
5434 assert(VT.
isVector() &&
"Can/should only get here for vectors.");
5473 if (!isa<ConstantSDNode>(Op.
getOperand(0))) {
5475 "be a constant integer");
5483 bool LegalOperations,
bool ForCodeSize,
5484 unsigned Depth)
const {
5503 if (!LegalOperations)
5515 return !
N.isUndef() && !isa<ConstantFPSDNode>(
N);
5518 if (!LegalOperations)
5524 return N.isUndef() ||
5539 ForCodeSize, Depth + 1))
5543 ForCodeSize, Depth + 1);
5556 ForCodeSize, Depth + 1))
5565 ForCodeSize, Depth + 1);
5575 ForCodeSize, Depth + 1);
5581 ForCodeSize, Depth + 1);
5583 ForCodeSize, Depth + 1);
5585 return V01 ?
std::max(V01, V2) : 0;
5592 ForCodeSize, Depth + 1);
5599 bool LegalOperations,
5601 unsigned Depth)
const {
5607 "getNegatedExpression doesn't match isNegatibleForFree");
5612 APFloat V = cast<ConstantFPSDNode>(
Op)->getValueAPF();
5623 APFloat V = cast<ConstantFPSDNode>(
C)->getValueAPF();
5632 "Expected NSZ fp-flag");
5639 LegalOperations, ForCodeSize,
5645 LegalOperations, ForCodeSize,
5652 if (N0CFP->isZero())
5666 LegalOperations, ForCodeSize,
5674 ForCodeSize, Depth + 1),
5681 "Expected NSZ fp-flag");
5684 ForCodeSize, Depth + 1);
5687 ForCodeSize, Depth + 1);
5689 ForCodeSize, Depth + 1);
5697 if (V0 > V1 || (V0 == V1 && isa<ConstantFPSDNode>(Op.
getOperand(0)))) {
5700 Op.
getOperand(0), DAG, LegalOperations, ForCodeSize, Depth + 1);
5707 ForCodeSize, Depth + 1);
5716 LegalOperations, ForCodeSize,
5721 LegalOperations, ForCodeSize,
5751 if (!HasMULHU && !HasMULHS && !HasUMUL_LOHI && !HasSMUL_LOHI)
5766 if ((
Signed && HasSMUL_LOHI) || (!
Signed && HasUMUL_LOHI)) {
5768 Hi =
SDValue(Lo.getNode(), 1);
5794 if (MakeMUL_LOHI(LL, RL, Lo, Hi,
false)) {
5807 RHSSB > InnerBitSize) {
5810 if (MakeMUL_LOHI(LL, RL, Lo, Hi,
true)) {
5817 unsigned ShiftAmount = OuterBitSize - InnerBitSize;
5839 if (!MakeMUL_LOHI(LL, RL, Lo, Hi,
false))
5862 if (!MakeMUL_LOHI(LL, RH, Lo, Hi,
false))
5869 if (!MakeMUL_LOHI(LH, RL, Lo, Hi,
false))
5923 DAG,
Kind, LL, LH, RL, RH);
5976 Result = DAG.
getSelect(DL, VT, IsZeroShift, IsFSHL ? X : Y, Or);
5997 Result = DAG.
getNode(RevRot, DL, VT, Op0, Sub);
6013 "Expecting the type bitwidth to be a power of 2");
6021 DAG.
getNode(HsOpc, DL, VT, Op0, And1));
6077 dl, Exponent, ExponentLoBit,
6166 { Chain, Src, FltOfs });
6188 Result = DAG.
getSelect(dl, DstVT, Sel, True, False);
6261 Result = DAG.
getSelect(dl, DstVT, SignBitTest, Slow, Fast);
6282 BitsToDouble(UINT64_C(0x4530000000100000)), dl, DstVT);
6296 {Node->
getOperand(0), HiFlt, TwoP84PlusTwoP52});
6298 {HiSub.
getValue(1), LoFlt, HiSub});
6340 unsigned IEEE2018Op =
6381 if (!(Len <= 128 && Len % 8 == 0))
6474 for (
unsigned i = 0; (1U << i) <= (NumBitsPerElt / 2); ++i) {
6479 Op = DAG.
getNOT(dl, Op, VT);
6560 std::pair<SDValue, SDValue>
6580 for (
unsigned Idx = 0; Idx < NumElem; ++Idx) {
6582 DAG.
getExtLoad(ExtType, SL, DstEltVT, Chain, BasePTR,
6589 Vals.push_back(ScalarLoad.
getValue(0));
6596 return std::make_pair(Value, NewChain);
6630 for (
unsigned Idx = 0; Idx < NumElem; ++Idx) {
6635 unsigned ShiftIntoIdx =
6651 assert(Stride &&
"Zero stride!");
6655 for (
unsigned Idx = 0; Idx < NumElem; ++Idx) {
6673 std::pair<SDValue, SDValue>
6676 "unaligned indexed loads not implemented!");
6702 return std::make_pair(Result, newLoad.
getValue(1));
6709 unsigned RegBytes = RegVT.getSizeInBits() / 8;
6710 unsigned NumRegs = (LoadedBytes + RegBytes - 1) / RegBytes;
6726 for (
unsigned i = 1; i < NumRegs; i++) {
6745 8 * (LoadedBytes -
Offset));
6767 return std::make_pair(Load, TF);
6771 "Unaligned load of unsupported type.");
6781 unsigned IncrementSize = NumBits / 8;
6796 Hi = DAG.
getExtLoad(HiExtType, dl, VT, Chain, Ptr,
6798 NewLoadedVT,
MinAlign(Alignment, IncrementSize),
6808 NewLoadedVT,
MinAlign(Alignment, IncrementSize),
6822 return std::make_pair(Result, TF);
6828 "unaligned indexed stores not implemented!");
6863 unsigned NumRegs = (StoredBytes + RegBytes - 1) / RegBytes;
6871 Chain, dl, Val, StackPtr,
6882 for (
unsigned i = 1; i < NumRegs; i++) {
6885 RegVT, dl, Store, StackPtr,
6920 "Unaligned store of unknown type.");
6924 int IncrementSize = NumBits / 8;
6940 Alignment =
MinAlign(Alignment, IncrementSize);
6955 bool IsCompressedMemory)
const {
6960 "Incompatible types of Data and Mask");
6961 if (IsCompressedMemory) {
6987 if (isa<ConstantSDNode>(Idx))
7015 "Converting bits to bytes lost precision");
7019 EVT IdxVT = Index.getValueType();
7040 std::string NameString = (
"__emutls_v." + GA->
getGlobal()->
getName()).str();
7044 assert(EmuTlsVar &&
"Cannot find EmuTlsVar ");
7046 Entry.
Ty = VoidPtrType;
7047 Args.push_back(Entry);
7054 std::pair<SDValue, SDValue> CallResult =
LowerCallTo(CLI);
7063 "Emulated TLS must have zero offset in GlobalAddressSDNode");
7064 return CallResult.first;
7114 unsigned OverflowOp;
7129 llvm_unreachable(
"Expected method to receive signed or unsigned saturation " 7130 "addition or subtraction node.");
7149 return DAG.
getSelect(dl, VT, Overflow, AllOnes, SumDiff);
7158 return DAG.
getSelect(dl, VT, Overflow, Zero, SumDiff);
7167 Result = DAG.
getSelect(dl, VT, SumNeg, SatMax, SatMin);
7168 return DAG.
getSelect(dl, VT, Overflow, Result, SumDiff);
7178 "Expected a fixed point multiplication opcode");
7209 Result = DAG.
getSelect(dl, VT, ProdNeg, SatMax, SatMin);
7210 return DAG.
getSelect(dl, VT, Overflow, Result, Product);
7219 return DAG.
getSelect(dl, VT, Overflow, SatMax, Product);
7223 assert(((Signed && Scale < VTSize) || (!Signed && Scale <= VTSize)) &&
7224 "Expected scale to be less than the number of bits if signed or at " 7225 "most the number of bits if unsigned.");
7227 "Expected both operands to be the same type");
7239 Hi = DAG.
getNode(HiOp, dl, VT, LHS, RHS);
7246 if (Scale == VTSize)
7293 return DAG.
getSelect(dl, VT, Overflow, ResultIfOverflow, Result);
7318 "Expected a fixed point division opcode");
7333 if (LHSLead + RHSTrail < Scale)
7336 unsigned LHSShift = std::min(LHSLead, Scale);
7337 unsigned RHSShift = Scale - LHSShift;
7404 { LHS, RHS, CarryIn });
7457 DAG.
getNode(
ISD::XOR, dl, OType, ConditionRHS, ResultLowerThanLHS), dl,
7458 ResultType, ResultType);
7472 const APInt &
C = RHSC->getAPIntValue();
7480 Overflow = DAG.
getSetCC(dl, SetCCVT,
7482 dl, VT, Result, ShiftAmt),
7495 static const unsigned Ops[2][3] =
7500 TopHalf = DAG.
getNode(Ops[isSigned][0], dl, VT, LHS, RHS);
7506 LHS = DAG.
getNode(Ops[isSigned][2], dl, WideVT, LHS);
7507 RHS = DAG.
getNode(Ops[isSigned][2], dl, WideVT, RHS);
7524 LC = RTLIB::MUL_I16;
7526 LC = RTLIB::MUL_I32;
7528 LC = RTLIB::MUL_I64;
7530 LC = RTLIB::MUL_I128;
7531 assert(LC != RTLIB::UNKNOWN_LIBCALL &&
"Cannot expand this operation!");
7558 CallOptions.
setSExt(isSigned);
7566 Ret =
makeLibCall(DAG, LC, WideVT, Args, CallOptions, dl).first;
7569 Ret =
makeLibCall(DAG, LC, WideVT, Args, CallOptions, dl).first;
7572 "Ret value is a collection of constituent nodes holding result.");
7583 Result = BottomHalf;
7591 Overflow = DAG.
getSetCC(dl, SetCCVT, TopHalf,
7601 "Unexpected result type for S/UMULO legalization");
7608 unsigned BaseOpcode = 0;
7642 Op = DAG.
getNode(BaseOpcode, dl, HalfVT, Lo, Hi);
7654 for (
unsigned i = 1; i < NumElts; i++)
7655 Res = DAG.
getNode(BaseOpcode, dl, EltVT, Res, Ops[i], Node->
getFlags());
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.
bool expandCTTZ(SDNode *N, SDValue &Result, SelectionDAG &DAG) const
Expand CTTZ/CTTZ_ZERO_UNDEF nodes.
unsigned Log2(Align A)
Returns the log2 of the alignment.
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 MVT getIntegerVT(unsigned BitWidth)
static APInt getKnownUndefForVectorBinop(SDValue BO, SelectionDAG &DAG, const APInt &UndefOp0, const APInt &UndefOp1)
Given a vector binary operation and known undefined elements for each input operand, compute whether each element of the output is undefined.
unsigned Log2_32_Ceil(uint32_t Value)
Return the ceil log base 2 of the specified value, 32 if the value is zero.
BUILTIN_OP_END - This must be the last enum value in this list.
A parsed version of the target data layout string in and methods for querying it. ...
FMINNUM/FMAXNUM - Perform floating-point minimum or maximum on two values.
virtual MVT getVectorIdxTy(const DataLayout &DL) const
Returns the type to be used for the index operand of: ISD::INSERT_VECTOR_ELT, ISD::EXTRACT_VECTOR_ELT...
EVT getValueType() const
Return the ValueType of the referenced return value.
bool isInteger() const
Return true if this is an integer or a vector integer type.
void setSignBit()
Set the sign bit to 1.
static void commuteMask(MutableArrayRef< int > Mask)
Change values in a shuffle permute mask assuming the two vector operands have swapped position...
static GCMetadataPrinterRegistry::Add< ErlangGCPrinter > X("erlang", "erlang-compatible garbage collector")
bool isSignMask() const
Check if the APInt's value is returned by getSignMask.
void setFlags(SDNodeFlags NewFlags)
opStatus convertFromAPInt(const APInt &Input, bool IsSigned, roundingMode RM)
bool hasNoSignedZeros() const
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
uint64_t getZExtValue() const
Get zero extended value.
MakeLibCallOptions & setTypeListBeforeSoften(ArrayRef< EVT > OpsVT, EVT RetVT, bool Value=true)
static APInt getAllOnesValue(unsigned numBits)
Get the all-ones value.
unsigned getOpcode() const
Return the SelectionDAG opcode value for this node.
bool isPow2VectorType() const
Returns true if the given vector is a power of 2.
void expandUADDSUBO(SDNode *Node, SDValue &Result, SDValue &Overflow, SelectionDAG &DAG) const
Method for building the DAG expansion of ISD::U(ADD|SUB)O.
void setBits(unsigned loBit, unsigned hiBit)
Set the bits from loBit (inclusive) to hiBit (exclusive) to 1.
virtual SDValue SimplifyMultipleUseDemandedBitsForTargetNode(SDValue Op, const APInt &DemandedBits, const APInt &DemandedElts, SelectionDAG &DAG, unsigned Depth) const
More limited version of SimplifyDemandedBits that can be used to "look through" ops that don't contri...
static const MCSymbolRefExpr * create(const MCSymbol *Symbol, MCContext &Ctx)
EXTRACT_SUBVECTOR(VECTOR, IDX) - Returns a subvector from VECTOR (an vector value) starting with the ...
CondCode getSetCCInverse(CondCode Operation, EVT Type)
Return the operation corresponding to !(X op Y), where 'op' is a valid SetCC operation.
LLVM_ATTRIBUTE_NORETURN void report_fatal_error(Error Err, bool gen_crash_diag=true)
Report a serious error, calling any installed error handler.
This class represents lattice values for constants.
Register getLocReg() const
FMINIMUM/FMAXIMUM - NaN-propagating minimum/maximum that also treat -0.0 as less than 0...
static void turnVectorIntoSplatVector(MutableArrayRef< SDValue > Values, std::function< bool(SDValue)> Predicate, SDValue AlternativeReplacement=SDValue())
If all values in Values that don't match the predicate are same 'splat' value, then replace all value...
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.
virtual MVT::SimpleValueType getCmpLibcallReturnType() const
Return the ValueType for comparison libcalls.
A Module instance is used to store all the information related to an LLVM module. ...
bool isSized(SmallPtrSetImpl< Type *> *Visited=nullptr) const
Return true if it makes sense to take the size of this type.
SDValue scalarizeVectorStore(StoreSDNode *ST, SelectionDAG &DAG) const
This structure is used to pass arguments to makeLibCall function.
Same as the corresponding unsaturated fixed point instructions, but the result is clamped between the...
bool hasConflict() const
Returns true if there is conflicting information.
ZERO_EXTEND_VECTOR_INREG(Vector) - This operator represents an in-register zero-extension of the low ...
virtual bool shouldExtendTypeInLibCall(EVT Type) const
Returns true if arguments should be extended in lib calls.
CallLoweringInfo & setIsPostTypeLegalization(bool Value=true)
MakeLibCallOptions & setIsPostTypeLegalization(bool Value=true)
const SDValue & getBasePtr() const
Carry-setting nodes for multiple precision addition and subtraction.
virtual unsigned getJumpTableEncoding() const
Return the entry encoding for a jump table in the current function.
void push_back(const T &Elt)
EVT getValueType(unsigned ResNo) const
Return the type of a specified result.
virtual void LowerAsmOperandForConstraint(SDValue Op, std::string &Constraint, std::vector< SDValue > &Ops, SelectionDAG &DAG) const
Lower the specified operand into the Ops vector.
void clearLowBits(unsigned loBits)
Set bottom loBits bits to 0.
TypeSize getSizeInBits() const
Returns the size of the specified MVT in bits.
EVT getHalfNumVectorElementsVT(LLVMContext &Context) const
APInt zext(unsigned width) const
Zero extend to a new width.
const SDValue & getValue() const
APInt udiv(const APInt &RHS) const
Unsigned division operation.
SDVTList getVTList() const
static APInt getLowBitsSet(unsigned numBits, unsigned loBitsSet)
Get a value with low bits set.
MVT getSimpleVT() const
Return the SimpleValueType held in the specified simple EVT.
bool expandCTLZ(SDNode *N, SDValue &Result, SelectionDAG &DAG) const
Expand CTLZ/CTLZ_ZERO_UNDEF nodes.
Libcall
RTLIB::Libcall enum - This enum defines all of the runtime library calls the backend can emit...
int MatchingInput
MatchingInput - If this is not -1, this is an output constraint where an input constraint is required...
virtual SDValue PerformDAGCombine(SDNode *N, DAGCombinerInfo &DCI) const
This method will be invoked for all target nodes and for any target-independent nodes that the target...
AAMDNodes getAAInfo() const
Returns the AA info that describes the dereference.
The two locations do not alias at all.
RESULT, BOOL = [SU]ADDO(LHS, RHS) - Overflow-aware nodes for addition.
bool isSubsetOf(const APInt &RHS) const
This operation checks that all bits set in this APInt are also set in RHS.
static ISD::NodeType getExtendForContent(BooleanContent Content)
const GlobalVariable * getNamedGlobal(StringRef Name) const
Return the global variable in the module with the specified name, of arbitrary type.
const SDValue & getChain() const
bool expandMULO(SDNode *Node, SDValue &Result, SDValue &Overflow, SelectionDAG &DAG) const
Method for building the DAG expansion of ISD::[US]MULO.
ISD::MemIndexedMode getAddressingMode() const
Return the addressing mode for this load or store: unindexed, pre-inc, pre-dec, post-inc, or post-dec.
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
CallLoweringInfo & setNoReturn(bool Value=true)
virtual std::pair< unsigned, const TargetRegisterClass * > getRegForInlineAsmConstraint(const TargetRegisterInfo *TRI, StringRef Constraint, MVT VT) const
Given a physical register constraint (e.g.
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 all_of(R &&range, UnaryPredicate P)
Provide wrappers to std::all_of which take ranges instead of having to pass begin/end explicitly...
C - The default llvm calling convention, compatible with C.
APInt trunc(unsigned width) const
Truncate to new width.
virtual const char * getTargetNodeName(unsigned Opcode) const
This method returns the name of a target specific DAG node.
void setAllBits()
Set every bit to 1.
unsigned getPointerSizeInBits(unsigned AS=0) const
Layout pointer size, in bits FIXME: The defaults need to be removed once all of the backends/clients ...
Constrained versions of the binary floating point operators.
unsigned const TargetRegisterInfo * TRI
virtual AsmOperandInfoVector ParseConstraints(const DataLayout &DL, const TargetRegisterInfo *TRI, ImmutableCallSite CS) const
Split up the constraint string from the inline assembly value into the specific constraints and their...
bool isInteger() const
Return true if this is an integer or a vector integer type.
Base class for all callable instructions (InvokeInst and CallInst) Holds everything related to callin...
TypeSize getScalarValueSizeInBits() const
CallLoweringInfo & setDebugLoc(const SDLoc &dl)
SDValue getSelect(const SDLoc &DL, EVT VT, SDValue Cond, SDValue LHS, SDValue RHS)
Helper function to make it easier to build Select's if you just have operands and don't want to check...
SIGN_EXTEND_VECTOR_INREG(Vector) - This operator represents an in-register sign-extension of the low ...
virtual bool shouldAvoidTransformToShift(EVT VT, unsigned Amount) const
Return true if creating a shift of the type by the given amount is not profitable.
virtual bool isTypeDesirableForOp(unsigned, EVT VT) const
Return true if the target has native support for the specified value type and it is 'desirable' to us...
[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
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
TypeSize getTypeSizeInBits(Type *Ty) const
Size examples:
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...
Value * CallOperandVal
If this is the result output operand or a clobber, this is null, otherwise it is the incoming operand...
bool isOperationLegalOrCustom(unsigned Op, EVT VT) const
Return true if the specified operation is legal on this target or can be made legal with custom lower...
void setAttributes(const CallBase *Call, unsigned ArgIdx)
Set CallLoweringInfo attribute flags based on a call instruction and called function attributes...
bool isByteSized() const
Return true if the bit size is a multiple of 8.
MachineMemOperand * getMemOperand() const
Return a MachineMemOperand object describing the memory reference performed by operation.
bool isTrueWhenEqual(CondCode Cond)
Return true if the specified condition returns true if the two operands to the condition are equal...
void setNoSignedZeros(bool b)
bool isConstTrueVal(const SDNode *N) const
Return if the N is a constant or constant vector equal to the true value from getBooleanContents().
INSERT_SUBVECTOR(VECTOR1, VECTOR2, IDX) - Returns a vector with VECTOR2 inserted into VECTOR1 at the ...
bool expandUINT_TO_FP(SDNode *N, SDValue &Result, SDValue &Chain, SelectionDAG &DAG) const
Expand UINT(i64) to double(f64) conversion.
CallLoweringInfo & setDiscardResult(bool Value=true)
unsigned getParamAlignment(unsigned ArgNo) const
Extract the alignment for a call or parameter (0=unknown).
virtual SDValue LowerToTLSEmulatedModel(const GlobalAddressSDNode *GA, SelectionDAG &DAG) const
Lower TLS global address SDNode for target independent emulated TLS model.
SDValue SimplifyMultipleUseDemandedBits(SDValue Op, const APInt &DemandedBits, const APInt &DemandedElts, SelectionDAG &DAG, unsigned Depth) const
More limited version of SimplifyDemandedBits that can be used to "look through" ops that don't contri...
virtual SDValue BuildSDIVPow2(SDNode *N, const APInt &Divisor, SelectionDAG &DAG, SmallVectorImpl< SDNode *> &Created) const
Targets may override this function to provide custom SDIV lowering for power-of-2 denominators...
unsigned getBitWidth() const
getBitWidth - Return the bitwidth of this constant.
Magic data for optimising unsigned division by a constant.
Select with condition operator - This selects between a true value and a false value (ops #2 and #3) ...
NodeType
ISD::NodeType enum - This enum defines the target-independent operators for a SelectionDAG.
bool hasOneUse() const
Return true if there is exactly one node using value ResNo of Node.
static APInt getSignedMaxValue(unsigned numBits)
Gets maximum signed value of APInt for a specific bit width.
bool hasAttribute(unsigned Index, Attribute::AttrKind Kind) const
Return true if the attribute exists at the given index.
INT = FGETSIGN(FP) - Return the sign bit of the specified floating point value as an integer 0/1 valu...
unsigned getBitWidth() const
Return the number of bits in the APInt.
SDValue BuildUDIV(SDNode *N, SelectionDAG &DAG, bool IsAfterLegalization, SmallVectorImpl< SDNode *> &Created) const
Given an ISD::UDIV node expressing a divide by constant, return a DAG expression to select that will ...
SDValue getExternalSymbol(const char *Sym, EVT VT)
bool isAllOnesValue() const
bool hasMatchingInput() const
hasMatchingInput - Return true if this is an output constraint that has a matching input constraint...
bool isCondCodeLegal(ISD::CondCode CC, MVT VT) const
Return true if the specified condition code is legal on this target.
ConstraintCodeVector Codes
Code - The constraint code, either the register name (in braces) or the constraint letter/number...
LLVMContext & getContext() const
Return the LLVMContext in which this type was uniqued.
virtual bool isFPExtFree(EVT DestVT, EVT SrcVT) const
Return true if an fpext operation is free (for instance, because single-precision floating-point numb...
RESULT,OUTCHAIN = INTRINSIC_W_CHAIN(INCHAIN, INTRINSICID, arg1, ...) This node represents a target in...
unsigned countMinTrailingZeros() const
Returns the minimum number of trailing zero bits.
virtual bool isCtlzFast() const
Return true if ctlz instruction is fast.
bool findOptimalMemOpLowering(std::vector< EVT > &MemOps, unsigned Limit, uint64_t Size, unsigned DstAlign, unsigned SrcAlign, bool IsMemset, bool ZeroMemset, bool MemcpyStrSrc, bool AllowOverlap, unsigned DstAS, unsigned SrcAS, const AttributeList &FuncAttributes) const
Determines the optimal series of memory ops to replace the memset / memcpy.
A convenience struct that encapsulates a DAG, and two SDValues for returning information from TargetL...
MVT getRegisterType(MVT VT) const
Return the type of registers that this ValueType will eventually require.
SDIVREM/UDIVREM - Divide two integers and produce both a quotient and remainder result.
bool isFloatingPoint() const
Return true if this is a FP or a vector FP type.
unsigned countTrailingZeros() const
Count the number of trailing zero bits.
static GCMetadataPrinterRegistry::Add< OcamlGCMetadataPrinter > Y("ocaml", "ocaml 3.10-compatible collector")
virtual unsigned ComputeNumSignBitsForTargetNode(SDValue Op, const APInt &DemandedElts, const SelectionDAG &DAG, unsigned Depth=0) const
This method can be implemented by targets that want to expose additional information about sign bits ...
unsigned getTargetFlags() const
void setNoSignedWrap(bool b)
ms magic() const
Calculate the magic numbers required to implement a signed integer division by a constant as a sequen...
std::vector< std::string > ConstraintCodeVector
bool hasOneUse() const
Return true if there is exactly one use of this node.
bool isBeforeLegalize() const
APInt getLoBits(unsigned numBits) const
Compute an APInt containing numBits lowbits from this APInt.
virtual bool isGAPlusOffset(SDNode *N, const GlobalValue *&GA, int64_t &Offset) const
Returns true (and the GlobalValue and the offset) if the node is a GlobalAddress + offset...
bool SimplifyDemandedVectorElts(SDValue Op, const APInt &DemandedEltMask, APInt &KnownUndef, APInt &KnownZero, TargetLoweringOpt &TLO, unsigned Depth=0, bool AssumeSingleUse=false) const
Look at Vector Op.
bool hasNoFPExcept() const
void setBit(unsigned BitPosition)
Set a given bit to 1.
static SDValue clampDynamicVectorIndex(SelectionDAG &DAG, SDValue Idx, EVT VecVT, const SDLoc &dl)
SDValue SimplifySetCC(EVT VT, SDValue N0, SDValue N1, ISD::CondCode Cond, bool foldBooleans, DAGCombinerInfo &DCI, const SDLoc &dl) const
Try to simplify a setcc built with the specified operands and cc.
ConstantSDNode * isConstOrConstSplat(SDValue N, bool AllowUndefs=false, bool AllowTruncation=false)
Returns the SDNode if it is a constant splat BuildVector or constant int.
APInt shl(unsigned shiftAmt) const
Left-shift function.
Shift and rotation operations.
bool matchUnaryPredicate(SDValue Op, std::function< bool(ConstantSDNode *)> Match, bool AllowUndefs=false)
Attempt to match a unary predicate against a scalar/splat constant or every element of a constant BUI...
Type * getTypeForEVT(LLVMContext &Context) const
This method returns an LLVM type corresponding to the specified EVT.
Class to represent struct types.
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...
ValTy * getCalledValue() const
Return the pointer to function that is being called.
TargetLowering::ConstraintType ConstraintType
Information about the constraint code, e.g.
SDValue getObjectPtrOffset(const SDLoc &SL, SDValue Ptr, int64_t Offset)
Create an add instruction with appropriate flags when used for addressing some offset of an object...
CallLoweringInfo & setChain(SDValue InChain)
BUILD_PAIR - This is the opposite of EXTRACT_ELEMENT in some ways.
RESULT = [US]MULFIX(LHS, RHS, SCALE) - Perform fixed point multiplication on 2 integers with the same...
This class consists of common code factored out of the SmallVector class to reduce code duplication b...
Base class for the full range of assembler expressions which are needed for parsing.
bool isIntegerTy() const
True if this is an instance of IntegerType.
op_iterator op_end() const
ISD::LoadExtType getExtensionType() const
Return whether this is a plain node, or one of the varieties of value-extending loads.
iterator_range< regclass_iterator > regclasses() const
virtual void computeKnownBitsForTargetInstr(GISelKnownBits &Analysis, Register R, KnownBits &Known, const APInt &DemandedElts, const MachineRegisterInfo &MRI, 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...
virtual const Constant * getTargetConstantFromLoad(LoadSDNode *LD) const
This method returns the constant pool value that will be loaded by LD.
The MachineFrameInfo class represents an abstract stack frame until prolog/epilog code is inserted...
SDValue getEntryNode() const
Return the token chain corresponding to the entry of the function.
virtual bool shouldUseStrictFP_TO_INT(EVT FpVT, EVT IntVT, bool IsSigned) const
Return true if it is more correct/profitable to use strict FP_TO_INT conversion operations - canonica...
TypeSize getValueSizeInBits() const
Returns the size of the value in bits.
const DataLayout & getDataLayout() const
Type * getType() const
Return the type of the instruction that generated this call site.
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
LLVM_NODISCARD StringRef substr(size_t Start, size_t N=npos) const
Return a reference to the substring from [Start, Start + N).
bool expandMUL(SDNode *N, SDValue &Lo, SDValue &Hi, EVT HiLoVT, SelectionDAG &DAG, MulExpansionKind Kind, SDValue LL=SDValue(), SDValue LH=SDValue(), SDValue RL=SDValue(), SDValue RH=SDValue()) const
Expand a MUL into two nodes.
LLVM_NODISCARD bool empty() const
empty - Check if the string is empty.
void lshrInPlace(unsigned ShiftAmt)
Logical right-shift this APInt by ShiftAmt in place.
SDValue FoldSetCC(EVT VT, SDValue N1, SDValue N2, ISD::CondCode Cond, const SDLoc &dl)
Constant fold a setcc to true or false.
This class defines information used to lower LLVM code to legal SelectionDAG operators that the targe...
bool paramHasAttr(unsigned ArgNo, Attribute::AttrKind Kind) const
Determine whether the argument or parameter has the given attribute.
bool ShrinkDemandedOp(SDValue Op, unsigned BitWidth, const APInt &Demanded, TargetLoweringOpt &TLO) const
Convert x+y to (VT)((SmallVT)x+(SmallVT)y) if the casts are free.
This represents a list of ValueType's that has been intern'd by a SelectionDAG.
SDValue getExtLoad(ISD::LoadExtType ExtType, const SDLoc &dl, EVT VT, SDValue Chain, SDValue Ptr, MachinePointerInfo PtrInfo, EVT MemVT, unsigned Alignment=0, MachineMemOperand::Flags MMOFlags=MachineMemOperand::MONone, const AAMDNodes &AAInfo=AAMDNodes())
KnownBits zextOrTrunc(unsigned BitWidth, bool ExtendedBitsAreKnownZero) const
Extends or truncates the underlying known Zero and One bits.
unsigned getLiveInPhysReg(unsigned VReg) const
getLiveInPhysReg - If VReg is a live-in virtual register, return the corresponding live-in physical r...
virtual bool isTruncateFree(Type *FromTy, Type *ToTy) const
Return true if it's free to truncate a value of type FromTy to type ToTy.
Context object for machine code objects.
void emitError(unsigned LocCookie, const Twine &ErrorStr)
emitError - Emit an error message to the currently installed error handler with optional location inf...
virtual EVT getOptimalMemOpType(uint64_t, unsigned, unsigned, bool, bool, bool, const AttributeList &) const
Returns the target specific optimal type for load and store operations as a result of memset...
unsigned getActiveBits() const
Compute the number of active bits in the value.
int64_t getSExtValue() const
SDValue expandFixedPointMul(SDNode *Node, SelectionDAG &DAG) const
Method for building the DAG expansion of ISD::[U|S]MULFIX[SAT].
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.
int64_t getSExtValue() const
Get sign extended value.
Type * getType() const
All values are typed, get the type of this value.
MachineFunction & getMachineFunction() const
[SU]INT_TO_FP - These operators convert integers (whose interpreted sign depends on the first letter)...
static SDNodeIterator begin(const SDNode *N)
EK_LabelDifference32 - Each entry is the address of the block minus the address of the jump table...
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.
SDValue peekThroughBitcasts(SDValue V)
Return the non-bitcasted source operand of V if it exists.
This contains information for each constraint that we are lowering.
Simple integer binary arithmetic operators.
STRICT_[US]INT_TO_FP - Convert a signed or unsigned integer to a floating point value.
int32_t exactLogBase2() const
APInt extractBits(unsigned numBits, unsigned bitPosition) const
Return an APInt with the extracted bits [bitPosition,bitPosition+numBits).
bool expandABS(SDNode *N, SDValue &Result, SelectionDAG &DAG) const
Expand ABS nodes.
SDValue getSetCC(const SDLoc &DL, EVT VT, SDValue LHS, SDValue RHS, ISD::CondCode Cond, SDValue Chain=SDValue(), bool IsSignaling=false)
Helper function to make it easier to build SetCC's if you just have an ISD::CondCode instead of an SD...
ArrayRef - Represent a constant reference to an array (0 or more elements consecutively in memory)...
EK_BlockAddress - Each entry is a plain address of block, e.g.
LLVM_NODISCARD size_t size() const
size - Get the string size.
bool isLittleEndian() const
Layout endianness...
CallLoweringInfo & setZExtResult(bool Value=true)
virtual bool shouldSplitFunctionArgumentsAsLittleEndian(const DataLayout &DL) const
For most targets, an LLVM type must be broken down into multiple smaller types.
SDValue getUNDEF(EVT VT)
Return an UNDEF node. UNDEF does not have a useful SDLoc.
AttributeList getAttributes() const
Return the attribute list for this Function.
virtual bool SimplifyDemandedVectorEltsForTargetNode(SDValue Op, const APInt &DemandedElts, APInt &KnownUndef, APInt &KnownZero, TargetLoweringOpt &TLO, unsigned Depth=0) const
Attempt to simplify any target nodes based on the demanded vector elements, returning true on success...
CondCode
ISD::CondCode enum - These are ordered carefully to make the bitfields below work out...
virtual SDValue LowerAsmOutputForConstraint(SDValue &Chain, SDValue &Flag, SDLoc DL, const AsmOperandInfo &OpInfo, SelectionDAG &DAG) const
op_iterator op_begin() const
TargetConstant* - Like Constant*, but the DAG does not do any folding, simplification, or lowering of the constant.
std::pair< SDValue, SDValue > expandUnalignedLoad(LoadSDNode *LD, SelectionDAG &DAG) const
Expands an unaligned load to 2 half-size loads for an integer, and possibly more for vectors...
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...
ConstraintPrefix Type
Type - The basic type of the constraint: input/output/clobber.
bool parametersInCSRMatch(const MachineRegisterInfo &MRI, const uint32_t *CallerPreservedMask, const SmallVectorImpl< CCValAssign > &ArgLocs, const SmallVectorImpl< SDValue > &OutVals) const
Check whether parameters to a call that are passed in callee saved registers are the same as from the...
bool isSignedIntSetCC(CondCode Code)
Return true if this is a setcc instruction that performs a signed comparison when used with integer o...
bool isTypeLegalForClass(const TargetRegisterClass &RC, MVT T) const
Return true if the given TargetRegisterClass has the ValueType T.
RESULT = INTRINSIC_WO_CHAIN(INTRINSICID, arg1, arg2, ...) This node represents a target intrinsic fun...
APInt reverseBits() const
Class to represent pointers.
virtual StringRef getRegAsmName(unsigned Reg) const
Return the assembly name for Reg.
This class is used to represent ISD::STORE nodes.
FP_TO_[US]INT - Convert a floating point value to a signed or unsigned integer.
Flag
These should be considered private to the implementation of the MCInstrDesc class.
BUILD_VECTOR(ELT0, ELT1, ELT2, ELT3,...) - Return a vector with the specified, possibly variable...
MVT getSimpleValueType() const
Return the simple ValueType of the referenced return value.
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 isVoidTy() const
Return true if this is 'void'.
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.
bool ShrinkDemandedConstant(SDValue Op, const APInt &Demanded, TargetLoweringOpt &TLO) const
Check to see if the specified operand of the specified instruction is a constant integer.
void insertBits(const APInt &SubBits, unsigned bitPosition)
Insert the bits from a smaller APInt starting at bitPosition.
bool isNegative() const
Determine sign of this APInt.
const SDValue & getBasePtr() const
EK_GPRel64BlockAddress - Each entry is an address of block, encoded with a relocation as gp-relative...
bool isSimple() const
Returns true if the memory operation is neither atomic or volatile.
SDValue getVectorShuffle(EVT VT, const SDLoc &dl, SDValue N1, SDValue N2, ArrayRef< int > Mask)
Return an ISD::VECTOR_SHUFFLE node.
int64_t getOffset() const
std::vector< AsmOperandInfo > AsmOperandInfoVector
OUTCHAIN = INTRINSIC_VOID(INCHAIN, INTRINSICID, arg1, arg2, ...) This node represents a target intrin...
These reductions are non-strict, and have a single vector operand.
MVT getSimpleValueType(const DataLayout &DL, Type *Ty, bool AllowUnknown=false) const
Return the MVT corresponding to this LLVM type. See getValueType.
bool isAllOnesValue() const
Determine if all bits are set.
virtual const char * LowerXConstraint(EVT ConstraintVT) const
Try to replace an X constraint, which matches anything, with another that has more specific requireme...
void expandSADDSUBO(SDNode *Node, SDValue &Result, SDValue &Overflow, SelectionDAG &DAG) const
Method for building the DAG expansion of ISD::S(ADD|SUB)O.
SDValue getVectorElementPointer(SelectionDAG &DAG, SDValue VecPtr, EVT VecVT, SDValue Index) const
Get a pointer to vector element Idx located in memory for a vector of type VecVT starting at a base a...
bool isStrictlyPositive() const
Determine if this APInt Value is positive.
unsigned const MachineRegisterInfo * MRI
MutableArrayRef - Represent a mutable reference to an array (0 or more elements consecutively in memo...
bool shouldAssumeDSOLocal(const Module &M, const GlobalValue *GV) const
constexpr bool isPowerOf2_32(uint32_t Value)
Return true if the argument is a power of two > 0.
The instances of the Type class are immutable: once they are created, they are never changed...
virtual ConstraintType getConstraintType(StringRef Constraint) const
Given a constraint, return the type of constraint it is for this target.
Simple binary floating point operators.
bool isIndirect
isIndirect - True if this operand is an indirect operand.
MachineFrameInfo & getFrameInfo()
getFrameInfo - Return the frame info object for the current function.
unsigned getVectorNumElements() const
Given a vector type, return the number of elements it contains.
size_t size() const
size - Get the array size.
static GCRegistry::Add< CoreCLRGC > E("coreclr", "CoreCLR-compatible GC")
This is an important base class in LLVM.
void resetAll()
Resets the known state of all bits.
iterator_range< value_op_iterator > op_values() const
bool isRound() const
Return true if the size is a power-of-two number of bytes.
const SDValue & getOperand(unsigned Num) const
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...
virtual bool SimplifyDemandedBitsForTargetNode(SDValue Op, const APInt &DemandedBits, const APInt &DemandedElts, KnownBits &Known, TargetLoweringOpt &TLO, unsigned Depth=0) const
Attempt to simplify any target nodes based on the demanded bits/elts, returning true on success...
virtual bool allowsMisalignedMemoryAccesses(EVT, unsigned AddrSpace=0, unsigned Align=1, MachineMemOperand::Flags Flags=MachineMemOperand::MONone, bool *=nullptr) const
Determine if the target supports unaligned memory accesses.
bool bitsLE(EVT VT) const
Return true if this has no more bits than VT.
Carry-using nodes for multiple precision addition and subtraction.
ValTy * getArgument(unsigned ArgNo) const
bool isKnownNeverSNaN(SDValue Op, unsigned Depth=0) const
bool isOneValue() const
Determine if this is a value of 1.
virtual SDValue unwrapAddress(SDValue N) const
static void ChooseConstraint(TargetLowering::AsmOperandInfo &OpInfo, const TargetLowering &TLI, SDValue Op, SelectionDAG *DAG)
If there are multiple different constraints that we could pick for this operand (e.g.
bool IsPostTypeLegalization
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.
static APInt getOneBitSet(unsigned numBits, unsigned BitNo)
Return an APInt with exactly one bit set in the result.
void AddToWorklist(SDNode *N)
SubConstraintInfoVector multipleAlternatives
multipleAlternatives - If there are multiple alternative constraints, this array will contain them...
bool isMinSignedValue() const
Determine if this is the smallest signed value.
std::pair< SDValue, SDValue > scalarizeVectorLoad(LoadSDNode *LD, SelectionDAG &DAG) const
Turn load of vector type into a load of the individual elements.
mu magicu(unsigned LeadingZeros=0) const
Calculate the magic numbers required to implement an unsigned integer division by a constant as a seq...
bool any_of(R &&range, UnaryPredicate P)
Provide wrappers to std::any_of which take ranges instead of having to pass begin/end explicitly...
virtual SDValue getNegatedExpression(SDValue Op, SelectionDAG &DAG, bool LegalOperations, bool ForCodeSize, unsigned Depth=0) const
If isNegatibleForFree returns true, return the newly negated expression.
virtual ConstraintWeight getSingleConstraintMatchWeight(AsmOperandInfo &info, const char *constraint) const
Examine constraint string and operand type and determine a weight value.
SDValue expandAddSubSat(SDNode *Node, SelectionDAG &DAG) const
Method for building the DAG expansion of ISD::[US][ADD|SUB]SAT.
bool CombineTo(SDValue O, SDValue N)
TypeSize getStoreSize() const
Return the number of bytes overwritten by a store of the specified value type.
MCSymbol * getJTISymbol(unsigned JTI, MCContext &Ctx, bool isLinkerPrivate=false) const
getJTISymbol - Return the MCSymbol for the specified non-empty jump table.
const APInt & getAPIntValue() const
bool isOperationLegalOrCustomOrPromote(unsigned Op, EVT VT) const
Return true if the specified operation is legal on this target or can be made legal with custom lower...
virtual bool targetShrinkDemandedConstant(SDValue Op, const APInt &Demanded, TargetLoweringOpt &TLO) const
unsigned getUnorderedFlavor(CondCode Cond)
This function returns 0 if the condition is always false if an operand is a NaN, 1 if the condition i...
CondCode getSetCCSwappedOperands(CondCode Operation)
Return the operation corresponding to (Y op X) when given the operation for (X op Y)...
static MVT getVT(Type *Ty, bool HandleUnknown=false)
Return the value type corresponding to the specified type.
bool isOperationLegal(unsigned Op, EVT VT) const
Return true if the specified operation is legal on this target.
bool isExtendedTrueVal(const ConstantSDNode *N, EVT VT, bool SExt) const
Return if N is a True value when extended to VT.
Bit counting operators with an undefined result for zero inputs.
ConstantSDNode * getConstantSplatNode(const APInt &DemandedElts, BitVector *UndefElements=nullptr) const
Returns the demanded splatted constant or null if this is not a constant splat.
X = FP_EXTEND(Y) - Extend a smaller FP type into a larger FP type.
virtual MVT getPointerTy(const DataLayout &DL, uint32_t AS=0) const
Return the pointer type for the given address space, defaults to the pointer type from the data layou...
auto find_if_not(R &&Range, UnaryPredicate P) -> decltype(adl_begin(Range))
std::vector< ArgListEntry > ArgListTy
bool isIntN(unsigned N, int64_t x)
Checks if an signed integer fits into the given (dynamic) bit width.
uint64_t NextPowerOf2(uint64_t A)
Returns the next power of two (in 64-bits) that is strictly greater than A.
SDValue buildLegalVectorShuffle(EVT VT, const SDLoc &DL, SDValue N0, SDValue N1, MutableArrayRef< int > Mask, SelectionDAG &DAG) const
Tries to build a legal vector shuffle using the provided parameters or equivalent variations...
TargetRegisterInfo base class - We assume that the target defines a static array of TargetRegisterDes...
SDValue expandFMINNUM_FMAXNUM(SDNode *N, SelectionDAG &DAG) const
Expand fminnum/fmaxnum into fminnum_ieee/fmaxnum_ieee with quieted inputs.
TypeSize getSizeInBits() const
Return the size of the specified value type in bits.
This structure contains all information that is necessary for lowering calls.
bool isPositionIndependent() const
virtual bool isUsedByReturnOnly(SDNode *, SDValue &) const
Return true if result of the specified node is used by a return node only.
SDValue getAllOnesConstant(const SDLoc &DL, EVT VT, bool IsTarget=false, bool IsOpaque=false)
bool isBeforeLegalizeOps() const
static PointerType * getInt8PtrTy(LLVMContext &C, unsigned AS=0)
const TargetMachine & getTargetMachine() const
#define llvm_unreachable(msg)
Marks that the current location is not supposed to be reachable.
EVT getValueType(const DataLayout &DL, Type *Ty, bool AllowUnknown=false) const
Return the EVT corresponding to this LLVM type.
std::string ConstraintCode
This contains the actual string for the code, like "m".
This struct is a compact representation of a valid (non-zero power of two) alignment.
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.
SDValue getTargetBlockAddress(const BlockAddress *BA, EVT VT, int64_t Offset=0, unsigned TargetFlags=0)
bool isUnindexed() const
Return true if this is NOT a pre/post inc/dec load/store.
ConstantFPSDNode * isConstOrConstSplatFP(SDValue N, bool AllowUndefs=false)
Returns the SDNode if it is a constant splat BuildVector or constant float.
This base class for TargetLowering contains the SelectionDAG-independent parts that can be used from ...
static const char *const Magic
const APInt & getConstantOperandAPInt(unsigned i) const
SDValue getBitcast(EVT VT, SDValue V)
Return a bitcast using the SDLoc of the value operand, and casting to the provided type...
static APInt getSignMask(unsigned BitWidth)
Get the SignMask for a specific bit width.
RESULT = [US]ADDSAT(LHS, RHS) - Perform saturation addition on 2 integers with the same bit width (W)...
static bool isUndef(ArrayRef< int > Mask)
SDValue expandVecReduce(SDNode *Node, SelectionDAG &DAG) const
Expand a VECREDUCE_* into an explicit calculation.
TokenFactor - This node takes multiple tokens as input and produces a single token result...
bool isLegalRC(const TargetRegisterInfo &TRI, const TargetRegisterClass &RC) const
Return true if the value types that can be represented by the specified register class are all legal...
static IntegerType * get(LLVMContext &C, unsigned NumBits)
This static method is the primary way of constructing an IntegerType.
const TargetLowering & getTargetLoweringInfo() const
void setNoUnsignedWrap(bool b)
SmallVectorImpl< T >::const_pointer c_str(SmallVectorImpl< T > &str)
SDValue getTargetGlobalAddress(const GlobalValue *GV, const SDLoc &DL, EVT VT, int64_t offset=0, unsigned TargetFlags=0)
SDValue getMemBasePlusOffset(SDValue Base, int64_t Offset, const SDLoc &DL, const SDNodeFlags Flags=SDNodeFlags())
Returns sum of the base pointer and offset.
virtual bool shouldReduceLoadWidth(SDNode *Load, ISD::LoadExtType ExtTy, EVT NewVT) const
Return true if it is profitable to reduce a load to a smaller type.
SDValue BuildSDIV(SDNode *N, SelectionDAG &DAG, bool IsAfterLegalization, SmallVectorImpl< SDNode *> &Created) const
Given an ISD::SDIV node expressing a divide by constant, return a DAG expression to select that will ...
virtual ConstraintWeight getMultipleConstraintMatchWeight(AsmOperandInfo &info, int maIndex) const
Examine constraint type and operand type and determine a weight value.
Returns platform specific canonical encoding of a floating point number.
Align max(MaybeAlign Lhs, Align Rhs)
SDValue lowerCmpEqZeroToCtlzSrl(SDValue Op, SelectionDAG &DAG) const
EXTRACT_VECTOR_ELT(VECTOR, IDX) - Returns a single element from VECTOR identified by the (potentially...
EVT getVectorElementType() const
Given a vector type, return the type of each element.
std::pair< SDValue, SDValue > SplitVector(const SDValue &N, const SDLoc &DL, const EVT &LoVT, const EVT &HiVT)
Split the vector with EXTRACT_SUBVECTOR using the provides VTs and return the low/high part...
This is used to represent a portion of an LLVM function in a low-level Data Dependence DAG representa...
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...
virtual SDValue getPICJumpTableRelocBase(SDValue Table, SelectionDAG &DAG) const
Returns relocation base for the given PIC jumptable.
This is a 'vector' (really, a variable-sized array), optimized for the case when the array is small...
bool expandCTPOP(SDNode *N, SDValue &Result, SelectionDAG &DAG) const
Expand CTPOP nodes.
MakeLibCallOptions & setSExt(bool Value=true)
SDValue getBuildVector(EVT VT, const SDLoc &DL, ArrayRef< SDValue > Ops)
Return an ISD::BUILD_VECTOR node.
bool SimplifyDemandedBits(SDValue Op, const APInt &DemandedBits, const APInt &DemandedElts, KnownBits &Known, TargetLoweringOpt &TLO, unsigned Depth=0, bool AssumeSingleUse=false) const
Look at Op.
static APInt getSplat(unsigned NewLen, const APInt &V)
Return a value containing V broadcasted over NewLen bits.
CCValAssign - Represent assignment of one arg/retval to a location.
void setNoFPExcept(bool b)
Predicate
Predicate - These are "(BI << 5) | BO" for various predicates.
FMINNUM_IEEE/FMAXNUM_IEEE - Perform floating-point minimum or maximum on two values, following the IEEE-754 2008 definition.
Byte Swap and Counting operators.
APFloat neg(APFloat X)
Returns the negated value of the argument.
bool isCalledByLegalizer() const
Wrapper class for IR location info (IR ordering and DebugLoc) to be passed into SDNode creation funct...
static APInt getMinValue(unsigned numBits)
Gets minimum unsigned value of APInt for a specific bit width.
void negate()
Negate this APInt in place.
CallLoweringInfo & setSExtResult(bool Value=true)
static GCRegistry::Add< StatepointGC > D("statepoint-example", "an example strategy for statepoint")
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.
SDValue IncrementMemoryAddress(SDValue Addr, SDValue Mask, const SDLoc &DL, EVT DataVT, SelectionDAG &DAG, bool IsCompressedMemory) const
Increments memory address Addr according to the type of the value DataVT that should be stored...
Represents one node in the SelectionDAG.
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...
void setAdjustsStack(bool V)
SDValue getNOT(const SDLoc &DL, SDValue Val, EVT VT)
Create a bitwise NOT operation as (XOR Val, -1).
bool isBitwiseNot(SDValue V, bool AllowUndefs=false)
Returns true if V is a bitwise not operation.
double BitsToDouble(uint64_t Bits)
This function takes a 64-bit integer and returns the bit equivalent double.
const Function & getFunction() const
Return the LLVM function that this machine code represents.
ArrayRef< EVT > OpsVTBeforeSoften
bool isConstFalseVal(const SDNode *N) const
Return if the N is a constant or constant vector equal to the false value from getBooleanContents().
unsigned logBase2() const
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.
unsigned countTrailingOnes() const
Count the number of trailing one bits.
static bool clobbersPhysReg(const uint32_t *RegMask, unsigned PhysReg)
clobbersPhysReg - Returns true if this RegMask clobbers PhysReg.
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.
virtual void ComputeConstraintToUse(AsmOperandInfo &OpInfo, SDValue Op, SelectionDAG *DAG=nullptr) const
Determines the constraint code and constraint type to use for the specific AsmOperandInfo, setting OpInfo.ConstraintCode and OpInfo.ConstraintType.
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.
amdgpu Simplify well known AMD library false FunctionCallee Callee
static unsigned getReg(const void *D, unsigned RC, unsigned RegNo)
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 expandFP_TO_UINT(SDNode *N, SDValue &Result, SDValue &Chain, SelectionDAG &DAG) const
Expand float to UINT conversion.
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.
ANY_EXTEND - Used for integer types. The high bits are undefined.
SDValue getGlobalAddress(const GlobalValue *GV, const SDLoc &DL, EVT VT, int64_t offset=0, bool isTargetGA=false, unsigned TargetFlags=0)
MulExpansionKind
Enum that specifies when a multiplication should be expanded.
SDValue expandUnalignedStore(StoreSDNode *ST, SelectionDAG &DAG) const
Expands an unaligned store to 2 half-size stores for integer values, and possibly more for vectors...
static APInt getMaxValue(unsigned numBits)
Gets maximum unsigned value of APInt for specific bit width.
MachineRegisterInfo - Keep track of information for virtual and physical registers, including vreg register classes, use/def chains for registers, etc.
virtual bool hasAndNotCompare(SDValue Y) const
Return true if the target should transform: (X & Y) == Y —> (~X & Y) == 0 (X & Y) != Y —> (~X & Y) ...
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.
bool hasNoSignedWrap() const
virtual bool isLegalICmpImmediate(int64_t) const
Return true if the specified immediate is legal icmp immediate, that is the target has icmp instructi...
static SDValue BuildExactSDIV(const TargetLowering &TLI, SDNode *N, const SDLoc &dl, SelectionDAG &DAG, SmallVectorImpl< SDNode *> &Created)
Given an exact SDIV by a constant, create a multiplication with the multiplicative inverse of the con...
bool matchBinaryPredicate(SDValue LHS, SDValue RHS, std::function< bool(ConstantSDNode *, ConstantSDNode *)> Match, bool AllowUndefs=false, bool AllowTypeMismatch=false)
Attempt to match a binary predicate against a pair of scalar/splat constants or every element of a pa...
virtual bool isFPImmLegal(const APFloat &, EVT, bool ForCodeSize=false) const
Returns true if the target can instruction select the specified FP immediate natively.
bool ugt(const APInt &RHS) const
Unsigned greater than comparison.
These are IR-level optimization flags that may be propagated to SDNodes.
Magic data for optimising signed division by a constant.
Type * getParamByValType(unsigned ArgNo) const
Extract the byval type for a call or parameter.
bool isVector() const
Return true if this is a vector value type.
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.
virtual char isNegatibleForFree(SDValue Op, SelectionDAG &DAG, bool LegalOperations, bool ForCodeSize, unsigned Depth=0) const
Return 1 if we can compute the negated form of the specified expression for the same cost as the expr...
SMUL_LOHI/UMUL_LOHI - Multiply two integers of type iN, producing a signed/unsigned value of type i[2...
StringRef getValueAsString() const
Return the attribute's value as a string.
bool isKnownToBeAPowerOfTwo(SDValue Val) const
Test if the given value is known to have exactly one bit set.
bool isPositionIndependent() const
SIGN_EXTEND_INREG - This operator atomically performs a SHL/SRA pair to sign extend a small value in ...
virtual bool isKnownNeverNaNForTargetNode(SDValue Op, const SelectionDAG &DAG, bool SNaN=false, unsigned Depth=0) const
If SNaN is false,.
LOAD and STORE have token chains as their first operand, then the same operands as an LLVM load/store...
StringRef getName() const
Return a constant reference to the value's name.
virtual EVT getSetCCResultType(const DataLayout &DL, LLVMContext &Context, EVT VT) const
Return the ValueType of the result of SETCC operations.
Establish a view to a call site for examination.
int64_t getOffset() const
bool expandMUL_LOHI(unsigned Opcode, EVT VT, SDLoc dl, SDValue LHS, SDValue RHS, SmallVectorImpl< SDValue > &Result, EVT HiLoVT, SelectionDAG &DAG, MulExpansionKind Kind, SDValue LL=SDValue(), SDValue LH=SDValue(), SDValue RL=SDValue(), SDValue RH=SDValue()) const
Expand a MUL or [US]MUL_LOHI of n-bit values into two or four nodes, respectively, each computing an n/2-bit part of the result.
const ConstantInt * getConstantIntValue() const
Flags getFlags() const
Return the raw flags of the source value,.
unsigned InferPtrAlignment(SDValue Ptr) const
Infer alignment of a load / store address.
bool isMatchingInputConstraint() const
Return true of this is an input operand that is a matching constraint like "4".
ISD::CondCode getCmpLibcallCC(RTLIB::Libcall Call) const
Get the CondCode that's to be used to test the result of the comparison libcall against zero...
unsigned getMatchedOperand() const
If this is an input matching constraint, this method returns the output operand it matches...
LLVM_NODISCARD std::enable_if<!is_simple_type< Y >::value, typename cast_retty< X, const Y >::ret_type >::type dyn_cast(const Y &Val)
RESULT = [US]SUBSAT(LHS, RHS) - Perform saturation subtraction on 2 integers with the same bit width ...
static constexpr unsigned MaxRecursionDepth
unsigned getOpcode() const
SDValue getValue(unsigned R) const
virtual bool isIntDivCheap(EVT VT, AttributeList Attr) const
Return true if integer divide is usually cheaper than a sequence of several shifts, adds, and multiplies for this target.
bool expandFunnelShift(SDNode *N, SDValue &Result, SelectionDAG &DAG) const
Expand funnel shift.
static unsigned getConstraintGenerality(TargetLowering::ConstraintType CT)
Return an integer indicating how general CT is.
SDValue expandFixedPointDiv(unsigned Opcode, const SDLoc &dl, SDValue LHS, SDValue RHS, unsigned Scale, SelectionDAG &DAG) const
Method for building the DAG expansion of ISD::[US]DIVFIX.
CopyFromReg - This node indicates that the input value is a virtual or physical register that is defi...
SDValue getConstant(uint64_t Val, const SDLoc &DL, EVT VT, bool isTarget=false, bool isOpaque=false)
Create a ConstantSDNode wrapping a constant value.
SDValue getGLOBAL_OFFSET_TABLE(EVT VT)
Return a GLOBAL_OFFSET_TABLE node. This does not have a useful SDLoc.
const MachinePointerInfo & getPointerInfo() const
bool isInTailCallPosition(SelectionDAG &DAG, SDNode *Node, SDValue &Chain) const
Check whether a given call node is in tail position within its function.
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.
LLVM_NODISCARD const char * data() const
data - Get a pointer to the start of the string (which may not be null terminated).
bool hasFnAttribute(Attribute::AttrKind Kind) const
Equivalent to hasAttribute(AttributeList::FunctionIndex, Kind) but may be faster. ...
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())
unsigned getMinSignedBits() const
Get the minimum bit size for this signed APInt.
bool isAllOnesConstant(SDValue V)
Returns true if V is an integer constant with all bits set.
static APInt getSignedMinValue(unsigned numBits)
Gets minimum signed value of APInt for a specific bit width.
unsigned getNumSignBits() const
Computes the number of leading bits of this APInt that are equal to its sign bit. ...
TypeSize getScalarSizeInBits() const
TargetLowering(const TargetLowering &)=delete
bool isSingleValueType() const
Return true if the type is a valid type for a register in codegen.
virtual bool isBinOp(unsigned Opcode) const
Return true if the node is a math/logic binary operator.
Module * getParent()
Get the module that this global value is contained inside of...
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.
Integer reductions may have a result type larger than the vector element type.
Fast - This calling convention attempts to make calls as fast as possible (e.g.
static void udivrem(const APInt &LHS, const APInt &RHS, APInt &Quotient, APInt &Remainder)
Dual division/remainder interface.
static SDNodeIterator end(const SDNode *N)
FMIN/FMAX nodes can have flags, for NaN/NoNaN variants.
EVT changeTypeToInteger()
Return the type converted to an equivalently sized integer or vector with integer element type...
bool isNullConstant(SDValue V)
Returns true if V is a constant integer zero.
SDValue getSelectCC(const SDLoc &DL, SDValue LHS, SDValue RHS, SDValue True, SDValue False, ISD::CondCode Cond)
Helper function to make it easier to build SelectCC's if you just have an ISD::CondCode instead of an...
#define LLVM_FALLTHROUGH
LLVM_FALLTHROUGH - Mark fallthrough cases in switch statements.
bool hasNoUnsignedWrap() const
std::pair< SDValue, SDValue > makeLibCall(SelectionDAG &DAG, RTLIB::Libcall LC, EVT RetVT, ArrayRef< SDValue > Ops, MakeLibCallOptions CallOptions, const SDLoc &dl, SDValue Chain=SDValue()) const
Returns a pair of (return value, chain).
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.
Attribute getFnAttribute(Attribute::AttrKind Kind) const
Return the attribute for the given attribute kind.
Primary interface to the complete machine description for the target machine.
unsigned countMinLeadingZeros() const
Returns the minimum number of leading zero bits.
print Print MemDeps of function
unsigned NoSignedZerosFPMath
NoSignedZerosFPMath - This flag is enabled when the -enable-no-signed-zeros-fp-math is specified on t...
StringRef - Represent a constant reference to a string, i.e.
FMAD - Perform a * b + c, while getting the same result as the separately rounded operations...
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.
EK_GPRel32BlockAddress - Each entry is an address of block, encoded with a relocation as gp-relative...
unsigned countLeadingZeros() const
The APInt version of the countLeadingZeros functions in MathExtras.h.
KnownBits computeKnownBits(SDValue Op, unsigned Depth=0) const
Determine which bits of Op are known to be either zero or one and return them in Known.
MVT ConstraintVT
The ValueType for the operand value.
MERGE_VALUES - This node takes multiple discrete operands and returns them all as its individual resu...
unsigned getNumOperands() const
virtual bool isShuffleMaskLegal(ArrayRef< int >, EVT) const
Targets can use this to indicate that they only support some VECTOR_SHUFFLE operations, those with specific masks.
bool isStrictFPOpcode()
Test if this node is a strict floating point pseudo-op.
BooleanContent
Enum that describes how the target represents true/false values.
static APInt getNullValue(unsigned numBits)
Get the '0' value.
const SDValue & getOperand(unsigned i) const
bool verifyReturnAddressArgumentIsConstant(SDValue Op, SelectionDAG &DAG) const
uint64_t getZExtValue() const
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).
for(unsigned i=Desc.getNumOperands(), e=OldMI.getNumOperands();i !=e;++i)
Unlike LLVM values, Selection DAG nodes may return multiple values as the result of a computation...
RESULT = [US]DIVFIX(LHS, RHS, SCALE) - Perform fixed point division on 2 integers with the same width...
bool expandROT(SDNode *N, SDValue &Result, SelectionDAG &DAG) const
Expand rotations.
Perform various unary floating-point operations inspired by libm.
static EVT getIntegerVT(LLVMContext &Context, unsigned BitWidth)
Returns the EVT that represents an integer with the given number of bits.
virtual bool shouldSignExtendTypeInLibCall(EVT Type, bool IsSigned) const
Returns true if arguments should be sign-extended in lib calls.
STRICT_FP_TO_[US]INT - Convert a floating point value to a signed or unsigned integer.
virtual const MCExpr * getPICJumpTableRelocBaseExpr(const MachineFunction *MF, unsigned JTI, MCContext &Ctx) const
This returns the relocation base for the given PIC jumptable, the same as getPICJumpTableRelocBase, but as an MCExpr.
LLVMContext * getContext() const
SCALAR_TO_VECTOR(VAL) - This represents the operation of loading a scalar value into element 0 of the...
constexpr char Args[]
Key for Kernel::Metadata::mArgs.
void setLowBits(unsigned loBits)
Set the bottom loBits bits.
Type * getElementType() const
CallLoweringInfo & setLibCallee(CallingConv::ID CC, Type *ResultType, SDValue Target, ArgListTy &&ArgsList)
void softenSetCCOperands(SelectionDAG &DAG, EVT VT, SDValue &NewLHS, SDValue &NewRHS, ISD::CondCode &CCCode, const SDLoc &DL, const SDValue OldLHS, const SDValue OldRHS) const
Soften the operands of a comparison.
EVT getShiftAmountTy(EVT LHSTy, const DataLayout &DL, bool LegalTypes=true) const
Carry-using nodes for multiple precision addition and subtraction.
EVT getHalfSizedIntegerVT(LLVMContext &Context) const
Finds the smallest simple value type that is greater than or equal to half the width of this EVT...
bool isNullValue() const
Determine if all bits are clear.
Wrapper class representing virtual and physical registers.
static ConstraintInfoVector ParseConstraints(StringRef ConstraintString)
ParseConstraints - Split up the constraint string into the specific constraints and their prefixes...
This file describes how to lower LLVM code to machine code.
void CommitTargetLoweringOpt(const TargetLoweringOpt &TLO)
const char * getLibcallName(RTLIB::Libcall Call) const
Get the libcall routine name for the specified libcall.
void selectAlternative(unsigned index)
selectAlternative - Point this constraint to the alternative constraint indicated by the index...
MULHU/MULHS - Multiply high - Multiply two integers of type iN, producing an unsigned/signed value of...
This class is used to represent ISD::LOAD nodes.
bool expandFP_TO_SINT(SDNode *N, SDValue &Result, SelectionDAG &DAG) const
Expand float(f32) to SINT(i64) conversion.