79#define DEBUG_TYPE "mips-lower"
84 Mips::D12_64, Mips::D13_64, Mips::D14_64, Mips::D15_64,
85 Mips::D16_64, Mips::D17_64, Mips::D18_64, Mips::D19_64
122 unsigned &NumIntermediates,
MVT &RegisterVT)
const {
127 return NumIntermediates;
143 unsigned Flag)
const {
149 unsigned Flag)
const {
155 unsigned Flag)
const {
161 unsigned Flag)
const {
167 unsigned Flag)
const {
169 N->getOffset(), Flag);
439 isMicroMips =
Subtarget.inMicroMipsMode();
465 if (!TM.isPositionIndependent() || !
Subtarget.getABI().IsO32() ||
486 EVT Ty =
N->getValueType(0);
487 unsigned LO = (Ty == MVT::i32) ? Mips::LO0 : Mips::LO0_64;
488 unsigned HI = (Ty == MVT::i32) ? Mips::HI0 : Mips::HI0_64;
494 N->getOperand(0),
N->getOperand(1));
499 if (
N->hasAnyUseOfValue(0)) {
508 if (
N->hasAnyUseOfValue(1)) {
550 "Illegal Condition Code");
565 if (!
LHS.getValueType().isFloatingPoint())
586 return DAG.
getNode((invert ? MipsISD::CMovFP_F : MipsISD::CMovFP_T),
DL,
602 EVT VT =
N->getValueType(0);
607 EVT XVT =
X.getValueType();
630 if (
Subtarget.hasMips64r6() && FalseTy == MVT::i64 &&
632 LHS.getOperand(0).getValueType() == MVT::i64 &&
673 if (!TrueC || !
True.getValueType().isInteger())
679 if (
True.getValueType() == MVT::i64)
712 SDValue ValueIfTrue =
N->getOperand(0), ValueIfFalse =
N->getOperand(2);
725 unsigned Opc = (
N->getOpcode() == MipsISD::CMovFP_T) ? MipsISD::CMovFP_F :
728 SDValue FCC =
N->getOperand(1), Glue =
N->getOperand(3);
730 ValueIfFalse, FCC, ValueIfTrue, Glue);
739 SDValue FirstOperand =
N->getOperand(0);
740 unsigned FirstOperandOpc = FirstOperand.
getOpcode();
742 EVT ValTy =
N->getValueType(0);
746 unsigned SMPos, SMSize;
787 if (SMPos != Pos || Pos >= ValTy.
getSizeInBits() || SMSize >= 32 ||
809 NewOperand = FirstOperand;
822 SDValue FirstOperand =
N->getOperand(0), SecondOperand =
N->getOperand(1);
823 unsigned SMPos0, SMSize0, SMPos1, SMSize1;
827 SecondOperand.getOpcode() ==
ISD::SHL) ||
829 SecondOperand.getOpcode() ==
ISD::AND)) {
840 ? SecondOperand.getOperand(0)
850 ? SecondOperand.getOperand(1)
856 if (SMPos0 != 0 || SMSize0 != ShlShiftValue)
860 EVT ValTy =
N->getValueType(0);
861 SMPos1 = ShlShiftValue;
863 SMSize1 = (ValTy == MVT::i64 ? 64 : 32) - SMPos1;
864 return DAG.
getNode(MipsISD::Ins,
DL, ValTy, ShlOperand0,
882 if (SecondOperand.getOpcode() ==
ISD::AND &&
883 SecondOperand.getOperand(0).getOpcode() ==
ISD::SHL) {
890 if (SMPos0 != SMPos1 || SMSize0 != SMSize1)
902 EVT ValTy =
N->getValueType(0);
903 if ((Shamt != SMPos0) || (SMPos0 + SMSize0 > ValTy.
getSizeInBits()))
918 ((SMSize0 + SMPos0 <= 64 &&
Subtarget.hasMips64r2()) ||
919 (SMSize0 + SMPos0 <= 32))) {
921 bool isConstCase = SecondOperand.getOpcode() !=
ISD::AND;
922 if (SecondOperand.getOpcode() ==
ISD::AND) {
935 EVT ValTy =
N->getOperand(0)->getValueType(0);
941 SecondOperand, Const1);
944 MipsISD::Ins,
DL,
N->getValueType(0),
1026 if (!IsSigned && !IsUnsigned)
1032 std::tie(BottomHalf, TopHalf) =
1035 CurDAG.
getNode(MipsISD::MTLOHI,
DL, MVT::Untyped, BottomHalf, TopHalf);
1039 unsigned Opcode = IsAdd ? (IsUnsigned ? MipsISD::MAddu : MipsISD::MAdd)
1040 : (IsUnsigned ? MipsISD::MSubu : MipsISD::MSub);
1059 !
Subtarget.inMips16Mode() &&
N->getValueType(0) == MVT::i64)
1074 !
Subtarget.inMips16Mode() &&
N->getValueType(0) == MVT::i64)
1084 SDValue InnerAdd =
N->getOperand(1);
1093 if (
Lo.getOpcode() != MipsISD::Lo)
1096 if ((
Lo.getOpcode() != MipsISD::Lo) ||
1100 EVT ValTy =
N->getValueType(0);
1117 SDValue FirstOperand =
N->getOperand(0);
1118 unsigned FirstOperandOpc = FirstOperand.
getOpcode();
1119 SDValue SecondOperand =
N->getOperand(1);
1120 EVT ValTy =
N->getValueType(0);
1124 unsigned SMPos, SMSize;
1147 if (SMPos != 0 || SMSize > 32 || Pos + SMSize > ValTy.
getSizeInBits())
1154 return DAG.
getNode(MipsISD::CIns,
DL, ValTy, NewOperand,
1167 EVT VT =
N->getValueType(0);
1196 int64_t ConstImm = ConstantOperand->getSExtValue();
1207 unsigned Opc =
N->getOpcode();
1216 case MipsISD::CMovFP_F:
1217 case MipsISD::CMovFP_T:
1249 return C->getAPIntValue().ule(15);
1257 N->getOperand(0).getOpcode() ==
ISD::SRL) ||
1259 N->getOperand(0).getOpcode() ==
ISD::SHL)) &&
1260 "Expected shift-shift mask");
1262 if (
N->getOperand(0).getValueType().isVector())
1277 switch (
Op.getOpcode())
1289 return lowerFSETCC(
Op, DAG);
1295 return lowerFNEG(
Op, DAG);
1297 return lowerFCANONICALIZE(
Op, DAG);
1310 return lowerSTRICT_FP_TO_INT(
Op, DAG);
1312 return lowerGET_ROUNDING(
Op, DAG);
1314 return lowerSET_ROUNDING(
Op, DAG);
1317 return lowerREADCYCLECOUNTER(
Op, DAG);
1319 return lowerConstantFP(
Op, DAG);
1343 if (MCCLOpts.mno_check_zero_division)
1368 MF->
insert(++
MBB.getIterator(), BreakMBB);
1381 MBB.addSuccessor(BreakMBB);
1415 switch (
MI.getOpcode()) {
1418 case Mips::ATOMIC_LOAD_ADD_I8:
1419 return emitAtomicBinaryPartword(
MI, BB, 1);
1420 case Mips::ATOMIC_LOAD_ADD_I16:
1421 return emitAtomicBinaryPartword(
MI, BB, 2);
1422 case Mips::ATOMIC_LOAD_ADD_I32:
1423 return emitAtomicBinary(
MI, BB);
1424 case Mips::ATOMIC_LOAD_ADD_I64:
1425 return emitAtomicBinary(
MI, BB);
1427 case Mips::ATOMIC_LOAD_AND_I8:
1428 return emitAtomicBinaryPartword(
MI, BB, 1);
1429 case Mips::ATOMIC_LOAD_AND_I16:
1430 return emitAtomicBinaryPartword(
MI, BB, 2);
1431 case Mips::ATOMIC_LOAD_AND_I32:
1432 return emitAtomicBinary(
MI, BB);
1433 case Mips::ATOMIC_LOAD_AND_I64:
1434 return emitAtomicBinary(
MI, BB);
1436 case Mips::ATOMIC_LOAD_OR_I8:
1437 return emitAtomicBinaryPartword(
MI, BB, 1);
1438 case Mips::ATOMIC_LOAD_OR_I16:
1439 return emitAtomicBinaryPartword(
MI, BB, 2);
1440 case Mips::ATOMIC_LOAD_OR_I32:
1441 return emitAtomicBinary(
MI, BB);
1442 case Mips::ATOMIC_LOAD_OR_I64:
1443 return emitAtomicBinary(
MI, BB);
1445 case Mips::ATOMIC_LOAD_XOR_I8:
1446 return emitAtomicBinaryPartword(
MI, BB, 1);
1447 case Mips::ATOMIC_LOAD_XOR_I16:
1448 return emitAtomicBinaryPartword(
MI, BB, 2);
1449 case Mips::ATOMIC_LOAD_XOR_I32:
1450 return emitAtomicBinary(
MI, BB);
1451 case Mips::ATOMIC_LOAD_XOR_I64:
1452 return emitAtomicBinary(
MI, BB);
1454 case Mips::ATOMIC_LOAD_NAND_I8:
1455 return emitAtomicBinaryPartword(
MI, BB, 1);
1456 case Mips::ATOMIC_LOAD_NAND_I16:
1457 return emitAtomicBinaryPartword(
MI, BB, 2);
1458 case Mips::ATOMIC_LOAD_NAND_I32:
1459 return emitAtomicBinary(
MI, BB);
1460 case Mips::ATOMIC_LOAD_NAND_I64:
1461 return emitAtomicBinary(
MI, BB);
1463 case Mips::ATOMIC_LOAD_SUB_I8:
1464 return emitAtomicBinaryPartword(
MI, BB, 1);
1465 case Mips::ATOMIC_LOAD_SUB_I16:
1466 return emitAtomicBinaryPartword(
MI, BB, 2);
1467 case Mips::ATOMIC_LOAD_SUB_I32:
1468 return emitAtomicBinary(
MI, BB);
1469 case Mips::ATOMIC_LOAD_SUB_I64:
1470 return emitAtomicBinary(
MI, BB);
1472 case Mips::ATOMIC_SWAP_I8:
1473 return emitAtomicBinaryPartword(
MI, BB, 1);
1474 case Mips::ATOMIC_SWAP_I16:
1475 return emitAtomicBinaryPartword(
MI, BB, 2);
1476 case Mips::ATOMIC_SWAP_I32:
1477 return emitAtomicBinary(
MI, BB);
1478 case Mips::ATOMIC_SWAP_I64:
1479 return emitAtomicBinary(
MI, BB);
1481 case Mips::ATOMIC_CMP_SWAP_I8:
1482 return emitAtomicCmpSwapPartword(
MI, BB, 1);
1483 case Mips::ATOMIC_CMP_SWAP_I16:
1484 return emitAtomicCmpSwapPartword(
MI, BB, 2);
1485 case Mips::ATOMIC_CMP_SWAP_I32:
1486 return emitAtomicCmpSwap(
MI, BB);
1487 case Mips::ATOMIC_CMP_SWAP_I64:
1488 return emitAtomicCmpSwap(
MI, BB);
1490 case Mips::ATOMIC_LOAD_MIN_I8:
1491 return emitAtomicBinaryPartword(
MI, BB, 1);
1492 case Mips::ATOMIC_LOAD_MIN_I16:
1493 return emitAtomicBinaryPartword(
MI, BB, 2);
1494 case Mips::ATOMIC_LOAD_MIN_I32:
1495 return emitAtomicBinary(
MI, BB);
1496 case Mips::ATOMIC_LOAD_MIN_I64:
1497 return emitAtomicBinary(
MI, BB);
1499 case Mips::ATOMIC_LOAD_MAX_I8:
1500 return emitAtomicBinaryPartword(
MI, BB, 1);
1501 case Mips::ATOMIC_LOAD_MAX_I16:
1502 return emitAtomicBinaryPartword(
MI, BB, 2);
1503 case Mips::ATOMIC_LOAD_MAX_I32:
1504 return emitAtomicBinary(
MI, BB);
1505 case Mips::ATOMIC_LOAD_MAX_I64:
1506 return emitAtomicBinary(
MI, BB);
1508 case Mips::ATOMIC_LOAD_UMIN_I8:
1509 return emitAtomicBinaryPartword(
MI, BB, 1);
1510 case Mips::ATOMIC_LOAD_UMIN_I16:
1511 return emitAtomicBinaryPartword(
MI, BB, 2);
1512 case Mips::ATOMIC_LOAD_UMIN_I32:
1513 return emitAtomicBinary(
MI, BB);
1514 case Mips::ATOMIC_LOAD_UMIN_I64:
1515 return emitAtomicBinary(
MI, BB);
1517 case Mips::ATOMIC_LOAD_UMAX_I8:
1518 return emitAtomicBinaryPartword(
MI, BB, 1);
1519 case Mips::ATOMIC_LOAD_UMAX_I16:
1520 return emitAtomicBinaryPartword(
MI, BB, 2);
1521 case Mips::ATOMIC_LOAD_UMAX_I32:
1522 return emitAtomicBinary(
MI, BB);
1523 case Mips::ATOMIC_LOAD_UMAX_I64:
1524 return emitAtomicBinary(
MI, BB);
1526 case Mips::PseudoSDIV:
1527 case Mips::PseudoUDIV:
1536 *
Subtarget.getInstrInfo(),
false, TrapKind);
1538 case Mips::SDIV_MM_Pseudo:
1539 case Mips::UDIV_MM_Pseudo:
1542 case Mips::DIV_MMR6:
1543 case Mips::DIVU_MMR6:
1544 case Mips::MOD_MMR6:
1545 case Mips::MODU_MMR6:
1549 case Mips::PseudoDSDIV:
1550 case Mips::PseudoDUDIV:
1559 case Mips::PseudoSELECT_I:
1560 case Mips::PseudoSELECT_I64:
1561 case Mips::PseudoSELECT_S:
1562 case Mips::PseudoSELECT_D32:
1563 case Mips::PseudoSELECT_D64:
1564 return emitPseudoSELECT(
MI, BB,
false, Mips::BNE);
1565 case Mips::PseudoSELECTFP_F_I:
1566 case Mips::PseudoSELECTFP_F_I64:
1567 case Mips::PseudoSELECTFP_F_S:
1568 case Mips::PseudoSELECTFP_F_D32:
1569 case Mips::PseudoSELECTFP_F_D64:
1570 return emitPseudoSELECT(
MI, BB,
true, Mips::BC1F);
1571 case Mips::PseudoSELECTFP_T_I:
1572 case Mips::PseudoSELECTFP_T_I64:
1573 case Mips::PseudoSELECTFP_T_S:
1574 case Mips::PseudoSELECTFP_T_D32:
1575 case Mips::PseudoSELECTFP_T_D64:
1576 return emitPseudoSELECT(
MI, BB,
true, Mips::BC1T);
1577 case Mips::PseudoD_SELECT_I:
1578 case Mips::PseudoD_SELECT_I64:
1579 return emitPseudoD_SELECT(
MI, BB);
1581 return emitLDR_W(
MI, BB);
1583 return emitLDR_D(
MI, BB);
1585 return emitSTR_W(
MI, BB);
1587 return emitSTR_D(
MI, BB);
1603 bool NeedsAdditionalReg =
false;
1604 switch (
MI.getOpcode()) {
1605 case Mips::ATOMIC_LOAD_ADD_I32:
1606 AtomicOp = Mips::ATOMIC_LOAD_ADD_I32_POSTRA;
1608 case Mips::ATOMIC_LOAD_SUB_I32:
1609 AtomicOp = Mips::ATOMIC_LOAD_SUB_I32_POSTRA;
1611 case Mips::ATOMIC_LOAD_AND_I32:
1612 AtomicOp = Mips::ATOMIC_LOAD_AND_I32_POSTRA;
1614 case Mips::ATOMIC_LOAD_OR_I32:
1615 AtomicOp = Mips::ATOMIC_LOAD_OR_I32_POSTRA;
1617 case Mips::ATOMIC_LOAD_XOR_I32:
1618 AtomicOp = Mips::ATOMIC_LOAD_XOR_I32_POSTRA;
1620 case Mips::ATOMIC_LOAD_NAND_I32:
1621 AtomicOp = Mips::ATOMIC_LOAD_NAND_I32_POSTRA;
1623 case Mips::ATOMIC_SWAP_I32:
1624 AtomicOp = Mips::ATOMIC_SWAP_I32_POSTRA;
1626 case Mips::ATOMIC_LOAD_ADD_I64:
1627 AtomicOp = Mips::ATOMIC_LOAD_ADD_I64_POSTRA;
1629 case Mips::ATOMIC_LOAD_SUB_I64:
1630 AtomicOp = Mips::ATOMIC_LOAD_SUB_I64_POSTRA;
1632 case Mips::ATOMIC_LOAD_AND_I64:
1633 AtomicOp = Mips::ATOMIC_LOAD_AND_I64_POSTRA;
1635 case Mips::ATOMIC_LOAD_OR_I64:
1636 AtomicOp = Mips::ATOMIC_LOAD_OR_I64_POSTRA;
1638 case Mips::ATOMIC_LOAD_XOR_I64:
1639 AtomicOp = Mips::ATOMIC_LOAD_XOR_I64_POSTRA;
1641 case Mips::ATOMIC_LOAD_NAND_I64:
1642 AtomicOp = Mips::ATOMIC_LOAD_NAND_I64_POSTRA;
1644 case Mips::ATOMIC_SWAP_I64:
1645 AtomicOp = Mips::ATOMIC_SWAP_I64_POSTRA;
1647 case Mips::ATOMIC_LOAD_MIN_I32:
1648 AtomicOp = Mips::ATOMIC_LOAD_MIN_I32_POSTRA;
1649 NeedsAdditionalReg =
true;
1651 case Mips::ATOMIC_LOAD_MAX_I32:
1652 AtomicOp = Mips::ATOMIC_LOAD_MAX_I32_POSTRA;
1653 NeedsAdditionalReg =
true;
1655 case Mips::ATOMIC_LOAD_UMIN_I32:
1656 AtomicOp = Mips::ATOMIC_LOAD_UMIN_I32_POSTRA;
1657 NeedsAdditionalReg =
true;
1659 case Mips::ATOMIC_LOAD_UMAX_I32:
1660 AtomicOp = Mips::ATOMIC_LOAD_UMAX_I32_POSTRA;
1661 NeedsAdditionalReg =
true;
1663 case Mips::ATOMIC_LOAD_MIN_I64:
1664 AtomicOp = Mips::ATOMIC_LOAD_MIN_I64_POSTRA;
1665 NeedsAdditionalReg =
true;
1667 case Mips::ATOMIC_LOAD_MAX_I64:
1668 AtomicOp = Mips::ATOMIC_LOAD_MAX_I64_POSTRA;
1669 NeedsAdditionalReg =
true;
1671 case Mips::ATOMIC_LOAD_UMIN_I64:
1672 AtomicOp = Mips::ATOMIC_LOAD_UMIN_I64_POSTRA;
1673 NeedsAdditionalReg =
true;
1675 case Mips::ATOMIC_LOAD_UMAX_I64:
1676 AtomicOp = Mips::ATOMIC_LOAD_UMAX_I64_POSTRA;
1677 NeedsAdditionalReg =
true;
1738 if (NeedsAdditionalReg) {
1745 MI.eraseFromParent();
1752 unsigned SrcReg)
const {
1767 MachineRegisterInfo &RegInfo = MF->
getRegInfo();
1772 int64_t ShiftImm = 32 - (
Size * 8);
1783 "Unsupported size for EmitAtomicBinaryPartial.");
1786 MachineRegisterInfo &RegInfo = MF->
getRegInfo();
1788 const bool ArePtrs64bit =
ABI.ArePtrs64bit();
1810 unsigned AtomicOp = 0;
1811 bool NeedsAdditionalReg =
false;
1812 switch (
MI.getOpcode()) {
1813 case Mips::ATOMIC_LOAD_NAND_I8:
1814 AtomicOp = Mips::ATOMIC_LOAD_NAND_I8_POSTRA;
1816 case Mips::ATOMIC_LOAD_NAND_I16:
1817 AtomicOp = Mips::ATOMIC_LOAD_NAND_I16_POSTRA;
1819 case Mips::ATOMIC_SWAP_I8:
1820 AtomicOp = Mips::ATOMIC_SWAP_I8_POSTRA;
1822 case Mips::ATOMIC_SWAP_I16:
1823 AtomicOp = Mips::ATOMIC_SWAP_I16_POSTRA;
1825 case Mips::ATOMIC_LOAD_ADD_I8:
1826 AtomicOp = Mips::ATOMIC_LOAD_ADD_I8_POSTRA;
1828 case Mips::ATOMIC_LOAD_ADD_I16:
1829 AtomicOp = Mips::ATOMIC_LOAD_ADD_I16_POSTRA;
1831 case Mips::ATOMIC_LOAD_SUB_I8:
1832 AtomicOp = Mips::ATOMIC_LOAD_SUB_I8_POSTRA;
1834 case Mips::ATOMIC_LOAD_SUB_I16:
1835 AtomicOp = Mips::ATOMIC_LOAD_SUB_I16_POSTRA;
1837 case Mips::ATOMIC_LOAD_AND_I8:
1838 AtomicOp = Mips::ATOMIC_LOAD_AND_I8_POSTRA;
1840 case Mips::ATOMIC_LOAD_AND_I16:
1841 AtomicOp = Mips::ATOMIC_LOAD_AND_I16_POSTRA;
1843 case Mips::ATOMIC_LOAD_OR_I8:
1844 AtomicOp = Mips::ATOMIC_LOAD_OR_I8_POSTRA;
1846 case Mips::ATOMIC_LOAD_OR_I16:
1847 AtomicOp = Mips::ATOMIC_LOAD_OR_I16_POSTRA;
1849 case Mips::ATOMIC_LOAD_XOR_I8:
1850 AtomicOp = Mips::ATOMIC_LOAD_XOR_I8_POSTRA;
1852 case Mips::ATOMIC_LOAD_XOR_I16:
1853 AtomicOp = Mips::ATOMIC_LOAD_XOR_I16_POSTRA;
1855 case Mips::ATOMIC_LOAD_MIN_I8:
1856 AtomicOp = Mips::ATOMIC_LOAD_MIN_I8_POSTRA;
1857 NeedsAdditionalReg =
true;
1859 case Mips::ATOMIC_LOAD_MIN_I16:
1860 AtomicOp = Mips::ATOMIC_LOAD_MIN_I16_POSTRA;
1861 NeedsAdditionalReg =
true;
1863 case Mips::ATOMIC_LOAD_MAX_I8:
1864 AtomicOp = Mips::ATOMIC_LOAD_MAX_I8_POSTRA;
1865 NeedsAdditionalReg =
true;
1867 case Mips::ATOMIC_LOAD_MAX_I16:
1868 AtomicOp = Mips::ATOMIC_LOAD_MAX_I16_POSTRA;
1869 NeedsAdditionalReg =
true;
1871 case Mips::ATOMIC_LOAD_UMIN_I8:
1872 AtomicOp = Mips::ATOMIC_LOAD_UMIN_I8_POSTRA;
1873 NeedsAdditionalReg =
true;
1875 case Mips::ATOMIC_LOAD_UMIN_I16:
1876 AtomicOp = Mips::ATOMIC_LOAD_UMIN_I16_POSTRA;
1877 NeedsAdditionalReg =
true;
1879 case Mips::ATOMIC_LOAD_UMAX_I8:
1880 AtomicOp = Mips::ATOMIC_LOAD_UMAX_I8_POSTRA;
1881 NeedsAdditionalReg =
true;
1883 case Mips::ATOMIC_LOAD_UMAX_I16:
1884 AtomicOp = Mips::ATOMIC_LOAD_UMAX_I16_POSTRA;
1885 NeedsAdditionalReg =
true;
1914 int64_t MaskImm = (
Size == 1) ? 255 : 65535;
1920 .
addReg(Ptr, {}, ArePtrs64bit ? Mips::sub_32 : 0)
1943 MachineInstrBuilder MIB =
1957 if (NeedsAdditionalReg) {
1963 MI.eraseFromParent();
1977 assert((
MI.getOpcode() == Mips::ATOMIC_CMP_SWAP_I32 ||
1978 MI.getOpcode() == Mips::ATOMIC_CMP_SWAP_I64) &&
1979 "Unsupported atomic pseudo for EmitAtomicCmpSwap.");
1981 const unsigned Size =
MI.getOpcode() == Mips::ATOMIC_CMP_SWAP_I32 ? 4 : 8;
1989 unsigned AtomicOp =
MI.getOpcode() == Mips::ATOMIC_CMP_SWAP_I32
1990 ? Mips::ATOMIC_CMP_SWAP_I32_POSTRA
1991 : Mips::ATOMIC_CMP_SWAP_I64_POSTRA;
2025 MI.eraseFromParent();
2033 "Unsupported size for EmitAtomicCmpSwapPartial.");
2036 MachineRegisterInfo &RegInfo = MF->
getRegInfo();
2038 const bool ArePtrs64bit =
ABI.ArePtrs64bit();
2060 unsigned AtomicOp =
MI.getOpcode() == Mips::ATOMIC_CMP_SWAP_I8
2061 ? Mips::ATOMIC_CMP_SWAP_I8_POSTRA
2062 : Mips::ATOMIC_CMP_SWAP_I16_POSTRA;
2103 int64_t MaskImm = (
Size == 1) ? 255 : 65535;
2104 BuildMI(BB,
DL,
TII->get(ArePtrs64bit ? Mips::DADDiu : Mips::ADDiu), MaskLSB2)
2106 BuildMI(BB,
DL,
TII->get(ArePtrs64bit ? Mips::AND64 : Mips::AND), AlignedAddr)
2109 .
addReg(Ptr, {}, ArePtrs64bit ? Mips::sub_32 : 0)
2151 MI.eraseFromParent();
2158 EVT VT =
Op.getValueType();
2175 uint32_t
Lo =
Bits & 0xFFFFFFFF;
2176 if (
Lo != 0 || Bits == 0)
2184 return DAG.
getNode(MipsISD::BuildPairF64,
DL, MVT::f64,
Low,
Hi);
2196 unsigned RdhwrOpc, DestReg;
2199 if (PtrVT == MVT::i64) {
2200 RdhwrOpc = Mips::RDHWR64;
2212 RdhwrOpc = Mips::RDHWR;
2240 if (CondRes.
getOpcode() != MipsISD::FPCmp)
2248 return DAG.
getNode(MipsISD::FPBrcond,
DL,
Op.getValueType(), Chain, BrCode,
2249 FCC0, Dest, CondRes);
2259 if (
Cond.getOpcode() != MipsISD::FPCmp)
2273 Op.getOperand(1),
Op.getOperand(2));
2282 "Floating point operand expected.");
2311 EVT Ty =
Op.getValueType();
2313 const GlobalValue *GV =
N->getGlobal();
2317 "Windows is the only supported COFF target");
2324 const MipsTargetObjectFile *TLOF =
2325 static_cast<const MipsTargetObjectFile *
>(
2328 if (
Subtarget.useSmallSection() && GO && TLOF->IsGlobalInSmallSection(GO))
2359 N, SDLoc(
N), Ty, DAG,
2367 EVT Ty =
Op.getValueType();
2388 const GlobalValue *GV = GA->
getGlobal();
2407 Args.emplace_back(Argument, PtrTy);
2409 TargetLowering::CallLoweringInfo CLI(DAG);
2412 .setLibCallee(
CallingConv::C, PtrTy, TlsGetAddr, std::move(Args));
2413 std::pair<SDValue, SDValue> CallResult =
LowerCallTo(CLI);
2415 SDValue Ret = CallResult.first;
2459 EVT Ty =
Op.getValueType();
2472 EVT Ty =
Op.getValueType();
2475 const MipsTargetObjectFile *TLOF =
2476 static_cast<const MipsTargetObjectFile *
>(
2493 MipsFunctionInfo *FuncInfo = MF.
getInfo<MipsFunctionInfo>();
2503 MachinePointerInfo(SV));
2507 SDNode *
Node =
Op.getNode();
2508 EVT VT =
Node->getValueType(0);
2512 llvm::MaybeAlign(
Node->getConstantOperandVal(3)).valueOrOne();
2515 unsigned ArgSlotSizeInBytes = (
ABI.IsN32() ||
ABI.IsN64()) ? 8 : 4;
2518 VAListPtr, MachinePointerInfo(SV));
2540 unsigned ArgSizeInBytes =
2548 MachinePointerInfo(SV));
2555 if (!
Subtarget.isLittle() && ArgSizeInBytes < ArgSlotSizeInBytes) {
2556 unsigned Adjustment = ArgSlotSizeInBytes - ArgSizeInBytes;
2561 return DAG.
getLoad(VT,
DL, Chain, VAList, MachinePointerInfo());
2565 bool HasExtractInsert) {
2566 EVT TyX =
Op.getOperand(0).getValueType();
2567 EVT TyY =
Op.getOperand(1).getValueType();
2577 DAG.
getNode(MipsISD::ExtractElementF64,
DL, MVT::i32,
Op.getOperand(0),
2581 DAG.
getNode(MipsISD::ExtractElementF64,
DL, MVT::i32,
Op.getOperand(1),
2584 if (HasExtractInsert) {
2588 Res = DAG.
getNode(MipsISD::Ins,
DL, MVT::i32,
E, Const31, Const1,
X);
2602 if (TyX == MVT::f32)
2608 return DAG.
getNode(MipsISD::BuildPairF64,
DL, MVT::f64, LowX, Res);
2612 bool HasExtractInsert) {
2613 unsigned WidthX =
Op.getOperand(0).getValueSizeInBits();
2614 unsigned WidthY =
Op.getOperand(1).getValueSizeInBits();
2623 if (HasExtractInsert) {
2629 if (WidthX > WidthY)
2631 else if (WidthY > WidthX)
2650 if (WidthX > WidthY)
2652 else if (WidthY > WidthX)
2670 bool HasExtractInsert)
const {
2674 if (
Op->getFlags().hasNoNaNs() ||
Subtarget.inAbs2008Mode())
2681 : DAG.
getNode(MipsISD::ExtractElementF64,
DL, MVT::i32,
2682 Op.getOperand(0), Const1);
2685 if (HasExtractInsert)
2686 Res = DAG.
getNode(MipsISD::Ins,
DL, MVT::i32,
2696 if (
Op.getValueType() == MVT::f32)
2704 DAG.
getNode(MipsISD::ExtractElementF64,
DL, MVT::i32,
Op.getOperand(0),
2706 return DAG.
getNode(MipsISD::BuildPairF64,
DL, MVT::f64, LowX, Res);
2710 bool HasExtractInsert)
const {
2714 if (
Op->getFlags().hasNoNaNs() ||
Subtarget.inAbs2008Mode())
2721 if (HasExtractInsert)
2722 Res = DAG.
getNode(MipsISD::Ins,
DL, MVT::i64,
2734 if ((
ABI.IsN32() ||
ABI.IsN64()) && (
Op.getValueType() == MVT::f64))
2735 return lowerFABS64(
Op, DAG,
Subtarget.hasExtractInsert());
2737 return lowerFABS32(
Op, DAG,
Subtarget.hasExtractInsert());
2744 if (
Op->getFlags().hasNoNaNs() ||
Subtarget.inAbs2008Mode())
2748 EVT VT =
Op.getValueType();
2751 if (VT == MVT::f32) {
2758 if (
ABI.IsN32() ||
ABI.IsN64()) {
2771 return DAG.
getNode(MipsISD::BuildPairF64,
DL, MVT::f64,
Lo,
Hi);
2777 EVT VT =
Op.getValueType();
2779 SDNodeFlags
Flags =
Op->getFlags();
2791 if (
Op.getConstantOperandVal(0) != 0) {
2793 "return address can be determined only for current frame");
2799 EVT VT =
Op.getValueType();
2809 if (
Op.getConstantOperandVal(0) != 0) {
2811 "return address can be determined only for current frame");
2817 MVT VT =
Op.getSimpleValueType();
2833 MipsFunctionInfo *MipsFI = MF.
getInfo<MipsFunctionInfo>();
2840 EVT Ty =
ABI.IsN64() ? MVT::i64 : MVT::i32;
2844 unsigned OffsetReg =
ABI.getReturnRegPtr(1);
2845 unsigned AddrReg =
ABI.getReturnRegPtr(0);
2848 return DAG.
getNode(MipsISD::EH_RETURN,
DL, MVT::Other, Chain,
2864 return DAG.
getNode(MipsISD::Sync,
DL, MVT::Other,
Op.getOperand(0),
2882 MVT VT =
Subtarget.isGP64bit() ? MVT::i64 : MVT::i32;
2921 MVT VT =
Subtarget.isGP64bit() ? MVT::i64 : MVT::i32;
2955 SDVTList VTList = DAG.
getVTList(VT, VT);
2977 SDValue Ptr = LD->getBasePtr();
2978 EVT VT = LD->getValueType(0), MemVT = LD->getMemoryVT();
2989 LD->getMemOperand());
2995 EVT MemVT = LD->getMemoryVT();
2997 if (
Subtarget.systemSupportsUnalignedAccess())
3001 if ((LD->getAlign().value() >= (MemVT.
getSizeInBits() / 8)) ||
3002 ((MemVT != MVT::i32) && (MemVT != MVT::i64)))
3006 EVT VT =
Op.getValueType();
3010 assert((VT == MVT::i32) || (VT == MVT::i64));
3088 return createStoreLR(MipsISD::SWR, DAG, SD, SWL, IsLittle ? 0 : 3);
3099 return createStoreLR(MipsISD::SDR, DAG, SD, SDL, IsLittle ? 0 : 7);
3124 if (!
Subtarget.systemSupportsUnalignedAccess() &&
3126 ((MemVT == MVT::i32) || (MemVT == MVT::i64)))
3138 EVT ValTy =
Op->getValueType(0);
3145 if (
Op.getValueSizeInBits() > 32 &&
Subtarget.isSingleFloat())
3163 Loc,
Op.getValueType(), SrcVal);
3208 static const MCPhysReg RCRegs[] = {Mips::FCR31};
3241 State.getMachineFunction().getSubtarget());
3256 if (LocVT == MVT::i8 || LocVT == MVT::i16 || LocVT == MVT::i32) {
3260 else if (ArgFlags.
isZExt())
3268 if (LocVT == MVT::i8 || LocVT == MVT::i16) {
3272 else if (ArgFlags.
isZExt())
3283 bool AllocateFloatsInIntReg = State.isVarArg() || ValNo > 1 ||
3284 State.getFirstUnallocated(
F32Regs) != ValNo;
3286 bool isI64 = (ValVT == MVT::i32 && OrigAlign ==
Align(8));
3290 if (ValVT == MVT::i32 && isVectorFloat) {
3296 Reg = State.AllocateReg(FloatVectorIntRegs);
3298 State.AllocateReg(
IntRegs[1]);
3300 State.AllocateReg(
IntRegs[3]);
3306 }
else if (ValVT == MVT::i32 ||
3307 (ValVT == MVT::f32 && AllocateFloatsInIntReg)) {
3317 }
else if (ValVT == MVT::f64 && AllocateFloatsInIntReg) {
3337 if (ValVT == MVT::f32) {
3342 Reg = State.AllocateReg(F64Regs);
3365 static const MCPhysReg F64Regs[] = { Mips::D6, Mips::D7 };
3367 return CC_MipsO32(ValNo, ValVT, LocVT, LocInfo, ArgFlags, OrigTy, State,
3375 static const MCPhysReg F64Regs[] = { Mips::D12_64, Mips::D14_64 };
3377 return CC_MipsO32(ValNo, ValVT, LocVT, LocInfo, ArgFlags, OrigTy, State,
3386#define GET_CALLING_CONV_IMPL
3387#include "MipsGenCallingConv.inc"
3390 return CC_Mips_FixedArg;
3402 const SDLoc &
DL,
bool IsTailCall,
3420 std::deque<std::pair<unsigned, SDValue>> &RegsToPass,
bool IsPICCall,
3421 bool GlobalOrExternal,
bool LocalLinkage,
bool IsCallReloc,
3433 if (IsPICCall && !LocalLinkage && IsCallReloc) {
3435 EVT Ty =
ABI.IsN64() ? MVT::i64 : MVT::i32;
3436 RegsToPass.push_back(std::make_pair(GPReg,
getGlobalReg(CLI.
DAG, Ty)));
3445 for (
auto &R : RegsToPass) {
3452 for (
auto &R : RegsToPass)
3459 assert(Mask &&
"Missing call preserved mask for calling convention");
3463 Function *
F =
G->getGlobal()->getParent()->getFunction(Sym);
3464 if (
F &&
F->hasFnAttribute(
"__Mips16RetHelper")) {
3472 Ops.push_back(InGlue);
3477 switch (
MI.getOpcode()) {
3481 case Mips::JALRPseudo:
3483 case Mips::JALR64Pseudo:
3484 case Mips::JALR16_MM:
3485 case Mips::JALRC16_MMR6:
3486 case Mips::TAILCALLREG:
3487 case Mips::TAILCALLREG64:
3488 case Mips::TAILCALLR6REG:
3489 case Mips::TAILCALL64R6REG:
3490 case Mips::TAILCALLREG_MM:
3491 case Mips::TAILCALLREG_MMR6: {
3494 Node->getOperand(0).getNumOperands() < 2) {
3500 const SDValue TargetAddr =
Node->getOperand(0).getOperand(1);
3510 LLVM_DEBUG(
dbgs() <<
"Not adding R_MIPS_JALR against data symbol "
3518 S =
MI.getParent()->getParent()->getContext().getOrCreateSymbol(
3600 unsigned ReservedArgArea =
3601 MemcpyInByVal ? 0 : ABI.GetCalleeAllocdArgSizeInBytes(CallConv);
3602 CCInfo.AllocateStack(ReservedArgArea,
Align(1));
3604 CCInfo.AnalyzeCallOperands(Outs,
CC_Mips);
3607 unsigned StackSize = CCInfo.getStackSize();
3619 bool CalleeIsLocal =
true;
3623 bool HasHiddenVisibility =
3626 CalleeIsLocal = HasLocalLinkage || HasHiddenVisibility;
3632 if (!
Subtarget.getCLOpts().tail_calls) {
3636 "site marked musttail");
3638 bool Eligible = isEligibleForTailCallOptimization(
3639 CCInfo, StackSize, *MF.
getInfo<MipsFunctionInfo>());
3640 if (!Eligible || !CalleeIsLocal) {
3644 "failed to perform tail call elimination on a call "
3645 "site marked musttail");
3657 StackSize =
alignTo(StackSize, StackAlignment);
3659 if (!(IsTailCall || MemcpyInByVal))
3665 std::deque<std::pair<unsigned, SDValue>> RegsToPass;
3668 CCInfo.rewindByValRegsInfo();
3671 for (
unsigned i = 0, e = ArgLocs.
size(), OutIdx = 0; i != e; ++i, ++OutIdx) {
3672 SDValue Arg = OutVals[OutIdx];
3673 CCValAssign &VA = ArgLocs[i];
3675 ISD::ArgFlagsTy
Flags = Outs[OutIdx].Flags;
3676 bool UseUpperBits =
false;
3679 if (
Flags.isByVal()) {
3680 unsigned FirstByValReg, LastByValReg;
3681 unsigned ByValIdx = CCInfo.getInRegsParamsProcessed();
3682 CCInfo.getInRegsParamInfo(ByValIdx, FirstByValReg, LastByValReg);
3685 "ByVal args of size 0 should have been ignored by front-end.");
3686 assert(ByValIdx < CCInfo.getInRegsParamsCount());
3688 "Do not tail-call optimize if there is a byval argument.");
3689 passByValArg(Chain,
DL, RegsToPass, MemOpChains, StackPtr, MFI, DAG, Arg,
3690 FirstByValReg, LastByValReg, Flags,
Subtarget.isLittle(),
3692 CCInfo.nextInRegsParam();
3702 if ((ValVT == MVT::f32 && LocVT == MVT::i32) ||
3703 (ValVT == MVT::f64 && LocVT == MVT::i64) ||
3704 (ValVT == MVT::i64 && LocVT == MVT::f64))
3706 else if (ValVT == MVT::f64 && LocVT == MVT::i32) {
3717 Register LocRegHigh = ArgLocs[++i].getLocReg();
3718 RegsToPass.
push_back(std::make_pair(LocRegLo,
Lo));
3719 RegsToPass.push_back(std::make_pair(LocRegHigh,
Hi));
3728 UseUpperBits =
true;
3734 UseUpperBits =
true;
3740 UseUpperBits =
true;
3748 unsigned ValSizeInBits = Outs[OutIdx].ArgVT.getSizeInBits();
3758 RegsToPass.push_back(std::make_pair(VA.
getLocReg(), Arg));
3779 Chain, Arg,
DL, IsTailCall, DAG));
3784 if (!MemOpChains.
empty())
3791 EVT Ty =
Callee.getValueType();
3792 bool GlobalOrExternal =
false, IsCallReloc =
false;
3797 if (!
Subtarget.isABICalls() && !IsPIC) {
3807 bool UseLongCalls =
Subtarget.useLongCalls();
3811 if (
F->hasFnAttribute(
"long-call"))
3812 UseLongCalls =
true;
3813 else if (
F->hasFnAttribute(
"short-call"))
3814 UseLongCalls =
false;
3823 bool LocalLinkage =
false;
3826 G->getGlobal()->hasDLLImportStorageClass()) {
3828 "Windows is the only supported COFF target");
3829 auto PtrInfo = MachinePointerInfo();
3833 const GlobalValue *Val =
G->getGlobal();
3852 GlobalOrExternal =
true;
3855 const char *Sym = S->getSymbol();
3871 GlobalOrExternal =
true;
3875 SDVTList NodeTys = DAG.
getVTList(MVT::Other, MVT::Glue);
3877 getOpndList(
Ops, RegsToPass, IsPIC, GlobalOrExternal, LocalLinkage,
3878 IsCallReloc, CLI, Callee, Chain);
3887 Chain = DAG.
getNode(MipsISD::JmpLink,
DL, NodeTys,
Ops);
3894 if (!(MemcpyInByVal)) {
3901 return LowerCallResult(Chain, InGlue, CallConv, IsVarArg, Ins,
DL, DAG,
3907SDValue MipsTargetLowering::LowerCallResult(
3917 CCInfo.AnalyzeCallResult(Ins, RetCC_Mips);
3920 for (
unsigned i = 0; i != RVLocs.
size(); ++i) {
3921 CCValAssign &VA = RVLocs[i];
3925 RVLocs[i].getLocVT(), InGlue);
3930 unsigned ValSizeInBits = Ins[i].ArgVT.getSizeInBits();
4031SDValue MipsTargetLowering::LowerFormalArguments(
4037 MipsFunctionInfo *MipsFI = MF.
getInfo<MipsFunctionInfo>();
4042 std::vector<SDValue> OutChains;
4048 CCInfo.AllocateStack(
ABI.GetCalleeAllocdArgSizeInBytes(CallConv),
Align(1));
4052 if (
Func.hasFnAttribute(
"interrupt") && !
Func.arg_empty())
4054 "Functions with the interrupt attribute cannot have arguments!");
4056 CCInfo.AnalyzeFormalArguments(Ins, CC_Mips_FixedArg);
4058 CCInfo.getInRegsParamsCount() > 0);
4060 unsigned CurArgIdx = 0;
4061 CCInfo.rewindByValRegsInfo();
4063 for (
unsigned i = 0, e = ArgLocs.
size(), InsIdx = 0; i != e; ++i, ++InsIdx) {
4064 CCValAssign &VA = ArgLocs[i];
4065 if (Ins[InsIdx].isOrigArg()) {
4066 std::advance(FuncArg, Ins[InsIdx].getOrigArgIndex() - CurArgIdx);
4067 CurArgIdx = Ins[InsIdx].getOrigArgIndex();
4070 ISD::ArgFlagsTy
Flags = Ins[InsIdx].Flags;
4073 if (
Flags.isByVal()) {
4074 assert(Ins[InsIdx].isOrigArg() &&
"Byval arguments cannot be implicit");
4075 unsigned FirstByValReg, LastByValReg;
4076 unsigned ByValIdx = CCInfo.getInRegsParamsProcessed();
4077 CCInfo.getInRegsParamInfo(ByValIdx, FirstByValReg, LastByValReg);
4080 "ByVal args of size 0 should have been ignored by front-end.");
4081 assert(ByValIdx < CCInfo.getInRegsParamsCount());
4082 copyByValRegs(Chain,
DL, OutChains, DAG, Flags, InVals, &*FuncArg,
4083 FirstByValReg, LastByValReg, VA, CCInfo);
4084 CCInfo.nextInRegsParam();
4104 if ((RegVT == MVT::i32 && ValVT == MVT::f32) ||
4105 (RegVT == MVT::i64 && ValVT == MVT::f64) ||
4106 (RegVT == MVT::f64 && ValVT == MVT::i64))
4108 else if (
ABI.IsO32() && RegVT == MVT::i32 &&
4109 ValVT == MVT::f64) {
4111 CCValAssign &NextVA = ArgLocs[++i];
4117 ArgValue = DAG.
getNode(MipsISD::BuildPairF64,
DL, MVT::f64,
4118 ArgValue, ArgValue2);
4137 LocVT,
DL, Chain, FIN,
4139 OutChains.push_back(ArgValue.
getValue(1));
4148 for (
unsigned i = 0, e = ArgLocs.
size(), InsIdx = 0; i != e; ++i, ++InsIdx) {
4150 if (ArgLocs[i].needsCustom()) {
4158 if (Ins[InsIdx].
Flags.isSRet()) {
4172 writeVarArgRegs(OutChains, Chain,
DL, DAG, CCInfo);
4176 if (!OutChains.empty()) {
4177 OutChains.push_back(Chain);
4194 MipsCCState CCInfo(CallConv, IsVarArg, MF, RVLocs,
Context);
4195 return CCInfo.CheckReturn(Outs, RetCC_Mips);
4198bool MipsTargetLowering::shouldSignExtendTypeInLibCall(
Type *Ty,
4199 bool IsSigned)
const {
4211 MipsFunctionInfo *MipsFI = MF.
getInfo<MipsFunctionInfo>();
4215 return DAG.
getNode(MipsISD::ERet,
DL, MVT::Other, RetOps);
4230 MipsCCState CCInfo(CallConv, IsVarArg, MF, RVLocs, *DAG.
getContext());
4233 CCInfo.AnalyzeReturn(Outs, RetCC_Mips);
4239 for (
unsigned i = 0; i != RVLocs.
size(); ++i) {
4241 CCValAssign &VA = RVLocs[i];
4243 bool UseUpperBits =
false;
4254 UseUpperBits =
true;
4260 UseUpperBits =
true;
4266 UseUpperBits =
true;
4274 unsigned ValSizeInBits = Outs[i].ArgVT.getSizeInBits();
4293 MipsFunctionInfo *MipsFI = MF.
getInfo<MipsFunctionInfo>();
4300 unsigned V0 =
ABI.getReturnRegPtr(0);
4315 return LowerInterruptReturn(RetOps,
DL, DAG);
4318 return DAG.
getNode(MipsISD::Ret,
DL, MVT::Other, RetOps);
4328MipsTargetLowering::getConstraintType(
StringRef Constraint)
const {
4340 if (Constraint.
size() == 1) {
4341 switch (Constraint[0]) {
4355 if (Constraint ==
"ZC")
4365MipsTargetLowering::getSingleConstraintMatchWeight(
4366 AsmOperandInfo &
info,
const char *constraint)
const {
4368 Value *CallOperandVal =
info.CallOperandVal;
4371 if (!CallOperandVal)
4375 switch (*constraint) {
4419 unsigned long long &
Reg) {
4420 if (
C.front() !=
'{' ||
C.back() !=
'}')
4421 return std::make_pair(
false,
false);
4425 I = std::find_if(
B,
E, isdigit);
4431 return std::make_pair(
true,
false);
4442 return VT.
bitsLT(MinVT) ? MinVT : VT;
4445std::pair<unsigned, const TargetRegisterClass *> MipsTargetLowering::
4451 unsigned long long Reg;
4456 return std::make_pair(0U,
nullptr);
4458 for (
unsigned RegClassID : {Mips::HI32RegClassID, Mips::LO32RegClassID}) {
4460 Prefix, *
TRI, RegClassID, Mips::RegAliasName)) {
4463 return std::make_pair(0U,
nullptr);
4464 return std::make_pair(NamedReg.id(),
TRI->getRegClass(RegClassID));
4468 if (
Prefix.starts_with(
"$msa")) {
4473 return std::make_pair(0U,
nullptr);
4475 RC =
TRI->getRegClass(Mips::MSACtrlRegClassID);
4477 Prefix.drop_front(), *
TRI, Mips::MSACtrlRegClassID, Mips::RegAliasName);
4479 return std::make_pair(0U,
nullptr);
4481 return std::make_pair(
Reg, RC);
4485 return std::make_pair(0U,
nullptr);
4487 if (Prefix ==
"$f") {
4492 if (VT == MVT::Other) {
4496 VT = (
Subtarget.isFP64bit() || !(
Reg % 2)) ? MVT::f64 : MVT::f32;
4501 if (RC == &Mips::AFGR64RegClass) {
4505 }
else if (Prefix ==
"$fcc")
4506 RC =
TRI->getRegClass(Mips::FCCRegClassID);
4507 else if (Prefix ==
"$w") {
4518 RC = &Mips::GPR64RegClass;
4520 RC = &Mips::GPR32RegClass;
4524 return std::make_pair(*(RC->
begin() +
Reg), RC);
4530std::pair<unsigned, const TargetRegisterClass *>
4534 if (Constraint.
size() == 1) {
4535 switch (Constraint[0]) {
4539 if ((VT == MVT::i32 || VT == MVT::i16 || VT == MVT::i8 ||
4541 (VT == MVT::f32 &&
Subtarget.useSoftFloat())) {
4543 return std::make_pair(0U, &Mips::CPU16RegsRegClass);
4544 return std::make_pair(0U, &Mips::GPR32RegClass);
4546 if ((VT == MVT::i64 || (VT == MVT::f64 &&
Subtarget.useSoftFloat()) ||
4547 (VT == MVT::f64 &&
Subtarget.isSingleFloat())) &&
4549 return std::make_pair(0U, &Mips::GPR32RegClass);
4550 if ((VT == MVT::i64 || (VT == MVT::f64 &&
Subtarget.useSoftFloat()) ||
4551 (VT == MVT::f64 &&
Subtarget.isSingleFloat())) &&
4553 return std::make_pair(0U, &Mips::GPR64RegClass);
4555 return std::make_pair(0U,
nullptr);
4557 if (VT == MVT::v16i8)
4558 return std::make_pair(0U, &Mips::MSA128BRegClass);
4559 else if (VT == MVT::v8i16 || VT == MVT::v8f16)
4560 return std::make_pair(0U, &Mips::MSA128HRegClass);
4561 else if (VT == MVT::v4i32 || VT == MVT::v4f32)
4562 return std::make_pair(0U, &Mips::MSA128WRegClass);
4563 else if (VT == MVT::v2i64 || VT == MVT::v2f64)
4564 return std::make_pair(0U, &Mips::MSA128DRegClass);
4565 else if (VT == MVT::f32)
4566 return std::make_pair(0U, &Mips::FGR32RegClass);
4567 else if ((VT == MVT::f64) && (!
Subtarget.isSingleFloat())) {
4569 return std::make_pair(0U, &Mips::FGR64RegClass);
4570 return std::make_pair(0U, &Mips::AFGR64RegClass);
4575 return std::make_pair(
ABI.getTempReg(9,
false).id(),
4576 &Mips::GPR32RegClass);
4578 return std::make_pair(
ABI.getTempReg(9,
true).id(),
4579 &Mips::GPR64RegClass);
4581 return std::make_pair(0U,
nullptr);
4584 if (VT == MVT::i32 || VT == MVT::i16 || VT == MVT::i8)
4585 return std::make_pair((
unsigned)Mips::LO0, &Mips::LO32RegClass);
4586 return std::make_pair((
unsigned)Mips::LO0_64, &Mips::LO64RegClass);
4591 return std::make_pair(0U,
nullptr);
4595 if (!Constraint.
empty()) {
4596 std::pair<unsigned, const TargetRegisterClass *>
R;
4597 R = parseRegForInlineAsmConstraint(Constraint, VT);
4608void MipsTargetLowering::LowerAsmOperandForConstraint(
SDValue Op,
4610 std::vector<SDValue> &
Ops,
4616 if (Constraint.
size() > 1)
4619 char ConstraintLetter = Constraint[0];
4620 switch (ConstraintLetter) {
4625 EVT
Type =
Op.getValueType();
4626 int64_t Val =
C->getSExtValue();
4635 EVT
Type =
Op.getValueType();
4636 int64_t Val =
C->getZExtValue();
4645 EVT
Type =
Op.getValueType();
4655 EVT
Type =
Op.getValueType();
4656 int64_t Val =
C->getSExtValue();
4657 if ((
isInt<32>(Val)) && ((Val & 0xffff) == 0)){
4665 EVT
Type =
Op.getValueType();
4666 int64_t Val =
C->getSExtValue();
4667 if ((Val >= -65535) && (Val <= -1)) {
4675 EVT
Type =
Op.getValueType();
4676 int64_t Val =
C->getSExtValue();
4685 EVT
Type =
Op.getValueType();
4686 int64_t Val =
C->getSExtValue();
4687 if ((Val <= 65535) && (Val >= 1)) {
4696 Ops.push_back(Result);
4703bool MipsTargetLowering::isLegalAddressingMode(
const DataLayout &
DL,
4731EVT MipsTargetLowering::getOptimalMemOpType(
4733 const AttributeList &FuncAttributes)
const {
4741MipsTargetLowering::getFPImmAction(
const APFloat &
Imm,
EVT VT,
4742 bool ForCodeSize)
const {
4743 if (VT != MVT::f32 && VT != MVT::f64)
4745 if (
Imm.isNegZero())
4750bool MipsTargetLowering::isLegalICmpImmediate(int64_t
Imm)
const {
4754bool MipsTargetLowering::isLegalAddImmediate(int64_t
Imm)
const {
4760 unsigned Depth)
const {
4762 if (
Op.getOpcode() == MipsISD::R6FCmp)
4763 return Op.getScalarValueSizeInBits();
4786void MipsTargetLowering::copyByValRegs(
4790 unsigned FirstReg,
unsigned LastReg,
const CCValAssign &VA,
4794 unsigned GPRSizeInBytes =
Subtarget.getGPRSizeInBytes();
4795 unsigned NumRegs = LastReg - FirstReg;
4796 unsigned RegAreaSize = NumRegs * GPRSizeInBytes;
4797 unsigned FrameObjSize = std::max(
Flags.getByValSize(), RegAreaSize);
4804 (int)((ByValArgRegs.
size() - FirstReg) * GPRSizeInBytes);
4826 for (
unsigned I = 0;
I < NumRegs; ++
I) {
4827 unsigned ArgReg = ByValArgRegs[FirstReg +
I];
4828 unsigned VReg =
addLiveIn(MF, ArgReg, RC);
4829 unsigned Offset =
I * GPRSizeInBytes;
4833 StorePtr, MachinePointerInfo(FuncArg,
Offset));
4834 OutChains.push_back(
Store);
4839void MipsTargetLowering::passByValArg(
4841 std::deque<std::pair<unsigned, SDValue>> &RegsToPass,
4846 unsigned ByValSizeInBytes =
Flags.getByValSize();
4847 unsigned OffsetInBytes = 0;
4848 unsigned RegSizeInBytes =
Subtarget.getGPRSizeInBytes();
4850 std::min(
Flags.getNonZeroByValAlign(),
Align(RegSizeInBytes));
4853 unsigned NumRegs = LastReg - FirstReg;
4857 bool LeftoverBytes = (NumRegs * RegSizeInBytes > ByValSizeInBytes);
4861 for (;
I < NumRegs - LeftoverBytes; ++
I, OffsetInBytes += RegSizeInBytes) {
4865 MachinePointerInfo(), Alignment);
4867 unsigned ArgReg = ArgRegs[FirstReg +
I];
4868 RegsToPass.push_back(std::make_pair(ArgReg, LoadVal));
4872 if (ByValSizeInBytes == OffsetInBytes)
4876 if (LeftoverBytes) {
4879 for (
unsigned LoadSizeInBytes = RegSizeInBytes / 2, TotalBytesLoaded = 0;
4880 OffsetInBytes < ByValSizeInBytes; LoadSizeInBytes /= 2) {
4881 unsigned RemainingSizeInBytes = ByValSizeInBytes - OffsetInBytes;
4883 if (RemainingSizeInBytes < LoadSizeInBytes)
4899 Shamt = TotalBytesLoaded * 8;
4901 Shamt = (RegSizeInBytes - (TotalBytesLoaded + LoadSizeInBytes)) * 8;
4911 OffsetInBytes += LoadSizeInBytes;
4912 TotalBytesLoaded += LoadSizeInBytes;
4916 unsigned ArgReg = ArgRegs[FirstReg +
I];
4917 RegsToPass.push_back(std::make_pair(ArgReg, Val));
4923 unsigned MemCpySize = ByValSizeInBytes - OffsetInBytes;
4929 Chain,
DL, Dst, Src, DAG.
getConstant(MemCpySize,
DL, PtrTy), Alignment,
4930 Alignment,
false,
false,
4931 nullptr, std::nullopt, MachinePointerInfo(), MachinePointerInfo());
4935void MipsTargetLowering::writeVarArgRegs(std::vector<SDValue> &OutChains,
4941 unsigned RegSizeInBytes =
Subtarget.getGPRSizeInBytes();
4946 MipsFunctionInfo *MipsFI = MF.
getInfo<MipsFunctionInfo>();
4951 if (ArgRegs.
size() == Idx)
4956 (int)(RegSizeInBytes * (ArgRegs.
size() - Idx));
4968 for (
unsigned I = Idx;
I < ArgRegs.
size();
4969 ++
I, VaArgOffset += RegSizeInBytes) {
4975 DAG.
getStore(Chain,
DL, ArgValue, PtrOff, MachinePointerInfo());
4978 OutChains.push_back(
Store);
4983 Align Alignment)
const {
4986 assert(
Size &&
"Byval argument's size shouldn't be 0.");
4990 unsigned FirstReg = 0;
4991 unsigned NumRegs = 0;
4994 unsigned RegSizeInBytes =
Subtarget.getGPRSizeInBytes();
5003 Alignment >=
Align(RegSizeInBytes) &&
5004 "Byval argument's alignment should be a multiple of RegSizeInBytes.");
5006 FirstReg = State->getFirstUnallocated(IntArgRegs);
5012 if ((Alignment > RegSizeInBytes) && (FirstReg % 2)) {
5013 State->AllocateReg(IntArgRegs[FirstReg], ShadowRegs[FirstReg]);
5019 for (
unsigned I = FirstReg;
Size > 0 && (
I < IntArgRegs.
size());
5020 Size -= RegSizeInBytes, ++
I, ++NumRegs)
5021 State->AllocateReg(IntArgRegs[
I], ShadowRegs[
I]);
5024 State->addInRegsParamInfo(FirstReg, FirstReg + NumRegs);
5030 unsigned Opc)
const {
5032 "Subtarget already supports SELECT nodes with the use of"
5033 "conditional-move instructions.");
5056 F->insert(It, copy0MBB);
5057 F->insert(It, sinkMBB);
5100 MI.eraseFromParent();
5109 "Subtarget already supports SELECT nodes with the use of"
5110 "conditional-move instructions.");
5129 MachineBasicBlock *thisMBB = BB;
5131 MachineBasicBlock *copy0MBB =
F->CreateMachineBasicBlock(LLVM_BB);
5132 MachineBasicBlock *sinkMBB =
F->CreateMachineBasicBlock(LLVM_BB);
5134 F->insert(It, sinkMBB);
5176 MI.eraseFromParent();
5185 Name.consume_front(
"$");
5188 if (Name.getAsInteger(10, RegIdx)) {
5189 std::string LowerName = Name.lower();
5201 unsigned RegClassID = Mips::GPR32RegClassID;
5206 RegClassID = Mips::GPR64RegClassID;
5208 RegClassID = Mips::GPR32RegClassID;
5215 RegClassID = Mips::GPR64RegClassID;
5220 if (!ReservedRegs.
test(Reg))
5235 const bool IsLittle =
Subtarget.isLittle();
5240 unsigned Imm =
MI.getOperand(2).getImm();
5246 Register Temp =
MRI.createVirtualRegister(&Mips::GPR32RegClass);
5255 Register LoadHalf =
MRI.createVirtualRegister(&Mips::GPR32RegClass);
5256 Register LoadFull =
MRI.createVirtualRegister(&Mips::GPR32RegClass);
5272 MI.eraseFromParent();
5281 const bool IsLittle =
Subtarget.isLittle();
5286 unsigned Imm =
MI.getOperand(2).getImm();
5356 MI.eraseFromParent();
5365 const bool IsLittle =
Subtarget.isLittle();
5368 Register StoreVal =
MI.getOperand(0).getReg();
5370 unsigned Imm =
MI.getOperand(2).getImm();
5405 MI.eraseFromParent();
5415 const bool IsLittle =
Subtarget.isLittle();
5418 Register StoreVal =
MI.getOperand(0).getReg();
5420 unsigned Imm =
MI.getOperand(2).getImm();
5497 MI.eraseFromParent();
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)
const AArch64Subtarget & Subtarget
assert(UImm &&(UImm !=~static_cast< T >(0)) &&"Invalid immediate!")
const AArch64InstrInfo & TII
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< ShadowStackGC > C("shadow-stack", "Very portable GC for uncooperative code generators")
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...
hexagon merge activate weight
Module.h This file contains the declarations for the Module class.
const AbstractManglingParser< Derived, Alloc >::OperatorInfo AbstractManglingParser< Derived, Alloc >::Ops[]
static SDValue performADDCombine(SDNode *N, SelectionDAG &DAG, TargetLowering::DAGCombinerInfo &DCI, const LoongArchSubtarget &Subtarget)
static SDValue performSUBCombine(SDNode *N, SelectionDAG &DAG, TargetLowering::DAGCombinerInfo &DCI, const LoongArchSubtarget &Subtarget)
static MachineBasicBlock * insertDivByZeroTrap(MachineInstr &MI, MachineBasicBlock *MBB)
static SDValue performSELECTCombine(SDNode *N, SelectionDAG &DAG, TargetLowering::DAGCombinerInfo &DCI, const LoongArchSubtarget &Subtarget)
Register const TargetRegisterInfo * TRI
Promote Memory to Register
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 convertRoundingMode(SDValue X, const SDLoc &DL, SelectionDAG &DAG)
static SDValue createFPCmp(SelectionDAG &DAG, const SDValue &Op)
static SDValue lowerFCOPYSIGN32(SDValue Op, SelectionDAG &DAG, bool HasExtractInsert)
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
SmallVector< MachineOperand, 4 > Cond
MachineRegisterInfo & MRI
static cl::opt< RegAllocEvictionAdvisorAnalysisLegacy::AdvisorMode > Mode("regalloc-enable-advisor", cl::Hidden, cl::init(RegAllocEvictionAdvisorAnalysisLegacy::AdvisorMode::Default), cl::desc("Enable regalloc advisor mode"), cl::values(clEnumValN(RegAllocEvictionAdvisorAnalysisLegacy::AdvisorMode::Default, "default", "Default"), clEnumValN(RegAllocEvictionAdvisorAnalysisLegacy::AdvisorMode::Release, "release", "precompiled"), clEnumValN(RegAllocEvictionAdvisorAnalysisLegacy::AdvisorMode::Development, "development", "for training")))
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)
static TableGen::Emitter::Opt Y("gen-skeleton-entry", EmitSkeleton, "Generate example skeleton entry")
static const MCPhysReg F32Regs[64]
APInt bitcastToAPInt() const
Class for arbitrary precision integers.
static APInt getSignMask(unsigned BitWidth)
Get the SignMask for a specific bit width.
uint64_t getZExtValue() const
Get zero extended value.
LLVM_ABI APInt extractBits(unsigned numBits, unsigned bitPosition) const
Return an APInt with the extracted bits [bitPosition,bitPosition+numBits).
This class represents an incoming formal argument to a Function.
Represent a constant reference to an array (0 or more elements consecutively in memory),...
size_t size() const
Get the array size.
LLVM Basic Block Representation.
bool test(unsigned Idx) const
Returns true if bit Idx is set.
static constexpr 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.
const APFloat & getValueAPF() const
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 hasProtectedVisibility() const
constexpr bool isValid() const
constexpr TypeSize getSizeInBits() const
Returns the total size of the type. Must only be called on sized types.
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 or function.
This class is used to represent ISD::LOAD nodes.
const MCRegisterInfo * getRegisterInfo() const
MCRegisterClass - Base class of TargetRegisterClass.
MCRegister getRegister(unsigned i) const
getRegister - Return the specified register in the class.
iterator begin() const
begin/end - Return all of the registers in this 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 ...
StringRef getName() const
getName - Get the symbol name.
static auto integer_valuetypes()
TypeSize getSizeInBits() const
Returns the size of the specified MVT in bits.
uint64_t getFixedSizeInBits() const
Return the size of the specified fixed width value type 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.
LLVM_ABI void computeMaxCallFrameSize(MachineFunction &MF, std::vector< MachineBasicBlock::iterator > *FrameSDOps=nullptr)
Computes the maximum size of a callframe.
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,...
const TargetRegisterClass * getRegClass(Register Reg) const
Return the register class of the specified virtual register.
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()
bool inMips16Mode() const
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...
virtual void getOpndList(SmallVectorImpl< SDValue > &Ops, std::deque< std::pair< unsigned, SDValue > > &RegsToPass, bool IsPICCall, bool GlobalOrExternal, bool LocalLinkage, 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...
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.
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
unsigned ComputeNumSignBitsForTargetNode(SDValue Op, const APInt &DemandedElts, const SelectionDAG &DAG, unsigned Depth) const override
This method can be implemented by targets that want to expose additional information about sign bits ...
SDValue getGlobalReg(SelectionDAG &DAG, EVT Ty) const
const MipsSubtarget & Subtarget
void HandleByVal(CCState *, unsigned &, Align) const override
Target-specific cleanup for formal ByVal parameters.
void finalizeLowering(MachineFunction &MF) const override
Execute target specific actions to finalize target lowering.
SDValue lowerLOAD(SDValue Op, SelectionDAG &DAG) const
bool IsConstantInSmallSection(const DataLayout &DL, const Constant *CN, const Function *F) 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, in exactly one operand.
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
ISD::CondCode getOperandCondCode(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...
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)
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 getNOT(const SDLoc &DL, SDValue Val, EVT VT)
Create a bitwise NOT operation as (XOR Val, -1).
LLVM_ABI SDValue getMemcpy(SDValue Chain, const SDLoc &dl, SDValue Dst, SDValue Src, SDValue Size, Align DstAlign, Align SrcAlign, 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 getStore(SDValue Chain, const SDLoc &dl, SDValue Val, SDValue Ptr, MachinePointerInfo PtrInfo, Align Alignment, MachineMemOperand::Flags MMOFlags=MachineMemOperand::MONone, const MMOMetadata &Metadata=MMOMetadata())
Helper function to build ISD::STORE nodes.
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 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 MMOMetadata &Metadata=MMOMetadata())
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 getSExtOrTrunc(SDValue Op, const SDLoc &DL, EVT VT)
Convert Op, which must be of integer type, to the integer type VT, by either sign-extending or trunca...
LLVM_ABI SDValue getLoad(EVT VT, const SDLoc &dl, SDValue Chain, SDValue Ptr, MachinePointerInfo PtrInfo, MaybeAlign Alignment=MaybeAlign(), MachineMemOperand::Flags MMOFlags=MachineMemOperand::MONone, const MMOMetadata &Metadata=MMOMetadata())
Loads are not normal binary operators: their result type is not determined by their operands,...
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)
LLVM_ABI unsigned ComputeNumSignBits(SDValue Op, unsigned Depth=0) const
Return the number of times the sign bit of the register is replicated into the other bits.
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)
LLVM_ABI SDValue getZExtOrTrunc(SDValue Op, const SDLoc &DL, EVT VT)
Convert Op, which must be of integer type, to the integer type VT, by either zero-extending or trunca...
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.
Represent a constant reference to a string, i.e.
constexpr bool empty() const
Check if the string is empty.
const char * const_iterator
constexpr size_t size() const
Get the string size.
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 void finalizeLowering(MachineFunction &MF) const
Execute target specific actions to finalize target lowering.
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
void setHasExtractBitsInsn(bool hasExtractInsn=true)
Tells the code generator that the target has BitExtract instructions.
MVT getRegisterType(LLVMContext &Context, EVT VT) const
Return the type of registers that this ValueType will eventually require.
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 a boolean value from i1 to a wider type.
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...
FPImmAction
How the legalizer should materialize a floating-point immediate.
@ ConstantPool
Load the immediate from the constant pool.
@ Legal
The target can instruction select the immediate natively.
@ Bitcast
Build the immediate as a bitcast of an integer constant with the same bits.
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.
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
MCSymbol * getSymbol(const GlobalValue *GV) const
unsigned EnableFastISel
EnableFastISel - This flag enables fast-path instruction selection which trades away generated code q...
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.
LLVM_ABI StringRef getName() const
Return a constant reference to the value's name.
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.
@ MEMBARRIER
MEMBARRIER - Compiler barrier only; generate a no-op.
@ 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,...
@ SET_ROUNDING
Set rounding mode.
@ SIGN_EXTEND
Conversion operators.
@ FSINCOS
FSINCOS - Compute both fsin and fcos as a single operation.
@ FNEG
Perform various unary floating-point operations inspired by libm.
@ 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.
@ GET_ROUNDING
Returns current rounding mode: -1 Undefined 0 Round to 0 1 Round to nearest, ties to even 2 Round to ...
@ SHL
Shift and rotation operations.
@ FMINNUM_IEEE
FMINNUM_IEEE/FMAXNUM_IEEE - Same as FMINNUM/FMAXNUM, except that a signaling NaN operand deterministi...
@ 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 - Same semantics as the llvm.minnum/maxnum intrinsics.
@ 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).
@ 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.
MCRegister matchRegisterName(StringRef Name, const MCRegisterInfo &MRI, unsigned RegClassID, unsigned AltIdx)
Match a symbolic name in RegClassID, or return an invalid register.
int getCPURegisterIndex(StringRef Name, const MCRegisterInfo &MRI, unsigned AltIdx, bool *IsDeprecated=nullptr)
Return a GPR name's hardware index, or -1 if unknown.
constexpr MCPhysReg FP_64
FastISel * createFastISel(FunctionLoweringInfo &funcInfo, const TargetLibraryInfo *libInfo, const LibcallLoweringInfo *libcallLowering)
constexpr MCPhysReg GP_64
constexpr MCPhysReg RA_64
constexpr MCPhysReg SP_64
Not(const Pred &P) -> Not< Pred >
@ SingleThread
Synchronized with respect to signal handlers executing in the same thread.
@ System
Synchronized with respect to all concurrently executing threads.
NodeAddr< NodeBase * > Node
NodeAddr< FuncNode * > Func
This is an optimization pass for GlobalISel generic memory operations.
@ Low
Lower the current thread's priority such that it does not affect foreground tasks significantly.
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.
LLVM_ABI bool isNullConstant(SDValue V)
Returns true if V is a constant integer zero.
@ Implicit
Not emitted register (e.g. carry, or temporary result).
@ 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.
@ Store
The extracted value is stored (ExtractElement only).
RelativeUniformCounterPtr ValuesPtrExpr VTableAddr Value
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 uint64_t alignTo(uint64_t Size, Align A)
Returns a multiple of A needed to store Size bytes.
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...
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.
LLVM_ABI bool isOneConstant(SDValue V)
Returns true if V is a constant integer one.
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.
constexpr T maskTrailingOnes(unsigned N)
Create a bitmask with the N right-most bits set to 1, and all other bits set to 0.
LLVM_ABI bool isAllOnesConstant(SDValue V)
Returns true if V is an integer constant with all bits set.
MCRegisterClass TargetRegisterClass
LLVM_ABI void reportFatalUsageError(Error Err)
Report a fatal error that does not indicate a bug in LLVM.
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.
uint64_t getScalarSizeInBits() const
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.
bool isScalarInteger() const
Return true if this is an integer, but not a vector.
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