80 for (
unsigned I = 0,
E = ArgLocs.
size();
I !=
E; ++
I) {
120 std::pair<SDValue, SDValue>
123 const SDLoc &dl,
bool doesNotReturn,
124 bool isReturnValueUsed)
const {
126 Args.reserve(Ops.
size());
134 Args.push_back(Entry);
137 if (LC == RTLIB::UNKNOWN_LIBCALL)
148 .setNoReturn(doesNotReturn)
160 const SDLoc &dl)
const {
162 &&
"Unsupported setcc type!");
165 RTLIB::Libcall LC1 = RTLIB::UNKNOWN_LIBCALL, LC2 = RTLIB::UNKNOWN_LIBCALL;
166 bool ShouldInvertCC =
false;
170 LC1 = (VT ==
MVT::f32) ? RTLIB::OEQ_F32 :
172 (VT ==
MVT::f128) ? RTLIB::OEQ_F128 : RTLIB::OEQ_PPCF128;
176 LC1 = (VT ==
MVT::f32) ? RTLIB::UNE_F32 :
178 (VT ==
MVT::f128) ? RTLIB::UNE_F128 : RTLIB::UNE_PPCF128;
182 LC1 = (VT ==
MVT::f32) ? RTLIB::OGE_F32 :
184 (VT ==
MVT::f128) ? RTLIB::OGE_F128 : RTLIB::OGE_PPCF128;
188 LC1 = (VT ==
MVT::f32) ? RTLIB::OLT_F32 :
190 (VT ==
MVT::f128) ? RTLIB::OLT_F128 : RTLIB::OLT_PPCF128;
194 LC1 = (VT ==
MVT::f32) ? RTLIB::OLE_F32 :
196 (VT ==
MVT::f128) ? RTLIB::OLE_F128 : RTLIB::OLE_PPCF128;
200 LC1 = (VT ==
MVT::f32) ? RTLIB::OGT_F32 :
202 (VT ==
MVT::f128) ? RTLIB::OGT_F128 : RTLIB::OGT_PPCF128;
205 LC1 = (VT ==
MVT::f32) ? RTLIB::UO_F32 :
207 (VT ==
MVT::f128) ? RTLIB::UO_F128 : RTLIB::UO_PPCF128;
210 LC1 = (VT ==
MVT::f32) ? RTLIB::O_F32 :
212 (VT ==
MVT::f128) ? RTLIB::O_F128 : RTLIB::O_PPCF128;
216 LC1 = (VT ==
MVT::f32) ? RTLIB::OLT_F32 :
218 (VT ==
MVT::f128) ? RTLIB::OLT_F128 : RTLIB::OLT_PPCF128;
219 LC2 = (VT ==
MVT::f32) ? RTLIB::OGT_F32 :
221 (VT ==
MVT::f128) ? RTLIB::OGT_F128 : RTLIB::OGT_PPCF128;
224 LC1 = (VT ==
MVT::f32) ? RTLIB::UO_F32 :
226 (VT ==
MVT::f128) ? RTLIB::UO_F128 : RTLIB::UO_PPCF128;
227 LC2 = (VT ==
MVT::f32) ? RTLIB::OEQ_F32 :
229 (VT ==
MVT::f128) ? RTLIB::OEQ_F128 : RTLIB::OEQ_PPCF128;
233 ShouldInvertCC =
true;
236 LC1 = (VT ==
MVT::f32) ? RTLIB::OGE_F32 :
238 (VT ==
MVT::f128) ? RTLIB::OGE_F128 : RTLIB::OGE_PPCF128;
241 LC1 = (VT ==
MVT::f32) ? RTLIB::OGT_F32 :
243 (VT ==
MVT::f128) ? RTLIB::OGT_F128 : RTLIB::OGT_PPCF128;
246 LC1 = (VT ==
MVT::f32) ? RTLIB::OLE_F32 :
248 (VT ==
MVT::f128) ? RTLIB::OLE_F128 : RTLIB::OLE_PPCF128;
251 LC1 = (VT ==
MVT::f32) ? RTLIB::OLT_F32 :
253 (VT ==
MVT::f128) ? RTLIB::OLT_F128 : RTLIB::OLT_PPCF128;
261 SDValue Ops[2] = {NewLHS, NewRHS};
270 if (LC2 != RTLIB::UNKNOWN_LIBCALL) {
369 const APInt &
C = Op1C->getAPIntValue();
391 const APInt &Demanded,
394 "ShrinkDemandedOp only supports binary operators!");
396 "ShrinkDemandedOp only supports nodes with one result!");
414 unsigned SmallVTBits = DemandedSize;
417 for (; SmallVTBits < BitWidth; SmallVTBits =
NextPowerOf2(SmallVTBits)) {
426 assert(DemandedSize <= SmallVTBits &&
"Narrowed below demanded bits?");
453 bool AssumeSingleUse)
const {
472 unsigned Depth,
bool AssumeSingleUse)
const {
473 unsigned BitWidth = OriginalDemandedBits.
getBitWidth();
475 "Mask size mismatches value type size!");
477 unsigned NumElts = OriginalDemandedElts.
getBitWidth();
480 "Unexpected vector size");
483 APInt DemandedElts = OriginalDemandedElts;
492 Known.
One = cast<ConstantSDNode>(
Op)->getAPIntValue();
510 }
else if (OriginalDemandedBits == 0 || OriginalDemandedElts == 0) {
515 }
else if (Depth == 6) {
525 if (!isa<ConstantSDNode>(
SrcOp)) {
530 Known2.
One = cast<ConstantSDNode>(
SrcOp)->getAPIntValue();
536 "Expected BUILD_VECTOR implicit truncation");
537 Known2 = Known2.
trunc(BitWidth);
552 for (
unsigned i = 0; i != NumSubVecs; ++i) {
553 APInt DemandedSubElts =
554 DemandedElts.
extractBits(NumSubElts, i * NumSubElts);
556 Known2, TLO, Depth + 1))
559 if (!!DemandedSubElts) {
560 Known.
One &= Known2.One;
561 Known.
Zero &= Known2.Zero;
570 APInt DemandedLHS(NumElts, 0);
571 APInt DemandedRHS(NumElts, 0);
572 for (
unsigned i = 0; i != NumElts; ++i) {
573 if (!DemandedElts[i])
575 int M = ShuffleMask[i];
583 assert(0 <= M && M < (
int)(2 * NumElts) &&
"Shuffle index out of range");
584 if (M < (
int)NumElts)
587 DemandedRHS.
setBit(M - NumElts);
590 if (!!DemandedLHS || !!DemandedRHS) {
595 Known2, TLO, Depth + 1))
597 Known.
One &= Known2.One;
598 Known.
Zero &= Known2.Zero;
602 Known2, TLO, Depth + 1))
604 Known.
One &= Known2.One;
605 Known.
Zero &= Known2.Zero;
622 if ((LHSKnown.
Zero & DemandedBits) ==
623 (~RHSC->getAPIntValue() & DemandedBits))
637 LHSKnown.
One == ~RHSC->getAPIntValue()) {
742 if (
C->getAPIntValue() == Known2.
One) {
751 if (!
C->isAllOnesValue()) {
763 Known = std::move(KnownOut);
773 assert(!Known.hasConflict() &&
"Bits known to be one AND zero?");
774 assert(!Known2.hasConflict() &&
"Bits known to be one AND zero?");
781 Known.One &= Known2.One;
782 Known.Zero &= Known2.Zero;
791 assert(!Known.hasConflict() &&
"Bits known to be one AND zero?");
792 assert(!Known2.hasConflict() &&
"Bits known to be one AND zero?");
799 Known.One &= Known2.One;
800 Known.Zero &= Known2.Zero;
812 BooleanContent::ZeroOrNegativeOneBooleanContent) {
819 return TLO.CombineTo(Op, Op0);
827 Known.Zero.setBitsFrom(1);
836 if (SA->getAPIntValue().uge(BitWidth))
839 unsigned ShAmt = SA->getZExtValue();
848 if (SA2->getAPIntValue().ult(BitWidth)) {
849 unsigned C1 = SA2->getZExtValue();
851 int Diff = ShAmt - C1;
858 return TLO.CombineTo(
859 Op, TLO.DAG.getNode(Opc, dl, VT, Op0.
getOperand(0), NewSA));
875 if (ShAmt < InnerBits && DemandedBits.
getActiveBits() <= InnerBits &&
882 TLO.DAG.getConstant(ShAmt, dl, ShTy));
883 return TLO.CombineTo(
895 unsigned InnerShAmt = SA2->getLimitedValue(InnerBits);
896 if (InnerShAmt < ShAmt && InnerShAmt < InnerBits &&
898 (InnerBits - InnerShAmt + ShAmt) &&
900 SDValue NewSA = TLO.DAG.getConstant(ShAmt - InnerShAmt, dl,
904 return TLO.CombineTo(
911 Known.Zero <<= ShAmt;
914 Known.Zero.setLowBits(ShAmt);
924 if (SA->getAPIntValue().uge(BitWidth))
927 unsigned ShAmt = SA->getZExtValue();
928 APInt InDemandedMask = (DemandedBits << ShAmt);
942 if (SA2->getAPIntValue().ult(BitWidth)) {
943 unsigned C1 = SA2->getZExtValue();
945 int Diff = ShAmt - C1;
952 return TLO.CombineTo(
953 Op, TLO.DAG.getNode(Opc, dl, VT, Op0.
getOperand(0), NewSA));
962 assert(!Known.hasConflict() &&
"Bits known to be one AND zero?");
963 Known.Zero.lshrInPlace(ShAmt);
964 Known.One.lshrInPlace(ShAmt);
966 Known.Zero.setHighBits(ShAmt);
979 return TLO.CombineTo(Op, TLO.DAG.getNode(
ISD::SRL, dl, VT, Op0, Op1));
983 if (SA->getAPIntValue().uge(BitWidth))
986 unsigned ShAmt = SA->getZExtValue();
987 APInt InDemandedMask = (DemandedBits << ShAmt);
1001 assert(!Known.hasConflict() &&
"Bits known to be one AND zero?");
1002 Known.Zero.lshrInPlace(ShAmt);
1003 Known.One.lshrInPlace(ShAmt);
1007 if (Known.Zero[BitWidth - ShAmt - 1] ||
1011 return TLO.CombineTo(
1012 Op, TLO.DAG.getNode(
ISD::SRL, dl, VT, Op0, Op1, Flags));
1019 TLO.DAG.getConstant(BitWidth - 1 - Log2, dl, Op1.
getValueType());
1020 return TLO.CombineTo(Op, TLO.DAG.getNode(
ISD::SRL, dl, VT, Op0, NewSA));
1023 if (Known.One[BitWidth - ShAmt - 1])
1025 Known.One.setHighBits(ShAmt);
1036 bool AlreadySignExtended =
1037 TLO.DAG.ComputeNumSignBits(Op0) >= BitWidth - ExVTBits + 1;
1040 if (!AlreadySignExtended) {
1043 EVT ShiftAmtTy = VT;
1044 if (TLO.LegalTypes() && !ShiftAmtTy.
isVector())
1048 TLO.DAG.getConstant(BitWidth - ExVTBits, dl, ShiftAmtTy);
1049 return TLO.CombineTo(Op,
1050 TLO.DAG.getNode(
ISD::SHL, dl, VT, Op0, ShiftAmt));
1056 return TLO.CombineTo(Op, Op0);
1062 InputDemandedBits.
setBit(ExVTBits - 1);
1066 assert(!Known.hasConflict() &&
"Bits known to be one AND zero?");
1072 if (Known.Zero[ExVTBits - 1])
1073 return TLO.CombineTo(
1074 Op, TLO.DAG.getZeroExtendInReg(Op0, dl, ExVT.
getScalarType()));
1077 if (Known.One[ExVTBits - 1]) {
1078 Known.One.setBitsFrom(ExVTBits);
1101 Known.Zero = KnownLo.Zero.zext(BitWidth) |
1102 KnownHi.Zero.zext(BitWidth).shl(HalfBitWidth);
1104 Known.One = KnownLo.One.zext(BitWidth) |
1105 KnownHi.One.zext(BitWidth).shl(HalfBitWidth);
1114 return TLO.CombineTo(Op, TLO.DAG.getNode(
ISD::ANY_EXTEND, dl, VT, Src));
1116 APInt InDemandedBits = DemandedBits.
trunc(InBits);
1119 assert(!Known.hasConflict() &&
"Bits known to be one AND zero?");
1120 Known = Known.zext(BitWidth);
1121 Known.Zero.setBitsFrom(InBits);
1130 return TLO.CombineTo(Op, TLO.DAG.getNode(
ISD::ANY_EXTEND, dl, VT, Src));
1134 APInt InDemandedBits = DemandedBits.
trunc(InBits);
1135 InDemandedBits.
setBit(InBits - 1);
1139 assert(!Known.hasConflict() &&
"Bits known to be one AND zero?");
1141 Known = Known.sext(BitWidth);
1144 if (Known.isNonNegative())
1153 APInt InDemandedBits = DemandedBits.
trunc(InBits);
1158 InDemandedBits.
setBit(InBits - 1);
1162 assert(!Known.hasConflict() &&
"Bits known to be one AND zero?");
1164 Known = Known.sext(BitWidth);
1170 APInt InDemandedBits = DemandedBits.
trunc(InBits);
1173 assert(!Known.hasConflict() &&
"Bits known to be one AND zero?");
1174 Known = Known.zext(BitWidth);
1183 APInt TruncMask = DemandedBits.
zext(OperandBitWidth);
1186 Known = Known.trunc(BitWidth);
1205 if (TLO.LegalTypes()) {
1212 OperandBitWidth - BitWidth);
1214 HighBits = HighBits.
trunc(BitWidth);
1216 if (!(HighBits & DemandedBits)) {
1221 return TLO.CombineTo(
1222 Op, TLO.DAG.getNode(
ISD::SRL, dl, VT, NewTrunc, Shift));
1229 assert(!Known.hasConflict() &&
"Bits known to be one AND zero?");
1238 Known, TLO, Depth+1))
1240 assert(!Known.hasConflict() &&
"Bits known to be one AND zero?");
1242 Known.Zero |= ~InMask;
1253 if (
auto *CIdx = dyn_cast<ConstantSDNode>(Idx))
1254 if (CIdx->getAPIntValue().ult(NumSrcElts))
1259 APInt DemandedSrcBits = DemandedBits;
1260 if (BitWidth > EltBitWidth)
1261 DemandedSrcBits = DemandedSrcBits.
trunc(EltBitWidth);
1268 if (BitWidth > EltBitWidth)
1269 Known = Known.zext(BitWidth);
1292 if (!OpVTLegal && OpVTSizeInBits > 32)
1295 SDValue ShAmt = TLO.DAG.getConstant(ShVal, dl, VT);
1296 return TLO.CombineTo(Op,
1297 TLO.DAG.getNode(
ISD::SHL, dl, VT, Sign, ShAmt));
1304 if (SrcVT.
isVector() && NumSrcEltBits > 1 &&
1305 (BitWidth % NumSrcEltBits) == 0 &&
1306 TLO.DAG.getDataLayout().isLittleEndian()) {
1307 unsigned Scale = BitWidth / NumSrcEltBits;
1308 auto GetDemandedSubMask = [&](
APInt &DemandedSubElts) ->
bool {
1310 for (
unsigned i = 0; i != Scale; ++i) {
1311 unsigned Offset = i * NumSrcEltBits;
1314 DemandedSubElts.
setBit(i);
1319 APInt DemandedSubElts;
1320 if (GetDemandedSubMask(DemandedSubElts)) {
1324 APInt KnownUndef, KnownZero;
1333 Known = TLO.DAG.computeKnownBits(Op, Depth);
1358 return TLO.CombineTo(Op, NewOp);
1372 SDValue Neg1 = TLO.DAG.getAllOnesConstant(dl, VT);
1380 return TLO.CombineTo(Op, NewOp);
1394 Known = TLO.DAG.computeKnownBits(Op, DemandedElts, Depth);
1420 const APInt &DemandedElts,
1440 bool AssumeSingleUse)
const {
1442 APInt DemandedElts = DemandedEltMask;
1446 "Mask size mismatches value type element count!");
1452 KnownUndef.setAllBits();
1461 if (DemandedElts == 0) {
1462 KnownUndef.setAllBits();
1475 if (!DemandedElts[0]) {
1476 KnownUndef.setAllBits();
1479 KnownUndef.setHighBits(NumElts - 1);
1493 if (NumSrcElts == NumElts)
1495 KnownZero, TLO, Depth + 1);
1497 APInt SrcZero, SrcUndef;
1502 if ((NumElts % NumSrcElts) == 0) {
1503 unsigned Scale = NumElts / NumSrcElts;
1504 for (
unsigned i = 0; i != NumElts; ++i)
1505 if (DemandedElts[i])
1506 SrcDemandedElts.
setBit(i / Scale);
1518 for (
unsigned i = 0; i != NumElts; ++i)
1519 if (DemandedElts[i]) {
1520 unsigned Ofs = (i % Scale) * EltSizeInBits;
1521 SrcDemandedBits.
setBits(Ofs, Ofs + EltSizeInBits);
1531 for (
unsigned i = 0; i != NumSrcElts; ++i) {
1532 if (SrcDemandedElts[i]) {
1534 KnownZero.
setBits(i * Scale, (i + 1) * Scale);
1536 KnownUndef.setBits(i * Scale, (i + 1) * Scale);
1544 if ((NumSrcElts % NumElts) == 0) {
1545 unsigned Scale = NumSrcElts / NumElts;
1546 for (
unsigned i = 0; i != NumElts; ++i)
1547 if (DemandedElts[i])
1548 SrcDemandedElts.
setBits(i * Scale, (i + 1) * Scale);
1556 for (
unsigned i = 0; i != NumElts; ++i) {
1557 if (DemandedElts[i]) {
1561 KnownUndef.setBit(i);
1574 bool Updated =
false;
1575 for (
unsigned i = 0; i != NumElts; ++i) {
1576 if (!DemandedElts[i] && !Ops[i].
isUndef()) {
1578 KnownUndef.setBit(i);
1586 for (
unsigned i = 0; i != NumElts; ++i) {
1589 KnownUndef.setBit(i);
1601 for (
unsigned i = 0; i != NumSubVecs; ++i) {
1604 APInt SubUndef, SubZero;
1608 KnownUndef.
insertBits(SubUndef, i * NumSubElts);
1609 KnownZero.
insertBits(SubZero, i * NumSubElts);
1620 const APInt& Idx = cast<ConstantSDNode>(Op.
getOperand(2))->getAPIntValue();
1621 if (Idx.
ugt(NumElts - NumSubElts))
1625 APInt SubUndef, SubZero;
1629 APInt BaseElts = DemandedElts;
1634 KnownUndef.insertBits(SubUndef, SubIdx);
1646 APInt SrcUndef, SrcZero;
1662 if (CIdx && CIdx->getAPIntValue().ult(NumElts)) {
1664 if (!DemandedElts[Idx])
1667 APInt DemandedVecElts(DemandedElts);
1670 KnownZero, TLO, Depth + 1))
1673 KnownUndef.clearBit(Idx);
1675 KnownUndef.setBit(Idx);
1683 APInt VecUndef, VecZero;
1697 APInt UnusedUndef, UnusedZero;
1699 UnusedZero, TLO, Depth + 1))
1703 APInt DemandedLHS(DemandedElts);
1704 APInt DemandedRHS(DemandedElts);
1705 APInt UndefLHS, ZeroLHS;
1706 APInt UndefRHS, ZeroRHS;
1708 ZeroLHS, TLO, Depth + 1))
1711 ZeroRHS, TLO, Depth + 1))
1714 KnownUndef = UndefLHS & UndefRHS;
1715 KnownZero = ZeroLHS & ZeroRHS;
1722 APInt DemandedLHS(NumElts, 0);
1723 APInt DemandedRHS(NumElts, 0);
1724 for (
unsigned i = 0; i != NumElts; ++i) {
1725 int M = ShuffleMask[i];
1726 if (M < 0 || !DemandedElts[i])
1728 assert(0 <= M && M < (
int)(2 * NumElts) &&
"Shuffle index out of range");
1729 if (M < (
int)NumElts)
1732 DemandedRHS.
setBit(M - NumElts);
1736 APInt UndefLHS, ZeroLHS;
1737 APInt UndefRHS, ZeroRHS;
1739 ZeroLHS, TLO, Depth + 1))
1742 ZeroRHS, TLO, Depth + 1))
1746 bool Updated =
false;
1747 bool IdentityLHS =
true, IdentityRHS =
true;
1749 for (
unsigned i = 0; i != NumElts; ++i) {
1750 int &M = NewMask[i];
1753 if (!DemandedElts[i] || (M < (
int)NumElts && UndefLHS[M]) ||
1754 (M >= (int)NumElts && UndefRHS[M - NumElts])) {
1758 IdentityLHS &= (M < 0) || (M == (
int)i);
1759 IdentityRHS &= (M < 0) || ((M - NumElts) == i);
1764 if (Updated && !IdentityLHS && !IdentityRHS && !TLO.LegalOps &&
1766 return TLO.CombineTo(Op,
1767 TLO.DAG.getVectorShuffle(VT, DL, Op.
getOperand(0),
1771 for (
unsigned i = 0; i != NumElts; ++i) {
1772 int M = ShuffleMask[i];
1774 KnownUndef.setBit(i);
1775 }
else if (M < (
int)NumElts) {
1777 KnownUndef.setBit(i);
1781 if (UndefRHS[M - NumElts])
1782 KnownUndef.setBit(i);
1783 if (ZeroRHS[M - NumElts])
1791 APInt SrcUndef, SrcZero;
1796 SrcZero, TLO, Depth + 1))
1805 KnownUndef.clearAllBits();
1818 APInt SrcUndef, SrcZero;
1820 SrcZero, TLO, Depth + 1))
1823 KnownZero, TLO, Depth + 1))
1825 KnownZero &= SrcZero;
1826 KnownUndef &= SrcUndef;
1830 APInt SrcUndef, SrcZero;
1832 SrcZero, TLO, Depth + 1))
1835 KnownZero, TLO, Depth + 1))
1840 KnownZero |= SrcZero;
1841 KnownUndef &= SrcUndef;
1842 KnownUndef &= ~KnownZero;
1849 KnownZero, TLO, Depth + 1))
1855 return TLO.CombineTo(Op, TLO.DAG.getConstant(0,
SDLoc(Op), VT));
1856 KnownUndef.clearAllBits();
1862 KnownZero, TLO, Depth))
1868 Depth, AssumeSingleUse))
1874 assert((KnownUndef & KnownZero) == 0 &&
"Elements flagged as undef AND zero");
1888 const APInt &DemandedElts,
1890 unsigned Depth)
const {
1895 "Should use MaskedValueIsZero if you don't know whether Op" 1896 " is a target node!");
1902 const APInt &DemandedElts,
1904 unsigned Depth)
const {
1905 assert(isa<FrameIndexSDNode>(Op) &&
"expected FrameIndex");
1918 unsigned Depth)
const {
1923 "Should use ComputeNumSignBits if you don't know whether Op" 1924 " is a target node!");
1935 "Should use SimplifyDemandedVectorElts if you don't know whether Op" 1936 " is a target node!");
1947 "Should use SimplifyDemandedBits if you don't know whether Op" 1948 " is a target node!");
1956 unsigned Depth)
const {
1961 "Should use isKnownNeverNaN if you don't know whether Op" 1962 " is a target node!");
1974 if (
auto *CN = dyn_cast<ConstantSDNode>(N)) {
1975 CVal = CN->getAPIntValue();
1976 }
else if (
auto *BV = dyn_cast<BuildVectorSDNode>(N)) {
1977 auto *CN = BV->getConstantSplatNode();
1983 unsigned BVEltWidth = BV->getValueType(0).getScalarSizeInBits();
1984 CVal = CN->getAPIntValue();
1986 CVal = CVal.
trunc(BVEltWidth);
2050 const SDLoc &DL)
const {
2083 return DAG.
getSetCC(DL, VT, N0, Zero, Cond);
2094 if (YConst && YConst->isNullValue())
2100 return DAG.
getSetCC(DL, VT, NewAnd, Zero, Cond);
2116 SDValue TargetLowering::optimizeSetCCOfSignedTruncationCheck(
2118 const SDLoc &DL)
const {
2121 if (!(C1 = dyn_cast<ConstantSDNode>(N1)))
2130 if (!(C01 = dyn_cast<ConstantSDNode>(N0->
getOperand(1))))
2158 auto checkConstants = [&I1, &I01]() ->
bool {
2163 if (checkConstants()) {
2170 if (!checkConstants())
2176 const unsigned KeptBits = I1.
logBase2();
2177 const unsigned KeptBitsMinusOne = I01.
logBase2();
2180 if (KeptBits != (KeptBitsMinusOne + 1))
2186 if (!DAG.getTargetLoweringInfo().shouldTransformSignedTruncationCheck(
2195 SDValue ShiftAmt = DAG.getConstant(MaskedBits, DL, XVT);
2198 SDValue T2 = DAG.getSetCC(DL, SCCVT, T1, X, NewCond);
2208 const SDLoc &dl)
const {
2227 return DAG.
getSetCC(dl, VT, N1, N0, SwappedCC);
2229 if (
auto *N1C = dyn_cast<ConstantSDNode>(N1.
getNode())) {
2230 const APInt &C1 = N1C->getAPIntValue();
2239 = cast<ConstantSDNode>(N0.
getOperand(1))->getAPIntValue();
2290 MinBits = N0->getOperand(0).getValueSizeInBits();
2292 }
else if (N0->getOpcode() ==
ISD::AND) {
2294 if (
auto *
C = dyn_cast<ConstantSDNode>(N0->getOperand(1)))
2295 if ((
C->getAPIntValue()+1).isPowerOf2()) {
2296 MinBits =
C->getAPIntValue().countTrailingOnes();
2301 MinBits = N0->getOperand(0).getValueSizeInBits();
2304 }
else if (
auto *LN0 = dyn_cast<LoadSDNode>(N0)) {
2307 MinBits = LN0->getMemoryVT().getSizeInBits();
2311 MinBits = LN0->getMemoryVT().getSizeInBits();
2317 unsigned ReqdBits = Signed ?
2324 MinBits >= ReqdBits) {
2329 if (MinBits == 1 && C1 == 1)
2334 return DAG.
getSetCC(dl, VT, Trunc, C, Cond);
2361 cast<CondCodeSDNode>(TopSetCC.
getOperand(2))->
get(),
2375 N0.getOpcode() ==
ISD::AND && C1 == 0 &&
2376 N0.getNode()->hasOneUse() &&
2377 isa<LoadSDNode>(N0.getOperand(0)) &&
2378 N0.getOperand(0).getNode()->hasOneUse() &&
2379 isa<ConstantSDNode>(N0.getOperand(1))) {
2380 LoadSDNode *Lod = cast<LoadSDNode>(N0.getOperand(0));
2382 unsigned bestWidth = 0, bestOffset = 0;
2384 unsigned origWidth = N0.getValueSizeInBits();
2385 unsigned maskWidth = origWidth;
2391 cast<ConstantSDNode>(N0.getOperand(1))->getAPIntValue();
2392 for (
unsigned width = origWidth / 2; width>=8; width /= 2) {
2394 for (
unsigned offset=0; offset<origWidth/width; offset++) {
2397 bestOffset = (uint64_t)offset * (width/8);
2399 bestOffset = (origWidth/width - offset - 1) * (width/8);
2400 bestMask = Mask.
lshr(offset * (width/8) * 8);
2414 if (bestOffset != 0)
2437 C1.getBitWidth() - InSize))) {
2454 return DAG.
getConstant(C1.isNonNegative(), dl, VT);
2468 EVT newVT = N0.getOperand(0).getValueType();
2487 EVT ExtSrcTy = cast<VTSDNode>(N0.getOperand(1))->getVT();
2489 EVT ExtDstTy = N0.getValueType();
2494 if (C1.getMinSignedBits() > ExtSrcTyBits)
2498 EVT Op0Ty = N0.getOperand(0).getValueType();
2499 if (Op0Ty == ExtSrcTy) {
2509 return DAG.
getSetCC(dl, VT, ZextOp,
2515 }
else if ((N1C->isNullValue() || N1C->isOne()) &&
2520 bool TrueWhenTrue = (Cond ==
ISD::SETEQ) ^ (!N1C->isOne());
2524 ISD::CondCode CC = cast<CondCodeSDNode>(N0.getOperand(2))->
get();
2526 N0.getOperand(0).getValueType().isInteger());
2529 return DAG.
getSetCC(dl, VT, N0.getOperand(0), N0.getOperand(1), CC);
2534 N0.getOperand(0).getOpcode() ==
ISD::XOR &&
2535 N0.getOperand(1) == N0.getOperand(0).getOperand(1))) &&
2536 isa<ConstantSDNode>(N0.getOperand(1)) &&
2537 cast<ConstantSDNode>(N0.getOperand(1))->isOne()) {
2550 N0.getOperand(0).getOpcode() ==
ISD::XOR);
2553 N0.getOperand(0).getOperand(0),
2557 return DAG.
getSetCC(dl, VT, Val, N1,
2560 }
else if (N1C->isOne() &&
2578 cast<ConstantSDNode>(Op0.
getOperand(1))->isOne()) {
2602 optimizeSetCCOfSignedTruncationCheck(VT, N0, N1, Cond, DCI, dl))
2609 const APInt &C1 = N1C->getAPIntValue();
2611 APInt MinVal, MaxVal;
2612 unsigned OperandBitSize = N1C->getValueType(0).getScalarSizeInBits();
2722 if (
auto *N1C = dyn_cast<ConstantSDNode>(N1.
getNode())) {
2723 const APInt &C1 = N1C->getAPIntValue();
2731 if (
auto *AndRHS = dyn_cast<ConstantSDNode>(N0.
getOperand(1))) {
2736 if (AndRHS->getAPIntValue().isPowerOf2()) {
2739 DAG.
getConstant(AndRHS->getAPIntValue().logBase2(), dl,
2742 }
else if (Cond ==
ISD::SETEQ && C1 == AndRHS->getAPIntValue()) {
2760 if (
auto *AndRHS = dyn_cast<ConstantSDNode>(N0.
getOperand(1))) {
2761 const APInt &AndRHSC = AndRHS->getAPIntValue();
2762 if ((-AndRHSC).isPowerOf2() && (AndRHSC & C1) == C1) {
2772 return DAG.
getSetCC(dl, VT, Shift, CmpRHS, Cond);
2802 return DAG.
getSetCC(dl, VT, Shift, CmpRHS, NewCond);
2808 if (isa<ConstantFPSDNode>(N0.
getNode())) {
2812 }
else if (
auto *CFP = dyn_cast<ConstantFPSDNode>(N1.
getNode())) {
2815 if (CFP->getValueAPF().isNaN()) {
2833 return DAG.
getSetCC(dl, VT, N0, N0, Cond);
2851 if (CFP->getValueAPF().isInfinity()) {
2852 if (CFP->getValueAPF().isNegative()) {
2896 if (UOF ==
unsigned(EqTrue))
2901 if (NewCond != Cond &&
2904 return DAG.
getSetCC(dl, VT, N0, N1, NewCond);
2930 bool LegalRHSImm =
false;
2932 if (
auto *RHSC = dyn_cast<ConstantSDNode>(N1)) {
2933 if (
auto *LHSR = dyn_cast<ConstantSDNode>(N0.
getOperand(1))) {
2938 LHSR->getAPIntValue(),
2950 RHSC->getAPIntValue(),
2961 RHSC->getAPIntValue(),
2968 if (RHSC->getValueType(0).getSizeInBits() <= 64)
3027 if (
SDValue V = simplifySetCCWithAnd(VT, N0, N1, Cond, DCI, dl))
3039 N0 = DAG.
getNOT(dl, Temp, OpVT);
3048 Temp = DAG.
getNOT(dl, N0, OpVT);
3055 Temp = DAG.
getNOT(dl, N1, OpVT);
3062 Temp = DAG.
getNOT(dl, N0, OpVT);
3069 Temp = DAG.
getNOT(dl, N1, OpVT);
3078 N0 = DAG.
getNode(ExtendCode, dl, VT, N0);
3094 if (
auto *GASD = dyn_cast<GlobalAddressSDNode>(N)) {
3095 GA = GASD->getGlobal();
3096 Offset += GASD->getOffset();
3104 if (
auto *V = dyn_cast<ConstantSDNode>(N2)) {
3105 Offset += V->getSExtValue();
3109 if (
auto *V = dyn_cast<ConstantSDNode>(N1)) {
3110 Offset += V->getSExtValue();
3131 unsigned S = Constraint.
size();
3134 switch (Constraint[0]) {
3162 if (S > 1 && Constraint[0] ==
'{' && Constraint[S-1] ==
'}') {
3163 if (S == 8 && Constraint.
substr(1, 6) ==
"memory")
3184 std::string &Constraint,
3185 std::vector<SDValue> &Ops,
3188 if (Constraint.length() > 1)
return;
3190 char ConstraintLetter = Constraint[0];
3191 switch (ConstraintLetter) {
3225 if (ConstraintLetter !=
'n') {
3226 int64_t Offs = GA->getOffset();
3229 C ?
SDLoc(C) : SDLoc(),
3236 if (ConstraintLetter !=
's') {
3250 std::pair<unsigned, const TargetRegisterClass *>
3254 if (Constraint.
empty() || Constraint[0] !=
'{')
3255 return std::make_pair(0u, static_cast<TargetRegisterClass*>(
nullptr));
3256 assert(*(Constraint.
end()-1) ==
'}' &&
"Not a brace enclosed constraint?");
3261 std::pair<unsigned, const TargetRegisterClass*> R =
3262 std::make_pair(0u, static_cast<const TargetRegisterClass*>(
nullptr));
3274 std::pair<unsigned, const TargetRegisterClass*> S =
3275 std::make_pair(*
I, RC);
3297 assert(!ConstraintCode.empty() &&
"No known constraint!");
3298 return isdigit(static_cast<unsigned char>(ConstraintCode[0]));
3304 assert(!ConstraintCode.empty() &&
"No known constraint!");
3305 return atoi(ConstraintCode.c_str());
3320 unsigned maCount = 0;
3328 ConstraintOperands.emplace_back(std::move(CI));
3338 switch (OpInfo.
Type) {
3354 assert(ResNo == 0 &&
"Asm only has one result!");
3377 if (
StructType *STy = dyn_cast<StructType>(OpTy))
3378 if (STy->getNumElements() == 1)
3379 OpTy = STy->getElementType(0);
3397 }
else if (
PointerType *PT = dyn_cast<PointerType>(OpTy)) {
3407 if (!ConstraintOperands.empty()) {
3409 unsigned bestMAIndex = 0;
3410 int bestWeight = -1;
3416 for (maIndex = 0; maIndex < maCount; ++maIndex) {
3418 for (
unsigned cIndex = 0, eIndex = ConstraintOperands.size();
3419 cIndex != eIndex; ++cIndex) {
3445 weightSum += weight;
3448 if (weightSum > bestWeight) {
3449 bestWeight = weightSum;
3450 bestMAIndex = maIndex;
3455 for (
unsigned cIndex = 0, eIndex = ConstraintOperands.size();
3456 cIndex != eIndex; ++cIndex) {
3466 for (
unsigned cIndex = 0, eIndex = ConstraintOperands.size();
3467 cIndex != eIndex; ++cIndex) {
3478 std::pair<unsigned, const TargetRegisterClass *> MatchRC =
3481 std::pair<unsigned, const TargetRegisterClass *> InputRC =
3486 (MatchRC.second != InputRC.second)) {
3488 " with a matching output constraint of" 3489 " incompatible type!");
3495 return ConstraintOperands;
3522 rCodes = &info.
Codes;
3528 for (
unsigned i = 0, e = rCodes->size(); i != e; ++i) {
3531 if (weight > BestWeight)
3532 BestWeight = weight;
3548 if (!CallOperandVal)
3551 switch (*constraint) {
3554 if (isa<ConstantInt>(CallOperandVal))
3558 if (isa<GlobalValue>(CallOperandVal))
3563 if (isa<ConstantFP>(CallOperandVal))
3610 assert(OpInfo.
Codes.size() > 1 &&
"Doesn't have multiple constraint options");
3611 unsigned BestIdx = 0;
3613 int BestGenerality = -1;
3616 for (
unsigned i = 0, e = OpInfo.
Codes.size(); i != e; ++i) {
3626 "Unhandled multi-letter 'other' constraint");
3627 std::vector<SDValue> ResultOps;
3630 if (!ResultOps.empty()) {
3644 if (Generality > BestGenerality) {
3647 BestGenerality = Generality;
3660 assert(!OpInfo.
Codes.empty() &&
"Must have at least one constraint");
3663 if (OpInfo.
Codes.size() == 1) {
3676 if (isa<BasicBlock>(v) || isa<ConstantInt>(v) || isa<Function>(v)) {
3702 bool UseSRA =
false;
3706 if (
C->isNullValue())
3708 APInt Divisor =
C->getAPIntValue();
3716 APInt Factor = Divisor;
3717 while ((t = Divisor * Factor) != 1)
3734 Factor = Factors[0];
3766 bool IsAfterLegalization,
3787 if (
C->isNullValue())
3790 const APInt &Divisor =
C->getAPIntValue();
3792 int NumeratorFactor = 0;
3803 NumeratorFactor = 1;
3806 NumeratorFactor = -1;
3823 SDValue MagicFactor, Factor, Shift, ShiftMask;
3830 MagicFactor = MagicFactors[0];
3831 Factor = Factors[0];
3833 ShiftMask = ShiftMasks[0];
3862 SDValue SignShift = DAG.
getConstant(EltBits - 1, dl, ShVT);
3875 bool IsAfterLegalization,
3889 bool UseNPQ =
false;
3893 if (
C->isNullValue())
3897 APInt Divisor =
C->getAPIntValue();
3899 unsigned PreShift = 0, PostShift = 0;
3903 if (magics.
a != 0 && !Divisor[0]) {
3906 magics = Divisor.
lshr(PreShift).
magicu(PreShift);
3907 assert(magics.
a == 0 &&
"Should use cheap fixup now");
3915 "We shouldn't generate an undefined shift!");
3916 PostShift = magics.
s;
3919 PostShift = magics.
s - 1;
3941 SDValue PreShift, PostShift, MagicFactor, NPQFactor;
3948 PreShift = PreShifts[0];
3949 MagicFactor = MagicFactors[0];
3950 PostShift = PostShifts[0];
3972 Q = GetMULHU(Q, MagicFactor);
3985 NPQ = GetMULHU(NPQ, NPQFactor);
4000 return DAG.
getSelect(dl, VT, IsOne, N0, Q);
4005 if (!isa<ConstantSDNode>(Op.
getOperand(0))) {
4007 "be a constant integer");
4036 if (!HasMULHU && !HasMULHS && !HasUMUL_LOHI && !HasSMUL_LOHI)
4051 if ((
Signed && HasSMUL_LOHI) || (!
Signed && HasUMUL_LOHI)) {
4053 Hi =
SDValue(Lo.getNode(), 1);
4079 if (MakeMUL_LOHI(LL, RL, Lo, Hi,
false)) {
4092 RHSSB > InnerBitSize) {
4095 if (MakeMUL_LOHI(LL, RL, Lo, Hi,
true)) {
4102 unsigned ShiftAmount = OuterBitSize - InnerBitSize;
4124 if (!MakeMUL_LOHI(LL, RL, Lo, Hi,
false))
4147 if (!MakeMUL_LOHI(LL, RH, Lo, Hi,
false))
4154 if (!MakeMUL_LOHI(LH, RL, Lo, Hi,
false))
4208 DAG,
Kind, LL, LH, RL, RH);
4261 Result = DAG.
getSelect(DL, VT, IsZeroShift, IsFSHL ? X : Y, Or);
4282 Result = DAG.
getNode(RevRot, DL, VT, Op0, Sub);
4298 "Expecting the type bitwidth to be a power of 2");
4306 DAG.
getNode(HsOpc, DL, VT, Op0, And1));
4354 dl, Exponent, ExponentLoBit,
4431 Result = DAG.
getSelect(dl, DstVT, Sel, True, False);
4481 Result = DAG.
getSelect(dl, DstVT, SignBitTest, Slow, Fast);
4502 BitsToDouble(UINT64_C(0x4530000000100000)), dl, DstVT);
4560 if (!(Len <= 128 && Len % 8 == 0))
4653 for (
unsigned i = 0; (1U << i) <= (NumBitsPerElt / 2); ++i) {
4658 Op = DAG.
getNOT(dl, Op, VT);
4758 for (
unsigned Idx = 0; Idx < NumElem; ++Idx) {
4760 DAG.
getExtLoad(ExtType, SL, DstEltVT, Chain, BasePTR,
4767 Vals.push_back(ScalarLoad.
getValue(0));
4808 for (
unsigned Idx = 0; Idx < NumElem; ++Idx) {
4813 unsigned ShiftIntoIdx =
4829 assert (Stride &&
"Zero stride!");
4833 for (
unsigned Idx = 0; Idx < NumElem; ++Idx) {
4851 std::pair<SDValue, SDValue>
4854 "unaligned indexed loads not implemented!");
4883 return std::make_pair(Result, newLoad.
getValue(1));
4890 unsigned RegBytes = RegVT.getSizeInBits() / 8;
4891 unsigned NumRegs = (LoadedBytes + RegBytes - 1) / RegBytes;
4907 for (
unsigned i = 1; i < NumRegs; i++) {
4926 8 * (LoadedBytes -
Offset));
4948 return std::make_pair(Load, TF);
4952 "Unaligned load of unsupported type.");
4962 unsigned IncrementSize = NumBits / 8;
4977 Hi = DAG.
getExtLoad(HiExtType, dl, VT, Chain, Ptr,
4979 NewLoadedVT,
MinAlign(Alignment, IncrementSize),
4989 NewLoadedVT,
MinAlign(Alignment, IncrementSize),
5003 return std::make_pair(Result, TF);
5009 "unaligned indexed stores not implemented!");
5047 unsigned NumRegs = (StoredBytes + RegBytes - 1) / RegBytes;
5055 Chain, dl, Val, StackPtr,
5066 for (
unsigned i = 1; i < NumRegs; i++) {
5069 RegVT, dl, Store, StackPtr,
5086 8 * (StoredBytes -
Offset));
5105 "Unaligned store of unknown type.");
5109 int IncrementSize = NumBits / 8;
5126 Alignment =
MinAlign(Alignment, IncrementSize);
5141 bool IsCompressedMemory)
const {
5146 "Incompatible types of Data and Mask");
5147 if (IsCompressedMemory) {
5173 if (isa<ConstantSDNode>(Idx))
5201 "Converting bits to bytes lost precision");
5205 EVT IdxVT = Index.getValueType();
5226 std::string NameString = (
"__emutls_v." + GA->
getGlobal()->
getName()).str();
5230 assert(EmuTlsVar &&
"Cannot find EmuTlsVar ");
5232 Entry.
Ty = VoidPtrType;
5233 Args.push_back(Entry);
5240 std::pair<SDValue, SDValue> CallResult =
LowerCallTo(CLI);
5249 "Emulated TLS must have zero offset in GlobalAddressSDNode");
5250 return CallResult.first;
5296 unsigned OverflowOp;
5311 llvm_unreachable(
"Expected method to receive signed or unsigned saturation " 5312 "addition or subtraction node.");
5316 "Expected operands to be integers. Vector of int arguments should " 5317 "already be unrolled.");
5319 "Expected operands to be integers. Vector of int arguments should " 5320 "already be unrolled.");
5322 "Expected both operands to be the same type");
5338 return DAG.
getSelect(dl, ResultType, Overflow, SatMax, SumDiff);
5343 return DAG.
getSelect(dl, ResultType, Overflow, SatMin, SumDiff);
5352 Result = DAG.
getSelect(dl, ResultType, SumNeg, SatMax, SatMin);
5353 return DAG.
getSelect(dl, ResultType, Overflow, Result, SumDiff);
5362 "Expected signed fixed point multiplication to have 3 operands.");
5368 "Expected operands to be integers. Vector of int arguments should " 5369 "already be unrolled.");
5371 "Expected operands to be integers. Vector of int arguments should " 5372 "already be unrolled.");
5374 "Expected both operands to be the same type");
5379 "Expected scale to be less than the number of bits.");
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.
BITCAST - This operator converts between integer, vector and FP values, as if the value was stored to...
SDValue getGlobalAddress(const GlobalValue *GV, const SDLoc &DL, EVT VT, int64_t offset=0, bool isTargetGA=false, unsigned char TargetFlags=0)
static MVT getIntegerVT(unsigned BitWidth)
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. ...
constexpr char Align[]
Key for Kernel::Arg::Metadata::mAlign.
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 GCMetadataPrinterRegistry::Add< ErlangGCPrinter > X("erlang", "erlang-compatible garbage collector")
bool isSignMask() const
Check if the APInt's value is returned by getSignMask.
opStatus convertFromAPInt(const APInt &Input, bool IsSigned, roundingMode RM)
C - The default llvm calling convention, compatible with C.
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.
static APInt getAllOnesValue(unsigned numBits)
Get the all-ones value.
unsigned getOpcode() const
Return the SelectionDAG opcode value for this node.
void setBits(unsigned loBit, unsigned hiBit)
Set the bits from loBit (inclusive) to hiBit (exclusive) to 1.
SDValue getSetCC(const SDLoc &DL, EVT VT, SDValue LHS, SDValue RHS, ISD::CondCode Cond)
Helper function to make it easier to build SetCC's if you just have an ISD::CondCode instead of an SD...
static const MCSymbolRefExpr * create(const MCSymbol *Symbol, MCContext &Ctx)
EXTRACT_SUBVECTOR(VECTOR, IDX) - Returns a subvector from VECTOR (an vector value) starting with the ...
LLVM_ATTRIBUTE_NORETURN void report_fatal_error(Error Err, bool gen_crash_diag=true)
Report a serious error, calling any installed error handler.
This class represents lattice values for constants.
unsigned getParamAlignment(unsigned ArgNo) const
Extract the alignment for a call or parameter (0=unknown).
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
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 ...
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.
LLVM_NODISCARD LLVM_ATTRIBUTE_ALWAYS_INLINE size_t size() const
size - Get the string size.
APInt zext(unsigned width) const
Zero extend to a new width.
bool isScalarInteger() const
Return true if this is an integer, but not a vector.
const SDValue & getValue() 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.
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
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
bool isBitwiseNot(SDValue V)
Returns true if V is a bitwise not operation.
virtual std::pair< unsigned, const TargetRegisterClass * > getRegForInlineAsmConstraint(const TargetRegisterInfo *TRI, StringRef Constraint, MVT VT) const
Given a physical register constraint (e.g.
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 ...
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.
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 ...
void softenSetCCOperands(SelectionDAG &DAG, EVT VT, SDValue &NewLHS, SDValue &NewRHS, ISD::CondCode &CCCode, const SDLoc &DL) const
Soften the operands of a comparison.
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...
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
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...
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...
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 ...
CallLoweringInfo & setDiscardResult(bool Value=true)
unsigned getBitWidth() const
Get the bit width of this value.
virtual SDValue LowerToTLSEmulatedModel(const GlobalAddressSDNode *GA, SelectionDAG &DAG) const
Lower TLS global address SDNode for target independent emulated TLS model.
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 getValueSizeInBits() const
Returns the size of the value in bits.
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) ...
LLVM_NODISCARD LLVM_ATTRIBUTE_ALWAYS_INLINE const char * data() const
data - Get a pointer to the start of the string (which may not be null terminated).
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.
RESULT,OUTCHAIN = INTRINSIC_W_CHAIN(INCHAIN, INTRINSICID, arg1, ...) This node represents a target in...
virtual bool isCtlzFast() const
Return true if ctlz instruction is fast.
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.
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 ...
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.
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.
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...
TargetLowering::ConstraintType ConstraintType
Information about the constraint code, e.g.
CallLoweringInfo & setChain(SDValue InChain)
BUILD_PAIR - This is the opposite of EXTRACT_ELEMENT in some ways.
RESULT = SMULFIX(LHS, RHS, SCALE) - Perform fixed point multiplication on 2 integers with the same wi...
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
unsigned getScalarValueSizeInBits() 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
unsigned getStoreSize() const
Return the number of bytes overwritten by a store of the specified value type.
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...
const DataLayout & getDataLayout() const
SDVTList getVTList(EVT VT)
Return an SDVTList that represents the list of values specified.
APInt getHiBits(unsigned numBits) const
Compute an APInt containing numBits highbits from this APInt.
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.
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...
zlib-gnu style compression
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())
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.
SDValue getMergeValues(ArrayRef< SDValue > Ops, const SDLoc &dl)
Create a MERGE_VALUES node from the given operands.
unsigned getSizeInBits() const
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...
ValTy * getCalledValue() const
Return the pointer to function that is being called.
unsigned getActiveBits() const
Compute the number of active bits in the value.
int64_t getSExtValue() const
SDValue getSExtOrTrunc(SDValue Op, const SDLoc &DL, EVT VT)
Convert Op, which must be of integer type, to the integer type VT, by either sign-extending or trunca...
void ashrInPlace(unsigned ShiftAmt)
Arithmetic right-shift this APInt by ShiftAmt in place.
Fast - This calling convention attempts to make calls as fast as possible (e.g.
unsigned getScalarSizeInBits() const
unsigned getSizeInBits() const
Return the size of the specified value type in bits.
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...
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.
This contains information for each constraint that we are lowering.
Simple integer binary arithmetic operators.
int32_t exactLogBase2() const
APInt extractBits(unsigned numBits, unsigned bitPosition) const
Return an APInt with the extracted bits [bitPosition,bitPosition+numBits).
LLVM_NODISCARD LLVM_ATTRIBUTE_ALWAYS_INLINE bool empty() const
empty - Check if the string is empty.
bool expandABS(SDNode *N, SDValue &Result, SelectionDAG &DAG) const
Expand ABS nodes.
bool paramHasAttr(unsigned ArgNo, Attribute::AttrKind Kind) const
Return true if the call or the callee has the given attribute.
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.
bool isLittleEndian() const
Layout endianness...
CallLoweringInfo & setZExtResult(bool Value=true)
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...
op_iterator op_begin() const
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...
LLVM_NODISCARD LLVM_ATTRIBUTE_ALWAYS_INLINE StringRef substr(size_t Start, size_t N=npos) const
Return a reference to the substring from [Start, Start + N).
SDValue getTargetConstant(uint64_t Val, const SDLoc &DL, EVT VT, bool isOpaque=false)
ConstraintPrefix Type
Type - The basic type of the constraint: input/output/clobber.
ArrayRef< SDUse > ops() const
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...
amdgpu Simplify well known AMD library false Value * Callee
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.
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...
void setAttributes(ImmutableCallSite *CS, unsigned ArgIdx)
Set CallLoweringInfo attribute flags based on a call instruction and called function attributes...
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...
int64_t getOffset() const
std::vector< AsmOperandInfo > AsmOperandInfoVector
OUTCHAIN = INTRINSIC_VOID(INCHAIN, INTRINSICID, arg1, arg2, ...) This node represents a target intrin...
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...
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
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...
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")
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...
bool bitsLE(EVT VT) const
Return true if this has no more bits than VT.
Carry-using nodes for multiple precision addition and subtraction.
bool isKnownNeverSNaN(SDValue Op, unsigned Depth=0) const
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.
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...
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...
KnownBits trunc(unsigned BitWidth)
Truncate the underlying known Zero and One bits.
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)
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.
X = FP_EXTEND(Y) - Extend a smaller FP type into a larger FP type.
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.
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.
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.
bool isBeforeLegalizeOps() const
static PointerType * getInt8PtrTy(LLVMContext &C, unsigned AS=0)
const TargetMachine & getTargetMachine() const
unsigned getNumOperands() const
Return the number of values used by this operation.
#define llvm_unreachable(msg)
Marks that the current location is not supposed to be reachable.
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".
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.
bool isUnindexed() const
Return true if this is NOT a pre/post inc/dec load/store.
This base class for TargetLowering contains the SelectionDAG-independent parts that can be used from ...
static const char *const Magic
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)
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 scalarizeVectorLoad(LoadSDNode *LD, SelectionDAG &DAG) const
Turn load of vector type into a load of the individual elements.
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.
SDValue getExpandedFixedPointMultiplication(SDNode *Node, SelectionDAG &DAG) const
Method for building the DAG expansion of ISD::SMULFIX.
Returns platform specific canonical encoding of a floating point number.
ValTy * getArgument(unsigned ArgNo) const
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.
double Log2(double Value)
Return the log base 2 of the specified value.
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.
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.
FMINNUM_IEEE/FMAXNUM_IEEE - Perform floating-point minimum or maximum on two values, following the IEEE-754 2008 definition.
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)
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...
CondCode getSetCCInverse(CondCode Operation, bool isInteger)
Return the operation corresponding to !(X op Y), where 'op' is a valid SetCC operation.
void setAdjustsStack(bool V)
SDValue getNOT(const SDLoc &DL, SDValue Val, EVT VT)
Create a bitwise NOT operation as (XOR Val, -1).
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.
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.
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.
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 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.
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.
const MCPhysReg * iterator
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) ...
uint64_t getTypeSizeInBits(Type *Ty) const
Size examples:
std::pair< SDValue, SDValue > LowerCallTo(CallLoweringInfo &CLI) const
This function lowers an abstract call to a function into an actual call.
static MachinePointerInfo getFixedStack(MachineFunction &MF, int FI, int64_t Offset=0)
Return a MachinePointerInfo record that refers to the specified FrameIndex.
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 ugt(const APInt &RHS) const
Unsigned greather than comparison.
These are IR-level optimization flags that may be propagated to SDNodes.
Magic data for optimising signed division by a constant.
ConstantSDNode * isConstOrConstSplat(SDValue N, bool AllowUndefs=false)
Returns the SDNode if it is a constant splat BuildVector or constant int.
bool isVector() const
Return true if this is a vector value type.
Bitwise operators - logical and, logical or, logical xor.
std::pair< SDValue, SDValue > makeLibCall(SelectionDAG &DAG, RTLIB::Libcall LC, EVT RetVT, ArrayRef< SDValue > Ops, bool isSigned, const SDLoc &dl, bool doesNotReturn=false, bool isReturnValueUsed=true) const
Returns a pair of (return value, chain).
SMUL_LOHI/UMUL_LOHI - Multiply two integers of type iN, producing a signed/unsigned value of type i[2...
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.
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.
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 ...
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.
CopyFromReg - This node indicates that the input value is a virtual or physical register that is defi...
Type * getType() const
Return the type of the instruction that generated this call site.
SDValue getConstant(uint64_t Val, const SDLoc &DL, EVT VT, bool isTarget=false, bool isOpaque=false)
Create a ConstantSDNode wrapping a constant value.
SDValue getCondCode(ISD::CondCode Cond)
SDValue 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.
ConstantSDNode * getConstantSplatNode(BitVector *UndefElements=nullptr) const
Returns the splatted constant or null if this is not a constant splat.
CONCAT_VECTORS(VECTOR0, VECTOR1, ...) - Given a number of values of vector type with the same length ...
bool MaskedValueIsZero(SDValue Op, const APInt &Mask, unsigned Depth=0) const
Return true if 'Op & Mask' is known to be zero.
bool expandFP_TO_UINT(SDNode *N, SDValue &Result, SelectionDAG &DAG) const
Expand float to UINT conversion.
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.
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. ...
TargetLowering(const TargetLowering &)=delete
bool isSingleValueType() const
Return true if the type is a valid type for a register in codegen.
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.
static SDNodeIterator end(const SDNode *N)
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...
bool hasNoUnsignedWrap() const
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.
Primary interface to the complete machine description for the target machine.
StringRef - Represent a constant reference to a string, i.e.
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 expandUINT_TO_FP(SDNode *N, SDValue &Result, SelectionDAG &DAG) const
Expand UINT(i64) to double(f64) conversion.
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
unsigned getLocReg() const
uint64_t getZExtValue() const
TRUNCATE - Completely drop the high bits.
SDValue getObjectPtrOffset(const SDLoc &SL, SDValue Op, int64_t Offset)
Create an add instruction with appropriate flags when used for addressing some offset of an object...
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...
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.
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)
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.
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.
SDValue getTargetGlobalAddress(const GlobalValue *GV, const SDLoc &DL, EVT VT, int64_t offset=0, unsigned char TargetFlags=0)
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.