81 #define DEBUG_TYPE "mips-lower" 83 STATISTIC(NumTailCalls,
"Number of tail calls");
91 cl::desc(
"MIPS: Don't trap on integer division by zero."),
95 Mips::D12_64, Mips::D13_64, Mips::D14_64, Mips::D15_64,
96 Mips::D16_64, Mips::D17_64, Mips::D18_64, Mips::D19_64
137 unsigned &NumIntermediates,
MVT &RegisterVT)
const {
140 IntermediateVT = RegisterVT;
145 return NumIntermediates;
155 unsigned Flag)
const {
161 unsigned Flag)
const {
167 unsigned Flag)
const {
173 unsigned Flag)
const {
179 unsigned Flag)
const {
569 unsigned LO = (Ty ==
MVT::i32) ? Mips::LO0 : Mips::LO0_64;
570 unsigned HI = (Ty ==
MVT::i32) ? Mips::HI0 : Mips::HI0_64;
632 "Illegal Condition Code");
773 return DAG.
getNode(Opc,
SDLoc(N), ValueIfFalse.getValueType(),
774 ValueIfFalse, FCC, ValueIfTrue, Glue);
784 unsigned FirstOperandOpc = FirstOperand.
getOpcode();
789 uint64_t Pos = 0, SMPos, SMSize;
795 if (!(CN = dyn_cast<ConstantSDNode>(Mask)) ||
805 if (!(CN = dyn_cast<ConstantSDNode>(FirstOperand.
getOperand(1))))
825 if (!(CN = dyn_cast<ConstantSDNode>(FirstOperand.
getOperand(1))))
830 if (SMPos != Pos || Pos >= ValTy.
getSizeInBits() || SMSize >= 32 ||
852 NewOperand = FirstOperand;
854 return DAG.
getNode(Opc, DL, ValTy, NewOperand,
870 uint64_t SMPos0, SMSize0, SMPos1, SMSize1;
877 if (!(CN = dyn_cast<ConstantSDNode>(And0.
getOperand(1))) ||
883 And1.getOperand(0).getOpcode() ==
ISD::SHL) {
885 if (!(CN = dyn_cast<ConstantSDNode>(And1.getOperand(1))) ||
890 if (SMPos0 != SMPos1 || SMSize0 != SMSize1)
895 if (!(CN = dyn_cast<ConstantSDNode>(Shl.
getOperand(1))))
903 if ((Shamt != SMPos0) || (SMPos0 + SMSize0 > ValTy.
getSizeInBits()))
916 if (~CN->
getSExtValue() == ((((int64_t)1 << SMSize0) - 1) << SMPos0) &&
917 ((SMSize0 + SMPos0 <= 64 && Subtarget.
hasMips64r2()) ||
918 (SMSize0 + SMPos0 <= 32))) {
922 if (!(CN1 = dyn_cast<ConstantSDNode>(And1->getOperand(1))))
925 if (!(CN1 = dyn_cast<ConstantSDNode>(N->
getOperand(1))))
1017 if (!IsSigned && !IsUnsigned)
1108 unsigned FirstOperandOpc = FirstOperand.
getOpcode();
1113 uint64_t Pos = 0, SMPos, SMSize;
1118 if (!(CN = dyn_cast<ConstantSDNode>(SecondOperand)))
1130 if (!(CN = dyn_cast<ConstantSDNode>(FirstOperand.
getOperand(1))) ||
1136 if (SMPos != 0 || SMSize > 32 || Pos + SMSize > ValTy.
getSizeInBits())
1225 case ISD::SRL_PARTS:
return lowerShiftRightParts(Op, DAG,
false);
1252 bool Is64Bit,
bool IsMicroMips) {
1261 TII.
get(IsMicroMips ? Mips::TEQ_MM : Mips::TEQ))
1285 case Mips::ATOMIC_LOAD_ADD_I8:
1286 return emitAtomicBinaryPartword(MI, BB, 1);
1287 case Mips::ATOMIC_LOAD_ADD_I16:
1288 return emitAtomicBinaryPartword(MI, BB, 2);
1289 case Mips::ATOMIC_LOAD_ADD_I32:
1290 return emitAtomicBinary(MI, BB);
1291 case Mips::ATOMIC_LOAD_ADD_I64:
1292 return emitAtomicBinary(MI, BB);
1294 case Mips::ATOMIC_LOAD_AND_I8:
1295 return emitAtomicBinaryPartword(MI, BB, 1);
1296 case Mips::ATOMIC_LOAD_AND_I16:
1297 return emitAtomicBinaryPartword(MI, BB, 2);
1298 case Mips::ATOMIC_LOAD_AND_I32:
1299 return emitAtomicBinary(MI, BB);
1300 case Mips::ATOMIC_LOAD_AND_I64:
1301 return emitAtomicBinary(MI, BB);
1303 case Mips::ATOMIC_LOAD_OR_I8:
1304 return emitAtomicBinaryPartword(MI, BB, 1);
1305 case Mips::ATOMIC_LOAD_OR_I16:
1306 return emitAtomicBinaryPartword(MI, BB, 2);
1307 case Mips::ATOMIC_LOAD_OR_I32:
1308 return emitAtomicBinary(MI, BB);
1309 case Mips::ATOMIC_LOAD_OR_I64:
1310 return emitAtomicBinary(MI, BB);
1312 case Mips::ATOMIC_LOAD_XOR_I8:
1313 return emitAtomicBinaryPartword(MI, BB, 1);
1314 case Mips::ATOMIC_LOAD_XOR_I16:
1315 return emitAtomicBinaryPartword(MI, BB, 2);
1316 case Mips::ATOMIC_LOAD_XOR_I32:
1317 return emitAtomicBinary(MI, BB);
1318 case Mips::ATOMIC_LOAD_XOR_I64:
1319 return emitAtomicBinary(MI, BB);
1321 case Mips::ATOMIC_LOAD_NAND_I8:
1322 return emitAtomicBinaryPartword(MI, BB, 1);
1323 case Mips::ATOMIC_LOAD_NAND_I16:
1324 return emitAtomicBinaryPartword(MI, BB, 2);
1325 case Mips::ATOMIC_LOAD_NAND_I32:
1326 return emitAtomicBinary(MI, BB);
1327 case Mips::ATOMIC_LOAD_NAND_I64:
1328 return emitAtomicBinary(MI, BB);
1330 case Mips::ATOMIC_LOAD_SUB_I8:
1331 return emitAtomicBinaryPartword(MI, BB, 1);
1332 case Mips::ATOMIC_LOAD_SUB_I16:
1333 return emitAtomicBinaryPartword(MI, BB, 2);
1334 case Mips::ATOMIC_LOAD_SUB_I32:
1335 return emitAtomicBinary(MI, BB);
1336 case Mips::ATOMIC_LOAD_SUB_I64:
1337 return emitAtomicBinary(MI, BB);
1339 case Mips::ATOMIC_SWAP_I8:
1340 return emitAtomicBinaryPartword(MI, BB, 1);
1341 case Mips::ATOMIC_SWAP_I16:
1342 return emitAtomicBinaryPartword(MI, BB, 2);
1343 case Mips::ATOMIC_SWAP_I32:
1344 return emitAtomicBinary(MI, BB);
1345 case Mips::ATOMIC_SWAP_I64:
1346 return emitAtomicBinary(MI, BB);
1348 case Mips::ATOMIC_CMP_SWAP_I8:
1349 return emitAtomicCmpSwapPartword(MI, BB, 1);
1350 case Mips::ATOMIC_CMP_SWAP_I16:
1351 return emitAtomicCmpSwapPartword(MI, BB, 2);
1352 case Mips::ATOMIC_CMP_SWAP_I32:
1353 return emitAtomicCmpSwap(MI, BB);
1354 case Mips::ATOMIC_CMP_SWAP_I64:
1355 return emitAtomicCmpSwap(MI, BB);
1356 case Mips::PseudoSDIV:
1357 case Mips::PseudoUDIV:
1364 case Mips::SDIV_MM_Pseudo:
1365 case Mips::UDIV_MM_Pseudo:
1368 case Mips::DIV_MMR6:
1369 case Mips::DIVU_MMR6:
1370 case Mips::MOD_MMR6:
1371 case Mips::MODU_MMR6:
1373 case Mips::PseudoDSDIV:
1374 case Mips::PseudoDUDIV:
1381 case Mips::PseudoSELECT_I:
1382 case Mips::PseudoSELECT_I64:
1383 case Mips::PseudoSELECT_S:
1384 case Mips::PseudoSELECT_D32:
1385 case Mips::PseudoSELECT_D64:
1386 return emitPseudoSELECT(MI, BB,
false, Mips::BNE);
1387 case Mips::PseudoSELECTFP_F_I:
1388 case Mips::PseudoSELECTFP_F_I64:
1389 case Mips::PseudoSELECTFP_F_S:
1390 case Mips::PseudoSELECTFP_F_D32:
1391 case Mips::PseudoSELECTFP_F_D64:
1392 return emitPseudoSELECT(MI, BB,
true, Mips::BC1F);
1393 case Mips::PseudoSELECTFP_T_I:
1394 case Mips::PseudoSELECTFP_T_I64:
1395 case Mips::PseudoSELECTFP_T_S:
1396 case Mips::PseudoSELECTFP_T_D32:
1397 case Mips::PseudoSELECTFP_T_D64:
1398 return emitPseudoSELECT(MI, BB,
true, Mips::BC1T);
1415 case Mips::ATOMIC_LOAD_ADD_I32:
1416 AtomicOp = Mips::ATOMIC_LOAD_ADD_I32_POSTRA;
1418 case Mips::ATOMIC_LOAD_SUB_I32:
1419 AtomicOp = Mips::ATOMIC_LOAD_SUB_I32_POSTRA;
1421 case Mips::ATOMIC_LOAD_AND_I32:
1422 AtomicOp = Mips::ATOMIC_LOAD_AND_I32_POSTRA;
1424 case Mips::ATOMIC_LOAD_OR_I32:
1425 AtomicOp = Mips::ATOMIC_LOAD_OR_I32_POSTRA;
1427 case Mips::ATOMIC_LOAD_XOR_I32:
1428 AtomicOp = Mips::ATOMIC_LOAD_XOR_I32_POSTRA;
1430 case Mips::ATOMIC_LOAD_NAND_I32:
1431 AtomicOp = Mips::ATOMIC_LOAD_NAND_I32_POSTRA;
1433 case Mips::ATOMIC_SWAP_I32:
1434 AtomicOp = Mips::ATOMIC_SWAP_I32_POSTRA;
1436 case Mips::ATOMIC_LOAD_ADD_I64:
1437 AtomicOp = Mips::ATOMIC_LOAD_ADD_I64_POSTRA;
1439 case Mips::ATOMIC_LOAD_SUB_I64:
1440 AtomicOp = Mips::ATOMIC_LOAD_SUB_I64_POSTRA;
1442 case Mips::ATOMIC_LOAD_AND_I64:
1443 AtomicOp = Mips::ATOMIC_LOAD_AND_I64_POSTRA;
1445 case Mips::ATOMIC_LOAD_OR_I64:
1446 AtomicOp = Mips::ATOMIC_LOAD_OR_I64_POSTRA;
1448 case Mips::ATOMIC_LOAD_XOR_I64:
1449 AtomicOp = Mips::ATOMIC_LOAD_XOR_I64_POSTRA;
1451 case Mips::ATOMIC_LOAD_NAND_I64:
1452 AtomicOp = Mips::ATOMIC_LOAD_NAND_I64_POSTRA;
1454 case Mips::ATOMIC_SWAP_I64:
1455 AtomicOp = Mips::ATOMIC_SWAP_I64_POSTRA;
1506 BuildMI(*BB, II, DL, TII->
get(Mips::COPY), IncrCopy).addReg(Incr);
1507 BuildMI(*BB, II, DL, TII->
get(Mips::COPY), PtrCopy).addReg(Ptr);
1523 unsigned SrcReg)
const {
1528 BuildMI(BB, DL, TII->
get(Mips::SEB), DstReg).addReg(SrcReg);
1533 BuildMI(BB, DL, TII->
get(Mips::SEH), DstReg).addReg(SrcReg);
1543 int64_t ShiftImm = 32 - (Size * 8);
1545 BuildMI(BB, DL, TII->
get(Mips::SLL), ScrReg).addReg(SrcReg).
addImm(ShiftImm);
1553 assert((Size == 1 || Size == 2) &&
1554 "Unsupported size for EmitAtomicBinaryPartial.");
1581 unsigned AtomicOp = 0;
1583 case Mips::ATOMIC_LOAD_NAND_I8:
1584 AtomicOp = Mips::ATOMIC_LOAD_NAND_I8_POSTRA;
1586 case Mips::ATOMIC_LOAD_NAND_I16:
1587 AtomicOp = Mips::ATOMIC_LOAD_NAND_I16_POSTRA;
1589 case Mips::ATOMIC_SWAP_I8:
1590 AtomicOp = Mips::ATOMIC_SWAP_I8_POSTRA;
1592 case Mips::ATOMIC_SWAP_I16:
1593 AtomicOp = Mips::ATOMIC_SWAP_I16_POSTRA;
1595 case Mips::ATOMIC_LOAD_ADD_I8:
1596 AtomicOp = Mips::ATOMIC_LOAD_ADD_I8_POSTRA;
1598 case Mips::ATOMIC_LOAD_ADD_I16:
1599 AtomicOp = Mips::ATOMIC_LOAD_ADD_I16_POSTRA;
1601 case Mips::ATOMIC_LOAD_SUB_I8:
1602 AtomicOp = Mips::ATOMIC_LOAD_SUB_I8_POSTRA;
1604 case Mips::ATOMIC_LOAD_SUB_I16:
1605 AtomicOp = Mips::ATOMIC_LOAD_SUB_I16_POSTRA;
1607 case Mips::ATOMIC_LOAD_AND_I8:
1608 AtomicOp = Mips::ATOMIC_LOAD_AND_I8_POSTRA;
1610 case Mips::ATOMIC_LOAD_AND_I16:
1611 AtomicOp = Mips::ATOMIC_LOAD_AND_I16_POSTRA;
1613 case Mips::ATOMIC_LOAD_OR_I8:
1614 AtomicOp = Mips::ATOMIC_LOAD_OR_I8_POSTRA;
1616 case Mips::ATOMIC_LOAD_OR_I16:
1617 AtomicOp = Mips::ATOMIC_LOAD_OR_I16_POSTRA;
1619 case Mips::ATOMIC_LOAD_XOR_I8:
1620 AtomicOp = Mips::ATOMIC_LOAD_XOR_I8_POSTRA;
1622 case Mips::ATOMIC_LOAD_XOR_I16:
1623 AtomicOp = Mips::ATOMIC_LOAD_XOR_I16_POSTRA;
1652 int64_t MaskImm = (Size == 1) ? 255 : 65535;
1657 BuildMI(BB, DL, TII->
get(Mips::ANDi), PtrLSB2)
1658 .addReg(Ptr, 0, ArePtrs64bit ? Mips::sub_32 : 0).
addImm(3);
1664 .addReg(PtrLSB2).
addImm((Size == 1) ? 3 : 2);
1667 BuildMI(BB, DL, TII->
get(Mips::ORi), MaskUpper)
1668 .addReg(Mips::ZERO).
addImm(MaskImm);
1670 .addReg(MaskUpper).
addReg(ShiftAmt);
1671 BuildMI(BB, DL, TII->
get(Mips::NOR), Mask2).addReg(Mips::ZERO).
addReg(Mask);
1672 BuildMI(BB, DL, TII->
get(Mips::SLLV), Incr2).addReg(Incr).
addReg(ShiftAmt);
1704 MipsTargetLowering::emitAtomicCmpSwap(
MachineInstr &MI,
1708 MI.
getOpcode() == Mips::ATOMIC_CMP_SWAP_I64) &&
1709 "Unsupported atomic psseudo for EmitAtomicCmpSwap.");
1711 const unsigned Size = MI.
getOpcode() == Mips::ATOMIC_CMP_SWAP_I32 ? 4 : 8;
1719 unsigned AtomicOp = MI.
getOpcode() == Mips::ATOMIC_CMP_SWAP_I32
1720 ? Mips::ATOMIC_CMP_SWAP_I32_POSTRA
1721 : Mips::ATOMIC_CMP_SWAP_I64_POSTRA;
1740 BuildMI(*BB, II, DL, TII->
get(Mips::COPY), DestCopy).addReg(Dest);
1741 BuildMI(*BB, II, DL, TII->
get(Mips::COPY), PtrCopy).addReg(Ptr);
1742 BuildMI(*BB, II, DL, TII->
get(Mips::COPY), OldValCopy).addReg(OldVal);
1743 BuildMI(*BB, II, DL, TII->
get(Mips::COPY), NewValCopy).addReg(NewVal);
1764 assert((Size == 1 || Size == 2) &&
1765 "Unsupported size for EmitAtomicCmpSwapPartial.");
1792 unsigned AtomicOp = MI.
getOpcode() == Mips::ATOMIC_CMP_SWAP_I8
1793 ? Mips::ATOMIC_CMP_SWAP_I8_POSTRA
1794 : Mips::ATOMIC_CMP_SWAP_I16_POSTRA;
1835 int64_t MaskImm = (Size == 1) ? 255 : 65535;
1836 BuildMI(BB, DL, TII->
get(ArePtrs64bit ? Mips::DADDiu : Mips::ADDiu), MaskLSB2)
1839 .addReg(Ptr).
addReg(MaskLSB2);
1840 BuildMI(BB, DL, TII->
get(Mips::ANDi), PtrLSB2)
1841 .addReg(Ptr, 0, ArePtrs64bit ? Mips::sub_32 : 0).
addImm(3);
1847 .addReg(PtrLSB2).
addImm((Size == 1) ? 3 : 2);
1850 BuildMI(BB, DL, TII->
get(Mips::ORi), MaskUpper)
1851 .addReg(Mips::ZERO).
addImm(MaskImm);
1853 .addReg(MaskUpper).
addReg(ShiftAmt);
1854 BuildMI(BB, DL, TII->
get(Mips::NOR), Mask2).addReg(Mips::ZERO).
addReg(Mask);
1855 BuildMI(BB, DL, TII->
get(Mips::ANDi), MaskedCmpVal)
1856 .addReg(CmpVal).
addImm(MaskImm);
1857 BuildMI(BB, DL, TII->
get(Mips::SLLV), ShiftedCmpVal)
1858 .addReg(MaskedCmpVal).
addReg(ShiftAmt);
1859 BuildMI(BB, DL, TII->
get(Mips::ANDi), MaskedNewVal)
1860 .addReg(NewVal).
addImm(MaskImm);
1861 BuildMI(BB, DL, TII->
get(Mips::SLLV), ShiftedNewVal)
1862 .addReg(MaskedNewVal).
addReg(ShiftAmt);
1907 FCC0, Dest, CondRes);
1929 "Floating point operand expected.");
1970 if (GV->hasLocalLinkage())
1980 N,
SDLoc(N), Ty, DAG,
2029 Entry.
Node = Argument;
2031 Args.push_back(Entry);
2036 .setLibCallee(
CallingConv::C, PtrTy, TlsGetAddr, std::move(Args));
2037 std::pair<SDValue, SDValue> CallResult =
LowerCallTo(CLI);
2136 const Value *SV = cast<SrcValueSDNode>(Node->
getOperand(2))->getValue();
2152 assert(((Align & (Align-1)) == 0) &&
"Expected Align to be a power of 2");
2164 unsigned ArgSizeInBytes =
2180 unsigned Adjustment = ArgSlotSizeInBytes - ArgSizeInBytes;
2189 bool HasExtractInsert) {
2208 if (HasExtractInsert) {
2236 bool HasExtractInsert) {
2247 if (HasExtractInsert) {
2253 if (WidthX > WidthY)
2255 else if (WidthY > WidthX)
2274 if (WidthX > WidthY)
2276 else if (WidthY > WidthX)
2297 "Frame address can only be determined for current frame.");
2315 "Return address can be determined only for current frame.");
2346 unsigned OffsetReg =
ABI.
IsN64() ? Mips::V1_64 : Mips::V1;
2347 unsigned AddrReg =
ABI.
IsN64() ? Mips::V0_64 : Mips::V0;
2432 IsSRA ? Ext : DAG.
getConstant(0, DL, VT), ShiftRightHi);
2450 SDValue Ops[] = { Chain, Ptr, Src };
2464 if ((LD->
getAlignment() >= MemVT.getSizeInBits() / 8) ||
2642 static const MCPhysReg IntRegs[] = { Mips::A0, Mips::A1, Mips::A2, Mips::A3 };
2646 static const MCPhysReg F32Regs[] = { Mips::F12, Mips::F14 };
2648 static const MCPhysReg FloatVectorIntRegs[] = { Mips::A0, Mips::A2 };
2660 else if (ArgFlags.
isZExt())
2672 else if (ArgFlags.
isZExt())
2683 bool AllocateFloatsInIntReg = State.
isVarArg() || ValNo > 1 ||
2686 bool isI64 = (ValVT ==
MVT::i32 && OrigAlign == 8);
2690 if (ValVT ==
MVT::i32 && isVectorFloat) {
2697 if (Reg == Mips::A2)
2706 }
else if (ValVT ==
MVT::i32 || (ValVT ==
MVT::f32 && AllocateFloatsInIntReg)) {
2710 if (isI64 && (Reg == Mips::A1 || Reg == Mips::A3))
2713 }
else if (ValVT ==
MVT::f64 && AllocateFloatsInIntReg) {
2717 if (Reg == Mips::A1 || Reg == Mips::A3)
2731 if (Reg2 == Mips::A1 || Reg2 == Mips::A3)
2750 static const MCPhysReg F64Regs[] = { Mips::D6, Mips::D7 };
2752 return CC_MipsO32(ValNo, ValVT, LocVT, LocInfo, ArgFlags, State, F64Regs);
2758 static const MCPhysReg F64Regs[] = { Mips::D12_64, Mips::D14_64 };
2760 return CC_MipsO32(ValNo, ValVT, LocVT, LocInfo, ArgFlags, State, F64Regs);
2767 #include "MipsGenCallingConv.inc" 2782 assert((Reg == Mips::A0) || (Reg == Mips::A2));
2783 return (Reg == Mips::A0) ? Mips::A1 : Mips::A3;
2788 const SDLoc &DL,
bool IsTailCall,
2806 std::deque<std::pair<unsigned, SDValue>> &RegsToPass,
2807 bool IsPICCall,
bool GlobalOrExternal,
bool InternalLinkage,
2820 if (IsPICCall && !InternalLinkage && IsCallReloc) {
2821 unsigned GPReg =
ABI.
IsN64() ? Mips::GP_64 : Mips::GP;
2823 RegsToPass.push_back(std::make_pair(GPReg,
getGlobalReg(CLI.
DAG, Ty)));
2832 for (
unsigned i = 0, e = RegsToPass.size(); i != e; ++i) {
2834 RegsToPass[i].second, InFlag);
2840 for (
unsigned i = 0, e = RegsToPass.size(); i != e; ++i)
2842 RegsToPass[i].second.getValueType()));
2848 assert(Mask &&
"Missing call preserved mask for calling convention");
2852 Function *
F =
G->getGlobal()->getParent()->getFunction(Sym);
2893 dyn_cast_or_null<const ExternalSymbolSDNode>(Callee.
getNode());
2919 bool MemcpyInByVal = ES &&
2926 unsigned ReservedArgArea =
2938 bool InternalLinkage =
false;
2940 IsTailCall = isEligibleForTailCallOptimization(
2943 InternalLinkage =
G->getGlobal()->hasInternalLinkage();
2944 IsTailCall &= (InternalLinkage ||
G->getGlobal()->hasLocalLinkage() ||
2945 G->getGlobal()->hasPrivateLinkage() ||
2946 G->getGlobal()->hasHiddenVisibility() ||
2947 G->getGlobal()->hasProtectedVisibility());
2952 "site marked musttail");
2961 NextStackOffset =
alignTo(NextStackOffset, StackAlignment);
2964 if (!(IsTailCall || MemcpyInByVal))
2971 std::deque<std::pair<unsigned, SDValue>> RegsToPass;
2977 for (
unsigned i = 0, e = ArgLocs.
size(); i != e; ++i) {
2982 bool UseUpperBits =
false;
2986 unsigned FirstByValReg, LastByValReg;
2991 "ByVal args of size 0 should have been ignored by front-end.");
2994 "Do not tail-call optimize if there is a byval argument.");
2995 passByValArg(Chain, DL, RegsToPass, MemOpChains, StackPtr, MFI, DAG, Arg,
3021 RegsToPass.push_back(std::make_pair(LocRegLo, Lo));
3022 RegsToPass.push_back(std::make_pair(LocRegHigh, Hi));
3031 UseUpperBits =
true;
3037 UseUpperBits =
true;
3043 UseUpperBits =
true;
3051 unsigned ValSizeInBits = Outs[i].ArgVT.getSizeInBits();
3061 RegsToPass.push_back(std::make_pair(VA.
getLocReg(),
Arg));
3071 Chain,
Arg, DL, IsTailCall, DAG));
3076 if (!MemOpChains.
empty())
3084 bool GlobalOrExternal =
false, IsCallReloc =
false;
3093 if (
auto *N = dyn_cast<ExternalSymbolSDNode>(Callee)) {
3098 }
else if (
auto *N = dyn_cast<GlobalAddressSDNode>(Callee)) {
3102 if (
auto *
F = dyn_cast<Function>(N->getGlobal())) {
3103 if (
F->hasFnAttribute(
"long-call"))
3104 UseLongCalls =
true;
3105 else if (
F->hasFnAttribute(
"short-call"))
3106 UseLongCalls =
false;
3120 if (InternalLinkage)
3136 GlobalOrExternal =
true;
3139 const char *Sym = S->getSymbol();
3155 GlobalOrExternal =
true;
3161 getOpndList(Ops, RegsToPass, IsPIC, GlobalOrExternal, InternalLinkage,
3162 IsCallReloc, CLI, Callee, Chain);
3174 if (!(MemcpyInByVal)) {
3182 return LowerCallResult(Chain, InFlag, CallConv, IsVarArg, Ins, DL, DAG,
3188 SDValue MipsTargetLowering::LowerCallResult(
3199 dyn_cast_or_null<const ExternalSymbolSDNode>(CLI.
Callee.
getNode());
3200 CCInfo.AnalyzeCallResult(Ins, RetCC_Mips, CLI.
RetTy,
3201 ES ? ES->getSymbol() :
nullptr);
3204 for (
unsigned i = 0; i != RVLocs.
size(); ++i) {
3209 RVLocs[i].getLocVT(), InFlag);
3214 unsigned ValSizeInBits = Ins[i].ArgVT.getSizeInBits();
3315 SDValue MipsTargetLowering::LowerFormalArguments(
3326 std::vector<SDValue> OutChains;
3338 "Functions with the interrupt attribute cannot have arguments!");
3340 CCInfo.AnalyzeFormalArguments(Ins, CC_Mips_FixedArg);
3342 CCInfo.getInRegsParamsCount() > 0);
3344 unsigned CurArgIdx = 0;
3345 CCInfo.rewindByValRegsInfo();
3347 for (
unsigned i = 0, e = ArgLocs.
size(); i != e; ++i) {
3349 if (Ins[i].isOrigArg()) {
3350 std::advance(FuncArg, Ins[i].getOrigArgIndex() - CurArgIdx);
3351 CurArgIdx = Ins[i].getOrigArgIndex();
3358 assert(Ins[i].isOrigArg() &&
"Byval arguments cannot be implicit");
3359 unsigned FirstByValReg, LastByValReg;
3360 unsigned ByValIdx = CCInfo.getInRegsParamsProcessed();
3361 CCInfo.getInRegsParamInfo(ByValIdx, FirstByValReg, LastByValReg);
3364 "ByVal args of size 0 should have been ignored by front-end.");
3365 assert(ByValIdx < CCInfo.getInRegsParamsCount());
3366 copyByValRegs(Chain, DL, OutChains, DAG, Flags, InVals, &*FuncArg,
3367 FirstByValReg, LastByValReg, VA, CCInfo);
3368 CCInfo.nextInRegsParam();
3399 ArgValue, ArgValue2);
3425 LocVT, DL, Chain, FIN,
3427 OutChains.push_back(ArgValue.
getValue(1));
3435 for (
unsigned i = 0, e = ArgLocs.
size(); i != e; ++i) {
3439 if (Ins[i].Flags.isSRet()) {
3453 writeVarArgRegs(OutChains, Chain, DL, DAG, CCInfo);
3457 if (!OutChains.empty()) {
3458 OutChains.push_back(Chain);
3475 MipsCCState CCInfo(CallConv, IsVarArg, MF, RVLocs, Context);
3480 MipsTargetLowering::shouldSignExtendTypeInLibCall(
EVT Type,
bool IsSigned)
const {
3520 for (
unsigned i = 0; i != RVLocs.
size(); ++i) {
3524 bool UseUpperBits =
false;
3535 UseUpperBits =
true;
3541 UseUpperBits =
true;
3547 UseUpperBits =
true;
3555 unsigned ValSizeInBits = Outs[i].ArgVT.getSizeInBits();
3581 unsigned V0 =
ABI.
IsN64() ? Mips::V0_64 : Mips::V0;
3596 return LowerInterruptReturn(RetOps, DL, DAG);
3609 MipsTargetLowering::getConstraintType(
StringRef Constraint)
const {
3621 if (Constraint.
size() == 1) {
3622 switch (Constraint[0]) {
3636 if (Constraint ==
"ZC")
3646 MipsTargetLowering::getSingleConstraintMatchWeight(
3647 AsmOperandInfo &
info,
const char *constraint)
const {
3649 Value *CallOperandVal = info.CallOperandVal;
3652 if (!CallOperandVal)
3656 switch (*constraint) {
3685 if (isa<ConstantInt>(CallOperandVal))
3700 unsigned long long &
Reg) {
3701 if (C.
front() !=
'{' || C.
back() !=
'}')
3702 return std::make_pair(
false,
false);
3712 return std::make_pair(
true,
false);
3723 return VT.
bitsLT(MinVT) ? MinVT : VT;
3726 std::pair<unsigned, const TargetRegisterClass *> MipsTargetLowering::
3732 unsigned long long Reg;
3737 return std::make_pair(0U,
nullptr);
3739 if ((Prefix ==
"hi" || Prefix ==
"lo")) {
3742 return std::make_pair(0U,
nullptr);
3745 Mips::HI32RegClassID : Mips::LO32RegClassID);
3746 return std::make_pair(*(RC->
begin()), RC);
3752 return std::make_pair(0U,
nullptr);
3755 .Case(
"$msair", Mips::MSAIR)
3756 .
Case(
"$msacsr", Mips::MSACSR)
3757 .
Case(
"$msaaccess", Mips::MSAAccess)
3758 .
Case(
"$msasave", Mips::MSASave)
3759 .
Case(
"$msamodify", Mips::MSAModify)
3760 .
Case(
"$msarequest", Mips::MSARequest)
3761 .
Case(
"$msamap", Mips::MSAMap)
3762 .
Case(
"$msaunmap", Mips::MSAUnmap)
3766 return std::make_pair(0U,
nullptr);
3769 return std::make_pair(Reg, RC);
3773 return std::make_pair(0U,
nullptr);
3775 if (Prefix ==
"$f") {
3783 if (RC == &Mips::AFGR64RegClass) {
3787 }
else if (Prefix ==
"$fcc")
3789 else if (Prefix ==
"$w") {
3796 assert(Reg < RC->getNumRegs());
3797 return std::make_pair(*(RC->
begin() +
Reg), RC);
3803 std::pair<unsigned, const TargetRegisterClass *>
3807 if (Constraint.
size() == 1) {
3808 switch (Constraint[0]) {
3814 return std::make_pair(0U, &Mips::CPU16RegsRegClass);
3815 return std::make_pair(0U, &Mips::GPR32RegClass);
3818 return std::make_pair(0U, &Mips::GPR32RegClass);
3820 return std::make_pair(0U, &Mips::GPR64RegClass);
3822 return std::make_pair(0U,
nullptr);
3825 return std::make_pair(0U, &Mips::MSA128BRegClass);
3827 return std::make_pair(0U, &Mips::MSA128HRegClass);
3829 return std::make_pair(0U, &Mips::MSA128WRegClass);
3831 return std::make_pair(0U, &Mips::MSA128DRegClass);
3833 return std::make_pair(0U, &Mips::FGR32RegClass);
3836 return std::make_pair(0U, &Mips::FGR64RegClass);
3837 return std::make_pair(0U, &Mips::AFGR64RegClass);
3842 return std::make_pair((
unsigned)Mips::T9, &Mips::GPR32RegClass);
3844 return std::make_pair((
unsigned)Mips::T9_64, &Mips::GPR64RegClass);
3846 return std::make_pair(0U,
nullptr);
3850 return std::make_pair((
unsigned)Mips::LO0, &Mips::LO32RegClass);
3851 return std::make_pair((
unsigned)Mips::LO0_64, &Mips::LO64RegClass);
3856 return std::make_pair(0U,
nullptr);
3860 std::pair<unsigned, const TargetRegisterClass *> R;
3861 R = parseRegForInlineAsmConstraint(Constraint, VT);
3871 void MipsTargetLowering::LowerAsmOperandForConstraint(
SDValue Op,
3872 std::string &Constraint,
3873 std::vector<SDValue>&Ops,
3879 if (Constraint.length() > 1)
return;
3881 char ConstraintLetter = Constraint[0];
3882 switch (ConstraintLetter) {
3888 int64_t Val = C->getSExtValue();
3898 int64_t Val = C->getZExtValue();
3908 uint64_t Val = (uint64_t)C->getZExtValue();
3918 int64_t Val = C->getSExtValue();
3919 if ((
isInt<32>(Val)) && ((Val & 0xffff) == 0)){
3928 int64_t Val = C->getSExtValue();
3929 if ((Val >= -65535) && (Val <= -1)) {
3938 int64_t Val = C->getSExtValue();
3939 if ((isInt<15>(Val))) {
3948 int64_t Val = C->getSExtValue();
3949 if ((Val <= 65535) && (Val >= 1)) {
3958 Ops.push_back(Result);
3965 bool MipsTargetLowering::isLegalAddressingMode(
const DataLayout &DL,
3992 EVT MipsTargetLowering::getOptimalMemOpType(uint64_t Size,
unsigned DstAlign,
3994 bool IsMemset,
bool ZeroMemset,
4003 bool MipsTargetLowering::isFPImmLegal(
const APFloat &Imm,
EVT VT)
const {
4011 unsigned MipsTargetLowering::getJumpTableEncoding()
const {
4020 bool MipsTargetLowering::useSoftFloat()
const {
4024 void MipsTargetLowering::copyByValRegs(
4025 SDValue Chain,
const SDLoc &DL, std::vector<SDValue> &OutChains,
4028 unsigned FirstReg,
unsigned LastReg,
const CCValAssign &VA,
4033 unsigned NumRegs = LastReg - FirstReg;
4034 unsigned RegAreaSize = NumRegs * GPRSizeInBytes;
4042 (
int)((ByValArgRegs.
size() - FirstReg) * GPRSizeInBytes);
4064 for (
unsigned I = 0; I < NumRegs; ++
I) {
4065 unsigned ArgReg = ByValArgRegs[FirstReg +
I];
4066 unsigned VReg =
addLiveIn(MF, ArgReg, RC);
4067 unsigned Offset = I * GPRSizeInBytes;
4072 OutChains.push_back(Store);
4077 void MipsTargetLowering::passByValArg(
4079 std::deque<std::pair<unsigned, SDValue>> &RegsToPass,
4085 unsigned OffsetInBytes = 0;
4087 unsigned Alignment = std::min(Flags.
getByValAlign(), RegSizeInBytes);
4090 unsigned NumRegs = LastReg - FirstReg;
4094 bool LeftoverBytes = (NumRegs * RegSizeInBytes > ByValSizeInBytes);
4098 for (; I < NumRegs - LeftoverBytes; ++
I, OffsetInBytes += RegSizeInBytes) {
4104 unsigned ArgReg = ArgRegs[FirstReg +
I];
4105 RegsToPass.push_back(std::make_pair(ArgReg, LoadVal));
4109 if (ByValSizeInBytes == OffsetInBytes)
4113 if (LeftoverBytes) {
4116 for (
unsigned LoadSizeInBytes = RegSizeInBytes / 2, TotalBytesLoaded = 0;
4117 OffsetInBytes < ByValSizeInBytes; LoadSizeInBytes /= 2) {
4118 unsigned RemainingSizeInBytes = ByValSizeInBytes - OffsetInBytes;
4120 if (RemainingSizeInBytes < LoadSizeInBytes)
4136 Shamt = TotalBytesLoaded * 8;
4138 Shamt = (RegSizeInBytes - (TotalBytesLoaded + LoadSizeInBytes)) * 8;
4148 OffsetInBytes += LoadSizeInBytes;
4149 TotalBytesLoaded += LoadSizeInBytes;
4150 Alignment = std::min(Alignment, LoadSizeInBytes);
4153 unsigned ArgReg = ArgRegs[FirstReg +
I];
4154 RegsToPass.push_back(std::make_pair(ArgReg, Val));
4160 unsigned MemCpySize = ByValSizeInBytes - OffsetInBytes;
4165 Chain = DAG.
getMemcpy(Chain, DL, Dst, Src,
4167 Alignment,
false,
false,
4173 void MipsTargetLowering::writeVarArgRegs(std::vector<SDValue> &OutChains,
4189 if (ArgRegs.
size() == Idx)
4194 (
int)(RegSizeInBytes * (ArgRegs.
size() - Idx));
4206 for (
unsigned I = Idx; I < ArgRegs.
size();
4207 ++
I, VaArgOffset += RegSizeInBytes) {
4214 cast<StoreSDNode>(Store.
getNode())->getMemOperand()->setValue(
4216 OutChains.push_back(Store);
4221 unsigned Align)
const {
4224 assert(Size &&
"Byval argument's size shouldn't be 0.");
4228 unsigned FirstReg = 0;
4229 unsigned NumRegs = 0;
4240 assert(!(Align % RegSizeInBytes) &&
4241 "Byval argument's alignment should be a multiple of" 4250 if ((Align > RegSizeInBytes) && (FirstReg % 2)) {
4251 State->
AllocateReg(IntArgRegs[FirstReg], ShadowRegs[FirstReg]);
4256 Size =
alignTo(Size, RegSizeInBytes);
4257 for (
unsigned I = FirstReg; Size > 0 && (I < IntArgRegs.
size());
4258 Size -= RegSizeInBytes, ++
I, ++NumRegs)
4268 unsigned Opc)
const {
4270 "Subtarget already supports SELECT nodes with the use of" 4271 "conditional-move instructions.");
4351 .Case(
"$28", Mips::GP_64)
4357 .Case(
"$28", Mips::GP)
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.
const MipsTargetLowering * createMipsSETargetLowering(const MipsTargetMachine &TM, const MipsSubtarget &STI)
static unsigned getBitWidth(Type *Ty, const DataLayout &DL)
Returns the bitwidth of the given scalar or pointer type.
void setFrameAddressIsTaken(bool T)
static SDValue lowerFCOPYSIGN32(SDValue Op, SelectionDAG &DAG, bool HasExtractInsert)
BITCAST - This operator converts between integer, vector and FP values, as if the value was stored to...
bool inMips16HardFloat() const
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.
static MVT getIntegerVT(unsigned BitWidth)
void push_back(const T &Elt)
A parsed version of the target data layout string in and methods for querying it. ...
FastISel * createFastISel(FunctionLoweringInfo &funcInfo, const TargetLibraryInfo *libInfo)
constexpr char Align[]
Key for Kernel::Arg::Metadata::mAlign.
EVT getValueType() const
Return the ValueType of the referenced return value.
This represents an addressing mode of: BaseGV + BaseOffs + BaseReg + Scale*ScaleReg If BaseGV is null...
static GCMetadataPrinterRegistry::Add< ErlangGCPrinter > X("erlang", "erlang-compatible garbage collector")
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...
SDValue getAddrGPRel(NodeTy *N, const SDLoc &DL, EVT Ty, SelectionDAG &DAG, bool IsN64) const
const GlobalValue * getGlobal() const
static const MCPhysReg IntRegs[32]
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.
GCNRegPressure max(const GCNRegPressure &P1, const GCNRegPressure &P2)
unsigned getOpcode() const
Return the SelectionDAG opcode value for this node.
This class represents an incoming formal argument to a Function.
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 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)...
const TargetRegisterClass * getRegClass(unsigned Reg) const
Return the register class of the specified virtual register.
C - The default llvm calling convention, compatible with C.
const MipsSubtarget & Subtarget
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.
Compute iterated dominance frontiers using a linear time algorithm.
static SDValue lowerUnalignedIntStore(StoreSDNode *SD, SelectionDAG &DAG, bool IsLittle)
MO_TLSLDM - Represents the offset into the global offset table at which.
static MVT getVectorVT(MVT VT, unsigned NumElements)
iterator begin() const
begin/end - Return all of the registers in this class.
const MipsTargetLowering * createMips16TargetLowering(const MipsTargetMachine &TM, const MipsSubtarget &STI)
Create MipsTargetLowering objects.
unsigned EnableFastISel
EnableFastISel - This flag enables fast-path instruction selection which trades away generated code q...
bool inMips16Mode() const
int getVarArgsFrameIndex() const
static SDValue performADDCombine(SDNode *N, SelectionDAG &DAG, TargetLowering::DAGCombinerInfo &DCI, const MipsSubtarget &Subtarget)
void addLiveIn(unsigned Reg, unsigned vreg=0)
addLiveIn - Add the specified register as a live-in.
const SDValue & getBasePtr() const
static SDValue performSELECTCombine(SDNode *N, SelectionDAG &DAG, TargetLowering::DAGCombinerInfo &DCI, const MipsSubtarget &Subtarget)
MO_GOT_HI16/LO16, MO_CALL_HI16/LO16 - Relocations used for large GOTs.
bool ArePtrs64bit() const
virtual unsigned getJumpTableEncoding() const
Return the entry encoding for a jump table in the current function.
EVT getValueType(unsigned ResNo) const
Return the type of a specified result.
virtual void LowerAsmOperandForConstraint(SDValue Op, std::string &Constraint, std::vector< SDValue > &Ops, SelectionDAG &DAG) const
Lower the specified operand into the Ops vector.
static SDValue performCMovFPCombine(SDNode *N, SelectionDAG &DAG, TargetLowering::DAGCombinerInfo &DCI, const MipsSubtarget &Subtarget)
const DebugLoc & getDebugLoc() const
Returns the debug location id of this MachineInstr.
MO_TLSGD - Represents the offset into the global offset table at which.
unsigned addLiveIn(unsigned PReg, const TargetRegisterClass *RC)
addLiveIn - Add the specified physical register as a live-in value and create a corresponding virtual...
bool getAsUnsignedInteger(StringRef Str, unsigned Radix, unsigned long long &Result)
Helper functions for StringRef::getAsInteger.
unsigned getReg() const
getReg - Returns the register number.
LLVM_NODISCARD LLVM_ATTRIBUTE_ALWAYS_INLINE size_t size() const
size - Get the string size.
MipsTargetLowering(const MipsTargetMachine &TM, const MipsSubtarget &STI)
const SDValue & getValue() 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...
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...
const MipsInstrInfo * getInstrInfo() const override
static SDValue lowerFCOPYSIGN64(SDValue Op, SelectionDAG &DAG, bool HasExtractInsert)
const SDValue & getChain() const
Function Alias Analysis Results
unsigned getAlignment() const
bool hasFnAttribute(Attribute::AttrKind Kind) const
Return true if the function has the attribute.
virtual std::pair< unsigned, const TargetRegisterClass * > getRegForInlineAsmConstraint(const TargetRegisterInfo *TRI, StringRef Constraint, MVT VT) const
Given a physical register constraint (e.g.
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...
virtual const TargetRegisterClass * getRegClassFor(MVT VT) const
Return the register class that should be used for the specified value type.
constexpr bool isInt< 16 >(int64_t x)
STATISTIC(NumFunctions, "Total number of functions")
unsigned const TargetRegisterInfo * TRI
bool hasExtractInsert() const
Features related to the presence of specific instructions.
bool isInteger() const
Return true if this is an integer or a vector integer type.
MachineBasicBlock * EmitInstrWithCustomInserter(MachineInstr &MI, MachineBasicBlock *MBB) const override
This method should be implemented by targets that mark instructions with the 'usesCustomInserter' fla...
CallLoweringInfo & setDebugLoc(const SDLoc &dl)
uint64_t alignTo(uint64_t Value, uint64_t Align, uint64_t Skew=0)
Returns the next integer (mod 2**64) that is greater than or equal to Value and is a multiple of Alig...
void setVarArgsFrameIndex(int Index)
MachineFunction & getMachineFunction() const
SDNode * getNode() const
get the SDNode which holds the desired result
SDValue getTargetExternalSymbol(const char *Sym, EVT VT, unsigned char TargetFlags=0)
SDValue getNode(unsigned Opcode, const SDLoc &DL, EVT VT, ArrayRef< SDUse > Ops)
Gets or creates the specified node.
bool isVectorTy() const
True if this is an instance of VectorType.
static BranchProbability getOne()
MachineMemOperand * getMemOperand() const
Return a MachineMemOperand object describing the memory reference performed by operation.
SDValue getAddrNonPIC(NodeTy *N, const SDLoc &DL, EVT Ty, SelectionDAG &DAG) 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...
virtual SDValue LowerToTLSEmulatedModel(const GlobalAddressSDNode *GA, SelectionDAG &DAG) const
Lower TLS global address SDNode for target independent emulated TLS model.
SDValue getAddrLocal(NodeTy *N, const SDLoc &DL, EVT Ty, SelectionDAG &DAG, bool IsN32OrN64) const
bool isUpperBitsInLoc() const
unsigned getValueSizeInBits() const
Returns the size of the value in bits.
OUTCHAIN = ATOMIC_FENCE(INCHAIN, ordering, scope) This corresponds to the fence instruction.
EVT getSetCCResultType(const DataLayout &DL, LLVMContext &Context, EVT VT) const override
getSetCCResultType - get the ISD::SETCC result ValueType
Select with condition operator - This selects between a true value and a false value (ops #2 and #3) ...
NodeType
ISD::NodeType enum - This enum defines the target-independent operators for a SelectionDAG.
bool hasOneUse() const
Return true if there is exactly one node using value ResNo of Node.
void LowerOperationWrapper(SDNode *N, SmallVectorImpl< SDValue > &Results, SelectionDAG &DAG) const override
This callback is invoked by the type legalizer to legalize nodes with an illegal operand type but leg...
bool isValid() const
Return true if this is a valid simple valuetype.
const TargetRegisterClass * getRegClass(unsigned i) const
Returns the register class associated with the enumeration value.
SDValue getExternalSymbol(const char *Sym, EVT VT)
void setTruncStoreAction(MVT ValVT, MVT MemVT, LegalizeAction Action)
Indicate that the specified truncating store does not work with the specified type and indicate what ...
bool isTruncatingStore() const
Return true if the op does a truncation before store.
bool WasOriginalArgVectorFloat(unsigned ValNo) const
MVT getRegisterType(MVT VT) const
Return the type of registers that this ValueType will eventually require.
bool hasStructRetAttr() const
Determine if the function returns a structure through first or second pointer argument.
SDIVREM/UDIVREM - Divide two integers and produce both a quotient and remainder result.
static bool isShiftedMask(uint64_t I, uint64_t &Pos, uint64_t &Size)
bool isFloatingPoint() const
Return true if this is a FP or a vector FP type.
SI optimize exec mask operations pre RA
SHL_PARTS/SRA_PARTS/SRL_PARTS - These operators are used for expanded integer shift operations...
static GCMetadataPrinterRegistry::Add< OcamlGCMetadataPrinter > Y("ocaml", "ocaml 3.10-compatible collector")
SDValue getIntPtrConstant(uint64_t Val, const SDLoc &DL, bool isTarget=false)
MachinePointerInfo callPtrInfo(const char *ES)
Create a MachinePointerInfo that has an ExternalSymbolPseudoSourceValue object representing a GOT ent...
static SDValue performORCombine(SDNode *N, SelectionDAG &DAG, TargetLowering::DAGCombinerInfo &DCI, const MipsSubtarget &Subtarget)
static SDValue performANDCombine(SDNode *N, SelectionDAG &DAG, TargetLowering::DAGCombinerInfo &DCI, const MipsSubtarget &Subtarget)
const HexagonInstrInfo * TII
static SDValue lowerFP_TO_SINT_STORE(StoreSDNode *SD, SelectionDAG &DAG)
Shift and rotation operations.
Type * getTypeForEVT(LLVMContext &Context) const
This method returns an LLVM type corresponding to the specified EVT.
bool inMicroMipsMode() const
static unsigned addLiveIn(MachineFunction &MF, unsigned PReg, const TargetRegisterClass *RC)
const TargetMachine & getTarget() const
getTarget - Return the target machine this machine code is compiled with
CallLoweringInfo & setChain(SDValue InChain)
BUILD_PAIR - This is the opposite of EXTRACT_ELEMENT in some ways.
CCAssignFn * CCAssignFnForCall() const
This class consists of common code factored out of the SmallVector class to reduce code duplication b...
void eraseFromParent()
Unlink 'this' from the containing basic block and delete it.
void addLoc(const CCValAssign &V)
bool isIntegerTy() const
True if this is an instance of IntegerType.
unsigned GetCalleeAllocdArgSizeInBytes(CallingConv::ID CC) const
Obtain the size of the area allocated by the callee for arguments.
ISD::LoadExtType getExtensionType() const
Return whether this is a plain node, or one of the varieties of value-extending loads.
CALLSEQ_START/CALLSEQ_END - These operators mark the beginning and end of a call sequence, and carry arbitrary information that target might want to know.
MVT getRegisterTypeForCallingConv(LLVMContext &Context, CallingConv::ID CC, EVT VT) const override
Return the register type for a given MVT, ensuring vectors are treated as a series of gpr sized integ...
EH_DWARF_CFA - This node represents the pointer to the DWARF Canonical Frame Address (CFA)...
The MachineFrameInfo class represents an abstract stack frame until prolog/epilog code is inserted...
unsigned getOpcode() const
Returns the opcode of this MachineInstr.
SDValue getEntryNode() const
Return the token chain corresponding to the entry of the function.
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...
static std::pair< bool, bool > parsePhysicalReg(StringRef C, StringRef &Prefix, unsigned long long &Reg)
This is a helper function to parse a physical register string and split it into non-numeric and numer...
const DataLayout & getDataLayout() const
SDVTList getVTList(EVT VT)
Return an SDVTList that represents the list of values specified.
FRAMEADDR, RETURNADDR - These nodes represent llvm.frameaddress and llvm.returnaddress on the DAG...
const BlockAddress * getBlockAddress() const
LLVM_NODISCARD LLVM_ATTRIBUTE_ALWAYS_INLINE R Default(T Value)
unsigned getStoreSize() const
Return the number of bytes overwritten by a store of the specified value type.
LocInfo getLocInfo() const
static Mips::CondCode condCodeToFCC(ISD::CondCode CC)
SDValue getAddrGlobalLargeGOT(NodeTy *N, const SDLoc &DL, EVT Ty, SelectionDAG &DAG, unsigned HiFlag, unsigned LoFlag, SDValue Chain, const MachinePointerInfo &PtrInfo) const
This class defines information used to lower LLVM code to legal SelectionDAG operators that the targe...
const MipsABIInfo & getABI() const
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())
SmallVector< ISD::InputArg, 32 > Ins
STACKSAVE - STACKSAVE has one operand, an input chain.
SDValue getMergeValues(ArrayRef< SDValue > Ops, const SDLoc &dl)
Create a MERGE_VALUES node from the given operands.
unsigned getSizeInBits() const
SDValue getGlobalReg(SelectionDAG &DAG, EVT Ty) const
int64_t getSExtValue() const
LLVM_NODISCARD LLVM_ATTRIBUTE_ALWAYS_INLINE bool startswith(StringRef Prefix) const
Check if this string starts with the given Prefix.
This is a fast-path instruction selection class that generates poor code and doesn't support illegal ...
unsigned getSizeInBits() const
Return the size of the specified value type in bits.
unsigned getNextStackOffset() const
getNextStackOffset - Return the next stack offset such that all stack slots satisfy their alignment r...
Type * getType() const
All values are typed, get the type of this value.
MachineFunction & getMachineFunction() const
static const MCPhysReg Mips64DPRegs[8]
SDValue getRegisterMask(const uint32_t *RegMask)
const TargetMachine & getTarget() const
SDValue getAddrNonPICSym64(NodeTy *N, const SDLoc &DL, EVT Ty, SelectionDAG &DAG) const
static bool invertFPCondCodeUser(Mips::CondCode CC)
This function returns true if the floating point conditional branches and conditional moves which use...
Simple integer binary arithmetic operators.
void addInRegsParamInfo(unsigned RegBegin, unsigned RegEnd)
SmallVector< ISD::OutputArg, 32 > Outs
static SpecialCallingConvType getSpecialCallingConvForCallee(const SDNode *Callee, const MipsSubtarget &Subtarget)
Determine the SpecialCallingConvType for the given callee.
ArrayRef< MCPhysReg > GetByValArgRegs() const
The registers to use for byval arguments.
unsigned getRegisterByName(const char *RegName, EVT VT, SelectionDAG &DAG) const override
Return the register ID of the name passed in.
SDValue getUNDEF(EVT VT)
Return an UNDEF node. UNDEF does not have a useful SDLoc.
TLSModel::Model getTLSModel(const GlobalValue *GV) const
Returns the TLS model which should be used for the given global variable.
CondCode
ISD::CondCode enum - These are ordered carefully to make the bitfields below work out...
SDValue getTargetConstant(uint64_t Val, const SDLoc &DL, EVT VT, bool isOpaque=false)
unsigned GetPtrAndOp() const
amdgpu Simplify well known AMD library false Value * Callee
MachineBasicBlock * CreateMachineBasicBlock(const BasicBlock *bb=nullptr)
CreateMachineBasicBlock - Allocate a new MachineBasicBlock.
const DataLayout & getDataLayout() const
Return the DataLayout attached to the Module associated to this MF.
const char * getSymbol() const
unsigned getByValSize() const
unsigned getKillRegState(bool B)
This class is used to represent ISD::STORE nodes.
static unsigned getNextIntArgReg(unsigned Reg)
FP_TO_[US]INT - Convert a floating point value to a signed or unsigned integer.
const TargetFrameLowering * getFrameLowering() const override
uint16_t MCPhysReg
An unsigned integer type large enough to represent all physical registers, but not necessarily virtua...
static CCValAssign getReg(unsigned ValNo, MVT ValVT, unsigned RegNo, MVT LocVT, LocInfo HTP)
Flag
These should be considered private to the implementation of the MCInstrDesc class.
TargetInstrInfo - Interface to description of machine instruction set.
MVT getSimpleValueType() const
Return the simple ValueType of the referenced return value.
bool useEmulatedTLS() const
Returns true if this target uses emulated TLS.
bool isFloatTy() const
Return true if this is 'float', a 32-bit IEEE fp type.
The memory access is volatile.
virtual void getOpndList(SmallVectorImpl< SDValue > &Ops, std::deque< std::pair< unsigned, SDValue >> &RegsToPass, bool IsPICCall, bool GlobalOrExternal, bool InternalLinkage, bool IsCallReloc, CallLoweringInfo &CLI, SDValue Callee, SDValue Chain) const
This function fills Ops, which is the list of operands that will later be used when a function call n...
unsigned getNumValues() const
Return the number of values defined/returned by this operator.
MachineInstrBuilder BuildMI(MachineFunction &MF, const DebugLoc &DL, const MCInstrDesc &MCID)
Builder interface. Specify how to create the initial instruction itself.
const SDValue & getBasePtr() const
unsigned getGPRSizeInBytes() const
A switch()-like statement whose cases are string literals.
EK_GPRel64BlockAddress - Each entry is an address of block, encoded with a relocation as gp-relative...
initializer< Ty > init(const Ty &Val)
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...
static mvt_range fp_vector_valuetypes()
static bool CC_MipsO32_FP64(unsigned ValNo, MVT ValVT, MVT LocVT, CCValAssign::LocInfo LocInfo, ISD::ArgFlagsTy ArgFlags, CCState &State)
MO_GOT_CALL - Represents the offset into the global offset table at which the address of a call site ...
static GCRegistry::Add< OcamlGC > B("ocaml", "ocaml 3.10-compatible GC")
static SDValue createCMovFP(SelectionDAG &DAG, SDValue Cond, SDValue True, SDValue False, const SDLoc &DL)
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...
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...
unsigned GetPtrAddiuOp() const
LLVM Basic Block Representation.
unsigned getOrigAlign() const
The instances of the Type class are immutable: once they are created, they are never changed...
const TargetSubtargetInfo & getSubtarget() const
getSubtarget - Return the subtarget for which this machine code is being compiled.
bool useLongCalls() const
This is an important class for using LLVM in a threaded context.
virtual ConstraintType getConstraintType(StringRef Constraint) const
Given a constraint, return the type of constraint it is for this target.
void setTargetDAGCombine(ISD::NodeType NT)
Targets should invoke this method for each target independent node that they want to provide a custom...
bool hasAnyUseOfValue(unsigned Value) const
Return true if there are any use of the indicated value.
MachineFrameInfo & getFrameInfo()
getFrameInfo - Return the frame info object for the current function.
unsigned getVectorNumElements() const
Given a vector type, return the number of elements it contains.
size_t size() const
size - Get the array size.
static GCRegistry::Add< CoreCLRGC > E("coreclr", "CoreCLR-compatible GC")
VAEND, VASTART - VAEND and VASTART have three operands: an input chain, pointer, and a SRCVALUE...
const SDValue & getOperand(unsigned Num) const
LoadExtType
LoadExtType enum - This enum defines the three variants of LOADEXT (load with extension).
This file contains the declarations for the subclasses of Constant, which represent the different fla...
static SDValue createStoreLR(unsigned Opc, SelectionDAG &DAG, StoreSDNode *SD, SDValue Chain, unsigned Offset)
bool IsConstantInSmallSection(const DataLayout &DL, const Constant *CN, const TargetMachine &TM) const
Return true if this constant should be placed into small data section.
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 ...
void setBooleanContents(BooleanContent Ty)
Specify how the target extends the result of integer and floating point boolean values from i1 to a w...
void HandleByVal(CCState *, unsigned &, unsigned) const override
Target-specific cleanup for formal ByVal parameters.
static mvt_range fp_valuetypes()
This file declares a class to represent arbitrary precision floating point values and provide a varie...
bool hasInternalLinkage() const
static EVT getFloatingPointVT(unsigned BitWidth)
Returns the EVT that represents a floating-point type with the given number of bits.
virtual ConstraintWeight getSingleConstraintMatchWeight(AsmOperandInfo &info, const char *constraint) const
Examine constraint string and operand type and determine a weight value.
Ty * getInfo()
getInfo - Keep track of various per-function pieces of information for backends that would like to do...
TRAP - Trapping instruction.
AssertSext, AssertZext - These nodes record if a register contains a value that has already been zero...
self_iterator getIterator()
SDValue getMemIntrinsicNode(unsigned Opcode, const SDLoc &dl, SDVTList VTList, ArrayRef< SDValue > Ops, EVT MemVT, MachinePointerInfo PtrInfo, unsigned Align=0, MachineMemOperand::Flags Flags=MachineMemOperand::MOLoad|MachineMemOperand::MOStore, unsigned Size=0)
Creates a MemIntrinsicNode that may produce a result and takes a list of operands.
Class to represent integer types.
VAARG - VAARG has four operands: an input chain, a pointer, a SRCVALUE, and the alignment.
static const MipsTargetLowering * create(const MipsTargetMachine &TM, const MipsSubtarget &STI)
auto find_if(R &&Range, UnaryPredicate P) -> decltype(adl_begin(Range))
Provide wrappers to std::find_if which take ranges instead of having to pass begin/end explicitly...
bool isCheapToSpeculateCttz() const override
Return true if it is cheap to speculate a call to intrinsic cttz.
SDValue getAddrGlobal(NodeTy *N, const SDLoc &DL, EVT Ty, SelectionDAG &DAG, unsigned Flag, SDValue Chain, const MachinePointerInfo &PtrInfo) 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/...
unsigned getInRegsParamsProcessed() const
SDValue lowerLOAD(SDValue Op, SelectionDAG &DAG) const
std::vector< ArgListEntry > ArgListTy
unsigned getAlignment() const
TargetRegisterInfo base class - We assume that the target defines a static array of TargetRegisterDes...
bool isSingleFloat() const
This structure contains all information that is necessary for lowering calls.
bool isPositionIndependent() const
LLVM_NODISCARD char back() const
back - Get the last character in the string.
bool isBeforeLegalizeOps() const
const TargetMachine & getTargetMachine() const
This class contains a discriminated union of information about pointers in memory operands...
unsigned getStackAlignment() const
getStackAlignment - This method returns the number of bytes to which the stack pointer must be aligne...
Fast - This calling convention attempts to make calls as fast as possible (e.g.
#define llvm_unreachable(msg)
Marks that the current location is not supposed to be reachable.
MO_GOTTPREL - Represents the offset from the thread pointer (Initial.
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...
void setIsKill(bool Val=true)
static SDValue createLoadLR(unsigned Opc, SelectionDAG &DAG, LoadSDNode *LD, SDValue Chain, SDValue Src, unsigned Offset)
bool isFloatingPoint() const
Return true if this is a FP or a vector FP type.
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...
unsigned getNumRegistersForCallingConv(LLVMContext &Context, CallingConv::ID CC, EVT VT) const override
Return the number of registers for a given MVT, ensuring vectors are treated as a series of gpr sized...
MO_GOT - Represents the offset into the global offset table at which the address the relocation entry...
static SDValue performSUBCombine(SDNode *N, SelectionDAG &DAG, TargetLowering::DAGCombinerInfo &DCI, const MipsSubtarget &Subtarget)
Iterator for intrusive lists based on ilist_node.
CCState - This class holds information needed while lowering arguments and return values...
unsigned countPopulation(T Value)
Count the number of set bits in a value.
void addSuccessor(MachineBasicBlock *Succ, BranchProbability Prob=BranchProbability::getUnknown())
Add Succ as a successor of this MachineBasicBlock.
constexpr bool isInt< 32 >(int64_t x)
virtual TargetLoweringObjectFile * getObjFileLowering() const
unsigned getGlobalBaseReg()
const MipsRegisterInfo * getRegisterInfo() const override
This is used to represent a portion of an LLVM function in a low-level Data Dependence DAG representa...
MachineOperand class - Representation of each machine instruction operand.
This is a 'vector' (really, a variable-sized array), optimized for the case when the array is small...
Provides information about what library functions are available for the current target.
static bool CC_MipsO32(unsigned ValNo, MVT ValVT, MVT LocVT, CCValAssign::LocInfo LocInfo, ISD::ArgFlagsTy ArgFlags, CCState &State, ArrayRef< MCPhysReg > F64Regs)
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)
static MachineBasicBlock * insertDivByZeroTrap(MachineInstr &MI, MachineBasicBlock &MBB, const TargetInstrInfo &TII, bool Is64Bit, bool IsMicroMips)
EVT changeVectorElementTypeToInteger() const
Return a vector with the same number of elements as this vector, but with the element type converted ...
BRCOND - Conditional branch.
Information about stack frame layout on the target.
static cl::opt< bool > NoZeroDivCheck("mno-check-zero-division", cl::Hidden, cl::desc("MIPS: Don't trap on integer division by zero."), cl::init(false))
CallingConv::ID getCallingConv() const
Byte Swap and Counting operators.
void AnalyzeCallOperands(const SmallVectorImpl< ISD::OutputArg > &Outs, CCAssignFn Fn, std::vector< TargetLowering::ArgListEntry > &FuncArgs, const char *Func)
FP16_TO_FP, FP_TO_FP16 - These operators are used to perform promotions and truncation for half-preci...
int CreateFixedObject(uint64_t Size, int64_t SPOffset, bool IsImmutable, bool isAliased=false)
Create a new object at a fixed location on the stack.
static IntegerType * getIntNTy(LLVMContext &C, unsigned N)
const Constant * getConstVal() const
Wrapper class for IR location info (IR ordering and DebugLoc) to be passed into SDNode creation funct...
Represents one node in the SelectionDAG.
CondCode getSetCCInverse(CondCode Operation, bool isInteger)
Return the operation corresponding to !(X op Y), where 'op' is a valid SetCC operation.
SDValue LowerOperation(SDValue Op, SelectionDAG &DAG) const override
LowerOperation - Provide custom lowering hooks for some operations.
SDValue getCopyToReg(SDValue Chain, const SDLoc &dl, unsigned Reg, SDValue N)
const Function & getFunction() const
Return the LLVM function that this machine code represents.
static mvt_range integer_valuetypes()
static bool CC_Mips(unsigned ValNo, MVT ValVT, MVT LocVT, CCValAssign::LocInfo LocInfo, ISD::ArgFlagsTy ArgFlags, CCState &State) LLVM_ATTRIBUTE_UNUSED
void swap(llvm::BitVector &LHS, llvm::BitVector &RHS)
Implement std::swap in terms of BitVector swap.
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...
EVT getMemoryVT() const
Return the type of the in-memory value.
unsigned getByValAlign() const
Select(COND, TRUEVAL, FALSEVAL).
void setMinFunctionAlignment(unsigned Align)
Set the target's minimum function alignment (in log2(bytes))
bool bitsLT(EVT VT) const
Return true if this has less bits than VT.
static SDValue performSHLCombine(SDNode *N, SelectionDAG &DAG, TargetLowering::DAGCombinerInfo &DCI, const MipsSubtarget &Subtarget)
ZERO_EXTEND - Used for integer types, zeroing the new bits.
ANY_EXTEND - Used for integer types. The high bits are undefined.
LLVM_ATTRIBUTE_ALWAYS_INLINE StringSwitch & Case(StringLiteral S, T Value)
FCOPYSIGN(X, Y) - Return the value of X with the sign of Y.
#define LLVM_ATTRIBUTE_UNUSED
static SDValue performDivRemCombine(SDNode *N, SelectionDAG &DAG, TargetLowering::DAGCombinerInfo &DCI, const MipsSubtarget &Subtarget)
static SDValue createFPCmp(SelectionDAG &DAG, const SDValue &Op)
amdgpu Simplify well known AMD library false Value Value * Arg
MO_TPREL_HI/LO - Represents the hi and low part of the offset from.
MachineRegisterInfo - Keep track of information for virtual and physical registers, including vreg register classes, use/def chains for registers, etc.
std::pair< SDValue, SDValue > LowerCallTo(CallLoweringInfo &CLI) const
This function lowers an abstract call to a function into an actual call.
static MachinePointerInfo getFixedStack(MachineFunction &MF, int FI, int64_t Offset=0)
Return a MachinePointerInfo record that refers to the specified FrameIndex.
uint64_t getTypeAllocSize(Type *Ty) const
Returns the offset in bytes between successive objects of the specified type, including alignment pad...
BR_JT - Jumptable branch.
unsigned getVectorTypeBreakdownForCallingConv(LLVMContext &Context, CallingConv::ID CC, EVT VT, EVT &IntermediateVT, unsigned &NumIntermediates, MVT &RegisterVT) const override
Break down vectors to the correct number of gpr sized integers.
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.
void AnalyzeReturn(const SmallVectorImpl< ISD::OutputArg > &Outs, CCAssignFn Fn)
const MachineFunction * getParent() const
Return the MachineFunction containing this basic block.
ArrayRef< MCPhysReg > GetVarArgRegs() const
The registers to use for the variable argument list.
static const uint32_t * getMips16RetHelperMask()
SDValue getTargetBlockAddress(const BlockAddress *BA, EVT VT, int64_t Offset=0, unsigned char TargetFlags=0)
SmallVector< SDValue, 32 > OutVals
constexpr bool isShiftedMask_64(uint64_t Value)
Return true if the argument contains a non-empty sequence of ones with the remainder zero (64 bit ver...
bool isVector() const
Return true if this is a vector value type.
void setFormalArgInfo(unsigned Size, bool HasByval)
const MachineInstrBuilder & addImm(int64_t Val) const
Add a new immediate operand.
Bitwise operators - logical and, logical or, logical xor.
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.
unsigned getLocMemOffset() const
static cl::opt< bool > LargeGOT("mxgot", cl::Hidden, cl::desc("MIPS: Enable GOT larger than 64k."), cl::init(false))
LLVM_NODISCARD bool empty() const
bool isPositionIndependent() const
SIGN_EXTEND_INREG - This operator atomically performs a SHL/SRA pair to sign extend a small value in ...
const MCInstrDesc & get(unsigned Opcode) const
Return the machine instruction descriptor that corresponds to the specified instruction opcode...
LOAD and STORE have token chains as their first operand, then the same operands as an LLVM load/store...
bool isCheapToSpeculateCtlz() const override
Return true if it is cheap to speculate a call to intrinsic ctlz.
FunctionLoweringInfo - This contains information that is global to a function that is used when lower...
Flags getFlags() const
Return the raw flags of the source value,.
void setSubReg(unsigned subReg)
SDValue lowerSTORE(SDValue Op, SelectionDAG &DAG) const
void setStackPointerRegisterToSaveRestore(unsigned R)
If set to a physical register, this specifies the register that llvm.savestack/llvm.restorestack should save and restore.
const BasicBlock * getBasicBlock() const
Return the LLVM basic block that this instance corresponded to originally.
MipsFunctionInfo - This class is derived from MachineFunction private Mips target-specific informatio...
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)
static CCValAssign getMem(unsigned ValNo, MVT ValVT, unsigned Offset, MVT LocVT, LocInfo HTP)
const MachineInstrBuilder & addReg(unsigned RegNo, unsigned flags=0, unsigned SubReg=0) const
Add a new virtual register operand.
unsigned getOpcode() const
FSINCOS - Compute both fsin and fcos as a single operation.
static SDValue performMADD_MSUBCombine(SDNode *ROOTNode, SelectionDAG &CurDAG, const MipsSubtarget &Subtarget)
SDValue getValue(unsigned R) const
unsigned getInRegsParamsCount() const
unsigned MaxStoresPerMemcpy
Specify maximum bytes of store instructions per memcpy call.
constexpr bool isUInt< 16 >(uint64_t x)
unsigned getNumRegisters(LLVMContext &Context, EVT VT) const
Return the number of registers that this ValueType will eventually require.
static SDValue UnpackFromArgumentSlot(SDValue Val, const CCValAssign &VA, EVT ArgVT, const SDLoc &DL, SelectionDAG &DAG)
SDValue getConstant(uint64_t Val, const SDLoc &DL, EVT VT, bool isTarget=false, bool isOpaque=false)
Create a ConstantSDNode wrapping a constant value.
OUTCHAIN = EH_RETURN(INCHAIN, OFFSET, HANDLER) - This node represents 'eh_return' gcc dwarf builtin...
const GlobalObject * getBaseObject() const
const MachinePointerInfo & getPointerInfo() const
assert(ImpDefSCC.getReg()==AMDGPU::SCC &&ImpDefSCC.isDef())
void insert(iterator MBBI, MachineBasicBlock *MBB)
SDValue getFrameIndex(int FI, EVT VT, bool isTarget=false)
LLVM_NODISCARD char front() const
front - Get the first character in the string.
void setReturnAddressIsTaken(bool s)
void getInRegsParamInfo(unsigned InRegsParamRecordIndex, unsigned &BeginReg, unsigned &EndReg) const
void setMinStackArgumentAlignment(unsigned Align)
Set the minimum stack alignment of an argument (in log2(bytes)).
static MachinePointerInfo getGOT(MachineFunction &MF)
Return a MachinePointerInfo record that refers to a GOT entry.
LLVM Value Representation.
uint64_t getConstantOperandVal(unsigned Num) const
Helper method returns the integer value of a ConstantSDNode operand.
FMA - Perform a * b + c with no intermediate rounding step.
SDValue getRegister(unsigned Reg, EVT VT)
constexpr char Size[]
Key for Kernel::Arg::Metadata::mSize.
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.
bool CheckReturn(const SmallVectorImpl< ISD::OutputArg > &ArgsFlags, CCAssignFn Fn)
CCAssignFn * CCAssignFnForReturn() const
void rewindByValRegsInfo()
bool useSoftFloat() const
void ReplaceAllUsesOfValueWith(SDValue From, SDValue To)
Replace any uses of From with To, leaving uses of other values produced by From.getNode() alone...
#define LLVM_FALLTHROUGH
LLVM_FALLTHROUGH - Mark fallthrough cases in switch statements.
StringRef - Represent a constant reference to a string, i.e.
SetCC operator - This evaluates to a true value iff the condition is true.
const SDValue & getOperand(unsigned i) const
unsigned GetNullPtr() const
bool verifyReturnAddressArgumentIsConstant(SDValue Op, SelectionDAG &DAG) const
OUTCHAIN = ATOMIC_STORE(INCHAIN, ptr, val) This corresponds to "store atomic" instruction.
bool systemSupportsUnalignedAccess() const
Does the system support unaligned memory access.
const MachineInstrBuilder & addMBB(MachineBasicBlock *MBB, unsigned char TargetFlags=0) const
unsigned getLocReg() const
uint64_t getZExtValue() const
TRUNCATE - Completely drop the high bits.
unsigned getSRetReturnReg() const
const char * getTargetNodeName(unsigned Opcode) const override
getTargetNodeName - This method returns the name of a target specific
unsigned AllocateReg(unsigned Reg)
AllocateReg - Attempt to allocate one register.
const MachineOperand & getOperand(unsigned i) const
Unlike LLVM values, Selection DAG nodes may return multiple values as the result of a computation...
bool isMustTailCall() const
Tests if this call site must be tail call optimized.
unsigned getMinStackArgumentAlignment() const
Return the minimum stack alignment of an argument.
unsigned AllocateStack(unsigned Size, unsigned Align)
AllocateStack - Allocate a chunk of stack space with the specified size and alignment.
static bool CC_MipsO32_FP32(unsigned ValNo, MVT ValVT, MVT LocVT, CCValAssign::LocInfo LocInfo, ISD::ArgFlagsTy ArgFlags, CCState &State)
Val, OUTCHAIN = ATOMIC_LOAD(INCHAIN, ptr) This corresponds to "load atomic" instruction.
LLVMContext * getContext() const
constexpr char Args[]
Key for Kernel::Metadata::mArgs.
unsigned createVirtualRegister(const TargetRegisterClass *RegClass, StringRef Name="")
createVirtualRegister - Create and return a new virtual register in the function with the specified r...
EVT getTypeForExtReturn(LLVMContext &Context, EVT VT, ISD::NodeType) const override
Return the type that should be used to zero or sign extend a zeroext/signext integer return value...
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...
void setSRetReturnReg(unsigned Reg)
SDValue getTargetGlobalAddress(const GlobalValue *GV, const SDLoc &DL, EVT VT, int64_t offset=0, unsigned char TargetFlags=0)
This class is used to represent ISD::LOAD nodes.
DYNAMIC_STACKALLOC - Allocate some number of bytes on the stack aligned to a specified boundary...