100 #define DEBUG_TYPE "ppc-lowering"
106 cl::desc(
"disable setting the node scheduling preference to ILP on PPC"),
cl::Hidden);
114 STATISTIC(NumTailCalls,
"Number of tail calls");
115 STATISTIC(NumSiblingCalls,
"Number of sibling calls");
129 bool isPPC64 = Subtarget.
isPPC64();
170 if (isPPC64 || Subtarget.
hasFPCVT()) {
1070 unsigned MaxMaxAlign) {
1071 if (MaxAlign == MaxMaxAlign)
1073 if (
VectorType *VTy = dyn_cast<VectorType>(Ty)) {
1074 if (MaxMaxAlign >= 32 && VTy->getBitWidth() >= 256)
1076 else if (VTy->getBitWidth() >= 128 && MaxAlign < 16)
1078 }
else if (
ArrayType *ATy = dyn_cast<ArrayType>(Ty)) {
1079 unsigned EltAlign = 0;
1081 if (EltAlign > MaxAlign)
1082 MaxAlign = EltAlign;
1083 }
else if (
StructType *STy = dyn_cast<StructType>(Ty)) {
1084 for (
auto *EltTy : STy->elements()) {
1085 unsigned EltAlign = 0;
1087 if (EltAlign > MaxAlign)
1088 MaxAlign = EltAlign;
1089 if (MaxAlign == MaxMaxAlign)
1241 return CFP->getValueAPF().isZero();
1245 if (
const ConstantFP *CFP = dyn_cast<ConstantFP>(
CP->getConstVal()))
1246 return CFP->getValueAPF().isZero();
1254 return Op < 0 || Op == Val;
1266 if (ShuffleKind == 0) {
1269 for (
unsigned i = 0; i != 16; ++i)
1272 }
else if (ShuffleKind == 2) {
1275 for (
unsigned i = 0; i != 16; ++i)
1278 }
else if (ShuffleKind == 1) {
1279 unsigned j = IsLE ? 0 : 1;
1280 for (
unsigned i = 0; i != 8; ++i)
1297 if (ShuffleKind == 0) {
1300 for (
unsigned i = 0; i != 16; i += 2)
1304 }
else if (ShuffleKind == 2) {
1307 for (
unsigned i = 0; i != 16; i += 2)
1311 }
else if (ShuffleKind == 1) {
1312 unsigned j = IsLE ? 0 : 2;
1313 for (
unsigned i = 0; i != 8; i += 2)
1339 if (ShuffleKind == 0) {
1342 for (
unsigned i = 0; i != 16; i += 4)
1348 }
else if (ShuffleKind == 2) {
1351 for (
unsigned i = 0; i != 16; i += 4)
1357 }
else if (ShuffleKind == 1) {
1358 unsigned j = IsLE ? 0 : 4;
1359 for (
unsigned i = 0; i != 8; i += 4)
1376 unsigned LHSStart,
unsigned RHSStart) {
1379 assert((UnitSize == 1 || UnitSize == 2 || UnitSize == 4) &&
1380 "Unsupported merge size!");
1382 for (
unsigned i = 0; i != 8/UnitSize; ++i)
1383 for (
unsigned j = 0; j != UnitSize; ++j) {
1385 LHSStart+j+i*UnitSize) ||
1387 RHSStart+j+i*UnitSize))
1402 if (ShuffleKind == 1)
1403 return isVMerge(N, UnitSize, 0, 0);
1404 else if (ShuffleKind == 2)
1405 return isVMerge(N, UnitSize, 0, 16);
1409 if (ShuffleKind == 1)
1410 return isVMerge(N, UnitSize, 8, 8);
1411 else if (ShuffleKind == 0)
1412 return isVMerge(N, UnitSize, 8, 24);
1427 if (ShuffleKind == 1)
1428 return isVMerge(N, UnitSize, 8, 8);
1429 else if (ShuffleKind == 2)
1430 return isVMerge(N, UnitSize, 8, 24);
1434 if (ShuffleKind == 1)
1435 return isVMerge(N, UnitSize, 0, 0);
1436 else if (ShuffleKind == 0)
1437 return isVMerge(N, UnitSize, 0, 16);
1486 unsigned RHSStartValue) {
1490 for (
unsigned i = 0; i < 2; ++i)
1491 for (
unsigned j = 0; j < 4; ++j)
1493 i*RHSStartValue+j+IndexOffset) ||
1495 i*RHSStartValue+j+IndexOffset+8))
1517 unsigned indexOffset = CheckEven ? 4 : 0;
1518 if (ShuffleKind == 1)
1519 return isVMerge(N, indexOffset, 0);
1520 else if (ShuffleKind == 2)
1521 return isVMerge(N, indexOffset, 16);
1526 unsigned indexOffset = CheckEven ? 0 : 4;
1527 if (ShuffleKind == 1)
1528 return isVMerge(N, indexOffset, 0);
1529 else if (ShuffleKind == 0)
1530 return isVMerge(N, indexOffset, 16);
1552 for (i = 0; i != 16 && SVOp->
getMaskElt(i) < 0; ++i)
1555 if (i == 16)
return -1;
1560 if (ShiftAmt < i)
return -1;
1565 if ((ShuffleKind == 0 && !isLE) || (ShuffleKind == 2 && isLE)) {
1567 for (++i; i != 16; ++i)
1570 }
else if (ShuffleKind == 1) {
1572 for (++i; i != 16; ++i)
1579 ShiftAmt = 16 - ShiftAmt;
1589 (EltSize == 1 || EltSize == 2 || EltSize == 4));
1601 if (ElementBase >= 16)
1606 for (
unsigned i = 1; i != EltSize; ++i)
1610 for (
unsigned i = EltSize, e = 16; i != e; i += EltSize) {
1612 for (
unsigned j = 0; j != EltSize; ++j)
1630 assert((Width == 2 || Width == 4 || Width == 8 || Width == 16) &&
1631 "Unexpected element width.");
1632 assert((StepLen == 1 || StepLen == -1) &&
"Unexpected element width.");
1634 unsigned NumOfElem = 16 / Width;
1635 unsigned MaskVal[16];
1636 for (
unsigned i = 0; i < NumOfElem; ++i) {
1638 if ((StepLen == 1) && (MaskVal[0] % Width)) {
1640 }
else if ((StepLen == -1) && ((MaskVal[0] + 1) % Width)) {
1644 for (
unsigned int j = 1; j < Width; ++j) {
1646 if (MaskVal[j] != MaskVal[j-1] + StepLen) {
1656 unsigned &InsertAtByte,
bool &Swap,
bool IsLE) {
1665 unsigned LittleEndianShifts[] = { 2, 1, 0, 3 };
1666 unsigned BigEndianShifts[] = { 3, 0, 1, 2 };
1671 if ((M0 > 3 && M1 == 1 && M2 == 2 && M3 == 3) ||
1672 (M0 < 4 && M1 == 5 && M2 == 6 && M3 == 7)) {
1673 ShiftElts = IsLE ? LittleEndianShifts[M0 & 0x3] : BigEndianShifts[M0 & 0x3];
1674 InsertAtByte = IsLE ? 12 : 0;
1679 if ((M1 > 3 && M0 == 0 && M2 == 2 && M3 == 3) ||
1680 (M1 < 4 && M0 == 4 && M2 == 6 && M3 == 7)) {
1681 ShiftElts = IsLE ? LittleEndianShifts[M1 & 0x3] : BigEndianShifts[M1 & 0x3];
1682 InsertAtByte = IsLE ? 8 : 4;
1687 if ((M2 > 3 && M0 == 0 && M1 == 1 && M3 == 3) ||
1688 (M2 < 4 && M0 == 4 && M1 == 5 && M3 == 7)) {
1689 ShiftElts = IsLE ? LittleEndianShifts[M2 & 0x3] : BigEndianShifts[M2 & 0x3];
1690 InsertAtByte = IsLE ? 4 : 8;
1695 if ((M3 > 3 && M0 == 0 && M1 == 1 && M2 == 2) ||
1696 (M3 < 4 && M0 == 4 && M1 == 5 && M2 == 6)) {
1697 ShiftElts = IsLE ? LittleEndianShifts[M3 & 0x3] : BigEndianShifts[M3 & 0x3];
1698 InsertAtByte = IsLE ? 0 : 12;
1708 unsigned XXINSERTWSrcElem = IsLE ? 2 : 1;
1709 if (M0 == XXINSERTWSrcElem && M1 == 1 && M2 == 2 && M3 == 3) {
1710 InsertAtByte = IsLE ? 12 : 0;
1713 if (M0 == 0 && M1 == XXINSERTWSrcElem && M2 == 2 && M3 == 3) {
1714 InsertAtByte = IsLE ? 8 : 4;
1717 if (M0 == 0 && M1 == 1 && M2 == XXINSERTWSrcElem && M3 == 3) {
1718 InsertAtByte = IsLE ? 4 : 8;
1721 if (M0 == 0 && M1 == 1 && M2 == 2 && M3 == XXINSERTWSrcElem) {
1722 InsertAtByte = IsLE ? 0 : 12;
1731 bool &Swap,
bool IsLE) {
1746 assert(M0 < 4 &&
"Indexing into an undef vector?");
1747 if (M1 != (M0 + 1) % 4 || M2 != (M1 + 1) % 4 || M3 != (M2 + 1) % 4)
1750 ShiftElts = IsLE ? (4 - M0) % 4 : M0;
1756 if (M1 != (M0 + 1) % 8 || M2 != (M1 + 1) % 8 || M3 != (M2 + 1) % 8)
1760 if (M0 == 0 || M0 == 7 || M0 == 6 || M0 == 5) {
1765 ShiftElts = (8 - M0) % 8;
1766 }
else if (M0 == 4 || M0 == 3 || M0 == 2 || M0 == 1) {
1771 ShiftElts = (4 - M0) % 4;
1776 if (M0 == 0 || M0 == 1 || M0 == 2 || M0 == 3) {
1781 }
else if (M0 == 4 || M0 == 5 || M0 == 6 || M0 == 7) {
1798 for (
int i = 0; i < 16; i += Width)
1830 bool &Swap,
bool IsLE) {
1839 assert(((M0 | M1) < 4) &&
"A mask element out of bounds?");
1844 if ((M0 | M1) < 2) {
1845 DM = IsLE ? (((~M1) & 1) << 1) + ((~M0) & 1) : (M0 << 1) + (M1 & 1);
1853 if (M0 > 1 && M1 < 2) {
1855 }
else if (M0 < 2 && M1 > 1) {
1863 DM = (((~M1) & 1) << 1) + ((~M0) & 1);
1866 if (M0 < 2 && M1 > 1) {
1868 }
else if (M0 > 1 && M1 < 2) {
1876 DM = (M0 << 1) + (M1 & 1);
1889 return (16 / EltSize) - 1 - (SVOp->
getMaskElt(0) / EltSize);
1906 if (EltSize < ByteSize) {
1907 unsigned Multiple = ByteSize/EltSize;
1909 assert(Multiple > 1 && Multiple <= 4 &&
"How can this happen?");
1917 if (!UniquedVals[i&(Multiple-1)].getNode())
1918 UniquedVals[i&(Multiple-1)] = N->
getOperand(i);
1919 else if (UniquedVals[i&(Multiple-1)] != N->
getOperand(i))
1929 bool LeadingZero =
true;
1930 bool LeadingOnes =
true;
1931 for (
unsigned i = 0; i != Multiple-1; ++i) {
1932 if (!UniquedVals[i].getNode())
continue;
1939 if (!UniquedVals[Multiple-1].getNode())
1941 int Val = cast<ConstantSDNode>(UniquedVals[Multiple-1])->getZExtValue();
1946 if (!UniquedVals[Multiple-1].getNode())
1948 int Val =cast<ConstantSDNode>(UniquedVals[Multiple-1])->getSExtValue();
1967 unsigned ValSizeInBytes = EltSize;
1970 Value = CN->getZExtValue();
1972 assert(CN->getValueType(0) ==
MVT::f32 &&
"Only one legal FP vector type!");
1973 Value =
FloatToBits(CN->getValueAPF().convertToFloat());
1979 if (ValSizeInBytes < ByteSize)
return SDValue();
1983 if (!
APInt(ValSizeInBytes * 8, Value).
isSplat(ByteSize * 8))
1990 if (MaskVal == 0)
return SDValue();
1993 if (SignExtend32<5>(MaskVal) == MaskVal)
2009 for (i = 0; i != 4 && SVOp->
getMaskElt(i) < 0; ++i)
2012 if (i == 4)
return -1;
2017 if (ShiftAmt < i)
return -1;
2021 for (++i; i != 4; ++i)
2037 if (!isa<ConstantSDNode>(N))
2040 Imm = (int16_t)cast<ConstantSDNode>(N)->getZExtValue();
2042 return Imm == (int32_t)cast<ConstantSDNode>(
N)->getZExtValue();
2044 return Imm == (int64_t)cast<ConstantSDNode>(N)->getZExtValue();
2080 if (~(LHSKnown.
Zero | RHSKnown.
Zero) == 0) {
2138 unsigned Alignment)
const {
2148 (!Alignment || (imm % Alignment) == 0)) {
2160 &&
"Cannot handle constant offsets yet!");
2172 (!Alignment || (imm % Alignment) == 0)) {
2183 dyn_cast<FrameIndexSDNode>(N.
getOperand(0))) {
2202 CN->getValueType(0));
2207 if ((CN->getValueType(0) ==
MVT::i32 ||
2208 (int64_t)CN->getZExtValue() == (int)CN->getZExtValue()) &&
2209 (!Alignment || (CN->getZExtValue() % Alignment) == 0)) {
2210 int Addr = (int)CN->getZExtValue();
2278 Ptr =
LD->getBasePtr();
2279 VT =
LD->getMemoryVT();
2280 Alignment =
LD->getAlignment();
2282 Ptr =
ST->getBasePtr();
2283 VT =
ST->getMemoryVT();
2284 Alignment =
ST->getAlignment();
2307 if (isa<FrameIndexSDNode>(Base) || isa<RegisterSDNode>(Base))
2310 SDValue Val = cast<StoreSDNode>(
N)->getValue();
2340 isa<ConstantSDNode>(
Offset))
2355 unsigned &HiOpFlags,
unsigned &LoOpFlags,
2372 if (GV->hasHiddenVisibility()) {
2434 unsigned MOHiFlag, MOLoFlag;
2512 unsigned MOHiFlag, MOLoFlag;
2541 unsigned MOHiFlag, MOLoFlag;
2562 bool is64bit = Subtarget.
isPPC64();
2589 PtrVT, GOTReg, TGA);
2593 PtrVT, TGA, GOTPtr);
2630 PtrVT, GOTPtr, TGA, TGA);
2632 PtrVT, TLSAddr, TGA);
2654 unsigned MOHiFlag, MOLoFlag;
2714 if (C->isAllOnesValue() || C->isNullValue())
2739 const Value *SV = cast<SrcValueSDNode>(Node->
getOperand(2))->getValue();
2780 InChain = OverflowArea.
getValue(1);
2826 InChain = DAG.
getTruncStore(InChain, dl, OverflowArea, OverflowAreaPtr,
2833 assert(!Subtarget.
isPPC64() &&
"LowerVACOPY is PPC32 only");
2857 bool isPPC64 = (PtrVT ==
MVT::i64);
2861 TargetLowering::ArgListEntry Entry;
2863 Entry.Ty = IntPtrTy;
2864 Entry.Node = Trmp; Args.push_back(Entry);
2867 Entry.Node = DAG.
getConstant(isPPC64 ? 48 : 40, dl,
2869 Args.push_back(Entry);
2871 Entry.Node = FPtr; Args.push_back(Entry);
2872 Entry.Node = Nest; Args.push_back(Entry);
2876 CLI.setDebugLoc(dl).setChain(Chain).setLibCallee(
2880 std::pair<SDValue, SDValue> CallResult =
LowerCallTo(CLI);
2881 return CallResult.second;
2931 uint64_t FrameOffset = PtrVT.getSizeInBits()/8;
2934 uint64_t StackOffset = PtrVT.getSizeInBits()/8 - 1;
2937 uint64_t FPROffset = 1;
2946 uint64_t nextOffset = FPROffset;
2954 nextOffset += StackOffset;
2955 nextPtr = DAG.
getNode(
ISD::ADD, dl, PtrVT, nextPtr, ConstStackOffset);
2958 SDValue thirdStore = DAG.
getStore(secondStore, dl, StackOffsetFI, nextPtr,
2960 nextOffset += FrameOffset;
2961 nextPtr = DAG.
getNode(
ISD::ADD, dl, PtrVT, nextPtr, ConstFrameOffset);
2964 return DAG.
getStore(thirdStore, dl, FR, nextPtr,
2968 #include "PPCGenCallingConv.inc"
2972 CCAssignFn *PPCTargetLowering::useFastISelCCs(
unsigned Flag)
const {
2973 return Flag ? CC_PPC64_ELF_FIS : RetCC_PPC64_ELF_FIS;
2990 PPC::R7, PPC::R8, PPC::R9, PPC::R10,
3000 if (RegNum != NumArgRegs && RegNum % 2 == 1) {
3018 PPC::R7, PPC::R8, PPC::R9, PPC::R10,
3023 int RegsLeft = NumArgRegs - RegNum;
3027 if (RegNum != NumArgRegs && RegsLeft < 4) {
3028 for (
int i = 0; i < RegsLeft; i++) {
3042 PPC::F1, PPC::F2, PPC::F3, PPC::F4, PPC::F5, PPC::F6, PPC::F7,
3052 if (RegNum != NumArgRegs && ArgRegs[RegNum] == PPC::F8) {
3065 static const MCPhysReg FPR[] = {PPC::F1, PPC::F2, PPC::F3, PPC::F4, PPC::F5,
3066 PPC::F6, PPC::F7, PPC::F8, PPC::F9, PPC::F10,
3067 PPC::F11, PPC::F12, PPC::F13};
3071 PPC::QF1, PPC::QF2, PPC::QF3, PPC::QF4, PPC::QF5, PPC::QF6, PPC::QF7,
3072 PPC::QF8, PPC::QF9, PPC::QF10, PPC::QF11, PPC::QF12, PPC::QF13};
3077 unsigned PtrByteSize) {
3085 ArgSize = ((ArgSize + PtrByteSize - 1)/PtrByteSize) * PtrByteSize;
3094 unsigned PtrByteSize) {
3095 unsigned Align = PtrByteSize;
3111 if (BVAlign > PtrByteSize) {
3112 if (BVAlign % PtrByteSize != 0)
3114 "ByVal alignment is not a multiple of the pointer size");
3140 unsigned PtrByteSize,
3141 unsigned LinkageSize,
3142 unsigned ParamAreaSize,
3143 unsigned &ArgOffset,
3144 unsigned &AvailableFPRs,
3145 unsigned &AvailableVRs,
bool HasQPX) {
3146 bool UseMemory =
false;
3151 ArgOffset = ((ArgOffset + Align - 1) / Align) *
Align;
3154 if (ArgOffset >= LinkageSize + ParamAreaSize)
3160 ArgOffset = ((ArgOffset + PtrByteSize - 1)/PtrByteSize) * PtrByteSize;
3163 if (ArgOffset > LinkageSize + ParamAreaSize)
3174 if (AvailableFPRs > 0) {
3182 if (AvailableVRs > 0) {
3194 unsigned NumBytes) {
3196 unsigned AlignMask = TargetAlign - 1;
3197 NumBytes = (NumBytes + AlignMask) & ~AlignMask;
3201 SDValue PPCTargetLowering::LowerFormalArguments(
3207 return LowerFormalArguments_64SVR4(Chain, CallConv, isVarArg, Ins,
3210 return LowerFormalArguments_32SVR4(Chain, CallConv, isVarArg, Ins,
3213 return LowerFormalArguments_Darwin(Chain, CallConv, isVarArg, Ins,
3218 SDValue PPCTargetLowering::LowerFormalArguments_32SVR4(
3260 unsigned PtrByteSize = 4;
3269 CCInfo.AllocateStack(LinkageSize, PtrByteSize);
3271 CCInfo.PreAnalyzeFormalArguments(Ins);
3273 CCInfo.AnalyzeFormalArguments(Ins, CC_PPC32_SVR4);
3274 CCInfo.clearWasPPCF128();
3276 for (
unsigned i = 0, e = ArgLocs.
size(); i != e; ++i) {
3289 RC = &PPC::GPRCRegClass;
3293 RC = &PPC::VSSRCRegClass;
3295 RC = &PPC::F4RCRegClass;
3299 RC = &PPC::VSFRCRegClass;
3301 RC = &PPC::F8RCRegClass;
3306 RC = &PPC::VRRCRegClass;
3309 RC = Subtarget.
hasQPX() ? &PPC::QSRCRegClass : &PPC::VRRCRegClass;
3313 RC = &PPC::VRRCRegClass;
3316 RC = &PPC::QFRCRegClass;
3319 RC = &PPC::QBRCRegClass;
3326 ValVT ==
MVT::i1 ? MVT::i32 : ValVT);
3355 CCByValInfo.
AllocateStack(CCInfo.getNextStackOffset(), PtrByteSize);
3357 CCByValInfo.AnalyzeFormalArguments(Ins, CC_PPC32_SVR4_ByVal);
3360 unsigned MinReservedArea = CCByValInfo.getNextStackOffset();
3361 MinReservedArea =
std::max(MinReservedArea, LinkageSize);
3378 PPC::R7, PPC::R8, PPC::R9, PPC::R10,
3383 PPC::F1, PPC::F2, PPC::F3, PPC::F4, PPC::F5, PPC::F6, PPC::F7,
3395 int Depth = NumGPArgRegs * PtrVT.getSizeInBits()/8 +
3400 CCInfo.getNextStackOffset(),
true));
3408 for (
unsigned GPRIndex = 0; GPRIndex != NumGPArgRegs; ++GPRIndex) {
3412 VReg = MF.
addLiveIn(GPArgRegs[GPRIndex], &PPC::GPRCRegClass);
3427 for (
unsigned FPRIndex = 0; FPRIndex != NumFPArgRegs; ++FPRIndex) {
3431 VReg = MF.
addLiveIn(FPArgRegs[FPRIndex], &PPC::F8RCRegClass);
3444 if (!MemOps.
empty())
3455 const SDLoc &dl)
const {
3466 SDValue PPCTargetLowering::LowerFormalArguments_64SVR4(
3479 "fastcc not supported on varargs functions");
3485 unsigned PtrByteSize = 8;
3489 PPC::X3, PPC::X4, PPC::X5, PPC::X6,
3490 PPC::X7, PPC::X8, PPC::X9, PPC::X10,
3494 PPC::V9, PPC::V10, PPC::V11, PPC::V12, PPC::V13
3500 const unsigned Num_QFPR_Regs = Num_FPR_Regs;
3508 bool HasParameterArea = !isELFv2ABI || isVarArg;
3509 unsigned ParamAreaSize = Num_GPR_Regs * PtrByteSize;
3510 unsigned NumBytes = LinkageSize;
3511 unsigned AvailableFPRs = Num_FPR_Regs;
3512 unsigned AvailableVRs = Num_VR_Regs;
3513 for (
unsigned i = 0, e = Ins.
size(); i != e; ++i) {
3514 if (Ins[i].Flags.
isNest())
3518 PtrByteSize, LinkageSize, ParamAreaSize,
3519 NumBytes, AvailableFPRs, AvailableVRs,
3521 HasParameterArea =
true;
3528 unsigned ArgOffset = LinkageSize;
3529 unsigned GPR_idx = 0, FPR_idx = 0, VR_idx = 0;
3530 unsigned &QFPR_idx = FPR_idx;
3533 unsigned CurArgIdx = 0;
3534 for (
unsigned ArgNo = 0, e = Ins.
size(); ArgNo != e; ++ArgNo) {
3536 bool needsLoad =
false;
3537 EVT ObjectVT = Ins[ArgNo].VT;
3538 EVT OrigVT = Ins[ArgNo].ArgVT;
3540 unsigned ArgSize = ObjSize;
3542 if (Ins[ArgNo].isOrigArg()) {
3543 std::advance(FuncArg, Ins[ArgNo].getOrigArgIndex() - CurArgIdx);
3544 CurArgIdx = Ins[ArgNo].getOrigArgIndex();
3549 unsigned CurArgOffset,
Align;
3550 auto ComputeArgOffset = [&]() {
3553 ArgOffset = ((ArgOffset + Align - 1) / Align) *
Align;
3554 CurArgOffset = ArgOffset;
3561 GPR_idx = (ArgOffset - LinkageSize) / PtrByteSize;
3562 GPR_idx =
std::min(GPR_idx, Num_GPR_Regs);
3568 assert(Ins[ArgNo].isOrigArg() &&
"Byval arguments cannot be implicit");
3575 ArgSize = ((ObjSize + PtrByteSize - 1)/PtrByteSize) * PtrByteSize;
3597 if (HasParameterArea ||
3598 ArgSize + ArgOffset > LinkageSize + Num_GPR_Regs * PtrByteSize)
3605 if (ObjSize < PtrByteSize) {
3609 if (!isLittleEndian) {
3615 if (GPR_idx != Num_GPR_Regs) {
3616 unsigned VReg = MF.
addLiveIn(GPR[GPR_idx++], &PPC::G8RCRegClass);
3620 if (ObjSize==1 || ObjSize==2 || ObjSize==4) {
3637 ArgOffset += PtrByteSize;
3646 for (
unsigned j = 0; j < ArgSize; j += PtrByteSize) {
3647 if (GPR_idx == Num_GPR_Regs)
3650 unsigned VReg = MF.
addLiveIn(GPR[GPR_idx], &PPC::G8RCRegClass);
3662 ArgOffset += ArgSize;
3673 unsigned VReg = MF.
addLiveIn(PPC::X11, &PPC::G8RCRegClass);
3676 if (ObjectVT == MVT::i32 || ObjectVT ==
MVT::i1)
3677 ArgVal = extendArgForPPC64(Flags, ObjectVT, DAG, ArgVal, dl);
3685 if (GPR_idx != Num_GPR_Regs) {
3686 unsigned VReg = MF.
addLiveIn(GPR[GPR_idx++], &PPC::G8RCRegClass);
3689 if (ObjectVT == MVT::i32 || ObjectVT ==
MVT::i1)
3692 ArgVal = extendArgForPPC64(Flags, ObjectVT, DAG, ArgVal, dl);
3698 ArgSize = PtrByteSize;
3709 if (FPR_idx != Num_FPR_Regs) {
3715 ? &PPC::VSSRCRegClass
3716 : &PPC::F4RCRegClass);
3719 ? &PPC::VSFRCRegClass
3720 : &PPC::F8RCRegClass);
3731 unsigned VReg = MF.
addLiveIn(GPR[GPR_idx++], &PPC::G8RCRegClass);
3735 if ((ArgOffset % PtrByteSize) == (isLittleEndian ? 4 : 0))
3754 ArgOffset += ArgSize;
3756 ArgOffset = ((ArgOffset + PtrByteSize - 1)/PtrByteSize) * PtrByteSize;
3766 if (!Subtarget.
hasQPX()) {
3770 if (VR_idx != Num_VR_Regs) {
3771 unsigned VReg = MF.
addLiveIn(VR[VR_idx], &PPC::VRRCRegClass);
3786 "Invalid QPX parameter type");
3794 if (QFPR_idx != Num_QFPR_Regs) {
3797 case MVT::v4f64: RC = &PPC::QFRCRegClass;
break;
3798 case MVT::v4f32: RC = &PPC::QSRCRegClass;
break;
3799 default: RC = &PPC::QBRCRegClass;
break;
3818 if (ObjSize < ArgSize && !isLittleEndian)
3819 CurArgOffset += ArgSize - ObjSize;
3829 unsigned MinReservedArea;
3830 if (HasParameterArea)
3831 MinReservedArea =
std::max(ArgOffset, LinkageSize + 8 * PtrByteSize);
3833 MinReservedArea = LinkageSize;
3846 int Depth = ArgOffset;
3855 for (GPR_idx = (ArgOffset - LinkageSize) / PtrByteSize;
3856 GPR_idx < Num_GPR_Regs; ++GPR_idx) {
3857 unsigned VReg = MF.
addLiveIn(GPR[GPR_idx], &PPC::G8RCRegClass);
3868 if (!MemOps.
empty())
3874 SDValue PPCTargetLowering::LowerFormalArguments_Darwin(
3889 unsigned PtrByteSize = isPPC64 ? 8 : 4;
3891 unsigned ArgOffset = LinkageSize;
3893 unsigned MinReservedArea = ArgOffset;
3897 PPC::R7, PPC::R8, PPC::R9, PPC::R10,
3900 PPC::X3, PPC::X4, PPC::X5, PPC::X6,
3901 PPC::X7, PPC::X8, PPC::X9, PPC::X10,
3905 PPC::V9, PPC::V10, PPC::V11, PPC::V12, PPC::V13
3912 unsigned GPR_idx = 0, FPR_idx = 0, VR_idx = 0;
3914 const MCPhysReg *GPR = isPPC64 ? GPR_64 : GPR_32;
3923 unsigned VecArgOffset = ArgOffset;
3924 if (!isVarArg && !isPPC64) {
3925 for (
unsigned ArgNo = 0, e = Ins.
size(); ArgNo != e;
3927 EVT ObjectVT = Ins[ArgNo].VT;
3934 ((ObjSize + PtrByteSize - 1)/PtrByteSize) * PtrByteSize;
3935 VecArgOffset += ArgSize;
3963 VecArgOffset = ((VecArgOffset+15)/16)*16;
3964 VecArgOffset += 12*16;
3971 unsigned nAltivecParamsAtEnd = 0;
3973 unsigned CurArgIdx = 0;
3974 for (
unsigned ArgNo = 0, e = Ins.
size(); ArgNo != e; ++ArgNo) {
3976 bool needsLoad =
false;
3977 EVT ObjectVT = Ins[ArgNo].VT;
3979 unsigned ArgSize = ObjSize;
3981 if (Ins[ArgNo].isOrigArg()) {
3982 std::advance(FuncArg, Ins[ArgNo].getOrigArgIndex() - CurArgIdx);
3983 CurArgIdx = Ins[ArgNo].getOrigArgIndex();
3985 unsigned CurArgOffset = ArgOffset;
3990 if (isVarArg || isPPC64) {
3991 MinReservedArea = ((MinReservedArea+15)/16)*16;
3995 }
else nAltivecParamsAtEnd++;
4005 assert(Ins[ArgNo].isOrigArg() &&
"Byval arguments cannot be implicit");
4009 ArgSize = ((ObjSize + PtrByteSize - 1)/PtrByteSize) * PtrByteSize;
4012 if (ObjSize==1 || ObjSize==2) {
4013 CurArgOffset = CurArgOffset + (4 - ObjSize);
4019 if (ObjSize==1 || ObjSize==2) {
4020 if (GPR_idx != Num_GPR_Regs) {
4023 VReg = MF.
addLiveIn(GPR[GPR_idx], &PPC::G8RCRegClass);
4025 VReg = MF.
addLiveIn(GPR[GPR_idx], &PPC::GPRCRegClass);
4035 ArgOffset += PtrByteSize;
4039 for (
unsigned j = 0; j < ArgSize; j += PtrByteSize) {
4043 if (GPR_idx != Num_GPR_Regs) {
4046 VReg = MF.
addLiveIn(GPR[GPR_idx], &PPC::G8RCRegClass);
4048 VReg = MF.
addLiveIn(GPR[GPR_idx], &PPC::GPRCRegClass);
4056 ArgOffset += PtrByteSize;
4058 ArgOffset += ArgSize - (ArgOffset-CurArgOffset);
4070 if (GPR_idx != Num_GPR_Regs) {
4071 unsigned VReg = MF.
addLiveIn(GPR[GPR_idx], &PPC::GPRCRegClass);
4080 ArgSize = PtrByteSize;
4083 ArgOffset += PtrByteSize;
4088 if (GPR_idx != Num_GPR_Regs) {
4089 unsigned VReg = MF.
addLiveIn(GPR[GPR_idx], &PPC::G8RCRegClass);
4092 if (ObjectVT == MVT::i32 || ObjectVT ==
MVT::i1)
4095 ArgVal = extendArgForPPC64(Flags, ObjectVT, DAG, ArgVal, dl);
4100 ArgSize = PtrByteSize;
4110 if (GPR_idx != Num_GPR_Regs) {
4112 if (ObjSize == 8 && GPR_idx != Num_GPR_Regs && !isPPC64)
4115 if (FPR_idx != Num_FPR_Regs) {
4130 ArgOffset += isPPC64 ? 8 : ObjSize;
4138 if (VR_idx != Num_VR_Regs) {
4139 unsigned VReg = MF.
addLiveIn(VR[VR_idx], &PPC::VRRCRegClass);
4142 while ((ArgOffset % 16) != 0) {
4143 ArgOffset += PtrByteSize;
4144 if (GPR_idx != Num_GPR_Regs)
4148 GPR_idx =
std::min(GPR_idx+4, Num_GPR_Regs);
4152 if (!isVarArg && !isPPC64) {
4154 CurArgOffset = VecArgOffset;
4158 ArgOffset = ((ArgOffset+15)/16)*16;
4159 CurArgOffset = ArgOffset;
4171 CurArgOffset + (ArgSize - ObjSize),
4181 if (nAltivecParamsAtEnd) {
4182 MinReservedArea = ((MinReservedArea+15)/16)*16;
4183 MinReservedArea += 16*nAltivecParamsAtEnd;
4187 MinReservedArea =
std::max(MinReservedArea, LinkageSize + 8 * PtrByteSize);
4200 int Depth = ArgOffset;
4210 for (; GPR_idx != Num_GPR_Regs; ++GPR_idx) {
4214 VReg = MF.
addLiveIn(GPR[GPR_idx], &PPC::G8RCRegClass);
4216 VReg = MF.
addLiveIn(GPR[GPR_idx], &PPC::GPRCRegClass);
4228 if (!MemOps.
empty())
4237 unsigned ParamSize) {
4239 if (!isTailCall)
return 0;
4243 int SPDiff = (int)CallerMinReservedArea - (
int)ParamSize;
4245 if (SPDiff < FI->getTailCallSPDelta())
4271 if (
const auto *
F = dyn_cast<Function>(GV)) {
4304 const unsigned PtrByteSize = 8;
4308 PPC::X3, PPC::X4, PPC::X5, PPC::X6,
4309 PPC::X7, PPC::X8, PPC::X9, PPC::X10,
4313 PPC::V9, PPC::V10, PPC::V11, PPC::V12, PPC::V13
4317 const unsigned NumFPRs = 13;
4319 const unsigned ParamAreaSize = NumGPRs * PtrByteSize;
4321 unsigned NumBytes = LinkageSize;
4322 unsigned AvailableFPRs = NumFPRs;
4323 unsigned AvailableVRs = NumVRs;
4326 if (Param.Flags.isNest())
continue;
4329 PtrByteSize, LinkageSize, ParamAreaSize,
4330 NumBytes, AvailableFPRs, AvailableVRs,
4346 for (; CalleeArgIter != CalleeArgEnd; ++CalleeArgIter, ++CallerArgIter) {
4347 const Value* CalleeArg = *CalleeArgIter;
4348 const Value* CallerArg = &(*CallerArgIter);
4349 if (CalleeArg == CallerArg)
4357 isa<UndefValue>(CalleeArg))
4367 PPCTargetLowering::IsEligibleForTailCallOptimization_64SVR4(
4377 if (
DisableSCO && !TailCallOpt)
return false;
4380 if (isVarArg)
return false;
4387 if (CallerCC != CalleeCC)
return false;
4406 !isa<ExternalSymbolSDNode>(Callee))
4437 PPCTargetLowering::IsEligibleForTailCallOptimization(
SDValue Callee,
4453 for (
unsigned i = 0; i != Ins.
size(); i++) {
4455 if (Flags.
isByVal())
return false;
4465 return G->getGlobal()->hasHiddenVisibility()
4466 ||
G->getGlobal()->hasProtectedVisibility();
4476 if (!C)
return nullptr;
4479 if ((Addr & 3) != 0 ||
4480 SignExtend32<26>(Addr) != Addr)
4492 struct TailCallArgumentInfo {
4497 TailCallArgumentInfo() =
default;
4507 for (
unsigned i = 0, e = TailCallArgs.
size(); i != e; ++i) {
4508 SDValue Arg = TailCallArgs[i].Arg;
4509 SDValue FIN = TailCallArgs[i].FrameIdxOp;
4510 int FI = TailCallArgs[i].FrameIdx;
4513 Chain, dl, Arg, FIN,
4522 int SPDiff,
const SDLoc &dl) {
4528 bool isPPC64 = Subtarget.
isPPC64();
4529 int SlotSize = isPPC64 ? 8 : 4;
4530 int NewRetAddrLoc = SPDiff + FL->getReturnSaveOffset();
4532 NewRetAddrLoc,
true);
4535 Chain = DAG.
getStore(Chain, dl, OldRetAddr, NewRetAddrFrIdx,
4541 int NewFPLoc = SPDiff + FL->getFramePointerSaveOffset();
4545 Chain = DAG.
getStore(Chain, dl, OldFP, NewFramePtrIdx,
4557 SDValue Arg,
int SPDiff,
unsigned ArgOffset,
4559 int Offset = ArgOffset + SPDiff;
4564 TailCallArgumentInfo Info;
4566 Info.FrameIdxOp = FIN;
4574 SDValue PPCTargetLowering::EmitTailCallLoadFPAndRetAddr(
4580 LROpOut = getReturnAddrFrameIndex(DAG);
4587 FPOpOut = getFramePointerFrameIndex(DAG);
4614 SDValue PtrOff,
int SPDiff,
unsigned ArgOffset,
bool isPPC64,
4637 const SDLoc &dl,
int SPDiff,
unsigned NumBytes,
SDValue LROp,
4647 if (!MemOpChains2.
empty())
4667 return G->getGlobal()->getValueType()->isFunctionTy();
4675 SDValue CallSeqStart,
const SDLoc &dl,
int SPDiff,
bool isTailCall,
4676 bool isPatchPoint,
bool hasNest,
4680 bool isPPC64 = Subtarget.
isPPC64();
4690 bool needIndirectCall =
true;
4691 if (!isSVR4ABI || !isPPC64)
4695 needIndirectCall =
false;
4704 if (
auto *
G = dyn_cast<GlobalAddressSDNode>(Callee))
4705 GV =
G->getGlobal();
4707 bool UsePlt = !Local && Subtarget.
isTargetELF() && !isPPC64;
4713 unsigned OpFlags = 0;
4722 needIndirectCall =
false;
4726 unsigned char OpFlags = 0;
4733 needIndirectCall =
false;
4743 needIndirectCall =
false;
4746 if (needIndirectCall) {
4749 SDValue MTCTROps[] = {Chain, Callee, InFlag};
4751 if (isSVR4ABI && isPPC64 && !isELFv2ABI) {
4823 MTCTROps[0] = Chain;
4824 MTCTROps[1] = LoadFuncPtr;
4825 MTCTROps[2] = InFlag;
4839 if (isSVR4ABI && isPPC64 && !isELFv2ABI && !hasNest)
4857 for (
unsigned i = 0, e = RegsToPass.size(); i != e; ++i)
4859 RegsToPass[i].second.getValueType()));
4863 if (isSVR4ABI && isPPC64 && !isPatchPoint) {
4871 SDValue PPCTargetLowering::LowerCallResult(
4881 for (
unsigned i = 0, e = RVLocs.
size(); i != e; ++i) {
4914 SDValue PPCTargetLowering::FinishCall(
4921 std::vector<EVT> NodeTys;
4923 unsigned CallOpc =
PrepareCall(DAG, Callee, InFlag, Chain, CallSeqStart, dl,
4924 SPDiff, isTailCall, isPatchPoint, hasNest,
4925 RegsToPass, Ops, NodeTys, CS, Subtarget);
4934 int BytesCalleePops =
4942 assert(Mask &&
"Missing call preserved mask for calling convention");
4951 cast<RegisterSDNode>(Callee)->
getReg() == PPC::CTR) ||
4954 isa<ConstantSDNode>(Callee)) &&
4955 "Expecting an global address, external symbol, absolute value or register");
5001 Chain = DAG.
getNode(CallOpc, dl, NodeTys, Ops);
5010 return LowerCallResult(Chain, InFlag, CallConv, isVarArg,
5011 Ins, dl, DAG, InVals);
5035 IsEligibleForTailCallOptimization_64SVR4(Callee, CallConv, CS,
5036 isVarArg, Outs, Ins, DAG);
5038 isTailCall = IsEligibleForTailCallOptimization(Callee, CallConv, isVarArg,
5045 assert(isa<GlobalAddressSDNode>(Callee) &&
5046 "Callee should be an llvm::Function object.");
5048 const GlobalValue *GV = cast<GlobalAddressSDNode>(Callee)->getGlobal();
5049 const unsigned Width = 80 - strlen(
"TCO caller: ")
5050 - strlen(
", callee linkage: 0, 0");
5051 dbgs() <<
"TCO caller: "
5053 <<
", callee linkage: "
5061 "site marked musttail");
5066 if (Subtarget.
useLongCalls() && isa<GlobalAddressSDNode>(Callee) &&
5068 Callee = LowerGlobalAddress(Callee, DAG);
5072 return LowerCall_64SVR4(Chain, Callee, CallConv, isVarArg,
5073 isTailCall, isPatchPoint, Outs, OutVals, Ins,
5074 dl, DAG, InVals, CS);
5076 return LowerCall_32SVR4(Chain, Callee, CallConv, isVarArg,
5077 isTailCall, isPatchPoint, Outs, OutVals, Ins,
5078 dl, DAG, InVals, CS);
5081 return LowerCall_Darwin(Chain, Callee, CallConv, isVarArg,
5082 isTailCall, isPatchPoint, Outs, OutVals, Ins,
5083 dl, DAG, InVals, CS);
5086 SDValue PPCTargetLowering::LowerCall_32SVR4(
5088 bool isTailCall,
bool isPatchPoint,
5100 unsigned PtrByteSize = 4;
5125 CCInfo.PreAnalyzeCallOperands(Outs);
5131 unsigned NumArgs = Outs.
size();
5133 for (
unsigned i = 0; i != NumArgs; ++i) {
5134 MVT ArgVT = Outs[i].VT;
5138 if (Outs[i].IsFixed) {
5148 errs() <<
"Call operand #" << i <<
" has unhandled type "
5156 CCInfo.AnalyzeCallOperands(Outs, CC_PPC32_SVR4);
5158 CCInfo.clearWasPPCF128();
5165 CCByValInfo.
AllocateStack(CCInfo.getNextStackOffset(), PtrByteSize);
5167 CCByValInfo.AnalyzeCallOperands(Outs, CC_PPC32_SVR4_ByVal);
5172 unsigned NumBytes = CCByValInfo.getNextStackOffset();
5186 Chain = EmitTailCallLoadFPAndRetAddr(DAG, SPDiff, Chain, LROp, FPOp, dl);
5197 bool seenFloatArg =
false;
5199 for (
unsigned i = 0, j = 0, e = ArgLocs.
size();
5211 assert((j < ByValArgLocs.
size()) &&
"Index out of bounds!");
5230 SDValue NewCallSeqStart = DAG.getCALLSEQ_START(MemcpyCall, NumBytes, 0,
5232 DAG.ReplaceAllUsesWith(CallSeqStart.
getNode(),
5233 NewCallSeqStart.getNode());
5234 Chain = CallSeqStart = NewCallSeqStart;
5255 SDValue PtrOff = DAG.getIntPtrConstant(LocMemOffset, dl);
5269 if (!MemOpChains.
empty())
5275 for (
unsigned i = 0, e = RegsToPass.
size(); i != e; ++i) {
5276 Chain = DAG.getCopyToReg(Chain, dl, RegsToPass[i].
first,
5277 RegsToPass[i].
second, InFlag);
5285 SDValue Ops[] = { Chain, InFlag };
5297 return FinishCall(CallConv, dl, isTailCall, isVarArg, isPatchPoint,
5299 RegsToPass, InFlag, Chain, CallSeqStart, Callee, SPDiff,
5300 NumBytes, Ins, InVals, CS);
5305 SDValue PPCTargetLowering::createMemcpyOutsideCallSeq(
5313 SDValue NewCallSeqStart = DAG.getCALLSEQ_START(MemcpyCall, FrameSize, 0,
5315 DAG.ReplaceAllUsesWith(CallSeqStart.
getNode(),
5317 return NewCallSeqStart;
5320 SDValue PPCTargetLowering::LowerCall_64SVR4(
5322 bool isTailCall,
bool isPatchPoint,
5330 unsigned NumOps = Outs.
size();
5331 bool hasNest =
false;
5332 bool IsSibCall =
false;
5335 unsigned PtrByteSize = 8;
5352 "fastcc not supported on varargs functions");
5359 unsigned NumBytes = LinkageSize;
5360 unsigned GPR_idx = 0, FPR_idx = 0, VR_idx = 0;
5361 unsigned &QFPR_idx = FPR_idx;
5364 PPC::X3, PPC::X4, PPC::X5, PPC::X6,
5365 PPC::X7, PPC::X8, PPC::X9, PPC::X10,
5369 PPC::V9, PPC::V10, PPC::V11, PPC::V12, PPC::V13
5375 const unsigned NumQFPRs = NumFPRs;
5381 bool HasParameterArea = !isELFv2ABI || isVarArg || CallConv ==
CallingConv::Fast;
5382 if (!HasParameterArea) {
5383 unsigned ParamAreaSize = NumGPRs * PtrByteSize;
5384 unsigned AvailableFPRs = NumFPRs;
5385 unsigned AvailableVRs = NumVRs;
5386 unsigned NumBytesTmp = NumBytes;
5387 for (
unsigned i = 0; i != NumOps; ++i) {
5388 if (Outs[i].Flags.
isNest())
continue;
5390 PtrByteSize, LinkageSize, ParamAreaSize,
5391 NumBytesTmp, AvailableFPRs, AvailableVRs,
5393 HasParameterArea =
true;
5399 unsigned NumGPRsUsed = 0, NumFPRsUsed = 0, NumVRsUsed = 0;
5402 for (
unsigned i = 0; i != NumOps; ++i) {
5404 EVT ArgVT = Outs[i].VT;
5405 EVT OrigVT = Outs[i].ArgVT;
5419 if (++NumGPRsUsed <= NumGPRs)
5428 if (++NumVRsUsed <= NumVRs)
5434 if (Subtarget.
hasQPX()) {
5435 if (++NumFPRsUsed <= NumFPRs)
5438 if (++NumVRsUsed <= NumVRs)
5446 if (++NumFPRsUsed <= NumFPRs)
5455 NumBytes = ((NumBytes + Align - 1) / Align) *
Align;
5459 NumBytes = ((NumBytes + PtrByteSize - 1)/PtrByteSize) * PtrByteSize;
5462 unsigned NumBytesActuallyUsed = NumBytes;
5472 if (HasParameterArea)
5473 NumBytes =
std::max(NumBytes, LinkageSize + 8 * PtrByteSize);
5475 NumBytes = LinkageSize;
5503 Chain = EmitTailCallLoadFPAndRetAddr(DAG, SPDiff, Chain, LROp, FPOp, dl);
5514 unsigned ArgOffset = LinkageSize;
5520 for (
unsigned i = 0; i != NumOps; ++i) {
5523 EVT ArgVT = Outs[i].VT;
5524 EVT OrigVT = Outs[i].ArgVT;
5533 auto ComputePtrOff = [&]() {
5537 ArgOffset = ((ArgOffset + Align - 1) / Align) *
Align;
5548 GPR_idx = (ArgOffset - LinkageSize) / PtrByteSize;
5549 GPR_idx =
std::min(GPR_idx, NumGPRs);
5579 if (Size==1 || Size==2 || Size==4) {
5581 if (GPR_idx != NumGPRs) {
5585 RegsToPass.
push_back(std::make_pair(GPR[GPR_idx++], Load));
5587 ArgOffset += PtrByteSize;
5592 if (GPR_idx == NumGPRs && Size < 8) {
5594 if (!isLittleEndian) {
5599 Chain = CallSeqStart = createMemcpyOutsideCallSeq(Arg, AddPtr,
5602 ArgOffset += PtrByteSize;
5619 Chain = CallSeqStart = createMemcpyOutsideCallSeq(Arg, PtrOff,
5624 if (Size < 8 && GPR_idx != NumGPRs) {
5634 if (!isLittleEndian) {
5638 Chain = CallSeqStart = createMemcpyOutsideCallSeq(Arg, AddPtr,
5646 RegsToPass.
push_back(std::make_pair(GPR[GPR_idx++], Load));
5649 ArgOffset += PtrByteSize;
5655 for (
unsigned j=0; j<
Size; j+=PtrByteSize) {
5658 if (GPR_idx != NumGPRs) {
5662 RegsToPass.
push_back(std::make_pair(GPR[GPR_idx++], Load));
5663 ArgOffset += PtrByteSize;
5665 ArgOffset += ((Size - j + PtrByteSize-1)/PtrByteSize)*PtrByteSize;
5679 RegsToPass.
push_back(std::make_pair(PPC::X11, Arg));
5687 if (GPR_idx != NumGPRs) {
5688 RegsToPass.
push_back(std::make_pair(GPR[GPR_idx++], Arg));
5693 assert(HasParameterArea &&
5694 "Parameter area must exist to pass an argument in memory.");
5696 true, isTailCall,
false, MemOpChains,
5697 TailCallArguments, dl);
5699 ArgOffset += PtrByteSize;
5702 ArgOffset += PtrByteSize;
5715 bool NeedGPROrStack = isVarArg || FPR_idx == NumFPRs;
5716 bool NeededLoad =
false;
5719 if (FPR_idx != NumFPRs)
5720 RegsToPass.
push_back(std::make_pair(
FPR[FPR_idx++], Arg));
5723 if (!NeedGPROrStack)
5745 }
else if (ArgOffset % PtrByteSize != 0) {
5749 if (!isLittleEndian)
5757 if (!isLittleEndian)
5767 RegsToPass.
push_back(std::make_pair(GPR[GPR_idx++], ArgVal));
5780 assert(HasParameterArea &&
5781 "Parameter area must exist to pass an argument in memory.");
5783 true, isTailCall,
false, MemOpChains,
5784 TailCallArguments, dl);
5795 ArgOffset = ((ArgOffset + PtrByteSize - 1)/PtrByteSize) * PtrByteSize;
5806 if (!Subtarget.
hasQPX()) {
5816 assert(HasParameterArea &&
5817 "Parameter area must exist if we have a varargs call.");
5823 if (VR_idx != NumVRs) {
5827 RegsToPass.
push_back(std::make_pair(VR[VR_idx++], Load));
5830 for (
unsigned i=0; i<16; i+=PtrByteSize) {
5831 if (GPR_idx == NumGPRs)
5838 RegsToPass.
push_back(std::make_pair(GPR[GPR_idx++], Load));
5844 if (VR_idx != NumVRs) {
5845 RegsToPass.
push_back(std::make_pair(VR[VR_idx++], Arg));
5850 assert(HasParameterArea &&
5851 "Parameter area must exist to pass an argument in memory.");
5853 true, isTailCall,
true, MemOpChains,
5854 TailCallArguments, dl);
5865 "Invalid QPX parameter type");
5872 assert(HasParameterArea &&
5873 "Parameter area must exist if we have a varargs call.");
5879 if (QFPR_idx != NumQFPRs) {
5883 RegsToPass.
push_back(std::make_pair(
QFPR[QFPR_idx++], Load));
5885 ArgOffset += (IsF32 ? 16 : 32);
5886 for (
unsigned i = 0; i < (IsF32 ? 16U : 32U); i += PtrByteSize) {
5887 if (GPR_idx == NumGPRs)
5894 RegsToPass.
push_back(std::make_pair(GPR[GPR_idx++], Load));
5900 if (QFPR_idx != NumQFPRs) {
5901 RegsToPass.
push_back(std::make_pair(
QFPR[QFPR_idx++], Arg));
5906 assert(HasParameterArea &&
5907 "Parameter area must exist to pass an argument in memory.");
5909 true, isTailCall,
true, MemOpChains,
5910 TailCallArguments, dl);
5912 ArgOffset += (IsF32 ? 16 : 32);
5916 ArgOffset += (IsF32 ? 16 : 32);
5922 assert((!HasParameterArea || NumBytesActuallyUsed == ArgOffset) &&
5923 "mismatch in size of parameter area");
5924 (void)NumBytesActuallyUsed;
5926 if (!MemOpChains.
empty())
5932 if (!isTailCall && !isPatchPoint &&
5934 !isa<ExternalSymbolSDNode>(Callee)) {
5948 if (isELFv2ABI && !isPatchPoint)
5949 RegsToPass.
push_back(std::make_pair((
unsigned)PPC::X12, Callee));
5955 for (
unsigned i = 0, e = RegsToPass.
size(); i != e; ++i) {
5956 Chain = DAG.
getCopyToReg(Chain, dl, RegsToPass[i].first,
5957 RegsToPass[i].second, InFlag);
5961 if (isTailCall && !IsSibCall)
5965 return FinishCall(CallConv, dl, isTailCall, isVarArg, isPatchPoint, hasNest,
5966 DAG, RegsToPass, InFlag, Chain, CallSeqStart, Callee,
5967 SPDiff, NumBytes, Ins, InVals, CS);
5970 SDValue PPCTargetLowering::LowerCall_Darwin(
5972 bool isTailCall,
bool isPatchPoint,
5978 unsigned NumOps = Outs.
size();
5982 unsigned PtrByteSize = isPPC64 ? 8 : 4;
5999 unsigned NumBytes = LinkageSize;
6007 unsigned nAltivecParamsAtEnd = 0;
6008 for (
unsigned i = 0; i != NumOps; ++i) {
6010 EVT ArgVT = Outs[i].VT;
6015 if (!isVarArg && !isPPC64) {
6018 nAltivecParamsAtEnd++;
6022 NumBytes = ((NumBytes+15)/16)*16;
6028 if (nAltivecParamsAtEnd) {
6029 NumBytes = ((NumBytes+15)/16)*16;
6030 NumBytes += 16*nAltivecParamsAtEnd;
6038 NumBytes =
std::max(NumBytes, LinkageSize + 8 * PtrByteSize);
6062 Chain = EmitTailCallLoadFPAndRetAddr(DAG, SPDiff, Chain, LROp, FPOp, dl);
6077 unsigned ArgOffset = LinkageSize;
6078 unsigned GPR_idx = 0, FPR_idx = 0, VR_idx = 0;
6082 PPC::R7, PPC::R8, PPC::R9, PPC::R10,
6085 PPC::X3, PPC::X4, PPC::X5, PPC::X6,
6086 PPC::X7, PPC::X8, PPC::X9, PPC::X10,
6090 PPC::V9, PPC::V10, PPC::V11, PPC::V12, PPC::V13
6093 const unsigned NumFPRs = 13;
6096 const MCPhysReg *GPR = isPPC64 ? GPR_64 : GPR_32;
6102 for (
unsigned i = 0; i != NumOps; ++i) {
6128 if (Size==1 || Size==2) {
6130 if (GPR_idx != NumGPRs) {
6134 RegsToPass.
push_back(std::make_pair(GPR[GPR_idx++], Load));
6136 ArgOffset += PtrByteSize;
6141 Chain = CallSeqStart = createMemcpyOutsideCallSeq(Arg, AddPtr,
6144 ArgOffset += PtrByteSize;
6151 Chain = CallSeqStart = createMemcpyOutsideCallSeq(Arg, PtrOff,
6158 for (
unsigned j=0; j<
Size; j+=PtrByteSize) {
6161 if (GPR_idx != NumGPRs) {
6165 RegsToPass.
push_back(std::make_pair(GPR[GPR_idx++], Load));
6166 ArgOffset += PtrByteSize;
6168 ArgOffset += ((Size - j + PtrByteSize-1)/PtrByteSize)*PtrByteSize;
6180 if (GPR_idx != NumGPRs) {
6184 RegsToPass.
push_back(std::make_pair(GPR[GPR_idx++], Arg));
6187 isPPC64, isTailCall,
false, MemOpChains,
6188 TailCallArguments, dl);
6190 ArgOffset += PtrByteSize;
6194 if (FPR_idx != NumFPRs) {
6195 RegsToPass.
push_back(std::make_pair(
FPR[FPR_idx++], Arg));
6203 if (GPR_idx != NumGPRs) {
6207 RegsToPass.
push_back(std::make_pair(GPR[GPR_idx++], Load));
6215 RegsToPass.
push_back(std::make_pair(GPR[GPR_idx++], Load));
6221 if (GPR_idx != NumGPRs)
6229 isPPC64, isTailCall,
false, MemOpChains,
6230 TailCallArguments, dl);
6246 while (ArgOffset % 16 !=0) {
6247 ArgOffset += PtrByteSize;
6248 if (GPR_idx != NumGPRs)
6258 if (VR_idx != NumVRs) {
6262 RegsToPass.
push_back(std::make_pair(VR[VR_idx++], Load));
6265 for (
unsigned i=0; i<16; i+=PtrByteSize) {
6266 if (GPR_idx == NumGPRs)
6273 RegsToPass.
push_back(std::make_pair(GPR[GPR_idx++], Load));
6280 if (VR_idx != NumVRs) {
6282 RegsToPass.
push_back(std::make_pair(VR[VR_idx++], Arg));
6283 }
else if (nAltivecParamsAtEnd==0) {
6286 isPPC64, isTailCall,
true, MemOpChains,
6287 TailCallArguments, dl);
6298 if (!isVarArg && nAltivecParamsAtEnd > NumVRs) {
6301 ArgOffset = ((ArgOffset+15)/16)*16;
6303 for (
unsigned i = 0; i != NumOps; ++i) {
6305 EVT ArgType = Outs[i].VT;
6312 isPPC64, isTailCall,
true, MemOpChains,
6313 TailCallArguments, dl);
6320 if (!MemOpChains.
empty())
6328 !isa<ExternalSymbolSDNode>(Callee) &&
6330 RegsToPass.
push_back(std::make_pair((
unsigned)(isPPC64 ? PPC::X12 :
6331 PPC::R12), Callee));
6336 for (
unsigned i = 0, e = RegsToPass.
size(); i != e; ++i) {
6337 Chain = DAG.
getCopyToReg(Chain, dl, RegsToPass[i].first,
6338 RegsToPass[i].second, InFlag);
6346 return FinishCall(CallConv, dl, isTailCall, isVarArg, isPatchPoint,
6348 RegsToPass, InFlag, Chain, CallSeqStart, Callee, SPDiff,
6349 NumBytes, Ins, InVals, CS);
6358 CCState CCInfo(CallConv, isVarArg, MF, RVLocs, Context);
6359 return CCInfo.CheckReturn(Outs, RetCC_PPC);
6377 for (
unsigned i = 0; i != RVLocs.
size(); ++i) {
6408 if (PPC::G8RCRegClass.
contains(*I))
6410 else if (PPC::F8RCRegClass.
contains(*I))
6412 else if (PPC::CRRCRegClass.
contains(*I))
6414 else if (PPC::VRRCRegClass.
contains(*I))
6425 RetOps.push_back(Flag);
6431 PPCTargetLowering::LowerGET_DYNAMIC_AREA_OFFSET(
SDValue Op,
6440 SDValue FPSIdx = getFramePointerFrameIndex(DAG);
6442 SDValue Ops[2] = {Chain, FPSIdx};
6456 bool isPPC64 = Subtarget.
isPPC64();
6457 unsigned SP = isPPC64 ? PPC::X1 : PPC::R1;
6477 bool isPPC64 = Subtarget.
isPPC64();
6492 FI->setReturnAddrSaveIndex(RASI);
6498 PPCTargetLowering::getFramePointerFrameIndex(
SelectionDAG & DAG)
const {
6500 bool isPPC64 = Subtarget.
isPPC64();
6515 FI->setFramePointerSaveIndex(FPSI);
6533 SDValue FPSIdx = getFramePointerFrameIndex(DAG);
6535 SDValue Ops[3] = { Chain, NegSize, FPSIdx };
6544 bool isPPC64 = Subtarget.
isPPC64();
6568 return LowerVectorLoad(Op, DAG);
6571 "Custom lowering only for i1 loads");
6593 return LowerVectorStore(Op, DAG);
6596 "Custom lowering only for i1 stores");
6616 "Custom lowering only for i1 results");
6731 void PPCTargetLowering::LowerFP_TO_INTForReuse(
SDValue Op, ReuseLoadInfo &RLI,
6733 const SDLoc &dl)
const {
6736 if (Src.getValueType() ==
MVT::f32)
6751 "i64 FP_TO_UINT is supported only with FPCVT");
6762 int FI = cast<FrameIndexSDNode>(FIPtr)->getIndex();
6796 const SDLoc &dl)
const {
6800 if (Src.getValueType() ==
MVT::f32)
6816 "i64 FP_TO_UINT is supported only with FPCVT");
6827 const SDLoc &dl)
const {
6829 return LowerFP_TO_INTDirectMove(Op, DAG, dl);
6832 LowerFP_TO_INTForReuse(Op, RLI, DAG, dl);
6835 RLI.Alignment, RLI.MMOFlags(), RLI.AAInfo, RLI.Ranges);
6846 bool PPCTargetLowering::canReuseLoadAddress(
SDValue Op,
EVT MemVT,
6857 LowerFP_TO_INTForReuse(Op, RLI, DAG, dl);
6871 "Non-pre-inc AM on PPC?");
6892 void PPCTargetLowering::spliceIntoChain(
SDValue ResChain,
6898 SDLoc dl(NewResChain);
6903 "A new TF really is required here");
6912 bool PPCTargetLowering::directMoveIsProfitable(
const SDValue &Op)
const {
6928 if (UI.getUse().get().getResNo() != 0)
6944 const SDLoc &dl)
const {
6947 "Invalid floating point type as target of conversion");
6949 "Int to FP conversions with direct moves require FPCVT");
6987 Value = DAG.
getNode(
ISD::FMA, dl, MVT::v4f64, Value, FPHalfs, FPHalfs);
7007 if (Subtarget.
hasDirectMove() && directMoveIsProfitable(Op) &&
7009 return LowerINT_TO_FPDirectMove(Op, DAG, dl);
7012 "UINT_TO_FP is supported only with FPCVT");
7077 if (canReuseLoadAddress(SINT,
MVT::i64, RLI, DAG)) {
7078 Bits = DAG.
getLoad(MVT::f64, dl, RLI.Chain, RLI.Ptr, RLI.MPI,
7079 RLI.Alignment, RLI.MMOFlags(), RLI.AAInfo, RLI.Ranges);
7080 spliceIntoChain(RLI.ResChain, Bits.
getValue(1), DAG);
7082 canReuseLoadAddress(SINT, MVT::i32, RLI, DAG,
ISD::SEXTLOAD)) {
7085 RLI.Alignment, RLI.AAInfo, RLI.Ranges);
7086 SDValue Ops[] = { RLI.Chain, RLI.Ptr };
7090 spliceIntoChain(RLI.ResChain, Bits.
getValue(1), DAG);
7092 canReuseLoadAddress(SINT, MVT::i32, RLI, DAG,
ISD::ZEXTLOAD)) {
7095 RLI.Alignment, RLI.AAInfo, RLI.Ranges);
7096 SDValue Ops[] = { RLI.Chain, RLI.Ptr };
7100 spliceIntoChain(RLI.ResChain, Bits.
getValue(1), DAG);
7117 assert(cast<StoreSDNode>(Store)->getMemoryVT() == MVT::i32 &&
7118 "Expected an i32 store");
7128 RLI.Alignment, RLI.AAInfo, RLI.Ranges);
7129 SDValue Ops[] = { RLI.Chain, RLI.Ptr };
7146 "Unhandled INT_TO_FP type in custom expander!");
7169 assert(cast<StoreSDNode>(Store)->getMemoryVT() == MVT::i32 &&
7170 "Expected an i32 store");
7181 RLI.Alignment, RLI.AAInfo, RLI.Ranges);
7182 SDValue Ops[] = { RLI.Chain, RLI.Ptr };
7188 spliceIntoChain(RLI.ResChain, Ld.getValue(1), DAG);
7191 "i32->FP without LFIWAX supported only on PPC64");
7206 MVT::f64, dl, Store, FIdx,
7306 SDValue OutOps[] = { OutLo, OutHi };
7335 SDValue OutOps[] = { OutLo, OutHi };
7364 SDValue OutOps[] = { OutLo, OutHi };
7376 assert(Val >= -16 && Val <= 15 &&
"vsplti is out of range!");
7378 static const MVT VTys[] = {
7388 EVT CanonicalVT = VTys[SplatSize-1];
7420 DAG.
getConstant(IID, dl, MVT::i32), Op0, Op1, Op2);
7432 for (
unsigned i = 0; i != 16; ++i)
7451 bool HasDirectMove) {
7458 bool IsSplat =
true;
7459 bool IsLoad =
false;
7486 return !(IsSplat && IsLoad);
7498 assert(BVN &&
"Expected a BuildVectorSDNode in LowerBUILD_VECTOR");
7512 "BUILD_VECTOR for v4i1 does not have 4 operands");
7515 for (
unsigned i = 0; i < 4; ++i) {
7517 if (!isa<ConstantSDNode>(BVN->
getOperand(i))) {
7530 for (
unsigned i = 0; i < 4; ++i) {
7551 for (
unsigned i = 0; i < 4; ++i) {
7559 if (StoreSize > 4) {
7574 if (!Stores.
empty())
7585 DAG.
getConstant(Intrinsic::ppc_qpx_qvlfiwz, dl, MVT::i32),
7592 DAG.
getConstant(Intrinsic::ppc_qpx_qvfcfidu, dl, MVT::i32),
7605 APInt APSplatBits, APSplatUndef;
7606 unsigned SplatBitSize;
7610 SplatBitSize > 32) {
7614 if (Subtarget.
hasVSX() &&
7622 unsigned SplatSize = SplatBitSize / 8;
7627 if (SplatBits == 0) {
7653 int32_t SextVal= (int32_t(SplatBits << (32-SplatBitSize)) >>
7655 if (SextVal >= -16 && SextVal <= 15)
7667 if (SextVal >= -32 && SextVal <= 31) {
7685 if (SplatSize == 4 && SplatBits == (0x7FFFFFFF&~SplatUndef)) {
7699 static const signed char SplatCsts[] = {
7700 -1, 1, -2, 2, -3, 3, -4, 4, -5, 5, -6, 6, -7, 7,
7701 -8, 8, -9, 9, -10, 10, -11, 11, -12, 12, -13, 13, 14, -14, 15, -15, -16
7707 int i = SplatCsts[idx];
7711 unsigned TypeShiftAmt = i & (SplatBitSize-1);
7714 if (SextVal == (
int)((
unsigned)i << TypeShiftAmt)) {
7716 static const unsigned IIDs[] = {
7717 Intrinsic::ppc_altivec_vslb, Intrinsic::ppc_altivec_vslh, 0,
7718 Intrinsic::ppc_altivec_vslw
7725 if (SextVal == (
int)((
unsigned)i >> TypeShiftAmt)) {
7727 static const unsigned IIDs[] = {
7728 Intrinsic::ppc_altivec_vsrb, Intrinsic::ppc_altivec_vsrh, 0,
7729 Intrinsic::ppc_altivec_vsrw
7736 if (SextVal == (
int)((
unsigned)i >> TypeShiftAmt)) {
7738 static const unsigned IIDs[] = {
7739 Intrinsic::ppc_altivec_vsrab, Intrinsic::ppc_altivec_vsrah, 0,
7740 Intrinsic::ppc_altivec_vsraw
7747 if (SextVal == (
int)(((
unsigned)i << TypeShiftAmt) |
7748 ((
unsigned)i >> (SplatBitSize-TypeShiftAmt)))) {
7750 static const unsigned IIDs[] = {
7751 Intrinsic::ppc_altivec_vrlb, Intrinsic::ppc_altivec_vrlh, 0,
7752 Intrinsic::ppc_altivec_vrlw
7759 if (SextVal == (
int)(((
unsigned)i << 8) | (i < 0 ? 0xFF : 0))) {
7765 if (SextVal == (
int)(((
unsigned)i << 16) | (i < 0 ? 0xFFFF : 0))) {
7771 if (SextVal == (
int)(((
unsigned)i << 24) | (i < 0 ? 0xFFFFFF : 0))) {
7786 unsigned OpNum = (PFEntry >> 26) & 0x0F;
7787 unsigned LHSID = (PFEntry >> 13) & ((1 << 13)-1);
7788 unsigned RHSID = (PFEntry >> 0) & ((1 << 13)-1);
7803 if (OpNum == OP_COPY) {
7804 if (LHSID == (1*9+2)*9+3)
return LHS;
7805 assert(LHSID == ((4*9+5)*9+6)*9+7 &&
"Illegal OP_COPY!");
7817 ShufIdxs[ 0] = 0; ShufIdxs[ 1] = 1; ShufIdxs[ 2] = 2; ShufIdxs[ 3] = 3;
7818 ShufIdxs[ 4] = 16; ShufIdxs[ 5] = 17; ShufIdxs[ 6] = 18; ShufIdxs[ 7] = 19;
7819 ShufIdxs[ 8] = 4; ShufIdxs[ 9] = 5; ShufIdxs[10] = 6; ShufIdxs[11] = 7;
7820 ShufIdxs[12] = 20; ShufIdxs[13] = 21; ShufIdxs[14] = 22; ShufIdxs[15] = 23;
7823 ShufIdxs[ 0] = 8; ShufIdxs[ 1] = 9; ShufIdxs[ 2] = 10; ShufIdxs[ 3] = 11;
7824 ShufIdxs[ 4] = 24; ShufIdxs[ 5] = 25; ShufIdxs[ 6] = 26; ShufIdxs[ 7] = 27;
7825 ShufIdxs[ 8] = 12; ShufIdxs[ 9] = 13; ShufIdxs[10] = 14; ShufIdxs[11] = 15;
7826 ShufIdxs[12] = 28; ShufIdxs[13] = 29; ShufIdxs[14] = 30; ShufIdxs[15] = 31;
7829 for (
unsigned i = 0; i != 16; ++i)
7830 ShufIdxs[i] = (i&3)+0;
7833 for (
unsigned i = 0; i != 16; ++i)
7834 ShufIdxs[i] = (i&3)+4;
7837 for (
unsigned i = 0; i != 16; ++i)
7838 ShufIdxs[i] = (i&3)+8;
7841 for (
unsigned i = 0; i != 16; ++i)
7842 ShufIdxs[i] = (i&3)+12;
7871 unsigned ShiftElts, InsertAtByte;
7893 if (Subtarget.
hasVSX() &&
7906 if (Subtarget.
hasVSX() &&
7939 if (Subtarget.
hasVSX()) {
7946 ((isLittleEndian && SplatIdx == 3) ||
7947 (!isLittleEndian && SplatIdx == 0))) {
7968 if (Subtarget.
hasQPX()) {
7969 if (VT.getVectorNumElements() != 4)
7975 if (AlignIdx != -1) {
7980 if (SplatIdx >= 4) {
7993 for (
unsigned i = 0; i < 4; ++i) {
7995 unsigned mm = m >= 0 ? (
unsigned) m : i;
7996 idx |= mm << (3-i)*3;
8031 unsigned int ShuffleKind = isLittleEndian ? 2 : 0;
8051 unsigned PFIndexes[4];
8052 bool isFourElementShuffle =
true;
8053 for (
unsigned i = 0; i != 4 && isFourElementShuffle; ++i) {
8055 for (
unsigned j = 0; j != 4; ++j) {
8056 if (PermMask[i*4+j] < 0)
8059 unsigned ByteSource = PermMask[i*4+j];
8060 if ((ByteSource & 3) != j) {
8061 isFourElementShuffle =
false;
8066 EltNo = ByteSource/4;
8067 }
else if (EltNo != ByteSource/4) {
8068 isFourElementShuffle =
false;
8072 PFIndexes[i] = EltNo;
8080 if (isFourElementShuffle && !isLittleEndian) {
8082 unsigned PFTableIndex =
8083 PFIndexes[0]*9*9*9+PFIndexes[1]*9*9+PFIndexes[2]*9+PFIndexes[3];
8086 unsigned Cost = (PFEntry >> 30);
8118 for (
unsigned i = 0, e = VT.getVectorNumElements(); i != e; ++i) {
8119 unsigned SrcElt = PermMask[i] < 0 ? 0 : PermMask[i];
8121 for (
unsigned j = 0; j != BytesPerElement; ++j)
8144 unsigned IntrinsicID =
8145 cast<ConstantSDNode>(Intrin.
getOperand(0))->getZExtValue();
8148 switch (IntrinsicID) {
8152 case Intrinsic::ppc_altivec_vcmpbfp_p:
8156 case Intrinsic::ppc_altivec_vcmpeqfp_p:
8160 case Intrinsic::ppc_altivec_vcmpequb_p:
8164 case Intrinsic::ppc_altivec_vcmpequh_p:
8168 case Intrinsic::ppc_altivec_vcmpequw_p:
8172 case Intrinsic::ppc_altivec_vcmpequd_p:
8179 case Intrinsic::ppc_altivec_vcmpneb_p:
8180 case Intrinsic::ppc_altivec_vcmpneh_p:
8181 case Intrinsic::ppc_altivec_vcmpnew_p:
8182 case Intrinsic::ppc_altivec_vcmpnezb_p:
8183 case Intrinsic::ppc_altivec_vcmpnezh_p:
8184 case Intrinsic::ppc_altivec_vcmpnezw_p:
8186 switch (IntrinsicID) {
8189 case Intrinsic::ppc_altivec_vcmpneb_p:
8192 case Intrinsic::ppc_altivec_vcmpneh_p:
8195 case Intrinsic::ppc_altivec_vcmpnew_p:
8198 case Intrinsic::ppc_altivec_vcmpnezb_p:
8201 case Intrinsic::ppc_altivec_vcmpnezh_p:
8204 case Intrinsic::ppc_altivec_vcmpnezw_p:
8212 case Intrinsic::ppc_altivec_vcmpgefp_p:
8216 case Intrinsic::ppc_altivec_vcmpgtfp_p:
8220 case Intrinsic::ppc_altivec_vcmpgtsb_p:
8224 case Intrinsic::ppc_altivec_vcmpgtsh_p:
8228 case Intrinsic::ppc_altivec_vcmpgtsw_p:
8232 case Intrinsic::ppc_altivec_vcmpgtsd_p:
8239 case Intrinsic::ppc_altivec_vcmpgtub_p:
8243 case Intrinsic::ppc_altivec_vcmpgtuh_p:
8247 case Intrinsic::ppc_altivec_vcmpgtuw_p:
8251 case Intrinsic::ppc_altivec_vcmpgtud_p:
8260 case Intrinsic::ppc_vsx_xvcmpeqdp_p:
8261 case Intrinsic::ppc_vsx_xvcmpgedp_p:
8262 case Intrinsic::ppc_vsx_xvcmpgtdp_p:
8263 case Intrinsic::ppc_vsx_xvcmpeqsp_p:
8264 case Intrinsic::ppc_vsx_xvcmpgesp_p:
8265 case Intrinsic::ppc_vsx_xvcmpgtsp_p:
8266 if (Subtarget.
hasVSX()) {
8267 switch (IntrinsicID) {
8268 case Intrinsic::ppc_vsx_xvcmpeqdp_p:
8271 case Intrinsic::ppc_vsx_xvcmpgedp_p:
8274 case Intrinsic::ppc_vsx_xvcmpgtdp_p:
8277 case Intrinsic::ppc_vsx_xvcmpeqsp_p:
8280 case Intrinsic::ppc_vsx_xvcmpgesp_p:
8283 case Intrinsic::ppc_vsx_xvcmpgtsp_p:
8293 case Intrinsic::ppc_altivec_vcmpbfp:
8296 case Intrinsic::ppc_altivec_vcmpeqfp:
8299 case Intrinsic::ppc_altivec_vcmpequb:
8302 case Intrinsic::ppc_altivec_vcmpequh:
8305 case Intrinsic::ppc_altivec_vcmpequw:
8308 case Intrinsic::ppc_altivec_vcmpequd:
8314 case Intrinsic::ppc_altivec_vcmpneb:
8315 case Intrinsic::ppc_altivec_vcmpneh:
8316 case Intrinsic::ppc_altivec_vcmpnew:
8317 case Intrinsic::ppc_altivec_vcmpnezb:
8318 case Intrinsic::ppc_altivec_vcmpnezh:
8319 case Intrinsic::ppc_altivec_vcmpnezw:
8321 switch (IntrinsicID) {
8324 case Intrinsic::ppc_altivec_vcmpneb:
8327 case Intrinsic::ppc_altivec_vcmpneh:
8330 case Intrinsic::ppc_altivec_vcmpnew:
8333 case Intrinsic::ppc_altivec_vcmpnezb:
8336 case Intrinsic::ppc_altivec_vcmpnezh:
8339 case Intrinsic::ppc_altivec_vcmpnezw:
8346 case Intrinsic::ppc_altivec_vcmpgefp:
8349 case Intrinsic::ppc_altivec_vcmpgtfp:
8352 case Intrinsic::ppc_altivec_vcmpgtsb:
8355 case Intrinsic::ppc_altivec_vcmpgtsh:
8358 case Intrinsic::ppc_altivec_vcmpgtsw:
8361 case Intrinsic::ppc_altivec_vcmpgtsd:
8367 case Intrinsic::ppc_altivec_vcmpgtub:
8370 case Intrinsic::ppc_altivec_vcmpgtuh:
8373 case Intrinsic::ppc_altivec_vcmpgtuw:
8376 case Intrinsic::ppc_altivec_vcmpgtud:
8390 unsigned IntrinsicID =
8391 cast<ConstantSDNode>(Op.
getOperand(0))->getZExtValue();
8393 if (IntrinsicID == Intrinsic::thread_pointer) {
8434 switch (cast<ConstantSDNode>(Op.
getOperand(1))->getZExtValue()) {
8437 BitNo = 0; InvertBit =
false;
8440 BitNo = 0; InvertBit =
true;
8443 BitNo = 2; InvertBit =
false;
8446 BitNo = 2; InvertBit =
true;
8468 int ArgStart = isa<ConstantSDNode>(Op.
getOperand(0)) ? 0 : 1;
8470 switch (cast<ConstantSDNode>(Op.
getOperand(ArgStart))->getZExtValue()) {
8471 case Intrinsic::ppc_cfence: {
8472 assert(ArgStart == 1 &&
"llvm.ppc.cfence must carry a chain argument.");
8473 assert(Subtarget.
isPPC64() &&
"Only 64-bit is supported for now.");
8541 "Should only be called for ISD::INSERT_VECTOR_ELT");
8555 "Unknown extract_vector_elt type");
8571 Value = DAG.
getNode(
ISD::FMA, dl, MVT::v4f64, Value, FPHalfs, FPHalfs);
8575 DAG.
getConstant(Intrinsic::ppc_qpx_qvfctiwu, dl, MVT::i32),
8587 DAG.
getConstant(Intrinsic::ppc_qpx_qvstfiw, dl, MVT::i32),
8595 unsigned Offset = 4*cast<ConstantSDNode>(N->
getOperand(1))->getZExtValue();
8629 SDValue Vals[4], LoadChains[4];
8630 for (
unsigned Idx = 0; Idx < 4; ++Idx) {
8632 if (ScalarVT != ScalarMemVT)
8636 ScalarMemVT,
MinAlign(Alignment, Idx * Stride),
8639 Load = DAG.
getLoad(ScalarVT, dl, LoadChain, BasePtr,
8646 "Unknown addressing mode on vector load");
8652 LoadChains[Idx] = Load.
getValue(1);
8656 BasePtr.getValueType()));
8667 SDValue RetOps[] = { Value, TF };
8677 SDValue VectElmts[4], VectElmtChains[4];
8678 for (
unsigned i = 0; i < 4; ++i) {
8680 Idx = DAG.
getNode(
ISD::ADD, dl, BasePtr.getValueType(), BasePtr, Idx);
8686 VectElmtChains[i] = VectElmts[i].
getValue(1);
8692 SDValue RVals[] = { Value, LoadChain };
8719 for (
unsigned Idx = 0; Idx < 4; ++Idx) {
8724 if (ScalarVT != ScalarMemVT)
8728 ScalarMemVT,
MinAlign(Alignment, Idx * Stride),
8731 Store = DAG.
getStore(StoreChain, dl, Ex, BasePtr,
8738 "Unknown addressing mode on vector store");
8746 Stores[Idx] =
Store;
8771 Value = DAG.
getNode(
ISD::FMA, dl, MVT::v4f64, Value, FPHalfs, FPHalfs);
8775 DAG.
getConstant(Intrinsic::ppc_qpx_qvfctiwu, dl, MVT::i32),
8786 DAG.
getConstant(Intrinsic::ppc_qpx_qvstfiw, dl, MVT::i32),
8794 SDValue Loads[4], LoadChains[4];
8795 for (
unsigned i = 0; i < 4; ++i) {
8796 unsigned Offset = 4*i;
8800 Loads[i] = DAG.
getLoad(MVT::i32, dl, StoreChain, Idx,
8802 LoadChains[i] = Loads[i].
getValue(1);
8808 for (
unsigned i = 0; i < 4; ++i) {
8856 LHS, RHS, Zero, DAG, dl);
8876 for (
unsigned i = 0; i != 8; ++i) {
8877 if (isLittleEndian) {
8879 Ops[i*2+1] = 2*i+16;
8882 Ops[i*2+1] = 2*i+1+16;
8908 return LowerVASTART(Op, DAG);
8911 return LowerVAARG(Op, DAG);
8914 return LowerVACOPY(Op, DAG);
8917 return LowerSTACKRESTORE(Op, DAG);
8920 return LowerDYNAMIC_STACKALLOC(Op, DAG);
8923 return LowerGET_DYNAMIC_AREA_OFFSET(Op, DAG);
8926 return LowerEH_DWARF_CFA(Op, DAG);
8931 case ISD::LOAD:
return LowerLOAD(Op, DAG);
8955 case ISD::MUL:
return LowerMUL(Op, DAG);
8965 return LowerINTRINSIC_VOID(Op, DAG);
8968 return LowerREM(Op, DAG);
8978 llvm_unreachable(
"Do not know how to custom type legalize this operation!");
8989 if (cast<ConstantSDNode>(N->
getOperand(1))->getZExtValue() !=
8990 Intrinsic::ppc_is_decremented_ctr_nonzero)
8994 "Unexpected result type for CTR decrement intrinsic");
9077 if (isa<LoadInst>(Inst) && Subtarget.
isPPC64())
9081 Intrinsic::ppc_cfence, {Inst->
getType()}),
9091 unsigned AtomicSize,
9094 unsigned CmpPred)
const {
9098 auto LoadMnemonic = PPC::LDARX;
9099 auto StoreMnemonic = PPC::STDCX;
9100 switch (AtomicSize) {
9104 LoadMnemonic = PPC::LBARX;
9105 StoreMnemonic = PPC::STBCX;
9109 LoadMnemonic = PPC::LHARX;
9110 StoreMnemonic = PPC::STHCX;
9114 LoadMnemonic = PPC::LWARX;
9115 StoreMnemonic = PPC::STWCX;
9118 LoadMnemonic = PPC::LDARX;
9119 StoreMnemonic = PPC::STDCX;
9146 unsigned TmpReg = (!BinOpcode) ? incr :
9148 : &PPC::GPRCRegClass);
9173 BuildMI(BB, dl, TII->
get(LoadMnemonic), dest)
9174 .addReg(ptrA).
addReg(ptrB);
9179 if (CmpOpcode == PPC::CMPW && AtomicSize < 4) {
9181 BuildMI(BB, dl, TII->
get(AtomicSize == 1 ? PPC::EXTSB : PPC::EXTSH),
9182 ExtReg).addReg(dest);
9183 BuildMI(BB, dl, TII->
get(CmpOpcode), PPC::CR0)
9184 .addReg(incr).
addReg(ExtReg);
9186 BuildMI(BB, dl, TII->
get(CmpOpcode), PPC::CR0)
9187 .addReg(incr).
addReg(dest);
9214 unsigned CmpPred)
const {
9218 CmpOpcode, CmpPred);
9226 bool is64bit = Subtarget.
isPPC64();
9228 unsigned ZeroReg = is64bit ? PPC::ZERO8 : PPC::ZERO;
9254 : &PPC::GPRCRegClass;
9294 if (ptrA != ZeroReg) {
9296 BuildMI(BB, dl, TII->
get(is64bit ? PPC::ADD8 : PPC::ADD4), Ptr1Reg)
9297 .addReg(ptrA).
addReg(ptrB);
9301 BuildMI(BB, dl, TII->
get(PPC::RLWINM), Shift1Reg).addReg(Ptr1Reg)
9303 if (!isLittleEndian)
9304 BuildMI(BB, dl, TII->
get(is64bit ? PPC::XORI8 : PPC::XORI), ShiftReg)
9305 .addReg(Shift1Reg).
addImm(is8bit ? 24 : 16);
9307 BuildMI(BB, dl, TII->
get(PPC::RLDICR), PtrReg)
9310 BuildMI(BB, dl, TII->
get(PPC::RLWINM), PtrReg)
9312 BuildMI(BB, dl, TII->
get(PPC::SLW), Incr2Reg)
9313 .addReg(incr).
addReg(ShiftReg);
9315 BuildMI(BB, dl, TII->
get(PPC::LI), Mask2Reg).addImm(255);
9317 BuildMI(BB, dl, TII->
get(PPC::LI), Mask3Reg).addImm(0);
9318 BuildMI(BB, dl, TII->
get(PPC::ORI),Mask2Reg).addReg(Mask3Reg).
addImm(65535);
9321 .addReg(Mask2Reg).
addReg(ShiftReg);
9324 BuildMI(BB, dl, TII->
get(PPC::LWARX), TmpDestReg)
9325 .addReg(ZeroReg).
addReg(PtrReg);
9328 .addReg(Incr2Reg).
addReg(TmpDestReg);
9329 BuildMI(BB, dl, TII->
get(is64bit ? PPC::ANDC8 : PPC::ANDC), Tmp2Reg)
9330 .addReg(TmpDestReg).
addReg(MaskReg);
9332 .addReg(TmpReg).
addReg(MaskReg);
9337 BuildMI(BB, dl, TII->
get(is64bit ? PPC::AND8 : PPC::AND), SReg)
9338 .addReg(TmpDestReg).
addReg(MaskReg);
9339 unsigned ValueReg = SReg;
9340 unsigned CmpReg = Incr2Reg;
9341 if (CmpOpcode == PPC::CMPW) {
9343 BuildMI(BB, dl, TII->
get(PPC::SRW), ValueReg)
9344 .addReg(SReg).
addReg(ShiftReg);
9346 BuildMI(BB, dl, TII->
get(is8bit ? PPC::EXTSB : PPC::EXTSH), ValueSReg)
9348 ValueReg = ValueSReg;
9351 BuildMI(BB, dl, TII->
get(CmpOpcode), PPC::CR0)
9352 .addReg(CmpReg).
addReg(ValueReg);
9360 .addReg(Tmp3Reg).
addReg(Tmp2Reg);
9371 BuildMI(*BB, BB->
begin(), dl, TII->
get(PPC::SRW), dest).addReg(TmpDestReg)
9395 assert(TRI->isTypeLegalForClass(*RC, MVT::i32) &&
"Invalid destination!");
9401 "Invalid Pointer Size!");
9454 MIB =
BuildMI(*thisMBB, MI, DL, TII->
get(PPC::STD))
9465 BaseReg = Subtarget.
isPPC64() ? PPC::X1 : PPC::R1;
9467 BaseReg = Subtarget.
isPPC64() ? PPC::BP8 : PPC::BP;
9469 MIB =
BuildMI(*thisMBB, MI, DL,
9470 TII->
get(Subtarget.
isPPC64() ? PPC::STD : PPC::STW))
9477 MIB =
BuildMI(*thisMBB, MI, DL, TII->
get(PPC::BCLalways)).addMBB(mainMBB);
9480 BuildMI(*thisMBB, MI, DL, TII->
get(PPC::LI), restoreDstReg).addImm(1);
9482 MIB =
BuildMI(*thisMBB, MI, DL, TII->
get(PPC::EH_SjLj_Setup))
9493 TII->
get(Subtarget.
isPPC64() ? PPC::MFLR8 : PPC::MFLR), LabelReg);
9497 MIB =
BuildMI(mainMBB, DL, TII->
get(PPC::STD))
9502 MIB =
BuildMI(mainMBB, DL, TII->
get(PPC::STW))
9510 BuildMI(mainMBB, DL, TII->
get(PPC::LI), mainDstReg).addImm(0);
9515 TII->
get(PPC::PHI), DstReg)
9516 .addReg(mainDstReg).
addMBB(mainMBB)
9538 "Invalid Pointer Size!");
9541 (PVT ==
MVT::i64) ? &PPC::G8RCRegClass : &PPC::GPRCRegClass;
9544 unsigned FP = (PVT ==
MVT::i64) ? PPC::X31 : PPC::R31;
9545 unsigned SP = (PVT ==
MVT::i64) ? PPC::X1 : PPC::R1;
9569 MIB =
BuildMI(*MBB, MI, DL, TII->
get(PPC::LWZ), FP)
9578 .addImm(LabelOffset)
9581 MIB =
BuildMI(*MBB, MI, DL, TII->
get(PPC::LWZ), Tmp)
9582 .addImm(LabelOffset)
9593 MIB =
BuildMI(*MBB, MI, DL, TII->
get(PPC::LWZ), SP)
9605 MIB =
BuildMI(*MBB, MI, DL, TII->
get(PPC::LWZ), BP)
9633 if (MI.
getOpcode() == TargetOpcode::STACKMAP ||
9634 MI.
getOpcode() == TargetOpcode::PATCHPOINT) {
9636 MI.
getOpcode() == TargetOpcode::PATCHPOINT) {
9649 if (MI.
getOpcode() == PPC::EH_SjLj_SetJmp32 ||
9650 MI.
getOpcode() == PPC::EH_SjLj_SetJmp64) {
9652 }
else if (MI.
getOpcode() == PPC::EH_SjLj_LongJmp32 ||
9653 MI.
getOpcode() == PPC::EH_SjLj_LongJmp64) {
9666 if (MI.
getOpcode() == PPC::SELECT_CC_I4 ||
9670 if (MI.
getOpcode() == PPC::SELECT_CC_I4 ||
9680 }
else if (MI.
getOpcode() == PPC::SELECT_CC_I4 ||
9684 MI.
getOpcode() == PPC::SELECT_CC_QFRC ||
9685 MI.
getOpcode() == PPC::SELECT_CC_QSRC ||
9686 MI.
getOpcode() == PPC::SELECT_CC_QBRC ||
9687 MI.
getOpcode() == PPC::SELECT_CC_VRRC ||
9688 MI.
getOpcode() == PPC::SELECT_CC_VSFRC ||
9689 MI.
getOpcode() == PPC::SELECT_CC_VSSRC ||
9690 MI.
getOpcode() == PPC::SELECT_CC_VSRC ||
9765 }
else if (MI.
getOpcode() == PPC::ReadTB) {
9797 BuildMI(BB, dl, TII->
get(PPC::MFSPR), HiReg).addImm(269);
9798 BuildMI(BB, dl, TII->
get(PPC::MFSPR), LoReg).addImm(268);
9799 BuildMI(BB, dl, TII->
get(PPC::MFSPR), ReadAgainReg).addImm(269);
9804 .addReg(HiReg).
addReg(ReadAgainReg);
9810 }
else if (MI.
getOpcode() == PPC::ATOMIC_LOAD_ADD_I8)
9812 else if (MI.
getOpcode() == PPC::ATOMIC_LOAD_ADD_I16)
9814 else if (MI.
getOpcode() == PPC::ATOMIC_LOAD_ADD_I32)
9816 else if (MI.
getOpcode() == PPC::ATOMIC_LOAD_ADD_I64)
9819 else if (MI.
getOpcode() == PPC::ATOMIC_LOAD_AND_I8)
9821 else if (MI.
getOpcode() == PPC::ATOMIC_LOAD_AND_I16)
9823 else if (MI.
getOpcode() == PPC::ATOMIC_LOAD_AND_I32)
9825 else if (MI.
getOpcode() == PPC::ATOMIC_LOAD_AND_I64)
9828 else if (MI.
getOpcode() == PPC::ATOMIC_LOAD_OR_I8)
9830 else if (MI.
getOpcode() == PPC::ATOMIC_LOAD_OR_I16)
9832 else if (MI.
getOpcode() == PPC::ATOMIC_LOAD_OR_I32)
9834 else if (MI.
getOpcode() == PPC::ATOMIC_LOAD_OR_I64)
9837 else if (MI.
getOpcode() == PPC::ATOMIC_LOAD_XOR_I8)
9839 else if (MI.
getOpcode() == PPC::ATOMIC_LOAD_XOR_I16)
9841 else if (MI.
getOpcode() == PPC::ATOMIC_LOAD_XOR_I32)
9843 else if (MI.
getOpcode() == PPC::ATOMIC_LOAD_XOR_I64)
9846 else if (MI.
getOpcode() == PPC::ATOMIC_LOAD_NAND_I8)
9848 else if (MI.
getOpcode() == PPC::ATOMIC_LOAD_NAND_I16)
9850 else if (MI.
getOpcode() == PPC::ATOMIC_LOAD_NAND_I32)
9852 else if (MI.
getOpcode() == PPC::ATOMIC_LOAD_NAND_I64)
9855 else if (MI.
getOpcode() == PPC::ATOMIC_LOAD_SUB_I8)
9857 else if (MI.
getOpcode() == PPC::ATOMIC_LOAD_SUB_I16)
9859 else if (MI.
getOpcode() == PPC::ATOMIC_LOAD_SUB_I32)
9861 else if (MI.
getOpcode() == PPC::ATOMIC_LOAD_SUB_I64)
9864 else if (MI.
getOpcode() == PPC::ATOMIC_LOAD_MIN_I8)
9866 else if (MI.
getOpcode() == PPC::ATOMIC_LOAD_MIN_I16)
9868 else if (MI.
getOpcode() == PPC::ATOMIC_LOAD_MIN_I32)
9870 else if (MI.
getOpcode() == PPC::ATOMIC_LOAD_MIN_I64)
9873 else if (MI.
getOpcode() == PPC::ATOMIC_LOAD_MAX_I8)
9875 else if (MI.
getOpcode() == PPC::ATOMIC_LOAD_MAX_I16)
9877 else if (MI.
getOpcode() == PPC::ATOMIC_LOAD_MAX_I32)
9879 else if (MI.
getOpcode() == PPC::ATOMIC_LOAD_MAX_I64)
9882 else if (MI.
getOpcode() == PPC::ATOMIC_LOAD_UMIN_I8)
9884 else if (MI.
getOpcode() == PPC::ATOMIC_LOAD_UMIN_I16)
9886 else if (MI.
getOpcode() == PPC::ATOMIC_LOAD_UMIN_I32)
9888 else if (MI.
getOpcode() == PPC::ATOMIC_LOAD_UMIN_I64)
9891 else if (MI.
getOpcode() == PPC::ATOMIC_LOAD_UMAX_I8)
9893 else if (MI.
getOpcode() == PPC::ATOMIC_LOAD_UMAX_I16)
9895 else if (MI.
getOpcode() == PPC::ATOMIC_LOAD_UMAX_I32)
9897 else if (MI.
getOpcode() == PPC::ATOMIC_LOAD_UMAX_I64)
9900 else if (MI.
getOpcode() == PPC::ATOMIC_SWAP_I8)
9902 else if (MI.
getOpcode() == PPC::ATOMIC_SWAP_I16)
9904 else if (MI.
getOpcode() == PPC::ATOMIC_SWAP_I32)
9906 else if (MI.
getOpcode() == PPC::ATOMIC_SWAP_I64)
9908 else if (MI.
getOpcode() == PPC::ATOMIC_CMP_SWAP_I32 ||
9909 MI.
getOpcode() == PPC::ATOMIC_CMP_SWAP_I64 ||
9911 MI.
getOpcode() == PPC::ATOMIC_CMP_SWAP_I8) ||
9913 MI.
getOpcode() == PPC::ATOMIC_CMP_SWAP_I16)) {
9914 bool is64bit = MI.
getOpcode() == PPC::ATOMIC_CMP_SWAP_I64;
9916 auto LoadMnemonic = PPC::LDARX;
9917 auto StoreMnemonic = PPC::STDCX;
9921 case PPC::ATOMIC_CMP_SWAP_I8:
9922 LoadMnemonic = PPC::LBARX;
9923 StoreMnemonic = PPC::STBCX;
9926 case PPC::ATOMIC_CMP_SWAP_I16:
9927 LoadMnemonic = PPC::LHARX;
9928 StoreMnemonic = PPC::STHCX;
9931 case PPC::ATOMIC_CMP_SWAP_I32:
9932 LoadMnemonic = PPC::LWARX;
9933 StoreMnemonic = PPC::STWCX;
9935 case PPC::ATOMIC_CMP_SWAP_I64:
9936 LoadMnemonic = PPC::LDARX;
9937 StoreMnemonic = PPC::STDCX;
9976 BuildMI(BB, dl, TII->
get(LoadMnemonic), dest)
9977 .addReg(ptrA).
addReg(ptrB);
9978 BuildMI(BB, dl, TII->
get(is64bit ? PPC::CMPD : PPC::CMPW), PPC::CR0)
9979 .addReg(oldval).
addReg(dest);
10002 }
else if (MI.
getOpcode() == PPC::ATOMIC_CMP_SWAP_I8 ||
10003 MI.
getOpcode() == PPC::ATOMIC_CMP_SWAP_I16) {
10007 bool is64bit = Subtarget.
isPPC64();
10009 bool is8bit = MI.
getOpcode() == PPC::ATOMIC_CMP_SWAP_I8;
10022 F->
insert(It, loop1MBB);
10023 F->
insert(It, loop2MBB);
10032 : &PPC::GPRCRegClass;
10035 unsigned ShiftReg =
10049 unsigned ZeroReg = is64bit ? PPC::ZERO8 : PPC::ZERO;
10082 if (ptrA != ZeroReg) {
10084 BuildMI(BB, dl, TII->
get(is64bit ? PPC::ADD8 : PPC::ADD4), Ptr1Reg)
10085 .addReg(ptrA).
addReg(ptrB);
10089 BuildMI(BB, dl, TII->
get(PPC::RLWINM), Shift1Reg).addReg(Ptr1Reg)
10091 if (!isLittleEndian)
10092 BuildMI(BB, dl, TII->
get(is64bit ? PPC::XORI8 : PPC::XORI), ShiftReg)
10093 .addReg(Shift1Reg).
addImm(is8bit ? 24 : 16);
10095 BuildMI(BB, dl, TII->
get(PPC::RLDICR), PtrReg)
10098 BuildMI(BB, dl, TII->
get(PPC::RLWINM), PtrReg)
10100 BuildMI(BB, dl, TII->
get(PPC::SLW), NewVal2Reg)
10101 .addReg(newval).
addReg(ShiftReg);
10102 BuildMI(BB, dl, TII->
get(PPC::SLW), OldVal2Reg)
10103 .addReg(oldval).
addReg(ShiftReg);
10105 BuildMI(BB, dl, TII->
get(PPC::LI), Mask2Reg).addImm(255);
10107 BuildMI(BB, dl, TII->
get(PPC::LI), Mask3Reg).addImm(0);
10108 BuildMI(BB, dl, TII->
get(PPC::ORI), Mask2Reg)
10109 .addReg(Mask3Reg).
addImm(65535);
10111 BuildMI(BB, dl, TII->
get(PPC::SLW), MaskReg)
10112 .addReg(Mask2Reg).
addReg(ShiftReg);
10114 .addReg(NewVal2Reg).
addReg(MaskReg);
10116 .addReg(OldVal2Reg).
addReg(MaskReg);
10119 BuildMI(BB, dl, TII->
get(PPC::LWARX), TmpDestReg)
10120 .addReg(ZeroReg).
addReg(PtrReg);
10122 .addReg(TmpDestReg).
addReg(MaskReg);
10123 BuildMI(BB, dl, TII->
get(PPC::CMPW), PPC::CR0)
10124 .addReg(TmpReg).
addReg(OldVal3Reg);
10131 BuildMI(BB, dl, TII->
get(PPC::ANDC),Tmp2Reg)
10132 .addReg(TmpDestReg).
addReg(MaskReg);
10134 .addReg(Tmp2Reg).
addReg(NewVal3Reg);
10135 BuildMI(BB, dl, TII->
get(PPC::STWCX)).addReg(Tmp4Reg)
10144 BuildMI(BB, dl, TII->
get(PPC::STWCX)).addReg(TmpDestReg)
10151 BuildMI(*BB, BB->
begin(), dl, TII->
get(PPC::SRW),dest).addReg(TmpReg)
10153 }
else if (MI.
getOpcode() == PPC::FADDrtz) {
10169 BuildMI(*BB, MI, dl, TII->
get(PPC::MTFSB1)).addImm(31);
10170 BuildMI(*BB, MI, dl, TII->
get(PPC::MTFSB0)).addImm(30);
10179 MI.
getOpcode() == PPC::ANDIo_1_EQ_BIT8 ||
10180 MI.
getOpcode() == PPC::ANDIo_1_GT_BIT8) {
10181 unsigned Opcode = (MI.
getOpcode() == PPC::ANDIo_1_EQ_BIT8 ||
10182 MI.
getOpcode() == PPC::ANDIo_1_GT_BIT8)
10186 MI.
getOpcode() == PPC::ANDIo_1_EQ_BIT8);
10190 &PPC::GPRCRegClass :
10191 &PPC::G8RCRegClass);
10194 BuildMI(*BB, MI, dl, TII->
get(Opcode), Dest)
10197 BuildMI(*BB, MI, dl, TII->
get(TargetOpcode::COPY),
10199 .addReg(isEQ ? PPC::CR0EQ : PPC::CR0GT);
10200 }
else if (MI.
getOpcode() == PPC::TCHECK_RET) {
10204 BuildMI(*BB, MI, Dl, TII->
get(PPC::TCHECK), CRReg);
10223 int RefinementSteps = Subtarget.
hasRecipPrec() ? 1 : 3;
10226 return RefinementSteps;
10230 int Enabled,
int &RefinementSteps,
10231 bool &UseOneConstNR,
10232 bool Reciprocal)
const {
10235 (VT == MVT::f64 && Subtarget.
hasFRSQRTE()) ||
10239 (VT == MVT::v4f64 && Subtarget.
hasQPX())) {
10240 if (RefinementSteps == ReciprocalEstimate::Unspecified)
10243 UseOneConstNR =
true;
10251 int &RefinementSteps)
const {
10254 (VT == MVT::f64 && Subtarget.
hasFRE()) ||
10258 (VT == MVT::v4f64 && Subtarget.
hasQPX())) {
10259 if (RefinementSteps == ReciprocalEstimate::Unspecified)
10266 unsigned PPCTargetLowering::combineRepeatedFPDivisors()
const {
10294 Offset += cast<ConstantSDNode>(Loc.
getOperand(1))->getSExtValue();
10303 unsigned Bytes,
int Dist,
10313 int FI = cast<FrameIndexSDNode>(Loc)->getIndex();
10314 int BFI = cast<FrameIndexSDNode>(BaseLoc)->getIndex();
10317 if (FS != BFS || FS != (
int)Bytes)
return false;
10321 SDValue Base1 = Loc, Base2 = BaseLoc;
10322 int64_t Offset1 = 0, Offset2 = 0;
10325 if (Base1 == Base2 && Offset1 == (Offset2 + Dist * Bytes))
10335 if (isGA1 && isGA2 && GV1 == GV2)
10336 return Offset1 == (Offset2 + Dist*Bytes);
10343 unsigned Bytes,
int Dist,
10346 EVT VT =
LS->getMemoryVT();
10353 switch (cast<ConstantSDNode>(N->
getOperand(1))->getZExtValue()) {
10354 default:
return false;
10355 case Intrinsic::ppc_qpx_qvlfd:
10356 case Intrinsic::ppc_qpx_qvlfda:
10359 case Intrinsic::ppc_qpx_qvlfs:
10360 case Intrinsic::ppc_qpx_qvlfsa:
10363 case Intrinsic::ppc_qpx_qvlfcd:
10364 case Intrinsic::ppc_qpx_qvlfcda:
10367 case Intrinsic::ppc_qpx_qvlfcs:
10368 case Intrinsic::ppc_qpx_qvlfcsa:
10371 case Intrinsic::ppc_qpx_qvlfiwa:
10372 case Intrinsic::ppc_qpx_qvlfiwz:
10373 case Intrinsic::ppc_altivec_lvx:
10374 case Intrinsic::ppc_altivec_lvxl:
10375 case Intrinsic::ppc_vsx_lxvw4x:
10376 case Intrinsic::ppc_vsx_lxvw4x_be:
10379 case Intrinsic::ppc_vsx_lxvd2x:
10380 case Intrinsic::ppc_vsx_lxvd2x_be:
10383 case Intrinsic::ppc_altivec_lvebx:
10386 case Intrinsic::ppc_altivec_lvehx:
10389 case Intrinsic::ppc_altivec_lvewx:
10399 switch (cast<ConstantSDNode>(N->
getOperand(1))->getZExtValue()) {
10400 default:
return false;
10401 case Intrinsic::ppc_qpx_qvstfd:
10402 case Intrinsic::ppc_qpx_qvstfda:
10405 case Intrinsic::ppc_qpx_qvstfs:
10406 case Intrinsic::ppc_qpx_qvstfsa:
10409 case Intrinsic::ppc_qpx_qvstfcd:
10410 case Intrinsic::ppc_qpx_qvstfcda:
10413 case Intrinsic::ppc_qpx_qvstfcs:
10414 case Intrinsic::ppc_qpx_qvstfcsa:
10417 case Intrinsic::ppc_qpx_qvstfiw:
10418 case Intrinsic::ppc_qpx_qvstfiwa:
10419 case Intrinsic::ppc_altivec_stvx:
10420 case Intrinsic::ppc_altivec_stvxl:
10421 case Intrinsic::ppc_vsx_stxvw4x:
10424 case Intrinsic::ppc_vsx_stxvd2x:
10427 case Intrinsic::ppc_vsx_stxvw4x_be:
10430 case Intrinsic::ppc_vsx_stxvd2x_be:
10433 case Intrinsic::ppc_altivec_stvebx:
10436 case Intrinsic::ppc_altivec_stvehx:
10439 case Intrinsic::ppc_altivec_stvewx:
10466 while (!Queue.empty()) {
10467 SDNode *ChainNext = Queue.pop_back_val();
10468 if (!Visited.
insert(ChainNext).second)
10471 if (
MemSDNode *ChainLD = dyn_cast<MemSDNode>(ChainNext)) {
10475 if (!Visited.count(ChainLD->getChain().getNode()))
10476 Queue.push_back(ChainLD->getChain().getNode());
10478 for (
const SDUse &O : ChainNext->
ops())
10479 if (!Visited.count(O.getNode()))
10480 Queue.push_back(O.getNode());
10482 LoadRoots.
insert(ChainNext);
10494 IE = LoadRoots.end(); I !=
IE; ++
I) {
10495 Queue.push_back(*I);
10497 while (!Queue.empty()) {
10498 SDNode *LoadRoot = Queue.pop_back_val();
10499 if (!Visited.
insert(LoadRoot).second)
10502 if (
MemSDNode *ChainLD = dyn_cast<MemSDNode>(LoadRoot))
10507 UE = LoadRoot->
use_end(); UI != UE; ++UI)
10508 if (((isa<MemSDNode>(*UI) &&
10509 cast<MemSDNode>(*UI)->getChain().getNode() == LoadRoot) ||
10511 Queue.push_back(*UI);
10544 auto Final = Shifted;
10554 SDValue PPCTargetLowering::ConvertSETCCToSubtract(
SDNode *N,
10555 DAGCombinerInfo &DCI)
const {
10563 if (!DCI.isAfterLegalizeVectorOps())
10569 UE = N->
use_end(); UI != UE; ++UI) {
10577 unsigned Size = DAG.getDataLayout().getLargestLegalIntTypeSizeInBits();
10579 if (OpSize < Size) {
10596 SDValue PPCTargetLowering::DAGCombineTruncBoolExt(
SDNode *N,
10597 DAGCombinerInfo &DCI)
const {
10651 if (Op1Known.
Zero != Op2Known.
Zero || Op1Known.
One != Op2Known.
One)
10686 for (
unsigned i = 0; i < 2; ++i) {
10702 while (!BinOps.
empty()) {
10711 for (
unsigned i = 0, ie = BinOp.
getNumOperands(); i != ie; ++i) {
10745 for (
unsigned i = 0, ie = Inputs.
size(); i != ie; ++i) {
10746 if (isa<ConstantSDNode>(Inputs[i]))
10750 UE = Inputs[i].getNode()->use_end();
10753 if (User != N && !Visited.
count(User))
10772 for (
unsigned i = 0, ie = PromOps.
size(); i != ie; ++i) {
10774 UE = PromOps[i].getNode()->use_end();
10777 if (User != N && !Visited.
count(User))
10797 for (
unsigned i = 0, ie = Inputs.
size(); i != ie; ++i) {
10800 if (isa<ConstantSDNode>(Inputs[i]))
10806 std::list<HandleSDNode> PromOpHandles;
10807 for (
auto &PromOp : PromOps)
10808 PromOpHandles.emplace_back(PromOp);
10815 while (!PromOpHandles.empty()) {
10817 PromOpHandles.pop_back();
10823 if (!isa<ConstantSDNode>(PromOp.
getOperand(0)) &&
10826 PromOpHandles.emplace_front(PromOp);
10831 if (isa<ConstantSDNode>(RepValue))
10840 default: C = 0;
break;
10845 if ((!isa<ConstantSDNode>(PromOp.
getOperand(C)) &&
10847 (!isa<ConstantSDNode>(PromOp.
getOperand(C+1)) &&
10853 PromOpHandles.emplace_front(PromOp);
10861 for (
unsigned i = 0; i < 2; ++i)
10862 if (isa<ConstantSDNode>(Ops[C+i]))
10878 SDValue PPCTargetLowering::DAGCombineExtBoolTrunc(
SDNode *N,
10879 DAGCombinerInfo &DCI)
const {
10918 while (!BinOps.
empty()) {
10925 PromOps.push_back(BinOp);
10927 for (
unsigned i = 0, ie = BinOp.
getNumOperands(); i != ie; ++i) {
10958 for (
unsigned i = 0, ie = Inputs.
size(); i != ie; ++i) {
10959 if (isa<ConstantSDNode>(Inputs[i]))
10963 UE = Inputs[i].getNode()->use_end();
10966 if (User != N && !Visited.count(User))
10973 SelectTruncOp[0].insert(std::make_pair(User,
10977 SelectTruncOp[0].insert(std::make_pair(User,
10980 SelectTruncOp[1].insert(std::make_pair(User,
10986 for (
unsigned i = 0, ie = PromOps.size(); i != ie; ++i) {
10988 UE = PromOps[i].getNode()->
use_end();
10991 if (User != N && !Visited.count(User))
10998 SelectTruncOp[0].insert(std::make_pair(User,
11002 SelectTruncOp[0].insert(std::make_pair(User,
11005 SelectTruncOp[1].insert(std::make_pair(User,
11012 bool ReallyNeedsExt =
false;
11016 for (
unsigned i = 0, ie = Inputs.
size(); i != ie; ++i) {
11017 if (isa<ConstantSDNode>(Inputs[i]))
11021 Inputs[i].getOperand(0).getValueSizeInBits();
11022 assert(PromBits < OpBits &&
"Truncation not to a smaller bit count?");
11027 OpBits-PromBits))) ||
11030 (OpBits-(PromBits-1)))) {
11031 ReallyNeedsExt =
true;
11039 for (
unsigned i = 0, ie = Inputs.
size(); i != ie; ++i) {
11043 if (isa<ConstantSDNode>(Inputs[i]))
11046 SDValue InSrc = Inputs[i].getOperand(0);
11060 std::list<HandleSDNode> PromOpHandles;
11061 for (
auto &PromOp : PromOps)
11062 PromOpHandles.emplace_back(PromOp);
11068 while (!PromOpHandles.empty()) {
11070 PromOpHandles.pop_back();
11074 default: C = 0;
break;
11079 if ((!isa<ConstantSDNode>(PromOp.
getOperand(C)) &&
11081 (!isa<ConstantSDNode>(PromOp.
getOperand(C+1)) &&
11087 PromOpHandles.emplace_front(PromOp);
11099 PromOpHandles.emplace_front(PromOp);
11108 for (
unsigned i = 0; i < 2; ++i) {
11109 if (!isa<ConstantSDNode>(Ops[C+i]))
11126 auto SI0 = SelectTruncOp[0].
find(PromOp.
getNode());
11127 if (SI0 != SelectTruncOp[0].
end())
11129 auto SI1 = SelectTruncOp[1].
find(PromOp.
getNode());
11130 if (SI1 != SelectTruncOp[1].
end())
11139 if (!ReallyNeedsExt)
11151 "Invalid extension type");
11169 combineElementTruncationToVectorTruncation(
SDNode *N,
11170 DAGCombinerInfo &DCI)
const {
11172 "Should be called with a BUILD_VECTOR node");
11179 "The input operand must be an fp-to-int conversion.");
11188 bool IsSplat =
true;
11198 if (NextConversion != FirstConversion)
11220 DAG.getIntPtrConstant(1, dl));
11235 SDValue BV = DAG.getBuildVector(NewVT, dl, Ops);
11236 return DAG.
getNode(Opcode, dl, TargetVT, BV);
11249 "Should be called with a BUILD_VECTOR node");
11252 bool InputsAreConsecutiveLoads =
true;
11253 bool InputsAreReverseConsecutive =
true;
11256 bool IsRoundOfExtLoad =
false;
11283 if (IsRoundOfExtLoad && LD2->getExtensionType() !=
ISD::EXTLOAD)
11287 InputsAreConsecutiveLoads =
false;
11289 InputsAreReverseConsecutive =
false;
11292 if (!InputsAreConsecutiveLoads && !InputsAreReverseConsecutive)
11296 assert(!(InputsAreConsecutiveLoads && InputsAreReverseConsecutive) &&
11297 "The loads cannot be both consecutive and reverse consecutive.");
11300 IsRoundOfExtLoad ? FirstInput.
getOperand(0) : FirstInput;
11307 if (InputsAreConsecutiveLoads) {
11308 assert(LD1 &&
"Input needs to be a LoadSDNode.");
11313 if (InputsAreReverseConsecutive) {
11314 assert(LDL &&
"Input needs to be a LoadSDNode.");
11316 LDL->getBasePtr(), LDL->getPointerInfo(),
11317 LDL->getAlignment());
11332 SDValue Input, uint64_t Elems,
11333 uint64_t CorrectElems) {
11344 ShuffleMask[CorrectElems & 0xF] = Elems & 0xF;
11346 ShuffleMask[(CorrectElems & 0xF0) >> 4] = (Elems & 0xF0) >> 4;
11347 CorrectElems = CorrectElems >> 8;
11348 Elems = Elems >> 8;
11353 DAG.
getUNDEF(Input.getValueType()), ShuffleMask);
11376 uint64_t TargetElems[] = {
11384 uint64_t Elems = 0;
11388 auto isSExtOfVecExtract = [&](
SDValue Op) ->
bool {
11403 if (Input && Input != Extract.
getOperand(0))
11409 Elems = Elems << 8;
11419 if (!isSExtOfVecExtract(N->
getOperand(i))) {
11426 int TgtElemArrayIdx;
11429 if (InputSize + OutputSize == 40)
11430 TgtElemArrayIdx = 0;
11431 else if (InputSize + OutputSize == 72)
11432 TgtElemArrayIdx = 1;
11433 else if (InputSize + OutputSize == 48)
11434 TgtElemArrayIdx = 2;
11435 else if (InputSize + OutputSize == 80)
11436 TgtElemArrayIdx = 3;
11437 else if (InputSize + OutputSize == 96)
11438 TgtElemArrayIdx = 4;
11442 uint64_t CorrectElems = TargetElems[TgtElemArrayIdx];
11444 ? CorrectElems & 0x0F0F0F0F0F0F0F0F
11445 : CorrectElems & 0xF0F0F0F0F0F0F0F0;
11446 if (Elems != CorrectElems) {
11454 SDValue PPCTargetLowering::DAGCombineBuildVector(
SDNode *N,
11455 DAGCombinerInfo &DCI)
const {
11457 "Should be called with a BUILD_VECTOR node");
11462 if (!Subtarget.
hasVSX())
11470 SDValue Reduced = combineElementTruncationToVectorTruncation(N, DCI);
11512 if (!Ext1Op || !Ext2Op)
11520 int SecondElem = Ext2Op->getZExtValue();
11522 if (FirstElem == 0 && SecondElem == 1)
11524 else if (FirstElem == 2 && SecondElem == 3)
11533 SrcVec, DAG.getIntPtrConstant(SubvecIdx, dl));
11537 DAGCombinerInfo &DCI)
const {
11540 "Need an int -> FP conversion node here");
11551 (FirstOperand.getValueType() ==
MVT::i8 ||
11552 FirstOperand.getValueType() ==
MVT::i16);
11556 unsigned ConvOp = Signed ?
11562 LoadSDNode *LDN = cast<LoadSDNode>(FirstOperand.getNode());
11570 SDValue ExtOps[] = { Ld, WidthConst };
11572 return DAG.
getNode(ConvOp, dl, DstDouble ? MVT::f64 :
MVT::f32, Ext);
11591 "UINT_TO_FP is supported only with FPCVT");
11612 DCI.AddToWorklist(Src.
getNode());
11628 DCI.AddToWorklist(FP.
getNode());
11682 SDValue LoadOps[] = { Chain, Base };
11694 if (VecTy != MVT::v2f64) {
11763 SDValue StoreOps[] = { Chain, Swap, Base };
11766 StoreOps, VecTy, MMO);
11778 return combineSHL(N, DCI);
11780 return combineSRA(N, DCI);
11782 return combineSRL(N, DCI);
11793 if (C->isNullValue() ||
11794 C->isAllOnesValue())
11801 return DAGCombineExtBoolTrunc(N, DCI);
11805 return DAGCombineTruncBoolExt(N, DCI);
11808 return combineFPToIntToFP(N, DCI);
11811 bool ValidTypeForStoreFltAsInt = (Op1VT ==
MVT::i32) ||
11815 if (Subtarget.
hasSTFIWX() && !cast<StoreSDNode>(
N)->isTruncatingStore() &&
11817 ValidTypeForStoreFltAsInt &&
11827 if (Op1VT == MVT::i32) {
11835 cast<StoreSDNode>(
N)->getMemoryVT(),
11836 cast<StoreSDNode>(
N)->getMemOperand());
11838 unsigned WidthInBytes =
11848 cast<StoreSDNode>(
N)->getMemoryVT(),
11849 cast<StoreSDNode>(
N)->getMemOperand());
11857 if (cast<StoreSDNode>(N)->isUnindexed() &&
11871 EVT mVT = cast<StoreSDNode>(
N)->getMemoryVT();
11872 if (Op1VT.
bitsGT(mVT)) {
11886 Ops, cast<StoreSDNode>(
N)->getMemoryVT(),
11887 cast<StoreSDNode>(
N)->getMemOperand());
11908 if (VT.isSimple()) {
11909 MVT LoadVT = VT.getSimpleVT();
11923 auto ReplaceTwoFloatLoad = [&]() {
11943 while (UI.getUse().getResNo() != 0) ++UI;
11945 while (UI.getUse().getResNo() != 0) ++UI;
11946 SDNode *RightShift = *UI;
11955 !isa<ConstantSDNode>(RightShift->
getOperand(1)) ||
11985 "Non-pre-inc AM on PPC?");
12018 if (ReplaceTwoFloatLoad())
12064 MVT PermCntlTy, PermTy, LDTy;
12066 Intr = isLittleEndian ? Intrinsic::ppc_altivec_lvsr :
12067 Intrinsic::ppc_altivec_lvsl;
12068 IntrLD = Intrinsic::ppc_altivec_lvx;
12069 IntrPerm = Intrinsic::ppc_altivec_vperm;
12074 Intr = MemVT == MVT::v4f64 ? Intrinsic::ppc_qpx_qvlpcld :
12075 Intrinsic::ppc_qpx_qvlpcls;
12076 IntrLD = MemVT == MVT::v4f64 ? Intrinsic::ppc_qpx_qvlfd :
12077 Intrinsic::ppc_qpx_qvlfs;
12078 IntrPerm = Intrinsic::ppc_qpx_qvfperm;
12100 SDValue BaseLoadOps[] = { Chain, LDXIntID, Ptr };
12104 BaseLoadOps, LDTy, BaseMMO);
12112 int IncOffset = VT.getSizeInBits() / 8;
12113 int IncValue = IncOffset;
12130 SDValue ExtraLoadOps[] = { Chain, LDXIntID, Ptr };
12134 ExtraLoadOps, LDTy, ExtraMMO);
12145 if (isLittleEndian)
12147 ExtraLoad, BaseLoad, PermCntl, DAG, dl);
12150 BaseLoad, ExtraLoad, PermCntl, DAG, dl);
12169 unsigned IID = cast<ConstantSDNode>(N->
getOperand(0))->getZExtValue();
12170 Intrinsic::ID Intr = (isLittleEndian ? Intrinsic::ppc_altivec_lvsr
12171 : Intrinsic::ppc_altivec_lvsl);
12172 if ((IID == Intr ||
12173 IID == Intrinsic::ppc_qpx_qvlpcld ||
12174 IID == Intrinsic::ppc_qpx_qvlpcls) &&
12178 int Bits = IID == Intrinsic::ppc_qpx_qvlpcld ?
12189 cast<ConstantSDNode>(UI->getOperand(0))->getZExtValue() == IID) {
12199 if (isa<ConstantSDNode>(Add->
getOperand(1))) {
12202 UE = BasePtr->
use_end(); UI != UE; ++UI) {
12203 if (UI->getOpcode() ==
ISD::ADD &&
12204 isa<ConstantSDNode>(UI->getOperand(1)) &&
12205 (cast<ConstantSDNode>(Add->
getOperand(1))->getZExtValue() -
12206 cast<ConstantSDNode>(UI->getOperand(1))->getZExtValue()) %
12207 (1ULL << Bits) == 0) {
12212 cast<ConstantSDNode>(
VI->getOperand(0))->getZExtValue() == IID) {
12227 switch (cast<ConstantSDNode>(N->
getOperand(1))->getZExtValue()) {
12230 case Intrinsic::ppc_vsx_lxvw4x:
12231 case Intrinsic::ppc_vsx_lxvd2x:
12240 switch (cast<ConstantSDNode>(N->
getOperand(1))->getZExtValue()) {
12243 case Intrinsic::ppc_vsx_stxvw4x:
12244 case Intrinsic::ppc_vsx_stxvd2x:
12297 SDNode *VCMPoNode =
nullptr;
12318 SDNode *FlagUser =
nullptr;
12320 FlagUser ==
nullptr; ++UI) {
12323 for (
unsigned i = 0, e = User->getNumOperands(); i != e; ++i) {
12324 if (User->getOperand(i) ==
SDValue(VCMPoNode, 1)) {
12334 return SDValue(VCMPoNode, 0);
12342 cast<ConstantSDNode>(Cond.
getOperand(1))->getZExtValue() ==
12343 Intrinsic::ppc_is_decremented_ctr_nonzero) {
12349 "Counter decrement has more than one use");
12369 Intrinsic::ppc_is_decremented_ctr_nonzero &&
12375 cast<ConstantSDNode>(LHS.
getOperand(1))->getZExtValue() ==
12376 Intrinsic::ppc_is_decremented_ctr_nonzero &&
12377 isa<ConstantSDNode>(RHS)) {
12379 "Counter decrement comparison is not EQ or NE");
12381 unsigned Val = cast<ConstantSDNode>(RHS)->getZExtValue();
12389 "Counter decrement has more than one use");
12401 assert(isDot &&
"Can't compare against a vector result!");
12405 unsigned Val = cast<ConstantSDNode>(RHS)->getZExtValue();
12406 if (Val != 0 && Val != 1) {
12414 bool BranchOnWhenPredTrue = (CC ==
ISD::SETEQ) ^ (Val == 0);
12427 switch (cast<ConstantSDNode>(LHS.
getOperand(1))->getZExtValue()) {
12451 return DAGCombineBuildVector(N, DCI);
12460 std::vector<SDNode *> *Created)
const {
12465 if ((VT != MVT::i32 && VT !=
MVT::i64) ||
12466 !(Divisor.
isPowerOf2() || (-Divisor).isPowerOf2()))
12472 bool IsNegPow2 = (-Divisor).isPowerOf2();
12478 Created->push_back(Op.
getNode());
12483 Created->push_back(Op.
getNode());
12495 const APInt &DemandedElts,
12497 unsigned Depth)
const {
12504 Known.
Zero = 0xFFFF0000;
12508 switch (cast<ConstantSDNode>(Op.
getOperand(0))->getZExtValue()) {
12510 case Intrinsic::ppc_altivec_vcmpbfp_p:
12511 case Intrinsic::ppc_altivec_vcmpeqfp_p:
12512 case Intrinsic::ppc_altivec_vcmpequb_p:
12513 case Intrinsic::ppc_altivec_vcmpequh_p:
12514 case Intrinsic::ppc_altivec_vcmpequw_p:
12515 case Intrinsic::ppc_altivec_vcmpequd_p:
12516 case Intrinsic::ppc_altivec_vcmpgefp_p:
12517 case Intrinsic::ppc_altivec_vcmpgtfp_p:
12518 case Intrinsic::ppc_altivec_vcmpgtsb_p:
12519 case Intrinsic::ppc_altivec_vcmpgtsh_p:
12520 case Intrinsic::ppc_altivec_vcmpgtsw_p:
12521 case Intrinsic::ppc_altivec_vcmpgtsd_p:
12522 case Intrinsic::ppc_altivec_vcmpgtub_p:
12523 case Intrinsic::ppc_altivec_vcmpgtuh_p:
12524 case Intrinsic::ppc_altivec_vcmpgtuw_p:
12525 case Intrinsic::ppc_altivec_vcmpgtud_p:
12552 uint64_t LoopSize = 0;
12554 for (
auto J = (*I)->begin(), JE = (*I)->end(); J != JE; ++J) {
12560 if (LoopSize > 16 && LoopSize <= 32)
12574 if (Constraint.
size() == 1) {
12575 switch (Constraint[0]) {
12593 }
else if (Constraint ==
"wc") {
12595 }
else if (Constraint ==
"wa" || Constraint ==
"wd" ||
12596 Constraint ==
"wf" || Constraint ==
"ws") {
12612 if (!CallOperandVal)
12619 else if ((
StringRef(constraint) ==
"wa" ||
12627 switch (*constraint) {
12657 std::pair<unsigned, const TargetRegisterClass *>
12661 if (Constraint.
size() == 1) {
12663 switch (Constraint[0]) {
12666 return std::make_pair(0U, &PPC::G8RC_NOX0RegClass);
12667 return std::make_pair(0U, &PPC::GPRC_NOR0RegClass);
12670 return std::make_pair(0U, &PPC::G8RCRegClass);
12671 return std::make_pair(0U, &PPC::GPRCRegClass);
12677 if (VT ==
MVT::f32 || VT == MVT::i32)
12678 return std::make_pair(0U, &PPC::F4RCRegClass);
12679 if (VT == MVT::f64 || VT ==
MVT::i64)
12680 return std::make_pair(0U, &PPC::F8RCRegClass);
12681 if (VT == MVT::v4f64 && Subtarget.
hasQPX())
12682 return std::make_pair(0U, &PPC::QFRCRegClass);
12684 return std::make_pair(0U, &PPC::QSRCRegClass);
12687 if (VT == MVT::v4f64 && Subtarget.
hasQPX())
12688 return std::make_pair(0U, &PPC::QFRCRegClass);
12690 return std::make_pair(0U, &PPC::QSRCRegClass);
12692 return std::make_pair(0U, &PPC::VRRCRegClass);
12694 return std::make_pair(0U, &PPC::CRRCRegClass);
12696 }
else if (Constraint ==
"wc" && Subtarget.
useCRBits()) {
12698 return std::make_pair(0U, &PPC::CRBITRCRegClass);
12699 }
else if ((Constraint ==
"wa" || Constraint ==
"wd" ||
12700 Constraint ==
"wf") && Subtarget.
hasVSX()) {
12701 return std::make_pair(0U, &PPC::VSRCRegClass);
12702 }
else if (Constraint ==
"ws" && Subtarget.
hasVSX()) {
12704 return std::make_pair(0U, &PPC::VSSRCRegClass);
12706 return std::make_pair(0U, &PPC::VSFRCRegClass);
12709 std::pair<unsigned, const TargetRegisterClass *> R =
12719 PPC::GPRCRegClass.contains(R.first))
12721 PPC::sub_32, &PPC::G8RCRegClass),
12722 &PPC::G8RCRegClass);
12726 R.first = PPC::CR0;
12727 R.second = &PPC::CRRCRegClass;
12736 std::string &Constraint,
12737 std::vector<SDValue>&Ops,
12742 if (Constraint.length() > 1)
return;
12744 char Letter = Constraint[0];
12768 if (isShiftedUInt<16, 16>(Value))
12772 if (isShiftedInt<16, 16>(Value))
12801 Ops.push_back(Result);
12813 unsigned AS)
const {
12827 switch (AM.
Scale) {
12858 unsigned Depth = cast<ConstantSDNode>(Op.
getOperand(0))->getZExtValue();
12864 bool isPPC64 = Subtarget.
isPPC64();
12868 SDValue FrameAddr = LowerFRAMEADDR(Op, DAG);
12878 SDValue RetAddrFI = getReturnAddrFrameIndex(DAG);
12886 unsigned Depth = cast<ConstantSDNode>(Op.
getOperand(0))->getZExtValue();
12899 FrameReg = isPPC64 ? PPC::X1 : PPC::R1;
12901 FrameReg = isPPC64 ? PPC::FP8 : PPC::FP;
12915 bool isPPC64 = Subtarget.
isPPC64();
12918 if ((isPPC64 && VT !=
MVT::i64 && VT != MVT::i32) ||
12919 (!isPPC64 && VT != MVT::i32))
12924 .Case(
"r1", is64Bit ? PPC::X1 : PPC::R1)
12925 .
Case(
"r2", (isDarwinABI || isPPC64) ? 0 :
PPC::R2)
12926 .
Case(
"r13", (!isPPC64 && isDarwinABI) ? 0 :
12927 (is64Bit ? PPC::X13 : PPC::R13))
12943 unsigned Intrinsic)
const {
12944 switch (Intrinsic) {
12945 case Intrinsic::ppc_qpx_qvlfd:
12946 case Intrinsic::ppc_qpx_qvlfs:
12947 case Intrinsic::ppc_qpx_qvlfcd:
12948 case Intrinsic::ppc_qpx_qvlfcs:
12949 case Intrinsic::ppc_qpx_qvlfiwa:
12950 case Intrinsic::ppc_qpx_qvlfiwz:
12951 case Intrinsic::ppc_altivec_lvx:
12952 case Intrinsic::ppc_altivec_lvxl:
12953 case Intrinsic::ppc_altivec_lvebx:
12954 case Intrinsic::ppc_altivec_lvehx:
12955 case Intrinsic::ppc_altivec_lvewx:
12956 case Intrinsic::ppc_vsx_lxvd2x:
12957 case Intrinsic::ppc_vsx_lxvw4x: {
12959 switch (Intrinsic) {
12960 case Intrinsic::ppc_altivec_lvebx:
12963 case Intrinsic::ppc_altivec_lvehx:
12966 case Intrinsic::ppc_altivec_lvewx:
12969 case Intrinsic::ppc_vsx_lxvd2x:
12972 case Intrinsic::ppc_qpx_qvlfd:
12975 case Intrinsic::ppc_qpx_qvlfs:
12978 case Intrinsic::ppc_qpx_qvlfcd:
12981 case Intrinsic::ppc_qpx_qvlfcs:
13000 case Intrinsic::ppc_qpx_qvlfda:
13001 case Intrinsic::ppc_qpx_qvlfsa:
13002 case Intrinsic::ppc_qpx_qvlfcda:
13003 case Intrinsic::ppc_qpx_qvlfcsa:
13004 case Intrinsic::ppc_qpx_qvlfiwaa:
13005 case Intrinsic::ppc_qpx_qvlfiwza: {
13007 switch (Intrinsic) {
13008 case Intrinsic::ppc_qpx_qvlfda:
13011 case Intrinsic::ppc_qpx_qvlfsa:
13014 case Intrinsic::ppc_qpx_qvlfcda:
13017 case Intrinsic::ppc_qpx_qvlfcsa:
13036 case Intrinsic::ppc_qpx_qvstfd:
13037 case Intrinsic::ppc_qpx_qvstfs:
13038 case Intrinsic::ppc_qpx_qvstfcd:
13039 case Intrinsic::ppc_qpx_qvstfcs:
13040 case Intrinsic::ppc_qpx_qvstfiw:
13041 case Intrinsic::ppc_altivec_stvx:
13042 case Intrinsic::ppc_altivec_stvxl:
13043 case Intrinsic::ppc_altivec_stvebx:
13044 case Intrinsic::ppc_altivec_stvehx:
13045 case Intrinsic::ppc_altivec_stvewx:
13046 case Intrinsic::ppc_vsx_stxvd2x:
13047 case Intrinsic::ppc_vsx_stxvw4x: {
13049 switch (Intrinsic) {
13050 case Intrinsic::ppc_altivec_stvebx:
13053 case Intrinsic::ppc_altivec_stvehx:
13056 case Intrinsic::ppc_altivec_stvewx:
13059 case Intrinsic::ppc_vsx_stxvd2x:
13062 case Intrinsic::ppc_qpx_qvstfd:
13065 case Intrinsic::ppc_qpx_qvstfs:
13068 case Intrinsic::ppc_qpx_qvstfcd:
13071 case Intrinsic::ppc_qpx_qvstfcs:
13090 case Intrinsic::ppc_qpx_qvstfda:
13091 case Intrinsic::ppc_qpx_qvstfsa:
13092 case Intrinsic::ppc_qpx_qvstfcda:
13093 case Intrinsic::ppc_qpx_qvstfcsa:
13094 case Intrinsic::ppc_qpx_qvstfiwa: {
13096 switch (Intrinsic) {
13097 case Intrinsic::ppc_qpx_qvstfda:
13100 case Intrinsic::ppc_qpx_qvstfsa:
13103 case Intrinsic::ppc_qpx_qvstfcda:
13106 case Intrinsic::ppc_qpx_qvstfcsa:
13144 unsigned DstAlign,
unsigned SrcAlign,
13145 bool IsMemset,
bool ZeroMemset,
13152 if (Subtarget.
hasQPX() && Size >= 32 && (!IsMemset || Size >= 64) &&
13153 (!SrcAlign || SrcAlign >= 32) && (!DstAlign || DstAlign >= 32) &&
13161 (((!SrcAlign || SrcAlign >= 16) && (!DstAlign || DstAlign >= 16)) ||
13180 return !(BitSize == 0 || BitSize > 64);
13188 return NumBits1 == 64 && NumBits2 == 32;
13196 return NumBits1 == 64 && NumBits2 == 32;
13202 if (
LoadSDNode *LD = dyn_cast<LoadSDNode>(Val)) {
13235 bool *
Fast)
const {
13249 if (Subtarget.
hasVSX()) {
13290 static const MCPhysReg ScratchRegs[] = {
13291 PPC::X12, PPC::LR8, PPC::CTR8, 0
13294 return ScratchRegs;
13298 const Constant *PersonalityFn)
const {
13299 return Subtarget.
isPPC64() ? PPC::X3 : PPC::R3;
13303 const Constant *PersonalityFn)
const {
13309 EVT VT ,
unsigned DefinedValues)
const {
13335 if (!Subtarget.
isPPC64())
return;
13355 if (PPC::G8RCRegClass.
contains(*I))
13356 RC = &PPC::G8RCRegClass;
13357 else if (PPC::F8RCRegClass.
contains(*I))
13358 RC = &PPC::F8RCRegClass;
13359 else if (PPC::CRRCRegClass.
contains(*I))
13360 RC = &PPC::CRRCRegClass;
13361 else if (PPC::VRRCRegClass.
contains(*I))
13362 RC = &PPC::VRRCRegClass;
13373 Attribute::NoUnwind) &&
13374 "Function should be nounwind in insertCopiesSplitCSR!");
13380 for (
auto *Exit : Exits)
13382 TII->
get(TargetOpcode::COPY), *
I)
13425 unsigned TargetOpcode;
13444 if (Mask->getZExtValue() == OpSizeInBits - 1)
13450 SDValue PPCTargetLowering::combineSHL(
SDNode *N, DAGCombinerInfo &DCI)
const {
13457 SDValue PPCTargetLowering::combineSRA(
SDNode *N, DAGCombinerInfo &DCI)
const {
13464 SDValue PPCTargetLowering::combineSRL(
SDNode *N, DAGCombinerInfo &DCI)
const {
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.
PPCTargetLowering(const PPCTargetMachine &TM, const PPCSubtarget &STI)
static bool resideInSameSection(const Function *Caller, SDValue Callee, const TargetMachine &TM)
ADJUST_TRAMPOLINE - This corresponds to the adjust_trampoline intrinsic.
G8RC = ADDI_TLSLD_L_ADDR G8RReg, Symbol, Symbol - Op that combines ADDI_TLSLD_L and GET_TLSLD_ADDR un...
cl::opt< bool > ANDIGlueBug
X3 = ADDI_TLSLD_L G8RReg, Symbol - For the local-dynamic TLS model, produces an ADDI8 instruction tha...
void setFrameAddressIsTaken(bool T)
unsigned getStackAlignment() const
getStackAlignment - This method returns the number of bytes to which the stack pointer must be aligne...
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 ...
unsigned getValueSizeInBits(unsigned ResNo) const
Returns MVT::getSizeInBits(getValueType(ResNo)).
User::const_op_iterator arg_iterator
The type of iterator to use when looping over actual arguments at this call site. ...
void AnalyzeCallResult(const SmallVectorImpl< ISD::InputArg > &Ins, CCAssignFn Fn)
AnalyzeCallResult - Analyze the return values of a call, incorporating info about the passed values i...
void push_back(const T &Elt)
const MachineFunction * getParent() const
Return the MachineFunction containing this basic block.
A parsed version of the target data layout string in and methods for querying it. ...
const_iterator end(StringRef path)
Get end iterator over path.
SDValue expandVSXStoreForLE(SDNode *N, DAGCombinerInfo &DCI) const
LinkageTypes getLinkage() const
FMINNUM/FMAXNUM - Perform floating-point minimum or maximum on two values.
SDValue getValue(unsigned R) const
This represents an addressing mode of: BaseGV + BaseOffs + BaseReg + Scale*ScaleReg If BaseGV is null...
FastISel * createFastISel(FunctionLoweringInfo &FuncInfo, const TargetLibraryInfo *LibInfo)
static SDValue BuildVSLDOI(SDValue LHS, SDValue RHS, unsigned Amt, EVT VT, SelectionDAG &DAG, const SDLoc &dl)
BuildVSLDOI - Return a VECTOR_SHUFFLE that is a vsldoi of the specified amount.
FormattedString left_justify(StringRef Str, unsigned Width)
left_justify - append spaces after string so total output is Width characters.
Return with a flag operand, matched by 'blr'.
Newer FCTI[D,W]UZ floating-point-to-integer conversion instructions for unsigned integers with round ...
SDValue get_VSPLTI_elt(SDNode *N, unsigned ByteSize, SelectionDAG &DAG)
get_VSPLTI_elt - If this is a build_vector of constants which can be formed by using a vspltis[bhw] i...
static Instruction * callIntrinsic(IRBuilder<> &Builder, Intrinsic::ID Id)
void setLoadExtAction(unsigned ExtType, MVT ValVT, MVT MemVT, LegalizeAction Action)
Indicate that the specified load with extension does not work with the specified type and indicate wh...
GPRC, CHAIN = LBRX CHAIN, Ptr, Type - This is a byte-swapping load instruction.
void setVarArgsNumGPR(unsigned Num)
raw_ostream & errs()
This returns a reference to a raw_ostream for standard error.
bool use64BitRegs() const
use64BitRegs - Return true if in 64-bit mode or if we should use 64-bit registers in 32-bit mode when...
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...
static bool hasSameArgumentList(const Function *CallerFn, ImmutableCallSite *CS)
This SDNode is used for target intrinsics that touch memory and need an associated MachineMemOperand...
virtual ConstraintType getConstraintType(StringRef Constraint) const
Given a constraint, return the type of constraint it is for this target.
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.
unsigned getRegisterByName(const char *RegName, EVT VT, SelectionDAG &DAG) const override
Return the register ID of the name passed in.
VisibilityTypes getVisibility() const
MachineBasicBlock * emitEHSjLjLongJmp(MachineInstr &MI, MachineBasicBlock *MBB) const
unsigned MaxLoadsPerMemcmpOptSize
Flags getFlags() const
Return the raw flags of the source value,.
GCNRegPressure max(const GCNRegPressure &P1, const GCNRegPressure &P2)
unsigned getByValTypeAlignment(Type *Ty, const DataLayout &DL) const override
getByValTypeAlignment - Return the desired alignment for ByVal aggregate function arguments in the ca...
static APInt getAllOnesValue(unsigned numBits)
Get the all-ones value.
LLVMContext * getContext() const
This class represents an incoming formal argument to a Function.
static cl::opt< bool > DisableSCO("disable-ppc-sco", cl::desc("disable sibling call optimization on ppc"), cl::Hidden)
QVFPERM = This corresponds to the QPX qvfperm instruction.
uint64_t getZExtValue() const
Get zero extended value.
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...
SDValue CombineTo(SDNode *N, ArrayRef< SDValue > To, bool AddTo=true)
SDValue getCALLSEQ_END(SDValue Chain, SDValue Op1, SDValue Op2, SDValue InGlue, const SDLoc &DL)
Return a new CALLSEQ_END node, which always must have a glue result (to ensure it's not CSE'd)...
static cl::opt< bool > DisablePPCUnaligned("disable-ppc-unaligned", cl::desc("disable unaligned load/store generation on PPC"), cl::Hidden)
Atomic ordering constants.
static const MCSymbolRefExpr * create(const MCSymbol *Symbol, MCContext &Ctx)
SDValue getIndexedLoad(SDValue OrigLoad, const SDLoc &dl, SDValue Base, SDValue Offset, ISD::MemIndexedMode AM)
STATISTIC(NumFunctions,"Total number of functions")
static SDValue LowerLabelRef(SDValue HiPart, SDValue LoPart, bool isPIC, SelectionDAG &DAG)
EXTRACT_SUBVECTOR(VECTOR, IDX) - Returns a subvector from VECTOR (an vector value) starting with the ...
Reloc::Model getRelocationModel() const
Returns the code generation relocation model.
LLVM_ATTRIBUTE_NORETURN void report_fatal_error(Error Err, bool gen_crash_diag=true)
Report a serious error, calling any installed error handler.
BR_CC - Conditional branch.
unsigned getExceptionSelectorRegister(const Constant *PersonalityFn) const override
If a physical register, this returns the register that receives the exception typeid on entry to a la...
LocInfo getLocInfo() const
GPRC = address of GLOBAL_OFFSET_TABLE.
bool hasOneUse() const
Return true if there is exactly one use of this node.
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.
bool isLittleEndian() const
G8RC = ADDI_DTPREL_L G8RReg, Symbol - For the local-dynamic TLS model, produces an ADDI8 instruction ...
A Module instance is used to store all the information related to an LLVM module. ...
bool hasOneUse() const
Return true if there is exactly one node using value ResNo of Node.
bool CC_PPC32_SVR4_Custom_AlignFPArgRegs(unsigned &ValNo, MVT &ValVT, MVT &LocVT, CCValAssign::LocInfo &LocInfo, ISD::ArgFlagsTy &ArgFlags, CCState &State)
bool CC_PPC32_SVR4_Custom_SkipLastArgRegsPPCF128(unsigned &ValNo, MVT &ValVT, MVT &LocVT, CCValAssign::LocInfo &LocInfo, ISD::ArgFlagsTy &ArgFlags, CCState &State)
const TargetMachine & getTargetMachine() const
unsigned createVirtualRegister(const TargetRegisterClass *RegClass)
createVirtualRegister - Create and return a new virtual register in the function with the specified r...
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
class llvm::RegisterBankInfo GPR
ConstraintWeight getSingleConstraintMatchWeight(AsmOperandInfo &info, const char *constraint) const override
Examine constraint string and operand type and determine a weight value.
static void LowerMemOpCallTo(SelectionDAG &DAG, MachineFunction &MF, SDValue Chain, SDValue Arg, SDValue PtrOff, int SPDiff, unsigned ArgOffset, bool isPPC64, bool isTailCall, bool isVector, SmallVectorImpl< SDValue > &MemOpChains, SmallVectorImpl< TailCallArgumentInfo > &TailCallArguments, const SDLoc &dl)
LowerMemOpCallTo - Store the argument to the stack or remember it in case of tail calls...
SDValue lowerCmpEqZeroToCtlzSrl(SDValue Op, SelectionDAG &DAG) const
int getSplatIndex() const
void setLRStoreRequired()
const TargetMachine & getTarget() const
unsigned addLiveIn(unsigned PReg, const TargetRegisterClass *RC)
addLiveIn - Add the specified physical register as a live-in value and create a corresponding virtual...
constexpr char IsConst[]
Key for Kernel::Arg::Metadata::mIsConst.
unsigned getScalarSizeInBits() const
The following two target-specific nodes are used for calls through function pointers in the 64-bit SV...
VRRC = VADD_SPLAT Elt, EltSize - Temporary node to be expanded during instruction selection to optimi...
bool isXXINSERTWMask(ShuffleVectorSDNode *N, unsigned &ShiftElts, unsigned &InsertAtByte, bool &Swap, bool IsLE)
isXXINSERTWMask - Return true if this VECTOR_SHUFFLE can be handled by the XXINSERTW instruction intr...
MO_LO, MO_HA - lo16(symbol) and ha16(symbol)
const TargetSubtargetInfo & getSubtarget() const
void transferSuccessorsAndUpdatePHIs(MachineBasicBlock *FromMBB)
Transfers all the successors, as in transferSuccessors, and update PHI operands in the successor bloc...
STACKRESTORE has two operands, an input chain and a pointer to restore to it returns an output chain...
This class represents a function call, abstracting a target machine's calling convention.
static bool findConsecutiveLoad(LoadSDNode *LD, SelectionDAG &DAG)
MachineBasicBlock * EmitPartwordAtomicBinary(MachineInstr &MI, MachineBasicBlock *MBB, bool is8bit, unsigned Opcode, unsigned CmpOpcode=0, unsigned CmpPred=0) const
static APInt getLowBitsSet(unsigned numBits, unsigned loBitsSet)
Get a value with low bits set.
const GlobalValue * getGlobal() const
QBRC, CHAIN = QVLFSb CHAIN, Ptr The 4xf32 load used for v4i1 constants.
bool CCAssignFn(unsigned ValNo, MVT ValVT, MVT LocVT, CCValAssign::LocInfo LocInfo, ISD::ArgFlagsTy ArgFlags, CCState &State)
CCAssignFn - This function assigns a location for Val, updating State to reflect the change...
LLVM_NODISCARD bool equals_lower(StringRef RHS) const
equals_lower - Check for string equality, ignoring case.
bool hasLazyResolverStub(const GlobalValue *GV) const
hasLazyResolverStub - Return true if accesses to the specified global have to go through a dyld lazy ...
MachineBasicBlock * EmitInstrWithCustomInserter(MachineInstr &MI, MachineBasicBlock *MBB) const override
This method should be implemented by targets that mark instructions with the 'usesCustomInserter' fla...
static MVT getFloatingPointVT(unsigned BitWidth)
unsigned getOpcode() const
Return the SelectionDAG opcode value for this node.
bool isXXSLDWIShuffleMask(ShuffleVectorSDNode *N, unsigned &ShiftElts, bool &Swap, bool IsLE)
isXXSLDWIShuffleMask - Return true if this is a shuffle mask suitable for a XXSLDWI instruction...
bool verifyReturnAddressArgumentIsConstant(SDValue Op, SelectionDAG &DAG) const
Function Alias Analysis Results
Type * getTypeForEVT(LLVMContext &Context) const
This method returns an LLVM type corresponding to the specified EVT.
unsigned getSizeInBits() const
static SDValue getTOCEntry(SelectionDAG &DAG, const SDLoc &dl, bool Is64Bit, SDValue GA)
bool isDoubleTy() const
Return true if this is 'double', a 64-bit IEEE fp type.
TargetGlobalAddress - Like GlobalAddress, but the DAG does no folding or anything else with this node...
unsigned getByValSize() const
bool hasP9Altivec() const
bool isUnindexed() const
Return true if this is NOT a pre/post inc/dec load/store.
CHAIN = RFEBB CHAIN, State - Return from event-based branch.
VEXTS, ByteWidth - takes an input in VSFRC and produces an output in VSFRC that is sign-extended from...
unsigned getNumOperands() const
Return the number of values used by this operation.
static unsigned CalculateStackSlotAlignment(EVT ArgVT, EVT OrigVT, ISD::ArgFlagsTy Flags, unsigned PtrByteSize)
CalculateStackSlotAlignment - Calculates the alignment of this argument on the stack.
bool isDarwin() const
isDarwin - True if this is any darwin platform.
void setBooleanVectorContents(BooleanContent Ty)
Specify how the target extends the result of a vector boolean value from a vector of i1 to a wider ty...
const Function * getParent() const
Return the enclosing method, or null if none.
unsigned getNumOperands() const
unsigned getValueSizeInBits() const
Returns the size of the value in bits.
constexpr bool isInt< 16 >(int64_t x)
int64_t getOffset() const
const SDValue & getOperand(unsigned Num) const
bool shouldExpandBuildVectorWithShuffles(EVT VT, unsigned DefinedValues) const override
const Function * getFunction() const
getFunction - Return the LLVM function that this machine code represents
unsigned getVarArgsNumGPR() const
CALL - A direct function call.
virtual bool shouldExpandBuildVectorWithShuffles(EVT, unsigned DefinedValues) const
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())
CHAIN,FLAG = BCTRL(CHAIN, INFLAG) - Directly corresponds to a BCTRL instruction.
SDValue getTargetExternalSymbol(const char *Sym, EVT VT, unsigned char TargetFlags=0)
bool isMustTailCall() const
Tests if this call site must be tail call optimized.
SDValue getNode(unsigned Opcode, const SDLoc &DL, EVT VT, ArrayRef< SDUse > Ops)
Gets or creates the specified node.
bool isLegalAddressingMode(const DataLayout &DL, const AddrMode &AM, Type *Ty, unsigned AS) const override
isLegalAddressingMode - Return true if the addressing mode represented by AM is legal for this target...
static BranchProbability getOne()
This defines the Use class.
Value * CallOperandVal
If this is the result output operand or a clobber, this is null, otherwise it is the incoming operand...
unsigned getValNo() const
const SDValue & getBasePtr() const
SDValue getConstantPool(const Constant *C, EVT VT, unsigned Align=0, int Offs=0, bool isT=false, unsigned char TargetFlags=0)
void setVarArgsNumFPR(unsigned Num)
bool isVPKUDUMShuffleMask(ShuffleVectorSDNode *N, unsigned ShuffleKind, SelectionDAG &DAG)
isVPKUDUMShuffleMask - Return true if this is the shuffle mask for a VPKUDUM instruction.
MachineBasicBlock * emitEHSjLjSetJmp(MachineInstr &MI, MachineBasicBlock *MBB) const
bool getPreIndexedAddressParts(SDNode *N, SDValue &Base, SDValue &Offset, ISD::MemIndexedMode &AM, SelectionDAG &DAG) const override
getPreIndexedAddressParts - returns true by value, base pointer and offset pointer and addressing mod...
static void PrepareTailCall(SelectionDAG &DAG, SDValue &InFlag, SDValue &Chain, const SDLoc &dl, int SPDiff, unsigned NumBytes, SDValue LROp, SDValue FPOp, SmallVectorImpl< TailCallArgumentInfo > &TailCallArguments)
Newer FCFID[US] integer-to-floating-point conversion instructions for unsigned integers and single-pr...
Select with condition operator - This selects between a true value and a false value (ops #2 and #3) ...
int getReturnAddrSaveIndex() const
NodeType
ISD::NodeType enum - This enum defines the target-independent operators for a SelectionDAG.
bool isLegalICmpImmediate(int64_t Imm) const override
isLegalICmpImmediate - Return true if the specified immediate is legal icmp immediate, that is the target has icmp instructions which can compare a register against the immediate without having to materialize the immediate into a register.
bool isUnsignedIntSetCC(CondCode Code)
Return true if this is a setcc instruction that performs an unsigned comparison when used with intege...
INT = FGETSIGN(FP) - Return the sign bit of the specified floating point value as an integer 0/1 valu...
This SDNode is used to implement the code generator support for the llvm IR shufflevector instruction...
return AArch64::GPR64RegClass contains(Reg)
SDValue getExternalSymbol(const char *Sym, EVT VT)
Instruction * emitLeadingFence(IRBuilder<> &Builder, Instruction *Inst, AtomicOrdering Ord) const override
Inserts in the IR a target-specific intrinsic specifying a fence.
CallingConv::ID getCallingConv() const
getCallingConv()/setCallingConv(CC) - These method get and set the calling convention of this functio...
unsigned arg_size() const
bool isVPKUHUMShuffleMask(ShuffleVectorSDNode *N, unsigned ShuffleKind, SelectionDAG &DAG)
isVPKUHUMShuffleMask - Return true if this is the shuffle mask for a VPKUHUM instruction.
void setTruncStoreAction(MVT ValVT, MVT MemVT, LegalizeAction Action)
Indicate that the specified truncating store does not work with the specified type and indicate what ...
static unsigned EnsureStackAlignment(const PPCFrameLowering *Lowering, unsigned NumBytes)
EnsureStackAlignment - Round stack frame size up from NumBytes to ensure minimum alignment required f...
RESULT,OUTCHAIN = INTRINSIC_W_CHAIN(INCHAIN, INTRINSICID, arg1, ...) This node represents a target in...
GlobalBaseReg - On Darwin, this node represents the result of the mflr at function entry...
bool allowsMisalignedMemoryAccesses(EVT VT, unsigned AddrSpace, unsigned Align=1, bool *Fast=nullptr) const override
Is unaligned memory access allowed for the given type, and is it fast relative to software emulation...
bool isFPExtFree(EVT VT) const override
Return true if an fpext operation is free (for instance, because single-precision floating-point numb...
OUTCHAIN = EH_SJLJ_LONGJMP(INCHAIN, buffer) This corresponds to the eh.sjlj.longjmp intrinsic...
SDIVREM/UDIVREM - Divide two integers and produce both a quotient and remainder result.
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)
The address of a basic block.
void setVarArgsStackOffset(int Offset)
A description of a memory reference used in the backend.
std::string getEVTString() const
This function returns value type as a string, e.g. "i32".
const TargetSubtargetInfo & getSubtarget() const
getSubtarget - Return the subtarget for which this machine code is being compiled.
PPCFunctionInfo - This class is derived from MachineFunction private PowerPC target-specific informat...
int64_t getOffset() const
const HexagonInstrInfo * TII
static Type * getFloatTy(LLVMContext &C)
ArrayRef< T > makeArrayRef(const T &OneElt)
Construct an ArrayRef from a single element.
G8RC = ADDI_TLSGD_L_ADDR G8RReg, Symbol, Symbol - Op that combines ADDI_TLSGD_L and GET_TLS_ADDR unti...
static MachineOperand CreateReg(unsigned Reg, bool isDef, bool isImp=false, bool isKill=false, bool isDead=false, bool isUndef=false, bool isEarlyClobber=false, unsigned SubReg=0, bool isDebug=false, bool isInternalRead=false)
Shift and rotation operations.
Class to represent struct types.
static cl::opt< bool > DisablePPCPreinc("disable-ppc-preinc", cl::desc("disable preincrement load/store generation on PPC"), cl::Hidden)
Base class for LoadSDNode and StoreSDNode.
EVT getValueType(unsigned ResNo) const
Return the type of a specified result.
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
ValTy * getCalledValue() const
Return the pointer to function that is being called.
unsigned getMinReservedArea() const
static void getMaxByValAlign(Type *Ty, unsigned &MaxAlign, unsigned MaxMaxAlign)
getMaxByValAlign - Helper for getByValTypeAlignment to determine the desired ByVal argument alignment...
BUILD_PAIR - This is the opposite of EXTRACT_ELEMENT in some ways.
void eraseFromParent()
Unlink 'this' from the containing basic block and delete it.
Base class for the full range of assembler expressions which are needed for parsing.
static Constant * get(ArrayRef< Constant * > V)
This provides a uniform API for creating instructions and inserting them into a basic block: either a...
Optional< StringRef > getSectionPrefix() const
Get the section prefix for this function.
const TargetRegisterClass * getRegClass(unsigned Reg) const
Return the register class of the specified virtual register.
LLVM_ATTRIBUTE_ALWAYS_INLINE R Default(const T &Value) const
FLT_ROUNDS_ - Returns current rounding mode: -1 Undefined 0 Round to 0 1 Round to nearest 2 Round to ...
int getVarArgsFrameIndex() const
Reg
All possible values of the reg field in the ModR/M byte.
void setCondCodeAction(ISD::CondCode CC, MVT VT, LegalizeAction Action)
Indicate that the specified condition code is or isn't supported on the target and indicate what to d...
MachinePointerInfo getWithOffset(int64_t O) const
EH_DWARF_CFA - This node represents the pointer to the DWARF Canonical Frame Address (CFA)...
The memory access is dereferenceable (i.e., doesn't trap).
virtual bool isJumpTableRelative() const
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...
Direct move from a GPR to a VSX register (algebraic)
X3 = ADDI_TLSGD_L G8RReg, Symbol - For the general-dynamic TLS model, produces an ADDI8 instruction t...
void setOperationAction(unsigned Op, MVT VT, LegalizeAction Action)
Indicate that the specified operation does not work with the specified type and indicate what to do a...
bool isStrongDefinitionForLinker() const
Returns true if this global's definition will be the one chosen by the linker.
int getMaskElt(unsigned Idx) const
bool isPositionIndependent() const
SDVTList getVTList(EVT VT)
Return an SDVTList that represents the list of values specified.
unsigned getStoreSize() const
Return the number of bytes overwritten by a store of the specified value type.
FRAMEADDR, RETURNADDR - These nodes represent llvm.frameaddress and llvm.returnaddress on the DAG...
void setJumpIsExpensive(bool isExpensive=true)
Tells the code generator not to expand logic operations on comparison predicates into separate sequen...
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.
QVALIGNI = This corresponds to the QPX qvaligni instruction.
bool SelectAddressRegImm(SDValue N, SDValue &Disp, SDValue &Base, SelectionDAG &DAG, unsigned Alignment) const
SelectAddressRegImm - Returns true if the address N can be represented by a base register plus a sign...
const MachineInstrBuilder & addImm(int64_t Val) const
Add a new immediate operand.
This class defines information used to lower LLVM code to legal SelectionDAG operators that the targe...
Sched::Preference getSchedulingPreference() const
Return target scheduling preference.
zlib-gnu style compression
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...
OutputArg - This struct carries flags and a value for a single outgoing (actual) argument or outgoing...
This represents a list of ValueType's that has been intern'd by a SelectionDAG.
SDValue getExtLoad(ISD::LoadExtType ExtType, const SDLoc &dl, EVT VT, SDValue Chain, SDValue Ptr, MachinePointerInfo PtrInfo, EVT MemVT, unsigned Alignment=0, MachineMemOperand::Flags MMOFlags=MachineMemOperand::MONone, const AAMDNodes &AAInfo=AAMDNodes())
LLVM_NODISCARD bool empty() const
bool getBoolValue() const
Convert APInt to a boolean value.
SmallVector< ISD::InputArg, 32 > Ins
AtomicOrdering
Atomic ordering for LLVM's memory model.
STACKSAVE - STACKSAVE has one operand, an input chain.
static void fixupFuncForFI(SelectionDAG &DAG, int FrameIdx, EVT VT)
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 getPrefLoopAlignment(MachineLoop *ML) const override
Return the preferred loop alignment.
unsigned getReturnSaveOffset() const
getReturnSaveOffset - Return the previous frame offset to save the return address.
Context object for machine code objects.
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...
static const unsigned PerfectShuffleTable[6561+1]
bool isInConsecutiveRegs() const
SDValue getSExtOrTrunc(SDValue Op, const SDLoc &DL, EVT VT)
Convert Op, which must be of integer type, to the integer type VT, by either sign-extending or trunca...
LLVM_ATTRIBUTE_ALWAYS_INLINE StringSwitch & Case(const char(&S)[N], const T &Value)
bool isSplatShuffleMask(ShuffleVectorSDNode *N, unsigned EltSize)
isSplatShuffleMask - Return true if the specified VECTOR_SHUFFLE operand specifies a splat of a singl...
unsigned getLocReg() const
This is a fast-path instruction selection class that generates poor code and doesn't support illegal ...
unsigned NoNaNsFPMath
NoNaNsFPMath - This flag is enabled when the -enable-no-nans-fp-math flag is specified on the command...
static bool isVMerge(ShuffleVectorSDNode *N, unsigned UnitSize, unsigned LHSStart, unsigned RHSStart)
isVMerge - Common function, used to match vmrg* shuffles.
void computeRegisterProperties(const TargetRegisterInfo *TRI)
Once all of the register classes are added, this allows us to compute derived properties we expose...
[SU]INT_TO_FP - These operators convert integers (whose interpreted sign depends on the first letter)...
std::pair< SDValue, SDValue > LowerCallTo(CallLoweringInfo &CLI) const
This function lowers an abstract call to a function into an actual call.
void insertCopiesSplitCSR(MachineBasicBlock *Entry, const SmallVectorImpl< MachineBasicBlock * > &Exits) const override
Insert explicit copies in entry and exit blocks.
unsigned getNumValues() const
Return the number of values defined/returned by this operator.
SDValue getRegisterMask(const uint32_t *RegMask)
unsigned MaxLoadsPerMemcmp
EK_LabelDifference32 - Each entry is the address of the block minus the address of the jump table...
SDValue getTargetFrameIndex(int FI, EVT VT)
SDValue LowerOperation(SDValue Op, SelectionDAG &DAG) const override
LowerOperation - Provide custom lowering hooks for some operations.
EVT getSetCCResultType(const DataLayout &DL, LLVMContext &Context, EVT VT) const override
getSetCCResultType - Return the ISD::SETCC ValueType
CHAIN = BDNZ CHAIN, DESTBB - These are used to create counter-based loops.
bool hasAtomicLoad() const
Return true if this atomic instruction loads from memory.
Select with a vector condition (op #0) and two vector operands (ops #1 and #2), returning a vector re...
R32 = MFOCRF(CRREG, INFLAG) - Represents the MFOCRF instruction.
void clearBit(unsigned BitPosition)
Set a given bit to 0.
G8RC = ADDIS_TLSGD_HA X2, Symbol - For the general-dynamic TLS model, produces an ADDIS8 instruction ...
Class to represent array types.
This contains information for each constraint that we are lowering.
Simple integer binary arithmetic operators.
unsigned getMatchingSuperReg(unsigned Reg, unsigned SubIdx, const TargetRegisterClass *RC) const
Return a super-register of the specified register Reg so its sub-register of index SubIdx is Reg...
MO_NLP_HIDDEN_FLAG - If this bit is set, the symbol reference is to a symbol with hidden visibility...
bool shouldConvertConstantLoadToIntImm(const APInt &Imm, Type *Ty) const override
Returns true if it is beneficial to convert a load of a constant to just the constant itself...
SmallVector< ISD::OutputArg, 32 > Outs
StringRef getSection() const
Get the custom section of this global if it has one.
CHAIN = STXVD2X CHAIN, VSRC, Ptr - Occurs only for little endian.
ArrayRef - Represent a constant reference to an array (0 or more elements consecutively in memory)...
bool hasInvariantFunctionDescriptors() const
bool isLittleEndian() const
Layout endianness...
Function * getDeclaration(Module *M, ID id, ArrayRef< Type * > Tys=None)
Create or insert an LLVM Function declaration for an intrinsic, and return it.
uint64_t getAlignment() const
Return the minimum known alignment in bytes of the actual memory reference.
const SDValue & getBasePtr() const
static SDValue combineBVOfConsecutiveLoads(SDNode *N, SelectionDAG &DAG)
Reduce the number of loads when building a vector.
SDValue getUNDEF(EVT VT)
Return an UNDEF node. UNDEF does not have a useful SDLoc.
static const MCPhysReg FPR[]
FPR - The set of FP registers that should be allocated for arguments, on Darwin.
const MCPhysReg * getCalleeSavedRegsViaCopy(const MachineFunction *MF) const
CondCode
ISD::CondCode enum - These are ordered carefully to make the bitfields below work out...
EVT getOptimalMemOpType(uint64_t Size, unsigned DstAlign, unsigned SrcAlign, bool IsMemset, bool ZeroMemset, bool MemcpyStrSrc, MachineFunction &MF) const override
getOptimalMemOpType - Returns the target specific optimal type for load and store operations as a res...
auto count(R &&Range, const E &Element) -> typename std::iterator_traits< decltype(std::begin(Range))>::difference_type
Wrapper function around std::count to count the number of times an element Element occurs in the give...
EVT getValueType(const DataLayout &DL, Type *Ty, bool AllowUnknown=false) const
Return the EVT corresponding to this LLVM type.
EVT getMemoryVT() const
Return the type of the in-memory value.
bool isInConsecutiveRegsLast() const
SDValue getTargetConstant(uint64_t Val, const SDLoc &DL, EVT VT, bool isOpaque=false)
READCYCLECOUNTER - This corresponds to the readcyclecounter intrinsic.
int getFramePointerSaveIndex() const
static bool isFloatingPointZero(SDValue Op)
isFloatingPointZero - Return true if this is 0.0 or -0.0.
bool isVMRGLShuffleMask(ShuffleVectorSDNode *N, unsigned UnitSize, unsigned ShuffleKind, SelectionDAG &DAG)
isVMRGLShuffleMask - Return true if this is a shuffle mask suitable for a VRGL* instruction with the ...
const DataLayout & getDataLayout() const
Return the DataLayout attached to the Module associated to this MF.
static void getBaseWithConstantOffset(SDValue Loc, SDValue &Base, int64_t &Offset, SelectionDAG &DAG)
LLVM_NODISCARD LLVM_ATTRIBUTE_ALWAYS_INLINE size_t size() const
size - Get the string size.
bool isSignedIntSetCC(CondCode Code)
Return true if this is a setcc instruction that performs a signed comparison when used with integer o...
bool CC_PPC32_SVR4_Custom_AlignArgRegs(unsigned &ValNo, MVT &ValVT, MVT &LocVT, CCValAssign::LocInfo &LocInfo, ISD::ArgFlagsTy &ArgFlags, CCState &State)
bool isFMAFasterThanFMulAndFAdd(EVT VT) const override
isFMAFasterThanFMulAndFAdd - Return true if an FMA operation is faster than a pair of fmul and fadd i...
RESULT = INTRINSIC_WO_CHAIN(INTRINSICID, arg1, arg2, ...) This node represents a target intrinsic fun...
XXINSERT - The PPC VSX insert instruction.
MachineBasicBlock * CreateMachineBasicBlock(const BasicBlock *bb=nullptr)
CreateMachineBasicBlock - Allocate a new MachineBasicBlock.
const DataLayout & getDataLayout() const
void ReplaceNodeResults(SDNode *N, SmallVectorImpl< SDValue > &Results, SelectionDAG &DAG) const override
ReplaceNodeResults - Replace the results of node with an illegal result type with new values built ou...
static MachinePointerInfo getStack(MachineFunction &MF, int64_t Offset)
Stack pointer relative access.
This instruction is lowered in PPCRegisterInfo::eliminateFrameIndex to compute an offset from native ...
const BasicBlock * getBasicBlock() const
Return the LLVM basic block that this instance corresponded to originally.
This class is used to represent ISD::STORE nodes.
unsigned getOpcode() const
Returns the opcode of this MachineInstr.
FP_TO_[US]INT - Convert a floating point value to a signed or unsigned integer.
bool isXXBRWShuffleMask(ShuffleVectorSDNode *N)
isXXBRWShuffleMask - Return true if this is a shuffle mask suitable for a XXBRW instruction.
uint32_t FloatToBits(float Float)
This function takes a float and returns the bit equivalent 32-bit integer.
uint16_t MCPhysReg
An unsigned integer type large enough to represent all physical registers, but not necessarily virtua...
Flag
These should be considered private to the implementation of the MCInstrDesc class.
BUILD_VECTOR(ELT0, ELT1, ELT2, ELT3,...) - Return a vector with the specified, possibly variable...
TargetInstrInfo - Interface to description of machine instruction set.
iterator find(const_arg_type_t< KeyT > Val)
static APInt getHighBitsSet(unsigned numBits, unsigned hiBitsSet)
Get a value with high bits set.
void setTailCallSPDelta(int size)
static int getEstimateRefinementSteps(EVT VT, const PPCSubtarget &Subtarget)
VSRC, CHAIN = LXVD2X_LE CHAIN, Ptr - Occurs only for little endian.
mmo_iterator memoperands_end() const
SDNode * getNode() const
get the SDNode which holds the desired result
bool getTgtMemIntrinsic(IntrinsicInfo &Info, const CallInst &I, unsigned Intrinsic) const override
Given an intrinsic, checks if on the target the intrinsic will need to map to a MemIntrinsicNode (tou...
constexpr uint64_t MinAlign(uint64_t A, uint64_t B)
A and B are either alignments or offsets.
MachineInstrBuilder BuildMI(MachineFunction &MF, const DebugLoc &DL, const MCInstrDesc &MCID)
Builder interface. Specify how to create the initial instruction itself.
unsigned getScalarSizeInBits() const
unsigned getStoreSize() const
Return the number of bytes overwritten by a store of the specified value type.
A switch()-like statement whose cases are string literals.
unsigned getFirstUnallocated(ArrayRef< MCPhysReg > Regs) const
getFirstUnallocated - Return the index of the first unallocated register in the set, or Regs.size() if they are all allocated.
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...
void addLiveIn(MCPhysReg PhysReg, LaneBitmask LaneMask=LaneBitmask::getAll())
Adds the specified register as a live in.
const MachineInstrBuilder & setMemRefs(MachineInstr::mmo_iterator b, MachineInstr::mmo_iterator e) const
unsigned UnsafeFPMath
UnsafeFPMath - This flag is enabled when the -enable-unsafe-fp-math flag is specified on the command ...
void computeKnownBitsForTargetNode(const SDValue Op, KnownBits &Known, const APInt &DemandedElts, const SelectionDAG &DAG, unsigned Depth=0) const override
Determine which of the bits specified in Mask are known to be either zero or one and return them in t...
static bool isNByteElemShuffleMask(ShuffleVectorSDNode *N, unsigned Width, int StepLen)
Check that the mask is shuffling N byte elements.
Control flow instructions. These all have token chains.
static SDValue stripModuloOnShift(const TargetLowering &TLI, SDNode *N, SelectionDAG &DAG)
const SDValue & getBasePtr() const
unsigned const MachineRegisterInfo * MRI
std::size_t countTrailingZeros(T Val, ZeroBehavior ZB=ZB_Width)
Count number of 0's from the least significant bit to the most stopping at the first 1...
FSEL - Traditional three-operand fsel node.
unsigned getFramePointerSaveOffset() const
getFramePointerSaveOffset - Return the previous frame offset to save the frame pointer.
bool isXXBRQShuffleMask(ShuffleVectorSDNode *N)
isXXBRQShuffleMask - Return true if this is a shuffle mask suitable for a XXBRQ instruction.
CodeModel::Model getCodeModel() const
Returns the code model.
LLVM Basic Block Representation.
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.
void addRegisterClass(MVT VT, const TargetRegisterClass *RC)
Add the specified register class as an available regclass for the specified value type...
virtual void insertSSPDeclarations(Module &M) const
Inserts necessary declarations for SSP (stack protection) purpose.
Simple binary floating point operators.
ch, gl = CR6[UN]SET ch, inglue - Toggle CR bit 6 for SVR4 vararg calls
void setTargetDAGCombine(ISD::NodeType NT)
Targets should invoke this method for each target independent node that they want to provide a custom...
bool isNonTemporal() const
bool isVectorTy() const
True if this is an instance of VectorType.
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...
MachineFrameInfo & getFrameInfo()
getFrameInfo - Return the frame info object for the current function.
static unsigned getSizeInBits(unsigned Reg, const MachineRegisterInfo &MRI, const TargetRegisterInfo &TRI)
Get the size in bits of Reg.
This is an important base class in LLVM.
void resetAll()
Resets the known state of all bits.
virtual unsigned getPrefLoopAlignment(MachineLoop *ML=nullptr) const
Return the preferred loop alignment.
MO_NLP_FLAG - If this bit is set, the symbol reference is actually to the non_lazy_ptr for the global...
VAEND, VASTART - VAEND and VASTART have three operands: an input chain, pointer, and a SRCVALUE...
G8RC = ADDIS_DTPREL_HA X3, Symbol - For the local-dynamic TLS model, produces an ADDIS8 instruction t...
bool isVector() const
Return true if this is a vector value type.
SExtVElems, takes an input vector of a smaller type and sign extends to an output vector of a larger ...
Direct move from a VSX register to a GPR.
LLVM_ATTRIBUTE_ALWAYS_INLINE iterator begin()
static bool is64Bit(const char *name)
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.
CHAIN,FLAG = MTCTR(VAL, CHAIN[, INFLAG]) - Directly corresponds to a MTCTR instruction.
SmallSet - This maintains a set of unique values, optimizing for the case when the set is small (less...
This file contains the declarations for the subclasses of Constant, which represent the different fla...
bool isFloatingPoint() const
Return true if this is a FP or a vector FP type.
const MachineOperand & getOperand(unsigned i) const
unsigned getVarArgsNumFPR() const
static int CalculateTailCallSPDiff(SelectionDAG &DAG, bool isTailCall, unsigned ParamSize)
CalculateTailCallSPDiff - Get the amount the stack pointer has to be adjusted to accommodate the argu...
bool isFloatTy() const
Return true if this is 'float', a 32-bit IEEE fp type.
static ManagedStatic< OptionRegistry > OR
unsigned getLiveInVirtReg(unsigned PReg) const
getLiveInVirtReg - If PReg is a live-in physical register, return the corresponding live-in physical ...
bool isOperationLegal(unsigned Op, EVT VT) const
Return true if the specified operation is legal on this target.
ConstantFP - Floating Point Values [float, double].
unsigned getVSPLTImmediate(SDNode *N, unsigned EltSize, SelectionDAG &DAG)
getVSPLTImmediate - Return the appropriate VSPLT* immediate to splat the specified isSplatShuffleMask...
std::pair< iterator, bool > insert(PtrType Ptr)
Inserts Ptr if and only if there is no element in the container equal to Ptr.
SDValue getCALLSEQ_START(SDValue Chain, uint64_t InSize, uint64_t OutSize, const SDLoc &DL)
Return a new CALLSEQ_START node, that starts new call frame, in which InSize bytes are set up inside ...
static bool isConsecutiveLSLoc(SDValue Loc, EVT VT, LSBaseSDNode *Base, unsigned Bytes, int Dist, SelectionDAG &DAG)
STFIWX - The STFIWX instruction.
POPCNTDKind hasPOPCNTD() const
ConstraintType getConstraintType(StringRef Constraint) const override
getConstraintType - Given a constraint, return the type of constraint it is for this target...
FCFID - The FCFID instruction, taking an f64 operand and producing and f64 value containing the FP re...
void setBooleanContents(BooleanContent Ty)
Specify how the target extends the result of integer and floating point boolean values from i1 to a w...
unsigned getScalarValueSizeInBits() const
static SDValue GeneratePerfectShuffle(unsigned PFEntry, SDValue LHS, SDValue RHS, SelectionDAG &DAG, const SDLoc &dl)
GeneratePerfectShuffle - Given an entry in the perfect-shuffle table, emit the specified operations t...
bool useLoadStackGuardNode() const override
Override to support customized stack guard loading.
void AddToWorklist(SDNode *N)
const PPCFrameLowering * getFrameLowering() const override
virtual std::pair< unsigned, const TargetRegisterClass * > getRegForInlineAsmConstraint(const TargetRegisterInfo *TRI, StringRef Constraint, MVT VT) const
Given a physical register constraint (e.g.
constexpr bool isPowerOf2_64(uint64_t Value)
Return true if the argument is a power of two > 0 (64 bit edition.)
This file declares a class to represent arbitrary precision floating point values and provide a varie...
static Type * getVoidTy(LLVMContext &C)
This class provides iterator support for SDUse operands that use a specific SDNode.
static void CalculateTailCallArgDest(SelectionDAG &DAG, MachineFunction &MF, bool isPPC64, SDValue Arg, int SPDiff, unsigned ArgOffset, SmallVectorImpl< TailCallArgumentInfo > &TailCallArguments)
CalculateTailCallArgDest - Remember Argument for later processing.
bool isVPKUWUMShuffleMask(ShuffleVectorSDNode *N, unsigned ShuffleKind, SelectionDAG &DAG)
isVPKUWUMShuffleMask - Return true if this is the shuffle mask for a VPKUWUM instruction.
INIT_TRAMPOLINE - This corresponds to the init_trampoline intrinsic.
bool any_of(R &&Range, UnaryPredicate P)
Provide wrappers to std::any_of which take ranges instead of having to pass begin/end explicitly...
static SDValue EmitTailCallStoreFPAndRetAddr(SelectionDAG &DAG, SDValue Chain, SDValue OldRetAddr, SDValue OldFP, int SPDiff, const SDLoc &dl)
EmitTailCallStoreFPAndRetAddr - Move the frame pointer and return address to the appropriate stack sl...
Ty * getInfo()
getInfo - Keep track of various per-function pieces of information for backends that would like to do...
void setVarArgsFrameIndex(int Index)
unsigned getOpcode() const
TRAP - Trapping instruction.
static const MCPhysReg QFPR[]
QFPR - The set of QPX registers that should be allocated for arguments.
unsigned GuaranteedTailCallOpt
GuaranteedTailCallOpt - This flag is enabled when -tailcallopt is specified on the commandline...
CHAIN = CLRBHRB CHAIN - Clear branch history rolling buffer.
AssertSext, AssertZext - These nodes record if a register contains a value that has already been zero...
void setPrefFunctionAlignment(unsigned Align)
Set the target's preferred function alignment.
GPRC, CHAIN = LFIWAX CHAIN, Ptr - This is a floating-point load which sign-extends from a 32-bit inte...
static mvt_range vector_valuetypes()
static bool getVectorCompareInfo(SDValue Intrin, int &CompareOpc, bool &isDot, const PPCSubtarget &Subtarget)
getVectorCompareInfo - Given an intrinsic, return false if it is not a vector comparison.
bool has64BitSupport() const
has64BitSupport - Return true if the selected CPU supports 64-bit instructions, regardless of whether...
virtual bool useLoadStackGuardNode() const
If this function returns true, SelectionDAGBuilder emits a LOAD_STACK_GUARD node when it is lowering ...
G8RC = ADDIS_TLSLD_HA X2, Symbol - For the local-dynamic TLS model, produces an ADDIS8 instruction th...
self_iterator getIterator()
uint64_t getConstantOperandVal(unsigned Num) const
Helper method returns the integer value of a ConstantSDNode operand.
std::pair< NoneType, bool > insert(const T &V)
insert - Insert an element into the set if it isn't already there.
G8RC = LD_GOT_TPREL_L Symbol, G8RReg - Used by the initial-exec TLS model, produces a LD instruction ...
int CreateFixedObject(uint64_t Size, int64_t SPOffset, bool Immutable, bool isAliased=false)
Create a new object at a fixed location on the stack.
QVESPLATI = This corresponds to the QPX qvesplati instruction.
VAARG - VAARG has four operands: an input chain, a pointer, a SRCVALUE, and the alignment.
use_iterator use_begin() const
Provide iteration support to walk over all uses of an SDNode.
const SDValue & getValue() const
void AddPromotedToType(unsigned Opc, MVT OrigVT, MVT DestVT)
If Opc/OrigVT is specified as being promoted, the promotion code defaults to trying a larger integer/...
ConstantSDNode * isConstOrConstSplat(SDValue V)
Returns the SDNode if it is a constant splat BuildVector or constant int.
unsigned NoInfsFPMath
NoInfsFPMath - This flag is enabled when the -enable-no-infs-fp-math flag is specified on the command...
Common code between 32-bit and 64-bit PowerPC targets.
unsigned MaxStoresPerMemmove
Specify maximum bytes of store instructions per memmove call.
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.
bool getFunctionSections() const
Return true if functions should be emitted into their own section, corresponding to -ffunction-sectio...
int isVSLDOIShuffleMask(SDNode *N, unsigned ShuffleKind, SelectionDAG &DAG)
isVSLDOIShuffleMask - If this is a vsldoi shuffle mask, return the shift amount, otherwise return -1...
std::vector< ArgListEntry > ArgListTy
static UndefValue * get(Type *T)
Static factory methods - Return an 'undef' object of the specified type.
void initializeSplitCSR(MachineBasicBlock *Entry) const override
Perform necessary initialization to handle a subset of CSRs explicitly via copies.
void setMinReservedArea(unsigned size)
TargetRegisterInfo base class - We assume that the target defines a static array of TargetRegisterDes...
This structure contains all information that is necessary for lowering calls.
bool shouldAssumeDSOLocal(const Module &M, const GlobalValue *GV) const
ISD::MemIndexedMode getAddressingMode() const
Return the addressing mode for this load or store: unindexed, pre-inc, pre-dec, post-inc, or post-dec.
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.
void setUseUnderscoreLongJmp(bool Val)
Indicate whether this target prefers to use _longjmp to implement llvm.longjmp or the version without...
static SDValue addShuffleForVecExtend(SDNode *N, SelectionDAG &DAG, SDValue Input, uint64_t Elems, uint64_t CorrectElems)
virtual SDValue getPICJumpTableRelocBase(SDValue Table, SelectionDAG &DAG) const
Returns relocation base for the given PIC jumptable.
const MCInstrDesc & get(unsigned Opcode) const
Return the machine instruction descriptor that corresponds to the specified instruction opcode...
const BlockAddress * getBlockAddress() const
bool isXXBRDShuffleMask(ShuffleVectorSDNode *N)
isXXBRDShuffleMask - Return true if this is a shuffle mask suitable for a XXBRD instruction.
bool hasPartwordAtomics() 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...
virtual void insertSelect(MachineBasicBlock &MBB, MachineBasicBlock::iterator I, const DebugLoc &DL, unsigned DstReg, ArrayRef< MachineOperand > Cond, unsigned TrueReg, unsigned FalseReg) const
Insert a select instruction into MBB before I that will copy TrueReg to DstReg when Cond is true...
CHAIN,FLAG = BCTRL(CHAIN, ADDR, INFLAG) - The combination of a bctrl instruction and the TOC reload r...
const uint32_t * getNoPreservedMask() const override
SDValue CreateStackTemporary(EVT VT, unsigned minAlign=1)
Create a stack temporary, suitable for holding the specified value type.
bool isTargetLinux() const
bool hasRecipPrec() const
bool isEXTLoad(const SDNode *N)
Returns true if the specified node is a EXTLOAD.
static bool isReleaseOrStronger(AtomicOrdering ao)
const MachinePointerInfo & getPointerInfo() const
unsigned getExceptionPointerRegister(const Constant *PersonalityFn) const override
If a physical register, this returns the register that receives the exception address on entry to an ...
int64_t getObjectOffset(int ObjectIdx) const
Return the assigned stack offset of the specified object from the incoming stack pointer.
void LowerAsmOperandForConstraint(SDValue Op, std::string &Constraint, std::vector< SDValue > &Ops, SelectionDAG &DAG) const override
LowerAsmOperandForConstraint - Lower the specified operand into the Ops vector.
GPRC, CHAIN = LXSIZX, CHAIN, Ptr, ByteWidth - This is a load of an integer smaller than 64 bits into ...
const MDNode * getRanges() const
Returns the Ranges that describes the dereference.
unsigned getByValAlign() const
The memory access writes data.
const SDValue & getOffset() const
bool bitsGT(EVT VT) const
Return true if this has more bits than VT.
unsigned getTOCSaveOffset() const
getTOCSaveOffset - Return the previous frame offset to save the TOC register – 64-bit SVR4 ABI only...
bool needsSwapsForVSXMemOps() const
Extract a subvector from unsigned integer vector and convert to FP.
ArrayRef< int > getMask() const
static unsigned PrepareCall(SelectionDAG &DAG, SDValue &Callee, SDValue &InFlag, SDValue &Chain, SDValue CallSeqStart, const SDLoc &dl, int SPDiff, bool isTailCall, bool isPatchPoint, bool hasNest, SmallVectorImpl< std::pair< unsigned, SDValue >> &RegsToPass, SmallVectorImpl< SDValue > &Ops, std::vector< EVT > &NodeTys, ImmutableCallSite *CS, const PPCSubtarget &Subtarget)
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...
SDValue getTargetConstantPool(const Constant *C, EVT VT, unsigned Align=0, int Offset=0, unsigned char TargetFlags=0)
SDValue getTargetJumpTable(int JTI, EVT VT, unsigned char TargetFlags=0)
TokenFactor - This node takes multiple tokens as input and produces a single token result...
int getVarArgsStackOffset() const
QBFLT = Access the underlying QPX floating-point boolean representation.
unsigned getABITypeAlignment(Type *Ty) const
Returns the minimum ABI-required alignment for the specified type.
bool isBuildVectorAllOnes(const SDNode *N)
Return true if the specified node is a BUILD_VECTOR where all of the elements are ~0 or undef...
const PPCRegisterInfo * getRegisterInfo() const override
bool hasP8Altivec() const
Iterator for intrusive lists based on ilist_node.
static bool CalculateStackSlotUsed(EVT ArgVT, EVT OrigVT, ISD::ArgFlagsTy Flags, unsigned PtrByteSize, unsigned LinkageSize, unsigned ParamAreaSize, unsigned &ArgOffset, unsigned &AvailableFPRs, unsigned &AvailableVRs, bool HasQPX)
CalculateStackSlotUsed - Return whether this argument will use its stack slot (instead of being passe...
CCState - This class holds information needed while lowering arguments and return values...
X3 = GET_TLSLD_ADDR X3, Symbol - For the local-dynamic TLS model, produces a call to __tls_get_addr(s...
SmallPtrSet - This class implements a set which is optimized for holding SmallSize or less elements...
bool hasDirectMove() const
virtual unsigned getJumpTableEncoding() const
Return the entry encoding for a jump table in the current function.
void addSuccessor(MachineBasicBlock *Succ, BranchProbability Prob=BranchProbability::getUnknown())
Add Succ as a successor of this MachineBasicBlock.
GPRC = TOC_ENTRY GA, TOC Loads the entry for GA from the TOC, where the TOC base is given by the last...
MCSymbol * getPICBaseSymbol() const
getPICBaseSymbol - Return a function-local symbol to represent the PIC base.
bool isFPImmLegal(const APFloat &Imm, EVT VT) const override
Returns true if the target can instruction select the specified FP immediate natively.
PICLevel::Level getPICLevel() const
Returns the PIC level (small or large model)
void setNode(SDNode *N)
set the SDNode
void addOperand(MachineFunction &MF, const MachineOperand &Op)
Add the specified operand to the instruction.
bool isBaseWithConstantOffset(SDValue Op) const
Return true if the specified operand is an ISD::ADD with a ConstantSDNode on the right-hand side...
SDValue BuildSDIVPow2(SDNode *N, const APInt &Divisor, SelectionDAG &DAG, std::vector< SDNode * > *Created) const override
Targets may override this function to provide custom SDIV lowering for power-of-2 denominators...
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.
static bool needStackSlotPassParameters(const PPCSubtarget &Subtarget, const SmallVectorImpl< ISD::OutputArg > &Outs)
EXTRACT_VECTOR_ELT(VECTOR, IDX) - Returns a single element from VECTOR identified by the (potentially...
bool isJumpTableRelative() const override
void setIsSplitCSR(bool s)
XXSPLT - The PPC VSX splat instructions.
bool CC_PPC32_SVR4_Custom_Dummy(unsigned &ValNo, MVT &ValVT, MVT &LocVT, CCValAssign::LocInfo &LocInfo, ISD::ArgFlagsTy &ArgFlags, CCState &State)
SDNode * UpdateNodeOperands(SDNode *N, SDValue Op)
Mutate the specified node in-place to have the specified operands.
static bool isConsecutiveLS(SDNode *N, LSBaseSDNode *Base, unsigned Bytes, int Dist, SelectionDAG &DAG)
VECSHL - The PPC VSX shift left instruction.
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...
const PPCInstrInfo * getInstrInfo() const override
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...
bool useSoftFloat() const
bool isPredecessorOf(const SDNode *N) const
Return true if this node is a predecessor of N.
This is a 'vector' (really, a variable-sized array), optimized for the case when the array is small...
G8RC = ADD_TLS G8RReg, Symbol - Used by the initial-exec TLS model, produces an ADD instruction that ...
unsigned getObjectAlignment(int ObjectIdx) const
Return the alignment of the specified stack object.
bool SelectAddressRegRegOnly(SDValue N, SDValue &Base, SDValue &Index, SelectionDAG &DAG) const
SelectAddressRegRegOnly - Given the specified addressed, force it to be represented as an indexed [r+...
Module.h This file contains the declarations for the Module class.
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.
Provides information about what library functions are available for the current target.
bool isVector(MCInstrInfo const &MCII, MCInst const &MCI)
CCValAssign - Represent assignment of one arg/retval to a location.
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)
constexpr size_t array_lengthof(T(&)[N])
Find the length of an array.
Predicate
Predicate - These are "(BI << 5) | BO" for various predicates.
size_type count(ConstPtrType Ptr) const
count - Return 1 if the specified pointer is in the set, 0 otherwise.
BRCOND - Conditional branch.
static unsigned CalculateStackSlotSize(EVT ArgVT, ISD::ArgFlagsTy Flags, unsigned PtrByteSize)
CalculateStackSlotSize - Calculates the size reserved for this argument on the stack.
static const char * Target
const SDValue & getChain() const
Byte Swap and Counting operators.
static SDValue BuildSplatI(int Val, unsigned SplatSize, EVT VT, SelectionDAG &DAG, const SDLoc &dl)
BuildSplatI - Build a canonical splati of Val with an element size of SplatSize.
static SDValue BuildIntrinsicOp(unsigned IID, SDValue Op, SelectionDAG &DAG, const SDLoc &dl, EVT DestVT=MVT::Other)
BuildIntrinsicOp - Return a unary operator intrinsic node with the specified intrinsic ID...
CHAIN = SC CHAIN, Imm128 - System call.
MachineMemOperand * getMemOperand() const
Return a MachineMemOperand object describing the memory reference performed by operation.
This is an abstract virtual class for memory operations.
const char * getTargetNodeName(unsigned Opcode) const override
getTargetNodeName() - This method returns the name of a target specific DAG node. ...
BasicBlock * GetInsertBlock() const
Wrapper class for IR location info (IR ordering and DebugLoc) to be passed into SDNode creation funct...
bool enableAggressiveFMAFusion(EVT VT) const override
Return true if target always beneficiates from combining into FMA for a given value type...
void setHasMultipleConditionRegisters(bool hasManyRegs=true)
Tells the code generator that the target has multiple (allocatable) condition registers that can be u...
X3 = GET_TLS_ADDR X3, Symbol - For the general-dynamic TLS model, produces a call to __tls_get_addr(s...
void insertSSPDeclarations(Module &M) const override
Inserts necessary declarations for SSP (stack protection) purpose.
virtual const MCExpr * getPICJumpTableRelocBaseExpr(const MachineFunction *MF, unsigned JTI, MCContext &Ctx) const
This returns the relocation base for the given PIC jumptable, the same as getPICJumpTableRelocBase, but as an MCExpr.
static SDNode * isBLACompatibleAddress(SDValue Op, SelectionDAG &DAG)
isCallCompatibleAddress - Return the immediate to use if the specified 32-bit value is representable ...
virtual bool isGAPlusOffset(SDNode *N, const GlobalValue *&GA, int64_t &Offset) const
Returns true (and the GlobalValue and the offset) if the node is a GlobalAddress + offset...
bool isDereferenceable() const
Represents one node in the SelectionDAG.
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...
VPERM - The PPC VPERM Instruction.
bool isXXPERMDIShuffleMask(ShuffleVectorSDNode *N, unsigned &ShiftElts, bool &Swap, bool IsLE)
isXXPERMDIShuffleMask - Return true if this is a shuffle mask suitable for a XXPERMDI instruction...
AAMDNodes getAAInfo() const
Returns the AA info that describes the dereference.
SDValue getCopyToReg(SDValue Chain, const SDLoc &dl, unsigned Reg, SDValue N)
STXSIX - The STXSI[bh]X instruction.
raw_ostream & dbgs()
dbgs() - This returns a reference to a raw_ostream for debugging messages.
static mvt_range integer_valuetypes()
i1 = ANDIo_1_[EQ|GT]_BIT(i32 or i64 x) - Represents the result of the eq or gt bit of CR0 after execu...
C - The default llvm calling convention, compatible with C.
void swap(llvm::BitVector &LHS, llvm::BitVector &RHS)
Implement std::swap in terms of BitVector swap.
SDValue expandVSXLoadForLE(SDNode *N, DAGCombinerInfo &DCI) const
G8RC = ADDIS_GOT_TPREL_HA X2, Symbol - Used by the initial-exec TLS model, produces an ADDIS8 instruc...
Value * getArgOperand(unsigned i) const
getArgOperand/setArgOperand - Return/set the i-th call argument.
ISD::LoadExtType getExtensionType() const
Return whether this is a plain node, or one of the varieties of value-extending loads.
Class to represent vector types.
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...
void setIndexedLoadAction(unsigned IdxMode, MVT VT, LegalizeAction Action)
Indicate that the specified indexed load does or does not work with the specified type and indicate w...
Target - Wrapper for Target specific information.
Class for arbitrary precision integers.
SDValue getConstantFP(double Val, const SDLoc &DL, EVT VT, bool isTarget=false)
Create a ConstantFPSDNode wrapping a constant value.
QVGPCI = This corresponds to the QPX qvgpci instruction.
virtual const uint32_t * getCallPreservedMask(const MachineFunction &MF, CallingConv::ID) const
Return a mask of call-preserved registers for the given calling convention on the current function...
iterator_range< use_iterator > uses()
bool isLegalAddImmediate(int64_t Imm) const override
isLegalAddImmediate - Return true if the specified immediate is legal add immediate, that is the target has add instructions which can add a register and the immediate without having to materialize the immediate into a register.
static unsigned getReg(const void *D, unsigned RC, unsigned RegNo)
static bool haveEfficientBuildVectorPattern(BuildVectorSDNode *V, bool HasDirectMove)
Do we have an efficient pattern in a .td file for this node?
A "pseudo-class" with methods for operating on BUILD_VECTORs.
Select(COND, TRUEVAL, FALSEVAL).
void setMinFunctionAlignment(unsigned Align)
Set the target's minimum function alignment (in log2(bytes))
int64_t getSExtValue() const
op_iterator op_begin() const
bool isIntegerTy() const
True if this is an instance of IntegerType.
unsigned EmulatedTLS
EmulatedTLS - This flag enables emulated TLS model, using emutls function in the runtime library...
virtual const TargetRegisterClass * getRegClassFor(MVT VT) const
Return the register class that should be used for the specified value type.
static use_iterator use_end()
void setPrefLoopAlignment(unsigned Align)
Set the target's preferred loop alignment.
ZERO_EXTEND - Used for integer types, zeroing the new bits.
ANY_EXTEND - Used for integer types. The high bits are undefined.
bool SelectAddressRegReg(SDValue N, SDValue &Base, SDValue &Index, SelectionDAG &DAG) const
SelectAddressRegReg - Given the specified addressed, check to see if it can be represented as an inde...
The combination of sra[wd]i and addze used to implemented signed integer division by a power of 2...
static SDValue generateEquivalentSub(SDNode *N, int Size, bool Complement, bool Swap, SDLoc &DL, SelectionDAG &DAG)
This function is called when we have proved that a SETCC node can be replaced by subtraction (and oth...
const DebugLoc & getDebugLoc() const
Returns the debug location id of this MachineInstr.
iterator insert(iterator I, T &&Elt)
FCOPYSIGN(X, Y) - Return the value of X with the sign of Y.
bool enableMachineScheduler() const override
constexpr char Size[]
Key for Kernel::Arg::Metadata::mSize.
static bool isAcquireOrStronger(AtomicOrdering ao)
llvm_unreachable("Unknown RegBank!")
GPRC = address of GLOBAL_OFFSET_TABLE.
MachineRegisterInfo - Keep track of information for virtual and physical registers, including vreg register classes, use/def chains for registers, etc.
The memory access reads data.
const MCExpr * getPICJumpTableRelocBaseExpr(const MachineFunction *MF, unsigned JTI, MCContext &Ctx) const override
This returns the relocation base for the given PIC jumptable, the same as getPICJumpTableRelocBase, but as an MCExpr.
GET_DYNAMIC_AREA_OFFSET - get offset from native SP to the address of the most recent dynamic alloca...
static MachinePointerInfo getFixedStack(MachineFunction &MF, int FI, int64_t Offset=0)
Return a MachinePointerInfo record that refers to the specified FrameIndex.
block_iterator block_end() const
BR_JT - Jumptable branch.
static std::vector< std::string > Flags
Representation of each machine instruction.
VACOPY - VACOPY has 5 operands: an input chain, a destination pointer, a source pointer, a SRCVALUE for the destination, and a SRCVALUE for the source.
SDValue getStackArgumentTokenFactor(SDValue Chain)
Compute a TokenFactor to force all the incoming stack arguments to be loaded from the stack...
These are IR-level optimization flags that may be propagated to SDNodes.
Represents a use of a SDNode.
SDValue getTargetBlockAddress(const BlockAddress *BA, EVT VT, int64_t Offset=0, unsigned char TargetFlags=0)
uint64_t getConstantOperandVal(unsigned i) const
SmallVector< SDValue, 32 > OutVals
GPRC, CHAIN = MFBHRBE CHAIN, Entry, Dummy - Move from branch history rolling buffer entry...
const MCPhysReg * getScratchRegisters(CallingConv::ID CC) const override
Returns a 0 terminated array of registers that can be safely used as scratch registers.
Bitwise operators - logical and, logical or, logical xor.
bool hasFnAttribute(Attribute::AttrKind Kind) const
Return true if the function has the attribute.
MachineBasicBlock * emitPatchPoint(MachineInstr &MI, MachineBasicBlock *MBB) const
Replace/modify any TargetFrameIndex operands with a targte-dependent sequence of memory operands that...
void splice(iterator Where, MachineBasicBlock *Other, iterator From)
Take an instruction from MBB 'Other' at the position From, and insert it into this MBB right before '...
SDValue getCopyFromReg(SDValue Chain, const SDLoc &dl, unsigned Reg, EVT VT)
MachineRegisterInfo & getRegInfo()
getRegInfo - Return information about the registers currently in use.
virtual void LowerAsmOperandForConstraint(SDValue Op, std::string &Constraint, std::vector< SDValue > &Ops, SelectionDAG &DAG) const
Lower the specified operand into the Ops vector.
Reciprocal estimate instructions (unary FP ops).
SMUL_LOHI/UMUL_LOHI - Multiply two integers of type iN, producing a signed/unsigned value of type i[2...
SIGN_EXTEND_INREG - This operator atomically performs a SHL/SRA pair to sign extend a small value in ...
static bool isXXBRShuffleMaskHelper(ShuffleVectorSDNode *N, int Width)
bool useLongCalls() const
bool isVMRGEOShuffleMask(ShuffleVectorSDNode *N, bool CheckEven, unsigned ShuffleKind, SelectionDAG &DAG)
isVMRGEOShuffleMask - Return true if this is a shuffle mask suitable for a VMRGEW or VMRGOW instructi...
LOAD and STORE have token chains as their first operand, then the same operands as an LLVM load/store...
F8RC = MFFS - This moves the FPSCR (not modeled) into the register.
Establish a view to a call site for examination.
unsigned getSizeInBits() const
Return the size of the specified value type in bits.
static MachineOperand CreateImm(int64_t Val)
ArrayRef< SDUse > ops() const
void AnalyzeReturn(const SmallVectorImpl< ISD::OutputArg > &Outs, CCAssignFn Fn)
AnalyzeReturn - Analyze the returned values of a return, incorporating info about the result values i...
Direct move from a GPR to a VSX register (zero)
LLVM_ATTRIBUTE_ALWAYS_INLINE size_type size() const
FunctionLoweringInfo - This contains information that is global to a function that is used when lower...
The CMPB instruction (takes two operands of i32 or i64).
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).
CallInst * CreateCall(Value *Callee, ArrayRef< Value * > Args=None, const Twine &Name="", MDNode *FPMathTag=nullptr)
unsigned MaxStoresPerMemmoveOptSize
Maximum number of store instructions that may be substituted for a call to memmove, used for functions with OptSize attribute.
unsigned MaxStoresPerMemcpyOptSize
Maximum number of store operations that may be substituted for a call to memcpy, used for functions w...
void setStackPointerRegisterToSaveRestore(unsigned R)
If set to a physical register, this specifies the register that llvm.savestack/llvm.restorestack should save and restore.
CHAIN = STBRX CHAIN, GPRC, Ptr, Type - This is a byte-swapping store instruction. ...
op_iterator op_end() const
Fast - This calling convention attempts to make calls as fast as possible (e.g.
unsigned getInstSizeInBytes(const MachineInstr &MI) const override
GetInstSize - Return the number of bytes of code the specified instruction may be.
const SDValue & getOffset() const
void setLibcallName(RTLIB::Libcall Call, const char *Name)
Rename the default libcall routine name for the specified libcall.
LLVM_NODISCARD std::enable_if<!is_simple_type< Y >::value, typename cast_retty< X, const Y >::ret_type >::type dyn_cast(const Y &Val)
constexpr int32_t SignExtend32(uint32_t X)
Sign-extend the number in the bottom B bits of X to a 32-bit integer.
static void setUsesTOCBasePtr(MachineFunction &MF)
TC_RETURN - A tail call return.
bool isNON_EXTLoad(const SDNode *N)
Returns true if the specified node is a non-extending load.
SDValue PerformDAGCombine(SDNode *N, DAGCombinerInfo &DCI) const override
This method will be invoked for all target nodes and for any target-independent nodes that the target...
FSINCOS - Compute both fsin and fcos as a single operation.
unsigned MaxStoresPerMemcpy
Specify maximum bytes of store instructions per memcpy call.
constexpr bool isUInt< 16 >(uint64_t x)
static MachinePointerInfo getConstantPool(MachineFunction &MF)
Return a MachinePointerInfo record that refers to the constant pool.
RESULT, OUTCHAIN = EH_SJLJ_SETJMP(INCHAIN, buffer) This corresponds to the eh.sjlj.setjmp intrinsic.
static bool isConstantOrUndef(int Op, int Val)
isConstantOrUndef - Op is either an undef node or a ConstantSDNode.
static bool isSplat(ArrayRef< Value * > VL)
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...
static bool isFunctionGlobalAddress(SDValue Callee)
bool useCRBits() const
useCRBits - Return true if we should store and manipulate i1 values in the individual condition regis...
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.
TLSModel::Model getTLSModel(const GlobalValue *GV) const
Returns the TLS model which should be used for the given global variable.
VSRC, CHAIN = XXSWAPD CHAIN, VSRC - Occurs only for little endian.
bool isPPC64() const
isPPC64 - Return true if we are generating code for 64-bit pointer mode.
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 ...
unsigned getReg() const
getReg - Returns the register number.
bool isFloatingPoint() const
Return true if this is a FP or a vector FP type.
std::pair< unsigned, const TargetRegisterClass * > getRegForInlineAsmConstraint(const TargetRegisterInfo *TRI, StringRef Constraint, MVT VT) const override
Given a physical register constraint (e.g.
assert(ImpDefSCC.getReg()==AMDGPU::SCC &&ImpDefSCC.isDef())
XXREVERSE - The PPC VSX reverse instruction.
void insert(iterator MBBI, MachineBasicBlock *MBB)
SDValue getFrameIndex(int FI, EVT VT, bool isTarget=false)
bool isAllOnesConstant(SDValue V)
Returns true if V is an integer constant with all bits set.
static SDValue combineBVOfVecSExt(SDNode *N, SelectionDAG &DAG)
void setReturnAddressIsTaken(bool s)
bool isSimple() const
Test if the given EVT is simple (as opposed to being extended).
unsigned getAlignment() const
void setMinStackArgumentAlignment(unsigned Align)
Set the minimum stack alignment of an argument (in log2(bytes)).
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...
void setSchedulingPreference(Sched::Preference Pref)
Specify the target scheduling preference.
static MachinePointerInfo getGOT(MachineFunction &MF)
Return a MachinePointerInfo record that refers to a GOT entry.
bool isOffsetFoldingLegal(const GlobalAddressSDNode *GA) const override
Return true if folding a constant offset with the given GlobalAddress is legal.
unsigned getPrimitiveSizeInBits() const LLVM_READONLY
Return the basic size of this type if it is a primitive type.
Module * getParent()
Get the module that this global value is contained inside of...
LLVM Value Representation.
FMA - Perform a * b + c with no intermediate rounding step.
static void StoreTailCallArgumentsToStackSlot(SelectionDAG &DAG, SDValue Chain, const SmallVectorImpl< TailCallArgumentInfo > &TailCallArgs, SmallVectorImpl< SDValue > &MemOpChains, const SDLoc &dl)
StoreTailCallArgumentsToStackSlot - Stores arguments to their stack slot.
SDValue getRegister(unsigned Reg, EVT VT)
void setUseUnderscoreSetJmp(bool Val)
Indicate whether this target prefers to use _setjmp to implement llvm.setjmp or the version without _...
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...
bool isTruncateFree(Type *Ty1, Type *Ty2) const override
isTruncateFree - Return true if it's free to truncate a value of type Ty1 to type Ty2...
CHAIN = COND_BRANCH CHAIN, CRRC, OPC, DESTBB [, INFLAG] - This corresponds to the COND_BRANCH pseudo ...
const MachineInstrBuilder & addMBB(MachineBasicBlock *MBB, unsigned char TargetFlags=0) const
Instruction * emitTrailingFence(IRBuilder<> &Builder, Instruction *Inst, AtomicOrdering Ord) const override
bool isNullConstant(SDValue V)
Returns true if V is a constant integer zero.
SDValue getSelectCC(const SDLoc &DL, SDValue LHS, SDValue RHS, SDValue True, SDValue False, ISD::CondCode Cond)
Helper function to make it easier to build SelectCC's if you just have an ISD::CondCode instead of an...
#define LLVM_FALLTHROUGH
LLVM_FALLTHROUGH - Mark fallthrough cases in switch statements.
SDValue getPICJumpTableRelocBase(SDValue Table, SelectionDAG &DAG) const override
Returns relocation base for the given PIC jumptable.
SDValue getValueType(EVT)
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.
PREFETCH - This corresponds to a prefetch intrinsic.
static cl::opt< bool > DisableILPPref("disable-ppc-ilp-pref", cl::desc("disable setting the node scheduling preference to ILP on PPC"), cl::Hidden)
These nodes represent PPC shifts.
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...
unsigned getDarwinDirective() const
getDarwinDirective - Returns the -m directive specified for the cpu.
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...
Primary interface to the complete machine description for the target machine.
block_iterator block_begin() const
static void getLabelAccessInfo(bool IsPIC, const PPCSubtarget &Subtarget, unsigned &HiOpFlags, unsigned &LoOpFlags, const GlobalValue *GV=nullptr)
Return true if we should reference labels using a PICBase, set the HiOpFlags and LoOpFlags to the tar...
StringRef - Represent a constant reference to a string, i.e.
APInt zext(unsigned width) const
Zero extend to a new width.
SetCC operator - This evaluates to a true value iff the condition is true.
virtual SDValue LowerToTLSEmulatedModel(const GlobalAddressSDNode *GA, SelectionDAG &DAG) const
Lower TLS global address SDNode for target independent emulated TLS model.
unsigned MaxStoresPerMemset
Specify maximum number of store instructions per memset call.
unsigned MaxStoresPerMemsetOptSize
Maximum number of stores operations that may be substituted for the call to memset, used for functions with OptSize attribute.
static BranchProbability getZero()
MachineBasicBlock * EmitAtomicBinary(MachineInstr &MI, MachineBasicBlock *MBB, unsigned AtomicSize, unsigned BinOpcode, unsigned CmpOpcode=0, unsigned CmpPred=0) const
StringRef getName() const
getName - Return the name of the corresponding LLVM function.
MERGE_VALUES - This node takes multiple discrete operands and returns them all as its individual resu...
unsigned getLocMemOffset() const
Extract a subvector from signed integer vector and convert to FP.
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.
RESVEC = VCMP(LHS, RHS, OPC) - Represents one of the altivec VCMP* instructions.
TRUNCATE - Completely drop the high bits.
EVT getShiftAmountTy(EVT LHSTy, const DataLayout &DL) const
FCTI[D,W]Z - The FCTIDZ and FCTIWZ instructions, taking an f32 or f64 operand, producing an f64 value...
Hi/Lo - These represent the high and low 16-bit parts of a global address respectively.
unsigned getLinkageSize() const
getLinkageSize - Return the size of the PowerPC ABI linkage area.
unsigned getAlignment() const
unsigned AllocateReg(unsigned Reg)
AllocateReg - Attempt to allocate one register.
const MachineInstrBuilder & addRegMask(const uint32_t *Mask) const
bool isXXBRHShuffleMask(ShuffleVectorSDNode *N)
isXXBRHShuffleMask - Return true if this is a shuffle mask suitable for a XXBRH instruction.
virtual ConstraintWeight getSingleConstraintMatchWeight(AsmOperandInfo &info, const char *constraint) const
Examine constraint string and operand type and determine a weight value.
Unlike LLVM values, Selection DAG nodes may return multiple values as the result of a computation...
On a symbol operand "FOO", this indicates that the reference is actually to "FOO@plt".
const MachineInstrBuilder & addReg(unsigned RegNo, unsigned flags=0, unsigned SubReg=0) const
Add a new virtual register operand.
FastISel * createFastISel(FunctionLoweringInfo &FuncInfo, const TargetLibraryInfo *LibInfo) const override
createFastISel - This method returns a target-specific FastISel object, or null if the target does no...
FNEG, FABS, FSQRT, FSIN, FCOS, FPOWI, FPOW, FLOG, FLOG2, FLOG10, FEXP, FEXP2, FCEIL, FTRUNC, FRINT, FNEARBYINT, FROUND, FFLOOR - Perform various unary floating point operations.
unsigned getJumpTableEncoding() const override
Return the entry encoding for a jump table in the current function.
F8RC = FADDRTZ F8RC, F8RC - This is an FADD done with rounding towards zero.
An SDNode for swaps that are not associated with any loads/stores and thereby have no chain...
unsigned AllocateStack(unsigned Size, unsigned Align)
AllocateStack - Allocate a chunk of stack space with the specified size and alignment.
RESVEC, OUTFLAG = VCMPo(LHS, RHS, OPC) - Represents one of the altivec VCMP*o instructions.
Val, OUTCHAIN = ATOMIC_LOAD(INCHAIN, ptr) This corresponds to "load atomic" instruction.
GPRC, CHAIN = LFIWZX CHAIN, Ptr - This is a floating-point load which zero-extends from a 32-bit inte...
int64_t getObjectSize(int ObjectIdx) const
Return the size of the specified object.
bool isIntS16Immediate(SDNode *N, int16_t &Imm)
isIntS16Immediate - This method tests to see if the node is either a 32-bit or 64-bit immediate...
SCALAR_TO_VECTOR(VAL) - This represents the operation of loading a scalar value into element 0 of the...
EVT changeVectorElementTypeToInteger() const
Return a vector with the same number of elements as this vector, but with the element type converted ...
MO_PIC_FLAG - If this bit is set, the symbol reference is relative to the function's picbase...
bool isVMRGHShuffleMask(ShuffleVectorSDNode *N, unsigned UnitSize, unsigned ShuffleKind, SelectionDAG &DAG)
isVMRGHShuffleMask - Return true if this is a shuffle mask suitable for a VRGH* instruction with the ...
MVT getSimpleVT() const
Return the SimpleValueType held in the specified simple EVT.
static SDValue CreateCopyOfByValArgument(SDValue Src, SDValue Dst, SDValue Chain, ISD::ArgFlagsTy Flags, SelectionDAG &DAG, const SDLoc &dl)
CreateCopyOfByValArgument - Make a copy of an aggregate at address specified by "Src" to address "Dst...
XXPERMDI - The PPC XXPERMDI instruction.
This file describes how to lower LLVM code to machine code.
StringRef getSection() const
SDValue getTargetGlobalAddress(const GlobalValue *GV, const SDLoc &DL, EVT VT, int64_t offset=0, unsigned char TargetFlags=0)
void setIndexedStoreAction(unsigned IdxMode, MVT VT, LegalizeAction Action)
Indicate that the specified indexed store does or does not work with the specified type and indicate ...
uint64_t getZExtValue() const
MemIndexedMode
MemIndexedMode enum - This enum defines the load / store indexed addressing modes.
bool isZExtFree(SDValue Val, EVT VT2) const override
Return true if zero-extending the specific node Val to type VT2 is free (either because it's implicit...
mmo_iterator memoperands_begin() const
Access to memory operands of the instruction.
MULHU/MULHS - Multiply high - Multiply two integers of type iN, producing an unsigned/signed value of...
int isQVALIGNIShuffleMask(SDNode *N)
If this is a qvaligni shuffle mask, return the shift amount, otherwise return -1. ...
unsigned getVectorNumElements() const
Given a vector type, return the number of elements it contains.
This class is used to represent ISD::LOAD nodes.
DYNAMIC_STACKALLOC - Allocate some number of bytes on the stack aligned to a specified boundary...
bool useSoftFloat() const override