78 for (
unsigned I = 0,
E = ArgLocs.
size();
I !=
E; ++
I) {
106 IsSRet = CS->
paramHasAttr(ArgIdx, Attribute::StructRet);
109 IsInAlloca = CS->
paramHasAttr(ArgIdx, Attribute::InAlloca);
110 IsReturned = CS->
paramHasAttr(ArgIdx, Attribute::Returned);
111 IsSwiftSelf = CS->
paramHasAttr(ArgIdx, Attribute::SwiftSelf);
112 IsSwiftError = CS->
paramHasAttr(ArgIdx, Attribute::SwiftError);
118 std::pair<SDValue, SDValue>
121 const SDLoc &dl,
bool doesNotReturn,
122 bool isReturnValueUsed)
const {
124 Args.reserve(Ops.
size());
132 Args.push_back(Entry);
135 if (LC == RTLIB::UNKNOWN_LIBCALL)
146 .setNoReturn(doesNotReturn)
158 const SDLoc &dl)
const {
160 &&
"Unsupported setcc type!");
163 RTLIB::Libcall LC1 = RTLIB::UNKNOWN_LIBCALL, LC2 = RTLIB::UNKNOWN_LIBCALL;
164 bool ShouldInvertCC =
false;
168 LC1 = (VT ==
MVT::f32) ? RTLIB::OEQ_F32 :
170 (VT ==
MVT::f128) ? RTLIB::OEQ_F128 : RTLIB::OEQ_PPCF128;
174 LC1 = (VT ==
MVT::f32) ? RTLIB::UNE_F32 :
176 (VT ==
MVT::f128) ? RTLIB::UNE_F128 : RTLIB::UNE_PPCF128;
180 LC1 = (VT ==
MVT::f32) ? RTLIB::OGE_F32 :
182 (VT ==
MVT::f128) ? RTLIB::OGE_F128 : RTLIB::OGE_PPCF128;
186 LC1 = (VT ==
MVT::f32) ? RTLIB::OLT_F32 :
188 (VT ==
MVT::f128) ? RTLIB::OLT_F128 : RTLIB::OLT_PPCF128;
192 LC1 = (VT ==
MVT::f32) ? RTLIB::OLE_F32 :
194 (VT ==
MVT::f128) ? RTLIB::OLE_F128 : RTLIB::OLE_PPCF128;
198 LC1 = (VT ==
MVT::f32) ? RTLIB::OGT_F32 :
200 (VT ==
MVT::f128) ? RTLIB::OGT_F128 : RTLIB::OGT_PPCF128;
203 LC1 = (VT ==
MVT::f32) ? RTLIB::UO_F32 :
205 (VT ==
MVT::f128) ? RTLIB::UO_F128 : RTLIB::UO_PPCF128;
208 LC1 = (VT ==
MVT::f32) ? RTLIB::O_F32 :
210 (VT ==
MVT::f128) ? RTLIB::O_F128 : RTLIB::O_PPCF128;
214 LC1 = (VT ==
MVT::f32) ? RTLIB::OLT_F32 :
216 (VT ==
MVT::f128) ? RTLIB::OLT_F128 : RTLIB::OLT_PPCF128;
217 LC2 = (VT ==
MVT::f32) ? RTLIB::OGT_F32 :
219 (VT ==
MVT::f128) ? RTLIB::OGT_F128 : RTLIB::OGT_PPCF128;
222 LC1 = (VT ==
MVT::f32) ? RTLIB::UO_F32 :
224 (VT ==
MVT::f128) ? RTLIB::UO_F128 : RTLIB::UO_PPCF128;
225 LC2 = (VT ==
MVT::f32) ? RTLIB::OEQ_F32 :
227 (VT ==
MVT::f128) ? RTLIB::OEQ_F128 : RTLIB::OEQ_PPCF128;
231 ShouldInvertCC =
true;
234 LC1 = (VT ==
MVT::f32) ? RTLIB::OGE_F32 :
236 (VT ==
MVT::f128) ? RTLIB::OGE_F128 : RTLIB::OGE_PPCF128;
239 LC1 = (VT ==
MVT::f32) ? RTLIB::OGT_F32 :
241 (VT ==
MVT::f128) ? RTLIB::OGT_F128 : RTLIB::OGT_PPCF128;
244 LC1 = (VT ==
MVT::f32) ? RTLIB::OLE_F32 :
246 (VT ==
MVT::f128) ? RTLIB::OLE_F128 : RTLIB::OLE_PPCF128;
249 LC1 = (VT ==
MVT::f32) ? RTLIB::OLT_F32 :
251 (VT ==
MVT::f128) ? RTLIB::OLT_F128 : RTLIB::OLT_PPCF128;
259 SDValue Ops[2] = {NewLHS, NewRHS};
268 if (LC2 != RTLIB::UNKNOWN_LIBCALL) {
367 const APInt &
C = Op1C->getAPIntValue();
389 const APInt &Demanded,
392 "ShrinkDemandedOp only supports binary operators!");
394 "ShrinkDemandedOp only supports nodes with one result!");
412 unsigned SmallVTBits = DemandedSize;
415 for (; SmallVTBits < BitWidth; SmallVTBits =
NextPowerOf2(SmallVTBits)) {
424 assert(DemandedSize <= SmallVTBits &&
"Narrowed below demanded bits?");
434 const APInt &Demanded,
504 const APInt &DemandedMask,
508 bool AssumeSingleUse)
const {
511 "Mask size mismatches value type size!");
512 APInt NewMask = DemandedMask;
521 Known.
One = cast<ConstantSDNode>(
Op)->getAPIntValue();
538 }
else if (DemandedMask == 0) {
543 }
else if (Depth == 6) {
553 if (!isa<ConstantSDNode>(SrcOp)) {
558 Known2.
One = cast<ConstantSDNode>(SrcOp)->getAPIntValue();
564 "Expected BUILD_VECTOR implicit truncation");
565 Known2 = Known2.
trunc(BitWidth);
585 if ((LHSKnown.
Zero & NewMask) == (~RHSC->getAPIntValue() & NewMask))
599 LHSKnown.
One == ~RHSC->getAPIntValue()) {
608 assert(!Known.hasConflict() &&
"Bits known to be one AND zero?");
610 Known2, TLO, Depth+1))
612 assert(!Known2.hasConflict() &&
"Bits known to be one AND zero?");
616 if (NewMask.isSubsetOf(Known2.Zero | Known.One))
618 if (NewMask.isSubsetOf(Known.Zero | Known2.One))
621 if (NewMask.isSubsetOf(Known.Zero | Known2.Zero))
622 return TLO.CombineTo(Op, TLO.DAG.getConstant(0, dl, VT));
631 Known.One &= Known2.One;
633 Known.Zero |= Known2.Zero;
638 assert(!Known.hasConflict() &&
"Bits known to be one AND zero?");
640 Known2, TLO, Depth+1))
642 assert(!Known2.hasConflict() &&
"Bits known to be one AND zero?");
646 if (NewMask.isSubsetOf(Known2.One | Known.Zero))
648 if (NewMask.isSubsetOf(Known.One | Known2.Zero))
658 Known.Zero &= Known2.Zero;
660 Known.One |= Known2.One;
665 assert(!Known.hasConflict() &&
"Bits known to be one AND zero?");
668 assert(!Known2.hasConflict() &&
"Bits known to be one AND zero?");
672 if (NewMask.isSubsetOf(Known.Zero))
674 if (NewMask.isSubsetOf(Known2.Zero))
683 if ((NewMask & ~Known.Zero & ~Known2.Zero) == 0)
689 KnownOut.
Zero = (Known.Zero & Known2.Zero) | (Known.One & Known2.One);
691 KnownOut.
One = (Known.Zero & Known2.One) | (Known.One & Known2.Zero);
698 if (NewMask.isSubsetOf(Known.Zero|Known.One)) {
699 if (Known.One == Known2.One) {
700 SDValue ANDC = TLO.DAG.getConstant(~Known.One & NewMask, dl, VT);
714 return TLO.CombineTo(Op, New);
721 Known = std::move(KnownOut);
729 assert(!Known.hasConflict() &&
"Bits known to be one AND zero?");
730 assert(!Known2.hasConflict() &&
"Bits known to be one AND zero?");
737 Known.One &= Known2.One;
738 Known.Zero &= Known2.Zero;
745 assert(!Known.hasConflict() &&
"Bits known to be one AND zero?");
746 assert(!Known2.hasConflict() &&
"Bits known to be one AND zero?");
753 Known.One &= Known2.One;
754 Known.Zero &= Known2.Zero;
765 BooleanContent::ZeroOrNegativeOneBooleanContent) {
772 return TLO.CombineTo(Op, Op0);
780 Known.Zero.setBitsFrom(1);
788 if (SA->getAPIntValue().uge(BitWidth))
791 unsigned ShAmt = SA->getZExtValue();
799 if (SA2->getAPIntValue().ult(BitWidth)) {
800 unsigned C1 = SA2->getZExtValue();
810 return TLO.CombineTo(Op, TLO.DAG.
getNode(Opc, dl, VT,
827 if (ShAmt < InnerBits && NewMask.getActiveBits() <= InnerBits &&
834 TLO.DAG.getConstant(ShAmt, dl, ShTy));
847 unsigned InnerShAmt = SA2->getLimitedValue(InnerBits);
848 if (InnerShAmt < ShAmt &&
849 InnerShAmt < InnerBits &&
850 NewMask.getActiveBits() <= (InnerBits - InnerShAmt + ShAmt) &&
851 NewMask.countTrailingZeros() >= ShAmt) {
853 TLO.DAG.getConstant(ShAmt - InnerShAmt, dl,
864 Known.Zero <<= ShAmt;
867 Known.Zero.setLowBits(ShAmt);
875 if (SA->getAPIntValue().uge(BitWidth))
878 unsigned ShAmt = SA->getZExtValue();
879 APInt InDemandedMask = (NewMask << ShAmt);
893 if (SA2->getAPIntValue().ult(BitWidth)) {
894 unsigned C1 = SA2->getZExtValue();
904 return TLO.CombineTo(Op, TLO.DAG.
getNode(Opc, dl, VT,
915 assert(!Known.hasConflict() &&
"Bits known to be one AND zero?");
916 Known.Zero.lshrInPlace(ShAmt);
917 Known.One.lshrInPlace(ShAmt);
919 Known.Zero.setHighBits(ShAmt);
927 if (NewMask.isOneValue())
928 return TLO.CombineTo(Op,
934 if (SA->getAPIntValue().uge(BitWidth))
937 unsigned ShAmt = SA->getZExtValue();
938 APInt InDemandedMask = (NewMask << ShAmt);
947 if (NewMask.countLeadingZeros() < ShAmt)
953 assert(!Known.hasConflict() &&
"Bits known to be one AND zero?");
954 Known.Zero.lshrInPlace(ShAmt);
955 Known.One.lshrInPlace(ShAmt);
959 if (Known.Zero[BitWidth - ShAmt - 1] ||
960 NewMask.countLeadingZeros() >= ShAmt) {
963 return TLO.CombineTo(Op,
968 int Log2 = NewMask.exactLogBase2();
972 TLO.DAG.getConstant(BitWidth - 1 - Log2, dl,
978 if (Known.One[BitWidth - ShAmt - 1])
980 Known.One.setHighBits(ShAmt);
988 if (NewMask.isSignMask()) {
990 bool AlreadySignExtended =
991 TLO.DAG.ComputeNumSignBits(InOp) >= BitWidth-ExVTBits+1;
994 if (!AlreadySignExtended) {
998 if (TLO.LegalTypes() && !ShiftAmtTy.
isVector())
1001 SDValue ShiftAmt = TLO.DAG.getConstant(BitWidth - ExVTBits, dl,
1009 if (NewMask.getActiveBits() <= ExVTBits)
1016 InputDemandedBits.
setBit(ExVTBits - 1);
1019 Known, TLO, Depth+1))
1021 assert(!Known.hasConflict() &&
"Bits known to be one AND zero?");
1027 if (Known.Zero[ExVTBits - 1])
1028 return TLO.CombineTo(Op, TLO.DAG.getZeroExtendInReg(
1032 if (Known.One[ExVTBits - 1]) {
1033 Known.One.setBitsFrom(ExVTBits);
1056 Known.
Zero = KnownLo.Zero.
zext(BitWidth) |
1057 KnownHi.Zero.
zext(BitWidth).
shl(HalfBitWidth);
1059 Known.One = KnownLo.One.
zext(BitWidth) |
1060 KnownHi.One.
zext(BitWidth).
shl(HalfBitWidth);
1067 if (NewMask.getActiveBits() <= OperandBitWidth)
1071 APInt InMask = NewMask.
trunc(OperandBitWidth);
1074 assert(!Known.hasConflict() &&
"Bits known to be one AND zero?");
1075 Known = Known.zext(BitWidth);
1076 Known.Zero.setBitsFrom(OperandBitWidth);
1083 if (NewMask.getActiveBits() <= InBits)
1089 APInt InDemandedBits = NewMask.
trunc(InBits);
1090 InDemandedBits.
setBit(InBits - 1);
1095 assert(!Known.hasConflict() &&
"Bits known to be one AND zero?");
1097 Known = Known.sext(BitWidth);
1100 if (Known.isNonNegative())
1107 APInt InMask = NewMask.
trunc(OperandBitWidth);
1110 assert(!Known.hasConflict() &&
"Bits known to be one AND zero?");
1111 Known = Known.zext(BitWidth);
1118 APInt TruncMask = NewMask.
zext(OperandBitWidth);
1121 Known = Known.
trunc(BitWidth);
1140 if (TLO.LegalTypes()) {
1147 OperandBitWidth - BitWidth);
1149 HighBits = HighBits.
trunc(BitWidth);
1151 if (!(HighBits & NewMask)) {
1164 assert(!Known.hasConflict() &&
"Bits known to be one AND zero?");
1173 Known, TLO, Depth+1))
1175 assert(!Known.hasConflict() &&
"Bits known to be one AND zero?");
1177 Known.Zero |= ~InMask;
1183 if (!TLO.LegalOperations() && !VT.
isVector() &&
1189 if ((OpVTLegal || i32Legal) && VT.
isSimple() &&
1198 if (!OpVTLegal && OpVTSizeInBits > 32)
1201 SDValue ShAmt = TLO.DAG.getConstant(ShVal, dl, VT);
1202 return TLO.CombineTo(Op, TLO.DAG.
getNode(
ISD::SHL, dl, VT, Sign, ShAmt));
1208 TLO.DAG.computeKnownBits(Op, Known, Depth);
1218 unsigned NewMaskLZ = NewMask.countLeadingZeros();
1232 return TLO.CombineTo(Op, NewOp);
1246 SDValue Neg1 = TLO.DAG.getAllOnesConstant(dl, VT);
1254 return TLO.CombineTo(Op, NewOp);
1261 TLO.DAG.computeKnownBits(Op, Known, Depth);
1267 if (NewMask.isSubsetOf(Known.
Zero|Known.
One)) {
1284 const APInt &DemandedElts,
1302 bool AssumeSingleUse)
const {
1304 APInt DemandedElts = DemandedEltMask;
1308 "Mask size mismatches value type element count!");
1314 KnownUndef.setAllBits();
1323 if (DemandedElts == 0) {
1324 KnownUndef.setAllBits();
1337 if (!DemandedElts[0]) {
1338 KnownUndef.setAllBits();
1341 KnownUndef.setHighBits(NumElts - 1);
1355 if (NumSrcElts == NumElts)
1357 KnownZero, TLO, Depth + 1);
1359 APInt SrcZero, SrcUndef;
1364 if ((NumElts % NumSrcElts) == 0) {
1365 unsigned Scale = NumElts / NumSrcElts;
1366 for (
unsigned i = 0; i != NumElts; ++i)
1367 if (DemandedElts[i])
1368 SrcDemandedElts.
setBit(i / Scale);
1376 for (
unsigned i = 0; i != NumSrcElts; ++i) {
1377 if (SrcDemandedElts[i]) {
1379 KnownZero.
setBits(i * Scale, (i + 1) * Scale);
1381 KnownUndef.setBits(i * Scale, (i + 1) * Scale);
1389 if ((NumSrcElts % NumElts) == 0) {
1390 unsigned Scale = NumSrcElts / NumElts;
1391 for (
unsigned i = 0; i != NumElts; ++i)
1392 if (DemandedElts[i])
1393 SrcDemandedElts.
setBits(i * Scale, (i + 1) * Scale);
1401 for (
unsigned i = 0; i != NumElts; ++i) {
1402 if (DemandedElts[i]) {
1406 KnownUndef.setBit(i);
1419 bool Updated =
false;
1420 for (
unsigned i = 0; i != NumElts; ++i) {
1421 if (!DemandedElts[i] && !Ops[i].
isUndef()) {
1423 KnownUndef.setBit(i);
1431 for (
unsigned i = 0; i != NumElts; ++i) {
1434 KnownUndef.setBit(i);
1446 for (
unsigned i = 0; i != NumSubVecs; ++i) {
1449 APInt SubUndef, SubZero;
1453 KnownUndef.
insertBits(SubUndef, i * NumSubElts);
1454 KnownZero.
insertBits(SubZero, i * NumSubElts);
1465 const APInt& Idx = cast<ConstantSDNode>(Op.
getOperand(2))->getAPIntValue();
1466 if (Idx.
uge(NumElts - NumSubElts))
1470 APInt SubUndef, SubZero;
1474 APInt BaseElts = DemandedElts;
1479 KnownUndef.insertBits(SubUndef, SubIdx);
1488 const APInt& Idx = cast<ConstantSDNode>(Op.
getOperand(1))->getAPIntValue();
1489 if (Idx.
uge(NumSrcElts - NumElts))
1493 APInt SrcElts = DemandedElts.
zext(NumSrcElts).
shl(SubIdx);
1494 APInt SrcUndef, SrcZero;
1498 KnownUndef = SrcUndef.
extractBits(NumElts, SubIdx);
1509 if (CIdx && CIdx->getAPIntValue().ult(NumElts)) {
1511 if (!DemandedElts[Idx])
1516 KnownZero, TLO, Depth + 1))
1519 KnownUndef.clearBit(Idx);
1521 KnownUndef.setBit(Idx);
1529 APInt VecUndef, VecZero;
1537 APInt DemandedLHS(DemandedElts);
1538 APInt DemandedRHS(DemandedElts);
1543 APInt UndefLHS, ZeroLHS;
1544 APInt UndefRHS, ZeroRHS;
1546 ZeroLHS, TLO, Depth + 1))
1549 ZeroRHS, TLO, Depth + 1))
1552 KnownUndef = UndefLHS & UndefRHS;
1553 KnownZero = ZeroLHS & ZeroRHS;
1560 APInt DemandedLHS(NumElts, 0);
1561 APInt DemandedRHS(NumElts, 0);
1562 for (
unsigned i = 0; i != NumElts; ++i) {
1563 int M = ShuffleMask[i];
1564 if (M < 0 || !DemandedElts[i])
1566 assert(0 <= M && M < (
int)(2 * NumElts) &&
"Shuffle index out of range");
1567 if (M < (
int)NumElts)
1570 DemandedRHS.
setBit(M - NumElts);
1574 APInt UndefLHS, ZeroLHS;
1575 APInt UndefRHS, ZeroRHS;
1577 ZeroLHS, TLO, Depth + 1))
1580 ZeroRHS, TLO, Depth + 1))
1584 bool Updated =
false;
1585 bool IdentityLHS =
true, IdentityRHS =
true;
1587 for (
unsigned i = 0; i != NumElts; ++i) {
1588 int &M = NewMask[i];
1591 if (!DemandedElts[i] || (M < (
int)NumElts && UndefLHS[M]) ||
1592 (M >= (int)NumElts && UndefRHS[M - NumElts])) {
1596 IdentityLHS &= (M < 0) || (M == (
int)i);
1597 IdentityRHS &= (M < 0) || ((M - NumElts) == i);
1602 if (Updated && !IdentityLHS && !IdentityRHS && !TLO.LegalOps &&
1604 return TLO.CombineTo(Op,
1605 TLO.DAG.getVectorShuffle(VT, DL, Op.
getOperand(0),
1609 for (
unsigned i = 0; i != NumElts; ++i) {
1610 int M = ShuffleMask[i];
1612 KnownUndef.setBit(i);
1613 }
else if (M < (
int)NumElts) {
1615 KnownUndef.setBit(i);
1619 if (UndefRHS[M - NumElts])
1620 KnownUndef.setBit(i);
1621 if (ZeroRHS[M - NumElts])
1629 APInt SrcUndef, SrcZero;
1631 SrcZero, TLO, Depth + 1))
1634 KnownZero, TLO, Depth + 1))
1636 KnownZero &= SrcZero;
1637 KnownUndef &= SrcUndef;
1642 KnownZero, TLO, Depth + 1))
1648 KnownZero, TLO, Depth))
1654 assert((KnownUndef & KnownZero) == 0 &&
"Elements flagged as undef AND zero");
1662 const APInt &DemandedElts,
1664 unsigned Depth)
const {
1669 "Should use MaskedValueIsZero if you don't know whether Op" 1670 " is a target node!");
1676 const APInt &DemandedElts,
1678 unsigned Depth)
const {
1679 assert(isa<FrameIndexSDNode>(Op) &&
"expected FrameIndex");
1692 unsigned Depth)
const {
1697 "Should use ComputeNumSignBits if you don't know whether Op" 1698 " is a target node!");
1709 "Should use SimplifyDemandedVectorElts if you don't know whether Op" 1710 " is a target node!");
1722 if (
auto *CN = dyn_cast<ConstantSDNode>(N)) {
1723 CVal = CN->getAPIntValue();
1724 }
else if (
auto *BV = dyn_cast<BuildVectorSDNode>(N)) {
1725 auto *CN = BV->getConstantSplatNode();
1731 unsigned BVEltWidth = BV->getValueType(0).getScalarSizeInBits();
1732 CVal = CN->getAPIntValue();
1734 CVal = CVal.
trunc(BVEltWidth);
1798 const SDLoc &DL)
const {
1831 return DAG.
getSetCC(DL, VT, N0, Zero, Cond);
1842 if (YConst && YConst->isNullValue())
1848 return DAG.
getSetCC(DL, VT, NewAnd, Zero, Cond);
1864 SDValue TargetLowering::optimizeSetCCOfSignedTruncationCheck(
1866 const SDLoc &DL)
const {
1869 if (!(C1 = dyn_cast<ConstantSDNode>(N1)))
1878 if (!(C01 = dyn_cast<ConstantSDNode>(N0->
getOperand(1))))
1910 const unsigned KeptBits = I1.
logBase2();
1911 const unsigned KeptBitsMinusOne = I01.
logBase2();
1914 if (KeptBits != (KeptBitsMinusOne + 1))
1920 if (!DAG.getTargetLoweringInfo().shouldTransformSignedTruncationCheck(
1929 SDValue ShiftAmt = DAG.getConstant(MaskedBits, DL, XVT);
1932 SDValue T2 = DAG.getSetCC(DL, SCCVT, T1, X, NewCond);
1942 const SDLoc &dl)
const {
1961 return DAG.
getSetCC(dl, VT, N1, N0, SwappedCC);
1963 if (
auto *N1C = dyn_cast<ConstantSDNode>(N1.
getNode())) {
1964 const APInt &C1 = N1C->getAPIntValue();
1973 = cast<ConstantSDNode>(N0.
getOperand(1))->getAPIntValue();
2024 MinBits = N0->getOperand(0).getValueSizeInBits();
2026 }
else if (N0->getOpcode() ==
ISD::AND) {
2028 if (
auto *
C = dyn_cast<ConstantSDNode>(N0->getOperand(1)))
2029 if ((
C->getAPIntValue()+1).isPowerOf2()) {
2030 MinBits =
C->getAPIntValue().countTrailingOnes();
2035 MinBits = N0->getOperand(0).getValueSizeInBits();
2038 }
else if (
auto *LN0 = dyn_cast<LoadSDNode>(N0)) {
2041 MinBits = LN0->getMemoryVT().getSizeInBits();
2045 MinBits = LN0->getMemoryVT().getSizeInBits();
2051 unsigned ReqdBits = Signed ?
2058 MinBits >= ReqdBits) {
2063 if (MinBits == 1 && C1 == 1)
2068 return DAG.
getSetCC(dl, VT, Trunc, C, Cond);
2095 cast<CondCodeSDNode>(TopSetCC.
getOperand(2))->
get(),
2109 N0.getOpcode() ==
ISD::AND && C1 == 0 &&
2110 N0.getNode()->hasOneUse() &&
2111 isa<LoadSDNode>(N0.getOperand(0)) &&
2112 N0.getOperand(0).getNode()->hasOneUse() &&
2113 isa<ConstantSDNode>(N0.getOperand(1))) {
2114 LoadSDNode *Lod = cast<LoadSDNode>(N0.getOperand(0));
2116 unsigned bestWidth = 0, bestOffset = 0;
2118 unsigned origWidth = N0.getValueSizeInBits();
2119 unsigned maskWidth = origWidth;
2125 cast<ConstantSDNode>(N0.getOperand(1))->getAPIntValue();
2126 for (
unsigned width = origWidth / 2; width>=8; width /= 2) {
2128 for (
unsigned offset=0; offset<origWidth/width; offset++) {
2131 bestOffset = (uint64_t)offset * (width/8);
2133 bestOffset = (origWidth/width - offset - 1) * (width/8);
2134 bestMask = Mask.
lshr(offset * (width/8) * 8);
2147 if (bestOffset != 0)
2170 C1.getBitWidth() - InSize))) {
2187 return DAG.
getConstant(C1.isNonNegative(), dl, VT);
2201 EVT newVT = N0.getOperand(0).getValueType();
2220 EVT ExtSrcTy = cast<VTSDNode>(N0.getOperand(1))->getVT();
2222 EVT ExtDstTy = N0.getValueType();
2227 if (C1.getMinSignedBits() > ExtSrcTyBits)
2231 EVT Op0Ty = N0.getOperand(0).getValueType();
2232 if (Op0Ty == ExtSrcTy) {
2242 return DAG.
getSetCC(dl, VT, ZextOp,
2248 }
else if ((N1C->isNullValue() || N1C->isOne()) &&
2253 bool TrueWhenTrue = (Cond ==
ISD::SETEQ) ^ (!N1C->isOne());
2257 ISD::CondCode CC = cast<CondCodeSDNode>(N0.getOperand(2))->
get();
2259 N0.getOperand(0).getValueType().isInteger());
2262 return DAG.
getSetCC(dl, VT, N0.getOperand(0), N0.getOperand(1), CC);
2267 N0.getOperand(0).getOpcode() ==
ISD::XOR &&
2268 N0.getOperand(1) == N0.getOperand(0).getOperand(1))) &&
2269 isa<ConstantSDNode>(N0.getOperand(1)) &&
2270 cast<ConstantSDNode>(N0.getOperand(1))->isOne()) {
2283 N0.getOperand(0).getOpcode() ==
ISD::XOR);
2286 N0.getOperand(0).getOperand(0),
2290 return DAG.
getSetCC(dl, VT, Val, N1,
2293 }
else if (N1C->isOne() &&
2311 cast<ConstantSDNode>(Op0.
getOperand(1))->isOne()) {
2335 optimizeSetCCOfSignedTruncationCheck(VT, N0, N1, Cond, DCI, dl))
2342 const APInt &C1 = N1C->getAPIntValue();
2344 APInt MinVal, MaxVal;
2345 unsigned OperandBitSize = N1C->getValueType(0).getScalarSizeInBits();
2455 if (
auto *N1C = dyn_cast<ConstantSDNode>(N1.
getNode())) {
2456 const APInt &C1 = N1C->getAPIntValue();
2464 if (
auto *AndRHS = dyn_cast<ConstantSDNode>(N0.
getOperand(1))) {
2469 if (AndRHS->getAPIntValue().isPowerOf2()) {
2472 DAG.
getConstant(AndRHS->getAPIntValue().logBase2(), dl,
2475 }
else if (Cond ==
ISD::SETEQ && C1 == AndRHS->getAPIntValue()) {
2493 if (
auto *AndRHS = dyn_cast<ConstantSDNode>(N0.
getOperand(1))) {
2494 const APInt &AndRHSC = AndRHS->getAPIntValue();
2495 if ((-AndRHSC).isPowerOf2() && (AndRHSC & C1) == C1) {
2505 return DAG.
getSetCC(dl, VT, Shift, CmpRHS, Cond);
2535 return DAG.
getSetCC(dl, VT, Shift, CmpRHS, NewCond);
2541 if (isa<ConstantFPSDNode>(N0.
getNode())) {
2545 }
else if (
auto *CFP = dyn_cast<ConstantFPSDNode>(N1.
getNode())) {
2548 if (CFP->getValueAPF().isNaN()) {
2566 return DAG.
getSetCC(dl, VT, N0, N0, Cond);
2584 if (CFP->getValueAPF().isInfinity()) {
2585 if (CFP->getValueAPF().isNegative()) {
2629 if (UOF ==
unsigned(EqTrue))
2634 if (NewCond != Cond &&
2637 return DAG.
getSetCC(dl, VT, N0, N1, NewCond);
2663 bool LegalRHSImm =
false;
2665 if (
auto *RHSC = dyn_cast<ConstantSDNode>(N1)) {
2666 if (
auto *LHSR = dyn_cast<ConstantSDNode>(N0.
getOperand(1))) {
2671 LHSR->getAPIntValue(),
2683 RHSC->getAPIntValue(),
2694 RHSC->getAPIntValue(),
2701 if (RHSC->getValueType(0).getSizeInBits() <= 64)
2760 if (
SDValue V = simplifySetCCWithAnd(VT, N0, N1, Cond, DCI, dl))
2772 N0 = DAG.
getNOT(dl, Temp, OpVT);
2781 Temp = DAG.
getNOT(dl, N0, OpVT);
2788 Temp = DAG.
getNOT(dl, N1, OpVT);
2795 Temp = DAG.
getNOT(dl, N0, OpVT);
2802 Temp = DAG.
getNOT(dl, N1, OpVT);
2811 N0 = DAG.
getNode(ExtendCode, dl, VT, N0);
2824 if (
auto *GASD = dyn_cast<GlobalAddressSDNode>(N)) {
2825 GA = GASD->getGlobal();
2826 Offset += GASD->getOffset();
2834 if (
auto *V = dyn_cast<ConstantSDNode>(N2)) {
2835 Offset += V->getSExtValue();
2839 if (
auto *V = dyn_cast<ConstantSDNode>(N1)) {
2840 Offset += V->getSExtValue();
2861 unsigned S = Constraint.
size();
2864 switch (Constraint[0]) {
2892 if (S > 1 && Constraint[0] ==
'{' && Constraint[S-1] ==
'}') {
2893 if (S == 8 && Constraint.
substr(1, 6) ==
"memory")
2914 std::string &Constraint,
2915 std::vector<SDValue> &Ops,
2918 if (Constraint.length() > 1)
return;
2920 char ConstraintLetter = Constraint[0];
2921 switch (ConstraintLetter) {
2955 if (ConstraintLetter !=
'n') {
2956 int64_t Offs = GA->getOffset();
2959 C ?
SDLoc(C) : SDLoc(),
2966 if (ConstraintLetter !=
's') {
2980 std::pair<unsigned, const TargetRegisterClass *>
2984 if (Constraint.
empty() || Constraint[0] !=
'{')
2985 return std::make_pair(0u, static_cast<TargetRegisterClass*>(
nullptr));
2986 assert(*(Constraint.
end()-1) ==
'}' &&
"Not a brace enclosed constraint?");
2991 std::pair<unsigned, const TargetRegisterClass*> R =
2992 std::make_pair(0u, static_cast<const TargetRegisterClass*>(
nullptr));
3004 std::pair<unsigned, const TargetRegisterClass*> S =
3005 std::make_pair(*
I, RC);
3027 assert(!ConstraintCode.empty() &&
"No known constraint!");
3028 return isdigit(static_cast<unsigned char>(ConstraintCode[0]));
3034 assert(!ConstraintCode.empty() &&
"No known constraint!");
3035 return atoi(ConstraintCode.c_str());
3050 unsigned maCount = 0;
3058 ConstraintOperands.emplace_back(std::move(CI));
3068 switch (OpInfo.
Type) {
3084 assert(ResNo == 0 &&
"Asm only has one result!");
3107 if (
StructType *STy = dyn_cast<StructType>(OpTy))
3108 if (STy->getNumElements() == 1)
3109 OpTy = STy->getElementType(0);
3127 }
else if (
PointerType *PT = dyn_cast<PointerType>(OpTy)) {
3137 if (!ConstraintOperands.empty()) {
3139 unsigned bestMAIndex = 0;
3140 int bestWeight = -1;
3146 for (maIndex = 0; maIndex < maCount; ++maIndex) {
3148 for (
unsigned cIndex = 0, eIndex = ConstraintOperands.size();
3149 cIndex != eIndex; ++cIndex) {
3175 weightSum += weight;
3178 if (weightSum > bestWeight) {
3179 bestWeight = weightSum;
3180 bestMAIndex = maIndex;
3185 for (
unsigned cIndex = 0, eIndex = ConstraintOperands.size();
3186 cIndex != eIndex; ++cIndex) {
3196 for (
unsigned cIndex = 0, eIndex = ConstraintOperands.size();
3197 cIndex != eIndex; ++cIndex) {
3208 std::pair<unsigned, const TargetRegisterClass *> MatchRC =
3211 std::pair<unsigned, const TargetRegisterClass *> InputRC =
3216 (MatchRC.second != InputRC.second)) {
3218 " with a matching output constraint of" 3219 " incompatible type!");
3225 return ConstraintOperands;
3252 rCodes = &info.
Codes;
3258 for (
unsigned i = 0, e = rCodes->size(); i != e; ++i) {
3261 if (weight > BestWeight)
3262 BestWeight = weight;
3278 if (!CallOperandVal)
3281 switch (*constraint) {
3284 if (isa<ConstantInt>(CallOperandVal))
3288 if (isa<GlobalValue>(CallOperandVal))
3293 if (isa<ConstantFP>(CallOperandVal))
3340 assert(OpInfo.
Codes.size() > 1 &&
"Doesn't have multiple constraint options");
3341 unsigned BestIdx = 0;
3343 int BestGenerality = -1;
3346 for (
unsigned i = 0, e = OpInfo.
Codes.size(); i != e; ++i) {
3356 "Unhandled multi-letter 'other' constraint");
3357 std::vector<SDValue> ResultOps;
3360 if (!ResultOps.empty()) {
3374 if (Generality > BestGenerality) {
3377 BestGenerality = Generality;
3390 assert(!OpInfo.
Codes.empty() &&
"Must have at least one constraint");
3393 if (OpInfo.
Codes.size() == 1) {
3406 if (isa<BasicBlock>(v) || isa<ConstantInt>(v) || isa<Function>(v)) {
3425 assert(d != 0 &&
"Division by zero!");
3443 while ((t = d*xn) != 1)
3489 DAG.getConstant(magics.
m, dl, VT));
3494 DAG.getConstant(magics.
m, dl, VT)).getNode(), 1);
3510 auto &DL = DAG.getDataLayout();
3524 return DAG.getNode(
ISD::ADD, dl, VT, Q, T);
3551 if (magics.
a != 0 && !Divisor[0]) {
3560 assert(magics.
a == 0 &&
"Should use cheap fixup now");
3577 if (magics.
a == 0) {
3579 "We shouldn't generate an undefined shift!");
3601 if (!isa<ConstantSDNode>(Op.
getOperand(0))) {
3603 "be a constant integer");
3632 if (!HasMULHU && !HasMULHS && !HasUMUL_LOHI && !HasSMUL_LOHI)
3647 if ((
Signed && HasSMUL_LOHI) || (!
Signed && HasUMUL_LOHI)) {
3649 Hi =
SDValue(Lo.getNode(), 1);
3675 if (MakeMUL_LOHI(LL, RL, Lo, Hi,
false)) {
3688 RHSSB > InnerBitSize) {
3691 if (MakeMUL_LOHI(LL, RL, Lo, Hi,
true)) {
3698 unsigned ShiftAmount = OuterBitSize - InnerBitSize;
3720 if (!MakeMUL_LOHI(LL, RL, Lo, Hi,
false))
3743 if (!MakeMUL_LOHI(LL, RH, Lo, Hi,
false))
3750 if (!MakeMUL_LOHI(LH, RL, Lo, Hi,
false))
3791 DAG,
Kind, LL, LH, RL, RH);
3843 dl, Exponent, ExponentLoBit,
3884 for (
unsigned Idx = 0; Idx < NumElem; ++Idx) {
3886 DAG.
getExtLoad(ExtType, SL, DstEltVT, Chain, BasePTR,
3935 for (
unsigned Idx = 0; Idx < NumElem; ++Idx) {
3940 unsigned ShiftIntoIdx =
3956 assert (Stride &&
"Zero stride!");
3960 for (
unsigned Idx = 0; Idx < NumElem; ++Idx) {
3978 std::pair<SDValue, SDValue>
3981 "unaligned indexed loads not implemented!");
4009 return std::make_pair(Result, newLoad.
getValue(1));
4016 unsigned RegBytes = RegVT.getSizeInBits() / 8;
4017 unsigned NumRegs = (LoadedBytes + RegBytes - 1) / RegBytes;
4033 for (
unsigned i = 1; i < NumRegs; i++) {
4052 8 * (LoadedBytes -
Offset));
4074 return std::make_pair(Load, TF);
4078 "Unaligned load of unsupported type.");
4088 unsigned IncrementSize = NumBits / 8;
4103 Hi = DAG.
getExtLoad(HiExtType, dl, VT, Chain, Ptr,
4105 NewLoadedVT,
MinAlign(Alignment, IncrementSize),
4115 NewLoadedVT,
MinAlign(Alignment, IncrementSize),
4129 return std::make_pair(Result, TF);
4135 "unaligned indexed stores not implemented!");
4172 unsigned NumRegs = (StoredBytes + RegBytes - 1) / RegBytes;
4180 Chain, dl, Val, StackPtr,
4191 for (
unsigned i = 1; i < NumRegs; i++) {
4194 RegVT, dl, Store, StackPtr,
4211 8 * (StoredBytes -
Offset));
4230 "Unaligned store of unknown type.");
4234 int IncrementSize = NumBits / 8;
4251 Alignment =
MinAlign(Alignment, IncrementSize);
4266 bool IsCompressedMemory)
const {
4271 "Incompatible types of Data and Mask");
4272 if (IsCompressedMemory) {
4298 if (isa<ConstantSDNode>(Idx))
4326 "Converting bits to bytes lost precision");
4330 EVT IdxVT = Index.getValueType();
4351 std::string NameString = (
"__emutls_v." + GA->
getGlobal()->
getName()).str();
4355 assert(EmuTlsVar &&
"Cannot find EmuTlsVar ");
4357 Entry.
Ty = VoidPtrType;
4358 Args.push_back(Entry);
4365 std::pair<SDValue, SDValue> CallResult =
LowerCallTo(CLI);
4374 "Emulated TLS must have zero offset in GlobalAddressSDNode");
4375 return CallResult.first;
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.
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)
void push_back(const T &Elt)
SDValue BuildUDIV(SDNode *N, const APInt &Divisor, 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 ...
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.
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")
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)
C - The default llvm calling convention, compatible with C.
ConstantSDNode * isConstOrConstSplat(SDValue N)
Returns the SDNode if it is a constant splat BuildVector or constant int.
EXTRACT_SUBVECTOR(VECTOR, IDX) - Returns a subvector from VECTOR (an vector value) starting with the ...
LLVM_ATTRIBUTE_NORETURN void report_fatal_error(Error Err, bool gen_crash_diag=true)
Report a serious error, calling any installed error handler.
Compute iterated dominance frontiers using a linear time algorithm.
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
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.
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.
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.
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.
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.
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)
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...
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 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.
Type * getTypeForEVT(LLVMContext &Context) const
This method returns an LLVM type corresponding to the specified EVT.
Class to represent struct types.
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.
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.
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
SDValue BuildSDIV(SDNode *N, const APInt &Divisor, 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 ...
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.
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
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.
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 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.
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.
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...
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 isOneValue() const
Determine if this is a value of 1.
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.
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.
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
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...
static SDValue BuildExactSDIV(const TargetLowering &TLI, SDValue Op1, APInt d, 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...
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.
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...
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 ...
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.
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 ConstraintWeight getMultipleConstraintMatchWeight(AsmOperandInfo &info, int maIndex) const
Examine constraint type and operand type and determine a weight value.
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.
SDNode * UpdateNodeOperands(SDNode *N, SDValue Op)
Mutate the specified node in-place to have the specified operands.
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...
SDValue getBuildVector(EVT VT, const SDLoc &DL, ArrayRef< SDValue > Ops)
Return an ISD::BUILD_VECTOR node.
CCValAssign - Represent assignment of one arg/retval to a location.
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.
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)
bool uge(const APInt &RHS) const
Unsigned greater or equal comparison.
SDValue getNOT(const SDLoc &DL, SDValue Val, EVT VT)
Create a bitwise NOT operation as (XOR Val, -1).
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.
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 SimplifyDemandedBits(SDNode *User, unsigned OpIdx, const APInt &Demanded, DAGCombinerInfo &DCI, TargetLoweringOpt &TLO) const
Helper for SimplifyDemandedBits that can simplify an operation with multiple uses.
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...
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.
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 ...
void computeKnownBits(SDValue Op, KnownBits &Known, unsigned Depth=0) const
Determine which bits of Op are known to be either zero or one and return them in Known.
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.
static bool isSigned(Value *V)
Can the given value generate sign bits.
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)
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.
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.
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.
static SDNodeIterator end(const SDNode *N)
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.
#define LLVM_FALLTHROUGH
LLVM_FALLTHROUGH - Mark fallthrough cases in switch statements.
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...
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.
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...
FNEG, FABS, FSQRT, FSIN, FCOS, FPOWI, FPOW, FLOG, FLOG2, FLOG10, FEXP, FEXP2, FCEIL, FTRUNC, FRINT, FNEARBYINT, FROUND, FFLOOR - Perform various unary floating point operations.
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
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.