99 return getValueAPF().bitwiseIsEqual(V);
126 unsigned SplatBitSize;
129 unsigned MinSplatBits = AllowShrink ? 0 : EltSize;
130 return BV->isConstantSplat(SplatVal, SplatUndef, SplatBitSize, HasUndefs,
132 EltSize >= SplatBitSize;
152 if (i == e)
return false;
165 if (CN->getAPIntValue().countTrailingOnes() < EltSize)
168 if (CFPN->getValueAPF().bitcastToAPInt().countTrailingOnes() < EltSize)
176 for (++i; i != e; ++i)
189 bool IsAllUndef =
true;
204 if (CN->getAPIntValue().countTrailingZeros() < EltSize)
207 if (CFPN->getValueAPF().bitcastToAPInt().countTrailingZeros() < EltSize)
226 if (!isa<ConstantSDNode>(
Op))
239 if (!isa<ConstantFPSDNode>(
Op))
277 unsigned OldL = (Operation >> 2) & 1;
278 unsigned OldG = (Operation >> 1) & 1;
285 unsigned Operation =
Op;
322 unsigned Op = Op1 | Op2;
378 for (
auto&
Op : Ops) {
387 for (
auto&
Op : Ops) {
417 ID.
AddPointer(cast<ConstantFPSDNode>(N)->getConstantFPValue());
436 ID.
AddPointer(cast<RegisterMaskSDNode>(N)->getRegMask());
439 ID.
AddPointer(cast<SrcValueSDNode>(N)->getValue());
443 ID.
AddInteger(cast<FrameIndexSDNode>(N)->getIndex());
447 ID.
AddInteger(cast<JumpTableSDNode>(N)->getIndex());
448 ID.
AddInteger(cast<JumpTableSDNode>(N)->getTargetFlags());
528 ID.
AddInteger(cast<MemSDNode>(N)->getPointerInfo().getAddrSpace());
561 for (
unsigned i = 1, e = N->
getNumValues(); i != e; ++i)
579 if (Node.use_empty())
594 while (!DeadNodes.
empty()) {
603 DUL->NodeDeleted(N,
nullptr);
606 RemoveNodeFromCSEMaps(N);
637 RemoveNodeFromCSEMaps(N);
641 DeleteNodeNotInCSEMaps(N);
644 void SelectionDAG::DeleteNodeNotInCSEMaps(
SDNode *
N) {
646 "Cannot delete the entry node!");
656 DbgValMapType::iterator
I = DbgValMap.find(Node);
657 if (I == DbgValMap.end())
659 for (
auto &Val: I->second)
660 Val->setIsInvalidated();
664 void SelectionDAG::DeallocateNode(
SDNode *N) {
692 "Wrong return type!");
695 "Mismatched operand types!");
697 "Wrong operand type!");
699 "Wrong return type size");
706 "Wrong number of operands!");
709 assert((
I->getValueType() == EltVT ||
710 (EltVT.isInteger() &&
I->getValueType().isInteger() &&
711 EltVT.bitsLE(
I->getValueType()))) &&
712 "Wrong operand type!");
714 "Operands must all have the same type");
726 void SelectionDAG::InsertNode(
SDNode *N) {
727 AllNodes.push_back(N);
738 bool SelectionDAG::RemoveNodeFromCSEMaps(
SDNode *N) {
743 assert(CondCodeNodes[cast<CondCodeSDNode>(N)->
get()] &&
744 "Cond code doesn't exist!");
745 Erased = CondCodeNodes[cast<CondCodeSDNode>(
N)->
get()] !=
nullptr;
746 CondCodeNodes[cast<CondCodeSDNode>(
N)->
get()] =
nullptr;
749 Erased = ExternalSymbols.erase(cast<ExternalSymbolSDNode>(N)->
getSymbol());
753 Erased = TargetExternalSymbols.erase(
754 std::pair<std::string,unsigned char>(ESN->
getSymbol(),
759 auto *MCSN = cast<MCSymbolSDNode>(
N);
760 Erased = MCSymbols.erase(MCSN->getMCSymbol());
764 EVT VT = cast<VTSDNode>(
N)->getVT();
766 Erased = ExtendedValueTypeNodes.erase(VT);
777 Erased = CSEMap.RemoveNode(N);
799 SelectionDAG::AddModifiedNodeToCSEMaps(
SDNode *N) {
803 SDNode *Existing = CSEMap.GetOrInsertNode(N);
812 DUL->NodeDeleted(N, Existing);
813 DeleteNodeNotInCSEMaps(N);
836 SDNode *Node = FindNodeOrInsertPos(ID,
SDLoc(N), InsertPos);
856 SDNode *Node = FindNodeOrInsertPos(ID,
SDLoc(N), InsertPos);
874 SDNode *Node = FindNodeOrInsertPos(ID,
SDLoc(N), InsertPos);
890 : TM(tm), OptLevel(OL),
893 InsertNode(&EntryNode);
907 assert(!UpdateListeners &&
"Dangling registered DAGUpdateListeners");
909 OperandRecycler.clear(OperandAllocator);
913 void SelectionDAG::allnodes_clear() {
914 assert(&*AllNodes.begin() == &EntryNode);
915 AllNodes.remove(AllNodes.begin());
916 while (!AllNodes.empty())
917 DeallocateNode(&AllNodes.front());
919 NextPersistentId = 0;
925 SDNode *N = CSEMap.FindNodeOrInsertPos(ID, InsertPos);
932 "debug location. Use another overload.");
939 const SDLoc &
DL,
void *&InsertPos) {
940 SDNode *N = CSEMap.FindNodeOrInsertPos(ID, InsertPos);
965 OperandRecycler.clear(OperandAllocator);
966 OperandAllocator.
Reset();
969 ExtendedValueTypeNodes.clear();
970 ExternalSymbols.clear();
971 TargetExternalSymbols.clear();
973 std::fill(CondCodeNodes.begin(), CondCodeNodes.end(),
975 std::fill(ValueTypeNodes.begin(), ValueTypeNodes.end(),
976 static_cast<SDNode*
>(
nullptr));
978 EntryNode.UseList =
nullptr;
979 InsertNode(&EntryNode);
1019 "getZeroExtendInReg should use the vector element type instead of "
1020 "the vector type!");
1031 assert(VT.
isVector() &&
"This DAG node is restricted to vector types.");
1033 "The sizes of the input and result must match in order to perform the "
1034 "extend in-register.");
1036 "The destination vector type must have fewer lanes than the input.");
1042 assert(VT.
isVector() &&
"This DAG node is restricted to vector types.");
1044 "The sizes of the input and result must match in order to perform the "
1045 "extend in-register.");
1047 "The destination vector type must have fewer lanes than the input.");
1053 assert(VT.
isVector() &&
"This DAG node is restricted to vector types.");
1055 "The sizes of the input and result must match in order to perform the "
1056 "extend in-register.");
1058 "The destination vector type must have fewer lanes than the input.");
1087 bool isT,
bool isO) {
1090 (uint64_t)((int64_t)Val >> EltVT.
getSizeInBits()) + 1 < 2) &&
1091 "getConstant with a uint64_t value that doesn't fit in the type!");
1096 bool isT,
bool isO) {
1101 EVT VT,
bool isT,
bool isO) {
1129 unsigned ViaVecNumElts = VT.
getSizeInBits() / ViaEltSizeInBits;
1141 ViaEltVT, isT, isO));
1158 Ops.
insert(Ops.
end(), EltParts.begin(), EltParts.end());
1163 "APInt size does not match type size!");
1171 if ((N = FindNodeOrInsertPos(ID, DL, IP)))
1176 N = newSDNode<ConstantSDNode>(isT, isO, Elt, DL.
getDebugLoc(), EltVT);
1177 CSEMap.InsertNode(N, IP);
1198 EVT VT,
bool isTarget) {
1212 if ((N = FindNodeOrInsertPos(ID, DL, IP)))
1217 N = newSDNode<ConstantFPSDNode>(isTarget, &V, DL.
getDebugLoc(), EltVT);
1218 CSEMap.InsertNode(N, IP);
1247 EVT VT, int64_t
Offset,
bool isTargetGA,
1249 assert((TargetFlags == 0 || isTargetGA) &&
1250 "Cannot set target flags on target-independent globals");
1269 if (
SDNode *
E = FindNodeOrInsertPos(ID, DL, IP))
1272 auto *N = newSDNode<GlobalAddressSDNode>(
1274 CSEMap.InsertNode(N, IP);
1285 if (
SDNode *
E = FindNodeOrInsertPos(ID, IP))
1288 auto *N = newSDNode<FrameIndexSDNode>(FI, VT, isTarget);
1289 CSEMap.InsertNode(N, IP);
1296 assert((TargetFlags == 0 || isTarget) &&
1297 "Cannot set target flags on target-independent jump tables");
1304 if (
SDNode *
E = FindNodeOrInsertPos(ID, IP))
1307 auto *N = newSDNode<JumpTableSDNode>(JTI, VT, isTarget,
TargetFlags);
1308 CSEMap.InsertNode(N, IP);
1314 unsigned Alignment,
int Offset,
1317 assert((TargetFlags == 0 || isTarget) &&
1318 "Cannot set target flags on target-independent globals");
1331 if (
SDNode *
E = FindNodeOrInsertPos(ID, IP))
1334 auto *N = newSDNode<ConstantPoolSDNode>(isTarget,
C, VT,
Offset, Alignment,
1336 CSEMap.InsertNode(N, IP);
1342 unsigned Alignment,
int Offset,
1345 assert((TargetFlags == 0 || isTarget) &&
1346 "Cannot set target flags on target-independent globals");
1357 if (
SDNode *
E = FindNodeOrInsertPos(ID, IP))
1360 auto *N = newSDNode<ConstantPoolSDNode>(isTarget,
C, VT,
Offset, Alignment,
1362 CSEMap.InsertNode(N, IP);
1375 if (
SDNode *
E = FindNodeOrInsertPos(ID, IP))
1379 CSEMap.InsertNode(N, IP);
1389 if (
SDNode *
E = FindNodeOrInsertPos(ID, IP))
1392 auto *N = newSDNode<BasicBlockSDNode>(MBB);
1393 CSEMap.InsertNode(N, IP);
1400 ValueTypeNodes.size())
1407 N = newSDNode<VTSDNode>(VT);
1413 SDNode *&N = ExternalSymbols[Sym];
1415 N = newSDNode<ExternalSymbolSDNode>(
false, Sym, 0, VT);
1421 SDNode *&N = MCSymbols[Sym];
1424 N = newSDNode<MCSymbolSDNode>(Sym, VT);
1432 TargetExternalSymbols[std::pair<std::string,unsigned char>(Sym,
1435 N = newSDNode<ExternalSymbolSDNode>(
true, Sym,
TargetFlags, VT);
1441 if ((
unsigned)Cond >= CondCodeNodes.size())
1442 CondCodeNodes.resize(Cond+1);
1444 if (!CondCodeNodes[Cond]) {
1445 auto *N = newSDNode<CondCodeSDNode>(Cond);
1446 CondCodeNodes[Cond] =
N;
1450 return SDValue(CondCodeNodes[Cond], 0);
1463 "Must have the same number of vector elements as mask elements!");
1465 "Invalid VECTOR_SHUFFLE");
1473 int NElts = Mask.
size();
1475 "Index out of range");
1483 for (
int i = 0; i != NElts; ++i)
1484 if (MaskVec[i] >= NElts) MaskVec[i] -= NElts;
1499 for (
int i = 0; i < NElts; ++i) {
1500 if (MaskVec[i] <
Offset || MaskVec[i] >= (
Offset + NElts))
1504 if (UndefElements[MaskVec[i] -
Offset]) {
1510 if (!UndefElements[i])
1514 if (
auto *N1BV = dyn_cast<BuildVectorSDNode>(N1))
1515 BlendSplat(N1BV, 0);
1516 if (
auto *N2BV = dyn_cast<BuildVectorSDNode>(N2))
1517 BlendSplat(N2BV, NElts);
1521 bool AllLHS =
true, AllRHS =
true;
1523 for (
int i = 0; i != NElts; ++i) {
1524 if (MaskVec[i] >= NElts) {
1529 }
else if (MaskVec[i] >= 0) {
1533 if (AllLHS && AllRHS)
1535 if (AllLHS && !N2Undef)
1548 bool Identity =
true, AllSame =
true;
1549 for (
int i = 0; i != NElts; ++i) {
1550 if (MaskVec[i] >= 0 && MaskVec[i] != i) Identity =
false;
1551 if (MaskVec[i] != MaskVec[0]) AllSame =
false;
1553 if (Identity && NElts)
1566 if (
auto *BV = dyn_cast<BuildVectorSDNode>(V)) {
1578 if (Splat && UndefElements.
none()) {
1583 if (
auto *
C = dyn_cast<ConstantSDNode>(Splat))
1584 if (
C->isNullValue())
1589 if (AllSame && SameNumElts) {
1606 for (
int i = 0; i != NElts; ++i)
1610 if (
SDNode *
E = FindNodeOrInsertPos(ID, dl, IP))
1616 int *MaskAlloc = OperandAllocator.
Allocate<
int>(NElts);
1617 std::copy(MaskVec.begin(), MaskVec.end(), MaskAlloc);
1619 auto *N = newSDNode<ShuffleVectorSDNode>(VT, dl.
getIROrder(),
1621 createOperands(N, Ops);
1623 CSEMap.InsertNode(N, IP);
1643 if (
SDNode *
E = FindNodeOrInsertPos(ID, IP))
1646 auto *N = newSDNode<RegisterSDNode>(RegNo, VT);
1647 CSEMap.InsertNode(N, IP);
1657 if (
SDNode *
E = FindNodeOrInsertPos(ID, IP))
1660 auto *N = newSDNode<RegisterMaskSDNode>(RegMask);
1661 CSEMap.InsertNode(N, IP);
1673 if (
SDNode *
E = FindNodeOrInsertPos(ID, IP))
1677 createOperands(N, Ops);
1679 CSEMap.InsertNode(N, IP);
1696 if (
SDNode *
E = FindNodeOrInsertPos(ID, IP))
1700 CSEMap.InsertNode(N, IP);
1707 "SrcValue is not a pointer?");
1714 if (
SDNode *
E = FindNodeOrInsertPos(ID, IP))
1717 auto *N = newSDNode<SrcValueSDNode>(V);
1718 CSEMap.InsertNode(N, IP);
1729 if (
SDNode *
E = FindNodeOrInsertPos(ID, IP))
1732 auto *N = newSDNode<MDNodeSDNode>(MD);
1733 CSEMap.InsertNode(N, IP);
1746 unsigned SrcAS,
unsigned DestAS) {
1754 if (
SDNode *
E = FindNodeOrInsertPos(ID, dl, IP))
1759 createOperands(N, Ops);
1761 CSEMap.InsertNode(N, IP);
1771 if (OpTy == ShTy || OpTy.
isVector())
return Op;
1779 const Value *V = cast<SrcValueSDNode>(Node->
getOperand(2))->getValue();
1790 assert(((Align & (Align-1)) == 0) &&
"Expected Align to be a power of 2");
1793 getConstant(Align - 1, dl, VAList.getValueType()));
1796 getConstant(-(int64_t)Align, dl, VAList.getValueType()));
1803 dl, VAList.getValueType()));
1816 const Value *VD = cast<SrcValueSDNode>(Node->
getOperand(3))->getValue();
1829 unsigned StackAlign =
1880 const APInt &C2 = N2C->getAPIntValue();
1882 const APInt &C1 = N1C->getAPIntValue();
1950 return getSetCC(dl, VT, N2, N1, SwappedCond);
1969 unsigned Depth)
const {
1980 const APInt &ShAmt = SA->getAPIntValue();
1991 unsigned Depth)
const {
2003 const APInt &DemandedElts,
2004 unsigned Depth)
const {
2021 Known.
One = cast<ConstantSDNode>(
Op)->getAPIntValue();
2027 "Unexpected vector size");
2030 if (!DemandedElts[i])
2039 "Expected BUILD_VECTOR implicit truncation");
2040 Known2 = Known2.
trunc(BitWidth);
2048 if (!Known.
One && !Known.
Zero)
2055 APInt DemandedLHS(NumElts, 0), DemandedRHS(NumElts, 0);
2058 assert(NumElts == SVN->
getMask().size() &&
"Unexpected vector size");
2059 for (
unsigned i = 0; i != NumElts; ++i) {
2060 if (!DemandedElts[i])
2068 DemandedLHS.clearAllBits();
2073 if ((
unsigned)M < NumElts)
2074 DemandedLHS.setBit((
unsigned)M % NumElts);
2076 DemandedRHS.
setBit((
unsigned)M % NumElts);
2079 if (!!DemandedLHS) {
2086 if (!Known.
One && !Known.
Zero)
2088 if (!!DemandedRHS) {
2102 for (
unsigned i = 0; i != NumSubVectors; ++i) {
2103 APInt DemandedSub = DemandedElts.
lshr(i * NumSubVectorElts);
2104 DemandedSub = DemandedSub.
trunc(NumSubVectorElts);
2105 if (!!DemandedSub) {
2112 if (!Known.
One && !Known.
Zero)
2126 APInt DemandedSrc = DemandedElts.
zext(NumSrcElts).
shl(Idx);
2142 if (BitWidth == SubBitWidth) {
2153 if ((BitWidth % SubBitWidth) == 0) {
2160 unsigned SubScale = BitWidth / SubBitWidth;
2161 APInt SubDemandedElts(NumElts * SubScale, 0);
2162 for (
unsigned i = 0; i != NumElts; ++i)
2163 if (DemandedElts[i])
2164 SubDemandedElts.
setBit(i * SubScale);
2166 for (
unsigned i = 0; i != SubScale; ++i) {
2169 Known.
One |= Known2.
One.
zext(BitWidth).
shl(SubBitWidth * i);
2175 if ((SubBitWidth % BitWidth) == 0) {
2181 unsigned SubScale = SubBitWidth / BitWidth;
2182 APInt SubDemandedElts(NumElts / SubScale, 0);
2183 for (
unsigned i = 0; i != NumElts; ++i)
2184 if (DemandedElts[i])
2185 SubDemandedElts.
setBit(i / SubScale);
2190 for (
unsigned i = 0; i != NumElts; ++i)
2191 if (DemandedElts[i]) {
2192 unsigned Offset = (i % SubScale) * BitWidth;
2196 if (!Known.
One && !Known.
Zero)
2229 Known.
Zero = KnownZeroOut;
2244 BitWidth) - BitWidth;
2260 if (RHSMaxLeadingZeros != BitWidth)
2261 LeadZ =
std::min(BitWidth, LeadZ + BitWidth - RHSMaxLeadingZeros - 1);
2269 if (!Known.
One && !Known.
Zero)
2280 if (!Known.
One && !Known.
Zero)
2311 Known.
Zero <<= *ShAmt;
2312 Known.
One <<= *ShAmt;
2355 InSignMask = InSignMask.
zext(BitWidth);
2357 InputDemandedBits |= InSignMask;
2360 Known.
One &= InputDemandedBits;
2361 Known.
Zero &= InputDemandedBits;
2366 Known.
Zero |= NewBits;
2367 Known.
One &= ~NewBits;
2369 Known.
One |= NewBits;
2370 Known.
Zero &= ~NewBits;
2372 Known.
Zero &= ~NewBits;
2373 Known.
One &= ~NewBits;
2382 unsigned LowBits =
Log2_32(PossibleTZ) + 1;
2391 unsigned LowBits =
Log2_32(PossibleLZ) + 1;
2418 Known = Known.
trunc(InBits);
2422 Known = Known.
zext(BitWidth);
2429 Known = Known.
trunc(InBits);
2431 Known = Known.
zext(BitWidth);
2440 Known = Known.
trunc(InBits);
2445 Known = Known.
sext(BitWidth);
2451 Known = Known.
trunc(InBits);
2453 Known = Known.
zext(BitWidth);
2459 Known = Known.
zext(InBits);
2461 Known = Known.
trunc(BitWidth);
2468 Known.
Zero |= (~InMask);
2493 if (CLHS->getAPIntValue().isNonNegative()) {
2503 if ((Known2.
Zero & MaskV) == MaskV) {
2504 unsigned NLZ2 = CLHS->getAPIntValue().countLeadingZeros();
2516 if (KnownZeroLow == 0)
2560 if (KnownZeroLow >= 2)
2566 if (KnownZeroHigh > 1)
2572 const APInt &RA = Rem->getAPIntValue().
abs();
2574 APInt LowBits = RA - 1;
2578 Known.
Zero = Known2.
Zero & LowBits;
2579 Known.
One = Known2.
One & LowBits;
2583 if (Known2.
Zero[BitWidth-1] || ((Known2.
Zero & LowBits) == LowBits))
2584 Known.
Zero |= ~LowBits;
2588 if (Known2.
One[BitWidth-1] && ((Known2.
One & LowBits) != 0))
2589 Known.
One |= ~LowBits;
2590 assert((Known.
Zero & Known.
One) == 0&&
"Bits known to be one AND zero?");
2596 const APInt &RA = Rem->getAPIntValue();
2598 APInt LowBits = (RA - 1);
2602 Known.
Zero = Known2.
Zero | ~LowBits;
2603 Known.
One = Known2.
One & LowBits;
2629 Known = Known.
trunc(BitWidth);
2641 if (BitWidth > EltBitWidth)
2642 Known = Known.
trunc(EltBitWidth);
2653 if (BitWidth > EltBitWidth)
2654 Known = Known.
zext(BitWidth);
2670 if (DemandedElts[EltIdx]) {
2758 if (!Known.
One && !Known.
Zero)
2786 assert((Known.
Zero & Known.
One) == 0 &&
"Bits known to be one AND zero?");
2802 (void)(~N0Known.
Zero).uadd_ov(~N1Known.
Zero, overflow);
2809 (~N1Known.
Zero & 0x01) == ~N1Known.
Zero)
2816 if ((~N0Known.
Zero & 0x01) == ~N0Known.
Zero)
2829 return Const->getAPIntValue().zextOrTrunc(BitWidth).isPowerOf2();
2835 if (
C &&
C->getAPIntValue() == 1)
2843 if (
C &&
C->getAPIntValue().isSignMask())
2851 return C->getAPIntValue().zextOrTrunc(BitWidth).isPowerOf2();
2874 unsigned Depth)
const {
2880 unsigned FirstAnswer = 1;
2891 Tmp = cast<VTSDNode>(Op.
getOperand(1))->getVT().getSizeInBits();
2892 return VTBits-Tmp+1;
2894 Tmp = cast<VTSDNode>(Op.
getOperand(1))->getVT().getSizeInBits();
2898 const APInt &Val = cast<ConstantSDNode>(
Op)->getAPIntValue();
2904 for (
unsigned i = 0, e = Op.
getNumOperands(); (i < e) && (Tmp > 1); ++i) {
2905 if (!DemandedElts[i])
2914 "Expected BUILD_VECTOR implicit truncation");
2916 Tmp2 = (Tmp2 > ExtraBits ? Tmp2 - ExtraBits : 1);
2925 APInt DemandedLHS(NumElts, 0), DemandedRHS(NumElts, 0);
2927 assert(NumElts == SVN->
getMask().size() &&
"Unexpected vector size");
2928 for (
unsigned i = 0; i != NumElts; ++i) {
2930 if (!DemandedElts[i])
2936 if ((
unsigned)M < NumElts)
2937 DemandedLHS.setBit((
unsigned)M % NumElts);
2939 DemandedRHS.
setBit((
unsigned)M % NumElts);
2944 if (!!DemandedRHS) {
2951 assert(Tmp <= VTBits &&
"Failed to determine minimum sign bits");
2962 Tmp = cast<VTSDNode>(Op.
getOperand(1))->getVT().getScalarSizeInBits();
2972 APInt ShiftVal =
C->getAPIntValue();
2981 if (
C->getAPIntValue().uge(VTBits) ||
2982 C->getAPIntValue().uge(Tmp))
break;
2983 return Tmp -
C->getZExtValue();
3002 if (Tmp == 1)
return 1;
3007 if (Tmp == 1)
return 1;
3044 unsigned RotAmt =
C->getZExtValue() & (VTBits-1);
3048 RotAmt = (VTBits-RotAmt) & (VTBits-1);
3053 if (Tmp > RotAmt+1)
return Tmp-RotAmt;
3061 if (Tmp == 1)
return 1;
3065 if (CRHS->isAllOnesValue()) {
3071 if ((Known.
Zero | 1).isAllOnesValue())
3081 if (Tmp2 == 1)
return 1;
3086 if (Tmp2 == 1)
return 1;
3090 if (CLHS->isNullValue()) {
3095 if ((Known.
Zero | 1).isAllOnesValue())
3109 if (Tmp == 1)
return 1;
3115 if (NumSrcSignBits > (NumSrcBits - VTBits))
3116 return NumSrcSignBits - (NumSrcBits - VTBits);
3130 return std::max(std::min(KnownSign - rIndex * BitWidth, BitWidth), 0);
3146 if (DemandedElts[EltIdx]) {
3155 APInt VectorElts = DemandedElts;
3167 assert(Tmp <= VTBits &&
"Failed to determine minimum sign bits");
3181 if (BitWidth != EltBitWidth)
3203 APInt DemandedSrc = DemandedElts.
zext(NumSrcElts).
shl(Idx);
3215 for (
unsigned i = 0; (i < NumSubVectors) && (Tmp > 1); ++i) {
3216 APInt DemandedSub = DemandedElts.
lshr(i * NumSubVectorElts);
3217 DemandedSub = DemandedSub.
trunc(NumSubVectorElts);
3223 assert(Tmp <= VTBits &&
"Failed to determine minimum sign bits");
3231 unsigned ExtType =
LD->getExtensionType();
3235 Tmp =
LD->getMemoryVT().getScalarSizeInBits();
3236 return VTBits-Tmp+1;
3238 Tmp =
LD->getMemoryVT().getScalarSizeInBits();
3252 FirstAnswer =
std::max(FirstAnswer, NumBits);
3286 cast<ConstantSDNode>(Op.
getOperand(1))->getAPIntValue()))
3302 return !
C->getValueAPF().isNaN();
3312 return !
C->isZero();
3319 return !
C->isNullValue();
3328 if (A == B)
return true;
3333 if (CA->isZero() && CB->isZero())
return true;
3341 "Values must have the same type");
3345 return (AKnown.Zero | BKnown.Zero).isAllOnesValue();
3351 assert(!Ops.
empty() &&
"Can't concatenate an empty list of vectors!");
3356 "Concatenation of vectors with inconsistent value types!");
3357 assert((Ops.
size() * Ops[0].getValueType().getVectorNumElements()) ==
3359 "Incorrect element count in vector concatenation!");
3361 if (Ops.
size() == 1)
3402 if (
SDNode *
E = FindNodeOrInsertPos(ID, DL, IP))
3407 CSEMap.InsertNode(N, IP);
3421 const APInt &Val =
C->getAPIntValue();
3426 C->isTargetOpcode(),
C->isOpaque());
3431 C->isTargetOpcode(),
C->isOpaque());
3553 if (BV->isConstant()) {
3600 "Vector element count mismatch!");
3602 "Invalid fpext node, dst < src!");
3608 "Invalid SIGN_EXTEND!");
3613 "Vector element count mismatch!");
3615 "Invalid sext node, dst < src!");
3624 "Invalid ZERO_EXTEND!");
3629 "Vector element count mismatch!");
3631 "Invalid zext node, dst < src!");
3640 "Invalid ANY_EXTEND!");
3645 "Vector element count mismatch!");
3647 "Invalid anyext node, dst < src!");
3665 "Invalid TRUNCATE!");
3670 "Vector element count mismatch!");
3672 "Invalid truncate node, src < dst!");
3698 "BSWAP types must be a multiple of 16 bits!");
3704 "Invalid BITREVERSE!");
3711 "Cannot BITCAST between types of different sizes!");
3724 "Illegal SCALAR_TO_VECTOR node!");
3729 isa<ConstantSDNode>(Operand.
getOperand(1)) &&
3756 if (
SDNode *
E = FindNodeOrInsertPos(ID, DL, IP)) {
3757 E->intersectFlagsWith(Flags);
3763 createOperands(N, Ops);
3764 CSEMap.InsertNode(N, IP);
3767 createOperands(N, Ops);
3777 case ISD::ADD:
return std::make_pair(C1 + C2,
true);
3778 case ISD::SUB:
return std::make_pair(C1 - C2,
true);
3779 case ISD::MUL:
return std::make_pair(C1 * C2,
true);
3780 case ISD::AND:
return std::make_pair(C1 & C2,
true);
3781 case ISD::OR:
return std::make_pair(C1 | C2,
true);
3782 case ISD::XOR:
return std::make_pair(C1 ^ C2,
true);
3783 case ISD::SHL:
return std::make_pair(C1 << C2,
true);
3784 case ISD::SRL:
return std::make_pair(C1.
lshr(C2),
true);
3785 case ISD::SRA:
return std::make_pair(C1.
ashr(C2),
true);
3788 case ISD::SMIN:
return std::make_pair(C1.
sle(C2) ? C1 : C2,
true);
3789 case ISD::SMAX:
return std::make_pair(C1.
sge(C2) ? C1 : C2,
true);
3790 case ISD::UMIN:
return std::make_pair(C1.
ule(C2) ? C1 : C2,
true);
3791 case ISD::UMAX:
return std::make_pair(C1.
uge(C2) ? C1 : C2,
true);
3793 if (!C2.getBoolValue())
3795 return std::make_pair(C1.
udiv(C2),
true);
3797 if (!C2.getBoolValue())
3799 return std::make_pair(C1.
urem(C2),
true);
3801 if (!C2.getBoolValue())
3803 return std::make_pair(C1.
sdiv(C2),
true);
3805 if (!C2.getBoolValue())
3807 return std::make_pair(C1.
srem(C2),
true);
3809 return std::make_pair(
APInt(1, 0),
false);
3838 case ISD::SUB: Offset = -uint64_t(Offset);
break;
3853 assert(Ops.
size() == 2 &&
"Div/rem should have 2 operands");
3860 [](
SDValue V) {
return V.isUndef() ||
3883 if (
const ConstantSDNode *Scalar1 = dyn_cast<ConstantSDNode>(Cst1)) {
3884 if (
const ConstantSDNode *Scalar2 = dyn_cast<ConstantSDNode>(Cst2)) {
3887 "Can't fold vectors ops with scalar operands");
3930 "Vector size mismatch!");
3958 auto IsScalarOrSameVectorSize = [&](
const SDValue &
Op) {
3963 auto IsConstantBuildVectorOrUndef = [&](
const SDValue &
Op) {
3972 if (!
llvm::all_of(Ops, IsConstantBuildVectorOrUndef) ||
3991 for (
unsigned i = 0; i != NumElts; i++) {
4017 SDValue ScalarResult =
getNode(Opcode, DL, SVT, ScalarOps, Flags);
4020 if (LegalSVT != SVT)
4045 }
else if (N1CFP && !N2CFP) {
4059 if (N1 == N2)
return N1;
4069 assert(VT.
isInteger() &&
"This operator does not apply to FP types!");
4071 N1.
getValueType() == VT &&
"Binary operator types must match!");
4074 if (N2C && N2C->isNullValue())
4076 if (N2C && N2C->isAllOnesValue())
4083 assert(VT.
isInteger() &&
"This operator does not apply to FP types!");
4085 N1.
getValueType() == VT &&
"Binary operator types must match!");
4088 if (N2C && N2C->isNullValue())
4102 assert(VT.
isInteger() &&
"This operator does not apply to FP types!");
4104 N1.
getValueType() == VT &&
"Binary operator types must match!");
4114 if (N2CFP && N2CFP->getValueAPF().isZero())
4118 if (N2CFP && N2CFP->getValueAPF().isZero())
4122 if (N2CFP && N2CFP->isZero())
4125 if (N2CFP && N2CFP->isExactlyValue(1.0))
4131 N1.
getValueType() == VT &&
"Binary operator types must match!");
4137 "Invalid FCOPYSIGN!");
4145 "Shift operators return type must be the same as their first arg");
4147 "Shifts only work on integers");
4149 "Vector shift amounts must be in the same as their first arg");
4155 "Invalid use of small shift amount with oversized value!");
4162 if (N2C && N2C->isNullValue())
4166 EVT EVT = cast<VTSDNode>(N2)->getVT();
4169 "Cannot FP_ROUND_INREG integer types");
4171 "FP_ROUND_INREG type should be vector iff the operand "
4175 "Vector element counts must match in FP_ROUND_INREG");
4178 if (cast<VTSDNode>(N2)->getVT() == VT)
return N1;
4185 N2C && (N2C->getZExtValue() == 0 || N2C->getZExtValue() == 1) &&
4186 "Invalid FP_ROUND!");
4191 EVT EVT = cast<VTSDNode>(N2)->getVT();
4194 "Cannot *_EXTEND_INREG FP types");
4196 "AssertSExt/AssertZExt type should be the vector element type "
4197 "rather than the vector type!");
4199 if (VT == EVT)
return N1;
4203 EVT EVT = cast<VTSDNode>(N2)->getVT();
4206 "Cannot *_EXTEND_INREG FP types");
4208 "SIGN_EXTEND_INREG type should be vector iff the operand "
4212 "Vector element counts must match in SIGN_EXTEND_INREG");
4214 if (EVT == VT)
return N1;
4225 return SignExtendInReg(Val, VT);
4238 Ops.
push_back(SignExtendInReg(Val, OpVT));
4289 if (N1Op2C && N2C) {
4302 assert(N2C && (
unsigned)N2C->getZExtValue() < 2 &&
"Bad EXTRACT_ELEMENT!");
4306 "Wrong types for EXTRACT_ELEMENT!");
4317 unsigned Shift = ElementSize * N2C->getZExtValue();
4325 "Extract subvector VTs must be a vectors!");
4328 "Extract subvector VTs must have the same element type!");
4330 "Extract subvector must be from larger vector to smaller vector!");
4335 &&
"Extract subvector overflow!");
4352 return N1.
getOperand(N2C->getZExtValue() / Factor);
4373 APFloat V1 = N1CFP->getValueAPF(),
V2 = N2CFP->getValueAPF();
4413 APFloat V = N1CFP->getValueAPF();
4506 if (
SDNode *
E = FindNodeOrInsertPos(ID, DL, IP)) {
4507 E->intersectFlagsWith(Flags);
4513 createOperands(N, Ops);
4514 CSEMap.InsertNode(N, IP);
4517 createOperands(N, Ops);
4532 if (N1CFP && N2CFP && N3CFP) {
4534 const APFloat &
V2 = N2CFP->getValueAPF();
4535 const APFloat &V3 = N3CFP->getValueAPF();
4552 if (
SDValue V =
FoldSetCC(VT, N1, N2, cast<CondCodeSDNode>(N3)->
get(), DL))
4562 if (N1C->getZExtValue())
4567 if (N2 == N3)
return N2;
4584 "Insert subvector VTs must be a vectors");
4586 "Dest and insert subvector source types must match!");
4588 "Insert subvector must be from smaller vector to larger vector!");
4589 if (isa<ConstantSDNode>(Index)) {
4591 cast<ConstantSDNode>(Index)->getZExtValue()
4593 &&
"Insert subvector overflow!");
4617 if (
SDNode *
E = FindNodeOrInsertPos(ID, DL, IP))
4621 createOperands(N, Ops);
4622 CSEMap.InsertNode(N, IP);
4625 createOperands(N, Ops);
4634 SDValue Ops[] = { N1, N2, N3, N4 };
4635 return getNode(Opcode, DL, VT, Ops);
4641 SDValue Ops[] = { N1, N2, N3, N4, N5 };
4642 return getNode(Opcode, DL, VT, Ops);
4660 if (FI->getIndex() < 0)
4675 assert(
C->getAPIntValue().getBitWidth() == 8);
4685 if (!IntVT.isInteger())
4712 if (Slice.
Array ==
nullptr) {
4730 unsigned NumVTBytes = NumVTBits / 8;
4731 unsigned NumBytes =
std::min(NumVTBytes,
unsigned(Slice.
Length));
4733 APInt Val(NumVTBits, 0);
4735 for (
unsigned i = 0; i != NumBytes; ++i)
4736 Val |= (uint64_t)(
unsigned char)Slice[i] << i*8;
4738 for (
unsigned i = 0; i != NumBytes; ++i)
4739 Val |= (uint64_t)(
unsigned char)Slice[i] << (NumVTBytes-i-1)*8;
4758 uint64_t SrcDelta = 0;
4761 G = cast<GlobalAddressSDNode>(Src);
4765 G = cast<GlobalAddressSDNode>(Src.
getOperand(0));
4766 SrcDelta = cast<ConstantSDNode>(Src.
getOperand(1))->getZExtValue();
4780 unsigned Limit, uint64_t
Size,
4781 unsigned DstAlign,
unsigned SrcAlign,
4786 unsigned DstAS,
unsigned SrcAS,
4789 assert((SrcAlign == 0 || SrcAlign >= DstAlign) &&
4790 "Expecting memcpy / memset source to meet alignment requirement!");
4799 IsMemset, ZeroMemset, MemcpyStrSrc,
4824 unsigned NumMemOps = 0;
4827 while (VTSize > Size) {
4861 if (NumMemOps && AllowOverlap &&
4862 VTSize >= 8 && NewVTSize < Size &&
4871 if (++NumMemOps > Limit)
4874 MemOps.push_back(VT);
4892 bool isVol,
bool AlwaysInline,
4906 std::vector<EVT> MemOps;
4907 bool DstAlignCanChange =
false;
4913 DstAlignCanChange =
true;
4915 if (Align > SrcAlign)
4919 bool isZeroConstant = CopyFromConstant && Slice.
Array ==
nullptr;
4923 (DstAlignCanChange ? 0 : Align),
4924 (isZeroConstant ? 0 : SrcAlign),
4925 false,
false, CopyFromConstant,
true,
4931 if (DstAlignCanChange) {
4932 Type *Ty = MemOps[0].getTypeForEVT(C);
4939 while (NewAlign > Align &&
4943 if (NewAlign > Align) {
4954 unsigned NumMemOps = MemOps.
size();
4955 uint64_t SrcOff = 0, DstOff = 0;
4956 for (
unsigned i = 0; i != NumMemOps; ++i) {
4961 if (VTSize > Size) {
4964 assert(i == NumMemOps-1 && i != 0);
4965 SrcOff -= VTSize -
Size;
4966 DstOff -= VTSize -
Size;
4969 if (CopyFromConstant &&
4977 if (SrcOff < Slice.
Length) {
4979 SubSlice.
move(SrcOff);
4982 SubSlice.
Array =
nullptr;
4984 SubSlice.
Length = VTSize;
4988 Store = DAG.
getStore(Chain, dl, Value,
5003 bool isDereferenceable =
5006 if (isDereferenceable)
5012 MinAlign(SrcAlign, SrcOff), SrcMMOFlags);
5030 bool isVol,
bool AlwaysInline,
5042 std::vector<EVT> MemOps;
5043 bool DstAlignCanChange =
false;
5049 DstAlignCanChange =
true;
5051 if (Align > SrcAlign)
5056 (DstAlignCanChange ? 0 : Align), SrcAlign,
5057 false,
false,
false,
false,
5063 if (DstAlignCanChange) {
5064 Type *Ty = MemOps[0].getTypeForEVT(C);
5066 if (NewAlign > Align) {
5076 uint64_t SrcOff = 0, DstOff = 0;
5080 unsigned NumMemOps = MemOps.
size();
5081 for (
unsigned i = 0; i < NumMemOps; i++) {
5086 bool isDereferenceable =
5089 if (isDereferenceable)
5101 for (
unsigned i = 0; i < NumMemOps; i++) {
5106 Store = DAG.
getStore(Chain, dl, LoadValues[i],
5136 uint64_t
Size,
unsigned Align,
bool isVol,
5145 std::vector<EVT> MemOps;
5146 bool DstAlignCanChange =
false;
5152 DstAlignCanChange =
true;
5154 isa<ConstantSDNode>(Src) && cast<ConstantSDNode>(Src)->isNullValue();
5156 Size, (DstAlignCanChange ? 0 :
Align), 0,
5157 true, IsZeroVal,
false,
true,
5162 if (DstAlignCanChange) {
5163 Type *Ty = MemOps[0].getTypeForEVT(*DAG.getContext());
5164 unsigned NewAlign = (
unsigned)DAG.getDataLayout().getABITypeAlignment(Ty);
5165 if (NewAlign > Align) {
5174 uint64_t DstOff = 0;
5175 unsigned NumMemOps = MemOps.
size();
5178 EVT LargestVT = MemOps[0];
5179 for (
unsigned i = 1; i < NumMemOps; i++)
5180 if (MemOps[i].bitsGT(LargestVT))
5181 LargestVT = MemOps[i];
5184 for (
unsigned i = 0; i < NumMemOps; i++) {
5187 if (VTSize > Size) {
5190 assert(i == NumMemOps-1 && i != 0);
5191 DstOff -= VTSize -
Size;
5197 if (VT.
bitsLT(LargestVT)) {
5206 Chain, dl, Value, DAG.getMemBasePlusOffset(Dst, DstOff, dl),
5229 bool isVol,
bool AlwaysInline,
bool isTailCall,
5232 assert(Align &&
"The SDAG layer expects explicit alignment and reserves 0");
5244 isVol,
false, DstPtrInfo, SrcPtrInfo);
5253 *
this, dl, Chain, Dst, Src, Size, Align, isVol, AlwaysInline,
5254 DstPtrInfo, SrcPtrInfo);
5262 assert(ConstantSize &&
"AlwaysInline requires a constant size!");
5265 true, DstPtrInfo, SrcPtrInfo);
5281 Entry.
Node = Dst; Args.push_back(Entry);
5282 Entry.
Node = Src; Args.push_back(Entry);
5283 Entry.
Node =
Size; Args.push_back(Entry);
5296 std::pair<SDValue,SDValue> CallResult = TLI->
LowerCallTo(CLI);
5297 return CallResult.second;
5302 bool isVol,
bool isTailCall,
5305 assert(Align &&
"The SDAG layer expects explicit alignment and reserves 0");
5318 false, DstPtrInfo, SrcPtrInfo);
5327 *
this, dl, Chain, Dst, Src, Size, Align, isVol, DstPtrInfo, SrcPtrInfo);
5342 Entry.
Node = Dst; Args.push_back(Entry);
5343 Entry.
Node = Src; Args.push_back(Entry);
5344 Entry.
Node =
Size; Args.push_back(Entry);
5357 std::pair<SDValue,SDValue> CallResult = TLI->
LowerCallTo(CLI);
5358 return CallResult.second;
5363 bool isVol,
bool isTailCall,
5365 assert(Align &&
"The SDAG layer expects explicit alignment and reserves 0");
5377 Align, isVol, DstPtrInfo);
5387 *
this, dl, Chain, Dst, Src, Size, Align, isVol, DstPtrInfo);
5398 Entry.
Node = Dst; Entry.
Ty = IntPtrTy;
5399 Args.push_back(Entry);
5402 Args.push_back(Entry);
5404 Entry.
Ty = IntPtrTy;
5405 Args.push_back(Entry);
5419 std::pair<SDValue,SDValue> CallResult = TLI->
LowerCallTo(CLI);
5420 return CallResult.second;
5431 if (
SDNode *
E = FindNodeOrInsertPos(ID, dl, IP)) {
5432 cast<AtomicSDNode>(
E)->refineAlignment(MMO);
5437 VTList, MemVT, MMO);
5438 createOperands(N, Ops);
5440 CSEMap.InsertNode(N, IP);
5465 AAMDNodes(),
nullptr, SSID, SuccessOrdering,
5468 return getAtomicCmpSwap(Opcode, dl, MemVT, VTs, Chain, Ptr, Cmp, Swp, MMO);
5480 return getAtomic(Opcode, dl, MemVT, VTs, Ops, MMO);
5485 const Value *PtrVal,
unsigned Alignment,
5507 nullptr, SSID, Ordering);
5509 return getAtomic(Opcode, dl, MemVT, Chain, Ptr, Val, MMO);
5527 "Invalid Atomic Op");
5534 return getAtomic(Opcode, dl, MemVT, VTs, Ops, MMO);
5544 return getAtomic(Opcode, dl, MemVT, VTs, Ops, MMO);
5549 if (Ops.
size() == 1)
5554 for (
unsigned i = 0; i < Ops.
size(); ++i)
5562 bool ReadMem,
bool WriteMem,
unsigned Size) {
5593 "Opcode is not a memory-accessing opcode!");
5602 if (
SDNode *
E = FindNodeOrInsertPos(ID, dl, IP)) {
5603 cast<MemIntrinsicSDNode>(
E)->refineAlignment(MMO);
5608 VTList, MemVT, MMO);
5609 createOperands(N, Ops);
5611 CSEMap.InsertNode(N, IP);
5614 VTList, MemVT, MMO);
5615 createOperands(N, Ops);
5638 int FI = cast<FrameIndexSDNode>(Ptr.
getOperand(0))->getIndex();
5651 if (
ConstantSDNode *OffsetNode = dyn_cast<ConstantSDNode>(OffsetOp))
5666 "Invalid chain type");
5679 PtrInfo, MMOFlags, MemVT.
getStoreSize(), Alignment, AAInfo, Ranges);
5680 return getLoad(AM, ExtType, VT, dl, Chain, Ptr, Offset, MemVT, MMO);
5690 assert(VT == MemVT &&
"Non-extending load from different memory type!");
5694 "Should only be an extending load, not truncating!");
5696 "Cannot convert from FP to Int or Int -> FP!");
5698 "Cannot use an ext load to convert to or from a vector!");
5701 "Cannot use an ext load to change the number of vector elements!");
5705 assert((Indexed || Offset.
isUndef()) &&
"Unindexed load with an offset!");
5713 ID.
AddInteger(getSyntheticNodeSubclassData<LoadSDNode>(
5714 dl.
getIROrder(), VTs, AM, ExtType, MemVT, MMO));
5717 if (
SDNode *
E = FindNodeOrInsertPos(ID, dl, IP)) {
5718 cast<LoadSDNode>(
E)->refineAlignment(MMO);
5722 ExtType, MemVT, MMO);
5723 createOperands(N, Ops);
5725 CSEMap.InsertNode(N, IP);
5737 PtrInfo, VT, Alignment, MMOFlags, AAInfo, Ranges);
5755 MemVT, Alignment, MMOFlags, AAInfo);
5799 return getStore(Chain, dl, Val, Ptr, MMO);
5805 "Invalid chain type");
5813 ID.
AddInteger(getSyntheticNodeSubclassData<StoreSDNode>(
5817 if (
SDNode *
E = FindNodeOrInsertPos(ID, dl, IP)) {
5818 cast<StoreSDNode>(
E)->refineAlignment(MMO);
5823 createOperands(N, Ops);
5825 CSEMap.InsertNode(N, IP);
5832 EVT SVT,
unsigned Alignment,
5836 "Invalid chain type");
5848 PtrInfo, MMOFlags, SVT.
getStoreSize(), Alignment, AAInfo);
5858 "Invalid chain type");
5860 return getStore(Chain, dl, Val, Ptr, MMO);
5863 "Should only be a truncating store, not extending!");
5865 "Can't do FP-INT conversion!");
5867 "Cannot use trunc store to convert to or from a vector!");
5870 "Cannot use trunc store to change the number of vector elements!");
5878 ID.
AddInteger(getSyntheticNodeSubclassData<StoreSDNode>(
5882 if (
SDNode *
E = FindNodeOrInsertPos(ID, dl, IP)) {
5883 cast<StoreSDNode>(
E)->refineAlignment(MMO);
5888 createOperands(N, Ops);
5890 CSEMap.InsertNode(N, IP);
5908 if (
SDNode *
E = FindNodeOrInsertPos(ID, dl, IP))
5914 createOperands(N, Ops);
5916 CSEMap.InsertNode(N, IP);
5930 ID.
AddInteger(getSyntheticNodeSubclassData<MaskedLoadSDNode>(
5931 dl.
getIROrder(), VTs, ExtTy, isExpanding, MemVT, MMO));
5934 if (
SDNode *
E = FindNodeOrInsertPos(ID, dl, IP)) {
5935 cast<MaskedLoadSDNode>(
E)->refineAlignment(MMO);
5939 ExtTy, isExpanding, MemVT, MMO);
5940 createOperands(N, Ops);
5942 CSEMap.InsertNode(N, IP);
5950 bool IsTruncating,
bool IsCompressing) {
5952 "Invalid chain type");
5959 ID.
AddInteger(getSyntheticNodeSubclassData<MaskedStoreSDNode>(
5960 dl.
getIROrder(), VTs, IsTruncating, IsCompressing, MemVT, MMO));
5963 if (
SDNode *
E = FindNodeOrInsertPos(ID, dl, IP)) {
5964 cast<MaskedStoreSDNode>(
E)->refineAlignment(MMO);
5968 IsTruncating, IsCompressing, MemVT, MMO);
5969 createOperands(N, Ops);
5971 CSEMap.InsertNode(N, IP);
5979 assert(Ops.
size() == 5 &&
"Incompatible number of operands");
5984 ID.AddInteger(getSyntheticNodeSubclassData<MaskedGatherSDNode>(
5988 if (
SDNode *
E = FindNodeOrInsertPos(ID, dl, IP)) {
5989 cast<MaskedGatherSDNode>(
E)->refineAlignment(MMO);
5995 createOperands(N, Ops);
5998 "Incompatible type of the PassThru value in MaskedGatherSDNode");
6001 "Vector width mismatch between mask and data");
6004 "Vector width mismatch between index and data");
6006 CSEMap.InsertNode(N, IP);
6014 assert(Ops.
size() == 5 &&
"Incompatible number of operands");
6019 ID.AddInteger(getSyntheticNodeSubclassData<MaskedScatterSDNode>(
6023 if (
SDNode *
E = FindNodeOrInsertPos(ID, dl, IP)) {
6024 cast<MaskedScatterSDNode>(
E)->refineAlignment(MMO);
6029 createOperands(N, Ops);
6033 "Vector width mismatch between mask and data");
6036 "Vector width mismatch between index and data");
6038 CSEMap.InsertNode(N, IP);
6051 switch (Ops.
size()) {
6052 case 0:
return getNode(Opcode, DL, VT);
6053 case 1:
return getNode(Opcode, DL, VT, static_cast<const SDValue>(Ops[0]));
6054 case 2:
return getNode(Opcode, DL, VT, Ops[0], Ops[1]);
6055 case 3:
return getNode(Opcode, DL, VT, Ops[0], Ops[1], Ops[2]);
6062 return getNode(Opcode, DL, VT, NewOps);
6067 unsigned NumOps = Ops.
size();
6069 case 0:
return getNode(Opcode, DL, VT);
6070 case 1:
return getNode(Opcode, DL, VT, Ops[0], Flags);
6071 case 2:
return getNode(Opcode, DL, VT, Ops[0], Ops[1], Flags);
6072 case 3:
return getNode(Opcode, DL, VT, Ops[0], Ops[1], Ops[2]);
6084 assert(NumOps == 5 &&
"SELECT_CC takes 5 operands!");
6086 "LHS and RHS of condition must have same type!");
6088 "True and False arms of SelectCC must have same type!");
6090 "select_cc node must be of same type as true and false value!");
6093 assert(NumOps == 5 &&
"BR_CC takes 5 operands!");
6095 "LHS/RHS of comparison should match types!");
6108 if (
SDNode *
E = FindNodeOrInsertPos(ID, DL, IP))
6112 createOperands(N, Ops);
6114 CSEMap.InsertNode(N, IP);
6117 createOperands(N, Ops);
6132 return getNode(Opcode, DL, VTList.
VTs[0], Ops);
6143 cast<VTSDNode>(N3.getOperand(1))->getVT() !=
MVT::i1)
6144 return getNode(Opcode, DL, VT, N1, N2, N3.getOperand(0));
6145 else if (N3.getOpcode() ==
ISD::AND)
6146 if (
ConstantSDNode *AndRHS = dyn_cast<ConstantSDNode>(N3.getOperand(1))) {
6150 if ((AndRHS->getValue() & (NumBits-1)) == NumBits-1)
6151 return getNode(Opcode, DL, VT, N1, N2, N3.getOperand(0));
6163 if (
SDNode *
E = FindNodeOrInsertPos(ID, DL, IP))
6167 createOperands(N, Ops);
6168 CSEMap.InsertNode(N, IP);
6171 createOperands(N, Ops);
6185 return getNode(Opcode, DL, VTList, Ops);
6191 return getNode(Opcode, DL, VTList, Ops);
6196 SDValue Ops[] = { N1, N2, N3 };
6197 return getNode(Opcode, DL, VTList, Ops);
6202 SDValue Ops[] = { N1, N2, N3, N4 };
6203 return getNode(Opcode, DL, VTList, Ops);
6209 SDValue Ops[] = { N1, N2, N3, N4, N5 };
6210 return getNode(Opcode, DL, VTList, Ops);
6214 return makeVTList(SDNode::getValueTypeList(VT), 1);
6224 SDVTListNode *Result = VTListMap.FindNodeOrInsertPos(ID, IP);
6230 VTListMap.InsertNode(Result, IP);
6243 SDVTListNode *Result = VTListMap.FindNodeOrInsertPos(ID, IP);
6250 VTListMap.InsertNode(Result, IP);
6264 SDVTListNode *Result = VTListMap.FindNodeOrInsertPos(ID, IP);
6272 VTListMap.InsertNode(Result, IP);
6278 unsigned NumVTs = VTs.
size();
6281 for (
unsigned index = 0; index < NumVTs; index++) {
6286 SDVTListNode *Result = VTListMap.FindNodeOrInsertPos(ID, IP);
6289 std::copy(VTs.
begin(), VTs.
end(), Array);
6291 VTListMap.InsertNode(Result, IP);
6310 void *InsertPos =
nullptr;
6311 if (
SDNode *Existing = FindModifiedNodeSlot(N, Op, InsertPos))
6316 if (!RemoveNodeFromCSEMaps(N))
6317 InsertPos =
nullptr;
6320 N->OperandList[0].set(Op);
6323 if (InsertPos) CSEMap.InsertNode(N, InsertPos);
6335 void *InsertPos =
nullptr;
6336 if (
SDNode *Existing = FindModifiedNodeSlot(N, Op1, Op2, InsertPos))
6341 if (!RemoveNodeFromCSEMaps(N))
6342 InsertPos =
nullptr;
6345 if (N->OperandList[0] != Op1)
6346 N->OperandList[0].set(Op1);
6347 if (N->OperandList[1] != Op2)
6348 N->OperandList[1].set(Op2);
6351 if (InsertPos) CSEMap.InsertNode(N, InsertPos);
6357 SDValue Ops[] = { Op1, Op2, Op3 };
6364 SDValue Ops[] = { Op1, Op2, Op3, Op4 };
6371 SDValue Ops[] = { Op1, Op2, Op3, Op4, Op5 };
6377 unsigned NumOps = Ops.
size();
6379 "Update with wrong number of operands");
6386 void *InsertPos =
nullptr;
6387 if (
SDNode *Existing = FindModifiedNodeSlot(N, Ops, InsertPos))
6392 if (!RemoveNodeFromCSEMaps(N))
6393 InsertPos =
nullptr;
6396 for (
unsigned i = 0; i != NumOps; ++i)
6397 if (N->OperandList[i] != Ops[i])
6398 N->OperandList[i].set(Ops[i]);
6401 if (InsertPos) CSEMap.InsertNode(N, InsertPos);
6444 SDValue Ops[] = { Op1, Op2, Op3 };
6533 if (
SDNode *ON = FindNodeOrInsertPos(ID,
SDLoc(N), IP))
6534 return UpdateSDLocOnMergeSDNode(ON,
SDLoc(N));
6537 if (!RemoveNodeFromCSEMaps(N))
6542 N->ValueList = VTs.
VTs;
6543 N->NumValues = VTs.
NumVTs;
6553 DeadNodeSet.
insert(Used);
6558 MN->setMemRefs(
nullptr,
nullptr);
6562 createOperands(N, Ops);
6566 if (!DeadNodeSet.
empty()) {
6568 for (
SDNode *N : DeadNodeSet)
6575 CSEMap.InsertNode(N, IP);
6582 bool IsUnary =
false;
6666 SDValue Ops[] = { Op1, Op2, Op3 };
6688 SDValue Ops[] = { Op1, Op2, Op3 };
6712 SDValue Ops[] = { Op1, Op2, Op3 };
6741 if (
SDNode *
E = FindNodeOrInsertPos(ID, DL, IP)) {
6742 return cast<MachineSDNode>(UpdateSDLocOnMergeSDNode(
E, DL));
6748 createOperands(N, Ops);
6751 CSEMap.InsertNode(N, IP);
6763 VT, Operand, SRIdxVal);
6773 VT, Operand, Subreg, SRIdxVal);
6786 if (
SDNode *
E = FindNodeOrInsertPos(ID,
SDLoc(), IP)) {
6787 E->intersectFlagsWith(Flags);
6798 unsigned R,
bool IsIndirect, uint64_t Off,
6800 assert(cast<DILocalVariable>(Var)->isValidLocationForIntrinsic(DL) &&
6801 "Expected inlined-at fields to agree");
6803 SDDbgValue(Var, Expr, N, R, IsIndirect, Off, DL, O);
6808 const Value *
C, uint64_t Off,
6810 assert(cast<DILocalVariable>(Var)->isValidLocationForIntrinsic(DL) &&
6811 "Expected inlined-at fields to agree");
6817 unsigned FI, uint64_t Off,
6820 assert(cast<DILocalVariable>(Var)->isValidLocationForIntrinsic(DL) &&
6821 "Expected inlined-at fields to agree");
6837 while (UI != UE && N == *UI)
6845 :
SelectionDAG::DAGUpdateListener(d), UI(ui), UE(ue) {}
6858 "Cannot replace with this method!");
6859 assert(From != To.
getNode() &&
"Cannot replace uses of with self");
6862 TransferDbgValues(FromN, To);
6872 RAUWUpdateListener Listener(*
this, UI, UE);
6877 RemoveNodeFromCSEMaps(User);
6887 }
while (UI != UE && *UI == User);
6891 AddModifiedNodeToCSEMaps(User);
6907 for (
unsigned i = 0, e = From->
getNumValues(); i != e; ++i)
6910 "Cannot use this version of ReplaceAllUsesWith!");
6918 for (
unsigned i = 0, e = From->
getNumValues(); i != e; ++i)
6920 assert((i < To->getNumValues()) &&
"Invalid To location");
6927 RAUWUpdateListener Listener(*
this, UI, UE);
6932 RemoveNodeFromCSEMaps(User);
6942 }
while (UI != UE && *UI == User);
6946 AddModifiedNodeToCSEMaps(User);
6964 for (
unsigned i = 0, e = From->
getNumValues(); i != e; ++i)
6965 TransferDbgValues(
SDValue(From, i), *To);
6970 RAUWUpdateListener Listener(*
this, UI, UE);
6975 RemoveNodeFromCSEMaps(User);
6986 }
while (UI != UE && *UI == User);
6990 AddModifiedNodeToCSEMaps(User);
7003 if (From == To)
return;
7012 TransferDbgValues(From, To);
7018 RAUWUpdateListener Listener(*
this, UI, UE);
7021 bool UserRemovedFromCSEMaps =
false;
7038 if (!UserRemovedFromCSEMaps) {
7039 RemoveNodeFromCSEMaps(User);
7040 UserRemovedFromCSEMaps =
true;
7045 }
while (UI != UE && *UI == User);
7049 if (!UserRemovedFromCSEMaps)
7054 AddModifiedNodeToCSEMaps(User);
7073 bool operator<(
const UseMemo &
L,
const UseMemo &R) {
7090 TransferDbgValues(*From, *To);
7096 for (
unsigned i = 0; i != Num; ++i) {
7097 unsigned FromResNo = From[i].
getResNo();
7100 E = FromNode->
use_end(); UI !=
E; ++UI) {
7103 UseMemo Memo = { *UI, i, &Use };
7112 for (
unsigned UseIndex = 0, UseIndexEnd = Uses.
size();
7113 UseIndex != UseIndexEnd; ) {
7119 RemoveNodeFromCSEMaps(User);
7126 unsigned i = Uses[UseIndex].Index;
7131 }
while (UseIndex != UseIndexEnd && Uses[UseIndex].User == User);
7135 AddModifiedNodeToCSEMaps(User);
7143 unsigned DAGSize = 0;
7166 SortedPos = AllNodes.insert(SortedPos, AllNodes.remove(Q));
7167 assert(SortedPos != AllNodes.end() &&
"Overran node list");
7186 assert(Degree != 0 &&
"Invalid node degree");
7192 SortedPos = AllNodes.insert(SortedPos, AllNodes.remove(P));
7193 assert(SortedPos != AllNodes.end() &&
"Overran node list");
7204 dbgs() <<
"Overran sorted position:\n";
7206 dbgs() <<
"Checking if this is due to cycles\n";
7213 assert(SortedPos == AllNodes.end() &&
7214 "Topological sort incomplete!");
7216 "First node in topological sort is not the entry token!");
7217 assert(AllNodes.front().getNodeId() == 0 &&
7218 "First node in topological sort has non-zero id!");
7219 assert(AllNodes.front().getNumOperands() == 0 &&
7220 "First node in topological sort has operands!");
7221 assert(AllNodes.back().getNodeId() == (int)DAGSize-1 &&
7222 "Last node in topologic sort has unexpected id!");
7223 assert(AllNodes.back().use_empty() &&
7224 "Last node in topologic sort has users!");
7236 DbgInfo->
add(DB, SD, isParameter);
7254 assert(FromNode != ToNode &&
7255 "Should not transfer Debug Values intranode");
7270 assert(isa<MemSDNode>(NewMemOp.
getNode()) &&
"Expected a memop node");
7308 return Const !=
nullptr && Const->
isOne();
7326 if (CN && UndefElements.
none() &&
7342 if (CN && UndefElements.
none())
7353 GlobalAddressSDNode::GlobalAddressSDNode(
unsigned Opc,
unsigned Order,
7356 int64_t o,
unsigned char TF)
7365 SrcAddrSpace(SrcAS), DestAddrSpace(DestAS) {}
7369 :
SDNode(Opc, Order, dl, VTs), MemoryVT(memvt), MMO(mmo) {
7390 std::vector<EVT> VTs;
7407 const EVT *SDNode::getValueTypeList(
EVT VT) {
7410 return &(*
EVTs->insert(VT).first);
7413 "Value type out of range!");
7426 if (UI.getUse().getResNo() == Value) {
7443 if (UI.getUse().getResNo() == Value)
7469 [&User](
const SDNode *Node) {
return User ==
Node; }))
7504 unsigned Depth)
const {
7505 if (*
this == Dest)
return true;
7509 if (Depth == 0)
return false;
7534 if (
LoadSDNode *Ld = dyn_cast<LoadSDNode>(*
this)) {
7535 if (!Ld->isVolatile())
7536 return Ld->getChain().reachesChainWithoutSideEffects(Dest, Depth-1);
7554 "Can't unroll a vector with multiple results!");
7557 unsigned NE = VT.getVectorNumElements();
7567 else if (NE > ResNE)
7571 for (i= 0; i !=
NE; ++i) {
7583 Operands[j] = Operand;
7615 for (; i < ResNE; ++i)
7643 if (BaseLocDecomp.equalBaseIndex(LocDecomp, *
this, Offset))
7644 return (Dist * Bytes == Offset);
7653 int64_t GVOffset = 0;
7659 unsigned Align = AlignBits ? 1 <<
std::min(31U, AlignBits) : 0;
7666 int FrameIdx = 1 << 31;
7667 int64_t FrameOffset = 0;
7669 FrameIdx = FI->getIndex();
7673 FrameIdx = cast<FrameIndexSDNode>(Ptr.
getOperand(0))->getIndex();
7677 if (FrameIdx != (1 << 31)) {
7697 return std::make_pair(LoVT, HiVT);
7702 std::pair<SDValue, SDValue>
7707 "More vector elements requested than available!");
7714 return std::make_pair(Lo, Hi);
7719 unsigned Start,
unsigned Count) {
7727 for (
unsigned i = Start, e = Start + Count; i != e; ++i) {
7740 return Val.MachineCPVal->getType();
7741 return Val.ConstVal->getType();
7745 unsigned &SplatBitSize,
7747 unsigned MinSplatBits,
7748 bool IsBigEndian)
const {
7752 if (MinSplatBits > VecWidth)
7757 SplatValue =
APInt(VecWidth, 0);
7758 SplatUndef =
APInt(VecWidth, 0);
7765 assert(NumOps > 0 &&
"isConstantSplat has 0-size build vector");
7768 for (
unsigned j = 0; j < NumOps; ++j) {
7769 unsigned i = IsBigEndian ? NumOps - 1 - j : j;
7771 unsigned BitPos = j * EltWidth;
7774 SplatUndef.
setBits(BitPos, BitPos + EltWidth);
7775 else if (
auto *CN = dyn_cast<ConstantSDNode>(OpVal))
7776 SplatValue.
insertBits(CN->getAPIntValue().zextOrTrunc(EltWidth), BitPos);
7777 else if (
auto *CN = dyn_cast<ConstantFPSDNode>(OpVal))
7778 SplatValue.
insertBits(CN->getValueAPF().bitcastToAPInt(), BitPos);
7785 HasAnyUndefs = (SplatUndef != 0);
7788 while (VecWidth > 8) {
7789 unsigned HalfSize = VecWidth / 2;
7796 if ((HighValue & ~LowUndef) != (LowValue & ~HighUndef) ||
7797 MinSplatBits > HalfSize)
7800 SplatValue = HighValue | LowValue;
7801 SplatUndef = HighUndef & LowUndef;
7803 VecWidth = HalfSize;
7806 SplatBitSize = VecWidth;
7811 if (UndefElements) {
7812 UndefElements->
clear();
7820 (*UndefElements)[i] =
true;
7821 }
else if (!Splatted) {
7823 }
else if (Splatted != Op) {
7830 "Can only have a splat without a constant for all undefs.");
7839 return dyn_cast_or_null<ConstantSDNode>(
getSplatValue(UndefElements));
7844 return dyn_cast_or_null<ConstantFPSDNode>(
getSplatValue(UndefElements));
7851 dyn_cast_or_null<ConstantFPSDNode>(
getSplatValue(UndefElements))) {
7854 const APFloat &APF = CN->getValueAPF();
7880 assert(i != e &&
"VECTOR_SHUFFLE node with all undef indices!");
7884 for (
int Idx = Mask[i]; i != e; ++i)
7885 if (Mask[i] >= 0 && Mask[i] != Idx)
7893 if (isa<ConstantSDNode>(N))
7907 if (isa<ConstantFPSDNode>(N))
7922 if (Checked.
count(N))
7927 if (!Visited.
insert(N).second) {
7928 errs() <<
"Detected cycle in SelectionDAG\n";
7929 dbgs() <<
"Offending node:\n";
7947 #ifdef EXPENSIVE_CHECKS
7949 #endif // EXPENSIVE_CHECKS
7951 assert(N &&
"Checking nonexistent SDNode");
void clearAllBits()
Set every bit to 0.
MVT getSimpleValueType() const
Return the simple ValueType of the referenced return value.
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.
SDNode * MorphNodeTo(SDNode *N, unsigned Opc, SDVTList VTs, ArrayRef< SDValue > Ops)
This mutates the specified node to have the specified return type, opcode, and operands.
void resize(unsigned N, bool t=false)
resize - Grow or shrink the bitvector.
opStatus roundToIntegral(roundingMode RM)
BITCAST - This operator converts between integer, vector and FP values, as if the value was stored to...
X = FP_ROUND(Y, TRUNC) - Rounding 'Y' from a larger floating point type down to the precision of the ...
static const fltSemantics & IEEEquad() LLVM_READNONE
SDValue getGlobalAddress(const GlobalValue *GV, const SDLoc &DL, EVT VT, int64_t offset=0, bool isTargetGA=false, unsigned char TargetFlags=0)
void AddPointer(const void *Ptr)
Add* - Add various data types to Bit data.
bool use_empty() const
Return true if there are no uses of this node.
unsigned countMinTrailingZeros() const
Returns the minimum number of trailing zero bits.
void push_back(const T &Elt)
unsigned Log2_32_Ceil(uint32_t Value)
Return the ceil log base 2 of the specified value, 32 if the value is zero.
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. ...
CallingConv::ID getLibcallCallingConv(RTLIB::Libcall Call) const
Get the CallingConv that should be used for the specified libcall.
SDValue getValue(unsigned R) const
OverflowKind
Used to represent the possible overflow behavior of an operation.
static void commuteMask(MutableArrayRef< int > Mask)
Change values in a shuffle permute mask assuming the two vector operands have swapped position...
ConstantFPSDNode * getConstantFPSplatNode(BitVector *UndefElements=nullptr) const
Returns the splatted constant FP or null if this is not a constant FP splat.
void setFlags(SDNodeFlags NewFlags)
raw_ostream & errs()
This returns a reference to a raw_ostream for standard error.
const char * getSymbol() const
opStatus convertFromAPInt(const APInt &Input, bool IsSigned, roundingMode RM)
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...
Constrained versions of libm-equivalent floating point intrinsics.
This SDNode is used for target intrinsics that touch memory and need an associated MachineMemOperand...
SDValue getBoolExtOrTrunc(SDValue Op, const SDLoc &SL, EVT VT, EVT OpVT)
Convert Op, which must be of integer type, to the integer type VT, by using an extension appropriate ...
bool isExactlyValue(double V) const
We don't rely on operator== working on double values, as it returns true for things that are clearly ...
EXTRACT_ELEMENT - This is used to get the lower or upper (determined by a Constant, which is required to be operand #1) half of the integer or float value specified as operand #0.
SDValue getSplatValue(BitVector *UndefElements=nullptr) const
Returns the splatted value or a null value if this is not a splat.
LLVMContext & getContext() const
getContext - Return a reference to the LLVMContext associated with this function. ...
Flags getFlags() const
Return the raw flags of the source value,.
GCNRegPressure max(const GCNRegPressure &P1, const GCNRegPressure &P2)
static APInt getAllOnesValue(unsigned numBits)
Get the all-ones value.
LLVMContext * getContext() const
SDValue getTargetIndex(int Index, EVT VT, int64_t Offset=0, unsigned char TargetFlags=0)
Keeps track of dbg_value information through SDISel.
bool isBuildVectorOfConstantSDNodes(const SDNode *N)
Return true if the specified node is a BUILD_VECTOR node of all ConstantSDNode or undef...
void setBits(unsigned loBit, unsigned hiBit)
Set the bits from loBit (inclusive) to hiBit (exclusive) to 1.
uint64_t getZExtValue() const
Get zero extended value.
SDValue UnrollVectorOp(SDNode *N, unsigned ResNE=0)
Utility function used by legalize and lowering to "unroll" a vector operation by splitting out the sc...
SDValue getSetCC(const SDLoc &DL, EVT VT, SDValue LHS, SDValue RHS, ISD::CondCode Cond)
Helper function to make it easier to build SetCC's if you just have an ISD::CondCode instead of an SD...
virtual SDValue EmitTargetCodeForMemcpy(SelectionDAG &DAG, const SDLoc &dl, SDValue Chain, SDValue Op1, SDValue Op2, SDValue Op3, unsigned Align, bool isVolatile, bool AlwaysInline, MachinePointerInfo DstPtrInfo, MachinePointerInfo SrcPtrInfo) const
Emit target-specific code that performs a memcpy.
SDValue getIndexedLoad(SDValue OrigLoad, const SDLoc &dl, SDValue Base, SDValue Offset, ISD::MemIndexedMode AM)
NodeType getExtForLoadExtType(bool IsFP, LoadExtType)
DELETED_NODE - This is an illegal value that is used to catch errors.
MDNODE_SDNODE - This is a node that holdes an MDNode*, which is used to reference metadata in the IR...
unsigned getMaxStoresPerMemcpy(bool OptSize) const
Get maximum # of store operations permitted for llvm.memcpy.
EXTRACT_SUBVECTOR(VECTOR, IDX) - Returns a subvector from VECTOR (an vector value) starting with the ...
LegalizeTypeAction getTypeAction(LLVMContext &Context, EVT VT) const
Return how we should legalize values of this type, either it is already legal (return 'Legal') or we ...
bool isKnownNeverNaN(SDValue Op) const
Test whether the given SDValue is known to never be NaN.
BR_CC - Conditional branch.
LLVM_ATTRIBUTE_NORETURN void report_fatal_error(Error Err, bool gen_crash_diag=true)
Report a serious error, calling any installed error handler.
bool ult(const APInt &RHS) const
Unsigned less than comparison.
bool none() const
none - Returns true if none of the bits are set.
SDDbgValue * getDbgValue(MDNode *Var, MDNode *Expr, SDNode *N, unsigned R, bool IsIndirect, uint64_t Off, const DebugLoc &DL, unsigned O)
Creates a SDDbgValue node.
void intersectWith(const SDNodeFlags Flags)
Clear any flags in this flag set that aren't also set in Flags.
bool hasNUsesOfValue(unsigned NUses, unsigned Value) const
Return true if there are exactly NUSES uses of the indicated value.
VECTOR_SHUFFLE(VEC1, VEC2) - Returns a vector, of the same type as VEC1/VEC2.
MCSymbol - Instances of this class represent a symbol name in the MC file, and MCSymbols are created ...
bool hasOneUse() const
Return true if there is exactly one node using value ResNo of Node.
SDVTList getVTList() const
APInt reverseBits() const
ZERO_EXTEND_VECTOR_INREG(Vector) - This operator represents an in-register zero-extension of the low ...
Maximum length of the test input libFuzzer tries to guess a good value based on the corpus and reports it always prefer smaller inputs during the corpus shuffle When libFuzzer itself reports a bug this exit code will be used If indicates the maximal total time in seconds to run the fuzzer minimizes the provided crash input Use with tries to cleanse the provided crash input to make it contain fewer original bytes Use with exact_artifact_path to specify the output Experimental Use value profile to guide fuzzing Number of jobs to run If min(jobs, NumberOfCpuCores()/2)\" is used.") FUZZER_FLAG_INT(reload
SDValue getSignExtendVectorInReg(SDValue Op, const SDLoc &DL, EVT VT)
Return an operation which will sign extend the low lanes of the operand into the specified vector typ...
unsigned getBitWidth() const
getBitWidth - Return the bitwidth of this constant.
static bool hasPredecessorHelper(const SDNode *N, SmallPtrSetImpl< const SDNode * > &Visited, SmallVectorImpl< const SDNode * > &Worklist, unsigned int MaxSteps=0)
Returns true if N is a predecessor of any node in Worklist.
Carry-setting nodes for multiple precision addition and subtraction.
virtual SDValue EmitTargetCodeForMemmove(SelectionDAG &DAG, const SDLoc &dl, SDValue Chain, SDValue Op1, SDValue Op2, SDValue Op3, unsigned Align, bool isVolatile, MachinePointerInfo DstPtrInfo, MachinePointerInfo SrcPtrInfo) const
Emit target-specific code that performs a memmove.
const TargetMachine & getTarget() const
unsigned getPointerTypeSizeInBits(Type *) const
Layout pointer size, in bits, based on the type.
bool isExtended() const
Test if the given EVT is extended (as opposed to being simple).
unsigned getPrefTypeAlignment(Type *Ty) const
Returns the preferred stack/global alignment for the specified type.
unsigned countMaxLeadingZeros() const
Returns the maximum number of leading zero bits possible.
Clients of various APIs that cause global effects on the DAG can optionally implement this interface...
SDValue makeEquivalentMemoryOrdering(LoadSDNode *Old, SDValue New)
If an existing load has uses of its chain, create a token factor node with that chain and the new mem...
friend struct DAGUpdateListener
DAGUpdateListener is a friend so it can manipulate the listener stack.
const TargetSubtargetInfo & getSubtarget() const
bool isKnownToBeAPowerOfTwo(SDValue Val) const
Test if the given value is known to have exactly one bit set.
unsigned InferPtrAlignment(SDValue Ptr) const
Infer alignment of a load / store address.
std::pair< EVT, EVT > GetSplitDestVTs(const EVT &VT) const
Compute the VTs needed for the low/hi parts of a type which is split (or expanded) into two not neces...
CondCode getSetCCAndOperation(CondCode Op1, CondCode Op2, bool isInteger)
Return the result of a logical AND between different comparisons of identical values: ((X op1 Y) & (X...
static APInt getLowBitsSet(unsigned numBits, unsigned loBitsSet)
Get a value with low bits set.
const GlobalValue * getGlobal() const
static void commuteShuffle(SDValue &N1, SDValue &N2, MutableArrayRef< int > M)
Swaps the values of N1 and N2.
virtual void addSelectionDAGCSEId(FoldingSetNodeID &ID)=0
static PointerType * get(Type *ElementType, unsigned AddressSpace)
This constructs a pointer to an object of the specified type in a numbered address space...
bool areNonVolatileConsecutiveLoads(LoadSDNode *LD, LoadSDNode *Base, unsigned Bytes, int Dist) const
Return true if loads are next to each other and can be merged.
SDValue getBasicBlock(MachineBasicBlock *MBB)
RESULT, BOOL = [SU]ADDO(LHS, RHS) - Overflow-aware nodes for addition.
Completely target-dependent object reference.
unsigned getOpcode() const
Return the SelectionDAG opcode value for this node.
static SDValue FoldCONCAT_VECTORS(const SDLoc &DL, EVT VT, ArrayRef< SDValue > Ops, SelectionDAG &DAG)
static ISD::NodeType getExtendForContent(BooleanContent Content)
bool getHasDebugValue() const
bool NewNodesMustHaveLegalTypes
When true, additional steps are taken to ensure that getConstant() and similar functions return DAG n...
Type * getTypeForEVT(LLVMContext &Context) const
This method returns an LLVM type corresponding to the specified EVT.
TargetGlobalAddress - Like GlobalAddress, but the DAG does no folding or anything else with this node...
unsigned getRawSubclassData() const
Return the SubclassData value, without HasDebugValue.
static const fltSemantics & EVTToAPFloatSemantics(EVT VT)
Returns an APFloat semantics tag appropriate for the given type.
bool isBitwiseNot(SDValue V)
Returns true if V is a bitwise not operation.
Val, Success, OUTCHAIN = ATOMIC_CMP_SWAP_WITH_SUCCESS(INCHAIN, ptr, cmp, swap) N.b.
unsigned getNumOperands() const
Return the number of values used by this operation.
bool all_of(R &&range, UnaryPredicate P)
Provide wrappers to std::all_of which take ranges instead of having to pass begin/end explicitly...
bool isInvalidated() const
void setAllBits()
Set every bit to 1.
unsigned getNumOperands() const
Constrained versions of the binary floating point operators.
unsigned getValueSizeInBits() const
Returns the size of the value in bits.
void Deallocate(SubClass *E)
Deallocate - Release storage for the pointed-to object.
int64_t getOffset() const
const SDValue & getOperand(unsigned Num) const
const Function * getFunction() const
getFunction - Return the LLVM function that this machine code represents
CallLoweringInfo & setDebugLoc(const SDLoc &dl)
virtual bool allowsMisalignedMemoryAccesses(EVT, unsigned AddrSpace=0, unsigned Align=1, bool *=nullptr) const
Determine if the target supports unaligned memory accesses.
unsigned getAddressSpace() const
Return the address space of the Pointer type.
SIGN_EXTEND_VECTOR_INREG(Vector) - This operator represents an in-register sign-extension of the low ...
static bool areOnlyUsersOf(ArrayRef< const SDNode * > Nodes, const SDNode *N)
Return true if all the users of N are contained in Nodes.
SDValue getTruncStore(SDValue Chain, const SDLoc &dl, SDValue Val, SDValue Ptr, MachinePointerInfo PtrInfo, EVT TVT, unsigned Alignment=0, MachineMemOperand::Flags MMOFlags=MachineMemOperand::MONone, const AAMDNodes &AAInfo=AAMDNodes())
[US]{MIN/MAX} - Binary minimum or maximum or signed or unsigned integers.
SDNode * isConstantFPBuildVectorOrConstantFP(SDValue N)
Test whether the given value is a constant FP or similar node.
void setNodeId(int Id)
Set unique node id.
void setBitsFrom(unsigned loBit)
Set the top bits starting from loBit.
SDValue getTargetExternalSymbol(const char *Sym, EVT VT, unsigned char TargetFlags=0)
SDValue getNode(unsigned Opcode, const SDLoc &DL, EVT VT, ArrayRef< SDUse > Ops)
Gets or creates the specified node.
ConstantSDNode * getConstantSplatNode(BitVector *UndefElements=nullptr) const
Returns the splatted constant or null if this is not a constant splat.
SDDbgValue * getFrameIndexDbgValue(MDNode *Var, MDNode *Expr, unsigned FI, uint64_t Off, const DebugLoc &DL, unsigned O)
FrameIndex.
const MachinePointerInfo & getPointerInfo() const
static MachinePointerInfo InferPointerInfo(SelectionDAG &DAG, SDValue Ptr, int64_t Offset=0)
InferPointerInfo - If the specified ptr/offset is a frame index, infer a MachinePointerInfo record fr...
const SDValue & setRoot(SDValue N)
Set the current root tag of the SelectionDAG.
void reserve(size_type N)
uint64_t Offset
Slice starts at this Offset.
unsigned getNumSignBits() const
Computes the number of leading bits of this APInt that are equal to its sign bit. ...
const SDValue & getValue() const
void DeleteNode(SDNode *N)
Remove the specified node from the system.
INSERT_SUBVECTOR(VECTOR1, VECTOR2, IDX) - Returns a vector with VECTOR2 inserted into VECTOR1 at the ...
SDValue getConstantPool(const Constant *C, EVT VT, unsigned Align=0, int Offs=0, bool isT=false, unsigned char TargetFlags=0)
APInt zextOrTrunc(unsigned width) const
Zero extend or truncate to width.
void init(MachineFunction &NewMF, OptimizationRemarkEmitter &NewORE)
Prepare this SelectionDAG to process code in the given MachineFunction.
void intersectFlagsWith(const SDNodeFlags Flags)
Clear any flags in this node that aren't also set in Flags.
std::size_t countLeadingZeros(T Val, ZeroBehavior ZB=ZB_Width)
Count number of 0's from the most significant bit to the least stopping at the first 1...
uint16_t PersistentId
Unique and persistent id per SDNode in the DAG.
EntryToken - This is the marker used to indicate the start of a region.
bool optForSize() const
Optimize this function for size (-Os) or minimum size (-Oz).
void AddDbgValue(SDDbgValue *DB, SDNode *SD, bool isParameter)
Add a dbg_value SDNode.
Select with condition operator - This selects between a true value and a false value (ops #2 and #3) ...
NodeType
ISD::NodeType enum - This enum defines the target-independent operators for a SelectionDAG.
unsigned getResNo() const
get the index which selects a specific result in the SDNode
SDValue getMCSymbol(MCSymbol *Sym, EVT VT)
void ReplaceAllUsesOfValuesWith(const SDValue *From, const SDValue *To, unsigned Num)
Like ReplaceAllUsesOfValueWith, but for multiple values at once.
bool bitsLT(EVT VT) const
Return true if this has less bits than VT.
virtual void NodeUpdated(SDNode *N)
The node N that was updated.
bool isUndef() const
Return true if the type of the node type undefined.
INT = FGETSIGN(FP) - Return the sign bit of the specified floating point value as an integer 0/1 valu...
bool optForMinSize() const
Optimize this function for minimum size (-Oz).
This SDNode is used to implement the code generator support for the llvm IR shufflevector instruction...
bool isAllOnesValue() const
SDValue getExternalSymbol(const char *Sym, EVT VT)
MemSDNode(unsigned Opc, unsigned Order, const DebugLoc &dl, SDVTList VTs, EVT MemoryVT, MachineMemOperand *MMO)
RESULT,OUTCHAIN = INTRINSIC_W_CHAIN(INCHAIN, INTRINSICID, arg1, ...) This node represents a target in...
bool isSubsetOf(const APInt &RHS) const
This operation checks that all bits set in this APInt are also set in RHS.
A templated base class for SmallPtrSet which provides the typesafe interface that is common across al...
virtual bool isCommutativeBinOp(unsigned Opcode) const
Returns true if the opcode is a commutative binary operation.
SDValue getMemBasePlusOffset(SDValue Base, unsigned Offset, const SDLoc &DL)
Returns sum of the base pointer and offset.
SDValue getAnyExtendVectorInReg(SDValue Op, const SDLoc &DL, EVT VT)
Return an operation which will any-extend the low lanes of the operand into the specified vector type...
const Triple & getTargetTriple() const
bool isKnownNeverZero(SDValue Op) const
Test whether the given SDValue is known to never be positive or negative zero.
APInt rotl(unsigned rotateAmt) const
Rotate left by rotateAmt.
SHL_PARTS/SRA_PARTS/SRL_PARTS - These operators are used for expanded integer shift operations...
bool isVector() const
Return true if this is a vector value type.
SDValue getIntPtrConstant(uint64_t Val, const SDLoc &DL, bool isTarget=false)
opStatus divide(const APFloat &RHS, roundingMode RM)
APInt urem(const APInt &RHS) const
Unsigned remainder operation.
The address of a basic block.
void clear()
Clear state and free memory necessary to make this SelectionDAG ready to process a new block...
bool isNegative() const
Return true if the value is negative.
bool isNonNegative() const
Returns true if this value is known to be non-negative.
A description of a memory reference used in the backend.
void clear()
clear - Removes all bits from the bitvector. Does not change capacity.
SDValue FoldSymbolOffset(unsigned Opcode, EVT VT, const GlobalAddressSDNode *GA, const SDNode *N2)
const TargetSubtargetInfo & getSubtarget() const
getSubtarget - Return the subtarget for which this machine code is being compiled.
void setBit(unsigned BitPosition)
Set a given bit to 1.
AddrSpaceCastSDNode(unsigned Order, const DebugLoc &dl, EVT VT, unsigned SrcAS, unsigned DestAS)
This file declares the MachineConstantPool class which is an abstract constant pool to keep track of ...
Twine - A lightweight data structure for efficiently representing the concatenation of temporary valu...
int64_t getOffset() const
void Reset()
Deallocate all but the current slab and reset the current pointer to the beginning of it...
void setHighBits(unsigned hiBits)
Set the top hiBits bits.
bool isUndef(unsigned Opcode, ArrayRef< SDValue > Ops)
Return true if the result of this operation is always undefined.
const APInt & getValue() const
Return the constant as an APInt value reference.
Shift and rotation operations.
bool isBuildVectorAllZeros(const SDNode *N)
Return true if the specified node is a BUILD_VECTOR where all of the elements are 0 or undef...
EVT getValueType(unsigned ResNo) const
Return the type of a specified result.
ABS - Determine the unsigned absolute value of a signed integer value of the same bitwidth...
A Use represents the edge between a Value definition and its users.
SDValue getTargetExtractSubreg(int SRIdx, const SDLoc &DL, EVT VT, SDValue Operand)
A convenience function for creating TargetInstrInfo::EXTRACT_SUBREG nodes.
MachineSDNode * getMachineNode(unsigned Opcode, const SDLoc &dl, EVT VT)
These are used for target selectors to create a new node with specified return type(s), MachineInstr opcode, and operands.
MachineFunction & getMachineFunction() const
SDValue getMaskedScatter(SDVTList VTs, EVT VT, const SDLoc &dl, ArrayRef< SDValue > Ops, MachineMemOperand *MMO)
CallLoweringInfo & setChain(SDValue InChain)
BUILD_PAIR - This is the opposite of EXTRACT_ELEMENT in some ways.
This class consists of common code factored out of the SmallVector class to reduce code duplication b...
virtual bool isNoopAddrSpaceCast(unsigned SrcAS, unsigned DestAS) const
Returns true if a cast between SrcAS and DestAS is a noop.
bool isZEXTLoad(const SDNode *N)
Returns true if the specified node is a ZEXTLOAD.
unsigned getAddressSpace() const
MachinePointerInfo getWithOffset(int64_t O) const
static void checkAddrSpaceIsValidForLibcall(const TargetLowering *TLI, unsigned AS)
APInt bitcastToAPInt() const
void AddInteger(signed I)
The memory access is dereferenceable (i.e., doesn't trap).
EVT getScalarType() const
If this is a vector type, return the element type, otherwise return this.
The MachineFrameInfo class represents an abstract stack frame until prolog/epilog code is inserted...
Val, OUTCHAIN = ATOMIC_SWAP(INCHAIN, ptr, amt) Val, OUTCHAIN = ATOMIC_LOAD_[OpName](INCHAIN, ptr, amt) For double-word atomic operations: ValLo, ValHi, OUTCHAIN = ATOMIC_SWAP(INCHAIN, ptr, amtLo, amtHi) ValLo, ValHi, OUTCHAIN = ATOMIC_LOAD_[OpName](INCHAIN, ptr, amtLo, amtHi) These correspond to the atomicrmw instruction.
bool isFixedObjectIndex(int ObjectIdx) const
Returns true if the specified index corresponds to a fixed stack object.
allnodes_const_iterator allnodes_end() const
bool bitsGE(EVT VT) const
Return true if this has no less bits than VT.
SDNode * getNodeIfExists(unsigned Opcode, SDVTList VTs, ArrayRef< SDValue > Ops, const SDNodeFlags Flags=SDNodeFlags())
Get the specified node if it's already available, or else return NULL.
int getMaskElt(unsigned Idx) const
SDVTList getVTList(EVT VT)
Return an SDVTList that represents the list of values specified.
This is an SDNode representing atomic operations.
MachineMemOperand * getMachineMemOperand(MachinePointerInfo PtrInfo, MachineMemOperand::Flags f, uint64_t s, unsigned base_alignment, const AAMDNodes &AAInfo=AAMDNodes(), const MDNode *Ranges=nullptr, SyncScope::ID SSID=SyncScope::System, AtomicOrdering Ordering=AtomicOrdering::NotAtomic, AtomicOrdering FailureOrdering=AtomicOrdering::NotAtomic)
getMachineMemOperand - Allocate a new MachineMemOperand.
MDNode * getExpression() const
void lshrInPlace(unsigned ShiftAmt)
Logical right-shift this APInt by ShiftAmt in place.
SDValue FoldSetCC(EVT VT, SDValue N1, SDValue N2, ISD::CondCode Cond, const SDLoc &dl)
Constant fold a setcc to true or false.
KnownBits zext(unsigned BitWidth)
Zero extends the underlying known Zero and One bits.
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 ...
This class defines information used to lower LLVM code to legal SelectionDAG operators that the targe...
bool isInteger() const
Return true if this is an integer or a vector integer type.
This file implements a class to represent arbitrary precision integral constant values and operations...
This represents a list of ValueType's that has been intern'd by a SelectionDAG.
iterator_range< allnodes_iterator > allnodes()
unsigned getEVTAlignment(EVT MemoryVT) const
Compute the default alignment value for the given type.
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())
LLVM_NODISCARD bool empty() const
bool getBoolValue() const
Convert APInt to a boolean value.
AtomicOrdering
Atomic ordering for LLVM's memory model.
SDValue getMergeValues(ArrayRef< SDValue > Ops, const SDLoc &dl)
Create a MERGE_VALUES node from the given operands.
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 getVectorElementType() const
Given a vector type, return the type of each element.
unsigned AssignTopologicalOrder()
Topological-sort the AllNodes list and a assign a unique node id for each node in the DAG based on th...
static void VerifySDNode(SDNode *N)
VerifySDNode - Sanity check the given SDNode. Aborts if it is invalid.
bool isConstantSplat(APInt &SplatValue, APInt &SplatUndef, unsigned &SplatBitSize, bool &HasAnyUndefs, unsigned MinSplatBits=0, bool isBigEndian=false) const
Check if this is a constant splat, and if so, find the smallest element size that splats the vector...
auto reverse(ContainerTy &&C, typename std::enable_if< has_rbegin< ContainerTy >::value >::type *=nullptr) -> decltype(make_range(C.rbegin(), C.rend()))
APInt shl(unsigned shiftAmt) const
Left-shift function.
const AMDGPUAS &AS return SrcAS
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...
bool isConstantSplatVector(const SDNode *N, APInt &SplatValue, bool AllowShrink=true)
Node predicates.
void ashrInPlace(unsigned ShiftAmt)
Arithmetic right-shift this APInt by ShiftAmt in place.
static SDValue getMemsetValue(SDValue Value, EVT VT, SelectionDAG &DAG, const SDLoc &dl)
getMemsetValue - Vectorized representation of the memset value operand.
static SDValue getMemsetStores(SelectionDAG &DAG, const SDLoc &dl, SDValue Chain, SDValue Dst, SDValue Src, uint64_t Size, unsigned Align, bool isVol, MachinePointerInfo DstPtrInfo)
Lower the call to 'memset' intrinsic function into a series of store operations.
void checkForCycles(const SelectionDAG *DAG, bool force=false)
unsigned getIROrder() const
Return the node ordering.
[SU]INT_TO_FP - These operators convert integers (whose interpreted sign depends on the first letter)...
SDValue getMaskedGather(SDVTList VTs, EVT VT, const SDLoc &dl, ArrayRef< SDValue > Ops, MachineMemOperand *MMO)
const ConstantDataArray * Array
ConstantDataArray pointer.
opStatus convert(const fltSemantics &ToSemantics, roundingMode RM, bool *losesInfo)
std::pair< SDValue, SDValue > LowerCallTo(CallLoweringInfo &CLI) const
This function lowers an abstract call to a function into an actual call.
unsigned getNumValues() const
Return the number of values defined/returned by this operator.
SDValue getRegisterMask(const uint32_t *RegMask)
DAGUpdateListener *const Next
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...
SDNode * mutateStrictFPToFP(SDNode *Node)
Mutate the specified strict FP node to its non-strict equivalent, unlinking the node from its chain a...
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.
Simple integer binary arithmetic operators.
bool sgt(const APInt &RHS) const
Signed greather than comparison.
DbgValueKind getKind() const
ArrayRef - Represent a constant reference to an array (0 or more elements consecutively in memory)...
opStatus subtract(const APFloat &RHS, roundingMode RM)
bool isLittleEndian() const
Layout endianness...
MachineConstantPoolValue * getMachineCPVal() const
SDValue getUNDEF(EVT VT)
Return an UNDEF node. UNDEF does not have a useful SDLoc.
cmpResult
IEEE-754R 5.11: Floating Point Comparison Relations.
SDValue getMaskedStore(SDValue Chain, const SDLoc &dl, SDValue Val, SDValue Ptr, SDValue Mask, EVT MemVT, MachineMemOperand *MMO, bool IsTruncating=false, bool IsCompressing=false)
CondCode
ISD::CondCode enum - These are ordered carefully to make the bitfields below work out...
const APInt & getAPIntValue() const
static const fltSemantics & IEEEdouble() LLVM_READNONE
TargetConstant* - Like Constant*, but the DAG does not do any folding, simplification, or lowering of the constant.
EVT getMemoryVT() const
Return the type of the in-memory value.
SDValue getTargetConstant(uint64_t Val, const SDLoc &DL, EVT VT, bool isOpaque=false)
ANY_EXTEND_VECTOR_INREG(Vector) - This operator represents an in-register any-extension of the low la...
const ConstantInt * getConstantIntValue() const
SDValue getSplatBuildVector(EVT VT, const SDLoc &DL, SDValue Op)
Return a splat ISD::BUILD_VECTOR node, consisting of Op splatted to all elements. ...
void setIROrder(unsigned Order)
Set the node ordering.
opStatus convertToInteger(MutableArrayRef< integerPart > Input, unsigned int Width, bool IsSigned, roundingMode RM, bool *IsExact) const
virtual bool shouldConvertConstantLoadToIntImm(const APInt &Imm, Type *Ty) const
Return true if it is beneficial to convert a load of a constant to just the constant itself...
RESULT = INTRINSIC_WO_CHAIN(INTRINSICID, arg1, arg2, ...) This node represents a target intrinsic fun...
size_t size() const
size - Get the array size.
const DataLayout & getDataLayout() const
bool bitsLE(EVT VT) const
Return true if this has no more bits than VT.
Expected< const typename ELFT::Sym * > getSymbol(typename ELFT::SymRange Symbols, uint32_t Index)
unsigned char getTargetFlags() const
UNDEF - An undefined node.
This class is used to represent ISD::STORE nodes.
FP_TO_[US]INT - Convert a floating point value to a signed or unsigned integer.
static void AddNodeIDValueTypes(FoldingSetNodeID &ID, SDVTList VTList)
AddNodeIDValueTypes - Value type lists are intern'd so we can represent them solely with their pointe...
BUILD_VECTOR(ELT0, ELT1, ELT2, ELT3,...) - Return a vector with the specified, possibly variable...
bool isOneConstant(SDValue V)
Returns true if V is a constant integer one.
This corresponds to the llvm.lifetime.
static APInt getHighBitsSet(unsigned numBits, unsigned hiBitsSet)
Get a value with high bits set.
bool getConstantDataArrayInfo(const Value *V, ConstantDataArraySlice &Slice, unsigned ElementSize, uint64_t Offset=0)
Returns true if the value V is a pointer into a ContantDataArray.
virtual const SelectionDAGTargetInfo * getSelectionDAGInfo() const
SDNode * getNode() const
get the SDNode which holds the desired result
FoldingSetNodeID - This class is used to gather all the unique data bits of a node.
The memory access is volatile.
constexpr uint64_t MinAlign(uint64_t A, uint64_t B)
A and B are either alignments or offsets.
bool hasPredecessor(const SDNode *N) const
Return true if N is a predecessor of this node.
void insertBits(const APInt &SubBits, unsigned bitPosition)
Insert the bits from a smaller APInt starting at bitPosition.
unsigned getScalarSizeInBits() const
unsigned getStoreSize() const
Return the number of bytes overwritten by a store of the specified value type.
SDValue getMDNode(const MDNode *MD)
Return an MDNodeSDNode which holds an MDNode.
bool isTypeLegal(EVT VT) const
Return true if the target has native support for the specified value type.
bool isOnlyUserOf(const SDNode *N) const
Return true if this node is the only use of N.
SDValue getVectorShuffle(EVT VT, const SDLoc &dl, SDValue N1, SDValue N2, ArrayRef< int > Mask)
Return an ISD::VECTOR_SHUFFLE node.
OUTCHAIN = INTRINSIC_VOID(INCHAIN, INTRINSICID, arg1, arg2, ...) This node represents a target intrin...
unsigned UnsafeFPMath
UnsafeFPMath - This flag is enabled when the -enable-unsafe-fp-math flag is specified on the command ...
static SDValue getMemmoveLoadsAndStores(SelectionDAG &DAG, const SDLoc &dl, SDValue Chain, SDValue Dst, SDValue Src, uint64_t Size, unsigned Align, bool isVol, bool AlwaysInline, MachinePointerInfo DstPtrInfo, MachinePointerInfo SrcPtrInfo)
SDValue getCommutedVectorShuffle(const ShuffleVectorSDNode &SV)
Returns an ISD::VECTOR_SHUFFLE node semantically equivalent to the shuffle node in input but with swa...
* if(!EatIfPresent(lltok::kw_thread_local)) return false
ParseOptionalThreadLocal := /*empty.
bool isZero() const
Return true if the value is positive or negative zero.
bool intersects(const APInt &RHS) const
This operation tests if there are any pairs of corresponding bits between this APInt and RHS that are...
MutableArrayRef - Represent a mutable reference to an array (0 or more elements consecutively in memo...
#define __asan_unpoison_memory_region(p, size)
APInt trunc(unsigned width) const
Truncate to new width.
SelectionDAG(const TargetMachine &TM, CodeGenOpt::Level)
bool hasFloatingPointExceptions() const
Return true if target supports floating point exceptions.
bool isMachineConstantPoolEntry() const
bool isNegative() const
Returns true if this value is known to be negative.
static void AddNodeIDNode(FoldingSetNodeID &ID, unsigned short OpC, SDVTList VTList, ArrayRef< SDValue > OpList)
const SDValue & getOperand(unsigned i) const
The instances of the Type class are immutable: once they are created, they are never changed...
This is an important class for using LLVM in a threaded context.
Simple binary floating point operators.
SDValue getMemIntrinsicNode(unsigned Opcode, const SDLoc &dl, SDVTList VTList, ArrayRef< SDValue > Ops, EVT MemVT, MachinePointerInfo PtrInfo, unsigned Align=0, bool Vol=false, bool ReadMem=true, bool WriteMem=true, unsigned Size=0)
Creates a MemIntrinsicNode that may produce a result and takes a list of operands.
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...
static bool doNotCSE(SDNode *N)
doNotCSE - Return true if CSE should not be performed for this node.
bool sge(const APInt &RHS) const
Signed greather or equal comparison.
MachineFrameInfo & getFrameInfo()
getFrameInfo - Return the frame info object for the current function.
void DropOperands()
Release the operands and set this node to have zero operands.
virtual EVT getOptimalMemOpType(uint64_t, unsigned, unsigned, bool, bool, bool, MachineFunction &) const
Returns the target specific optimal type for load and store operations as a result of memset...
unsigned countMinLeadingZeros() const
Returns the minimum number of leading zero bits.
PointerUnion< const Value *, const PseudoSourceValue * > V
This is the IR pointer value for the access, or it is null if unknown.
This is an important base class in LLVM.
void resetAll()
Resets the known state of all bits.
static SDValue getMemsetStringVal(EVT VT, const SDLoc &dl, SelectionDAG &DAG, const TargetLowering &TLI, const ConstantDataArraySlice &Slice)
getMemsetStringVal - Similar to getMemsetValue.
const SDNodeFlags getFlags() const
LLVM_ATTRIBUTE_ALWAYS_INLINE iterator begin()
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...
const Constant * getConstVal() const
constexpr char Args[]
Key for Kernel::Metadata::mArgs.
This file contains the declarations for the subclasses of Constant, which represent the different fla...
LLVM_ATTRIBUTE_RETURNS_NONNULL LLVM_ATTRIBUTE_RETURNS_NOALIAS void * Allocate(size_t Size, size_t Alignment)
Allocate space at the specified alignment.
bool isDereferenceable(unsigned Size, LLVMContext &C, const DataLayout &DL) const
Return true if memory region [V, V+Offset+Size) is known to be dereferenceable.
Carry-using nodes for multiple precision addition and subtraction.
virtual bool isSafeMemOpType(MVT) const
Returns true if it's safe to use load / store of the specified type to expand memcpy / memset inline...
ConstantFP - Floating Point Values [float, double].
std::pair< iterator, bool > insert(PtrType Ptr)
Inserts Ptr if and only if there is no element in the container equal to Ptr.
unsigned getMaxStoresPerMemmove(bool OptSize) const
Get maximum # of store operations permitted for llvm.memmove.
SDValue getAddrSpaceCast(const SDLoc &dl, EVT VT, SDValue Ptr, unsigned SrcAS, unsigned DestAS)
Return an AddrSpaceCastSDNode.
unsigned getScalarValueSizeInBits() const
static APInt getOneBitSet(unsigned numBits, unsigned BitNo)
Return an APInt with exactly one bit set in the result.
bool sle(const APInt &RHS) const
Signed less or equal comparison.
void RemoveDeadNodes()
This method deletes all unreachable nodes in the SelectionDAG.
static void AddNodeIDOperands(FoldingSetNodeID &ID, ArrayRef< SDValue > Ops)
AddNodeIDOperands - Various routines for adding operands to the NodeID data.
This file declares a class to represent arbitrary precision floating point values and provide a varie...
This class provides iterator support for SDUse operands that use a specific SDNode.
BumpPtrAllocator & getAlloc()
bool any_of(R &&Range, UnaryPredicate P)
Provide wrappers to std::any_of which take ranges instead of having to pass begin/end explicitly...
APInt ashr(unsigned ShiftAmt) const
Arithmetic right-shift function.
ArrayRef< SDDbgValue * > GetDbgValues(const SDNode *SD)
Get the debug values which reference the given SDNode.
static ManagedStatic< std::set< EVT, EVT::compareRawBits > > EVTs
KnownBits trunc(unsigned BitWidth)
Truncate the underlying known Zero and One bits.
unsigned getBitWidth() const
Return the number of bits in the APInt.
bool uge(const APInt &RHS) const
Unsigned greater or equal comparison.
unsigned getOpcode() const
opStatus multiply(const APFloat &RHS, roundingMode RM)
TargetIndex - Like a constant pool entry, but with completely target-dependent semantics.
APInt sdiv(const APInt &RHS) const
Signed division function for APInt.
AssertSext, AssertZext - These nodes record if a register contains a value that has already been zero...
unsigned char getTargetFlags() const
void RemoveDeadNode(SDNode *N)
Remove the specified node from the system.
self_iterator getIterator()
CondCode getSetCCSwappedOperands(CondCode Operation)
Return the operation corresponding to (Y op X) when given the operation for (X op Y)...
uint64_t getConstantOperandVal(unsigned Num) const
Helper method returns the integer value of a ConstantSDNode operand.
unsigned countPopulation() const
Count the number of bits set.
VAARG - VAARG has four operands: an input chain, a pointer, a SRCVALUE, and the alignment.
ilist< SDNode >::size_type allnodes_size() const
Represents offset+length into a ConstantDataArray.
use_iterator use_begin() const
Provide iteration support to walk over all uses of an SDNode.
bool empty() const
empty - Check if the array is empty.
SDValue getMaskedLoad(EVT VT, const SDLoc &dl, SDValue Chain, SDValue Ptr, SDValue Mask, SDValue Src0, EVT MemVT, MachineMemOperand *MMO, ISD::LoadExtType, bool IsExpanding=false)
const SDValue & getValue() const
ConstantSDNode * isConstOrConstSplat(SDValue V)
Returns the SDNode if it is a constant splat BuildVector or constant int.
void clearSignBit()
Set the sign bit to 0.
static bool isValueValidForType(EVT VT, const APFloat &Val)
bool isThreadLocal() const
If the value is "Thread Local", its value isn't shared by the threads.
Bit counting operators with an undefined result for zero inputs.
Val, OUTCHAIN = ATOMIC_CMP_SWAP(INCHAIN, ptr, cmp, swap) For double-word atomic operations: ValLo...
bool MaskedValueIsZero(SDValue Op, const APInt &Mask, unsigned Depth=0) const
Return true if 'Op & Mask' is known to be zero.
X = FP_EXTEND(Y) - Extend a smaller FP type into a larger FP type.
LLVM_NODISCARD bool empty() const
static ManagedStatic< sys::SmartMutex< true > > VTMutex
ArrayRef< SDDbgValue * > getSDDbgValues(const SDNode *Node)
std::vector< ArgListEntry > ArgListTy
bool isPointerTy() const
True if this is an instance of PointerType.
const APFloat & getValueAPF() const
static const APInt * getValidShiftAmountConstant(SDValue V)
If a SHL/SRA/SRL node has a constant or splat constant shift amount that is less than the element bit...
TargetRegisterInfo base class - We assume that the target defines a static array of TargetRegisterDes...
bool isEqualTo(SDValue A, SDValue B) const
Test whether two SDValues are known to compare equal.
Abstract base class for all machine specific constantpool value subclasses.
This structure contains all information that is necessary for lowering calls.
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...
unsigned countTrailingZeros() const
Count the number of trailing zero bits.
SDDbgValue * getConstantDbgValue(MDNode *Var, MDNode *Expr, const Value *C, uint64_t Off, const DebugLoc &DL, unsigned O)
Constant.
This class contains a discriminated union of information about pointers in memory operands...
bool isPowerOf2() const
Check if this APInt's value is a power of two greater than zero.
HANDLENODE node - Used as a handle for various purposes.
void copySign(const APFloat &RHS)
SDValue getAtomicCmpSwap(unsigned Opcode, const SDLoc &dl, EVT MemVT, SDVTList VTs, SDValue Chain, SDValue Ptr, SDValue Cmp, SDValue Swp, MachinePointerInfo PtrInfo, unsigned Alignment, AtomicOrdering SuccessOrdering, AtomicOrdering FailureOrdering, SyncScope::ID SSID)
Gets a node for an atomic cmpxchg op.
APInt rotr(unsigned rotateAmt) const
Rotate right by rotateAmt.
const SDValue & getRoot() const
Return the root tag of the SelectionDAG.
const BlockAddress * getBlockAddress() const
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 isNull() const
Test if the pointer held in the union is null, regardless of which type it is.
EH_LABEL - Represents a label in mid basic block used to track locations needed for debug and excepti...
APInt srem(const APInt &RHS) const
Function for signed remainder operation.
const MachinePointerInfo & getPointerInfo() const
MachineMemOperand * MMO
Memory reference information.
const MDNode * getRanges() const
Returns the Ranges that describes the dereference.
static const char *const Magic
The memory access writes data.
const SDValue & getOffset() const
unsigned countMinLeadingOnes() const
Returns the minimum number of leading one bits.
bool bitsGT(EVT VT) const
Return true if this has more bits than VT.
bool isOSDarwin() const
isOSDarwin - Is this a "Darwin" OS (OS X, iOS, or watchOS).
SDValue getZeroExtendVectorInReg(SDValue Op, const SDLoc &DL, EVT VT)
Return an operation which will zero extend the low lanes of the operand into the specified vector typ...
ArrayRef< int > getMask() const
bool ugt(const APInt &RHS) const
Unsigned greather than comparison.
SDValue getBitcast(EVT VT, SDValue V)
Return a bitcast using the SDLoc of the value operand, and casting to the provided type...
IntegerType * getIntPtrType(LLVMContext &C, unsigned AddressSpace=0) const
Returns an integer type with size at least as big as that of a pointer in the given address space...
static APInt getSignMask(unsigned BitWidth)
Get the SignMask for a specific bit width.
EVT getHalfNumVectorElementsVT(LLVMContext &Context) const
TokenFactor - This node takes multiple tokens as input and produces a single token result...
unsigned getABITypeAlignment(Type *Ty) const
Returns the minimum ABI-required alignment for the specified type.
SDValue expandVACopy(SDNode *Node)
Expand the specified ISD::VACOPY node as the Legalize pass would.
bool isBuildVectorAllOnes(const SDNode *N)
Return true if the specified node is a BUILD_VECTOR where all of the elements are ~0 or undef...
static const fltSemantics & IEEEsingle() LLVM_READNONE
Iterator for intrusive lists based on ilist_node.
SmallPtrSet - This class implements a set which is optimized for holding SmallSize or less elements...
const DebugLoc & getDebugLoc() const
This is the shared class of boolean and integer constants.
void dump() const
Dump this node, for debugging.
allnodes_const_iterator allnodes_begin() const
static const fltSemantics & IEEEhalf() LLVM_READNONE
virtual void NodeDeleted(SDNode *N, SDNode *E)
The node N that was deleted and, if E is not null, an equivalent node E that replaced it...
APInt getHiBits(unsigned numBits) const
Compute an APInt containing numBits highbits from this APInt.
bool isDereferenceable() const
bool isBaseWithConstantOffset(SDValue Op) const
Return true if the specified operand is an ISD::ADD with a ConstantSDNode on the right-hand side...
bool erase(PtrType Ptr)
erase - If the set contains the specified pointer, remove it and return true, otherwise return false...
const char * getLibcallName(RTLIB::Libcall Call) const
Get the libcall routine name for the specified libcall.
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.
EXTRACT_VECTOR_ELT(VECTOR, IDX) - Returns a single element from VECTOR identified by the (potentially...
std::pair< SDValue, SDValue > SplitVector(const SDValue &N, const SDLoc &DL, const EVT &LoVT, const EVT &HiVT)
Split the vector with EXTRACT_SUBVECTOR using the provides VTs and return the low/high part...
SDNode * UpdateNodeOperands(SDNode *N, SDValue Op)
Mutate the specified node in-place to have the specified operands.
This is used to represent a portion of an LLVM function in a low-level Data Dependence DAG representa...
X = FP_ROUND_INREG(Y, VT) - This operator takes an FP register, and rounds it to a floating point val...
SDNode * SelectNodeTo(SDNode *N, unsigned TargetOpc, EVT VT)
These are used for target selectors to mutate the specified node to have the specified return type...
SDValue getZExtOrTrunc(SDValue Op, const SDLoc &DL, EVT VT)
Convert Op, which must be of integer type, to the integer type VT, by either zero-extending or trunca...
ADDRSPACECAST - This operator converts between pointers of different address spaces.
This is a 'vector' (really, a variable-sized array), optimized for the case when the array is small...
unsigned getObjectAlignment(int ObjectIdx) const
Return the alignment of the specified stack object.
uint64_t Length
Length of the slice.
Type * getType() const
All values are typed, get the type of this value.
SDValue getBuildVector(EVT VT, const SDLoc &DL, ArrayRef< SDValue > Ops)
Return an ISD::BUILD_VECTOR node.
static APInt getSplat(unsigned NewLen, const APInt &V)
Return a value containing V broadcasted over NewLen bits.
SDNode * getSDNode() const
virtual const TargetLowering * getTargetLowering() const
SDValue getMemcpy(SDValue Chain, const SDLoc &dl, SDValue Dst, SDValue Src, SDValue Size, unsigned Align, bool isVol, bool AlwaysInline, bool isTailCall, MachinePointerInfo DstPtrInfo, MachinePointerInfo SrcPtrInfo)
bool allOperandsUndef(const SDNode *N)
Return true if the node has at least one operand and all operands of the specified node are ISD::UNDE...
size_type count(ConstPtrType Ptr) const
count - Return 1 if the specified pointer is in the set, 0 otherwise.
An SDNode that represents everything that will be needed to construct a MachineInstr.
const SDValue & getChain() const
A collection of metadata nodes that might be associated with a memory access used by the alias-analys...
Byte Swap and Counting operators.
FP16_TO_FP, FP_TO_FP16 - These operators are used to perform promotions and truncation for half-preci...
LLVM_NODISCARD T pop_back_val()
MachineMemOperand * getMemOperand() const
Return a MachineMemOperand object describing the memory reference performed by operation.
This is an abstract virtual class for memory operations.
unsigned char getTargetFlags() const
SDValue getMemmove(SDValue Chain, const SDLoc &dl, SDValue Dst, SDValue Src, SDValue Size, unsigned Align, bool isVol, bool isTailCall, MachinePointerInfo DstPtrInfo, MachinePointerInfo SrcPtrInfo)
Wrapper class for IR location info (IR ordering and DebugLoc) to be passed into SDNode creation funct...
unsigned getAddrSpace() const
Return the LLVM IR address space number that this pointer points into.
void ExtractVectorElements(SDValue Op, SmallVectorImpl< SDValue > &Args, unsigned Start=0, unsigned Count=0)
Append the extracted elements from Start to Count out of the vector Op in Args.
static Constant * get(Type *Ty, uint64_t V, bool isSigned=false)
If Ty is a vector type, return a Constant with a splat of the given value.
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...
static const int FIRST_TARGET_MEMORY_OPCODE
FIRST_TARGET_MEMORY_OPCODE - Target-specific pre-isel operations which do not reference a specific me...
int32_t exactLogBase2() const
Represents one node in the SelectionDAG.
void computeKnownBitsFromRangeMetadata(const MDNode &Ranges, KnownBits &Known)
Compute known bits from the range metadata.
static Constant * get(Type *Ty, double V)
This returns a ConstantFP, or a vector containing a splat of a ConstantFP, for the specified value in...
CondCode getSetCCInverse(CondCode Operation, bool isInteger)
Return the operation corresponding to !(X op Y), where 'op' is a valid SetCC operation.
static BaseIndexOffset match(SDValue Ptr, const SelectionDAG &DAG)
Parses tree in Ptr for base, index, offset addresses.
Type * getType() const
getType - get type of this MachineConstantPoolValue.
SDValue getNOT(const SDLoc &DL, SDValue Val, EVT VT)
Create a bitwise NOT operation as (XOR Val, -1).
static SDValue getMemcpyLoadsAndStores(SelectionDAG &DAG, const SDLoc &dl, SDValue Chain, SDValue Dst, SDValue Src, uint64_t Size, unsigned Align, bool isVol, bool AlwaysInline, MachinePointerInfo DstPtrInfo, MachinePointerInfo SrcPtrInfo)
AAMDNodes getAAInfo() const
Returns the AA info that describes the dereference.
raw_ostream & dbgs()
dbgs() - This returns a reference to a raw_ostream for debugging messages.
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.
ISD::LoadExtType getExtensionType() const
Return whether this is a plain node, or one of the varieties of value-extending loads.
SDNode * isConstantIntBuildVectorOrConstantInt(SDValue N)
Test whether the given value is a constant int or similar node.
unsigned countMaxPopulation() const
Returns the maximum number of bits that could be one.
static EVT getVectorVT(LLVMContext &Context, EVT VT, unsigned NumElements, bool IsScalable=false)
Returns the EVT that represents a vector NumElements in length, where each element is of type VT...
Class for arbitrary precision integers.
bool isBuildVectorOfConstantFPSDNodes(const SDNode *N)
Return true if the specified node is a BUILD_VECTOR node of all ConstantFPSDNode or undef...
SDValue getConstantFP(double Val, const SDLoc &DL, EVT VT, bool isTarget=false)
Create a ConstantFPSDNode wrapping a constant value.
bool exceedsNaturalStackAlignment(unsigned Align) const
Returns true if the given alignment exceeds the natural stack alignment.
bool haveNoCommonBitsSet(SDValue A, SDValue B) const
Return true if A and B have no common bits set.
static unsigned getReg(const void *D, unsigned RC, unsigned RegNo)
SDValue FoldConstantArithmetic(unsigned Opcode, const SDLoc &DL, EVT VT, SDNode *Cst1, SDNode *Cst2)
A "pseudo-class" with methods for operating on BUILD_VECTORs.
Select(COND, TRUEVAL, FALSEVAL).
int64_t getSExtValue() const
op_iterator op_begin() const
static use_iterator use_end()
bool isNullFPConstant(SDValue V)
Returns true if V is an FP constant with a value of positive zero.
ZERO_EXTEND - Used for integer types, zeroing the new bits.
unsigned countMinPopulation() const
Returns the number of bits known to be one.
ANY_EXTEND - Used for integer types. The high bits are undefined.
opStatus mod(const APFloat &RHS)
iterator insert(iterator I, T &&Elt)
CondCode getSetCCOrOperation(CondCode Op1, CondCode Op2, bool isInteger)
Return the result of a logical OR between different comparisons of identical values: ((X op1 Y) | (X ...
FCOPYSIGN(X, Y) - Return the value of X with the sign of Y.
void append(in_iter in_start, in_iter in_end)
Add the specified range to the end of the SmallVector.
SDValue getShiftAmountOperand(EVT LHSTy, SDValue Op)
Return the specified value casted to the target's desired shift amount type.
SDValue FoldConstantVectorArithmetic(unsigned Opcode, const SDLoc &DL, EVT VT, ArrayRef< SDValue > Ops, const SDNodeFlags Flags=SDNodeFlags())
SDValue getBlockAddress(const BlockAddress *BA, EVT VT, int64_t Offset=0, bool isTarget=false, unsigned char TargetFlags=0)
iterator_range< value_op_iterator > op_values() const
constexpr char Size[]
Key for Kernel::Arg::Metadata::mSize.
Flags
Flags values. These may be or'd together.
llvm_unreachable("Unknown RegBank!")
bool isNonTemporal() const
The memory access reads data.
int64_t getOffset() const
static MachinePointerInfo getFixedStack(MachineFunction &MF, int FI, int64_t Offset=0)
Return a MachinePointerInfo record that refers to the specified FrameIndex.
CallLoweringInfo & setTailCall(bool Value=true)
unsigned char getTargetFlags() const
static std::vector< std::string > Flags
opStatus add(const APFloat &RHS, roundingMode RM)
SDValue getStackArgumentTokenFactor(SDValue Chain)
Compute a TokenFactor to force all the incoming stack arguments to be loaded from the stack...
ConstantFPSDNode * isConstOrConstSplatFP(SDValue V)
Returns the SDNode if it is a constant splat BuildVector or constant float.
opStatus
IEEE-754R 7: Default exception handling.
These are IR-level optimization flags that may be propagated to SDNodes.
PointerType * getType() const
Global values are always pointers.
Represents a use of a SDNode.
unsigned getIROrder() const
LLVM_ATTRIBUTE_ALWAYS_INLINE iterator end()
uint64_t getConstantOperandVal(unsigned i) const
Bitwise operators - logical and, logical or, logical xor.
bool hasAnyUseOfValue(unsigned Value) const
Return true if there are any use of the indicated value.
static void checkForCyclesHelper(const SDNode *N, SmallPtrSetImpl< const SDNode * > &Visited, SmallPtrSetImpl< const SDNode * > &Checked, const llvm::SelectionDAG *DAG)
static bool shouldLowerMemFuncForSize(const MachineFunction &MF)
APInt udiv(const APInt &RHS) const
Unsigned division operation.
SIGN_EXTEND_INREG - This operator atomically performs a SHL/SRA pair to sign extend a small value in ...
void dumprFull(const SelectionDAG *G=nullptr) const
printrFull to dbgs().
static bool isMemSrcFromConstant(SDValue Src, ConstantDataArraySlice &Slice)
Returns true if memcpy source is constant data.
LOAD and STORE have token chains as their first operand, then the same operands as an LLVM load/store...
unsigned getMaxStoresPerMemset(bool OptSize) const
Get maximum # of store operations permitted for llvm.memset.
unsigned getSizeInBits() const
Return the size of the specified value type in bits.
void ReplaceAllUsesWith(SDValue From, SDValue Op)
Modify anything using 'From' to use 'To' instead.
ArrayRef< SDUse > ops() const
LLVM_ATTRIBUTE_ALWAYS_INLINE size_type size() const
bool isOperandOf(const SDNode *N) const
Return true if this node is an operand of N.
void Profile(FoldingSetNodeID &ID) const
Gather unique data for the node.
bool isIndexed() const
Return true if this is a pre/post inc/dec load/store.
constexpr char Align[]
Key for Kernel::Arg::Metadata::mAlign.
The memory access always returns the same value (or traps).
static std::pair< APInt, bool > FoldValue(unsigned Opcode, const APInt &C1, const APInt &C2)
op_iterator op_end() const
const TargetMachine & getTarget() const
getTarget - Return the target machine this machine code is compiled with
Fast - This calling convention attempts to make calls as fast as possible (e.g.
const SDValue & getOffset() const
LLVM_NODISCARD std::enable_if<!is_simple_type< Y >::value, typename cast_retty< X, const Y >::ret_type >::type dyn_cast(const Y &Val)
intptr_t getRawBits() const
bool reachesChainWithoutSideEffects(SDValue Dest, unsigned Depth=2) const
Return true if this operand (which must be a chain) reaches the specified operand without crossing an...
static int isSignedOp(ISD::CondCode Opcode)
For an integer comparison, return 1 if the comparison is a signed operation and 2 if the result is an...
DebugLoc getDebugLoc() const
constexpr int64_t SignExtend64(uint64_t x)
Sign-extend the number in the bottom B bits of X to a 64-bit integer.
int32_t getConstantFPSplatPow2ToLog2Int(BitVector *UndefElements, uint32_t BitWidth) const
If this is a constant FP splat and the splatted constant FP is an exact power or 2, return the log base 2 integer value.
int getNodeId() const
Return the unique node id.
int CreateStackObject(uint64_t Size, unsigned Alignment, bool isSS, const AllocaInst *Alloca=nullptr)
Create a new statically sized stack object, returning a nonnegative identifier to represent it...
EVT getValueType() const
Return the ValueType of the referenced return value.
SDValue getConstant(uint64_t Val, const SDLoc &DL, EVT VT, bool isTarget=false, bool isOpaque=false)
Create a ConstantSDNode wrapping a constant value.
unsigned countMaxTrailingZeros() const
Returns the maximum number of trailing zero bits possible.
MVT getFrameIndexTy(const DataLayout &DL) const
Return the type for frame index, which is determined by the alloca address space specified through th...
SDValue getCondCode(ISD::CondCode Cond)
SDNode * getNode() const
Convenience function for get().getNode().
SDValue getAtomic(unsigned Opcode, const SDLoc &dl, EVT MemVT, SDValue Chain, SDValue Ptr, SDValue Val, const Value *PtrVal, unsigned Alignment, AtomicOrdering Ordering, SyncScope::ID SSID)
Gets a node for an atomic op, produces result (if relevant) and chain and takes 2 operands...
SDValue getVAArg(EVT VT, const SDLoc &dl, SDValue Chain, SDValue Ptr, SDValue SV, unsigned Align)
VAArg produces a result and token chain, and takes a pointer and a source value as input...
const DebugLoc & getDebugLoc() const
Return the source location info.
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 getIndexedStore(SDValue OrigStoe, const SDLoc &dl, SDValue Base, SDValue Offset, ISD::MemIndexedMode AM)
CONCAT_VECTORS(VECTOR0, VECTOR1, ...) - Given a number of values of vector type with the same length ...
bool isFloatingPoint() const
Return true if this is a FP or a vector FP type.
static bool FindOptimalMemOpLowering(std::vector< EVT > &MemOps, unsigned Limit, uint64_t Size, unsigned DstAlign, unsigned SrcAlign, bool IsMemset, bool ZeroMemset, bool MemcpyStrSrc, bool AllowOverlap, unsigned DstAS, unsigned SrcAS, SelectionDAG &DAG, const TargetLowering &TLI)
Determines the optimal series of memory ops to replace the memset / memcpy.
SDValue getJumpTable(int JTI, EVT VT, bool isTarget=false, unsigned char TargetFlags=0)
This class is used to form a handle around another node that is persistent and is updated across invo...
assert(ImpDefSCC.getReg()==AMDGPU::SCC &&ImpDefSCC.isDef())
opStatus fusedMultiplyAdd(const APFloat &Multiplicand, const APFloat &Addend, roundingMode RM)
bool isAllOnesConstant(SDValue V)
Returns true if V is an integer constant with all bits set.
SDValue getFrameIndex(int FI, EVT VT, bool isTarget=false)
bool isSimple() const
Test if the given EVT is simple (as opposed to being extended).
unsigned getAlignment() const
bool operator<(int64_t V1, const APSInt &V2)
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...
uint64_t getOffset() const
EVT getTypeToTransformTo(LLVMContext &Context, EVT VT) const
For types supported by the target, this is an identity function.
LLVM Value Representation.
FMA - Perform a * b + c with no intermediate rounding step.
SDValue getLogicalNOT(const SDLoc &DL, SDValue Val, EVT VT)
Create a logical NOT operation as (XOR Val, BooleanOne).
SDValue getRegister(unsigned Reg, EVT VT)
SDValue getAnyExtOrTrunc(SDValue Op, const SDLoc &DL, EVT VT)
Convert Op, which must be of integer type, to the integer type VT, by either any-extending or truncat...
APInt sextOrTrunc(unsigned width) const
Sign extend or truncate to width.
MemSDNodeBitfields MemSDNodeBits
bool isNullConstant(SDValue V)
Returns true if V is a constant integer zero.
bool isTruncatingStore() const
Return true if the op does a truncation before store.
#define LLVM_FALLTHROUGH
LLVM_FALLTHROUGH - Mark fallthrough cases in switch statements.
void setDebugLoc(DebugLoc dl)
Set source location info.
SDValue getValueType(EVT)
KnownBits sext(unsigned BitWidth)
Sign extends the underlying known Zero and One bits.
std::underlying_type< E >::type Mask()
Get a bitmask with 1s in all places up to the high-order bit of E's largest value.
SDValue getFPExtendOrRound(SDValue Op, const SDLoc &DL, EVT VT)
Convert Op, which must be of float type, to the float type VT, by either extending or rounding (by tr...
PREFETCH - This corresponds to a prefetch intrinsic.
unsigned getResNo() const
void setHasDebugValue(bool b)
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...
uint64_t getSize() const
Return the size in bytes of the memory reference.
const TargetLowering & getTargetLoweringInfo() const
void ReplaceAllUsesOfValueWith(SDValue From, SDValue To)
Replace any uses of From with To, leaving uses of other values produced by From.Val alone...
SDValue getEHLabel(const SDLoc &dl, SDValue Root, MCSymbol *Label)
unsigned countLeadingZeros() const
The APInt version of the countLeadingZeros functions in MathExtras.h.
Primary interface to the complete machine description for the target machine.
void add(SDDbgValue *V, const SDNode *Node, bool isParameter)
FoldingSetNodeIDRef Intern(BumpPtrAllocator &Allocator) const
Intern - Copy this node's data to a memory region allocated from the given allocator and return a Fol...
SDValue getSrcValue(const Value *v)
Construct a node to track a Value* through the backend.
virtual const TargetRegisterInfo * getRegisterInfo() const
getRegisterInfo - If register information is available, return it.
APInt zext(unsigned width) const
Zero extend to a new width.
SetCC operator - This evaluates to a true value iff the condition is true.
OverflowKind computeOverflowKind(SDValue N0, SDValue N1) const
Determine if the result of the addition of 2 node can overflow.
bool needsStackRealignment(const MachineFunction &MF) const
True if storage within the function requires the stack pointer to be aligned more than the normal cal...
ManagedStatic - This transparently changes the behavior of global statics to be lazily constructed on...
virtual bool isOffsetFoldingLegal(const GlobalAddressSDNode *GA) const
Return true if folding a constant offset with the given GlobalAddress is legal.
virtual SDValue EmitTargetCodeForMemset(SelectionDAG &DAG, const SDLoc &dl, SDValue Chain, SDValue Op1, SDValue Op2, SDValue Op3, unsigned Align, bool isVolatile, MachinePointerInfo DstPtrInfo) const
Emit target-specific code that performs a memset.
void move(uint64_t Delta)
Moves the Offset and adjusts Length accordingly.
void sort(Policy policy, RandomAccessIterator Start, RandomAccessIterator End, const Comparator &Comp=Comparator())
unsigned getMinStackArgumentAlignment() const
Return the minimum stack alignment of an argument.
MERGE_VALUES - This node takes multiple discrete operands and returns them all as its individual resu...
BooleanContent
Enum that describes how the target represents true/false values.
static void AddNodeIDOpcode(FoldingSetNodeID &ID, unsigned OpC)
AddNodeIDOpcode - Add the node opcode to the NodeID data.
static APInt getNullValue(unsigned numBits)
Get the '0' value.
static ManagedStatic< EVTArray > SimpleVTArray
APInt abs() const
Get the absolute value;.
SDValue getEntryNode() const
Return the token chain corresponding to the entry of the function.
OUTCHAIN = ATOMIC_STORE(INCHAIN, ptr, val) This corresponds to "store atomic" instruction.
MDNode * getVariable() const
SDValue getZeroExtendInReg(SDValue Op, const SDLoc &DL, EVT SrcTy)
Return the expression required to zero extend the Op value assuming it was the smaller SrcTy value...
bool SignBitIsZero(SDValue Op, unsigned Depth=0) const
Return true if the sign bit of Op is known to be zero.
bool isOperandOf(const SDNode *N) const
Return true if this node is an operand of N.
SDValue getTargetInsertSubreg(int SRIdx, const SDLoc &DL, EVT VT, SDValue Operand, SDValue Subreg)
A convenience function for creating TargetInstrInfo::INSERT_SUBREG nodes.
TRUNCATE - Completely drop the high bits.
EVT getShiftAmountTy(EVT LHSTy, const DataLayout &DL) const
bool isTargetMemoryOpcode() const
Test if this node has a target-specific memory-referencing opcode (in the <target>ISD namespace and g...
unsigned getAlignment() const
bool isCondCodeLegal(ISD::CondCode CC, MVT VT) const
Return true if the specified condition code is legal on this target.
void erase(const SDNode *Node)
Invalidate all DbgValues attached to the node and remove it from the Node-to-DbgValues map...
Unlike LLVM values, Selection DAG nodes may return multiple values as the result of a computation...
MVT getSimpleValueType(unsigned ResNo) const
Return the type of a specified result as a simple type.
SDDbgValue - Holds the information from a dbg_value node through SDISel.
FNEG, FABS, FSQRT, FSIN, FCOS, FPOWI, FPOW, FLOG, FLOG2, FLOG10, FEXP, FEXP2, FCEIL, FTRUNC, FRINT, FNEARBYINT, FROUND, FFLOOR - Perform various unary floating point operations.
APInt lshr(unsigned shiftAmt) const
Logical right-shift function.
void setObjectAlignment(int ObjectIdx, unsigned Align)
setObjectAlignment - Change the alignment of the specified stack object.
static EVT getIntegerVT(LLVMContext &Context, unsigned BitWidth)
Returns the EVT that represents an integer with the given number of bits.
bool ule(const APInt &RHS) const
Unsigned less or equal comparison.
void computeKnownBits(const Value *V, KnownBits &Known, const DataLayout &DL, unsigned Depth=0, AssumptionCache *AC=nullptr, const Instruction *CxtI=nullptr, const DominatorTree *DT=nullptr, OptimizationRemarkEmitter *ORE=nullptr)
Determine which bits of V are known to be either zero or one and return them in the KnownZero/KnownOn...
static void AddNodeIDCustom(FoldingSetNodeID &ID, const SDNode *N)
If this is an SDNode with special info, add this info to the NodeID data.
static IntegerType * getInt8Ty(LLVMContext &C)
SDValue getMemset(SDValue Chain, const SDLoc &dl, SDValue Dst, SDValue Src, SDValue Size, unsigned Align, bool isVol, bool isTailCall, MachinePointerInfo DstPtrInfo)
Val, OUTCHAIN = ATOMIC_LOAD(INCHAIN, ptr) This corresponds to "load atomic" instruction.
SCALAR_TO_VECTOR(VAL) - This represents the operation of loading a scalar value into element 0 of the...
static bool isSplatMask(const int *Mask, EVT VT)
void setLowBits(unsigned loBits)
Set the bottom loBits bits.
unsigned getResNo() const
Convenience function for get().getResNo().
CallLoweringInfo & setLibCallee(CallingConv::ID CC, Type *ResultType, SDValue Target, ArgListTy &&ArgsList)
MVT getSimpleVT() const
Return the SimpleValueType held in the specified simple EVT.
Carry-using nodes for multiple precision addition and subtraction.
bool isMachineOpcode() const
Test if this node has a post-isel opcode, directly corresponding to a MachineInstr opcode...
SDValue expandVAArg(SDNode *Node)
Expand the specified ISD::VAARG node as the Legalize pass would.
This file describes how to lower LLVM code to machine code.
unsigned char getTargetFlags() const
unsigned getOrder() const
uint64_t getZExtValue() const
MemIndexedMode
MemIndexedMode enum - This enum defines the load / store indexed addressing modes.
MULHU/MULHS - Multiply high - Multiply two integers of type iN, producing an unsigned/signed value of...
bool slt(const APInt &RHS) const
Signed less than comparison.
static SDVTList makeVTList(const EVT *VTs, unsigned NumVTs)
makeVTList - Return an instance of the SDVTList struct initialized with the specified members...
unsigned getVectorNumElements() const
Given a vector type, return the number of elements it contains.
SRCVALUE - This is a node type that holds a Value* that is used to make reference to a value in the L...
This class is used to represent ISD::LOAD nodes.
bool is_contained(R &&Range, const E &Element)
Wrapper function around std::find to detect if an element exists in a container.