80#define DEBUG_TYPE "mips-lower"
86 cl::desc(
"MIPS: Don't trap on integer division by zero."),
92 Mips::D12_64, Mips::D13_64, Mips::D14_64, Mips::D15_64,
93 Mips::D16_64, Mips::D17_64, Mips::D18_64, Mips::D19_64
124 unsigned &NumIntermediates,
MVT &RegisterVT)
const {
129 return NumIntermediates;
145 unsigned Flag)
const {
151 unsigned Flag)
const {
157 unsigned Flag)
const {
163 unsigned Flag)
const {
169 unsigned Flag)
const {
171 N->getOffset(), Flag);
555 isMicroMips =
Subtarget.inMicroMipsMode();
581 if (!TM.isPositionIndependent() || !TM.getABI().IsO32() ||
601 EVT Ty =
N->getValueType(0);
602 unsigned LO = (Ty == MVT::i32) ? Mips::LO0 : Mips::LO0_64;
603 unsigned HI = (Ty == MVT::i32) ? Mips::HI0 : Mips::HI0_64;
609 N->getOperand(0),
N->getOperand(1));
614 if (
N->hasAnyUseOfValue(0)) {
623 if (
N->hasAnyUseOfValue(1)) {
665 "Illegal Condition Code");
680 if (!
LHS.getValueType().isFloatingPoint())
792 SDValue ValueIfTrue =
N->getOperand(0), ValueIfFalse =
N->getOperand(2);
808 SDValue FCC =
N->getOperand(1), Glue =
N->getOperand(3);
810 ValueIfFalse, FCC, ValueIfTrue, Glue);
819 SDValue FirstOperand =
N->getOperand(0);
820 unsigned FirstOperandOpc = FirstOperand.
getOpcode();
822 EVT ValTy =
N->getValueType(0);
826 unsigned SMPos, SMSize;
849 if (SMPos != 0 || Pos + SMSize > ValTy.getSizeInBits())
867 if (SMPos != Pos || Pos >= ValTy.getSizeInBits() || SMSize >= 32 ||
868 Pos + SMSize > ValTy.getSizeInBits())
889 NewOperand = FirstOperand;
902 SDValue FirstOperand =
N->getOperand(0), SecondOperand =
N->getOperand(1);
903 unsigned SMPos0, SMSize0, SMPos1, SMSize1;
907 SecondOperand.getOpcode() ==
ISD::SHL) ||
909 SecondOperand.getOpcode() ==
ISD::AND)) {
920 ? SecondOperand.getOperand(0)
930 ? SecondOperand.getOperand(1)
936 if (SMPos0 != 0 || SMSize0 != ShlShiftValue)
940 EVT ValTy =
N->getValueType(0);
941 SMPos1 = ShlShiftValue;
942 assert(SMPos1 < ValTy.getSizeInBits());
943 SMSize1 = (ValTy == MVT::i64 ? 64 : 32) - SMPos1;
962 if (SecondOperand.getOpcode() ==
ISD::AND &&
963 SecondOperand.getOperand(0).getOpcode() ==
ISD::SHL) {
970 if (SMPos0 != SMPos1 || SMSize0 != SMSize1)
982 EVT ValTy =
N->getValueType(0);
983 if ((Shamt != SMPos0) || (SMPos0 + SMSize0 > ValTy.getSizeInBits()))
996 if (~CN->
getSExtValue() == ((((int64_t)1 << SMSize0) - 1) << SMPos0) &&
997 ((SMSize0 + SMPos0 <= 64 && Subtarget.
hasMips64r2()) ||
998 (SMSize0 + SMPos0 <= 32))) {
1000 bool isConstCase = SecondOperand.getOpcode() !=
ISD::AND;
1001 if (SecondOperand.getOpcode() ==
ISD::AND) {
1014 EVT ValTy =
N->getOperand(0)->getValueType(0);
1020 SecondOperand, Const1);
1028 DAG.
getConstant(ValTy.getSizeInBits() / 8 < 8 ? SMSize0 & 31
1089 if (!Mult.hasOneUse())
1097 SDValue MultLHS = Mult->getOperand(0);
1098 SDValue MultRHS = Mult->getOperand(1);
1105 if (!IsSigned && !IsUnsigned)
1111 std::tie(BottomHalf, TopHalf) =
1138 !Subtarget.
inMips16Mode() &&
N->getValueType(0) == MVT::i64)
1153 !Subtarget.
inMips16Mode() &&
N->getValueType(0) == MVT::i64)
1163 SDValue InnerAdd =
N->getOperand(1);
1179 EVT ValTy =
N->getValueType(0);
1196 SDValue FirstOperand =
N->getOperand(0);
1197 unsigned FirstOperandOpc = FirstOperand.
getOpcode();
1198 SDValue SecondOperand =
N->getOperand(1);
1199 EVT ValTy =
N->getValueType(0);
1203 unsigned SMPos, SMSize;
1213 if (Pos >= ValTy.getSizeInBits())
1226 if (SMPos != 0 || SMSize > 32 || Pos + SMSize > ValTy.getSizeInBits())
1246 EVT VT =
N->getValueType(0);
1261 int64_t ConstImm = ConstantOperand->getSExtValue();
1272 unsigned Opc =
N->getOpcode();
1314 return C->getAPIntValue().ule(15);
1322 N->getOperand(0).getOpcode() ==
ISD::SRL) ||
1324 N->getOperand(0).getOpcode() ==
ISD::SHL)) &&
1325 "Expected shift-shift mask");
1327 if (
N->getOperand(0).getValueType().isVector())
1342 switch (
Op.getOpcode())
1344 case ISD::BRCOND:
return lowerBRCOND(
Op, DAG);
1354 return lowerFSETCC(
Op, DAG);
1355 case ISD::VASTART:
return lowerVASTART(
Op, DAG);
1356 case ISD::VAARG:
return lowerVAARG(
Op, DAG);
1358 case ISD::FABS:
return lowerFABS(
Op, DAG);
1360 return lowerFCANONICALIZE(
Op, DAG);
1364 case ISD::ATOMIC_FENCE:
return lowerATOMIC_FENCE(
Op, DAG);
1373 return lowerSTRICT_FP_TO_INT(
Op, DAG);
1375 case ISD::READCYCLECOUNTER:
1376 return lowerREADCYCLECOUNTER(
Op, DAG);
1399 bool Is64Bit,
bool IsMicroMips) {
1408 TII.get(IsMicroMips ? Mips::TEQ_MM : Mips::TEQ))
1429 switch (
MI.getOpcode()) {
1432 case Mips::ATOMIC_LOAD_ADD_I8:
1433 return emitAtomicBinaryPartword(
MI, BB, 1);
1434 case Mips::ATOMIC_LOAD_ADD_I16:
1435 return emitAtomicBinaryPartword(
MI, BB, 2);
1436 case Mips::ATOMIC_LOAD_ADD_I32:
1437 return emitAtomicBinary(
MI, BB);
1438 case Mips::ATOMIC_LOAD_ADD_I64:
1439 return emitAtomicBinary(
MI, BB);
1441 case Mips::ATOMIC_LOAD_AND_I8:
1442 return emitAtomicBinaryPartword(
MI, BB, 1);
1443 case Mips::ATOMIC_LOAD_AND_I16:
1444 return emitAtomicBinaryPartword(
MI, BB, 2);
1445 case Mips::ATOMIC_LOAD_AND_I32:
1446 return emitAtomicBinary(
MI, BB);
1447 case Mips::ATOMIC_LOAD_AND_I64:
1448 return emitAtomicBinary(
MI, BB);
1450 case Mips::ATOMIC_LOAD_OR_I8:
1451 return emitAtomicBinaryPartword(
MI, BB, 1);
1452 case Mips::ATOMIC_LOAD_OR_I16:
1453 return emitAtomicBinaryPartword(
MI, BB, 2);
1454 case Mips::ATOMIC_LOAD_OR_I32:
1455 return emitAtomicBinary(
MI, BB);
1456 case Mips::ATOMIC_LOAD_OR_I64:
1457 return emitAtomicBinary(
MI, BB);
1459 case Mips::ATOMIC_LOAD_XOR_I8:
1460 return emitAtomicBinaryPartword(
MI, BB, 1);
1461 case Mips::ATOMIC_LOAD_XOR_I16:
1462 return emitAtomicBinaryPartword(
MI, BB, 2);
1463 case Mips::ATOMIC_LOAD_XOR_I32:
1464 return emitAtomicBinary(
MI, BB);
1465 case Mips::ATOMIC_LOAD_XOR_I64:
1466 return emitAtomicBinary(
MI, BB);
1468 case Mips::ATOMIC_LOAD_NAND_I8:
1469 return emitAtomicBinaryPartword(
MI, BB, 1);
1470 case Mips::ATOMIC_LOAD_NAND_I16:
1471 return emitAtomicBinaryPartword(
MI, BB, 2);
1472 case Mips::ATOMIC_LOAD_NAND_I32:
1473 return emitAtomicBinary(
MI, BB);
1474 case Mips::ATOMIC_LOAD_NAND_I64:
1475 return emitAtomicBinary(
MI, BB);
1477 case Mips::ATOMIC_LOAD_SUB_I8:
1478 return emitAtomicBinaryPartword(
MI, BB, 1);
1479 case Mips::ATOMIC_LOAD_SUB_I16:
1480 return emitAtomicBinaryPartword(
MI, BB, 2);
1481 case Mips::ATOMIC_LOAD_SUB_I32:
1482 return emitAtomicBinary(
MI, BB);
1483 case Mips::ATOMIC_LOAD_SUB_I64:
1484 return emitAtomicBinary(
MI, BB);
1486 case Mips::ATOMIC_SWAP_I8:
1487 return emitAtomicBinaryPartword(
MI, BB, 1);
1488 case Mips::ATOMIC_SWAP_I16:
1489 return emitAtomicBinaryPartword(
MI, BB, 2);
1490 case Mips::ATOMIC_SWAP_I32:
1491 return emitAtomicBinary(
MI, BB);
1492 case Mips::ATOMIC_SWAP_I64:
1493 return emitAtomicBinary(
MI, BB);
1495 case Mips::ATOMIC_CMP_SWAP_I8:
1496 return emitAtomicCmpSwapPartword(
MI, BB, 1);
1497 case Mips::ATOMIC_CMP_SWAP_I16:
1498 return emitAtomicCmpSwapPartword(
MI, BB, 2);
1499 case Mips::ATOMIC_CMP_SWAP_I32:
1500 return emitAtomicCmpSwap(
MI, BB);
1501 case Mips::ATOMIC_CMP_SWAP_I64:
1502 return emitAtomicCmpSwap(
MI, BB);
1504 case Mips::ATOMIC_LOAD_MIN_I8:
1505 return emitAtomicBinaryPartword(
MI, BB, 1);
1506 case Mips::ATOMIC_LOAD_MIN_I16:
1507 return emitAtomicBinaryPartword(
MI, BB, 2);
1508 case Mips::ATOMIC_LOAD_MIN_I32:
1509 return emitAtomicBinary(
MI, BB);
1510 case Mips::ATOMIC_LOAD_MIN_I64:
1511 return emitAtomicBinary(
MI, BB);
1513 case Mips::ATOMIC_LOAD_MAX_I8:
1514 return emitAtomicBinaryPartword(
MI, BB, 1);
1515 case Mips::ATOMIC_LOAD_MAX_I16:
1516 return emitAtomicBinaryPartword(
MI, BB, 2);
1517 case Mips::ATOMIC_LOAD_MAX_I32:
1518 return emitAtomicBinary(
MI, BB);
1519 case Mips::ATOMIC_LOAD_MAX_I64:
1520 return emitAtomicBinary(
MI, BB);
1522 case Mips::ATOMIC_LOAD_UMIN_I8:
1523 return emitAtomicBinaryPartword(
MI, BB, 1);
1524 case Mips::ATOMIC_LOAD_UMIN_I16:
1525 return emitAtomicBinaryPartword(
MI, BB, 2);
1526 case Mips::ATOMIC_LOAD_UMIN_I32:
1527 return emitAtomicBinary(
MI, BB);
1528 case Mips::ATOMIC_LOAD_UMIN_I64:
1529 return emitAtomicBinary(
MI, BB);
1531 case Mips::ATOMIC_LOAD_UMAX_I8:
1532 return emitAtomicBinaryPartword(
MI, BB, 1);
1533 case Mips::ATOMIC_LOAD_UMAX_I16:
1534 return emitAtomicBinaryPartword(
MI, BB, 2);
1535 case Mips::ATOMIC_LOAD_UMAX_I32:
1536 return emitAtomicBinary(
MI, BB);
1537 case Mips::ATOMIC_LOAD_UMAX_I64:
1538 return emitAtomicBinary(
MI, BB);
1540 case Mips::PseudoSDIV:
1541 case Mips::PseudoUDIV:
1548 case Mips::SDIV_MM_Pseudo:
1549 case Mips::UDIV_MM_Pseudo:
1552 case Mips::DIV_MMR6:
1553 case Mips::DIVU_MMR6:
1554 case Mips::MOD_MMR6:
1555 case Mips::MODU_MMR6:
1557 case Mips::PseudoDSDIV:
1558 case Mips::PseudoDUDIV:
1565 case Mips::PseudoSELECT_I:
1566 case Mips::PseudoSELECT_I64:
1567 case Mips::PseudoSELECT_S:
1568 case Mips::PseudoSELECT_D32:
1569 case Mips::PseudoSELECT_D64:
1570 return emitPseudoSELECT(
MI, BB,
false, Mips::BNE);
1571 case Mips::PseudoSELECTFP_F_I:
1572 case Mips::PseudoSELECTFP_F_I64:
1573 case Mips::PseudoSELECTFP_F_S:
1574 case Mips::PseudoSELECTFP_F_D32:
1575 case Mips::PseudoSELECTFP_F_D64:
1576 return emitPseudoSELECT(
MI, BB,
true, Mips::BC1F);
1577 case Mips::PseudoSELECTFP_T_I:
1578 case Mips::PseudoSELECTFP_T_I64:
1579 case Mips::PseudoSELECTFP_T_S:
1580 case Mips::PseudoSELECTFP_T_D32:
1581 case Mips::PseudoSELECTFP_T_D64:
1582 return emitPseudoSELECT(
MI, BB,
true, Mips::BC1T);
1583 case Mips::PseudoD_SELECT_I:
1584 case Mips::PseudoD_SELECT_I64:
1585 return emitPseudoD_SELECT(
MI, BB);
1587 return emitLDR_W(
MI, BB);
1589 return emitLDR_D(
MI, BB);
1591 return emitSTR_W(
MI, BB);
1593 return emitSTR_D(
MI, BB);
1609 bool NeedsAdditionalReg =
false;
1610 switch (
MI.getOpcode()) {
1611 case Mips::ATOMIC_LOAD_ADD_I32:
1612 AtomicOp = Mips::ATOMIC_LOAD_ADD_I32_POSTRA;
1614 case Mips::ATOMIC_LOAD_SUB_I32:
1615 AtomicOp = Mips::ATOMIC_LOAD_SUB_I32_POSTRA;
1617 case Mips::ATOMIC_LOAD_AND_I32:
1618 AtomicOp = Mips::ATOMIC_LOAD_AND_I32_POSTRA;
1620 case Mips::ATOMIC_LOAD_OR_I32:
1621 AtomicOp = Mips::ATOMIC_LOAD_OR_I32_POSTRA;
1623 case Mips::ATOMIC_LOAD_XOR_I32:
1624 AtomicOp = Mips::ATOMIC_LOAD_XOR_I32_POSTRA;
1626 case Mips::ATOMIC_LOAD_NAND_I32:
1627 AtomicOp = Mips::ATOMIC_LOAD_NAND_I32_POSTRA;
1629 case Mips::ATOMIC_SWAP_I32:
1630 AtomicOp = Mips::ATOMIC_SWAP_I32_POSTRA;
1632 case Mips::ATOMIC_LOAD_ADD_I64:
1633 AtomicOp = Mips::ATOMIC_LOAD_ADD_I64_POSTRA;
1635 case Mips::ATOMIC_LOAD_SUB_I64:
1636 AtomicOp = Mips::ATOMIC_LOAD_SUB_I64_POSTRA;
1638 case Mips::ATOMIC_LOAD_AND_I64:
1639 AtomicOp = Mips::ATOMIC_LOAD_AND_I64_POSTRA;
1641 case Mips::ATOMIC_LOAD_OR_I64:
1642 AtomicOp = Mips::ATOMIC_LOAD_OR_I64_POSTRA;
1644 case Mips::ATOMIC_LOAD_XOR_I64:
1645 AtomicOp = Mips::ATOMIC_LOAD_XOR_I64_POSTRA;
1647 case Mips::ATOMIC_LOAD_NAND_I64:
1648 AtomicOp = Mips::ATOMIC_LOAD_NAND_I64_POSTRA;
1650 case Mips::ATOMIC_SWAP_I64:
1651 AtomicOp = Mips::ATOMIC_SWAP_I64_POSTRA;
1653 case Mips::ATOMIC_LOAD_MIN_I32:
1654 AtomicOp = Mips::ATOMIC_LOAD_MIN_I32_POSTRA;
1655 NeedsAdditionalReg =
true;
1657 case Mips::ATOMIC_LOAD_MAX_I32:
1658 AtomicOp = Mips::ATOMIC_LOAD_MAX_I32_POSTRA;
1659 NeedsAdditionalReg =
true;
1661 case Mips::ATOMIC_LOAD_UMIN_I32:
1662 AtomicOp = Mips::ATOMIC_LOAD_UMIN_I32_POSTRA;
1663 NeedsAdditionalReg =
true;
1665 case Mips::ATOMIC_LOAD_UMAX_I32:
1666 AtomicOp = Mips::ATOMIC_LOAD_UMAX_I32_POSTRA;
1667 NeedsAdditionalReg =
true;
1669 case Mips::ATOMIC_LOAD_MIN_I64:
1670 AtomicOp = Mips::ATOMIC_LOAD_MIN_I64_POSTRA;
1671 NeedsAdditionalReg =
true;
1673 case Mips::ATOMIC_LOAD_MAX_I64:
1674 AtomicOp = Mips::ATOMIC_LOAD_MAX_I64_POSTRA;
1675 NeedsAdditionalReg =
true;
1677 case Mips::ATOMIC_LOAD_UMIN_I64:
1678 AtomicOp = Mips::ATOMIC_LOAD_UMIN_I64_POSTRA;
1679 NeedsAdditionalReg =
true;
1681 case Mips::ATOMIC_LOAD_UMAX_I64:
1682 AtomicOp = Mips::ATOMIC_LOAD_UMAX_I64_POSTRA;
1683 NeedsAdditionalReg =
true;
1744 if (NeedsAdditionalReg) {
1751 MI.eraseFromParent();
1758 unsigned SrcReg)
const {
1773 MachineRegisterInfo &RegInfo = MF->
getRegInfo();
1778 int64_t ShiftImm = 32 - (
Size * 8);
1789 "Unsupported size for EmitAtomicBinaryPartial.");
1792 MachineRegisterInfo &RegInfo = MF->
getRegInfo();
1794 const bool ArePtrs64bit =
ABI.ArePtrs64bit();
1795 const TargetRegisterClass *RCp =
1816 unsigned AtomicOp = 0;
1817 bool NeedsAdditionalReg =
false;
1818 switch (
MI.getOpcode()) {
1819 case Mips::ATOMIC_LOAD_NAND_I8:
1820 AtomicOp = Mips::ATOMIC_LOAD_NAND_I8_POSTRA;
1822 case Mips::ATOMIC_LOAD_NAND_I16:
1823 AtomicOp = Mips::ATOMIC_LOAD_NAND_I16_POSTRA;
1825 case Mips::ATOMIC_SWAP_I8:
1826 AtomicOp = Mips::ATOMIC_SWAP_I8_POSTRA;
1828 case Mips::ATOMIC_SWAP_I16:
1829 AtomicOp = Mips::ATOMIC_SWAP_I16_POSTRA;
1831 case Mips::ATOMIC_LOAD_ADD_I8:
1832 AtomicOp = Mips::ATOMIC_LOAD_ADD_I8_POSTRA;
1834 case Mips::ATOMIC_LOAD_ADD_I16:
1835 AtomicOp = Mips::ATOMIC_LOAD_ADD_I16_POSTRA;
1837 case Mips::ATOMIC_LOAD_SUB_I8:
1838 AtomicOp = Mips::ATOMIC_LOAD_SUB_I8_POSTRA;
1840 case Mips::ATOMIC_LOAD_SUB_I16:
1841 AtomicOp = Mips::ATOMIC_LOAD_SUB_I16_POSTRA;
1843 case Mips::ATOMIC_LOAD_AND_I8:
1844 AtomicOp = Mips::ATOMIC_LOAD_AND_I8_POSTRA;
1846 case Mips::ATOMIC_LOAD_AND_I16:
1847 AtomicOp = Mips::ATOMIC_LOAD_AND_I16_POSTRA;
1849 case Mips::ATOMIC_LOAD_OR_I8:
1850 AtomicOp = Mips::ATOMIC_LOAD_OR_I8_POSTRA;
1852 case Mips::ATOMIC_LOAD_OR_I16:
1853 AtomicOp = Mips::ATOMIC_LOAD_OR_I16_POSTRA;
1855 case Mips::ATOMIC_LOAD_XOR_I8:
1856 AtomicOp = Mips::ATOMIC_LOAD_XOR_I8_POSTRA;
1858 case Mips::ATOMIC_LOAD_XOR_I16:
1859 AtomicOp = Mips::ATOMIC_LOAD_XOR_I16_POSTRA;
1861 case Mips::ATOMIC_LOAD_MIN_I8:
1862 AtomicOp = Mips::ATOMIC_LOAD_MIN_I8_POSTRA;
1863 NeedsAdditionalReg =
true;
1865 case Mips::ATOMIC_LOAD_MIN_I16:
1866 AtomicOp = Mips::ATOMIC_LOAD_MIN_I16_POSTRA;
1867 NeedsAdditionalReg =
true;
1869 case Mips::ATOMIC_LOAD_MAX_I8:
1870 AtomicOp = Mips::ATOMIC_LOAD_MAX_I8_POSTRA;
1871 NeedsAdditionalReg =
true;
1873 case Mips::ATOMIC_LOAD_MAX_I16:
1874 AtomicOp = Mips::ATOMIC_LOAD_MAX_I16_POSTRA;
1875 NeedsAdditionalReg =
true;
1877 case Mips::ATOMIC_LOAD_UMIN_I8:
1878 AtomicOp = Mips::ATOMIC_LOAD_UMIN_I8_POSTRA;
1879 NeedsAdditionalReg =
true;
1881 case Mips::ATOMIC_LOAD_UMIN_I16:
1882 AtomicOp = Mips::ATOMIC_LOAD_UMIN_I16_POSTRA;
1883 NeedsAdditionalReg =
true;
1885 case Mips::ATOMIC_LOAD_UMAX_I8:
1886 AtomicOp = Mips::ATOMIC_LOAD_UMAX_I8_POSTRA;
1887 NeedsAdditionalReg =
true;
1889 case Mips::ATOMIC_LOAD_UMAX_I16:
1890 AtomicOp = Mips::ATOMIC_LOAD_UMAX_I16_POSTRA;
1891 NeedsAdditionalReg =
true;
1920 int64_t MaskImm = (
Size == 1) ? 255 : 65535;
1926 .
addReg(Ptr, 0, ArePtrs64bit ? Mips::sub_32 : 0).
addImm(3);
1947 MachineInstrBuilder MIB =
1961 if (NeedsAdditionalReg) {
1967 MI.eraseFromParent();
1981 assert((
MI.getOpcode() == Mips::ATOMIC_CMP_SWAP_I32 ||
1982 MI.getOpcode() == Mips::ATOMIC_CMP_SWAP_I64) &&
1983 "Unsupported atomic pseudo for EmitAtomicCmpSwap.");
1985 const unsigned Size =
MI.getOpcode() == Mips::ATOMIC_CMP_SWAP_I32 ? 4 : 8;
1993 unsigned AtomicOp =
MI.getOpcode() == Mips::ATOMIC_CMP_SWAP_I32
1994 ? Mips::ATOMIC_CMP_SWAP_I32_POSTRA
1995 : Mips::ATOMIC_CMP_SWAP_I64_POSTRA;
2009 Register PtrCopy =
MRI.createVirtualRegister(
MRI.getRegClass(Ptr));
2010 Register OldValCopy =
MRI.createVirtualRegister(
MRI.getRegClass(OldVal));
2011 Register NewValCopy =
MRI.createVirtualRegister(
MRI.getRegClass(NewVal));
2029 MI.eraseFromParent();
2037 "Unsupported size for EmitAtomicCmpSwapPartial.");
2040 MachineRegisterInfo &RegInfo = MF->
getRegInfo();
2042 const bool ArePtrs64bit =
ABI.ArePtrs64bit();
2043 const TargetRegisterClass *RCp =
2064 unsigned AtomicOp =
MI.getOpcode() == Mips::ATOMIC_CMP_SWAP_I8
2065 ? Mips::ATOMIC_CMP_SWAP_I8_POSTRA
2066 : Mips::ATOMIC_CMP_SWAP_I16_POSTRA;
2107 int64_t MaskImm = (
Size == 1) ? 255 : 65535;
2108 BuildMI(BB,
DL,
TII->get(ArePtrs64bit ? Mips::DADDiu : Mips::ADDiu), MaskLSB2)
2110 BuildMI(BB,
DL,
TII->get(ArePtrs64bit ? Mips::AND64 : Mips::AND), AlignedAddr)
2113 .
addReg(Ptr, 0, ArePtrs64bit ? Mips::sub_32 : 0).
addImm(3);
2153 MI.eraseFromParent();
2163 unsigned RdhwrOpc, DestReg;
2166 if (PtrVT == MVT::i64) {
2167 RdhwrOpc = Mips::RDHWR64;
2179 RdhwrOpc = Mips::RDHWR;
2216 FCC0, Dest, CondRes);
2238 "Floating point operand expected.");
2267 EVT Ty =
Op.getValueType();
2269 const GlobalValue *GV =
N->getGlobal();
2273 "Windows is the only supported COFF target");
2280 const MipsTargetObjectFile *TLOF =
2281 static_cast<const MipsTargetObjectFile *
>(
2315 N, SDLoc(
N), Ty, DAG,
2323 EVT Ty =
Op.getValueType();
2344 const GlobalValue *GV = GA->
getGlobal();
2363 Args.emplace_back(Argument, PtrTy);
2365 TargetLowering::CallLoweringInfo CLI(DAG);
2368 .setLibCallee(
CallingConv::C, PtrTy, TlsGetAddr, std::move(Args));
2369 std::pair<SDValue, SDValue> CallResult =
LowerCallTo(CLI);
2415 EVT Ty =
Op.getValueType();
2428 EVT Ty =
Op.getValueType();
2431 const MipsTargetObjectFile *TLOF =
2432 static_cast<const MipsTargetObjectFile *
>(
2449 MipsFunctionInfo *FuncInfo = MF.
getInfo<MipsFunctionInfo>();
2459 MachinePointerInfo(SV));
2463 SDNode *
Node =
Op.getNode();
2464 EVT VT =
Node->getValueType(0);
2468 llvm::MaybeAlign(
Node->getConstantOperandVal(3)).valueOrOne();
2471 unsigned ArgSlotSizeInBytes = (
ABI.IsN32() ||
ABI.IsN64()) ? 8 : 4;
2474 VAListPtr, MachinePointerInfo(SV));
2496 unsigned ArgSizeInBytes =
2504 MachinePointerInfo(SV));
2511 if (!
Subtarget.isLittle() && ArgSizeInBytes < ArgSlotSizeInBytes) {
2512 unsigned Adjustment = ArgSlotSizeInBytes - ArgSizeInBytes;
2517 return DAG.
getLoad(VT,
DL, Chain, VAList, MachinePointerInfo());
2521 bool HasExtractInsert) {
2522 EVT TyX =
Op.getOperand(0).getValueType();
2523 EVT TyY =
Op.getOperand(1).getValueType();
2532 DAG.
getNode(ISD::BITCAST,
DL, MVT::i32,
Op.getOperand(0)) :
2536 DAG.
getNode(ISD::BITCAST,
DL, MVT::i32,
Op.getOperand(1)) :
2540 if (HasExtractInsert) {
2558 if (TyX == MVT::f32)
2559 return DAG.
getNode(ISD::BITCAST,
DL,
Op.getOperand(0).getValueType(), Res);
2568 bool HasExtractInsert) {
2569 unsigned WidthX =
Op.getOperand(0).getValueSizeInBits();
2570 unsigned WidthY =
Op.getOperand(1).getValueSizeInBits();
2579 if (HasExtractInsert) {
2585 if (WidthX > WidthY)
2587 else if (WidthY > WidthX)
2593 return DAG.
getNode(ISD::BITCAST,
DL,
Op.getOperand(0).getValueType(),
I);
2606 if (WidthX > WidthY)
2608 else if (WidthY > WidthX)
2614 return DAG.
getNode(ISD::BITCAST,
DL,
Op.getOperand(0).getValueType(),
Or);
2626 bool HasExtractInsert)
const {
2636 ? DAG.
getNode(ISD::BITCAST,
DL, MVT::i32,
Op.getOperand(0))
2638 Op.getOperand(0), Const1);
2641 if (HasExtractInsert)
2652 if (
Op.getValueType() == MVT::f32)
2653 return DAG.
getNode(ISD::BITCAST,
DL, MVT::f32, Res);
2666 bool HasExtractInsert)
const {
2677 if (HasExtractInsert)
2686 return DAG.
getNode(ISD::BITCAST,
DL, MVT::f64, Res);
2690 if ((
ABI.IsN32() ||
ABI.IsN64()) && (
Op.getValueType() == MVT::f64))
2691 return lowerFABS64(
Op, DAG,
Subtarget.hasExtractInsert());
2693 return lowerFABS32(
Op, DAG,
Subtarget.hasExtractInsert());
2699 EVT VT =
Op.getValueType();
2701 SDNodeFlags
Flags =
Op->getFlags();
2713 if (
Op.getConstantOperandVal(0) != 0) {
2715 "return address can be determined only for current frame");
2721 EVT VT =
Op.getValueType();
2731 if (
Op.getConstantOperandVal(0) != 0) {
2733 "return address can be determined only for current frame");
2739 MVT VT =
Op.getSimpleValueType();
2740 unsigned RA =
ABI.IsN64() ? Mips::RA_64 : Mips::RA;
2755 MipsFunctionInfo *MipsFI = MF.
getInfo<MipsFunctionInfo>();
2762 EVT Ty =
ABI.IsN64() ? MVT::i64 : MVT::i32;
2766 unsigned OffsetReg =
ABI.IsN64() ? Mips::V1_64 : Mips::V1;
2767 unsigned AddrReg =
ABI.IsN64() ? Mips::V0_64 : Mips::V0;
2789 MVT VT =
Subtarget.isGP64bit() ? MVT::i64 : MVT::i32;
2823 MVT VT =
Subtarget.isGP64bit() ? MVT::i64 : MVT::i32;
2854 SDVTList VTList = DAG.
getVTList(VT, VT);
2857 DL, VTList,
Cond, ShiftRightHi,
2872 SDValue Ptr = LD->getBasePtr();
2873 EVT VT = LD->getValueType(0), MemVT = LD->getMemoryVT();
2884 LD->getMemOperand());
2890 EVT MemVT = LD->getMemoryVT();
2892 if (
Subtarget.systemSupportsUnalignedAccess())
2896 if ((LD->getAlign().value() >= (MemVT.
getSizeInBits() / 8)) ||
2897 ((MemVT != MVT::i32) && (MemVT != MVT::i64)))
2901 EVT VT =
Op.getValueType();
2905 assert((VT == MVT::i32) || (VT == MVT::i64));
3019 if (!
Subtarget.systemSupportsUnalignedAccess() &&
3021 ((MemVT == MVT::i32) || (MemVT == MVT::i64)))
3033 EVT ValTy =
Op->getValueType(0);
3058 Loc,
Op.getValueType(), SrcVal);
3092 State.getMachineFunction().getSubtarget());
3094 static const MCPhysReg IntRegs[] = { Mips::A0, Mips::A1, Mips::A2, Mips::A3 };
3098 static const MCPhysReg FloatVectorIntRegs[] = { Mips::A0, Mips::A2 };
3106 if (LocVT == MVT::i8 || LocVT == MVT::i16 || LocVT == MVT::i32) {
3110 else if (ArgFlags.
isZExt())
3118 if (LocVT == MVT::i8 || LocVT == MVT::i16) {
3122 else if (ArgFlags.
isZExt())
3133 bool AllocateFloatsInIntReg = State.isVarArg() || ValNo > 1 ||
3134 State.getFirstUnallocated(
F32Regs) != ValNo;
3136 bool isI64 = (ValVT == MVT::i32 && OrigAlign ==
Align(8));
3140 if (ValVT == MVT::i32 && isVectorFloat) {
3146 Reg = State.AllocateReg(FloatVectorIntRegs);
3147 if (
Reg == Mips::A2)
3148 State.AllocateReg(Mips::A1);
3150 State.AllocateReg(Mips::A3);
3156 }
else if (ValVT == MVT::i32 ||
3157 (ValVT == MVT::f32 && AllocateFloatsInIntReg)) {
3161 if (isI64 && (
Reg == Mips::A1 ||
Reg == Mips::A3))
3164 }
else if (ValVT == MVT::f64 && AllocateFloatsInIntReg) {
3168 if (
Reg == Mips::A1 ||
Reg == Mips::A3)
3184 if (ValVT == MVT::f32) {
3189 Reg = State.AllocateReg(F64Regs);
3192 if (Reg2 == Mips::A1 || Reg2 == Mips::A3)
3212 static const MCPhysReg F64Regs[] = { Mips::D6, Mips::D7 };
3214 return CC_MipsO32(ValNo, ValVT, LocVT, LocInfo, ArgFlags, OrigTy, State,
3222 static const MCPhysReg F64Regs[] = { Mips::D12_64, Mips::D14_64 };
3224 return CC_MipsO32(ValNo, ValVT, LocVT, LocInfo, ArgFlags, OrigTy, State,
3233#include "MipsGenCallingConv.inc"
3236 return CC_Mips_FixedArg;
3248 const SDLoc &
DL,
bool IsTailCall,
3266 std::deque<std::pair<unsigned, SDValue>> &RegsToPass,
3267 bool IsPICCall,
bool GlobalOrExternal,
bool InternalLinkage,
3280 if (IsPICCall && !InternalLinkage && IsCallReloc) {
3281 unsigned GPReg =
ABI.IsN64() ? Mips::GP_64 : Mips::GP;
3282 EVT Ty =
ABI.IsN64() ? MVT::i64 : MVT::i32;
3283 RegsToPass.push_back(std::make_pair(GPReg,
getGlobalReg(CLI.
DAG, Ty)));
3292 for (
auto &R : RegsToPass) {
3299 for (
auto &R : RegsToPass)
3306 assert(Mask &&
"Missing call preserved mask for calling convention");
3310 Function *
F =
G->getGlobal()->getParent()->getFunction(Sym);
3311 if (
F &&
F->hasFnAttribute(
"__Mips16RetHelper")) {
3319 Ops.push_back(InGlue);
3324 switch (
MI.getOpcode()) {
3328 case Mips::JALRPseudo:
3330 case Mips::JALR64Pseudo:
3331 case Mips::JALR16_MM:
3332 case Mips::JALRC16_MMR6:
3333 case Mips::TAILCALLREG:
3334 case Mips::TAILCALLREG64:
3335 case Mips::TAILCALLR6REG:
3336 case Mips::TAILCALL64R6REG:
3337 case Mips::TAILCALLREG_MM:
3338 case Mips::TAILCALLREG_MMR6: {
3342 Node->getNumOperands() < 1 ||
3343 Node->getOperand(0).getNumOperands() < 2) {
3349 const SDValue TargetAddr =
Node->getOperand(0).getOperand(1);
3357 LLVM_DEBUG(
dbgs() <<
"Not adding R_MIPS_JALR against data symbol "
3358 <<
G->getGlobal()->getName() <<
"\n");
3361 Sym =
G->getGlobal()->getName();
3365 Sym = ES->getSymbol();
3373 LLVM_DEBUG(
dbgs() <<
"Adding R_MIPS_JALR against " << Sym <<
"\n");
3437 Chain.
getOpcode() == ISD::CALLSEQ_START;
3441 unsigned ReservedArgArea =
3442 MemcpyInByVal ? 0 : ABI.GetCalleeAllocdArgSizeInBytes(CallConv);
3443 CCInfo.AllocateStack(ReservedArgArea,
Align(1));
3445 CCInfo.AnalyzeCallOperands(Outs,
CC_Mips);
3448 unsigned StackSize = CCInfo.getStackSize();
3458 bool InternalLinkage =
false;
3460 IsTailCall = isEligibleForTailCallOptimization(
3463 InternalLinkage =
G->getGlobal()->hasInternalLinkage();
3464 IsTailCall &= (InternalLinkage ||
G->getGlobal()->hasLocalLinkage() ||
3465 G->getGlobal()->hasPrivateLinkage() ||
3466 G->getGlobal()->hasHiddenVisibility() ||
3467 G->getGlobal()->hasProtectedVisibility());
3472 "site marked musttail");
3481 StackSize =
alignTo(StackSize, StackAlignment);
3483 if (!(IsTailCall || MemcpyInByVal))
3489 std::deque<std::pair<unsigned, SDValue>> RegsToPass;
3492 CCInfo.rewindByValRegsInfo();
3495 for (
unsigned i = 0, e = ArgLocs.
size(), OutIdx = 0; i != e; ++i, ++OutIdx) {
3496 SDValue Arg = OutVals[OutIdx];
3497 CCValAssign &VA = ArgLocs[i];
3499 ISD::ArgFlagsTy
Flags = Outs[OutIdx].Flags;
3500 bool UseUpperBits =
false;
3503 if (
Flags.isByVal()) {
3504 unsigned FirstByValReg, LastByValReg;
3505 unsigned ByValIdx = CCInfo.getInRegsParamsProcessed();
3506 CCInfo.getInRegsParamInfo(ByValIdx, FirstByValReg, LastByValReg);
3509 "ByVal args of size 0 should have been ignored by front-end.");
3510 assert(ByValIdx < CCInfo.getInRegsParamsCount());
3512 "Do not tail-call optimize if there is a byval argument.");
3513 passByValArg(Chain,
DL, RegsToPass, MemOpChains, StackPtr, MFI, DAG, Arg,
3514 FirstByValReg, LastByValReg, Flags,
Subtarget.isLittle(),
3516 CCInfo.nextInRegsParam();
3526 if ((ValVT == MVT::f32 && LocVT == MVT::i32) ||
3527 (ValVT == MVT::f64 && LocVT == MVT::i64) ||
3528 (ValVT == MVT::i64 && LocVT == MVT::f64))
3529 Arg = DAG.
getNode(ISD::BITCAST,
DL, LocVT, Arg);
3530 else if (ValVT == MVT::f64 && LocVT == MVT::i32) {
3541 Register LocRegHigh = ArgLocs[++i].getLocReg();
3542 RegsToPass.
push_back(std::make_pair(LocRegLo,
Lo));
3543 RegsToPass.push_back(std::make_pair(LocRegHigh,
Hi));
3549 Arg = DAG.
getNode(ISD::BITCAST,
DL, LocVT, Arg);
3552 UseUpperBits =
true;
3558 UseUpperBits =
true;
3564 UseUpperBits =
true;
3572 unsigned ValSizeInBits = Outs[OutIdx].ArgVT.getSizeInBits();
3582 RegsToPass.push_back(std::make_pair(VA.
getLocReg(), Arg));
3603 Chain, Arg,
DL, IsTailCall, DAG));
3608 if (!MemOpChains.
empty())
3615 EVT Ty =
Callee.getValueType();
3616 bool GlobalOrExternal =
false, IsCallReloc =
false;
3621 if (!
Subtarget.isABICalls() && !IsPIC) {
3631 bool UseLongCalls =
Subtarget.useLongCalls();
3635 if (
F->hasFnAttribute(
"long-call"))
3636 UseLongCalls =
true;
3637 else if (
F->hasFnAttribute(
"short-call"))
3638 UseLongCalls =
false;
3649 G->getGlobal()->hasDLLImportStorageClass()) {
3651 "Windows is the only supported COFF target");
3652 auto PtrInfo = MachinePointerInfo();
3656 const GlobalValue *Val =
G->getGlobal();
3659 if (InternalLinkage)
3675 GlobalOrExternal =
true;
3678 const char *Sym = S->getSymbol();
3694 GlobalOrExternal =
true;
3698 SDVTList NodeTys = DAG.
getVTList(MVT::Other, MVT::Glue);
3700 getOpndList(
Ops, RegsToPass, IsPIC, GlobalOrExternal, InternalLinkage,
3701 IsCallReloc, CLI, Callee, Chain);
3717 if (!(MemcpyInByVal)) {
3724 return LowerCallResult(Chain, InGlue, CallConv, IsVarArg, Ins,
DL, DAG,
3730SDValue MipsTargetLowering::LowerCallResult(
3740 CCInfo.AnalyzeCallResult(Ins, RetCC_Mips);
3743 for (
unsigned i = 0; i != RVLocs.
size(); ++i) {
3744 CCValAssign &VA = RVLocs[i];
3748 RVLocs[i].getLocVT(), InGlue);
3753 unsigned ValSizeInBits =
Ins[i].ArgVT.getSizeInBits();
3842 Val = DAG.
getNode(ISD::BITCAST,
DL, ValVT, Val);
3854SDValue MipsTargetLowering::LowerFormalArguments(
3860 MipsFunctionInfo *MipsFI = MF.
getInfo<MipsFunctionInfo>();
3865 std::vector<SDValue> OutChains;
3871 CCInfo.AllocateStack(
ABI.GetCalleeAllocdArgSizeInBytes(CallConv),
Align(1));
3875 if (
Func.hasFnAttribute(
"interrupt") && !
Func.arg_empty())
3877 "Functions with the interrupt attribute cannot have arguments!");
3879 CCInfo.AnalyzeFormalArguments(Ins, CC_Mips_FixedArg);
3881 CCInfo.getInRegsParamsCount() > 0);
3883 unsigned CurArgIdx = 0;
3884 CCInfo.rewindByValRegsInfo();
3886 for (
unsigned i = 0, e = ArgLocs.
size(), InsIdx = 0; i != e; ++i, ++InsIdx) {
3887 CCValAssign &VA = ArgLocs[i];
3888 if (Ins[InsIdx].isOrigArg()) {
3889 std::advance(FuncArg, Ins[InsIdx].getOrigArgIndex() - CurArgIdx);
3890 CurArgIdx =
Ins[InsIdx].getOrigArgIndex();
3893 ISD::ArgFlagsTy
Flags =
Ins[InsIdx].Flags;
3896 if (
Flags.isByVal()) {
3897 assert(Ins[InsIdx].isOrigArg() &&
"Byval arguments cannot be implicit");
3898 unsigned FirstByValReg, LastByValReg;
3899 unsigned ByValIdx = CCInfo.getInRegsParamsProcessed();
3900 CCInfo.getInRegsParamInfo(ByValIdx, FirstByValReg, LastByValReg);
3903 "ByVal args of size 0 should have been ignored by front-end.");
3904 assert(ByValIdx < CCInfo.getInRegsParamsCount());
3905 copyByValRegs(Chain,
DL, OutChains, DAG, Flags, InVals, &*FuncArg,
3906 FirstByValReg, LastByValReg, VA, CCInfo);
3907 CCInfo.nextInRegsParam();
3927 if ((RegVT == MVT::i32 && ValVT == MVT::f32) ||
3928 (RegVT == MVT::i64 && ValVT == MVT::f64) ||
3929 (RegVT == MVT::f64 && ValVT == MVT::i64))
3930 ArgValue = DAG.
getNode(ISD::BITCAST,
DL, ValVT, ArgValue);
3931 else if (
ABI.IsO32() && RegVT == MVT::i32 &&
3932 ValVT == MVT::f64) {
3934 CCValAssign &NextVA = ArgLocs[++i];
3941 ArgValue, ArgValue2);
3960 LocVT,
DL, Chain, FIN,
3962 OutChains.push_back(ArgValue.
getValue(1));
3971 for (
unsigned i = 0, e = ArgLocs.
size(), InsIdx = 0; i != e; ++i, ++InsIdx) {
3973 if (ArgLocs[i].needsCustom()) {
3981 if (Ins[InsIdx].
Flags.isSRet()) {
3995 writeVarArgRegs(OutChains, Chain,
DL, DAG, CCInfo);
3999 if (!OutChains.empty()) {
4000 OutChains.push_back(Chain);
4017 MipsCCState CCInfo(CallConv, IsVarArg, MF, RVLocs,
Context);
4018 return CCInfo.CheckReturn(Outs, RetCC_Mips);
4021bool MipsTargetLowering::shouldSignExtendTypeInLibCall(
Type *Ty,
4022 bool IsSigned)
const {
4034 MipsFunctionInfo *MipsFI = MF.
getInfo<MipsFunctionInfo>();
4053 MipsCCState CCInfo(CallConv, IsVarArg, MF, RVLocs, *DAG.
getContext());
4056 CCInfo.AnalyzeReturn(Outs, RetCC_Mips);
4062 for (
unsigned i = 0; i != RVLocs.
size(); ++i) {
4064 CCValAssign &VA = RVLocs[i];
4066 bool UseUpperBits =
false;
4077 UseUpperBits =
true;
4083 UseUpperBits =
true;
4089 UseUpperBits =
true;
4097 unsigned ValSizeInBits = Outs[i].ArgVT.getSizeInBits();
4116 MipsFunctionInfo *MipsFI = MF.
getInfo<MipsFunctionInfo>();
4123 unsigned V0 =
ABI.IsN64() ? Mips::V0_64 : Mips::V0;
4138 return LowerInterruptReturn(RetOps,
DL, DAG);
4151MipsTargetLowering::getConstraintType(
StringRef Constraint)
const {
4163 if (Constraint.
size() == 1) {
4164 switch (Constraint[0]) {
4178 if (Constraint ==
"ZC")
4188MipsTargetLowering::getSingleConstraintMatchWeight(
4189 AsmOperandInfo &
info,
const char *constraint)
const {
4191 Value *CallOperandVal =
info.CallOperandVal;
4194 if (!CallOperandVal)
4198 switch (*constraint) {
4242 unsigned long long &
Reg) {
4243 if (
C.front() !=
'{' ||
C.back() !=
'}')
4244 return std::make_pair(
false,
false);
4248 I = std::find_if(
B,
E, isdigit);
4254 return std::make_pair(
true,
false);
4265 return VT.
bitsLT(MinVT) ? MinVT : VT;
4268std::pair<unsigned, const TargetRegisterClass *> MipsTargetLowering::
4274 unsigned long long Reg;
4279 return std::make_pair(0U,
nullptr);
4281 if ((Prefix ==
"hi" || Prefix ==
"lo")) {
4284 return std::make_pair(0U,
nullptr);
4286 RC =
TRI->getRegClass(Prefix ==
"hi" ?
4287 Mips::HI32RegClassID : Mips::LO32RegClassID);
4288 return std::make_pair(*(RC->
begin()), RC);
4289 }
else if (Prefix.starts_with(
"$msa")) {
4294 return std::make_pair(0U,
nullptr);
4297 .
Case(
"$msair", Mips::MSAIR)
4298 .
Case(
"$msacsr", Mips::MSACSR)
4299 .
Case(
"$msaaccess", Mips::MSAAccess)
4300 .
Case(
"$msasave", Mips::MSASave)
4301 .
Case(
"$msamodify", Mips::MSAModify)
4302 .
Case(
"$msarequest", Mips::MSARequest)
4303 .
Case(
"$msamap", Mips::MSAMap)
4304 .
Case(
"$msaunmap", Mips::MSAUnmap)
4308 return std::make_pair(0U,
nullptr);
4310 RC =
TRI->getRegClass(Mips::MSACtrlRegClassID);
4311 return std::make_pair(
Reg, RC);
4315 return std::make_pair(0U,
nullptr);
4317 if (Prefix ==
"$f") {
4322 if (VT == MVT::Other) {
4326 VT = (
Subtarget.isFP64bit() || !(
Reg % 2)) ? MVT::f64 : MVT::f32;
4331 if (RC == &Mips::AFGR64RegClass) {
4335 }
else if (Prefix ==
"$fcc")
4336 RC =
TRI->getRegClass(Mips::FCCRegClassID);
4337 else if (Prefix ==
"$w") {
4345 return std::make_pair(*(RC->
begin() +
Reg), RC);
4351std::pair<unsigned, const TargetRegisterClass *>
4355 if (Constraint.
size() == 1) {
4356 switch (Constraint[0]) {
4360 if ((VT == MVT::i32 || VT == MVT::i16 || VT == MVT::i8 ||
4362 (VT == MVT::f32 &&
Subtarget.useSoftFloat())) {
4364 return std::make_pair(0U, &Mips::CPU16RegsRegClass);
4365 return std::make_pair(0U, &Mips::GPR32RegClass);
4367 if ((VT == MVT::i64 || (VT == MVT::f64 &&
Subtarget.useSoftFloat()) ||
4368 (VT == MVT::f64 &&
Subtarget.isSingleFloat())) &&
4370 return std::make_pair(0U, &Mips::GPR32RegClass);
4371 if ((VT == MVT::i64 || (VT == MVT::f64 &&
Subtarget.useSoftFloat()) ||
4372 (VT == MVT::f64 &&
Subtarget.isSingleFloat())) &&
4374 return std::make_pair(0U, &Mips::GPR64RegClass);
4376 return std::make_pair(0U,
nullptr);
4378 if (VT == MVT::v16i8)
4379 return std::make_pair(0U, &Mips::MSA128BRegClass);
4380 else if (VT == MVT::v8i16 || VT == MVT::v8f16)
4381 return std::make_pair(0U, &Mips::MSA128HRegClass);
4382 else if (VT == MVT::v4i32 || VT == MVT::v4f32)
4383 return std::make_pair(0U, &Mips::MSA128WRegClass);
4384 else if (VT == MVT::v2i64 || VT == MVT::v2f64)
4385 return std::make_pair(0U, &Mips::MSA128DRegClass);
4386 else if (VT == MVT::f32)
4387 return std::make_pair(0U, &Mips::FGR32RegClass);
4388 else if ((VT == MVT::f64) && (!
Subtarget.isSingleFloat())) {
4390 return std::make_pair(0U, &Mips::FGR64RegClass);
4391 return std::make_pair(0U, &Mips::AFGR64RegClass);
4396 return std::make_pair((
unsigned)Mips::T9, &Mips::GPR32RegClass);
4398 return std::make_pair((
unsigned)Mips::T9_64, &Mips::GPR64RegClass);
4400 return std::make_pair(0U,
nullptr);
4403 if (VT == MVT::i32 || VT == MVT::i16 || VT == MVT::i8)
4404 return std::make_pair((
unsigned)Mips::LO0, &Mips::LO32RegClass);
4405 return std::make_pair((
unsigned)Mips::LO0_64, &Mips::LO64RegClass);
4410 return std::make_pair(0U,
nullptr);
4414 if (!Constraint.
empty()) {
4415 std::pair<unsigned, const TargetRegisterClass *>
R;
4416 R = parseRegForInlineAsmConstraint(Constraint, VT);
4427void MipsTargetLowering::LowerAsmOperandForConstraint(
SDValue Op,
4429 std::vector<SDValue> &
Ops,
4435 if (Constraint.
size() > 1)
4438 char ConstraintLetter = Constraint[0];
4439 switch (ConstraintLetter) {
4444 EVT
Type =
Op.getValueType();
4445 int64_t Val =
C->getSExtValue();
4454 EVT
Type =
Op.getValueType();
4455 int64_t Val =
C->getZExtValue();
4464 EVT
Type =
Op.getValueType();
4465 uint64_t Val =
C->getZExtValue();
4474 EVT
Type =
Op.getValueType();
4475 int64_t Val =
C->getSExtValue();
4476 if ((
isInt<32>(Val)) && ((Val & 0xffff) == 0)){
4484 EVT
Type =
Op.getValueType();
4485 int64_t Val =
C->getSExtValue();
4486 if ((Val >= -65535) && (Val <= -1)) {
4494 EVT
Type =
Op.getValueType();
4495 int64_t Val =
C->getSExtValue();
4504 EVT
Type =
Op.getValueType();
4505 int64_t Val =
C->getSExtValue();
4506 if ((Val <= 65535) && (Val >= 1)) {
4515 Ops.push_back(Result);
4522bool MipsTargetLowering::isLegalAddressingMode(
const DataLayout &
DL,
4550EVT MipsTargetLowering::getOptimalMemOpType(
4552 const AttributeList &FuncAttributes)
const {
4559bool MipsTargetLowering::isFPImmLegal(
const APFloat &Imm,
EVT VT,
4560 bool ForCodeSize)
const {
4561 if (VT != MVT::f32 && VT != MVT::f64)
4563 if (
Imm.isNegZero())
4565 return Imm.isZero();
4568bool MipsTargetLowering::isLegalICmpImmediate(int64_t Imm)
const {
4572bool MipsTargetLowering::isLegalAddImmediate(int64_t Imm)
const {
4584SDValue MipsTargetLowering::getPICJumpTableRelocBase(
SDValue Table,
4595void MipsTargetLowering::copyByValRegs(
4599 unsigned FirstReg,
unsigned LastReg,
const CCValAssign &VA,
4603 unsigned GPRSizeInBytes =
Subtarget.getGPRSizeInBytes();
4604 unsigned NumRegs = LastReg - FirstReg;
4605 unsigned RegAreaSize = NumRegs * GPRSizeInBytes;
4606 unsigned FrameObjSize = std::max(
Flags.getByValSize(), RegAreaSize);
4613 (int)((ByValArgRegs.
size() - FirstReg) * GPRSizeInBytes);
4635 for (
unsigned I = 0;
I < NumRegs; ++
I) {
4636 unsigned ArgReg = ByValArgRegs[FirstReg +
I];
4637 unsigned VReg =
addLiveIn(MF, ArgReg, RC);
4638 unsigned Offset =
I * GPRSizeInBytes;
4642 StorePtr, MachinePointerInfo(FuncArg,
Offset));
4643 OutChains.push_back(Store);
4648void MipsTargetLowering::passByValArg(
4650 std::deque<std::pair<unsigned, SDValue>> &RegsToPass,
4655 unsigned ByValSizeInBytes =
Flags.getByValSize();
4656 unsigned OffsetInBytes = 0;
4657 unsigned RegSizeInBytes =
Subtarget.getGPRSizeInBytes();
4659 std::min(
Flags.getNonZeroByValAlign(),
Align(RegSizeInBytes));
4662 unsigned NumRegs = LastReg - FirstReg;
4666 bool LeftoverBytes = (NumRegs * RegSizeInBytes > ByValSizeInBytes);
4670 for (;
I < NumRegs - LeftoverBytes; ++
I, OffsetInBytes += RegSizeInBytes) {
4674 MachinePointerInfo(), Alignment);
4676 unsigned ArgReg = ArgRegs[FirstReg +
I];
4677 RegsToPass.push_back(std::make_pair(ArgReg, LoadVal));
4681 if (ByValSizeInBytes == OffsetInBytes)
4685 if (LeftoverBytes) {
4688 for (
unsigned LoadSizeInBytes = RegSizeInBytes / 2, TotalBytesLoaded = 0;
4689 OffsetInBytes < ByValSizeInBytes; LoadSizeInBytes /= 2) {
4690 unsigned RemainingSizeInBytes = ByValSizeInBytes - OffsetInBytes;
4692 if (RemainingSizeInBytes < LoadSizeInBytes)
4708 Shamt = TotalBytesLoaded * 8;
4710 Shamt = (RegSizeInBytes - (TotalBytesLoaded + LoadSizeInBytes)) * 8;
4720 OffsetInBytes += LoadSizeInBytes;
4721 TotalBytesLoaded += LoadSizeInBytes;
4722 Alignment = std::min(Alignment,
Align(LoadSizeInBytes));
4725 unsigned ArgReg = ArgRegs[FirstReg +
I];
4726 RegsToPass.push_back(std::make_pair(ArgReg, Val));
4732 unsigned MemCpySize = ByValSizeInBytes - OffsetInBytes;
4739 Align(Alignment),
false,
false,
4740 nullptr, std::nullopt, MachinePointerInfo(), MachinePointerInfo());
4744void MipsTargetLowering::writeVarArgRegs(std::vector<SDValue> &OutChains,
4750 unsigned RegSizeInBytes =
Subtarget.getGPRSizeInBytes();
4755 MipsFunctionInfo *MipsFI = MF.
getInfo<MipsFunctionInfo>();
4760 if (ArgRegs.
size() == Idx)
4765 (int)(RegSizeInBytes * (ArgRegs.
size() - Idx));
4777 for (
unsigned I = Idx;
I < ArgRegs.
size();
4778 ++
I, VaArgOffset += RegSizeInBytes) {
4784 DAG.
getStore(Chain,
DL, ArgValue, PtrOff, MachinePointerInfo());
4787 OutChains.push_back(Store);
4792 Align Alignment)
const {
4795 assert(
Size &&
"Byval argument's size shouldn't be 0.");
4799 unsigned FirstReg = 0;
4800 unsigned NumRegs = 0;
4803 unsigned RegSizeInBytes =
Subtarget.getGPRSizeInBytes();
4812 Alignment >=
Align(RegSizeInBytes) &&
4813 "Byval argument's alignment should be a multiple of RegSizeInBytes.");
4815 FirstReg = State->getFirstUnallocated(IntArgRegs);
4821 if ((Alignment > RegSizeInBytes) && (FirstReg % 2)) {
4822 State->AllocateReg(IntArgRegs[FirstReg], ShadowRegs[FirstReg]);
4828 for (
unsigned I = FirstReg;
Size > 0 && (
I < IntArgRegs.
size());
4829 Size -= RegSizeInBytes, ++
I, ++NumRegs)
4830 State->AllocateReg(IntArgRegs[
I], ShadowRegs[
I]);
4833 State->addInRegsParamInfo(FirstReg, FirstReg + NumRegs);
4839 unsigned Opc)
const {
4841 "Subtarget already supports SELECT nodes with the use of"
4842 "conditional-move instructions.");
4865 F->insert(It, copy0MBB);
4866 F->insert(It, sinkMBB);
4909 MI.eraseFromParent();
4918 "Subtarget already supports SELECT nodes with the use of"
4919 "conditional-move instructions.");
4938 MachineBasicBlock *thisMBB = BB;
4940 MachineBasicBlock *copy0MBB =
F->CreateMachineBasicBlock(LLVM_BB);
4941 MachineBasicBlock *sinkMBB =
F->CreateMachineBasicBlock(LLVM_BB);
4943 F->insert(It, sinkMBB);
4985 MI.eraseFromParent();
4998 .
Case(
"$28", Mips::GP_64)
4999 .
Case(
"sp", Mips::SP_64)
5005 .
Case(
"$28", Mips::GP)
5006 .
Case(
"sp", Mips::SP)
5021 unsigned Imm =
MI.getOperand(2).getImm();
5027 Register Temp =
MRI.createVirtualRegister(&Mips::GPR32RegClass);
5036 Register LoadHalf =
MRI.createVirtualRegister(&Mips::GPR32RegClass);
5037 Register LoadFull =
MRI.createVirtualRegister(&Mips::GPR32RegClass);
5038 Register Undef =
MRI.createVirtualRegister(&Mips::GPR32RegClass);
5043 .
addImm(Imm + (IsLittle ? 0 : 3))
5048 .
addImm(Imm + (IsLittle ? 3 : 0))
5053 MI.eraseFromParent();
5062 const bool IsLittle =
Subtarget.isLittle();
5067 unsigned Imm =
MI.getOperand(2).getImm();
5074 Register Temp =
MRI.createVirtualRegister(&Mips::GPR64RegClass);
5081 Register Wtemp =
MRI.createVirtualRegister(&Mips::MSA128WRegClass);
5082 Register Lo =
MRI.createVirtualRegister(&Mips::GPR32RegClass);
5083 Register Hi =
MRI.createVirtualRegister(&Mips::GPR32RegClass);
5087 .
addImm(Imm + (IsLittle ? 0 : 4));
5091 .
addImm(Imm + (IsLittle ? 4 : 0));
5101 Register LoHalf =
MRI.createVirtualRegister(&Mips::GPR32RegClass);
5102 Register LoFull =
MRI.createVirtualRegister(&Mips::GPR32RegClass);
5103 Register LoUndef =
MRI.createVirtualRegister(&Mips::GPR32RegClass);
5104 Register HiHalf =
MRI.createVirtualRegister(&Mips::GPR32RegClass);
5105 Register HiFull =
MRI.createVirtualRegister(&Mips::GPR32RegClass);
5106 Register HiUndef =
MRI.createVirtualRegister(&Mips::GPR32RegClass);
5107 Register Wtemp =
MRI.createVirtualRegister(&Mips::MSA128WRegClass);
5112 .
addImm(Imm + (IsLittle ? 0 : 7))
5117 .
addImm(Imm + (IsLittle ? 3 : 4))
5123 .
addImm(Imm + (IsLittle ? 4 : 3))
5128 .
addImm(Imm + (IsLittle ? 7 : 0))
5137 MI.eraseFromParent();
5146 const bool IsLittle =
Subtarget.isLittle();
5149 Register StoreVal =
MI.getOperand(0).getReg();
5151 unsigned Imm =
MI.getOperand(2).getImm();
5157 Register BitcastW =
MRI.createVirtualRegister(&Mips::MSA128WRegClass);
5158 Register Tmp =
MRI.createVirtualRegister(&Mips::GPR32RegClass);
5171 Register Tmp =
MRI.createVirtualRegister(&Mips::GPR32RegClass);
5179 .
addImm(Imm + (IsLittle ? 0 : 3));
5183 .
addImm(Imm + (IsLittle ? 3 : 0));
5186 MI.eraseFromParent();
5196 const bool IsLittle =
Subtarget.isLittle();
5199 Register StoreVal =
MI.getOperand(0).getReg();
5201 unsigned Imm =
MI.getOperand(2).getImm();
5208 Register BitcastD =
MRI.createVirtualRegister(&Mips::MSA128DRegClass);
5209 Register Lo =
MRI.createVirtualRegister(&Mips::GPR64RegClass);
5222 Register BitcastW =
MRI.createVirtualRegister(&Mips::MSA128WRegClass);
5223 Register Lo =
MRI.createVirtualRegister(&Mips::GPR32RegClass);
5224 Register Hi =
MRI.createVirtualRegister(&Mips::GPR32RegClass);
5239 .
addImm(Imm + (IsLittle ? 0 : 4));
5243 .
addImm(Imm + (IsLittle ? 4 : 0));
5249 Register Lo =
MRI.createVirtualRegister(&Mips::GPR32RegClass);
5250 Register Hi =
MRI.createVirtualRegister(&Mips::GPR32RegClass);
5263 .
addImm(Imm + (IsLittle ? 0 : 3));
5267 .
addImm(Imm + (IsLittle ? 3 : 0));
5271 .
addImm(Imm + (IsLittle ? 4 : 7));
5275 .
addImm(Imm + (IsLittle ? 7 : 4));
5278 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, const AArch64Subtarget *Subtarget, const AArch64TargetLowering &TLI)
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
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 cl::opt< bool > NoZeroDivCheck("mno-check-zero-division", cl::Hidden, cl::desc("MIPS: Don't trap on integer division by zero."), cl::init(false))
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)
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.
LLVM_ABI bool isIndirectCall() const
Return true if the callsite is an indirect call.
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 hasDLLImportStorageClass() const
LLVM_ABI const GlobalObject * getAliaseeObject() const
bool hasInternalLinkage() 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...
This class is used to represent ISD::LOAD nodes.
LLVM_ABI MCSymbol * getOrCreateSymbol(const Twine &Name)
Lookup the symbol inside with the specified Name.
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 & addImm(int64_t Val) const
Add a new immediate operand.
const MachineInstrBuilder & addReg(Register RegNo, unsigned flags=0, unsigned SubReg=0) const
Add a new virtual register operand.
const MachineInstrBuilder & addMBB(MachineBasicBlock *MBB, unsigned TargetFlags=0) const
const MachineInstrBuilder & addUse(Register RegNo, unsigned Flags=0, unsigned SubReg=0) const
Add a virtual register use operand.
const MachineInstrBuilder & addDef(Register RegNo, unsigned Flags=0, 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 a 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.
const char * getTargetNodeName(unsigned Opcode) const override
getTargetNodeName - This method returns the name of a target specific
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
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...
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
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
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),...
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...
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.
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 bool empty() const
empty - Check if the string is empty.
const char * const_iterator
constexpr size_t size() const
size - Get the string size.
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 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...
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 NoNaNsFPMath
NoNaNsFPMath - This flag is enabled when the -enable-no-nans-fp-math flag is specified on the command...
unsigned EnableFastISel
EnableFastISel - This flag enables fast-path instruction selection which trades away generated code q...
unsigned EmitCallGraphSection
Emit section containing call graph metadata.
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...
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.
@ STRICT_FSETCC
STRICT_FSETCC/STRICT_FSETCCS - Constrained versions of SETCC, used for floating-point operands only.
@ BSWAP
Byte Swap and Counting operators.
@ ADD
Simple integer binary arithmetic operators.
@ 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.
@ SDIVREM
SDIVREM/UDIVREM - Divide two integers and produce both a quotient and remainder result.
@ 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.
@ 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).
@ BasicBlock
Various leaf nodes.
@ SHL
Shift and rotation operations.
@ 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) ...
@ 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.
@ AND
Bitwise operators - logical and, logical or, logical xor.
@ TokenFactor
TokenFactor - This node takes multiple tokens as input and produces a single token result.
@ TRUNCATE
TRUNCATE - Completely drop the high bits.
@ 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.
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)
@ Implicit
Not emitted register (e.g. carry, or temporary result).
@ Define
Register definition.
@ Kill
The last use of a register.
@ EarlyClobber
Register definition happens before uses.
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.
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.
unsigned getKillRegState(bool B)
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