82#define DEBUG_TYPE "mips-lower"
90 cl::desc(
"MIPS: permit tail calls."),
94 Mips::D12_64, Mips::D13_64, Mips::D14_64, Mips::D15_64,
95 Mips::D16_64, Mips::D17_64, Mips::D18_64, Mips::D19_64
126 unsigned &NumIntermediates,
MVT &RegisterVT)
const {
131 return NumIntermediates;
147 unsigned Flag)
const {
153 unsigned Flag)
const {
159 unsigned Flag)
const {
165 unsigned Flag)
const {
171 unsigned Flag)
const {
173 N->getOffset(), Flag);
440 isMicroMips =
Subtarget.inMicroMipsMode();
466 if (!TM.isPositionIndependent() || !TM.getABI().IsO32() ||
487 EVT Ty =
N->getValueType(0);
488 unsigned LO = (Ty == MVT::i32) ? Mips::LO0 : Mips::LO0_64;
489 unsigned HI = (Ty == MVT::i32) ? Mips::HI0 : Mips::HI0_64;
495 N->getOperand(0),
N->getOperand(1));
500 if (
N->hasAnyUseOfValue(0)) {
509 if (
N->hasAnyUseOfValue(1)) {
551 "Illegal Condition Code");
566 if (!
LHS.getValueType().isFloatingPoint())
587 return DAG.
getNode((invert ? MipsISD::CMovFP_F : MipsISD::CMovFP_T),
DL,
678 SDValue ValueIfTrue =
N->getOperand(0), ValueIfFalse =
N->getOperand(2);
691 unsigned Opc = (
N->getOpcode() == MipsISD::CMovFP_T) ? MipsISD::CMovFP_F :
694 SDValue FCC =
N->getOperand(1), Glue =
N->getOperand(3);
696 ValueIfFalse, FCC, ValueIfTrue, Glue);
705 SDValue FirstOperand =
N->getOperand(0);
706 unsigned FirstOperandOpc = FirstOperand.
getOpcode();
708 EVT ValTy =
N->getValueType(0);
712 unsigned SMPos, SMSize;
735 if (SMPos != 0 || Pos + SMSize > ValTy.getSizeInBits())
753 if (SMPos != Pos || Pos >= ValTy.getSizeInBits() || SMSize >= 32 ||
754 Pos + SMSize > ValTy.getSizeInBits())
775 NewOperand = FirstOperand;
788 SDValue FirstOperand =
N->getOperand(0), SecondOperand =
N->getOperand(1);
789 unsigned SMPos0, SMSize0, SMPos1, SMSize1;
793 SecondOperand.getOpcode() ==
ISD::SHL) ||
795 SecondOperand.getOpcode() ==
ISD::AND)) {
806 ? SecondOperand.getOperand(0)
816 ? SecondOperand.getOperand(1)
822 if (SMPos0 != 0 || SMSize0 != ShlShiftValue)
826 EVT ValTy =
N->getValueType(0);
827 SMPos1 = ShlShiftValue;
828 assert(SMPos1 < ValTy.getSizeInBits());
829 SMSize1 = (ValTy == MVT::i64 ? 64 : 32) - SMPos1;
830 return DAG.
getNode(MipsISD::Ins,
DL, ValTy, ShlOperand0,
848 if (SecondOperand.getOpcode() ==
ISD::AND &&
849 SecondOperand.getOperand(0).getOpcode() ==
ISD::SHL) {
856 if (SMPos0 != SMPos1 || SMSize0 != SMSize1)
868 EVT ValTy =
N->getValueType(0);
869 if ((Shamt != SMPos0) || (SMPos0 + SMSize0 > ValTy.getSizeInBits()))
882 if (~CN->
getSExtValue() == ((((int64_t)1 << SMSize0) - 1) << SMPos0) &&
883 ((SMSize0 + SMPos0 <= 64 && Subtarget.
hasMips64r2()) ||
884 (SMSize0 + SMPos0 <= 32))) {
886 bool isConstCase = SecondOperand.getOpcode() !=
ISD::AND;
887 if (SecondOperand.getOpcode() ==
ISD::AND) {
900 EVT ValTy =
N->getOperand(0)->getValueType(0);
906 SecondOperand, Const1);
909 MipsISD::Ins,
DL,
N->getValueType(0),
914 DAG.
getConstant(ValTy.getSizeInBits() / 8 < 8 ? SMSize0 & 31
991 if (!IsSigned && !IsUnsigned)
997 std::tie(BottomHalf, TopHalf) =
1000 CurDAG.
getNode(MipsISD::MTLOHI,
DL, MVT::Untyped, BottomHalf, TopHalf);
1004 unsigned Opcode = IsAdd ? (IsUnsigned ? MipsISD::MAddu : MipsISD::MAdd)
1005 : (IsUnsigned ? MipsISD::MSubu : MipsISD::MSub);
1024 !Subtarget.
inMips16Mode() &&
N->getValueType(0) == MVT::i64)
1039 !Subtarget.
inMips16Mode() &&
N->getValueType(0) == MVT::i64)
1049 SDValue InnerAdd =
N->getOperand(1);
1058 if (
Lo.getOpcode() != MipsISD::Lo)
1061 if ((
Lo.getOpcode() != MipsISD::Lo) ||
1065 EVT ValTy =
N->getValueType(0);
1082 SDValue FirstOperand =
N->getOperand(0);
1083 unsigned FirstOperandOpc = FirstOperand.
getOpcode();
1084 SDValue SecondOperand =
N->getOperand(1);
1085 EVT ValTy =
N->getValueType(0);
1089 unsigned SMPos, SMSize;
1099 if (Pos >= ValTy.getSizeInBits())
1112 if (SMPos != 0 || SMSize > 32 || Pos + SMSize > ValTy.getSizeInBits())
1119 return DAG.
getNode(MipsISD::CIns,
DL, ValTy, NewOperand,
1132 EVT VT =
N->getValueType(0);
1147 int64_t ConstImm = ConstantOperand->getSExtValue();
1158 unsigned Opc =
N->getOpcode();
1167 case MipsISD::CMovFP_F:
1168 case MipsISD::CMovFP_T:
1200 return C->getAPIntValue().ule(15);
1208 N->getOperand(0).getOpcode() ==
ISD::SRL) ||
1210 N->getOperand(0).getOpcode() ==
ISD::SHL)) &&
1211 "Expected shift-shift mask");
1213 if (
N->getOperand(0).getValueType().isVector())
1228 switch (
Op.getOpcode())
1240 return lowerFSETCC(
Op, DAG);
1246 return lowerFCANONICALIZE(
Op, DAG);
1259 return lowerSTRICT_FP_TO_INT(
Op, DAG);
1262 return lowerREADCYCLECOUNTER(
Op, DAG);
1285 bool Is64Bit,
bool IsMicroMips) {
1294 TII.get(IsMicroMips ? Mips::TEQ_MM : Mips::TEQ))
1315 switch (
MI.getOpcode()) {
1318 case Mips::ATOMIC_LOAD_ADD_I8:
1319 return emitAtomicBinaryPartword(
MI, BB, 1);
1320 case Mips::ATOMIC_LOAD_ADD_I16:
1321 return emitAtomicBinaryPartword(
MI, BB, 2);
1322 case Mips::ATOMIC_LOAD_ADD_I32:
1323 return emitAtomicBinary(
MI, BB);
1324 case Mips::ATOMIC_LOAD_ADD_I64:
1325 return emitAtomicBinary(
MI, BB);
1327 case Mips::ATOMIC_LOAD_AND_I8:
1328 return emitAtomicBinaryPartword(
MI, BB, 1);
1329 case Mips::ATOMIC_LOAD_AND_I16:
1330 return emitAtomicBinaryPartword(
MI, BB, 2);
1331 case Mips::ATOMIC_LOAD_AND_I32:
1332 return emitAtomicBinary(
MI, BB);
1333 case Mips::ATOMIC_LOAD_AND_I64:
1334 return emitAtomicBinary(
MI, BB);
1336 case Mips::ATOMIC_LOAD_OR_I8:
1337 return emitAtomicBinaryPartword(
MI, BB, 1);
1338 case Mips::ATOMIC_LOAD_OR_I16:
1339 return emitAtomicBinaryPartword(
MI, BB, 2);
1340 case Mips::ATOMIC_LOAD_OR_I32:
1341 return emitAtomicBinary(
MI, BB);
1342 case Mips::ATOMIC_LOAD_OR_I64:
1343 return emitAtomicBinary(
MI, BB);
1345 case Mips::ATOMIC_LOAD_XOR_I8:
1346 return emitAtomicBinaryPartword(
MI, BB, 1);
1347 case Mips::ATOMIC_LOAD_XOR_I16:
1348 return emitAtomicBinaryPartword(
MI, BB, 2);
1349 case Mips::ATOMIC_LOAD_XOR_I32:
1350 return emitAtomicBinary(
MI, BB);
1351 case Mips::ATOMIC_LOAD_XOR_I64:
1352 return emitAtomicBinary(
MI, BB);
1354 case Mips::ATOMIC_LOAD_NAND_I8:
1355 return emitAtomicBinaryPartword(
MI, BB, 1);
1356 case Mips::ATOMIC_LOAD_NAND_I16:
1357 return emitAtomicBinaryPartword(
MI, BB, 2);
1358 case Mips::ATOMIC_LOAD_NAND_I32:
1359 return emitAtomicBinary(
MI, BB);
1360 case Mips::ATOMIC_LOAD_NAND_I64:
1361 return emitAtomicBinary(
MI, BB);
1363 case Mips::ATOMIC_LOAD_SUB_I8:
1364 return emitAtomicBinaryPartword(
MI, BB, 1);
1365 case Mips::ATOMIC_LOAD_SUB_I16:
1366 return emitAtomicBinaryPartword(
MI, BB, 2);
1367 case Mips::ATOMIC_LOAD_SUB_I32:
1368 return emitAtomicBinary(
MI, BB);
1369 case Mips::ATOMIC_LOAD_SUB_I64:
1370 return emitAtomicBinary(
MI, BB);
1372 case Mips::ATOMIC_SWAP_I8:
1373 return emitAtomicBinaryPartword(
MI, BB, 1);
1374 case Mips::ATOMIC_SWAP_I16:
1375 return emitAtomicBinaryPartword(
MI, BB, 2);
1376 case Mips::ATOMIC_SWAP_I32:
1377 return emitAtomicBinary(
MI, BB);
1378 case Mips::ATOMIC_SWAP_I64:
1379 return emitAtomicBinary(
MI, BB);
1381 case Mips::ATOMIC_CMP_SWAP_I8:
1382 return emitAtomicCmpSwapPartword(
MI, BB, 1);
1383 case Mips::ATOMIC_CMP_SWAP_I16:
1384 return emitAtomicCmpSwapPartword(
MI, BB, 2);
1385 case Mips::ATOMIC_CMP_SWAP_I32:
1386 return emitAtomicCmpSwap(
MI, BB);
1387 case Mips::ATOMIC_CMP_SWAP_I64:
1388 return emitAtomicCmpSwap(
MI, BB);
1390 case Mips::ATOMIC_LOAD_MIN_I8:
1391 return emitAtomicBinaryPartword(
MI, BB, 1);
1392 case Mips::ATOMIC_LOAD_MIN_I16:
1393 return emitAtomicBinaryPartword(
MI, BB, 2);
1394 case Mips::ATOMIC_LOAD_MIN_I32:
1395 return emitAtomicBinary(
MI, BB);
1396 case Mips::ATOMIC_LOAD_MIN_I64:
1397 return emitAtomicBinary(
MI, BB);
1399 case Mips::ATOMIC_LOAD_MAX_I8:
1400 return emitAtomicBinaryPartword(
MI, BB, 1);
1401 case Mips::ATOMIC_LOAD_MAX_I16:
1402 return emitAtomicBinaryPartword(
MI, BB, 2);
1403 case Mips::ATOMIC_LOAD_MAX_I32:
1404 return emitAtomicBinary(
MI, BB);
1405 case Mips::ATOMIC_LOAD_MAX_I64:
1406 return emitAtomicBinary(
MI, BB);
1408 case Mips::ATOMIC_LOAD_UMIN_I8:
1409 return emitAtomicBinaryPartword(
MI, BB, 1);
1410 case Mips::ATOMIC_LOAD_UMIN_I16:
1411 return emitAtomicBinaryPartword(
MI, BB, 2);
1412 case Mips::ATOMIC_LOAD_UMIN_I32:
1413 return emitAtomicBinary(
MI, BB);
1414 case Mips::ATOMIC_LOAD_UMIN_I64:
1415 return emitAtomicBinary(
MI, BB);
1417 case Mips::ATOMIC_LOAD_UMAX_I8:
1418 return emitAtomicBinaryPartword(
MI, BB, 1);
1419 case Mips::ATOMIC_LOAD_UMAX_I16:
1420 return emitAtomicBinaryPartword(
MI, BB, 2);
1421 case Mips::ATOMIC_LOAD_UMAX_I32:
1422 return emitAtomicBinary(
MI, BB);
1423 case Mips::ATOMIC_LOAD_UMAX_I64:
1424 return emitAtomicBinary(
MI, BB);
1426 case Mips::PseudoSDIV:
1427 case Mips::PseudoUDIV:
1434 case Mips::SDIV_MM_Pseudo:
1435 case Mips::UDIV_MM_Pseudo:
1438 case Mips::DIV_MMR6:
1439 case Mips::DIVU_MMR6:
1440 case Mips::MOD_MMR6:
1441 case Mips::MODU_MMR6:
1443 case Mips::PseudoDSDIV:
1444 case Mips::PseudoDUDIV:
1451 case Mips::PseudoSELECT_I:
1452 case Mips::PseudoSELECT_I64:
1453 case Mips::PseudoSELECT_S:
1454 case Mips::PseudoSELECT_D32:
1455 case Mips::PseudoSELECT_D64:
1456 return emitPseudoSELECT(
MI, BB,
false, Mips::BNE);
1457 case Mips::PseudoSELECTFP_F_I:
1458 case Mips::PseudoSELECTFP_F_I64:
1459 case Mips::PseudoSELECTFP_F_S:
1460 case Mips::PseudoSELECTFP_F_D32:
1461 case Mips::PseudoSELECTFP_F_D64:
1462 return emitPseudoSELECT(
MI, BB,
true, Mips::BC1F);
1463 case Mips::PseudoSELECTFP_T_I:
1464 case Mips::PseudoSELECTFP_T_I64:
1465 case Mips::PseudoSELECTFP_T_S:
1466 case Mips::PseudoSELECTFP_T_D32:
1467 case Mips::PseudoSELECTFP_T_D64:
1468 return emitPseudoSELECT(
MI, BB,
true, Mips::BC1T);
1469 case Mips::PseudoD_SELECT_I:
1470 case Mips::PseudoD_SELECT_I64:
1471 return emitPseudoD_SELECT(
MI, BB);
1473 return emitLDR_W(
MI, BB);
1475 return emitLDR_D(
MI, BB);
1477 return emitSTR_W(
MI, BB);
1479 return emitSTR_D(
MI, BB);
1495 bool NeedsAdditionalReg =
false;
1496 switch (
MI.getOpcode()) {
1497 case Mips::ATOMIC_LOAD_ADD_I32:
1498 AtomicOp = Mips::ATOMIC_LOAD_ADD_I32_POSTRA;
1500 case Mips::ATOMIC_LOAD_SUB_I32:
1501 AtomicOp = Mips::ATOMIC_LOAD_SUB_I32_POSTRA;
1503 case Mips::ATOMIC_LOAD_AND_I32:
1504 AtomicOp = Mips::ATOMIC_LOAD_AND_I32_POSTRA;
1506 case Mips::ATOMIC_LOAD_OR_I32:
1507 AtomicOp = Mips::ATOMIC_LOAD_OR_I32_POSTRA;
1509 case Mips::ATOMIC_LOAD_XOR_I32:
1510 AtomicOp = Mips::ATOMIC_LOAD_XOR_I32_POSTRA;
1512 case Mips::ATOMIC_LOAD_NAND_I32:
1513 AtomicOp = Mips::ATOMIC_LOAD_NAND_I32_POSTRA;
1515 case Mips::ATOMIC_SWAP_I32:
1516 AtomicOp = Mips::ATOMIC_SWAP_I32_POSTRA;
1518 case Mips::ATOMIC_LOAD_ADD_I64:
1519 AtomicOp = Mips::ATOMIC_LOAD_ADD_I64_POSTRA;
1521 case Mips::ATOMIC_LOAD_SUB_I64:
1522 AtomicOp = Mips::ATOMIC_LOAD_SUB_I64_POSTRA;
1524 case Mips::ATOMIC_LOAD_AND_I64:
1525 AtomicOp = Mips::ATOMIC_LOAD_AND_I64_POSTRA;
1527 case Mips::ATOMIC_LOAD_OR_I64:
1528 AtomicOp = Mips::ATOMIC_LOAD_OR_I64_POSTRA;
1530 case Mips::ATOMIC_LOAD_XOR_I64:
1531 AtomicOp = Mips::ATOMIC_LOAD_XOR_I64_POSTRA;
1533 case Mips::ATOMIC_LOAD_NAND_I64:
1534 AtomicOp = Mips::ATOMIC_LOAD_NAND_I64_POSTRA;
1536 case Mips::ATOMIC_SWAP_I64:
1537 AtomicOp = Mips::ATOMIC_SWAP_I64_POSTRA;
1539 case Mips::ATOMIC_LOAD_MIN_I32:
1540 AtomicOp = Mips::ATOMIC_LOAD_MIN_I32_POSTRA;
1541 NeedsAdditionalReg =
true;
1543 case Mips::ATOMIC_LOAD_MAX_I32:
1544 AtomicOp = Mips::ATOMIC_LOAD_MAX_I32_POSTRA;
1545 NeedsAdditionalReg =
true;
1547 case Mips::ATOMIC_LOAD_UMIN_I32:
1548 AtomicOp = Mips::ATOMIC_LOAD_UMIN_I32_POSTRA;
1549 NeedsAdditionalReg =
true;
1551 case Mips::ATOMIC_LOAD_UMAX_I32:
1552 AtomicOp = Mips::ATOMIC_LOAD_UMAX_I32_POSTRA;
1553 NeedsAdditionalReg =
true;
1555 case Mips::ATOMIC_LOAD_MIN_I64:
1556 AtomicOp = Mips::ATOMIC_LOAD_MIN_I64_POSTRA;
1557 NeedsAdditionalReg =
true;
1559 case Mips::ATOMIC_LOAD_MAX_I64:
1560 AtomicOp = Mips::ATOMIC_LOAD_MAX_I64_POSTRA;
1561 NeedsAdditionalReg =
true;
1563 case Mips::ATOMIC_LOAD_UMIN_I64:
1564 AtomicOp = Mips::ATOMIC_LOAD_UMIN_I64_POSTRA;
1565 NeedsAdditionalReg =
true;
1567 case Mips::ATOMIC_LOAD_UMAX_I64:
1568 AtomicOp = Mips::ATOMIC_LOAD_UMAX_I64_POSTRA;
1569 NeedsAdditionalReg =
true;
1630 if (NeedsAdditionalReg) {
1637 MI.eraseFromParent();
1644 unsigned SrcReg)
const {
1659 MachineRegisterInfo &RegInfo = MF->
getRegInfo();
1664 int64_t ShiftImm = 32 - (
Size * 8);
1675 "Unsupported size for EmitAtomicBinaryPartial.");
1678 MachineRegisterInfo &RegInfo = MF->
getRegInfo();
1680 const bool ArePtrs64bit =
ABI.ArePtrs64bit();
1681 const TargetRegisterClass *RCp =
1702 unsigned AtomicOp = 0;
1703 bool NeedsAdditionalReg =
false;
1704 switch (
MI.getOpcode()) {
1705 case Mips::ATOMIC_LOAD_NAND_I8:
1706 AtomicOp = Mips::ATOMIC_LOAD_NAND_I8_POSTRA;
1708 case Mips::ATOMIC_LOAD_NAND_I16:
1709 AtomicOp = Mips::ATOMIC_LOAD_NAND_I16_POSTRA;
1711 case Mips::ATOMIC_SWAP_I8:
1712 AtomicOp = Mips::ATOMIC_SWAP_I8_POSTRA;
1714 case Mips::ATOMIC_SWAP_I16:
1715 AtomicOp = Mips::ATOMIC_SWAP_I16_POSTRA;
1717 case Mips::ATOMIC_LOAD_ADD_I8:
1718 AtomicOp = Mips::ATOMIC_LOAD_ADD_I8_POSTRA;
1720 case Mips::ATOMIC_LOAD_ADD_I16:
1721 AtomicOp = Mips::ATOMIC_LOAD_ADD_I16_POSTRA;
1723 case Mips::ATOMIC_LOAD_SUB_I8:
1724 AtomicOp = Mips::ATOMIC_LOAD_SUB_I8_POSTRA;
1726 case Mips::ATOMIC_LOAD_SUB_I16:
1727 AtomicOp = Mips::ATOMIC_LOAD_SUB_I16_POSTRA;
1729 case Mips::ATOMIC_LOAD_AND_I8:
1730 AtomicOp = Mips::ATOMIC_LOAD_AND_I8_POSTRA;
1732 case Mips::ATOMIC_LOAD_AND_I16:
1733 AtomicOp = Mips::ATOMIC_LOAD_AND_I16_POSTRA;
1735 case Mips::ATOMIC_LOAD_OR_I8:
1736 AtomicOp = Mips::ATOMIC_LOAD_OR_I8_POSTRA;
1738 case Mips::ATOMIC_LOAD_OR_I16:
1739 AtomicOp = Mips::ATOMIC_LOAD_OR_I16_POSTRA;
1741 case Mips::ATOMIC_LOAD_XOR_I8:
1742 AtomicOp = Mips::ATOMIC_LOAD_XOR_I8_POSTRA;
1744 case Mips::ATOMIC_LOAD_XOR_I16:
1745 AtomicOp = Mips::ATOMIC_LOAD_XOR_I16_POSTRA;
1747 case Mips::ATOMIC_LOAD_MIN_I8:
1748 AtomicOp = Mips::ATOMIC_LOAD_MIN_I8_POSTRA;
1749 NeedsAdditionalReg =
true;
1751 case Mips::ATOMIC_LOAD_MIN_I16:
1752 AtomicOp = Mips::ATOMIC_LOAD_MIN_I16_POSTRA;
1753 NeedsAdditionalReg =
true;
1755 case Mips::ATOMIC_LOAD_MAX_I8:
1756 AtomicOp = Mips::ATOMIC_LOAD_MAX_I8_POSTRA;
1757 NeedsAdditionalReg =
true;
1759 case Mips::ATOMIC_LOAD_MAX_I16:
1760 AtomicOp = Mips::ATOMIC_LOAD_MAX_I16_POSTRA;
1761 NeedsAdditionalReg =
true;
1763 case Mips::ATOMIC_LOAD_UMIN_I8:
1764 AtomicOp = Mips::ATOMIC_LOAD_UMIN_I8_POSTRA;
1765 NeedsAdditionalReg =
true;
1767 case Mips::ATOMIC_LOAD_UMIN_I16:
1768 AtomicOp = Mips::ATOMIC_LOAD_UMIN_I16_POSTRA;
1769 NeedsAdditionalReg =
true;
1771 case Mips::ATOMIC_LOAD_UMAX_I8:
1772 AtomicOp = Mips::ATOMIC_LOAD_UMAX_I8_POSTRA;
1773 NeedsAdditionalReg =
true;
1775 case Mips::ATOMIC_LOAD_UMAX_I16:
1776 AtomicOp = Mips::ATOMIC_LOAD_UMAX_I16_POSTRA;
1777 NeedsAdditionalReg =
true;
1806 int64_t MaskImm = (
Size == 1) ? 255 : 65535;
1812 .
addReg(Ptr, {}, ArePtrs64bit ? Mips::sub_32 : 0)
1834 MachineInstrBuilder MIB =
1848 if (NeedsAdditionalReg) {
1854 MI.eraseFromParent();
1868 assert((
MI.getOpcode() == Mips::ATOMIC_CMP_SWAP_I32 ||
1869 MI.getOpcode() == Mips::ATOMIC_CMP_SWAP_I64) &&
1870 "Unsupported atomic pseudo for EmitAtomicCmpSwap.");
1872 const unsigned Size =
MI.getOpcode() == Mips::ATOMIC_CMP_SWAP_I32 ? 4 : 8;
1880 unsigned AtomicOp =
MI.getOpcode() == Mips::ATOMIC_CMP_SWAP_I32
1881 ? Mips::ATOMIC_CMP_SWAP_I32_POSTRA
1882 : Mips::ATOMIC_CMP_SWAP_I64_POSTRA;
1896 Register PtrCopy =
MRI.createVirtualRegister(
MRI.getRegClass(Ptr));
1897 Register OldValCopy =
MRI.createVirtualRegister(
MRI.getRegClass(OldVal));
1898 Register NewValCopy =
MRI.createVirtualRegister(
MRI.getRegClass(NewVal));
1916 MI.eraseFromParent();
1924 "Unsupported size for EmitAtomicCmpSwapPartial.");
1927 MachineRegisterInfo &RegInfo = MF->
getRegInfo();
1929 const bool ArePtrs64bit =
ABI.ArePtrs64bit();
1930 const TargetRegisterClass *RCp =
1951 unsigned AtomicOp =
MI.getOpcode() == Mips::ATOMIC_CMP_SWAP_I8
1952 ? Mips::ATOMIC_CMP_SWAP_I8_POSTRA
1953 : Mips::ATOMIC_CMP_SWAP_I16_POSTRA;
1994 int64_t MaskImm = (
Size == 1) ? 255 : 65535;
1995 BuildMI(BB,
DL,
TII->get(ArePtrs64bit ? Mips::DADDiu : Mips::ADDiu), MaskLSB2)
1997 BuildMI(BB,
DL,
TII->get(ArePtrs64bit ? Mips::AND64 : Mips::AND), AlignedAddr)
2000 .
addReg(Ptr, {}, ArePtrs64bit ? Mips::sub_32 : 0)
2041 MI.eraseFromParent();
2051 unsigned RdhwrOpc, DestReg;
2054 if (PtrVT == MVT::i64) {
2055 RdhwrOpc = Mips::RDHWR64;
2067 RdhwrOpc = Mips::RDHWR;
2095 if (CondRes.
getOpcode() != MipsISD::FPCmp)
2103 return DAG.
getNode(MipsISD::FPBrcond,
DL,
Op.getValueType(), Chain, BrCode,
2104 FCC0, Dest, CondRes);
2114 if (
Cond.getOpcode() != MipsISD::FPCmp)
2126 "Floating point operand expected.");
2155 EVT Ty =
Op.getValueType();
2157 const GlobalValue *GV =
N->getGlobal();
2161 "Windows is the only supported COFF target");
2168 const MipsTargetObjectFile *TLOF =
2169 static_cast<const MipsTargetObjectFile *
>(
2203 N, SDLoc(
N), Ty, DAG,
2211 EVT Ty =
Op.getValueType();
2232 const GlobalValue *GV = GA->
getGlobal();
2251 Args.emplace_back(Argument, PtrTy);
2253 TargetLowering::CallLoweringInfo CLI(DAG);
2256 .setLibCallee(
CallingConv::C, PtrTy, TlsGetAddr, std::move(Args));
2257 std::pair<SDValue, SDValue> CallResult =
LowerCallTo(CLI);
2259 SDValue Ret = CallResult.first;
2303 EVT Ty =
Op.getValueType();
2316 EVT Ty =
Op.getValueType();
2319 const MipsTargetObjectFile *TLOF =
2320 static_cast<const MipsTargetObjectFile *
>(
2337 MipsFunctionInfo *FuncInfo = MF.
getInfo<MipsFunctionInfo>();
2347 MachinePointerInfo(SV));
2351 SDNode *
Node =
Op.getNode();
2352 EVT VT =
Node->getValueType(0);
2356 llvm::MaybeAlign(
Node->getConstantOperandVal(3)).valueOrOne();
2359 unsigned ArgSlotSizeInBytes = (
ABI.IsN32() ||
ABI.IsN64()) ? 8 : 4;
2362 VAListPtr, MachinePointerInfo(SV));
2384 unsigned ArgSizeInBytes =
2392 MachinePointerInfo(SV));
2399 if (!
Subtarget.isLittle() && ArgSizeInBytes < ArgSlotSizeInBytes) {
2400 unsigned Adjustment = ArgSlotSizeInBytes - ArgSizeInBytes;
2405 return DAG.
getLoad(VT,
DL, Chain, VAList, MachinePointerInfo());
2409 bool HasExtractInsert) {
2410 EVT TyX =
Op.getOperand(0).getValueType();
2411 EVT TyY =
Op.getOperand(1).getValueType();
2421 DAG.
getNode(MipsISD::ExtractElementF64,
DL, MVT::i32,
Op.getOperand(0),
2425 DAG.
getNode(MipsISD::ExtractElementF64,
DL, MVT::i32,
Op.getOperand(1),
2428 if (HasExtractInsert) {
2432 Res = DAG.
getNode(MipsISD::Ins,
DL, MVT::i32,
E, Const31, Const1,
X);
2446 if (TyX == MVT::f32)
2452 return DAG.
getNode(MipsISD::BuildPairF64,
DL, MVT::f64, LowX, Res);
2456 bool HasExtractInsert) {
2457 unsigned WidthX =
Op.getOperand(0).getValueSizeInBits();
2458 unsigned WidthY =
Op.getOperand(1).getValueSizeInBits();
2467 if (HasExtractInsert) {
2473 if (WidthX > WidthY)
2475 else if (WidthY > WidthX)
2494 if (WidthX > WidthY)
2496 else if (WidthY > WidthX)
2514 bool HasExtractInsert)
const {
2518 if (
Op->getFlags().hasNoNaNs() ||
Subtarget.inAbs2008Mode())
2525 : DAG.
getNode(MipsISD::ExtractElementF64,
DL, MVT::i32,
2526 Op.getOperand(0), Const1);
2529 if (HasExtractInsert)
2530 Res = DAG.
getNode(MipsISD::Ins,
DL, MVT::i32,
2540 if (
Op.getValueType() == MVT::f32)
2548 DAG.
getNode(MipsISD::ExtractElementF64,
DL, MVT::i32,
Op.getOperand(0),
2550 return DAG.
getNode(MipsISD::BuildPairF64,
DL, MVT::f64, LowX, Res);
2554 bool HasExtractInsert)
const {
2558 if (
Op->getFlags().hasNoNaNs() ||
Subtarget.inAbs2008Mode())
2565 if (HasExtractInsert)
2566 Res = DAG.
getNode(MipsISD::Ins,
DL, MVT::i64,
2578 if ((
ABI.IsN32() ||
ABI.IsN64()) && (
Op.getValueType() == MVT::f64))
2579 return lowerFABS64(
Op, DAG,
Subtarget.hasExtractInsert());
2581 return lowerFABS32(
Op, DAG,
Subtarget.hasExtractInsert());
2587 EVT VT =
Op.getValueType();
2589 SDNodeFlags
Flags =
Op->getFlags();
2601 if (
Op.getConstantOperandVal(0) != 0) {
2603 "return address can be determined only for current frame");
2609 EVT VT =
Op.getValueType();
2619 if (
Op.getConstantOperandVal(0) != 0) {
2621 "return address can be determined only for current frame");
2627 MVT VT =
Op.getSimpleValueType();
2628 unsigned RA =
ABI.IsN64() ? Mips::RA_64 : Mips::RA;
2643 MipsFunctionInfo *MipsFI = MF.
getInfo<MipsFunctionInfo>();
2650 EVT Ty =
ABI.IsN64() ? MVT::i64 : MVT::i32;
2654 unsigned OffsetReg =
ABI.IsN64() ? Mips::V1_64 : Mips::V1;
2655 unsigned AddrReg =
ABI.IsN64() ? Mips::V0_64 : Mips::V0;
2658 return DAG.
getNode(MipsISD::EH_RETURN,
DL, MVT::Other, Chain,
2670 return DAG.
getNode(MipsISD::Sync,
DL, MVT::Other,
Op.getOperand(0),
2677 MVT VT =
Subtarget.isGP64bit() ? MVT::i64 : MVT::i32;
2711 MVT VT =
Subtarget.isGP64bit() ? MVT::i64 : MVT::i32;
2742 SDVTList VTList = DAG.
getVTList(VT, VT);
2745 DL, VTList,
Cond, ShiftRightHi,
2760 SDValue Ptr = LD->getBasePtr();
2761 EVT VT = LD->getValueType(0), MemVT = LD->getMemoryVT();
2772 LD->getMemOperand());
2778 EVT MemVT = LD->getMemoryVT();
2780 if (
Subtarget.systemSupportsUnalignedAccess())
2784 if ((LD->getAlign().value() >= (MemVT.
getSizeInBits() / 8)) ||
2785 ((MemVT != MVT::i32) && (MemVT != MVT::i64)))
2789 EVT VT =
Op.getValueType();
2793 assert((VT == MVT::i32) || (VT == MVT::i64));
2871 return createStoreLR(MipsISD::SWR, DAG, SD, SWL, IsLittle ? 0 : 3);
2882 return createStoreLR(MipsISD::SDR, DAG, SD, SDL, IsLittle ? 0 : 7);
2907 if (!
Subtarget.systemSupportsUnalignedAccess() &&
2909 ((MemVT == MVT::i32) || (MemVT == MVT::i64)))
2921 EVT ValTy =
Op->getValueType(0);
2946 Loc,
Op.getValueType(), SrcVal);
2952 static const MCPhysReg RCRegs[] = {Mips::FCR31};
2985 State.getMachineFunction().getSubtarget());
2987 static const MCPhysReg IntRegs[] = { Mips::A0, Mips::A1, Mips::A2, Mips::A3 };
2991 static const MCPhysReg FloatVectorIntRegs[] = { Mips::A0, Mips::A2 };
2999 if (LocVT == MVT::i8 || LocVT == MVT::i16 || LocVT == MVT::i32) {
3003 else if (ArgFlags.
isZExt())
3011 if (LocVT == MVT::i8 || LocVT == MVT::i16) {
3015 else if (ArgFlags.
isZExt())
3026 bool AllocateFloatsInIntReg = State.isVarArg() || ValNo > 1 ||
3027 State.getFirstUnallocated(
F32Regs) != ValNo;
3029 bool isI64 = (ValVT == MVT::i32 && OrigAlign ==
Align(8));
3033 if (ValVT == MVT::i32 && isVectorFloat) {
3039 Reg = State.AllocateReg(FloatVectorIntRegs);
3040 if (
Reg == Mips::A2)
3041 State.AllocateReg(Mips::A1);
3043 State.AllocateReg(Mips::A3);
3049 }
else if (ValVT == MVT::i32 ||
3050 (ValVT == MVT::f32 && AllocateFloatsInIntReg)) {
3054 if (isI64 && (
Reg == Mips::A1 ||
Reg == Mips::A3))
3057 }
else if (ValVT == MVT::f64 && AllocateFloatsInIntReg) {
3061 if (
Reg == Mips::A1 ||
Reg == Mips::A3)
3077 if (ValVT == MVT::f32) {
3082 Reg = State.AllocateReg(F64Regs);
3085 if (Reg2 == Mips::A1 || Reg2 == Mips::A3)
3105 static const MCPhysReg F64Regs[] = { Mips::D6, Mips::D7 };
3107 return CC_MipsO32(ValNo, ValVT, LocVT, LocInfo, ArgFlags, OrigTy, State,
3115 static const MCPhysReg F64Regs[] = { Mips::D12_64, Mips::D14_64 };
3117 return CC_MipsO32(ValNo, ValVT, LocVT, LocInfo, ArgFlags, OrigTy, State,
3126#include "MipsGenCallingConv.inc"
3129 return CC_Mips_FixedArg;
3141 const SDLoc &
DL,
bool IsTailCall,
3159 std::deque<std::pair<unsigned, SDValue>> &RegsToPass,
3160 bool IsPICCall,
bool GlobalOrExternal,
bool InternalLinkage,
3173 if (IsPICCall && !InternalLinkage && IsCallReloc) {
3174 unsigned GPReg =
ABI.IsN64() ? Mips::GP_64 : Mips::GP;
3175 EVT Ty =
ABI.IsN64() ? MVT::i64 : MVT::i32;
3176 RegsToPass.push_back(std::make_pair(GPReg,
getGlobalReg(CLI.
DAG, Ty)));
3185 for (
auto &R : RegsToPass) {
3192 for (
auto &R : RegsToPass)
3199 assert(Mask &&
"Missing call preserved mask for calling convention");
3203 Function *
F =
G->getGlobal()->getParent()->getFunction(Sym);
3204 if (
F &&
F->hasFnAttribute(
"__Mips16RetHelper")) {
3212 Ops.push_back(InGlue);
3217 switch (
MI.getOpcode()) {
3221 case Mips::JALRPseudo:
3223 case Mips::JALR64Pseudo:
3224 case Mips::JALR16_MM:
3225 case Mips::JALRC16_MMR6:
3226 case Mips::TAILCALLREG:
3227 case Mips::TAILCALLREG64:
3228 case Mips::TAILCALLR6REG:
3229 case Mips::TAILCALL64R6REG:
3230 case Mips::TAILCALLREG_MM:
3231 case Mips::TAILCALLREG_MMR6: {
3235 Node->getNumOperands() < 1 ||
3236 Node->getOperand(0).getNumOperands() < 2) {
3242 const SDValue TargetAddr =
Node->getOperand(0).getOperand(1);
3250 LLVM_DEBUG(
dbgs() <<
"Not adding R_MIPS_JALR against data symbol "
3251 <<
G->getGlobal()->getName() <<
"\n");
3254 Sym =
G->getGlobal()->getName();
3258 Sym = ES->getSymbol();
3266 LLVM_DEBUG(
dbgs() <<
"Adding R_MIPS_JALR against " << Sym <<
"\n");
3334 unsigned ReservedArgArea =
3335 MemcpyInByVal ? 0 : ABI.GetCalleeAllocdArgSizeInBytes(CallConv);
3336 CCInfo.AllocateStack(ReservedArgArea,
Align(1));
3338 CCInfo.AnalyzeCallOperands(Outs,
CC_Mips);
3341 unsigned StackSize = CCInfo.getStackSize();
3353 bool CalleeIsLocal =
true;
3357 bool HasHiddenVisibility =
3360 CalleeIsLocal = HasLocalLinkage || HasHiddenVisibility;
3370 "site marked musttail");
3372 bool Eligible = isEligibleForTailCallOptimization(
3373 CCInfo, StackSize, *MF.
getInfo<MipsFunctionInfo>());
3374 if (!Eligible || !CalleeIsLocal) {
3378 "failed to perform tail call elimination on a call "
3379 "site marked musttail");
3391 StackSize =
alignTo(StackSize, StackAlignment);
3393 if (!(IsTailCall || MemcpyInByVal))
3399 std::deque<std::pair<unsigned, SDValue>> RegsToPass;
3402 CCInfo.rewindByValRegsInfo();
3405 for (
unsigned i = 0, e = ArgLocs.
size(), OutIdx = 0; i != e; ++i, ++OutIdx) {
3406 SDValue Arg = OutVals[OutIdx];
3407 CCValAssign &VA = ArgLocs[i];
3409 ISD::ArgFlagsTy
Flags = Outs[OutIdx].Flags;
3410 bool UseUpperBits =
false;
3413 if (
Flags.isByVal()) {
3414 unsigned FirstByValReg, LastByValReg;
3415 unsigned ByValIdx = CCInfo.getInRegsParamsProcessed();
3416 CCInfo.getInRegsParamInfo(ByValIdx, FirstByValReg, LastByValReg);
3419 "ByVal args of size 0 should have been ignored by front-end.");
3420 assert(ByValIdx < CCInfo.getInRegsParamsCount());
3422 "Do not tail-call optimize if there is a byval argument.");
3423 passByValArg(Chain,
DL, RegsToPass, MemOpChains, StackPtr, MFI, DAG, Arg,
3424 FirstByValReg, LastByValReg, Flags,
Subtarget.isLittle(),
3426 CCInfo.nextInRegsParam();
3436 if ((ValVT == MVT::f32 && LocVT == MVT::i32) ||
3437 (ValVT == MVT::f64 && LocVT == MVT::i64) ||
3438 (ValVT == MVT::i64 && LocVT == MVT::f64))
3440 else if (ValVT == MVT::f64 && LocVT == MVT::i32) {
3451 Register LocRegHigh = ArgLocs[++i].getLocReg();
3452 RegsToPass.
push_back(std::make_pair(LocRegLo,
Lo));
3453 RegsToPass.push_back(std::make_pair(LocRegHigh,
Hi));
3462 UseUpperBits =
true;
3468 UseUpperBits =
true;
3474 UseUpperBits =
true;
3482 unsigned ValSizeInBits = Outs[OutIdx].ArgVT.getSizeInBits();
3492 RegsToPass.push_back(std::make_pair(VA.
getLocReg(), Arg));
3513 Chain, Arg,
DL, IsTailCall, DAG));
3518 if (!MemOpChains.
empty())
3525 EVT Ty =
Callee.getValueType();
3526 bool GlobalOrExternal =
false, IsCallReloc =
false;
3531 if (!
Subtarget.isABICalls() && !IsPIC) {
3541 bool UseLongCalls =
Subtarget.useLongCalls();
3545 if (
F->hasFnAttribute(
"long-call"))
3546 UseLongCalls =
true;
3547 else if (
F->hasFnAttribute(
"short-call"))
3548 UseLongCalls =
false;
3557 bool InternalLinkage =
false;
3560 G->getGlobal()->hasDLLImportStorageClass()) {
3562 "Windows is the only supported COFF target");
3563 auto PtrInfo = MachinePointerInfo();
3567 const GlobalValue *Val =
G->getGlobal();
3570 if (InternalLinkage)
3586 GlobalOrExternal =
true;
3589 const char *Sym = S->getSymbol();
3605 GlobalOrExternal =
true;
3609 SDVTList NodeTys = DAG.
getVTList(MVT::Other, MVT::Glue);
3611 getOpndList(
Ops, RegsToPass, IsPIC, GlobalOrExternal, InternalLinkage,
3612 IsCallReloc, CLI, Callee, Chain);
3621 Chain = DAG.
getNode(MipsISD::JmpLink,
DL, NodeTys,
Ops);
3628 if (!(MemcpyInByVal)) {
3635 return LowerCallResult(Chain, InGlue, CallConv, IsVarArg, Ins,
DL, DAG,
3641SDValue MipsTargetLowering::LowerCallResult(
3651 CCInfo.AnalyzeCallResult(Ins, RetCC_Mips);
3654 for (
unsigned i = 0; i != RVLocs.
size(); ++i) {
3655 CCValAssign &VA = RVLocs[i];
3659 RVLocs[i].getLocVT(), InGlue);
3664 unsigned ValSizeInBits = Ins[i].ArgVT.getSizeInBits();
3765SDValue MipsTargetLowering::LowerFormalArguments(
3771 MipsFunctionInfo *MipsFI = MF.
getInfo<MipsFunctionInfo>();
3776 std::vector<SDValue> OutChains;
3782 CCInfo.AllocateStack(
ABI.GetCalleeAllocdArgSizeInBytes(CallConv),
Align(1));
3786 if (
Func.hasFnAttribute(
"interrupt") && !
Func.arg_empty())
3788 "Functions with the interrupt attribute cannot have arguments!");
3790 CCInfo.AnalyzeFormalArguments(Ins, CC_Mips_FixedArg);
3792 CCInfo.getInRegsParamsCount() > 0);
3794 unsigned CurArgIdx = 0;
3795 CCInfo.rewindByValRegsInfo();
3797 for (
unsigned i = 0, e = ArgLocs.
size(), InsIdx = 0; i != e; ++i, ++InsIdx) {
3798 CCValAssign &VA = ArgLocs[i];
3799 if (Ins[InsIdx].isOrigArg()) {
3800 std::advance(FuncArg, Ins[InsIdx].getOrigArgIndex() - CurArgIdx);
3801 CurArgIdx = Ins[InsIdx].getOrigArgIndex();
3804 ISD::ArgFlagsTy
Flags = Ins[InsIdx].Flags;
3807 if (
Flags.isByVal()) {
3808 assert(Ins[InsIdx].isOrigArg() &&
"Byval arguments cannot be implicit");
3809 unsigned FirstByValReg, LastByValReg;
3810 unsigned ByValIdx = CCInfo.getInRegsParamsProcessed();
3811 CCInfo.getInRegsParamInfo(ByValIdx, FirstByValReg, LastByValReg);
3814 "ByVal args of size 0 should have been ignored by front-end.");
3815 assert(ByValIdx < CCInfo.getInRegsParamsCount());
3816 copyByValRegs(Chain,
DL, OutChains, DAG, Flags, InVals, &*FuncArg,
3817 FirstByValReg, LastByValReg, VA, CCInfo);
3818 CCInfo.nextInRegsParam();
3838 if ((RegVT == MVT::i32 && ValVT == MVT::f32) ||
3839 (RegVT == MVT::i64 && ValVT == MVT::f64) ||
3840 (RegVT == MVT::f64 && ValVT == MVT::i64))
3842 else if (
ABI.IsO32() && RegVT == MVT::i32 &&
3843 ValVT == MVT::f64) {
3845 CCValAssign &NextVA = ArgLocs[++i];
3851 ArgValue = DAG.
getNode(MipsISD::BuildPairF64,
DL, MVT::f64,
3852 ArgValue, ArgValue2);
3871 LocVT,
DL, Chain, FIN,
3873 OutChains.push_back(ArgValue.
getValue(1));
3882 for (
unsigned i = 0, e = ArgLocs.
size(), InsIdx = 0; i != e; ++i, ++InsIdx) {
3884 if (ArgLocs[i].needsCustom()) {
3892 if (Ins[InsIdx].
Flags.isSRet()) {
3906 writeVarArgRegs(OutChains, Chain,
DL, DAG, CCInfo);
3910 if (!OutChains.empty()) {
3911 OutChains.push_back(Chain);
3928 MipsCCState CCInfo(CallConv, IsVarArg, MF, RVLocs,
Context);
3929 return CCInfo.CheckReturn(Outs, RetCC_Mips);
3932bool MipsTargetLowering::shouldSignExtendTypeInLibCall(
Type *Ty,
3933 bool IsSigned)
const {
3945 MipsFunctionInfo *MipsFI = MF.
getInfo<MipsFunctionInfo>();
3949 return DAG.
getNode(MipsISD::ERet,
DL, MVT::Other, RetOps);
3964 MipsCCState CCInfo(CallConv, IsVarArg, MF, RVLocs, *DAG.
getContext());
3967 CCInfo.AnalyzeReturn(Outs, RetCC_Mips);
3973 for (
unsigned i = 0; i != RVLocs.
size(); ++i) {
3975 CCValAssign &VA = RVLocs[i];
3977 bool UseUpperBits =
false;
3988 UseUpperBits =
true;
3994 UseUpperBits =
true;
4000 UseUpperBits =
true;
4008 unsigned ValSizeInBits = Outs[i].ArgVT.getSizeInBits();
4027 MipsFunctionInfo *MipsFI = MF.
getInfo<MipsFunctionInfo>();
4034 unsigned V0 =
ABI.IsN64() ? Mips::V0_64 : Mips::V0;
4049 return LowerInterruptReturn(RetOps,
DL, DAG);
4052 return DAG.
getNode(MipsISD::Ret,
DL, MVT::Other, RetOps);
4062MipsTargetLowering::getConstraintType(
StringRef Constraint)
const {
4074 if (Constraint.
size() == 1) {
4075 switch (Constraint[0]) {
4089 if (Constraint ==
"ZC")
4099MipsTargetLowering::getSingleConstraintMatchWeight(
4100 AsmOperandInfo &
info,
const char *constraint)
const {
4102 Value *CallOperandVal =
info.CallOperandVal;
4105 if (!CallOperandVal)
4109 switch (*constraint) {
4153 unsigned long long &
Reg) {
4154 if (
C.front() !=
'{' ||
C.back() !=
'}')
4155 return std::make_pair(
false,
false);
4159 I = std::find_if(
B,
E, isdigit);
4165 return std::make_pair(
true,
false);
4176 return VT.
bitsLT(MinVT) ? MinVT : VT;
4179std::pair<unsigned, const TargetRegisterClass *> MipsTargetLowering::
4185 unsigned long long Reg;
4190 return std::make_pair(0U,
nullptr);
4192 if ((Prefix ==
"hi" || Prefix ==
"lo")) {
4195 return std::make_pair(0U,
nullptr);
4197 RC =
TRI->getRegClass(Prefix ==
"hi" ?
4198 Mips::HI32RegClassID : Mips::LO32RegClassID);
4199 return std::make_pair(*(RC->
begin()), RC);
4200 }
else if (Prefix.starts_with(
"$msa")) {
4205 return std::make_pair(0U,
nullptr);
4208 .
Case(
"$msair", Mips::MSAIR)
4209 .
Case(
"$msacsr", Mips::MSACSR)
4210 .
Case(
"$msaaccess", Mips::MSAAccess)
4211 .
Case(
"$msasave", Mips::MSASave)
4212 .
Case(
"$msamodify", Mips::MSAModify)
4213 .
Case(
"$msarequest", Mips::MSARequest)
4214 .
Case(
"$msamap", Mips::MSAMap)
4215 .
Case(
"$msaunmap", Mips::MSAUnmap)
4219 return std::make_pair(0U,
nullptr);
4221 RC =
TRI->getRegClass(Mips::MSACtrlRegClassID);
4222 return std::make_pair(
Reg, RC);
4226 return std::make_pair(0U,
nullptr);
4228 if (Prefix ==
"$f") {
4233 if (VT == MVT::Other) {
4237 VT = (
Subtarget.isFP64bit() || !(
Reg % 2)) ? MVT::f64 : MVT::f32;
4242 if (RC == &Mips::AFGR64RegClass) {
4246 }
else if (Prefix ==
"$fcc")
4247 RC =
TRI->getRegClass(Mips::FCCRegClassID);
4248 else if (Prefix ==
"$w") {
4256 return std::make_pair(*(RC->
begin() +
Reg), RC);
4262std::pair<unsigned, const TargetRegisterClass *>
4266 if (Constraint.
size() == 1) {
4267 switch (Constraint[0]) {
4271 if ((VT == MVT::i32 || VT == MVT::i16 || VT == MVT::i8 ||
4273 (VT == MVT::f32 &&
Subtarget.useSoftFloat())) {
4275 return std::make_pair(0U, &Mips::CPU16RegsRegClass);
4276 return std::make_pair(0U, &Mips::GPR32RegClass);
4278 if ((VT == MVT::i64 || (VT == MVT::f64 &&
Subtarget.useSoftFloat()) ||
4279 (VT == MVT::f64 &&
Subtarget.isSingleFloat())) &&
4281 return std::make_pair(0U, &Mips::GPR32RegClass);
4282 if ((VT == MVT::i64 || (VT == MVT::f64 &&
Subtarget.useSoftFloat()) ||
4283 (VT == MVT::f64 &&
Subtarget.isSingleFloat())) &&
4285 return std::make_pair(0U, &Mips::GPR64RegClass);
4287 return std::make_pair(0U,
nullptr);
4289 if (VT == MVT::v16i8)
4290 return std::make_pair(0U, &Mips::MSA128BRegClass);
4291 else if (VT == MVT::v8i16 || VT == MVT::v8f16)
4292 return std::make_pair(0U, &Mips::MSA128HRegClass);
4293 else if (VT == MVT::v4i32 || VT == MVT::v4f32)
4294 return std::make_pair(0U, &Mips::MSA128WRegClass);
4295 else if (VT == MVT::v2i64 || VT == MVT::v2f64)
4296 return std::make_pair(0U, &Mips::MSA128DRegClass);
4297 else if (VT == MVT::f32)
4298 return std::make_pair(0U, &Mips::FGR32RegClass);
4299 else if ((VT == MVT::f64) && (!
Subtarget.isSingleFloat())) {
4301 return std::make_pair(0U, &Mips::FGR64RegClass);
4302 return std::make_pair(0U, &Mips::AFGR64RegClass);
4307 return std::make_pair((
unsigned)Mips::T9, &Mips::GPR32RegClass);
4309 return std::make_pair((
unsigned)Mips::T9_64, &Mips::GPR64RegClass);
4311 return std::make_pair(0U,
nullptr);
4314 if (VT == MVT::i32 || VT == MVT::i16 || VT == MVT::i8)
4315 return std::make_pair((
unsigned)Mips::LO0, &Mips::LO32RegClass);
4316 return std::make_pair((
unsigned)Mips::LO0_64, &Mips::LO64RegClass);
4321 return std::make_pair(0U,
nullptr);
4325 if (!Constraint.
empty()) {
4326 std::pair<unsigned, const TargetRegisterClass *>
R;
4327 R = parseRegForInlineAsmConstraint(Constraint, VT);
4338void MipsTargetLowering::LowerAsmOperandForConstraint(
SDValue Op,
4340 std::vector<SDValue> &
Ops,
4346 if (Constraint.
size() > 1)
4349 char ConstraintLetter = Constraint[0];
4350 switch (ConstraintLetter) {
4355 EVT
Type =
Op.getValueType();
4356 int64_t Val =
C->getSExtValue();
4365 EVT
Type =
Op.getValueType();
4366 int64_t Val =
C->getZExtValue();
4375 EVT
Type =
Op.getValueType();
4376 uint64_t Val =
C->getZExtValue();
4385 EVT
Type =
Op.getValueType();
4386 int64_t Val =
C->getSExtValue();
4387 if ((
isInt<32>(Val)) && ((Val & 0xffff) == 0)){
4395 EVT
Type =
Op.getValueType();
4396 int64_t Val =
C->getSExtValue();
4397 if ((Val >= -65535) && (Val <= -1)) {
4405 EVT
Type =
Op.getValueType();
4406 int64_t Val =
C->getSExtValue();
4415 EVT
Type =
Op.getValueType();
4416 int64_t Val =
C->getSExtValue();
4417 if ((Val <= 65535) && (Val >= 1)) {
4426 Ops.push_back(Result);
4433bool MipsTargetLowering::isLegalAddressingMode(
const DataLayout &
DL,
4461EVT MipsTargetLowering::getOptimalMemOpType(
4463 const AttributeList &FuncAttributes)
const {
4470bool MipsTargetLowering::isFPImmLegal(
const APFloat &Imm,
EVT VT,
4471 bool ForCodeSize)
const {
4472 if (VT != MVT::f32 && VT != MVT::f64)
4474 if (
Imm.isNegZero())
4476 return Imm.isZero();
4479bool MipsTargetLowering::isLegalICmpImmediate(int64_t Imm)
const {
4483bool MipsTargetLowering::isLegalAddImmediate(int64_t Imm)
const {
4495SDValue MipsTargetLowering::getPICJumpTableRelocBase(
SDValue Table,
4506void MipsTargetLowering::copyByValRegs(
4510 unsigned FirstReg,
unsigned LastReg,
const CCValAssign &VA,
4514 unsigned GPRSizeInBytes =
Subtarget.getGPRSizeInBytes();
4515 unsigned NumRegs = LastReg - FirstReg;
4516 unsigned RegAreaSize = NumRegs * GPRSizeInBytes;
4517 unsigned FrameObjSize = std::max(
Flags.getByValSize(), RegAreaSize);
4524 (int)((ByValArgRegs.
size() - FirstReg) * GPRSizeInBytes);
4546 for (
unsigned I = 0;
I < NumRegs; ++
I) {
4547 unsigned ArgReg = ByValArgRegs[FirstReg +
I];
4548 unsigned VReg =
addLiveIn(MF, ArgReg, RC);
4549 unsigned Offset =
I * GPRSizeInBytes;
4553 StorePtr, MachinePointerInfo(FuncArg,
Offset));
4554 OutChains.push_back(Store);
4559void MipsTargetLowering::passByValArg(
4561 std::deque<std::pair<unsigned, SDValue>> &RegsToPass,
4566 unsigned ByValSizeInBytes =
Flags.getByValSize();
4567 unsigned OffsetInBytes = 0;
4568 unsigned RegSizeInBytes =
Subtarget.getGPRSizeInBytes();
4570 std::min(
Flags.getNonZeroByValAlign(),
Align(RegSizeInBytes));
4573 unsigned NumRegs = LastReg - FirstReg;
4577 bool LeftoverBytes = (NumRegs * RegSizeInBytes > ByValSizeInBytes);
4581 for (;
I < NumRegs - LeftoverBytes; ++
I, OffsetInBytes += RegSizeInBytes) {
4585 MachinePointerInfo(), Alignment);
4587 unsigned ArgReg = ArgRegs[FirstReg +
I];
4588 RegsToPass.push_back(std::make_pair(ArgReg, LoadVal));
4592 if (ByValSizeInBytes == OffsetInBytes)
4596 if (LeftoverBytes) {
4599 for (
unsigned LoadSizeInBytes = RegSizeInBytes / 2, TotalBytesLoaded = 0;
4600 OffsetInBytes < ByValSizeInBytes; LoadSizeInBytes /= 2) {
4601 unsigned RemainingSizeInBytes = ByValSizeInBytes - OffsetInBytes;
4603 if (RemainingSizeInBytes < LoadSizeInBytes)
4619 Shamt = TotalBytesLoaded * 8;
4621 Shamt = (RegSizeInBytes - (TotalBytesLoaded + LoadSizeInBytes)) * 8;
4631 OffsetInBytes += LoadSizeInBytes;
4632 TotalBytesLoaded += LoadSizeInBytes;
4633 Alignment = std::min(Alignment,
Align(LoadSizeInBytes));
4636 unsigned ArgReg = ArgRegs[FirstReg +
I];
4637 RegsToPass.push_back(std::make_pair(ArgReg, Val));
4643 unsigned MemCpySize = ByValSizeInBytes - OffsetInBytes;
4650 Align(Alignment),
false,
false,
4651 nullptr, std::nullopt, MachinePointerInfo(), MachinePointerInfo());
4655void MipsTargetLowering::writeVarArgRegs(std::vector<SDValue> &OutChains,
4661 unsigned RegSizeInBytes =
Subtarget.getGPRSizeInBytes();
4666 MipsFunctionInfo *MipsFI = MF.
getInfo<MipsFunctionInfo>();
4671 if (ArgRegs.
size() == Idx)
4676 (int)(RegSizeInBytes * (ArgRegs.
size() - Idx));
4688 for (
unsigned I = Idx;
I < ArgRegs.
size();
4689 ++
I, VaArgOffset += RegSizeInBytes) {
4695 DAG.
getStore(Chain,
DL, ArgValue, PtrOff, MachinePointerInfo());
4698 OutChains.push_back(Store);
4703 Align Alignment)
const {
4706 assert(
Size &&
"Byval argument's size shouldn't be 0.");
4710 unsigned FirstReg = 0;
4711 unsigned NumRegs = 0;
4714 unsigned RegSizeInBytes =
Subtarget.getGPRSizeInBytes();
4723 Alignment >=
Align(RegSizeInBytes) &&
4724 "Byval argument's alignment should be a multiple of RegSizeInBytes.");
4726 FirstReg = State->getFirstUnallocated(IntArgRegs);
4732 if ((Alignment > RegSizeInBytes) && (FirstReg % 2)) {
4733 State->AllocateReg(IntArgRegs[FirstReg], ShadowRegs[FirstReg]);
4739 for (
unsigned I = FirstReg;
Size > 0 && (
I < IntArgRegs.
size());
4740 Size -= RegSizeInBytes, ++
I, ++NumRegs)
4741 State->AllocateReg(IntArgRegs[
I], ShadowRegs[
I]);
4744 State->addInRegsParamInfo(FirstReg, FirstReg + NumRegs);
4750 unsigned Opc)
const {
4752 "Subtarget already supports SELECT nodes with the use of"
4753 "conditional-move instructions.");
4776 F->insert(It, copy0MBB);
4777 F->insert(It, sinkMBB);
4820 MI.eraseFromParent();
4829 "Subtarget already supports SELECT nodes with the use of"
4830 "conditional-move instructions.");
4849 MachineBasicBlock *thisMBB = BB;
4851 MachineBasicBlock *copy0MBB =
F->CreateMachineBasicBlock(LLVM_BB);
4852 MachineBasicBlock *sinkMBB =
F->CreateMachineBasicBlock(LLVM_BB);
4854 F->insert(It, sinkMBB);
4896 MI.eraseFromParent();
4902int MipsTargetLowering::getCPURegisterIndex(
StringRef Name)
const {
4905 CC = StringSwitch<unsigned>(Name)
4942 if (!(
ABI.IsN32() ||
ABI.IsN64()))
4948 if (8 <= CC && CC <= 11)
4952 CC = StringSwitch<unsigned>(Name)
4970 std::string newRegName =
RegName;
4975 std::smatch matchResult;
4977 static const std::regex matchStr(
"^[0-9]*$");
4978 if (std::regex_match(newRegName, matchResult, matchStr))
4979 regIdx = std::stoi(newRegName);
4982 regIdx = getCPURegisterIndex(
StringRef(newRegName));
4986 if (regIdx >= 0 && regIdx < 32) {
4989 ?
MRI->getRegClass(Mips::GPR64RegClassID)
4990 :
MRI->getRegClass(Mips::GPR32RegClassID);
5008 unsigned Imm =
MI.getOperand(2).getImm();
5014 Register Temp =
MRI.createVirtualRegister(&Mips::GPR32RegClass);
5023 Register LoadHalf =
MRI.createVirtualRegister(&Mips::GPR32RegClass);
5024 Register LoadFull =
MRI.createVirtualRegister(&Mips::GPR32RegClass);
5030 .
addImm(Imm + (IsLittle ? 0 : 3))
5035 .
addImm(Imm + (IsLittle ? 3 : 0))
5040 MI.eraseFromParent();
5049 const bool IsLittle =
Subtarget.isLittle();
5054 unsigned Imm =
MI.getOperand(2).getImm();
5061 Register Temp =
MRI.createVirtualRegister(&Mips::GPR64RegClass);
5068 Register Wtemp =
MRI.createVirtualRegister(&Mips::MSA128WRegClass);
5069 Register Lo =
MRI.createVirtualRegister(&Mips::GPR32RegClass);
5070 Register Hi =
MRI.createVirtualRegister(&Mips::GPR32RegClass);
5074 .
addImm(Imm + (IsLittle ? 0 : 4));
5078 .
addImm(Imm + (IsLittle ? 4 : 0));
5088 Register LoHalf =
MRI.createVirtualRegister(&Mips::GPR32RegClass);
5089 Register LoFull =
MRI.createVirtualRegister(&Mips::GPR32RegClass);
5090 Register LoUndef =
MRI.createVirtualRegister(&Mips::GPR32RegClass);
5091 Register HiHalf =
MRI.createVirtualRegister(&Mips::GPR32RegClass);
5092 Register HiFull =
MRI.createVirtualRegister(&Mips::GPR32RegClass);
5093 Register HiUndef =
MRI.createVirtualRegister(&Mips::GPR32RegClass);
5094 Register Wtemp =
MRI.createVirtualRegister(&Mips::MSA128WRegClass);
5099 .
addImm(Imm + (IsLittle ? 0 : 7))
5104 .
addImm(Imm + (IsLittle ? 3 : 4))
5110 .
addImm(Imm + (IsLittle ? 4 : 3))
5115 .
addImm(Imm + (IsLittle ? 7 : 0))
5124 MI.eraseFromParent();
5133 const bool IsLittle =
Subtarget.isLittle();
5136 Register StoreVal =
MI.getOperand(0).getReg();
5138 unsigned Imm =
MI.getOperand(2).getImm();
5144 Register BitcastW =
MRI.createVirtualRegister(&Mips::MSA128WRegClass);
5145 Register Tmp =
MRI.createVirtualRegister(&Mips::GPR32RegClass);
5158 Register Tmp =
MRI.createVirtualRegister(&Mips::GPR32RegClass);
5166 .
addImm(Imm + (IsLittle ? 0 : 3));
5170 .
addImm(Imm + (IsLittle ? 3 : 0));
5173 MI.eraseFromParent();
5183 const bool IsLittle =
Subtarget.isLittle();
5186 Register StoreVal =
MI.getOperand(0).getReg();
5188 unsigned Imm =
MI.getOperand(2).getImm();
5195 Register BitcastD =
MRI.createVirtualRegister(&Mips::MSA128DRegClass);
5196 Register Lo =
MRI.createVirtualRegister(&Mips::GPR64RegClass);
5209 Register BitcastW =
MRI.createVirtualRegister(&Mips::MSA128WRegClass);
5210 Register Lo =
MRI.createVirtualRegister(&Mips::GPR32RegClass);
5211 Register Hi =
MRI.createVirtualRegister(&Mips::GPR32RegClass);
5226 .
addImm(Imm + (IsLittle ? 0 : 4));
5230 .
addImm(Imm + (IsLittle ? 4 : 0));
5236 Register Lo =
MRI.createVirtualRegister(&Mips::GPR32RegClass);
5237 Register Hi =
MRI.createVirtualRegister(&Mips::GPR32RegClass);
5250 .
addImm(Imm + (IsLittle ? 0 : 3));
5254 .
addImm(Imm + (IsLittle ? 3 : 0));
5258 .
addImm(Imm + (IsLittle ? 4 : 7));
5262 .
addImm(Imm + (IsLittle ? 7 : 4));
5265 MI.eraseFromParent();
unsigned const MachineRegisterInfo * MRI
static SDValue performSHLCombine(SDNode *N, TargetLowering::DAGCombinerInfo &DCI, SelectionDAG &DAG)
If the operand is a bitwise AND with a constant RHS, and the shift has a constant RHS and is the only...
static SDValue performORCombine(SDNode *N, TargetLowering::DAGCombinerInfo &DCI)
static SDValue performANDCombine(SDNode *N, TargetLowering::DAGCombinerInfo &DCI)
assert(UImm &&(UImm !=~static_cast< T >(0)) &&"Invalid immediate!")
This file declares a class to represent arbitrary precision floating point values and provide a varie...
MachineBasicBlock MachineBasicBlock::iterator DebugLoc DL
Function Alias Analysis Results
static GCRegistry::Add< CoreCLRGC > E("coreclr", "CoreCLR-compatible GC")
static GCRegistry::Add< OcamlGC > B("ocaml", "ocaml 3.10-compatible GC")
This file contains the declarations for the subclasses of Constant, which represent the different fla...
const HexagonInstrInfo * TII
Module.h This file contains the declarations for the Module class.
const AbstractManglingParser< Derived, Alloc >::OperatorInfo AbstractManglingParser< Derived, Alloc >::Ops[]
static MachineBasicBlock * insertDivByZeroTrap(MachineInstr &MI, MachineBasicBlock *MBB)
Register const TargetRegisterInfo * TRI
Promote Memory to Register
cl::opt< bool > EmitJalrReloc
cl::opt< bool > NoZeroDivCheck
static bool CC_Mips(unsigned ValNo, MVT ValVT, MVT LocVT, CCValAssign::LocInfo LocInfo, ISD::ArgFlagsTy ArgFlags, Type *OrigTy, CCState &State)
static bool CC_MipsO32_FP64(unsigned ValNo, MVT ValVT, MVT LocVT, CCValAssign::LocInfo LocInfo, ISD::ArgFlagsTy ArgFlags, Type *OrigTy, CCState &State)
static bool CC_MipsO32_FP32(unsigned ValNo, MVT ValVT, MVT LocVT, CCValAssign::LocInfo LocInfo, ISD::ArgFlagsTy ArgFlags, Type *OrigTy, CCState &State)
static SDValue performMADD_MSUBCombine(SDNode *ROOTNode, SelectionDAG &CurDAG, const MipsSubtarget &Subtarget)
static bool invertFPCondCodeUser(Mips::CondCode CC)
This function returns true if the floating point conditional branches and conditional moves which use...
static bool CC_MipsO32(unsigned ValNo, MVT ValVT, MVT LocVT, CCValAssign::LocInfo LocInfo, ISD::ArgFlagsTy ArgFlags, Type *OrigTy, CCState &State, ArrayRef< MCPhysReg > F64Regs)
static SDValue lowerFP_TO_SINT_STORE(StoreSDNode *SD, SelectionDAG &DAG, bool SingleFloat)
static SDValue performDivRemCombine(SDNode *N, SelectionDAG &DAG, TargetLowering::DAGCombinerInfo &DCI, const MipsSubtarget &Subtarget)
static const MCPhysReg Mips64DPRegs[8]
static SDValue lowerUnalignedIntStore(StoreSDNode *SD, SelectionDAG &DAG, bool IsLittle)
static SDValue createStoreLR(unsigned Opc, SelectionDAG &DAG, StoreSDNode *SD, SDValue Chain, unsigned Offset)
static unsigned addLiveIn(MachineFunction &MF, unsigned PReg, const TargetRegisterClass *RC)
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...
static SDValue createLoadLR(unsigned Opc, SelectionDAG &DAG, LoadSDNode *LD, SDValue Chain, SDValue Src, unsigned Offset)
static SDValue lowerFCOPYSIGN64(SDValue Op, SelectionDAG &DAG, bool HasExtractInsert)
static SDValue performADDCombine(SDNode *N, SelectionDAG &DAG, TargetLowering::DAGCombinerInfo &DCI, const MipsSubtarget &Subtarget)
static SDValue performSUBCombine(SDNode *N, SelectionDAG &DAG, TargetLowering::DAGCombinerInfo &DCI, const MipsSubtarget &Subtarget)
static SDValue createFPCmp(SelectionDAG &DAG, const SDValue &Op)
static SDValue lowerFCOPYSIGN32(SDValue Op, SelectionDAG &DAG, bool HasExtractInsert)
static SDValue performSELECTCombine(SDNode *N, SelectionDAG &DAG, TargetLowering::DAGCombinerInfo &DCI, const MipsSubtarget &Subtarget)
static SDValue performSignExtendCombine(SDNode *N, SelectionDAG &DAG, TargetLowering::DAGCombinerInfo &DCI, const MipsSubtarget &Subtarget)
static SDValue performCMovFPCombine(SDNode *N, SelectionDAG &DAG, TargetLowering::DAGCombinerInfo &DCI, const MipsSubtarget &Subtarget)
static SDValue UnpackFromArgumentSlot(SDValue Val, const CCValAssign &VA, EVT ArgVT, const SDLoc &DL, SelectionDAG &DAG)
static Mips::CondCode condCodeToFCC(ISD::CondCode CC)
static SDValue createCMovFP(SelectionDAG &DAG, SDValue Cond, SDValue True, SDValue False, const SDLoc &DL)
static cl::opt< bool > UseMipsTailCalls("mips-tail-calls", cl::Hidden, cl::desc("MIPS: permit tail calls."), cl::init(false))
uint64_t IntrinsicInst * II
const SmallVectorImpl< MachineOperand > & Cond
SI optimize exec mask operations pre RA
static bool contains(SmallPtrSetImpl< ConstantExpr * > &Cache, ConstantExpr *Expr, Constant *C)
This file defines the SmallVector class.
static const MCPhysReg IntRegs[32]
This file defines the 'Statistic' class, which is designed to be an easy way to expose various metric...
#define STATISTIC(VARNAME, DESC)
This file implements the StringSwitch template, which mimics a switch() statement whose cases are str...
static TableGen::Emitter::Opt Y("gen-skeleton-entry", EmitSkeleton, "Generate example skeleton entry")
static TableGen::Emitter::OptClass< SkeletonEmitter > X("gen-skeleton-class", "Generate example skeleton class")
static const MCPhysReg F32Regs[64]
This class represents an incoming formal argument to a Function.
ArrayRef - Represent a constant reference to an array (0 or more elements consecutively in memory),...
size_t size() const
size - Get the array size.
LLVM Basic Block Representation.
static BranchProbability getOne()
CCState - This class holds information needed while lowering arguments and return values.
unsigned getFirstUnallocated(ArrayRef< MCPhysReg > Regs) const
getFirstUnallocated - Return the index of the first unallocated register in the set,...
CallingConv::ID getCallingConv() const
uint64_t getStackSize() const
Returns the size of the currently allocated portion of the stack.
CCValAssign - Represent assignment of one arg/retval to a location.
Register getLocReg() const
LocInfo getLocInfo() const
static CCValAssign getReg(unsigned ValNo, MVT ValVT, MCRegister Reg, MVT LocVT, LocInfo HTP, bool IsCustom=false)
static CCValAssign getCustomReg(unsigned ValNo, MVT ValVT, MCRegister Reg, MVT LocVT, LocInfo HTP)
bool isUpperBitsInLoc() const
static CCValAssign getMem(unsigned ValNo, MVT ValVT, int64_t Offset, MVT LocVT, LocInfo HTP, bool IsCustom=false)
int64_t getLocMemOffset() const
Base class for all callable instructions (InvokeInst and CallInst) Holds everything related to callin...
LLVM_ABI bool isMustTailCall() const
Tests if this call site must be tail call optimized.
uint64_t getZExtValue() const
int64_t getSExtValue() const
A parsed version of the target data layout string in and methods for querying it.
LLVM_ABI TypeSize getTypeAllocSize(Type *Ty) const
Returns the offset in bytes between successive objects of the specified type, including alignment pad...
const char * getSymbol() const
This is a fast-path instruction selection class that generates poor code and doesn't support illegal ...
FunctionLoweringInfo - This contains information that is global to a function that is used when lower...
bool hasStructRetAttr() const
Determine if the function returns a structure through first or second pointer argument.
const Argument * const_arg_iterator
bool hasFnAttribute(Attribute::AttrKind Kind) const
Return true if the function has the attribute.
const GlobalValue * getGlobal() const
bool hasLocalLinkage() const
bool hasPrivateLinkage() const
bool hasHiddenVisibility() const
bool hasDLLImportStorageClass() const
bool isDeclarationForLinker() const
LLVM_ABI const GlobalObject * getAliaseeObject() const
bool hasInternalLinkage() const
bool hasProtectedVisibility() const
This is an important class for using LLVM in a threaded context.
LLVM_ABI void emitError(const Instruction *I, const Twine &ErrorStr)
emitError - Emit an error message to the currently installed error handler with optional location inf...
Tracks which library functions to use for a particular subtarget.
This class is used to represent ISD::LOAD nodes.
const MCRegisterInfo * getRegisterInfo() const
LLVM_ABI MCSymbol * getOrCreateSymbol(const Twine &Name)
Lookup the symbol inside with the specified Name.
MCRegisterClass - Base class of TargetRegisterClass.
MCRegister getRegister(unsigned i) const
getRegister - Return the specified register in the class.
MCRegisterInfo base class - We assume that the target defines a static array of MCRegisterDesc object...
Wrapper class representing physical registers. Should be passed by value.
MCSymbol - Instances of this class represent a symbol name in the MC file, and MCSymbols are created ...
static auto integer_valuetypes()
TypeSize getSizeInBits() const
Returns the size of the specified MVT in bits.
TypeSize getStoreSize() const
Return the number of bytes overwritten by a store of the specified value type.
static MVT getVectorVT(MVT VT, unsigned NumElements)
bool isFloatingPoint() const
Return true if this is a FP or a vector FP type.
bool isValid() const
Return true if this is a valid simple valuetype.
static MVT getIntegerVT(unsigned BitWidth)
static auto fp_valuetypes()
static auto fp_fixedlen_vector_valuetypes()
LLVM_ABI void transferSuccessorsAndUpdatePHIs(MachineBasicBlock *FromMBB)
Transfers all the successors, as in transferSuccessors, and update PHI operands in the successor bloc...
LLVM_ABI instr_iterator insert(instr_iterator I, MachineInstr *M)
Insert MI into the instruction list before I, possibly inside a bundle.
const BasicBlock * getBasicBlock() const
Return the LLVM basic block that this instance corresponded to originally.
LLVM_ABI void addSuccessor(MachineBasicBlock *Succ, BranchProbability Prob=BranchProbability::getUnknown())
Add Succ as a successor of this MachineBasicBlock.
const MachineFunction * getParent() const
Return the MachineFunction containing this basic block.
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 '...
MachineInstrBundleIterator< MachineInstr > iterator
The MachineFrameInfo class represents an abstract stack frame until prolog/epilog code is inserted.
LLVM_ABI int CreateFixedObject(uint64_t Size, int64_t SPOffset, bool IsImmutable, bool isAliased=false)
Create a new object at a fixed location on the stack.
void setFrameAddressIsTaken(bool T)
void setHasTailCall(bool V=true)
void setReturnAddressIsTaken(bool s)
MachineFrameInfo & getFrameInfo()
getFrameInfo - Return the frame info object for the current function.
MCContext & getContext() const
MachineRegisterInfo & getRegInfo()
getRegInfo - Return information about the registers currently in use.
const DataLayout & getDataLayout() const
Return the DataLayout attached to the Module associated to this MF.
Function & getFunction()
Return the LLVM function that this machine code represents.
BasicBlockListType::iterator iterator
Ty * getInfo()
getInfo - Keep track of various per-function pieces of information for backends that would like to do...
Register addLiveIn(MCRegister PReg, const TargetRegisterClass *RC)
addLiveIn - Add the specified physical register as a live-in value and create a corresponding virtual...
MachineBasicBlock * CreateMachineBasicBlock(const BasicBlock *BB=nullptr, std::optional< UniqueBBID > BBID=std::nullopt)
CreateMachineInstr - Allocate a new MachineInstr.
void insert(iterator MBBI, MachineBasicBlock *MBB)
const TargetMachine & getTarget() const
getTarget - Return the target machine this machine code is compiled with
const MachineInstrBuilder & addUse(Register RegNo, RegState Flags={}, unsigned SubReg=0) const
Add a virtual register use operand.
const MachineInstrBuilder & addReg(Register RegNo, RegState Flags={}, unsigned SubReg=0) const
Add a new virtual register operand.
const MachineInstrBuilder & addImm(int64_t Val) const
Add a new immediate operand.
const MachineInstrBuilder & addMBB(MachineBasicBlock *MBB, unsigned TargetFlags=0) const
const MachineInstrBuilder & addDef(Register RegNo, RegState Flags={}, unsigned SubReg=0) const
Add a virtual register definition operand.
Representation of each machine instruction.
const MachineOperand & getOperand(unsigned i) const
@ EK_GPRel32BlockAddress
EK_GPRel32BlockAddress - Each entry is an address of block, encoded with a relocation as gp-relative,...
@ EK_BlockAddress
EK_BlockAddress - Each entry is a plain address of block, e.g.: .word LBB123.
@ EK_GPRel64BlockAddress
EK_GPRel64BlockAddress - Each entry is an address of block, encoded with a relocation as gp-relative,...
@ MOVolatile
The memory access is volatile.
Flags getFlags() const
Return the raw flags of the source value,.
MachineOperand class - Representation of each machine instruction operand.
void setSubReg(unsigned subReg)
static MachineOperand CreateMCSymbol(MCSymbol *Sym, unsigned TargetFlags=0)
void setIsKill(bool Val=true)
Register getReg() const
getReg - Returns the register number.
MachineRegisterInfo - Keep track of information for virtual and physical registers,...
LLVM_ABI Register createVirtualRegister(const TargetRegisterClass *RegClass, StringRef Name="")
createVirtualRegister - Create and return a new virtual register in the function with the specified r...
void addLiveIn(MCRegister Reg, Register vreg=Register())
addLiveIn - Add the specified register as a live-in.
MachineMemOperand * getMemOperand() const
Return the unique MachineMemOperand object describing the memory reference performed by operation.
const MachinePointerInfo & getPointerInfo() const
const SDValue & getChain() const
EVT getMemoryVT() const
Return the type of the in-memory value.
static SpecialCallingConvType getSpecialCallingConvForCallee(const SDNode *Callee, const MipsSubtarget &Subtarget)
Determine the SpecialCallingConvType for the given callee.
MipsFunctionInfo - This class is derived from MachineFunction private Mips target-specific informatio...
void setVarArgsFrameIndex(int Index)
unsigned getSRetReturnReg() const
int getVarArgsFrameIndex() const
MachinePointerInfo callPtrInfo(MachineFunction &MF, const char *ES)
Create a MachinePointerInfo that has an ExternalSymbolPseudoSourceValue object representing a GOT ent...
Register getGlobalBaseReg(MachineFunction &MF)
void setSRetReturnReg(unsigned Reg)
void setFormalArgInfo(unsigned Size, bool HasByval)
static const uint32_t * getMips16RetHelperMask()
const MipsInstrInfo * getInstrInfo() const override
bool inMips16Mode() const
const MipsRegisterInfo * getRegisterInfo() const override
bool hasExtractInsert() const
Features related to the presence of specific instructions.
bool isSingleFloat() const
const TargetFrameLowering * getFrameLowering() const override
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...
bool hasBitTest(SDValue X, SDValue Y) const override
Return true if the target has a bit-test instruction: (X & (1 << Y)) ==/!= 0 This knowledge can be us...
static const MipsTargetLowering * create(const MipsTargetMachine &TM, const MipsSubtarget &STI)
SDValue getAddrGPRel(NodeTy *N, const SDLoc &DL, EVT Ty, SelectionDAG &DAG, bool IsN64) const
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.
Register getRegisterByName(const char *RegName, LLT VT, const MachineFunction &MF) const override
Return the register ID of the name passed in.
SDValue getAddrNonPICSym64(NodeTy *N, const SDLoc &DL, EVT Ty, SelectionDAG &DAG) const
EVT getSetCCResultType(const DataLayout &DL, LLVMContext &Context, EVT VT) const override
getSetCCResultType - get the ISD::SETCC result ValueType
SDValue getAddrGlobal(NodeTy *N, const SDLoc &DL, EVT Ty, SelectionDAG &DAG, unsigned Flag, SDValue Chain, const MachinePointerInfo &PtrInfo) const
MipsTargetLowering(const MipsTargetMachine &TM, const MipsSubtarget &STI)
SDValue getAddrGlobalLargeGOT(NodeTy *N, const SDLoc &DL, EVT Ty, SelectionDAG &DAG, unsigned HiFlag, unsigned LoFlag, SDValue Chain, const MachinePointerInfo &PtrInfo) const
SDValue getDllimportVariable(NodeTy *N, const SDLoc &DL, EVT Ty, SelectionDAG &DAG, SDValue Chain, const MachinePointerInfo &PtrInfo) const
bool shouldFoldConstantShiftPairToMask(const SDNode *N) const override
Return true if it is profitable to fold a pair of shifts into a mask.
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...
CCAssignFn * CCAssignFnForReturn() 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...
MachineBasicBlock * EmitInstrWithCustomInserter(MachineInstr &MI, MachineBasicBlock *MBB) const override
This method should be implemented by targets that mark instructions with the 'usesCustomInserter' fla...
SDValue getDllimportSymbol(NodeTy *N, const SDLoc &DL, EVT Ty, SelectionDAG &DAG) const
CCAssignFn * CCAssignFnForCall() const
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 getAddrNonPIC(NodeTy *N, const SDLoc &DL, EVT Ty, SelectionDAG &DAG) const
SDValue lowerSTORE(SDValue Op, SelectionDAG &DAG) const
FastISel * createFastISel(FunctionLoweringInfo &funcInfo, const TargetLibraryInfo *libInfo, const LibcallLoweringInfo *libcallLowering) const override
createFastISel - This method returns a target specific FastISel object, or null if the target does no...
void AdjustInstrPostInstrSelection(MachineInstr &MI, SDNode *Node) const override
This method should be implemented by targets that mark instructions with the 'hasPostISelHook' flag.
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...
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.
bool isCheapToSpeculateCtlz(Type *Ty) const override
Return true if it is cheap to speculate a call to intrinsic ctlz.
SDValue LowerOperation(SDValue Op, SelectionDAG &DAG) const override
LowerOperation - Provide custom lowering hooks for some operations.
bool isCheapToSpeculateCttz(Type *Ty) const override
Return true if it is cheap to speculate a call to intrinsic cttz.
SDValue getAddrLocal(NodeTy *N, const SDLoc &DL, EVT Ty, SelectionDAG &DAG, bool IsN32OrN64) const
SDValue getGlobalReg(SelectionDAG &DAG, EVT Ty) const
const MipsSubtarget & Subtarget
void HandleByVal(CCState *, unsigned &, Align) const override
Target-specific cleanup for formal ByVal parameters.
SDValue lowerLOAD(SDValue Op, SelectionDAG &DAG) const
bool IsConstantInSmallSection(const DataLayout &DL, const Constant *CN, const TargetMachine &TM) const
Return true if this constant should be placed into small data section.
Wrapper class representing virtual and physical registers.
Wrapper class for IR location info (IR ordering and DebugLoc) to be passed into SDNode creation funct...
Represents one node in the SelectionDAG.
unsigned getOpcode() const
Return the SelectionDAG opcode value for this node.
uint64_t getAsZExtVal() const
Helper method returns the zero-extended integer value of a ConstantSDNode.
const SDValue & getOperand(unsigned Num) const
EVT getValueType(unsigned ResNo) const
Return the type of a specified result.
Unlike LLVM values, Selection DAG nodes may return multiple values as the result of a computation.
SDNode * getNode() const
get the SDNode which holds the desired result
bool hasOneUse() const
Return true if there is exactly one node using value ResNo of Node.
SDValue getValue(unsigned R) const
EVT getValueType() const
Return the ValueType of the referenced return value.
TypeSize getValueSizeInBits() const
Returns the size of the value in bits.
const SDValue & getOperand(unsigned i) const
unsigned getOpcode() const
This is used to represent a portion of an LLVM function in a low-level Data Dependence DAG representa...
LLVM_ABI SDValue getExtLoad(ISD::LoadExtType ExtType, const SDLoc &dl, EVT VT, SDValue Chain, SDValue Ptr, MachinePointerInfo PtrInfo, EVT MemVT, MaybeAlign Alignment=MaybeAlign(), MachineMemOperand::Flags MMOFlags=MachineMemOperand::MONone, const AAMDNodes &AAInfo=AAMDNodes())
SDValue getTargetGlobalAddress(const GlobalValue *GV, const SDLoc &DL, EVT VT, int64_t offset=0, unsigned TargetFlags=0)
SDValue getCopyToReg(SDValue Chain, const SDLoc &dl, Register Reg, SDValue N)
LLVM_ABI SDValue getMergeValues(ArrayRef< SDValue > Ops, const SDLoc &dl)
Create a MERGE_VALUES node from the given operands.
LLVM_ABI SDVTList getVTList(EVT VT)
Return an SDVTList that represents the list of values specified.
LLVM_ABI MachineSDNode * getMachineNode(unsigned Opcode, const SDLoc &dl, EVT VT)
These are used for target selectors to create a new node with specified return type(s),...
LLVM_ABI SDValue getRegister(Register Reg, EVT VT)
LLVM_ABI SDValue getLoad(EVT VT, const SDLoc &dl, SDValue Chain, SDValue Ptr, MachinePointerInfo PtrInfo, MaybeAlign Alignment=MaybeAlign(), 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 getGLOBAL_OFFSET_TABLE(EVT VT)
Return a GLOBAL_OFFSET_TABLE node. This does not have a useful SDLoc.
LLVM_ABI SDValue getMemIntrinsicNode(unsigned Opcode, const SDLoc &dl, SDVTList VTList, ArrayRef< SDValue > Ops, EVT MemVT, MachinePointerInfo PtrInfo, Align Alignment, MachineMemOperand::Flags Flags=MachineMemOperand::MOLoad|MachineMemOperand::MOStore, LocationSize Size=LocationSize::precise(0), const AAMDNodes &AAInfo=AAMDNodes())
Creates a MemIntrinsicNode that may produce a result and takes a list of operands.
SDValue getSetCC(const SDLoc &DL, EVT VT, SDValue LHS, SDValue RHS, ISD::CondCode Cond, SDValue Chain=SDValue(), bool IsSignaling=false, SDNodeFlags Flags={})
Helper function to make it easier to build SetCC's if you just have an ISD::CondCode instead of an SD...
LLVM_ABI SDValue getMemcpy(SDValue Chain, const SDLoc &dl, SDValue Dst, SDValue Src, SDValue Size, Align Alignment, bool isVol, bool AlwaysInline, const CallInst *CI, std::optional< bool > OverrideTailCall, MachinePointerInfo DstPtrInfo, MachinePointerInfo SrcPtrInfo, const AAMDNodes &AAInfo=AAMDNodes(), BatchAAResults *BatchAA=nullptr)
SDValue getTargetJumpTable(int JTI, EVT VT, unsigned TargetFlags=0)
SDValue getUNDEF(EVT VT)
Return an UNDEF node. UNDEF does not have a useful SDLoc.
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).
SDValue getCopyFromReg(SDValue Chain, const SDLoc &dl, Register Reg, EVT VT)
const DataLayout & getDataLayout() const
LLVM_ABI SDValue getConstant(uint64_t Val, const SDLoc &DL, EVT VT, bool isTarget=false, bool isOpaque=false)
Create a ConstantSDNode wrapping a constant value.
SDValue getSignedTargetConstant(int64_t Val, const SDLoc &DL, EVT VT, bool isOpaque=false)
LLVM_ABI SDValue getStore(SDValue Chain, const SDLoc &dl, SDValue Val, SDValue Ptr, MachinePointerInfo PtrInfo, Align Alignment, MachineMemOperand::Flags MMOFlags=MachineMemOperand::MONone, const AAMDNodes &AAInfo=AAMDNodes())
Helper function to build ISD::STORE nodes.
LLVM_ABI SDValue getSignedConstant(int64_t Val, const SDLoc &DL, EVT VT, bool isTarget=false, bool isOpaque=false)
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 ...
SDValue getSelectCC(const SDLoc &DL, SDValue LHS, SDValue RHS, SDValue True, SDValue False, ISD::CondCode Cond, SDNodeFlags Flags=SDNodeFlags())
Helper function to make it easier to build SelectCC's if you just have an ISD::CondCode instead of an...
LLVM_ABI SDValue getExternalSymbol(const char *Sym, EVT VT)
const TargetMachine & getTarget() const
LLVM_ABI SDValue getIntPtrConstant(uint64_t Val, const SDLoc &DL, bool isTarget=false)
LLVM_ABI SDValue getValueType(EVT)
LLVM_ABI SDValue getNode(unsigned Opcode, const SDLoc &DL, EVT VT, ArrayRef< SDUse > Ops)
Gets or creates the specified node.
LLVM_ABI bool isKnownNeverNaN(SDValue Op, const APInt &DemandedElts, bool SNaN=false, unsigned Depth=0) const
Test whether the given SDValue (or all elements of it, if it is a vector) is known to never be NaN in...
SDValue getTargetConstant(uint64_t Val, const SDLoc &DL, EVT VT, bool isOpaque=false)
SDValue getTargetBlockAddress(const BlockAddress *BA, EVT VT, int64_t Offset=0, unsigned TargetFlags=0)
LLVM_ABI void ReplaceAllUsesOfValueWith(SDValue From, SDValue To)
Replace any uses of From with To, leaving uses of other values produced by From.getNode() alone.
MachineFunction & getMachineFunction() const
LLVM_ABI SDValue getFrameIndex(int FI, EVT VT, bool isTarget=false)
LLVM_ABI SDValue getRegisterMask(const uint32_t *RegMask)
void addCallSiteInfo(const SDNode *Node, CallSiteInfo &&CallInfo)
Set CallSiteInfo to be associated with Node.
LLVMContext * getContext() const
LLVM_ABI SDValue getTargetExternalSymbol(const char *Sym, EVT VT, unsigned TargetFlags=0)
SDValue getTargetConstantPool(const Constant *C, EVT VT, MaybeAlign Align=std::nullopt, int Offset=0, unsigned TargetFlags=0)
SDValue getEntryNode() const
Return the token chain corresponding to the entry of the function.
LLVM_ABI std::pair< SDValue, SDValue > SplitScalar(const SDValue &N, const SDLoc &DL, const EVT &LoVT, const EVT &HiVT)
Split the scalar node with EXTRACT_ELEMENT using the provided VTs and return the low/high part.
This class consists of common code factored out of the SmallVector class to reduce code duplication b...
void push_back(const T &Elt)
This is a 'vector' (really, a variable-sized array), optimized for the case when the array is small.
This class is used to represent ISD::STORE nodes.
const SDValue & getBasePtr() const
const SDValue & getValue() const
bool isTruncatingStore() const
Return true if the op does a truncation before store.
StringRef - Represent a constant reference to a string, i.e.
constexpr StringRef substr(size_t Start, size_t N=npos) const
Return a reference to the substring from [Start, Start + N).
constexpr bool empty() const
empty - Check if the string is empty.
const char * const_iterator
constexpr size_t size() const
size - Get the string size.
LLVM_ABI std::string lower() const
A switch()-like statement whose cases are string literals.
StringSwitch & Case(StringLiteral S, T Value)
Information about stack frame layout on the target.
unsigned getStackAlignment() const
getStackAlignment - This method returns the number of bytes to which the stack pointer must be aligne...
Align getStackAlign() const
getStackAlignment - This method returns the number of bytes to which the stack pointer must be aligne...
TargetInstrInfo - Interface to description of machine instruction set.
Provides information about what library functions are available for the current target.
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...
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...
virtual const TargetRegisterClass * getRegClassFor(MVT VT, bool isDivergent=false) const
Return the register class that should be used for the specified value type.
void setMinStackArgumentAlignment(Align Alignment)
Set the minimum stack alignment of an argument.
const TargetMachine & getTargetMachine() const
virtual unsigned getNumRegisters(LLVMContext &Context, EVT VT, std::optional< MVT > RegisterVT=std::nullopt) const
Return the number of registers that this ValueType will eventually require.
void setMaxAtomicSizeInBitsSupported(unsigned SizeInBits)
Set the maximum atomic operation size supported by the backend.
void setMinFunctionAlignment(Align Alignment)
Set the target's minimum function alignment.
void setBooleanContents(BooleanContent Ty)
Specify how the target extends the result of integer and floating point boolean values from i1 to a w...
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...
void setTruncStoreAction(MVT ValVT, MVT MemVT, LegalizeAction Action)
Indicate that the specified truncating store does not work with the specified type and indicate what ...
@ ZeroOrOneBooleanContent
@ ZeroOrNegativeOneBooleanContent
void setStackPointerRegisterToSaveRestore(Register R)
If set to a physical register, this specifies the register that llvm.savestack/llvm....
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/...
void setTargetDAGCombine(ArrayRef< ISD::NodeType > NTs)
Targets should invoke this method for each target independent node that they want to provide a custom...
virtual bool useSoftFloat() const
Align getMinStackArgumentAlignment() const
Return the minimum stack alignment of an argument.
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...
std::vector< ArgListEntry > ArgListTy
unsigned MaxStoresPerMemcpy
Specify maximum number of store instructions per memcpy call.
MVT getRegisterType(MVT VT) const
Return the type of registers that this ValueType will eventually require.
virtual ConstraintType getConstraintType(StringRef Constraint) const
Given a constraint, return the type of constraint it is for this target.
virtual SDValue LowerToTLSEmulatedModel(const GlobalAddressSDNode *GA, SelectionDAG &DAG) const
Lower TLS global address SDNode for target independent emulated TLS model.
std::pair< SDValue, SDValue > LowerCallTo(CallLoweringInfo &CLI) const
This function lowers an abstract call to a function into an actual call.
bool isPositionIndependent() const
virtual ConstraintWeight getSingleConstraintMatchWeight(AsmOperandInfo &info, const char *constraint) const
Examine constraint string and operand type and determine a weight value.
virtual std::pair< unsigned, const TargetRegisterClass * > getRegForInlineAsmConstraint(const TargetRegisterInfo *TRI, StringRef Constraint, MVT VT) const
Given a physical register constraint (e.g.
TargetLowering(const TargetLowering &)=delete
virtual ArrayRef< MCPhysReg > getRoundingControlRegisters() const
Returns a 0 terminated array of rounding control registers that can be attached into strict FP call.
virtual void LowerAsmOperandForConstraint(SDValue Op, StringRef Constraint, std::vector< SDValue > &Ops, SelectionDAG &DAG) const
Lower the specified operand into the Ops vector.
virtual unsigned getJumpTableEncoding() const
Return the entry encoding for a jump table in the current function.
virtual void LowerOperationWrapper(SDNode *N, SmallVectorImpl< SDValue > &Results, SelectionDAG &DAG) const
This callback is invoked by the type legalizer to legalize nodes with an illegal operand type but leg...
void setTypeIdForCallsiteInfo(const CallBase *CB, MachineFunction &MF, MachineFunction::CallSiteInfo &CSInfo) const
TLSModel::Model getTLSModel(const GlobalValue *GV) const
Returns the TLS model which should be used for the given global variable.
bool useEmulatedTLS() const
Returns true if this target uses emulated TLS.
virtual TargetLoweringObjectFile * getObjFileLowering() const
unsigned EnableFastISel
EnableFastISel - This flag enables fast-path instruction selection which trades away generated code q...
iterator begin() const
begin/end - Return all of the registers in this class.
TargetRegisterInfo base class - We assume that the target defines a static array of TargetRegisterDes...
Twine - A lightweight data structure for efficiently representing the concatenation of temporary valu...
The instances of the Type class are immutable: once they are created, they are never changed.
bool isVectorTy() const
True if this is an instance of VectorType.
bool isFloatTy() const
Return true if this is 'float', a 32-bit IEEE fp type.
LLVM_ABI TypeSize getPrimitiveSizeInBits() const LLVM_READONLY
Return the basic size of this type if it is a primitive type.
bool isIntegerTy() const
True if this is an instance of IntegerType.
static LLVM_ABI IntegerType * getIntNTy(LLVMContext &C, unsigned N)
bool isFPOrFPVectorTy() const
Return true if this is a FP type or a vector of FP.
LLVM Value Representation.
Type * getType() const
All values are typed, get the type of this value.
constexpr ScalarTy getFixedValue() const
self_iterator getIterator()
#define llvm_unreachable(msg)
Marks that the current location is not supposed to be reachable.
constexpr char Align[]
Key for Kernel::Arg::Metadata::mAlign.
constexpr char Args[]
Key for Kernel::Metadata::mArgs.
constexpr std::underlying_type_t< E > Mask()
Get a bitmask with 1s in all places up to the high-order bit of E's largest value.
unsigned ID
LLVM IR allows to use arbitrary numbers as calling convention identifiers.
@ Fast
Attempts to make calls as fast as possible (e.g.
@ C
The default llvm calling convention, compatible with C.
NodeType
ISD::NodeType enum - This enum defines the target-independent operators for a SelectionDAG.
@ SETCC
SetCC operator - This evaluates to a true value iff the condition is true.
@ STACKRESTORE
STACKRESTORE has two operands, an input chain and a pointer to restore to it returns an output chain.
@ STACKSAVE
STACKSAVE - STACKSAVE has one operand, an input chain.
@ STRICT_FSETCC
STRICT_FSETCC/STRICT_FSETCCS - Constrained versions of SETCC, used for floating-point operands only.
@ BSWAP
Byte Swap and Counting operators.
@ VAEND
VAEND, VASTART - VAEND and VASTART have three operands: an input chain, pointer, and a SRCVALUE.
@ ATOMIC_STORE
OUTCHAIN = ATOMIC_STORE(INCHAIN, val, ptr) This corresponds to "store atomic" instruction.
@ ADD
Simple integer binary arithmetic operators.
@ LOAD
LOAD and STORE have token chains as their first operand, then the same operands as an LLVM load/store...
@ ANY_EXTEND
ANY_EXTEND - Used for integer types. The high bits are undefined.
@ FMA
FMA - Perform a * b + c with no intermediate rounding step.
@ FADD
Simple binary floating point operators.
@ ATOMIC_FENCE
OUTCHAIN = ATOMIC_FENCE(INCHAIN, ordering, scope) This corresponds to the fence instruction.
@ SDIVREM
SDIVREM/UDIVREM - Divide two integers and produce both a quotient and remainder result.
@ FP16_TO_FP
FP16_TO_FP, FP_TO_FP16 - These operators are used to perform promotions and truncation for half-preci...
@ BITCAST
BITCAST - This operator converts between integer, vector and FP values, as if the value was stored to...
@ BUILD_PAIR
BUILD_PAIR - This is the opposite of EXTRACT_ELEMENT in some ways.
@ EH_RETURN
OUTCHAIN = EH_RETURN(INCHAIN, OFFSET, HANDLER) - This node represents 'eh_return' gcc dwarf builtin,...
@ SIGN_EXTEND
Conversion operators.
@ FSINCOS
FSINCOS - Compute both fsin and fcos as a single operation.
@ BR_CC
BR_CC - Conditional branch.
@ BR_JT
BR_JT - Jumptable branch.
@ FCANONICALIZE
Returns platform specific canonical encoding of a floating point number.
@ IS_FPCLASS
Performs a check of floating point class property, defined by IEEE-754.
@ SELECT
Select(COND, TRUEVAL, FALSEVAL).
@ ATOMIC_LOAD
Val, OUTCHAIN = ATOMIC_LOAD(INCHAIN, ptr) This corresponds to "load atomic" instruction.
@ VACOPY
VACOPY - VACOPY has 5 operands: an input chain, a destination pointer, a source pointer,...
@ BasicBlock
Various leaf nodes.
@ SHL
Shift and rotation operations.
@ FMINNUM_IEEE
FMINNUM_IEEE/FMAXNUM_IEEE - Perform floating-point minimumNumber or maximumNumber on two values,...
@ ZERO_EXTEND
ZERO_EXTEND - Used for integer types, zeroing the new bits.
@ SELECT_CC
Select with condition operator - This selects between a true value and a false value (ops #2 and #3) ...
@ FMINNUM
FMINNUM/FMAXNUM - Perform floating-point minimum maximum on two values, following IEEE-754 definition...
@ DYNAMIC_STACKALLOC
DYNAMIC_STACKALLOC - Allocate some number of bytes on the stack aligned to a specified boundary.
@ SIGN_EXTEND_INREG
SIGN_EXTEND_INREG - This operator atomically performs a SHL/SRA pair to sign extend a small value in ...
@ EH_DWARF_CFA
EH_DWARF_CFA - This node represents the pointer to the DWARF Canonical Frame Address (CFA),...
@ FRAMEADDR
FRAMEADDR, RETURNADDR - These nodes represent llvm.frameaddress and llvm.returnaddress on the DAG.
@ STRICT_FP_TO_SINT
STRICT_FP_TO_[US]INT - Convert a floating point value to a signed or unsigned integer.
@ FP_TO_SINT
FP_TO_[US]INT - Convert a floating point value to a signed or unsigned integer.
@ READCYCLECOUNTER
READCYCLECOUNTER - This corresponds to the readcyclecounter intrinsic.
@ AND
Bitwise operators - logical and, logical or, logical xor.
@ TRAP
TRAP - Trapping instruction.
@ TokenFactor
TokenFactor - This node takes multiple tokens as input and produces a single token result.
@ TRUNCATE
TRUNCATE - Completely drop the high bits.
@ VAARG
VAARG - VAARG has four operands: an input chain, a pointer, a SRCVALUE, and the alignment.
@ BRCOND
BRCOND - Conditional branch.
@ SHL_PARTS
SHL_PARTS/SRA_PARTS/SRL_PARTS - These operators are used for expanded integer shift operations.
@ AssertSext
AssertSext, AssertZext - These nodes record if a register contains a value that has already been zero...
@ FCOPYSIGN
FCOPYSIGN(X, Y) - Return the value of X with the sign of Y.
@ CALLSEQ_START
CALLSEQ_START/CALLSEQ_END - These operators mark the beginning and end of a call sequence,...
LLVM_ABI CondCode getSetCCInverse(CondCode Operation, EVT Type)
Return the operation corresponding to !(X op Y), where 'op' is a valid SetCC operation.
CondCode
ISD::CondCode enum - These are ordered carefully to make the bitfields below work out,...
LoadExtType
LoadExtType enum - This enum defines the three variants of LOADEXT (load with extension).
@ Bitcast
Perform the operation on a different, but equivalently sized type.
@ MO_TLSGD
On a symbol operand, this indicates that the immediate is the offset to the slot in GOT which stores ...
Flag
These should be considered private to the implementation of the MCInstrDesc class.
FastISel * createFastISel(FunctionLoweringInfo &funcInfo, const TargetLibraryInfo *libInfo, const LibcallLoweringInfo *libcallLowering)
Not(const Pred &P) -> Not< Pred >
initializer< Ty > init(const Ty &Val)
NodeAddr< NodeBase * > Node
NodeAddr< FuncNode * > Func
This is an optimization pass for GlobalISel generic memory operations.
FunctionAddr VTableAddr Value
MachineInstrBuilder BuildMI(MachineFunction &MF, const MIMetadata &MIMD, const MCInstrDesc &MCID)
Builder interface. Specify how to create the initial instruction itself.
constexpr bool isInt(int64_t x)
Checks if an integer fits into the given bit width.
@ Implicit
Not emitted register (e.g. carry, or temporary result).
@ Kill
The last use of a register.
@ Undef
Value of the register doesn't matter.
@ EarlyClobber
Register definition happens before uses.
@ Define
Register definition.
constexpr RegState getKillRegState(bool B)
decltype(auto) dyn_cast(const From &Val)
dyn_cast<X> - Return the argument parameter cast to the specified type.
bool CCAssignFn(unsigned ValNo, MVT ValVT, MVT LocVT, CCValAssign::LocInfo LocInfo, ISD::ArgFlagsTy ArgFlags, Type *OrigTy, CCState &State)
CCAssignFn - This function assigns a location for Val, updating State to reflect the change.
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...
auto dyn_cast_or_null(const Y &Val)
LLVM_ABI raw_ostream & dbgs()
dbgs() - This returns a reference to a raw_ostream for debugging messages.
LLVM_ABI void report_fatal_error(Error Err, bool gen_crash_diag=true)
constexpr bool isUInt(uint64_t x)
Checks if an unsigned integer fits into the given bit width.
class LLVM_GSL_OWNER SmallVector
Forward declaration of SmallVector so that calculateSmallVectorDefaultInlinedElements can reference s...
bool isa(const From &Val)
isa<X> - Return true if the parameter to the template is an instance of one of the template type argu...
constexpr T divideCeil(U Numerator, V Denominator)
Returns the integer ceil(Numerator / Denominator).
const MipsTargetLowering * createMips16TargetLowering(const MipsTargetMachine &TM, const MipsSubtarget &STI)
Create MipsTargetLowering objects.
@ Or
Bitwise or logical OR of integers.
uint16_t MCPhysReg
An unsigned integer type large enough to represent all physical registers, but not necessarily virtua...
uint64_t alignTo(uint64_t Size, Align A)
Returns a multiple of A needed to store Size bytes.
DWARFExpression::Operation Op
ArrayRef(const T &OneElt) -> ArrayRef< T >
decltype(auto) cast(const From &Val)
cast<X> - Return the argument parameter cast to the specified type.
const MipsTargetLowering * createMipsSETargetLowering(const MipsTargetMachine &TM, const MipsSubtarget &STI)
LLVM_ABI bool getAsUnsignedInteger(StringRef Str, unsigned Radix, unsigned long long &Result)
Helper functions for StringRef::getAsInteger.
void swap(llvm::BitVector &LHS, llvm::BitVector &RHS)
Implement std::swap in terms of BitVector swap.
This struct is a compact representation of a valid (non-zero power of two) alignment.
constexpr uint64_t value() const
This is a hole in the type system and should not be abused.
EVT changeVectorElementTypeToInteger() const
Return a vector with the same number of elements as this vector, but with the element type converted ...
bool bitsLT(EVT VT) const
Return true if this has less bits than VT.
TypeSize getSizeInBits() const
Return the size of the specified value type in bits.
bool isPow2VectorType() const
Returns true if the given vector is a power of 2.
MVT getSimpleVT() const
Return the SimpleValueType held in the specified simple EVT.
static EVT getFloatingPointVT(unsigned BitWidth)
Returns the EVT that represents a floating-point type with the given number of bits.
bool isVector() const
Return true if this is a vector value type.
LLVM_ABI Type * getTypeForEVT(LLVMContext &Context) const
This method returns an LLVM type corresponding to the specified EVT.
bool isRound() const
Return true if the size is a power-of-two number of bytes.
EVT getVectorElementType() const
Given a vector type, return the type of each element.
unsigned getVectorNumElements() const
Given a vector type, return the number of elements it contains.
bool isInteger() const
Return true if this is an integer or a vector integer type.
Align getNonZeroOrigAlign() const
SmallVector< ArgRegPair, 1 > ArgRegPairs
Vector of call argument and its forwarding register.
This class contains a discriminated union of information about pointers in memory operands,...
static LLVM_ABI MachinePointerInfo getGOT(MachineFunction &MF)
Return a MachinePointerInfo record that refers to a GOT entry.
static LLVM_ABI MachinePointerInfo getFixedStack(MachineFunction &MF, int FI, int64_t Offset=0)
Return a MachinePointerInfo record that refers to the specified FrameIndex.
This struct is a compact representation of a valid (power of two) or undefined (0) alignment.
This represents a list of ValueType's that has been intern'd by a SelectionDAG.
This structure contains all information that is necessary for lowering calls.
SmallVector< ISD::InputArg, 32 > Ins
SmallVector< ISD::OutputArg, 32 > Outs
SmallVector< SDValue, 32 > OutVals
bool isBeforeLegalizeOps() const