81 #define DEBUG_TYPE "mips-lower" 83 STATISTIC(NumTailCalls,
"Number of tail calls");
87 cl::desc(
"MIPS: Don't trap on integer division by zero."),
93 Mips::D12_64, Mips::D13_64, Mips::D14_64, Mips::D15_64,
94 Mips::D16_64, Mips::D17_64, Mips::D18_64, Mips::D19_64
133 unsigned &NumIntermediates,
MVT &RegisterVT)
const {
136 IntermediateVT = RegisterVT;
141 return NumIntermediates;
151 unsigned Flag)
const {
157 unsigned Flag)
const {
163 unsigned Flag)
const {
169 unsigned Flag)
const {
175 unsigned Flag)
const {
573 unsigned LO = (Ty ==
MVT::i32) ? Mips::LO0 : Mips::LO0_64;
574 unsigned HI = (Ty ==
MVT::i32) ? Mips::HI0 : Mips::HI0_64;
636 "Illegal Condition Code");
779 return DAG.
getNode(Opc,
SDLoc(N), ValueIfFalse.getValueType(),
780 ValueIfFalse, FCC, ValueIfTrue, Glue);
790 unsigned FirstOperandOpc = FirstOperand.
getOpcode();
795 uint64_t Pos = 0, SMPos, SMSize;
801 if (!(CN = dyn_cast<ConstantSDNode>(Mask)) ||
811 if (!(CN = dyn_cast<ConstantSDNode>(FirstOperand.
getOperand(1))))
831 if (!(CN = dyn_cast<ConstantSDNode>(FirstOperand.
getOperand(1))))
836 if (SMPos != Pos || Pos >= ValTy.
getSizeInBits() || SMSize >= 32 ||
858 NewOperand = FirstOperand;
860 return DAG.
getNode(Opc, DL, ValTy, NewOperand,
876 uint64_t SMPos0, SMSize0, SMPos1, SMSize1;
883 if (!(CN = dyn_cast<ConstantSDNode>(And0.
getOperand(1))) ||
889 And1.getOperand(0).getOpcode() ==
ISD::SHL) {
891 if (!(CN = dyn_cast<ConstantSDNode>(And1.getOperand(1))) ||
896 if (SMPos0 != SMPos1 || SMSize0 != SMSize1)
901 if (!(CN = dyn_cast<ConstantSDNode>(Shl.
getOperand(1))))
909 if ((Shamt != SMPos0) || (SMPos0 + SMSize0 > ValTy.
getSizeInBits()))
922 if (~CN->
getSExtValue() == ((((int64_t)1 << SMSize0) - 1) << SMPos0) &&
923 ((SMSize0 + SMPos0 <= 64 && Subtarget.
hasMips64r2()) ||
924 (SMSize0 + SMPos0 <= 32))) {
928 if (!(CN1 = dyn_cast<ConstantSDNode>(And1->getOperand(1))))
931 if (!(CN1 = dyn_cast<ConstantSDNode>(N->
getOperand(1))))
1023 if (!IsSigned && !IsUnsigned)
1114 unsigned FirstOperandOpc = FirstOperand.
getOpcode();
1119 uint64_t Pos = 0, SMPos, SMSize;
1124 if (!(CN = dyn_cast<ConstantSDNode>(SecondOperand)))
1136 if (!(CN = dyn_cast<ConstantSDNode>(FirstOperand.
getOperand(1))) ||
1142 if (SMPos != 0 || SMSize > 32 || Pos + SMSize > ValTy.
getSizeInBits())
1233 case ISD::FABS:
return lowerFABS(Op, DAG);
1240 case ISD::SRL_PARTS:
return lowerShiftRightParts(Op, DAG,
false);
1267 bool Is64Bit,
bool IsMicroMips) {
1276 TII.
get(IsMicroMips ? Mips::TEQ_MM : Mips::TEQ))
1300 case Mips::ATOMIC_LOAD_ADD_I8:
1301 return emitAtomicBinaryPartword(MI, BB, 1);
1302 case Mips::ATOMIC_LOAD_ADD_I16:
1303 return emitAtomicBinaryPartword(MI, BB, 2);
1304 case Mips::ATOMIC_LOAD_ADD_I32:
1305 return emitAtomicBinary(MI, BB);
1306 case Mips::ATOMIC_LOAD_ADD_I64:
1307 return emitAtomicBinary(MI, BB);
1309 case Mips::ATOMIC_LOAD_AND_I8:
1310 return emitAtomicBinaryPartword(MI, BB, 1);
1311 case Mips::ATOMIC_LOAD_AND_I16:
1312 return emitAtomicBinaryPartword(MI, BB, 2);
1313 case Mips::ATOMIC_LOAD_AND_I32:
1314 return emitAtomicBinary(MI, BB);
1315 case Mips::ATOMIC_LOAD_AND_I64:
1316 return emitAtomicBinary(MI, BB);
1318 case Mips::ATOMIC_LOAD_OR_I8:
1319 return emitAtomicBinaryPartword(MI, BB, 1);
1320 case Mips::ATOMIC_LOAD_OR_I16:
1321 return emitAtomicBinaryPartword(MI, BB, 2);
1322 case Mips::ATOMIC_LOAD_OR_I32:
1323 return emitAtomicBinary(MI, BB);
1324 case Mips::ATOMIC_LOAD_OR_I64:
1325 return emitAtomicBinary(MI, BB);
1327 case Mips::ATOMIC_LOAD_XOR_I8:
1328 return emitAtomicBinaryPartword(MI, BB, 1);
1329 case Mips::ATOMIC_LOAD_XOR_I16:
1330 return emitAtomicBinaryPartword(MI, BB, 2);
1331 case Mips::ATOMIC_LOAD_XOR_I32:
1332 return emitAtomicBinary(MI, BB);
1333 case Mips::ATOMIC_LOAD_XOR_I64:
1334 return emitAtomicBinary(MI, BB);
1336 case Mips::ATOMIC_LOAD_NAND_I8:
1337 return emitAtomicBinaryPartword(MI, BB, 1);
1338 case Mips::ATOMIC_LOAD_NAND_I16:
1339 return emitAtomicBinaryPartword(MI, BB, 2);
1340 case Mips::ATOMIC_LOAD_NAND_I32:
1341 return emitAtomicBinary(MI, BB);
1342 case Mips::ATOMIC_LOAD_NAND_I64:
1343 return emitAtomicBinary(MI, BB);
1345 case Mips::ATOMIC_LOAD_SUB_I8:
1346 return emitAtomicBinaryPartword(MI, BB, 1);
1347 case Mips::ATOMIC_LOAD_SUB_I16:
1348 return emitAtomicBinaryPartword(MI, BB, 2);
1349 case Mips::ATOMIC_LOAD_SUB_I32:
1350 return emitAtomicBinary(MI, BB);
1351 case Mips::ATOMIC_LOAD_SUB_I64:
1352 return emitAtomicBinary(MI, BB);
1354 case Mips::ATOMIC_SWAP_I8:
1355 return emitAtomicBinaryPartword(MI, BB, 1);
1356 case Mips::ATOMIC_SWAP_I16:
1357 return emitAtomicBinaryPartword(MI, BB, 2);
1358 case Mips::ATOMIC_SWAP_I32:
1359 return emitAtomicBinary(MI, BB);
1360 case Mips::ATOMIC_SWAP_I64:
1361 return emitAtomicBinary(MI, BB);
1363 case Mips::ATOMIC_CMP_SWAP_I8:
1364 return emitAtomicCmpSwapPartword(MI, BB, 1);
1365 case Mips::ATOMIC_CMP_SWAP_I16:
1366 return emitAtomicCmpSwapPartword(MI, BB, 2);
1367 case Mips::ATOMIC_CMP_SWAP_I32:
1368 return emitAtomicCmpSwap(MI, BB);
1369 case Mips::ATOMIC_CMP_SWAP_I64:
1370 return emitAtomicCmpSwap(MI, BB);
1372 case Mips::ATOMIC_LOAD_MIN_I8:
1373 return emitAtomicBinaryPartword(MI, BB, 1);
1374 case Mips::ATOMIC_LOAD_MIN_I16:
1375 return emitAtomicBinaryPartword(MI, BB, 2);
1376 case Mips::ATOMIC_LOAD_MIN_I32:
1377 return emitAtomicBinary(MI, BB);
1378 case Mips::ATOMIC_LOAD_MIN_I64:
1379 return emitAtomicBinary(MI, BB);
1381 case Mips::ATOMIC_LOAD_MAX_I8:
1382 return emitAtomicBinaryPartword(MI, BB, 1);
1383 case Mips::ATOMIC_LOAD_MAX_I16:
1384 return emitAtomicBinaryPartword(MI, BB, 2);
1385 case Mips::ATOMIC_LOAD_MAX_I32:
1386 return emitAtomicBinary(MI, BB);
1387 case Mips::ATOMIC_LOAD_MAX_I64:
1388 return emitAtomicBinary(MI, BB);
1390 case Mips::ATOMIC_LOAD_UMIN_I8:
1391 return emitAtomicBinaryPartword(MI, BB, 1);
1392 case Mips::ATOMIC_LOAD_UMIN_I16:
1393 return emitAtomicBinaryPartword(MI, BB, 2);
1394 case Mips::ATOMIC_LOAD_UMIN_I32:
1395 return emitAtomicBinary(MI, BB);
1396 case Mips::ATOMIC_LOAD_UMIN_I64:
1397 return emitAtomicBinary(MI, BB);
1399 case Mips::ATOMIC_LOAD_UMAX_I8:
1400 return emitAtomicBinaryPartword(MI, BB, 1);
1401 case Mips::ATOMIC_LOAD_UMAX_I16:
1402 return emitAtomicBinaryPartword(MI, BB, 2);
1403 case Mips::ATOMIC_LOAD_UMAX_I32:
1404 return emitAtomicBinary(MI, BB);
1405 case Mips::ATOMIC_LOAD_UMAX_I64:
1406 return emitAtomicBinary(MI, BB);
1408 case Mips::PseudoSDIV:
1409 case Mips::PseudoUDIV:
1416 case Mips::SDIV_MM_Pseudo:
1417 case Mips::UDIV_MM_Pseudo:
1420 case Mips::DIV_MMR6:
1421 case Mips::DIVU_MMR6:
1422 case Mips::MOD_MMR6:
1423 case Mips::MODU_MMR6:
1425 case Mips::PseudoDSDIV:
1426 case Mips::PseudoDUDIV:
1433 case Mips::PseudoSELECT_I:
1434 case Mips::PseudoSELECT_I64:
1435 case Mips::PseudoSELECT_S:
1436 case Mips::PseudoSELECT_D32:
1437 case Mips::PseudoSELECT_D64:
1438 return emitPseudoSELECT(MI, BB,
false, Mips::BNE);
1439 case Mips::PseudoSELECTFP_F_I:
1440 case Mips::PseudoSELECTFP_F_I64:
1441 case Mips::PseudoSELECTFP_F_S:
1442 case Mips::PseudoSELECTFP_F_D32:
1443 case Mips::PseudoSELECTFP_F_D64:
1444 return emitPseudoSELECT(MI, BB,
true, Mips::BC1F);
1445 case Mips::PseudoSELECTFP_T_I:
1446 case Mips::PseudoSELECTFP_T_I64:
1447 case Mips::PseudoSELECTFP_T_S:
1448 case Mips::PseudoSELECTFP_T_D32:
1449 case Mips::PseudoSELECTFP_T_D64:
1450 return emitPseudoSELECT(MI, BB,
true, Mips::BC1T);
1451 case Mips::PseudoD_SELECT_I:
1452 case Mips::PseudoD_SELECT_I64:
1453 return emitPseudoD_SELECT(MI, BB);
1469 bool NeedsAdditionalReg =
false;
1471 case Mips::ATOMIC_LOAD_ADD_I32:
1472 AtomicOp = Mips::ATOMIC_LOAD_ADD_I32_POSTRA;
1474 case Mips::ATOMIC_LOAD_SUB_I32:
1475 AtomicOp = Mips::ATOMIC_LOAD_SUB_I32_POSTRA;
1477 case Mips::ATOMIC_LOAD_AND_I32:
1478 AtomicOp = Mips::ATOMIC_LOAD_AND_I32_POSTRA;
1480 case Mips::ATOMIC_LOAD_OR_I32:
1481 AtomicOp = Mips::ATOMIC_LOAD_OR_I32_POSTRA;
1483 case Mips::ATOMIC_LOAD_XOR_I32:
1484 AtomicOp = Mips::ATOMIC_LOAD_XOR_I32_POSTRA;
1486 case Mips::ATOMIC_LOAD_NAND_I32:
1487 AtomicOp = Mips::ATOMIC_LOAD_NAND_I32_POSTRA;
1489 case Mips::ATOMIC_SWAP_I32:
1490 AtomicOp = Mips::ATOMIC_SWAP_I32_POSTRA;
1492 case Mips::ATOMIC_LOAD_ADD_I64:
1493 AtomicOp = Mips::ATOMIC_LOAD_ADD_I64_POSTRA;
1495 case Mips::ATOMIC_LOAD_SUB_I64:
1496 AtomicOp = Mips::ATOMIC_LOAD_SUB_I64_POSTRA;
1498 case Mips::ATOMIC_LOAD_AND_I64:
1499 AtomicOp = Mips::ATOMIC_LOAD_AND_I64_POSTRA;
1501 case Mips::ATOMIC_LOAD_OR_I64:
1502 AtomicOp = Mips::ATOMIC_LOAD_OR_I64_POSTRA;
1504 case Mips::ATOMIC_LOAD_XOR_I64:
1505 AtomicOp = Mips::ATOMIC_LOAD_XOR_I64_POSTRA;
1507 case Mips::ATOMIC_LOAD_NAND_I64:
1508 AtomicOp = Mips::ATOMIC_LOAD_NAND_I64_POSTRA;
1510 case Mips::ATOMIC_SWAP_I64:
1511 AtomicOp = Mips::ATOMIC_SWAP_I64_POSTRA;
1513 case Mips::ATOMIC_LOAD_MIN_I32:
1514 AtomicOp = Mips::ATOMIC_LOAD_MIN_I32_POSTRA;
1515 NeedsAdditionalReg =
true;
1517 case Mips::ATOMIC_LOAD_MAX_I32:
1518 AtomicOp = Mips::ATOMIC_LOAD_MAX_I32_POSTRA;
1519 NeedsAdditionalReg =
true;
1521 case Mips::ATOMIC_LOAD_UMIN_I32:
1522 AtomicOp = Mips::ATOMIC_LOAD_UMIN_I32_POSTRA;
1523 NeedsAdditionalReg =
true;
1525 case Mips::ATOMIC_LOAD_UMAX_I32:
1526 AtomicOp = Mips::ATOMIC_LOAD_UMAX_I32_POSTRA;
1527 NeedsAdditionalReg =
true;
1529 case Mips::ATOMIC_LOAD_MIN_I64:
1530 AtomicOp = Mips::ATOMIC_LOAD_MIN_I64_POSTRA;
1531 NeedsAdditionalReg =
true;
1533 case Mips::ATOMIC_LOAD_MAX_I64:
1534 AtomicOp = Mips::ATOMIC_LOAD_MAX_I64_POSTRA;
1535 NeedsAdditionalReg =
true;
1537 case Mips::ATOMIC_LOAD_UMIN_I64:
1538 AtomicOp = Mips::ATOMIC_LOAD_UMIN_I64_POSTRA;
1539 NeedsAdditionalReg =
true;
1541 case Mips::ATOMIC_LOAD_UMAX_I64:
1542 AtomicOp = Mips::ATOMIC_LOAD_UMAX_I64_POSTRA;
1543 NeedsAdditionalReg =
true;
1594 BuildMI(*BB, II, DL, TII->
get(Mips::COPY), IncrCopy).addReg(Incr);
1595 BuildMI(*BB, II, DL, TII->
get(Mips::COPY), PtrCopy).addReg(Ptr);
1604 if (NeedsAdditionalReg) {
1618 unsigned SrcReg)
const {
1623 BuildMI(BB, DL, TII->
get(Mips::SEB), DstReg).addReg(SrcReg);
1628 BuildMI(BB, DL, TII->
get(Mips::SEH), DstReg).addReg(SrcReg);
1638 int64_t ShiftImm = 32 - (Size * 8);
1640 BuildMI(BB, DL, TII->
get(Mips::SLL), ScrReg).addReg(SrcReg).
addImm(ShiftImm);
1648 assert((Size == 1 || Size == 2) &&
1649 "Unsupported size for EmitAtomicBinaryPartial.");
1676 unsigned AtomicOp = 0;
1677 bool NeedsAdditionalReg =
false;
1679 case Mips::ATOMIC_LOAD_NAND_I8:
1680 AtomicOp = Mips::ATOMIC_LOAD_NAND_I8_POSTRA;
1682 case Mips::ATOMIC_LOAD_NAND_I16:
1683 AtomicOp = Mips::ATOMIC_LOAD_NAND_I16_POSTRA;
1685 case Mips::ATOMIC_SWAP_I8:
1686 AtomicOp = Mips::ATOMIC_SWAP_I8_POSTRA;
1688 case Mips::ATOMIC_SWAP_I16:
1689 AtomicOp = Mips::ATOMIC_SWAP_I16_POSTRA;
1691 case Mips::ATOMIC_LOAD_ADD_I8:
1692 AtomicOp = Mips::ATOMIC_LOAD_ADD_I8_POSTRA;
1694 case Mips::ATOMIC_LOAD_ADD_I16:
1695 AtomicOp = Mips::ATOMIC_LOAD_ADD_I16_POSTRA;
1697 case Mips::ATOMIC_LOAD_SUB_I8:
1698 AtomicOp = Mips::ATOMIC_LOAD_SUB_I8_POSTRA;
1700 case Mips::ATOMIC_LOAD_SUB_I16:
1701 AtomicOp = Mips::ATOMIC_LOAD_SUB_I16_POSTRA;
1703 case Mips::ATOMIC_LOAD_AND_I8:
1704 AtomicOp = Mips::ATOMIC_LOAD_AND_I8_POSTRA;
1706 case Mips::ATOMIC_LOAD_AND_I16:
1707 AtomicOp = Mips::ATOMIC_LOAD_AND_I16_POSTRA;
1709 case Mips::ATOMIC_LOAD_OR_I8:
1710 AtomicOp = Mips::ATOMIC_LOAD_OR_I8_POSTRA;
1712 case Mips::ATOMIC_LOAD_OR_I16:
1713 AtomicOp = Mips::ATOMIC_LOAD_OR_I16_POSTRA;
1715 case Mips::ATOMIC_LOAD_XOR_I8:
1716 AtomicOp = Mips::ATOMIC_LOAD_XOR_I8_POSTRA;
1718 case Mips::ATOMIC_LOAD_XOR_I16:
1719 AtomicOp = Mips::ATOMIC_LOAD_XOR_I16_POSTRA;
1721 case Mips::ATOMIC_LOAD_MIN_I8:
1722 AtomicOp = Mips::ATOMIC_LOAD_MIN_I8_POSTRA;
1723 NeedsAdditionalReg =
true;
1725 case Mips::ATOMIC_LOAD_MIN_I16:
1726 AtomicOp = Mips::ATOMIC_LOAD_MIN_I16_POSTRA;
1727 NeedsAdditionalReg =
true;
1729 case Mips::ATOMIC_LOAD_MAX_I8:
1730 AtomicOp = Mips::ATOMIC_LOAD_MAX_I8_POSTRA;
1731 NeedsAdditionalReg =
true;
1733 case Mips::ATOMIC_LOAD_MAX_I16:
1734 AtomicOp = Mips::ATOMIC_LOAD_MAX_I16_POSTRA;
1735 NeedsAdditionalReg =
true;
1737 case Mips::ATOMIC_LOAD_UMIN_I8:
1738 AtomicOp = Mips::ATOMIC_LOAD_UMIN_I8_POSTRA;
1739 NeedsAdditionalReg =
true;
1741 case Mips::ATOMIC_LOAD_UMIN_I16:
1742 AtomicOp = Mips::ATOMIC_LOAD_UMIN_I16_POSTRA;
1743 NeedsAdditionalReg =
true;
1745 case Mips::ATOMIC_LOAD_UMAX_I8:
1746 AtomicOp = Mips::ATOMIC_LOAD_UMAX_I8_POSTRA;
1747 NeedsAdditionalReg =
true;
1749 case Mips::ATOMIC_LOAD_UMAX_I16:
1750 AtomicOp = Mips::ATOMIC_LOAD_UMAX_I16_POSTRA;
1751 NeedsAdditionalReg =
true;
1780 int64_t MaskImm = (Size == 1) ? 255 : 65535;
1785 BuildMI(BB, DL, TII->
get(Mips::ANDi), PtrLSB2)
1786 .addReg(Ptr, 0, ArePtrs64bit ? Mips::sub_32 : 0).
addImm(3);
1792 .addReg(PtrLSB2).
addImm((Size == 1) ? 3 : 2);
1795 BuildMI(BB, DL, TII->
get(Mips::ORi), MaskUpper)
1796 .addReg(Mips::ZERO).
addImm(MaskImm);
1798 .addReg(MaskUpper).
addReg(ShiftAmt);
1799 BuildMI(BB, DL, TII->
get(Mips::NOR), Mask2).addReg(Mips::ZERO).
addReg(Mask);
1800 BuildMI(BB, DL, TII->
get(Mips::SLLV), Incr2).addReg(Incr).
addReg(ShiftAmt);
1821 if (NeedsAdditionalReg) {
1838 MipsTargetLowering::emitAtomicCmpSwap(
MachineInstr &MI,
1842 MI.
getOpcode() == Mips::ATOMIC_CMP_SWAP_I64) &&
1843 "Unsupported atomic pseudo for EmitAtomicCmpSwap.");
1845 const unsigned Size = MI.
getOpcode() == Mips::ATOMIC_CMP_SWAP_I32 ? 4 : 8;
1853 unsigned AtomicOp = MI.
getOpcode() == Mips::ATOMIC_CMP_SWAP_I32
1854 ? Mips::ATOMIC_CMP_SWAP_I32_POSTRA
1855 : Mips::ATOMIC_CMP_SWAP_I64_POSTRA;
1873 BuildMI(*BB, II, DL, TII->
get(Mips::COPY), PtrCopy).addReg(Ptr);
1874 BuildMI(*BB, II, DL, TII->
get(Mips::COPY), OldValCopy).addReg(OldVal);
1875 BuildMI(*BB, II, DL, TII->
get(Mips::COPY), NewValCopy).addReg(NewVal);
1896 assert((Size == 1 || Size == 2) &&
1897 "Unsupported size for EmitAtomicCmpSwapPartial.");
1924 unsigned AtomicOp = MI.
getOpcode() == Mips::ATOMIC_CMP_SWAP_I8
1925 ? Mips::ATOMIC_CMP_SWAP_I8_POSTRA
1926 : Mips::ATOMIC_CMP_SWAP_I16_POSTRA;
1967 int64_t MaskImm = (Size == 1) ? 255 : 65535;
1968 BuildMI(BB, DL, TII->
get(ArePtrs64bit ? Mips::DADDiu : Mips::ADDiu), MaskLSB2)
1971 .addReg(Ptr).
addReg(MaskLSB2);
1972 BuildMI(BB, DL, TII->
get(Mips::ANDi), PtrLSB2)
1973 .addReg(Ptr, 0, ArePtrs64bit ? Mips::sub_32 : 0).
addImm(3);
1979 .addReg(PtrLSB2).
addImm((Size == 1) ? 3 : 2);
1982 BuildMI(BB, DL, TII->
get(Mips::ORi), MaskUpper)
1983 .addReg(Mips::ZERO).
addImm(MaskImm);
1985 .addReg(MaskUpper).
addReg(ShiftAmt);
1986 BuildMI(BB, DL, TII->
get(Mips::NOR), Mask2).addReg(Mips::ZERO).
addReg(Mask);
1987 BuildMI(BB, DL, TII->
get(Mips::ANDi), MaskedCmpVal)
1988 .addReg(CmpVal).
addImm(MaskImm);
1989 BuildMI(BB, DL, TII->
get(Mips::SLLV), ShiftedCmpVal)
1990 .addReg(MaskedCmpVal).
addReg(ShiftAmt);
1991 BuildMI(BB, DL, TII->
get(Mips::ANDi), MaskedNewVal)
1992 .addReg(NewVal).
addImm(MaskImm);
1993 BuildMI(BB, DL, TII->
get(Mips::SLLV), ShiftedNewVal)
1994 .addReg(MaskedNewVal).
addReg(ShiftAmt);
2039 FCC0, Dest, CondRes);
2061 "Floating point operand expected.");
2102 if (GV->hasLocalLinkage())
2112 N,
SDLoc(N), Ty, DAG,
2161 Entry.
Node = Argument;
2163 Args.push_back(Entry);
2168 .setLibCallee(
CallingConv::C, PtrTy, TlsGetAddr, std::move(Args));
2169 std::pair<SDValue, SDValue> CallResult =
LowerCallTo(CLI);
2269 const Value *SV = cast<SrcValueSDNode>(Node->
getOperand(2))->getValue();
2296 unsigned ArgSizeInBytes =
2312 unsigned Adjustment = ArgSlotSizeInBytes - ArgSizeInBytes;
2321 bool HasExtractInsert) {
2340 if (HasExtractInsert) {
2368 bool HasExtractInsert) {
2379 if (HasExtractInsert) {
2385 if (WidthX > WidthY)
2387 else if (WidthY > WidthX)
2406 if (WidthX > WidthY)
2408 else if (WidthY > WidthX)
2426 bool HasExtractInsert) {
2438 if (HasExtractInsert)
2463 bool HasExtractInsert) {
2471 if (HasExtractInsert)
2493 if (cast<ConstantSDNode>(Op.
getOperand(0))->getZExtValue() != 0) {
2495 "return address can be determined only for current frame");
2514 if (cast<ConstantSDNode>(Op.
getOperand(0))->getZExtValue() != 0) {
2516 "return address can be determined only for current frame");
2549 unsigned OffsetReg =
ABI.
IsN64() ? Mips::V1_64 : Mips::V1;
2550 unsigned AddrReg =
ABI.
IsN64() ? Mips::V0_64 : Mips::V0;
2637 : Mips::PseudoD_SELECT_I,
2638 DL, VTList, Cond, ShiftRightHi,
2645 IsSRA ? Ext : DAG.
getConstant(0, DL, VT), ShiftRightHi);
2663 SDValue Ops[] = { Chain, Ptr, Src };
2677 if ((LD->
getAlignment() >= MemVT.getSizeInBits() / 8) ||
2860 static const MCPhysReg IntRegs[] = { Mips::A0, Mips::A1, Mips::A2, Mips::A3 };
2864 static const MCPhysReg F32Regs[] = { Mips::F12, Mips::F14 };
2866 static const MCPhysReg FloatVectorIntRegs[] = { Mips::A0, Mips::A2 };
2878 else if (ArgFlags.
isZExt())
2890 else if (ArgFlags.
isZExt())
2901 bool AllocateFloatsInIntReg = State.
isVarArg() || ValNo > 1 ||
2904 bool isI64 = (ValVT ==
MVT::i32 && OrigAlign == 8);
2908 if (ValVT ==
MVT::i32 && isVectorFloat) {
2915 if (Reg == Mips::A2)
2925 (ValVT ==
MVT::f32 && AllocateFloatsInIntReg)) {
2929 if (isI64 && (Reg == Mips::A1 || Reg == Mips::A3))
2932 }
else if (ValVT ==
MVT::f64 && AllocateFloatsInIntReg) {
2936 if (Reg == Mips::A1 || Reg == Mips::A3)
2950 if (Reg2 == Mips::A1 || Reg2 == Mips::A3)
2969 static const MCPhysReg F64Regs[] = { Mips::D6, Mips::D7 };
2971 return CC_MipsO32(ValNo, ValVT, LocVT, LocInfo, ArgFlags, State, F64Regs);
2977 static const MCPhysReg F64Regs[] = { Mips::D12_64, Mips::D14_64 };
2979 return CC_MipsO32(ValNo, ValVT, LocVT, LocInfo, ArgFlags, State, F64Regs);
2986 #include "MipsGenCallingConv.inc" 2989 return CC_Mips_FixedArg;
3001 assert((Reg == Mips::A0) || (Reg == Mips::A2));
3002 return (Reg == Mips::A0) ? Mips::A1 : Mips::A3;
3007 const SDLoc &DL,
bool IsTailCall,
3025 std::deque<std::pair<unsigned, SDValue>> &RegsToPass,
3026 bool IsPICCall,
bool GlobalOrExternal,
bool InternalLinkage,
3039 if (IsPICCall && !InternalLinkage && IsCallReloc) {
3040 unsigned GPReg =
ABI.
IsN64() ? Mips::GP_64 : Mips::GP;
3042 RegsToPass.push_back(std::make_pair(GPReg,
getGlobalReg(CLI.
DAG, Ty)));
3051 for (
unsigned i = 0,
e = RegsToPass.size(); i !=
e; ++i) {
3053 RegsToPass[i].second, InFlag);
3059 for (
unsigned i = 0,
e = RegsToPass.size(); i !=
e; ++i)
3061 RegsToPass[i].second.getValueType()));
3067 assert(Mask &&
"Missing call preserved mask for calling convention");
3071 Function *
F =
G->getGlobal()->getParent()->getFunction(Sym);
3089 case Mips::JALRPseudo:
3091 case Mips::JALR64Pseudo:
3092 case Mips::JALR16_MM:
3093 case Mips::JALRC16_MMR6:
3094 case Mips::TAILCALLREG:
3095 case Mips::TAILCALLREG64:
3096 case Mips::TAILCALLR6REG:
3097 case Mips::TAILCALL64R6REG:
3098 case Mips::TAILCALLREG_MM:
3099 case Mips::TAILCALLREG_MMR6: {
3100 if (!EmitJalrReloc ||
3113 dyn_cast_or_null<const GlobalAddressSDNode>(TargetAddr)) {
3117 if (!isa<Function>(
G->getGlobal())) {
3118 LLVM_DEBUG(
dbgs() <<
"Not adding R_MIPS_JALR against data symbol " 3119 <<
G->getGlobal()->getName() <<
"\n");
3122 Sym =
G->getGlobal()->getName();
3125 dyn_cast_or_null<const ExternalSymbolSDNode>(TargetAddr)) {
3126 Sym = ES->getSymbol();
3134 LLVM_DEBUG(
dbgs() <<
"Adding R_MIPS_JALR against " << Sym <<
"\n");
3169 dyn_cast_or_null<const ExternalSymbolSDNode>(Callee.
getNode());
3195 bool MemcpyInByVal = ES &&
3202 unsigned ReservedArgArea =
3214 bool InternalLinkage =
false;
3216 IsTailCall = isEligibleForTailCallOptimization(
3219 InternalLinkage =
G->getGlobal()->hasInternalLinkage();
3220 IsTailCall &= (InternalLinkage ||
G->getGlobal()->hasLocalLinkage() ||
3221 G->getGlobal()->hasPrivateLinkage() ||
3222 G->getGlobal()->hasHiddenVisibility() ||
3223 G->getGlobal()->hasProtectedVisibility());
3228 "site marked musttail");
3237 NextStackOffset =
alignTo(NextStackOffset, StackAlignment);
3240 if (!(IsTailCall || MemcpyInByVal))
3247 std::deque<std::pair<unsigned, SDValue>> RegsToPass;
3253 for (
unsigned i = 0,
e = ArgLocs.
size(); i !=
e; ++i) {
3258 bool UseUpperBits =
false;
3262 unsigned FirstByValReg, LastByValReg;
3267 "ByVal args of size 0 should have been ignored by front-end.");
3270 "Do not tail-call optimize if there is a byval argument.");
3271 passByValArg(Chain, DL, RegsToPass, MemOpChains, StackPtr, MFI, DAG, Arg,
3297 RegsToPass.push_back(std::make_pair(LocRegLo, Lo));
3298 RegsToPass.push_back(std::make_pair(LocRegHigh, Hi));
3307 UseUpperBits =
true;
3313 UseUpperBits =
true;
3319 UseUpperBits =
true;
3327 unsigned ValSizeInBits = Outs[i].ArgVT.getSizeInBits();
3337 RegsToPass.push_back(std::make_pair(VA.
getLocReg(),
Arg));
3347 Chain,
Arg, DL, IsTailCall, DAG));
3352 if (!MemOpChains.
empty())
3360 bool GlobalOrExternal =
false, IsCallReloc =
false;
3369 if (
auto *N = dyn_cast<ExternalSymbolSDNode>(Callee)) {
3374 }
else if (
auto *N = dyn_cast<GlobalAddressSDNode>(Callee)) {
3378 if (
auto *
F = dyn_cast<Function>(N->getGlobal())) {
3379 if (
F->hasFnAttribute(
"long-call"))
3380 UseLongCalls =
true;
3381 else if (
F->hasFnAttribute(
"short-call"))
3382 UseLongCalls =
false;
3396 if (InternalLinkage)
3412 GlobalOrExternal =
true;
3415 const char *Sym = S->getSymbol();
3431 GlobalOrExternal =
true;
3437 getOpndList(Ops, RegsToPass, IsPIC, GlobalOrExternal, InternalLinkage,
3438 IsCallReloc, CLI, Callee, Chain);
3450 if (!(MemcpyInByVal)) {
3458 return LowerCallResult(Chain, InFlag, CallConv, IsVarArg, Ins, DL, DAG,
3464 SDValue MipsTargetLowering::LowerCallResult(
3475 dyn_cast_or_null<const ExternalSymbolSDNode>(CLI.
Callee.
getNode());
3476 CCInfo.AnalyzeCallResult(Ins, RetCC_Mips, CLI.
RetTy,
3477 ES ? ES->getSymbol() :
nullptr);
3480 for (
unsigned i = 0; i != RVLocs.
size(); ++i) {
3485 RVLocs[i].getLocVT(), InFlag);
3490 unsigned ValSizeInBits = Ins[i].ArgVT.getSizeInBits();
3591 SDValue MipsTargetLowering::LowerFormalArguments(
3602 std::vector<SDValue> OutChains;
3614 "Functions with the interrupt attribute cannot have arguments!");
3616 CCInfo.AnalyzeFormalArguments(Ins, CC_Mips_FixedArg);
3618 CCInfo.getInRegsParamsCount() > 0);
3620 unsigned CurArgIdx = 0;
3621 CCInfo.rewindByValRegsInfo();
3623 for (
unsigned i = 0,
e = ArgLocs.
size(); i !=
e; ++i) {
3625 if (Ins[i].isOrigArg()) {
3626 std::advance(FuncArg, Ins[i].getOrigArgIndex() - CurArgIdx);
3627 CurArgIdx = Ins[i].getOrigArgIndex();
3634 assert(Ins[i].isOrigArg() &&
"Byval arguments cannot be implicit");
3635 unsigned FirstByValReg, LastByValReg;
3636 unsigned ByValIdx = CCInfo.getInRegsParamsProcessed();
3637 CCInfo.getInRegsParamInfo(ByValIdx, FirstByValReg, LastByValReg);
3640 "ByVal args of size 0 should have been ignored by front-end.");
3641 assert(ByValIdx < CCInfo.getInRegsParamsCount());
3642 copyByValRegs(Chain, DL, OutChains, DAG, Flags, InVals, &*FuncArg,
3643 FirstByValReg, LastByValReg, VA, CCInfo);
3644 CCInfo.nextInRegsParam();
3675 ArgValue, ArgValue2);
3701 LocVT, DL, Chain, FIN,
3703 OutChains.push_back(ArgValue.
getValue(1));
3711 for (
unsigned i = 0,
e = ArgLocs.
size(); i !=
e; ++i) {
3715 if (Ins[i].Flags.isSRet()) {
3729 writeVarArgRegs(OutChains, Chain, DL, DAG, CCInfo);
3733 if (!OutChains.empty()) {
3734 OutChains.push_back(Chain);
3751 MipsCCState CCInfo(CallConv, IsVarArg, MF, RVLocs, Context);
3755 bool MipsTargetLowering::shouldSignExtendTypeInLibCall(
EVT Type,
3756 bool IsSigned)
const {
3796 for (
unsigned i = 0; i != RVLocs.
size(); ++i) {
3800 bool UseUpperBits =
false;
3811 UseUpperBits =
true;
3817 UseUpperBits =
true;
3823 UseUpperBits =
true;
3831 unsigned ValSizeInBits = Outs[i].ArgVT.getSizeInBits();
3857 unsigned V0 =
ABI.
IsN64() ? Mips::V0_64 : Mips::V0;
3872 return LowerInterruptReturn(RetOps, DL, DAG);
3885 MipsTargetLowering::getConstraintType(
StringRef Constraint)
const {
3897 if (Constraint.
size() == 1) {
3898 switch (Constraint[0]) {
3912 if (Constraint ==
"ZC")
3922 MipsTargetLowering::getSingleConstraintMatchWeight(
3923 AsmOperandInfo &
info,
const char *constraint)
const {
3925 Value *CallOperandVal = info.CallOperandVal;
3928 if (!CallOperandVal)
3932 switch (*constraint) {
3961 if (isa<ConstantInt>(CallOperandVal))
3976 unsigned long long &
Reg) {
3977 if (C.
front() !=
'{' || C.
back() !=
'}')
3978 return std::make_pair(
false,
false);
3988 return std::make_pair(
true,
false);
3999 return VT.
bitsLT(MinVT) ? MinVT : VT;
4002 std::pair<unsigned, const TargetRegisterClass *> MipsTargetLowering::
4008 unsigned long long Reg;
4013 return std::make_pair(0U,
nullptr);
4015 if ((Prefix ==
"hi" || Prefix ==
"lo")) {
4018 return std::make_pair(0U,
nullptr);
4021 Mips::HI32RegClassID : Mips::LO32RegClassID);
4022 return std::make_pair(*(RC->
begin()), RC);
4028 return std::make_pair(0U,
nullptr);
4031 .Case(
"$msair", Mips::MSAIR)
4032 .
Case(
"$msacsr", Mips::MSACSR)
4033 .
Case(
"$msaaccess", Mips::MSAAccess)
4034 .
Case(
"$msasave", Mips::MSASave)
4035 .
Case(
"$msamodify", Mips::MSAModify)
4036 .
Case(
"$msarequest", Mips::MSARequest)
4037 .
Case(
"$msamap", Mips::MSAMap)
4038 .
Case(
"$msaunmap", Mips::MSAUnmap)
4042 return std::make_pair(0U,
nullptr);
4045 return std::make_pair(Reg, RC);
4049 return std::make_pair(0U,
nullptr);
4051 if (Prefix ==
"$f") {
4059 if (RC == &Mips::AFGR64RegClass) {
4063 }
else if (Prefix ==
"$fcc")
4065 else if (Prefix ==
"$w") {
4072 assert(Reg < RC->getNumRegs());
4073 return std::make_pair(*(RC->
begin() +
Reg), RC);
4079 std::pair<unsigned, const TargetRegisterClass *>
4083 if (Constraint.
size() == 1) {
4084 switch (Constraint[0]) {
4090 return std::make_pair(0U, &Mips::CPU16RegsRegClass);
4091 return std::make_pair(0U, &Mips::GPR32RegClass);
4094 return std::make_pair(0U, &Mips::GPR32RegClass);
4096 return std::make_pair(0U, &Mips::GPR64RegClass);
4098 return std::make_pair(0U,
nullptr);
4101 return std::make_pair(0U, &Mips::MSA128BRegClass);
4103 return std::make_pair(0U, &Mips::MSA128HRegClass);
4105 return std::make_pair(0U, &Mips::MSA128WRegClass);
4107 return std::make_pair(0U, &Mips::MSA128DRegClass);
4109 return std::make_pair(0U, &Mips::FGR32RegClass);
4112 return std::make_pair(0U, &Mips::FGR64RegClass);
4113 return std::make_pair(0U, &Mips::AFGR64RegClass);
4118 return std::make_pair((
unsigned)Mips::T9, &Mips::GPR32RegClass);
4120 return std::make_pair((
unsigned)Mips::T9_64, &Mips::GPR64RegClass);
4122 return std::make_pair(0U,
nullptr);
4126 return std::make_pair((
unsigned)Mips::LO0, &Mips::LO32RegClass);
4127 return std::make_pair((
unsigned)Mips::LO0_64, &Mips::LO64RegClass);
4132 return std::make_pair(0U,
nullptr);
4136 if (!Constraint.
empty()) {
4137 std::pair<unsigned, const TargetRegisterClass *> R;
4138 R = parseRegForInlineAsmConstraint(Constraint, VT);
4149 void MipsTargetLowering::LowerAsmOperandForConstraint(
SDValue Op,
4150 std::string &Constraint,
4151 std::vector<SDValue>&Ops,
4157 if (Constraint.length() > 1)
return;
4159 char ConstraintLetter = Constraint[0];
4160 switch (ConstraintLetter) {
4166 int64_t Val = C->getSExtValue();
4176 int64_t Val = C->getZExtValue();
4186 uint64_t Val = (uint64_t)C->getZExtValue();
4196 int64_t Val = C->getSExtValue();
4197 if ((
isInt<32>(Val)) && ((Val & 0xffff) == 0)){
4206 int64_t Val = C->getSExtValue();
4207 if ((Val >= -65535) && (Val <= -1)) {
4216 int64_t Val = C->getSExtValue();
4217 if ((isInt<15>(Val))) {
4226 int64_t Val = C->getSExtValue();
4227 if ((Val <= 65535) && (Val >= 1)) {
4236 Ops.push_back(Result);
4243 bool MipsTargetLowering::isLegalAddressingMode(
const DataLayout &DL,
4271 EVT MipsTargetLowering::getOptimalMemOpType(
4272 uint64_t Size,
unsigned DstAlign,
unsigned SrcAlign,
bool IsMemset,
4273 bool ZeroMemset,
bool MemcpyStrSrc,
4281 bool MipsTargetLowering::isFPImmLegal(
const APFloat &Imm,
EVT VT,
4282 bool ForCodeSize)
const {
4290 unsigned MipsTargetLowering::getJumpTableEncoding()
const {
4299 bool MipsTargetLowering::useSoftFloat()
const {
4303 void MipsTargetLowering::copyByValRegs(
4304 SDValue Chain,
const SDLoc &DL, std::vector<SDValue> &OutChains,
4307 unsigned FirstReg,
unsigned LastReg,
const CCValAssign &VA,
4312 unsigned NumRegs = LastReg - FirstReg;
4313 unsigned RegAreaSize = NumRegs * GPRSizeInBytes;
4321 (
int)((ByValArgRegs.
size() - FirstReg) * GPRSizeInBytes);
4343 for (
unsigned I = 0; I < NumRegs; ++
I) {
4344 unsigned ArgReg = ByValArgRegs[FirstReg +
I];
4345 unsigned VReg =
addLiveIn(MF, ArgReg, RC);
4346 unsigned Offset = I * GPRSizeInBytes;
4351 OutChains.push_back(Store);
4356 void MipsTargetLowering::passByValArg(
4358 std::deque<std::pair<unsigned, SDValue>> &RegsToPass,
4364 unsigned OffsetInBytes = 0;
4366 unsigned Alignment = std::min(Flags.
getByValAlign(), RegSizeInBytes);
4369 unsigned NumRegs = LastReg - FirstReg;
4373 bool LeftoverBytes = (NumRegs * RegSizeInBytes > ByValSizeInBytes);
4377 for (; I < NumRegs - LeftoverBytes; ++
I, OffsetInBytes += RegSizeInBytes) {
4383 unsigned ArgReg = ArgRegs[FirstReg +
I];
4384 RegsToPass.push_back(std::make_pair(ArgReg, LoadVal));
4388 if (ByValSizeInBytes == OffsetInBytes)
4392 if (LeftoverBytes) {
4395 for (
unsigned LoadSizeInBytes = RegSizeInBytes / 2, TotalBytesLoaded = 0;
4396 OffsetInBytes < ByValSizeInBytes; LoadSizeInBytes /= 2) {
4397 unsigned RemainingSizeInBytes = ByValSizeInBytes - OffsetInBytes;
4399 if (RemainingSizeInBytes < LoadSizeInBytes)
4415 Shamt = TotalBytesLoaded * 8;
4417 Shamt = (RegSizeInBytes - (TotalBytesLoaded + LoadSizeInBytes)) * 8;
4427 OffsetInBytes += LoadSizeInBytes;
4428 TotalBytesLoaded += LoadSizeInBytes;
4429 Alignment = std::min(Alignment, LoadSizeInBytes);
4432 unsigned ArgReg = ArgRegs[FirstReg +
I];
4433 RegsToPass.push_back(std::make_pair(ArgReg, Val));
4439 unsigned MemCpySize = ByValSizeInBytes - OffsetInBytes;
4444 Chain = DAG.
getMemcpy(Chain, DL, Dst, Src,
4446 Alignment,
false,
false,
4452 void MipsTargetLowering::writeVarArgRegs(std::vector<SDValue> &OutChains,
4468 if (ArgRegs.
size() == Idx)
4473 (
int)(RegSizeInBytes * (ArgRegs.
size() - Idx));
4485 for (
unsigned I = Idx; I < ArgRegs.
size();
4486 ++
I, VaArgOffset += RegSizeInBytes) {
4493 cast<StoreSDNode>(Store.
getNode())->getMemOperand()->setValue(
4495 OutChains.push_back(Store);
4500 unsigned Align)
const {
4503 assert(Size &&
"Byval argument's size shouldn't be 0.");
4507 unsigned FirstReg = 0;
4508 unsigned NumRegs = 0;
4519 assert(!(Align % RegSizeInBytes) &&
4520 "Byval argument's alignment should be a multiple of" 4529 if ((Align > RegSizeInBytes) && (FirstReg % 2)) {
4530 State->
AllocateReg(IntArgRegs[FirstReg], ShadowRegs[FirstReg]);
4535 Size =
alignTo(Size, RegSizeInBytes);
4536 for (
unsigned I = FirstReg; Size > 0 && (I < IntArgRegs.
size());
4537 Size -= RegSizeInBytes, ++
I, ++NumRegs)
4547 unsigned Opc)
const {
4549 "Subtarget already supports SELECT nodes with the use of" 4550 "conditional-move instructions.");
4623 MipsTargetLowering::emitPseudoD_SELECT(
MachineInstr &MI,
4626 "Subtarget already supports SELECT nodes with the use of" 4627 "conditional-move instructions.");
4707 .Case(
"$28", Mips::GP_64)
4713 .Case(
"$28", Mips::GP)
TypeSize getStoreSize() const
Return the number of bytes overwritten by a store of the specified value type.
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)
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.
unsigned getOpcode() const
Return the SelectionDAG opcode value for this node.
This class represents an incoming formal argument to a Function.
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 MipsSubtarget & Subtarget
CondCode getSetCCInverse(CondCode Operation, EVT Type)
Return the operation corresponding to !(X op Y), where 'op' is a valid SetCC operation.
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.
This class represents lattice values for constants.
Register getLocReg() const
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.
static SDValue lowerFP_TO_SINT_STORE(StoreSDNode *SD, SelectionDAG &DAG, bool SingleFloat)
const MipsTargetLowering * createMips16TargetLowering(const MipsTargetMachine &TM, const MipsSubtarget &STI)
Create MipsTargetLowering objects.
MCSymbol - Instances of this class represent a symbol name in the MC file, and MCSymbols are created ...
unsigned EnableFastISel
EnableFastISel - This flag enables fast-path instruction selection which trades away generated code q...
bool inMips16Mode() const
int getVarArgsFrameIndex() const
Register createVirtualRegister(const TargetRegisterClass *RegClass, StringRef Name="")
createVirtualRegister - Create and return a new virtual register in the function with the specified r...
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
LLVM_NODISCARD bool startswith(StringRef Prefix) const
Check if this string starts with the given Prefix.
virtual unsigned getJumpTableEncoding() const
Return the entry encoding for a jump table in the current function.
void push_back(const T &Elt)
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...
static mvt_range fp_fixedlen_vector_valuetypes()
TypeSize getSizeInBits() const
Returns the size of the specified MVT in bits.
bool getAsUnsignedInteger(StringRef Str, unsigned Radix, unsigned long long &Result)
Helper functions for StringRef::getAsInteger.
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...
SDValue getTargetExternalSymbol(const char *Sym, EVT VT, unsigned TargetFlags=0)
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...
C - The default llvm calling convention, compatible with C.
constexpr bool isInt< 16 >(int64_t x)
STATISTIC(NumFunctions, "Total number of functions")
cl::opt< bool > EmitJalrReloc
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)
void setVarArgsFrameIndex(int Index)
MachineFunction & getMachineFunction() const
SDNode * getNode() const
get the SDNode which holds the desired result
SDValue getNode(unsigned Opcode, const SDLoc &DL, EVT VT, ArrayRef< SDUse > Ops)
Gets or creates the specified node.
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
OUTCHAIN = ATOMIC_FENCE(INCHAIN, ordering, scope) This corresponds to the fence instruction.
const MachineInstrBuilder & addMBB(MachineBasicBlock *MBB, unsigned TargetFlags=0) const
EVT getSetCCResultType(const DataLayout &DL, LLVMContext &Context, EVT VT) const override
getSetCCResultType - get the ISD::SETCC result ValueType
StringSwitch & Case(StringLiteral S, T Value)
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)
const TargetRegisterClass * getRegClass(Register Reg) const
Return the register class of the specified virtual register.
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)
unsigned 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...
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
void AdjustInstrPostInstrSelection(MachineInstr &MI, SDNode *Node) const override
This method should be implemented by targets that mark instructions with the 'hasPostISelHook' flag...
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)
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.
LLVM_NODISCARD R Default(T Value)
ISD::LoadExtType getExtensionType() const
Return whether this is a plain node, or one of the varieties of value-extending loads.
SDValue getTargetJumpTable(int JTI, EVT VT, unsigned TargetFlags=0)
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...
TypeSize getValueSizeInBits() const
Returns the size of the value in bits.
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
LocInfo getLocInfo() const
LLVM_NODISCARD bool empty() const
empty - Check if the string is empty.
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.
Align getMinStackArgumentAlignment() const
Return the minimum stack alignment of an argument.
SDValue getGlobalReg(SelectionDAG &DAG, EVT Ty) const
void emitError(unsigned LocCookie, const Twine &ErrorStr)
emitError - Emit an error message to the currently installed error handler with optional location inf...
int64_t getSExtValue() const
This is a fast-path instruction selection class that generates poor code and doesn't support illegal ...
unsigned getNextStackOffset() const
getNextStackOffset - Return the next stack offset such that all stack slots satisfy their alignment r...
unsigned NoNaNsFPMath
NoNaNsFPMath - This flag is enabled when the -enable-no-nans-fp-math flag is specified on the command...
Type * getType() const
All values are typed, get the type of this value.
MachineFunction & getMachineFunction() const
virtual const TargetRegisterClass * getRegClassFor(MVT VT, bool isDivergent=false) const
Return the register class that should be used for the specified value type.
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...
void setMinFunctionAlignment(Align Alignment)
Set the target's minimum function alignment.
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.
bool isMustTailCall() const
Tests if this call site must be tail call optimized.
SDValue getSetCC(const SDLoc &DL, EVT VT, SDValue LHS, SDValue RHS, ISD::CondCode Cond, SDValue Chain=SDValue(), bool IsSignaling=false)
Helper function to make it easier to build SetCC's if you just have an ISD::CondCode instead of an SD...
ArrayRef - Represent a constant reference to an array (0 or more elements consecutively in memory)...
LLVM_NODISCARD size_t size() const
size - Get the string size.
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)
uint64_t value() const
This is a hole in the type system and should not be abused.
unsigned GetPtrAndOp() const
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.
MCContext & getContext() const
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 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 SDValue lowerFABS32(SDValue Op, SelectionDAG &DAG, bool HasExtractInsert)
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
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)
TypeSize getTypeAllocSize(Type *Ty) const
Returns the offset in bytes between successive objects of the specified type, including alignment pad...
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
#define LLVM_ATTRIBUTE_UNUSED
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.
amdgpu Simplify well known AMD library false FunctionCallee Value * Arg
AssertSext, AssertZext - These nodes record if a register contains a value that has already been zero...
self_iterator getIterator()
bool shouldFoldConstantShiftPairToMask(const SDNode *N, CombineLevel Level) const override
Return true if it is profitable to fold a pair of shifts into a mask.
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
virtual 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...
std::vector< ArgListEntry > ArgListTy
unsigned getAlignment() const
TargetRegisterInfo base class - We assume that the target defines a static array of TargetRegisterDes...
TypeSize getSizeInBits() const
Return the size of the specified value type in bits.
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
static SDValue lowerFABS64(SDValue Op, SelectionDAG &DAG, bool HasExtractInsert)
const TargetMachine & getTargetMachine() const
This class contains a discriminated union of information about pointers in memory operands...
unsigned getNumOperands() const
Return the number of values used by this operation.
unsigned getStackAlignment() const
getStackAlignment - This method returns the number of bytes to which the stack pointer must be aligne...
#define llvm_unreachable(msg)
Marks that the current location is not supposed to be reachable.
This struct is a compact representation of a valid (non-zero power of two) alignment.
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...
SDValue getTargetBlockAddress(const BlockAddress *BA, EVT VT, int64_t Offset=0, unsigned TargetFlags=0)
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.
Register getGlobalBaseReg()
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...
SDValue getTargetConstantPool(const Constant *C, EVT VT, unsigned Align=0, int Offset=0, unsigned TargetFlags=0)
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...
SDValue getTargetGlobalAddress(const GlobalValue *GV, const SDLoc &DL, EVT VT, int64_t offset=0, unsigned TargetFlags=0)
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)
void addOperand(MachineFunction &MF, const MachineOperand &Op)
Add the specified operand to the instruction.
Align max(MaybeAlign Lhs, Align Rhs)
virtual TargetLoweringObjectFile * getObjFileLowering() const
const MipsRegisterInfo * getRegisterInfo() const override
This struct is a compact representation of a valid (power of two) or undefined (0) alignment...
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
Promote Memory to Register
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)
bool inAbs2008Mode() const
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.
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.
raw_ostream & dbgs()
dbgs() - This returns a reference to a raw_ostream for debugging messages.
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
amdgpu Simplify well known AMD library false FunctionCallee Callee
Select(COND, TRUEVAL, FALSEVAL).
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.
FCOPYSIGN(X, Y) - Return the value of X with the sign of Y.
static SDValue performDivRemCombine(SDNode *N, SelectionDAG &DAG, TargetLowering::DAGCombinerInfo &DCI, const MipsSubtarget &Subtarget)
static SDValue createFPCmp(SelectionDAG &DAG, const SDValue &Op)
MO_TPREL_HI/LO - Represents the hi and low part of the offset from.
const MachineBasicBlock * getParent() const
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.
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()
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...
uint64_t alignTo(uint64_t Size, Align A)
Returns a multiple of A needed to store Size bytes.
bool isVector() const
Return true if this is a vector value type.
unsigned AllocateStack(unsigned Size, unsigned Alignment)
AllocateStack - Allocate a chunk of stack space with the specified size and alignment.
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
MCSymbol * getOrCreateSymbol(const Twine &Name)
Lookup the symbol inside with the specified Name.
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)
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 number of store instructions per memcpy call.
const LLVMTargetMachine & getTarget() const
getTarget - Return the target machine this machine code is compiled with
constexpr bool isUInt< 16 >(uint64_t x)
void setMinStackArgumentAlignment(Align Alignment)
Set the minimum stack alignment of an argument.
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
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, uint64_t Size=0, const AAMDNodes &AAInfo=AAMDNodes())
Creates a MemIntrinsicNode that may produce a result and takes a list of operands.
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
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)
Fast - This calling convention attempts to make calls as fast as possible (e.g.
#define LLVM_FALLTHROUGH
LLVM_FALLTHROUGH - Mark fallthrough cases in switch statements.
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
Register getRegisterByName(const char *RegName, LLT VT, const MachineFunction &MF) const override
Return the register ID of the name passed in.
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...
StringRef - Represent a constant reference to a string, i.e.
SetCC operator - This evaluates to a true value iff the condition is true.
unsigned getNumOperands() const
Register getReg() const
getReg - Returns the register number.
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.
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...
const MachineInstrBuilder & addReg(Register RegNo, unsigned flags=0, unsigned SubReg=0) const
Add a new virtual register operand.
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.
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...
Wrapper class representing virtual and physical registers.
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...
static MachineOperand CreateMCSymbol(MCSymbol *Sym, unsigned TargetFlags=0)
void setSRetReturnReg(unsigned Reg)
Helper operand used to generate R_MIPS_JALR.
This class is used to represent ISD::LOAD nodes.
DYNAMIC_STACKALLOC - Allocate some number of bytes on the stack aligned to a specified boundary...