54 if (
AttrBuilder(CallerAttrs, AttributeSet::ReturnIndex)
83 std::pair<SDValue, SDValue>
86 const SDValue *Ops,
unsigned NumOps,
87 bool isSigned,
SDLoc dl,
89 bool isReturnValueUsed)
const {
94 for (
unsigned i = 0; i != NumOps; ++i) {
99 Args.push_back(Entry);
108 doesNotReturn, isReturnValueUsed, Callee, Args,
121 &&
"Unsupported setcc type!");
199 SDValue Ops[2] = { NewLHS, NewRHS };
200 NewLHS =
makeLibCall(DAG, LC1, RetVT, Ops, 2,
false,
208 NewLHS =
makeLibCall(DAG, LC2, RetVT, Ops, 2,
false,
282 const APInt &Demanded) {
292 if (!C)
return false;
302 DAG.getConstant(Demanded &
305 return CombineTo(Op, New);
322 const APInt &Demanded,
325 "ShrinkDemandedOp only supports binary operators!");
327 "ShrinkDemandedOp only supports nodes with one result!");
338 unsigned SmallVTBits = DemandedSize;
341 for (; SmallVTBits < BitWidth; SmallVTBits =
NextPowerOf2(SmallVTBits)) {
351 bool NeedZext = DemandedSize > SmallVTBits;
354 return CombineTo(Op, Z);
368 const APInt &DemandedMask,
372 unsigned Depth)
const {
375 "Mask size mismatches value type size!");
376 APInt NewMask = DemandedMask;
380 KnownZero = KnownOne =
APInt(BitWidth, 0);
393 }
else if (DemandedMask == 0) {
398 }
else if (Depth == 6) {
402 APInt KnownZero2, KnownOne2, KnownZeroOut, KnownOneOut;
406 KnownOne = cast<ConstantSDNode>(Op)->getAPIntValue();
407 KnownZero = ~KnownOne;
415 APInt LHSZero, LHSOne;
419 if ((LHSZero & NewMask) == (~RHSC->getAPIntValue() & NewMask))
428 KnownOne, TLO, Depth+1))
430 assert((KnownZero & KnownOne) == 0 &&
"Bits known to be one AND zero?");
432 KnownZero2, KnownOne2, TLO, Depth+1))
434 assert((KnownZero2 & KnownOne2) == 0 &&
"Bits known to be one AND zero?");
438 if ((NewMask & ~KnownZero2 & KnownOne) == (~KnownZero2 & NewMask))
440 if ((NewMask & ~KnownZero & KnownOne2) == (~KnownZero & NewMask))
443 if ((NewMask & (KnownZero|KnownZero2)) == NewMask)
444 return TLO.CombineTo(Op, TLO.DAG.getConstant(0, Op.
getValueType()));
446 if (TLO.ShrinkDemandedConstant(Op, ~KnownZero2 & NewMask))
449 if (TLO.ShrinkDemandedOp(Op, BitWidth, NewMask, dl))
453 KnownOne &= KnownOne2;
455 KnownZero |= KnownZero2;
459 KnownOne, TLO, Depth+1))
461 assert((KnownZero & KnownOne) == 0 &&
"Bits known to be one AND zero?");
463 KnownZero2, KnownOne2, TLO, Depth+1))
465 assert((KnownZero2 & KnownOne2) == 0 &&
"Bits known to be one AND zero?");
469 if ((NewMask & ~KnownOne2 & KnownZero) == (~KnownOne2 & NewMask))
471 if ((NewMask & ~KnownOne & KnownZero2) == (~KnownOne & NewMask))
475 if ((NewMask & ~KnownZero & KnownOne2) == (~KnownZero & NewMask))
477 if ((NewMask & ~KnownZero2 & KnownOne) == (~KnownZero2 & NewMask))
480 if (TLO.ShrinkDemandedConstant(Op, NewMask))
483 if (TLO.ShrinkDemandedOp(Op, BitWidth, NewMask, dl))
487 KnownZero &= KnownZero2;
489 KnownOne |= KnownOne2;
493 KnownOne, TLO, Depth+1))
495 assert((KnownZero & KnownOne) == 0 &&
"Bits known to be one AND zero?");
497 KnownOne2, TLO, Depth+1))
499 assert((KnownZero2 & KnownOne2) == 0 &&
"Bits known to be one AND zero?");
503 if ((KnownZero & NewMask) == NewMask)
505 if ((KnownZero2 & NewMask) == NewMask)
508 if (TLO.ShrinkDemandedOp(Op, BitWidth, NewMask, dl))
514 if ((NewMask & ~KnownZero & ~KnownZero2) == 0)
520 KnownZeroOut = (KnownZero & KnownZero2) | (KnownOne & KnownOne2);
522 KnownOneOut = (KnownZero & KnownOne2) | (KnownOne & KnownZero2);
529 if ((NewMask & (KnownZero|KnownOne)) == NewMask) {
530 if (KnownOne == KnownOne2) {
532 SDValue ANDC = TLO.DAG.getConstant(~KnownOne & NewMask, VT);
542 APInt Expanded =
C->getAPIntValue() | (~NewMask);
545 if (Expanded !=
C->getAPIntValue()) {
548 TLO.DAG.getConstant(Expanded, VT));
549 return TLO.CombineTo(Op, New);
553 }
else if (TLO.ShrinkDemandedConstant(Op, NewMask)) {
558 KnownZero = KnownZeroOut;
559 KnownOne = KnownOneOut;
563 KnownOne, TLO, Depth+1))
566 KnownOne2, TLO, Depth+1))
568 assert((KnownZero & KnownOne) == 0 &&
"Bits known to be one AND zero?");
569 assert((KnownZero2 & KnownOne2) == 0 &&
"Bits known to be one AND zero?");
572 if (TLO.ShrinkDemandedConstant(Op, NewMask))
576 KnownOne &= KnownOne2;
577 KnownZero &= KnownZero2;
581 KnownOne, TLO, Depth+1))
584 KnownOne2, TLO, Depth+1))
586 assert((KnownZero & KnownOne) == 0 &&
"Bits known to be one AND zero?");
587 assert((KnownZero2 & KnownOne2) == 0 &&
"Bits known to be one AND zero?");
590 if (TLO.ShrinkDemandedConstant(Op, NewMask))
594 KnownOne &= KnownOne2;
595 KnownZero &= KnownZero2;
599 unsigned ShAmt = SA->getZExtValue();
603 if (ShAmt >= BitWidth)
612 unsigned C1= cast<ConstantSDNode>(InOp.
getOperand(1))->getZExtValue();
623 return TLO.CombineTo(Op, TLO.DAG.
getNode(Opc, dl, VT,
629 KnownZero, KnownOne, TLO, Depth+1))
638 if (ShAmt < InnerBits && NewMask.lshr(InnerBits) == 0 &&
645 TLO.DAG.getConstant(ShAmt, ShTy));
660 uint64_t InnerShAmt = cast<ConstantSDNode>(InnerOp.
getOperand(1))
662 if (InnerShAmt < ShAmt &&
663 InnerShAmt < InnerBits &&
664 NewMask.lshr(InnerBits - InnerShAmt + ShAmt) == 0 &&
665 NewMask.trunc(ShAmt) == 0) {
667 TLO.DAG.getConstant(ShAmt - InnerShAmt,
678 KnownZero <<= SA->getZExtValue();
679 KnownOne <<= SA->getZExtValue();
687 unsigned ShAmt = SA->getZExtValue();
692 if (ShAmt >= BitWidth)
701 unsigned C1= cast<ConstantSDNode>(InOp.
getOperand(1))->getZExtValue();
711 return TLO.CombineTo(Op, TLO.DAG.
getNode(Opc, dl, VT,
718 KnownZero, KnownOne, TLO, Depth+1))
720 assert((KnownZero & KnownOne) == 0 &&
"Bits known to be one AND zero?");
721 KnownZero = KnownZero.lshr(ShAmt);
722 KnownOne = KnownOne.lshr(ShAmt);
725 KnownZero |= HighBits;
734 return TLO.CombineTo(Op,
740 unsigned ShAmt = SA->getZExtValue();
743 if (ShAmt >= BitWidth)
746 APInt InDemandedMask = (NewMask << ShAmt);
755 KnownZero, KnownOne, TLO, Depth+1))
757 assert((KnownZero & KnownOne) == 0 &&
"Bits known to be one AND zero?");
758 KnownZero = KnownZero.lshr(ShAmt);
759 KnownOne = KnownOne.lshr(ShAmt);
766 if (KnownZero.intersects(SignBit) || (HighBits & ~NewMask) == HighBits)
775 TLO.DAG.getConstant(BitWidth - 1 - Log2,
781 if (KnownOne.intersects(SignBit))
783 KnownOne |= HighBits;
791 if (MsbMask == DemandedMask) {
798 if (TLO.LegalTypes() && !ShiftAmtTy.
isVector())
801 SDValue ShiftAmt = TLO.DAG.getConstant(BitWidth - ShAmt, ShiftAmtTy);
813 if ((NewBits & NewMask) == 0)
818 APInt InputDemandedBits =
825 InputDemandedBits |= InSignBit;
828 KnownZero, KnownOne, TLO, Depth+1))
830 assert((KnownZero & KnownOne) == 0 &&
"Bits known to be one AND zero?");
836 if (KnownZero.intersects(InSignBit))
837 return TLO.CombineTo(Op,
838 TLO.DAG.getZeroExtendInReg(Op.
getOperand(0),dl,ExVT));
840 if (KnownOne.intersects(InSignBit)) {
842 KnownZero &= ~NewBits;
844 KnownZero &= ~NewBits;
845 KnownOne &= ~NewBits;
850 unsigned OperandBitWidth =
852 APInt InMask = NewMask.
trunc(OperandBitWidth);
863 KnownZero, KnownOne, TLO, Depth+1))
865 assert((KnownZero & KnownOne) == 0 &&
"Bits known to be one AND zero?");
866 KnownZero = KnownZero.zext(BitWidth);
867 KnownOne = KnownOne.zext(BitWidth);
868 KnownZero |= NewBits;
876 APInt NewBits = ~InMask & NewMask;
886 APInt InDemandedBits = InMask & NewMask;
887 InDemandedBits |= InSignBit;
888 InDemandedBits = InDemandedBits.
trunc(InBits);
891 KnownOne, TLO, Depth+1))
893 KnownZero = KnownZero.
zext(BitWidth);
894 KnownOne = KnownOne.
zext(BitWidth);
897 if (KnownZero.intersects(InSignBit))
903 if (KnownOne.intersects(InSignBit)) {
905 assert((KnownZero & NewBits) == 0);
907 assert((KnownOne & NewBits) == 0);
908 assert((KnownZero & NewBits) == 0);
913 unsigned OperandBitWidth =
915 APInt InMask = NewMask.
trunc(OperandBitWidth);
917 KnownZero, KnownOne, TLO, Depth+1))
919 assert((KnownZero & KnownOne) == 0 &&
"Bits known to be one AND zero?");
920 KnownZero = KnownZero.zext(BitWidth);
921 KnownOne = KnownOne.zext(BitWidth);
927 unsigned OperandBitWidth =
929 APInt TruncMask = NewMask.
zext(OperandBitWidth);
931 KnownZero, KnownOne, TLO, Depth+1))
933 KnownZero = KnownZero.
trunc(BitWidth);
934 KnownOne = KnownOne.
trunc(BitWidth);
945 if (TLO.LegalTypes() &&
954 if (TLO.LegalTypes()) {
961 OperandBitWidth - BitWidth);
964 if (ShAmt->
getZExtValue() < BitWidth && !(HighBits & NewMask)) {
979 assert((KnownZero & KnownOne) == 0 &&
"Bits known to be one AND zero?");
989 KnownZero, KnownOne, TLO, Depth+1))
991 assert((KnownZero & KnownOne) == 0 &&
"Bits known to be one AND zero?");
993 KnownZero |= ~InMask & NewMask;
999 if (!TLO.LegalOperations() &&
1012 if (!OpVTLegal && OpVTSizeInBits > 32)
1028 BitWidth - NewMask.countLeadingZeros());
1030 KnownOne2, TLO, Depth+1))
1033 KnownOne2, TLO, Depth+1))
1036 if (TLO.ShrinkDemandedOp(Op, BitWidth, NewMask, dl))
1042 TLO.DAG.ComputeMaskedBits(Op, KnownZero, KnownOne, Depth);
1048 if ((NewMask & (KnownZero|KnownOne)) == NewMask)
1061 unsigned Depth)
const {
1066 "Should use MaskedValueIsZero if you don't know whether Op"
1067 " is a target node!");
1075 unsigned Depth)
const {
1080 "Should use ComputeNumSignBits if you don't know whether Op"
1081 " is a target node!");
1095 if (
C->getAPIntValue() == 1)
1103 if (
C->getAPIntValue().isSignBit())
1112 APInt KnownZero, KnownOne;
1142 if (isa<ConstantSDNode>(N0.
getNode()) &&
1145 return DAG.
getSetCC(dl, VT, N1, N0, SwappedCC);
1148 const APInt &C1 = N1C->getAPIntValue();
1157 = cast<ConstantSDNode>(N0.
getOperand(1))->getAPIntValue();
1206 MinBits = N0->getOperand(0).getValueSizeInBits();
1208 }
else if (N0->getOpcode() ==
ISD::AND) {
1211 if ((
C->getAPIntValue()+1).isPowerOf2()) {
1212 MinBits =
C->getAPIntValue().countTrailingOnes();
1215 }
else if (
LoadSDNode *LN0 = dyn_cast<LoadSDNode>(N0)) {
1218 MinBits = LN0->getMemoryVT().getSizeInBits();
1225 MinBits < C1.getBitWidth() && MinBits >= C1.getActiveBits()) {
1231 return DAG.
getSetCC(dl, VT, Trunc, C, Cond);
1241 N0.getOpcode() ==
ISD::AND && C1 == 0 &&
1242 N0.getNode()->hasOneUse() &&
1243 isa<LoadSDNode>(N0.getOperand(0)) &&
1244 N0.getOperand(0).getNode()->hasOneUse() &&
1245 isa<ConstantSDNode>(N0.getOperand(1))) {
1246 LoadSDNode *Lod = cast<LoadSDNode>(N0.getOperand(0));
1248 unsigned bestWidth = 0, bestOffset = 0;
1250 unsigned origWidth = N0.getValueType().getSizeInBits();
1251 unsigned maskWidth = origWidth;
1257 cast<ConstantSDNode>(N0.getOperand(1))->getAPIntValue();
1258 for (
unsigned width = origWidth / 2; width>=8; width /= 2) {
1260 for (
unsigned offset=0; offset<origWidth/width; offset++) {
1261 if ((newMask & Mask) == Mask) {
1263 bestOffset = (origWidth/width - offset - 1) * (width/8);
1265 bestOffset = (uint64_t)offset * (width/8);
1266 bestMask = Mask.lshr(offset * (width/8) * 8);
1270 newMask = newMask << width;
1279 if (bestOffset != 0)
1285 false,
false,
false, NewAlign);
1302 C1.getBitWidth() - InSize))) {
1331 EVT newVT = N0.getOperand(0).getValueType();
1335 return DAG.
getSetCC(dl, VT, N0.getOperand(0),
1345 EVT ExtSrcTy = cast<VTSDNode>(N0.getOperand(1))->getVT();
1347 EVT ExtDstTy = N0.getValueType();
1352 if (C1.getMinSignedBits() > ExtSrcTyBits)
1356 EVT Op0Ty = N0.getOperand(0).getValueType();
1357 if (Op0Ty == ExtSrcTy) {
1367 return DAG.
getSetCC(dl, VT, ZextOp,
1373 }
else if ((N1C->isNullValue() || N1C->getAPIntValue() == 1) &&
1378 bool TrueWhenTrue = (Cond ==
ISD::SETEQ) ^ (N1C->getAPIntValue() != 1);
1382 ISD::CondCode CC = cast<CondCodeSDNode>(N0.getOperand(2))->
get();
1384 N0.getOperand(0).getValueType().isInteger());
1387 return DAG.
getSetCC(dl, VT, N0.getOperand(0), N0.getOperand(1), CC);
1392 N0.getOperand(0).getOpcode() ==
ISD::XOR &&
1393 N0.getOperand(1) == N0.getOperand(0).getOperand(1))) &&
1394 isa<ConstantSDNode>(N0.getOperand(1)) &&
1395 cast<ConstantSDNode>(N0.getOperand(1))->getAPIntValue() == 1) {
1407 assert(N0.getOpcode() ==
ISD::AND &&
1408 N0.getOperand(0).getOpcode() ==
ISD::XOR);
1411 N0.getOperand(0).getOperand(0),
1415 return DAG.
getSetCC(dl, VT, Val, N1,
1418 }
else if (N1C->getAPIntValue() == 1 &&
1435 cast<ConstantSDNode>(Op0.
getOperand(1))->getAPIntValue() == 1) {
1458 APInt MinVal, MaxVal;
1459 unsigned OperandBitSize = N1C->getValueType(0).getSizeInBits();
1533 (VT == N0.getValueType() ||
1537 dyn_cast<ConstantSDNode>(N0.getOperand(1))) {
1542 if (AndRHS->getAPIntValue().isPowerOf2()) {
1545 DAG.
getConstant(AndRHS->getAPIntValue().logBase2(), ShiftTy)));
1547 }
else if (Cond ==
ISD::SETEQ && C1 == AndRHS->getAPIntValue()) {
1550 if (C1.isPowerOf2()) {
1558 if (C1.getMinSignedBits() <= 64 &&
1562 N0.getOpcode() ==
ISD::AND && N0.hasOneUse()) {
1564 dyn_cast<ConstantSDNode>(N0.getOperand(1))) {
1565 const APInt &AndRHSC = AndRHS->getAPIntValue();
1566 if ((-AndRHSC).isPowerOf2() && (AndRHSC & C1) == C1) {
1570 EVT CmpTy = N0.getValueType();
1574 return DAG.
getSetCC(dl, VT, Shift, CmpRHS, Cond);
1588 ShiftBits = C1.countTrailingOnes();
1592 ShiftBits = C1.countTrailingZeros();
1594 NewC = NewC.
lshr(ShiftBits);
1598 EVT CmpTy = N0.getValueType();
1602 return DAG.
getSetCC(dl, VT, Shift, CmpRHS, NewCond);
1608 if (isa<ConstantFPSDNode>(N0.
getNode())) {
1615 if (CFP->getValueAPF().isNaN()) {
1633 return DAG.
getSetCC(dl, VT, N0, N0, Cond);
1641 if (CFP->getValueAPF().isInfinity()) {
1642 if (CFP->getValueAPF().isNegative()) {
1701 return DAG.
getSetCC(dl, VT, N0, N1, NewCond);
1727 bool LegalRHSImm =
false;
1735 LHSR->getAPIntValue(),
1747 RHSC->getAPIntValue(),
1758 RHSC->getAPIntValue(),
1765 if (RHSC->getValueType(0).getSizeInBits() <= 64)
1827 return DAG.
getSetCC(dl, VT, N0, Zero, Cond);
1838 return DAG.
getSetCC(dl, VT, N1, Zero, Cond);
1901 int64_t &Offset)
const {
1902 if (isa<GlobalAddressSDNode>(N)) {
1944 unsigned S = Constraint.size();
1947 switch (Constraint[0]) {
1975 if (S > 1 && Constraint[0] ==
'{' && Constraint[S-1] ==
'}') {
1976 if (S == 8 && !Constraint.compare(1, 6,
"memory", 6))
1997 std::string &Constraint,
1998 std::vector<SDValue> &Ops,
2001 if (Constraint.length() > 1)
return;
2003 char ConstraintLetter = Constraint[0];
2004 switch (ConstraintLetter) {
2025 if (C == 0 || GA == 0) {
2029 if (C == 0 || GA == 0)
2036 if (ConstraintLetter !=
'n') {
2037 int64_t Offs = GA->getOffset();
2040 C ?
SDLoc(C) : SDLoc(),
2047 if (ConstraintLetter !=
's') {
2064 if (Constraint.empty() || Constraint[0] !=
'{')
2065 return std::make_pair(0u, static_cast<TargetRegisterClass*>(0));
2066 assert(*(Constraint.end()-1) ==
'}' &&
"Not a brace enclosed constraint?");
2069 StringRef RegName(Constraint.data()+1, Constraint.size()-2);
2071 std::pair<unsigned, const TargetRegisterClass*> R =
2072 std::make_pair(0u, static_cast<const TargetRegisterClass*>(0));
2087 if (RegName.equals_lower(RI->
getName(*
I))) {
2088 std::pair<unsigned, const TargetRegisterClass*> S =
2089 std::make_pair(*
I, RC);
2111 assert(!ConstraintCode.empty() &&
"No known constraint!");
2112 return isdigit(static_cast<unsigned char>(ConstraintCode[0]));
2118 assert(!ConstraintCode.empty() &&
"No known constraint!");
2119 return atoi(ConstraintCode.c_str());
2133 unsigned maCount = 0;
2143 for (
unsigned i = 0, e = ConstraintInfos.size(); i != e; ++i) {
2144 ConstraintOperands.push_back(
AsmOperandInfo(ConstraintInfos[i]));
2154 switch (OpInfo.
Type) {
2169 assert(ResNo == 0 &&
"Asm only has one result!");
2192 if (
StructType *STy = dyn_cast<StructType>(OpTy))
2193 if (STy->getNumElements() == 1)
2194 OpTy = STy->getElementType(0);
2212 }
else if (
PointerType *PT = dyn_cast<PointerType>(OpTy)) {
2223 if (ConstraintInfos.size()) {
2225 unsigned bestMAIndex = 0;
2226 int bestWeight = -1;
2232 for (maIndex = 0; maIndex < maCount; ++maIndex) {
2234 for (
unsigned cIndex = 0, eIndex = ConstraintOperands.size();
2235 cIndex != eIndex; ++cIndex) {
2261 weightSum += weight;
2264 if (weightSum > bestWeight) {
2265 bestWeight = weightSum;
2266 bestMAIndex = maIndex;
2271 for (
unsigned cIndex = 0, eIndex = ConstraintOperands.size();
2272 cIndex != eIndex; ++cIndex) {
2282 for (
unsigned cIndex = 0, eIndex = ConstraintOperands.size();
2283 cIndex != eIndex; ++cIndex) {
2294 std::pair<unsigned, const TargetRegisterClass*> MatchRC =
2297 std::pair<unsigned, const TargetRegisterClass*> InputRC =
2302 (MatchRC.second != InputRC.second)) {
2304 " with a matching output constraint of"
2305 " incompatible type!");
2312 return ConstraintOperands;
2341 rCodes = &info.
Codes;
2347 for (
unsigned i = 0, e = rCodes->size(); i != e; ++i) {
2350 if (weight > BestWeight)
2351 BestWeight = weight;
2367 if (CallOperandVal == NULL)
2370 switch (*constraint) {
2373 if (isa<ConstantInt>(CallOperandVal))
2377 if (isa<GlobalValue>(CallOperandVal))
2382 if (isa<ConstantFP>(CallOperandVal))
2429 assert(OpInfo.
Codes.size() > 1 &&
"Doesn't have multiple constraint options");
2430 unsigned BestIdx = 0;
2432 int BestGenerality = -1;
2435 for (
unsigned i = 0, e = OpInfo.
Codes.size(); i != e; ++i) {
2444 assert(OpInfo.
Codes[i].size() == 1 &&
2445 "Unhandled multi-letter 'other' constraint");
2446 std::vector<SDValue> ResultOps;
2449 if (!ResultOps.empty()) {
2463 if (Generality > BestGenerality) {
2466 BestGenerality = Generality;
2480 assert(!OpInfo.
Codes.empty() &&
"Must have at least one constraint");
2483 if (OpInfo.
Codes.size() == 1) {
2496 if (isa<BasicBlock>(v) || isa<ConstantInt>(v) || isa<Function>(v)) {
2516 assert(d != 0 &&
"Division by zero!");
2519 unsigned ShAmt = d.countTrailingZeros();
2529 while ((t = d*xn) != 1)
2530 xn *=
APInt(d.getBitWidth(), 2) - t;
2542 std::vector<SDNode*> *Created)
const {
2572 Created->push_back(Q.
getNode());
2578 Created->push_back(Q.
getNode());
2585 Created->push_back(Q.
getNode());
2592 Created->push_back(T.
getNode());
2602 std::vector<SDNode*> *Created)
const {
2613 const APInt &N1C = cast<ConstantSDNode>(N->
getOperand(1))->getAPIntValue();
2620 if (magics.
a != 0 && !N1C[0]) {
2625 Created->push_back(Q.
getNode());
2629 assert(magics.
a == 0 &&
"Should use cheap fixup now");
2644 Created->push_back(Q.
getNode());
2646 if (magics.
a == 0) {
2648 "We shouldn't generate an undefined shift!");
2654 Created->push_back(NPQ.
getNode());
2658 Created->push_back(NPQ.
getNode());
2661 Created->push_back(NPQ.
getNode());
MVT getSimpleValueType() const
Return the simple ValueType of the referenced return value.
static MVT getIntegerVT(unsigned BitWidth)
unsigned Log2_32_Ceil(uint32_t Value)
SDValue getConstant(uint64_t Val, EVT VT, bool isTarget=false)
CallingConv::ID getLibcallCallingConv(RTLIB::Libcall Call) const
Get the CallingConv that should be used for the specified libcall.
mu magicu(unsigned LeadingZeros=0) const
static APInt getSignBit(unsigned BitWidth)
Get the SignBit for a specific bit width.
static APInt getAllOnesValue(unsigned numBits)
Get the all-ones value.
LLVMContext * getContext() const
Sign extended before/after call.
Force argument to be passed in register.
bool ShrinkDemandedConstant(SDValue Op, const APInt &Demanded)
const TargetMachine & getTargetMachine() const
virtual void ComputeConstraintToUse(AsmOperandInfo &OpInfo, SDValue Op, SelectionDAG *DAG=0) const
bool isCalledByLegalizer() const
enable_if_c<!is_simple_type< Y >::value, typename cast_retty< X, const Y >::ret_type >::type dyn_cast(const Y &Val)
Nested function static chain.
virtual ConstraintType getConstraintType(const std::string &Constraint) const
Given a constraint, return the type of constraint it is for this target.
static APInt getLowBitsSet(unsigned numBits, unsigned loBitsSet)
Get a value with low bits set.
const GlobalValue * getGlobal() const
unsigned getOpcode() const
Type * getTypeForEVT(LLVMContext &Context) const
unsigned getSizeInBits() const
bool isUnindexed() const
isUnindexed - Return true if this is NOT a pre/post inc/dec load/store.
bool ShrinkDemandedOp(SDValue Op, unsigned BitWidth, const APInt &Demanded, SDLoc dl)
regclass_iterator regclass_end() const
virtual bool isLegalICmpImmediate(int64_t) const
unsigned getNumOperands() const
unsigned getValueSizeInBits() const
virtual bool isZExtFree(Type *, Type *) const
const SDValue & getOperand(unsigned Num) const
const Function * getFunction() const
static bool isCommutativeBinOp(unsigned Opcode)
void ComputeMaskedBits(SDValue Op, APInt &KnownZero, APInt &KnownOne, unsigned Depth=0) const
virtual unsigned ComputeNumSignBitsForTargetNode(SDValue Op, unsigned Depth=0) const
bool hasAttribute(unsigned Index, Attribute::AttrKind Kind) const
Return true if the attribute exists at the given index.
const MCPhysReg * iterator
bool isTrueWhenEqual(CondCode Cond)
const SDValue & getBasePtr() const
Magic data for optimising unsigned division by a constant.
virtual bool isTypeDesirableForOp(unsigned, EVT VT) const
static APInt getSignedMaxValue(unsigned numBits)
Gets maximum signed value of APInt for a specific bit width.
bool bitsLT(EVT VT) const
bitsLT - Return true if this has less bits than VT.
bool SimplifyDemandedBits(SDValue Op, const APInt &DemandedMask, APInt &KnownZero, APInt &KnownOne, TargetLoweringOpt &TLO, unsigned Depth=0) const
ValTy * getArgument(unsigned ArgNo) const
LLVM_ATTRIBUTE_NORETURN void report_fatal_error(const char *reason, bool gen_crash_diag=true)
SDValue getExternalSymbol(const char *Sym, EVT VT)
ConstraintCodeVector Codes
bool isSingleValueType() const
bool isNegative() const
Determine sign of this APInt.
SDValue getLoad(EVT VT, SDLoc dl, SDValue Chain, SDValue Ptr, MachinePointerInfo PtrInfo, bool isVolatile, bool isNonTemporal, bool isInvariant, unsigned Alignment, const MDNode *TBAAInfo=0, const MDNode *Ranges=0)
bool isVector() const
isVector - Return true if this is a vector value type.
virtual const char * LowerXConstraint(EVT ConstraintVT) const
EVT getShiftAmountTy(EVT LHSTy) const
void setAttributes(ImmutableCallSite *CS, unsigned AttrIdx)
Set CallLoweringInfo attribute flags based on a call instruction and called function attributes...
bool isLittleEndian() const
virtual const char * getTargetNodeName(unsigned Opcode) const
This method returns the name of a target specific DAG node.
bool isRound() const
isRound - Return true if the size is a power-of-two number of bytes.
virtual SDValue PerformDAGCombine(SDNode *N, DAGCombinerInfo &DCI) const
int64_t getOffset() const
#define llvm_unreachable(msg)
EVT getValueType(unsigned ResNo) const
MachineFunction & getMachineFunction() const
std::pair< SDValue, SDValue > makeLibCall(SelectionDAG &DAG, RTLIB::Libcall LC, EVT RetVT, const SDValue *Ops, unsigned NumOps, bool isSigned, SDLoc dl, bool doesNotReturn=false, bool isReturnValueUsed=true) const
Returns a pair of (return value, chain).
TargetLowering::ConstraintType ConstraintType
APInt LLVM_ATTRIBUTE_UNUSED_RESULT lshr(unsigned shiftAmt) const
Logical right-shift function.
virtual EVT getSetCCResultType(LLVMContext &Context, EVT VT) const
SDValue getTargetGlobalAddress(const GlobalValue *GV, SDLoc DL, EVT VT, int64_t offset=0, unsigned char TargetFlags=0)
MachinePointerInfo getWithOffset(int64_t O) const
EVT getScalarType() const
SDVTList getVTList(EVT VT)
virtual MVT getPointerTy(uint32_t=0) const
SDValue SimplifySetCC(EVT VT, SDValue N0, SDValue N1, ISD::CondCode Cond, bool foldBooleans, DAGCombinerInfo &DCI, SDLoc dl) const
Hidden pointer to structure to return.
bool isInteger() const
isInteger - Return true if this is an integer, or a vector integer type.
int atoi(const char *str);
MVT getSimpleValueType(Type *Ty, bool AllowUnknown=false) const
Return the MVT corresponding to this LLVM type. See getValueType.
virtual bool isUsedByReturnOnly(SDNode *, SDValue &) const
LLVMContext & getContext() const
getContext - Return the LLVMContext in which this type was uniqued.
std::pair< SDValue, SDValue > LowerCallTo(CallLoweringInfo &CLI) const
unsigned getNumValues() const
This contains information for each constraint that we are lowering.
Simple integer binary arithmetic operators.
signed char MatchingInput
SDValue getUNDEF(EVT VT)
getUNDEF - Return an UNDEF node. UNDEF does not have a useful SDLoc.
virtual std::pair< unsigned, const TargetRegisterClass * > getRegForInlineAsmConstraint(const std::string &Constraint, MVT VT) const
ValTy * getCalledValue() const
const APInt & getAPIntValue() const
uint16_t getParamAlignment(uint16_t i) const
Extract the alignment for a call or parameter (0=unknown).
EVT getMemoryVT() const
getMemoryVT - Return the type of the in-memory value.
SDValue BuildSDIV(SDNode *N, SelectionDAG &DAG, bool IsAfterLegalization, std::vector< SDNode * > *Created) const
Given an ISD::SDIV node expressing a divide by constant, return a DAG expression to select that will ...
bool isSignedIntSetCC(CondCode Code)
Type * getElementType() const
Considered to not alias after call.
bool bitsLE(EVT VT) const
bitsLE - Return true if this has no more bits than VT.
bool isLegalRC(const TargetRegisterClass *RC) const
UNDEF - An undefined node.
static const MCSymbolRefExpr * Create(const MCSymbol *Symbol, MCContext &Ctx)
static bool isWeakForLinker(LinkageTypes Linkage)
static APInt getHighBitsSet(unsigned numBits, unsigned hiBitsSet)
Get a value with high bits set.
SDNode * getNode() const
get the SDNode which holds the desired result
bool isTypeLegal(EVT VT) const
bool isMatchingInputConstraint() const
bool isInteger() const
isInteger - Return true if this is an integer, or a vector integer type.
bool intersects(const APInt &RHS) const
regclass_iterator regclass_begin() const
APInt LLVM_ATTRIBUTE_UNUSED_RESULT trunc(unsigned width) const
Truncate to new width.
const SDValue & getOperand(unsigned i) const
bool isOperationLegalOrCustom(unsigned Op, EVT VT) const
static bool ValueHasExactlyOneBitSet(SDValue Val, const SelectionDAG &DAG)
int64_t getSExtValue() const
Get sign extended value.
unsigned getMatchedOperand() const
bool isBeforeLegalizeOps() const
bool isOperationLegal(unsigned Op, EVT VT) const
Return true if the specified operation is legal on this target.
static void ChooseConstraint(TargetLowering::AsmOperandInfo &OpInfo, const TargetLowering &TLI, SDValue Op, SelectionDAG *DAG)
Return value is always equal to this argument.
void AddToWorklist(SDNode *N)
SubConstraintInfoVector multipleAlternatives
virtual bool isTruncateFree(Type *, Type *) const
const DataLayout * getDataLayout() const
bool isBeforeLegalize() const
unsigned getBitWidth() const
Return the number of bits in the APInt.
bool CombineTo(SDValue O, SDValue N)
unsigned getOpcode() const
for(unsigned i=0, e=MI->getNumOperands();i!=e;++i)
Zero extended before/after call.
virtual void computeMaskedBitsForTargetNode(const SDValue Op, APInt &KnownZero, APInt &KnownOne, const SelectionDAG &DAG, unsigned Depth=0) const
unsigned getUnorderedFlavor(CondCode Cond)
CondCode getSetCCSwappedOperands(CondCode Operation)
static MVT getVT(Type *Ty, bool HandleUnknown=false)
unsigned countPopulation() const
Count the number of bits set.
bool MaskedValueIsZero(SDValue Op, const APInt &Mask, unsigned Depth=0) const
bool isIntN(unsigned N, int64_t x)
uint64_t NextPowerOf2(uint64_t A)
std::vector< ArgListEntry > ArgListTy
std::string ConstraintCode
virtual SDValue getPICJumpTableRelocBase(SDValue Table, SelectionDAG &DAG) const
Returns relocation base for the given PIC jumptable.
const MachinePointerInfo & getPointerInfo() const
ISD::CondCode getCmpLibcallCC(RTLIB::Libcall Call) const
bool bitsGT(EVT VT) const
bitsGT - Return true if this has more bits than VT.
unsigned countTrailingZeros() const
Count the number of trailing zero bits.
std::vector< AsmOperandInfo > AsmOperandInfoVector
static IntegerType * get(LLVMContext &C, unsigned NumBits)
Get or create an IntegerType instance.
std::vector< std::string > ConstraintCodeVector
SDValue getNOT(SDLoc DL, SDValue Val, EVT VT)
getNOT - Create a bitwise NOT operation as (XOR Val, -1).
SmallVectorImpl< T >::const_pointer c_str(SmallVectorImpl< T > &str)
virtual unsigned getJumpTableEncoding() const
const char * getLibcallName(RTLIB::Libcall Call) const
Get the libcall routine name for the specified libcall.
BooleanContent getBooleanContents(bool isVec) const
const SDValue & getChain() const
bool hasMatchingInput() const
bool isStrictlyPositive() const
Determine if this APInt Value is positive.
static APInt getMinValue(unsigned numBits)
Gets minimum unsigned value of APInt for a specific bit width.
virtual const MCExpr * getPICJumpTableRelocBaseExpr(const MachineFunction *MF, unsigned JTI, MCContext &Ctx) const
virtual bool isGAPlusOffset(SDNode *N, const GlobalValue *&GA, int64_t &Offset) const
int32_t exactLogBase2() const
CondCode getSetCCInverse(CondCode Operation, bool isInteger)
bool isInTailCallPosition(SelectionDAG &DAG, SDNode *Node, SDValue &Chain) const
unsigned Log2_32(uint32_t Value)
AttributeSet getAttributes() const
Return the attribute list for this Function.
MCSymbol * getJTISymbol(unsigned JTI, MCContext &Ctx, bool isLinkerPrivate=false) const
ISD::LoadExtType getExtensionType() const
Class for arbitrary precision integers.
int64_t getSExtValue() const
ZERO_EXTEND - Used for integer types, zeroing the new bits.
SDValue getNode(unsigned Opcode, SDLoc DL, EVT VT)
ANY_EXTEND - Used for integer types. The high bits are undefined.
static APInt getMaxValue(unsigned numBits)
Gets maximum unsigned value of APInt for specific bit width.
APInt And(const APInt &LHS, const APInt &RHS)
Bitwise AND function for APInt.
static APInt getBitsSet(unsigned numBits, unsigned loBit, unsigned hiBit)
Get a value with a block of bits set.
virtual MVT::SimpleValueType getCmpLibcallReturnType() const
bool isAllOnesValue() const
Determine if all bits are set.
uint64_t MinAlign(uint64_t A, uint64_t B)
Magic data for optimising signed division by a constant.
Bitwise operators - logical and, logical or, logical xor.
SDValue BuildExactSDIV(SDValue Op1, SDValue Op2, SDLoc dl, SelectionDAG &DAG) const
Given an exact SDIV by a constant, create a multiplication with the multiplicative inverse of the con...
virtual void LowerAsmOperandForConstraint(SDValue Op, std::string &Constraint, std::vector< SDValue > &Ops, SelectionDAG &DAG) const
bool isDeclaration() const
ImmutableCallSite - establish a view to a call site for examination.
unsigned getSizeInBits() const
getSizeInBits - Return the size of the specified value type in bits.
unsigned getPointerSizeInBits(unsigned AS=0) const
bool paramHasAttr(unsigned i, Attribute::AttrKind A) const
Return true if the call or the callee has the given attribute.
virtual const TargetRegisterInfo * getRegisterInfo() const
bool hasType(EVT vt) const
SDValue FoldSetCC(EVT VT, SDValue N1, SDValue N2, ISD::CondCode Cond, SDLoc dl)
FoldSetCC - Constant fold a setcc to true or false.
static unsigned getConstraintGenerality(TargetLowering::ConstraintType CT)
SDValue getCondCode(ISD::CondCode Cond)
virtual AsmOperandInfoVector ParseConstraints(ImmutableCallSite CS) const
SDValue getGLOBAL_OFFSET_TABLE(EVT VT)
bool isFloatingPoint() const
isFloatingPoint - Return true if this is a FP, or a vector FP type.
static APInt getSignedMinValue(unsigned numBits)
Gets minimum signed value of APInt for a specific bit width.
LLVM Value Representation.
SDValue BuildUDIV(SDNode *N, SelectionDAG &DAG, bool IsAfterLegalization, std::vector< SDNode * > *Created) const
Given an ISD::UDIV node expressing a divide by constant, return a DAG expression to select that will ...
virtual ConstraintWeight getMultipleConstraintMatchWeight(AsmOperandInfo &info, int maIndex) const
uint64_t getTypeSizeInBits(Type *Ty) const
unsigned countLeadingZeros() const
The APInt version of the countLeadingZeros functions in MathExtras.h.
const char * getName(unsigned RegNo) const
Return the human-readable symbolic target-specific name for the specified physical register...
bool isPowerOf2_32(uint32_t Value)
APInt LLVM_ATTRIBUTE_UNUSED_RESULT zext(unsigned width) const
Zero extend to a new width.
virtual bool isOffsetFoldingLegal(const GlobalAddressSDNode *GA) const
SDValue getTargetConstant(uint64_t Val, EVT VT)
MVT ConstraintVT
The ValueType for the operand value.
SDValue getSetCC(SDLoc DL, EVT VT, SDValue LHS, SDValue RHS, ISD::CondCode Cond)
BooleanContent
Enum that describes how the target represents true/false values.
SDValue getEntryNode() const
TRUNCATE - Completely drop the high bits.
unsigned getAlignment() const
bool isCondCodeLegal(ISD::CondCode CC, MVT VT) const
Return true if the specified condition code is legal on this target.
virtual ConstraintWeight getSingleConstraintMatchWeight(AsmOperandInfo &info, const char *constraint) const
static EVT getIntegerVT(LLVMContext &Context, unsigned BitWidth)
std::vector< ConstraintInfo > ConstraintInfoVector
static RegisterPass< NVPTXAllocaHoisting > X("alloca-hoisting","Hoisting alloca instructions in non-entry ""blocks to the entry block")
const TargetRegisterClass *const * regclass_iterator
LegalizeAction getCondCodeAction(ISD::CondCode CC, MVT VT) const
static ConstraintInfoVector ParseConstraints(StringRef ConstraintString)
bool isVoidTy() const
isVoidTy - Return true if this is 'void'.
void selectAlternative(unsigned index)
uint64_t getZExtValue() const
void softenSetCCOperands(SelectionDAG &DAG, EVT VT, SDValue &NewLHS, SDValue &NewRHS, ISD::CondCode &CCCode, SDLoc DL) const