65 SP::I0, SP::I1, SP::I2, SP::I3, SP::I4, SP::I5
73 ValNo, ValVT, State.AllocateStack(8,
Align(4)), LocVT, LocInfo));
82 ValNo, ValVT, State.AllocateStack(4,
Align(4)), LocVT, LocInfo));
91 SP::I0, SP::I1, SP::I2, SP::I3, SP::I4, SP::I5
113 assert((LocVT == MVT::f32 || LocVT == MVT::f128
115 "Can't handle non-64 bits locations");
118 unsigned size = (LocVT == MVT::f128) ? 16 : 8;
121 unsigned Offset = State.AllocateStack(
size, alignment);
124 if (LocVT == MVT::i64 &&
Offset < 6*8)
127 else if (LocVT == MVT::f64 &&
Offset < 16*8)
130 else if (LocVT == MVT::f32 &&
Offset < 16*8)
133 else if (LocVT == MVT::f128 &&
Offset < 16*8)
151 if (LocVT == MVT::f32)
165 unsigned Offset = State.AllocateStack(4,
Align(4));
167 if (LocVT == MVT::f32 &&
Offset < 16*8) {
174 if (LocVT == MVT::i32 &&
Offset < 6*8) {
226#define GET_CALLING_CONV_IMPL
227#include "SparcGenCallingConv.inc"
233 static_assert(SP::I0 + 7 == SP::I7 && SP::O0 + 7 == SP::O7,
235 if (
Reg >= SP::I0 &&
Reg <= SP::I7)
236 return Reg - SP::I0 + SP::O0;
243 const Type *RetTy)
const {
245 CCState CCInfo(CallConv, isVarArg, MF, RVLocs, Context);
246 return CCInfo.
CheckReturn(Outs, Subtarget->is64Bit() ? RetCC_Sparc64
256 if (Subtarget->is64Bit())
285 for (
unsigned i = 0, realRVLocIdx = 0;
287 ++i, ++realRVLocIdx) {
291 SDValue Arg = OutVals[realRVLocIdx];
319 unsigned RetAddrOffset = 8;
336 F.hasStructRetAttr() ?
F.getParamStructRetType(0) :
F.getReturnType();
348 return DAG.
getNode(SPISD::RET_GLUE,
DL, MVT::Other, RetOps);
377 for (
unsigned i = 0; i != RVLocs.
size(); ++i) {
406 if (i+1 < RVLocs.
size() && RVLocs[i+1].getLocReg() == VA.
getLocReg()) {
427 return DAG.
getNode(SPISD::RET_GLUE,
DL, MVT::Other, RetOps);
434 if (Subtarget->is64Bit())
463 for (
unsigned i = 0, e = ArgLocs.
size(); i != e; ++i, ++InIdx) {
467 if (Ins[InIdx].Flags.isSRet()) {
484 Register VRegHi = RegInfo.createVirtualRegister(&SP::IntRegsRegClass);
499 &SP::IntRegsRegClass);
512 Register VReg = RegInfo.createVirtualRegister(&SP::IntRegsRegClass);
518 else if (VA.
getLocVT() != MVT::i32) {
581 unsigned ArgIndex = Ins[InIdx].OrigArgIndex;
582 assert(Ins[InIdx].PartOffset == 0);
583 while (i + 1 != e && Ins[InIdx + 1].OrigArgIndex == ArgIndex) {
585 unsigned PartOffset = Ins[InIdx + 1].PartOffset;
597 if (!Ins.
empty() && Ins[0].Flags.isSRet()) {
612 SP::I0, SP::I1, SP::I2, SP::I3, SP::I4, SP::I5
615 const MCPhysReg *CurArgReg = ArgRegs+NumAllocated, *ArgRegEnd = ArgRegs+6;
617 if (NumAllocated == 6)
621 ArgOffset = 68+4*NumAllocated;
627 std::vector<SDValue> OutChains;
629 for (; CurArgReg != ArgRegEnd; ++CurArgReg) {
630 Register VReg = RegInfo.createVirtualRegister(&SP::IntRegsRegClass);
643 if (!OutChains.empty()) {
644 OutChains.push_back(Chain);
666 const unsigned ArgArea = 128;
679 if (VA.getValVT() == MVT::i32 && VA.needsCustom())
685 switch (VA.getLocInfo()) {
710 unsigned Offset = VA.getLocMemOffset() + ArgArea;
711 unsigned ValSize = VA.getValVT().getSizeInBits() / 8;
738 Subtarget->getStackPointerBias());
744 for (; ArgOffset < 6*8; ArgOffset += 8) {
754 if (!OutChains.
empty())
768 return TRI->isReservedReg(MF, r);
772 return TRI->isReservedReg(MF, r);
774 return Outgoing || Incoming;
780 F, (
"SPARC doesn't support"
781 " function calls if any of the argument registers is reserved.")});
787 if (Subtarget->is64Bit())
795 return Call->hasFnAttr(Attribute::ReturnsTwice);
804 const char *CalleeName =
E->getSymbol();
818 auto &Outs = CLI.
Outs;
822 if (Caller.getFnAttribute(
"disable-tail-calls").getValueAsString() ==
"true")
828 unsigned StackSizeLimit = Subtarget->is64Bit() ? 48 : 0;
838 bool CalleeSRet = !Outs.empty() && Outs[0].Flags.isSRet();
839 if (CallerSRet != CalleeSRet)
844 for (
auto &Arg : Outs)
845 if (Arg.Flags.isByVal())
879 "call site marked musttail");
885 ArgsSize = (ArgsSize+7) & ~7;
891 for (
unsigned i = 0, e = Outs.
size(); i != e; ++i) {
893 if (!Flags.isByVal())
897 unsigned Size = Flags.getByValSize();
898 Align Alignment = Flags.getNonZeroByValAlign();
906 DAG.
getMemcpy(Chain, dl, FIPtr, Arg, SizeNode, Alignment, Alignment,
919 assert(!isTailCall || ArgsSize == 0);
928 bool hasStructRetAttr =
false;
929 unsigned SRetArgSize = 0;
931 for (
unsigned i = 0, realArgIdx = 0, byvalArgIdx = 0, e = ArgLocs.
size();
935 SDValue Arg = OutVals[realArgIdx];
940 if (Flags.isByVal()) {
941 Arg = ByValArgs[byvalArgIdx++];
967 if (Flags.isSRet()) {
979 hasStructRetAttr =
true;
981 assert(Outs[realArgIdx].OrigArgIndex == 0);
1053 unsigned ArgIndex = Outs[realArgIdx].OrigArgIndex;
1054 assert(Outs[realArgIdx].PartOffset == 0);
1057 if (i + 1 != e && Outs[realArgIdx + 1].OrigArgIndex == ArgIndex) {
1058 Type *OrigArgType = CLI.
Args[ArgIndex].Ty;
1066 SlotVT = Outs[realArgIdx].VT;
1072 DAG.
getStore(Chain, dl, Arg, SpillSlot,
1076 while (i + 1 != e && Outs[realArgIdx + 1].OrigArgIndex == ArgIndex) {
1077 SDValue PartValue = OutVals[realArgIdx + 1];
1078 unsigned PartOffset = Outs[realArgIdx + 1].PartOffset;
1086 "Not enough space for argument part!");
1119 if (!MemOpChains.
empty())
1127 for (
const auto &[OrigReg,
N] : RegsToPass) {
1146 Ops.push_back(Chain);
1147 Ops.push_back(Callee);
1148 if (hasStructRetAttr)
1150 for (
const auto &[OrigReg,
N] : RegsToPass) {
1159 ?
TRI->getRTCallPreservedMask(CallConv)
1165 assert(Mask &&
"Missing call preserved mask for calling convention");
1169 Ops.push_back(InGlue);
1173 return DAG.
getNode(SPISD::TAIL_CALL, dl, MVT::Other,
Ops);
1176 Chain = DAG.
getNode(SPISD::CALL, dl, NodeTys,
Ops);
1190 for (
unsigned i = 0; i != RVLocs.
size(); ++i) {
1191 assert(RVLocs[i].isRegLoc() &&
"Can only return in registers!");
1192 if (RVLocs[i].getLocVT() == MVT::v2i32) {
1195 Chain, dl,
toCallerWindow(RVLocs[i++].getLocReg()), MVT::i32, InGlue);
1196 Chain =
Lo.getValue(1);
1197 InGlue =
Lo.getValue(2);
1201 Chain, dl,
toCallerWindow(RVLocs[i].getLocReg()), MVT::i32, InGlue);
1202 Chain =
Hi.getValue(1);
1203 InGlue =
Hi.getValue(2);
1210 RVLocs[i].getValVT(), InGlue)
1225 Name.consume_front(
"%");
1227 .
Cases({
"r24",
"i0"}, SP::I0)
1228 .Cases({
"r25",
"i1"}, SP::I1)
1229 .Cases({
"r26",
"i2"}, SP::I2)
1230 .Cases({
"r27",
"i3"}, SP::I3)
1231 .Cases({
"r28",
"i4"}, SP::I4)
1232 .Cases({
"r29",
"i5"}, SP::I5)
1233 .Cases({
"r30",
"i6",
"fp"}, SP::I6)
1234 .Cases({
"r31",
"i7"}, SP::I7)
1235 .Cases({
"r8",
"o0"}, SP::O0)
1236 .Cases({
"r9",
"o1"}, SP::O1)
1237 .Cases({
"r10",
"o2"}, SP::O2)
1238 .Cases({
"r11",
"o3"}, SP::O3)
1239 .Cases({
"r12",
"o4"}, SP::O4)
1240 .Cases({
"r13",
"o5"}, SP::O5)
1241 .Cases({
"r14",
"o6",
"sp"}, SP::O6)
1242 .Cases({
"r15",
"o7"}, SP::O7)
1243 .Cases({
"r16",
"l0"}, SP::L0)
1244 .Cases({
"r17",
"l1"}, SP::L1)
1245 .Cases({
"r18",
"l2"}, SP::L2)
1246 .Cases({
"r19",
"l3"}, SP::L3)
1247 .Cases({
"r20",
"l4"}, SP::L4)
1248 .Cases({
"r21",
"l5"}, SP::L5)
1249 .Cases({
"r22",
"l6"}, SP::L6)
1250 .Cases({
"r23",
"l7"}, SP::L7)
1251 .Cases({
"r0",
"g0"}, SP::G0)
1252 .Cases({
"r1",
"g1"}, SP::G1)
1253 .Cases({
"r2",
"g2"}, SP::G2)
1254 .Cases({
"r3",
"g3"}, SP::G3)
1255 .Cases({
"r4",
"g4"}, SP::G4)
1256 .Cases({
"r5",
"g5"}, SP::G5)
1257 .Cases({
"r6",
"g6"}, SP::G6)
1258 .Cases({
"r7",
"g7"}, SP::G7)
1265 if (!
TRI->isReservedReg(MF, Reg))
1282 MVT ValTy = VA.getLocVT();
1285 if (!VA.isRegLoc() || (ValTy != MVT::f64 && ValTy != MVT::f128))
1288 if (!Outs[VA.getValNo()].Flags.isVarArg())
1293 Register firstReg = (ValTy == MVT::f64) ? SP::D0 : SP::Q0;
1294 unsigned argSize = (ValTy == MVT::f64) ? 8 : 16;
1295 unsigned Offset = argSize * (VA.getLocReg() - firstReg);
1296 assert(
Offset < 16*8 &&
"Offset out of range, bad register enum?");
1300 unsigned IReg = SP::I0 +
Offset/8;
1301 if (ValTy == MVT::f64)
1306 assert(ValTy == MVT::f128 &&
"Unexpected type!");
1315 VA.getLocVT(), VA.getLocInfo());
1340 "call site marked musttail");
1346 unsigned StackReserved = 6 * 8u;
1347 unsigned ArgsSize = std::max<unsigned>(StackReserved, CCInfo.
getStackSize());
1350 ArgsSize =
alignTo(ArgsSize, 16);
1374 for (
unsigned i = 0, e = ArgLocs.
size(); i != e; ++i) {
1430 RegsToPass.
push_back(std::make_pair(HiReg, Hi64));
1431 RegsToPass.
push_back(std::make_pair(LoReg, Lo64));
1443 if (i+1 < ArgLocs.
size() && ArgLocs[i+1].isRegLoc() &&
1444 ArgLocs[i+1].getLocReg() == VA.
getLocReg()) {
1456 RegsToPass.
push_back(std::make_pair(Reg, Arg));
1467 Subtarget->getStackPointerBias() +
1475 if (!MemOpChains.
empty())
1483 for (
const auto &[Reg,
N] : RegsToPass) {
1500 Ops.push_back(Chain);
1501 Ops.push_back(Callee);
1502 for (
const auto &[Reg,
N] : RegsToPass)
1508 ((hasReturnsTwice) ?
TRI->getRTCallPreservedMask(CLI.
CallConv)
1515 assert(Mask &&
"Missing call preserved mask for calling convention");
1521 Ops.push_back(InGlue);
1526 return DAG.
getNode(SPISD::TAIL_CALL,
DL, MVT::Other,
Ops);
1546 if (CLI.
Ins.size() == 1 && CLI.
Ins[0].VT == MVT::f32 && !CLI.
CB)
1547 CLI.
Ins[0].Flags.setInReg();
1552 for (
unsigned i = 0; i != RVLocs.
size(); ++i) {
1685 MVT PtrVT = Subtarget->is64Bit() ? MVT::i64 : MVT::i32;
1697 if (!Subtarget->useSoftFloat()) {
1702 if (Subtarget->is64Bit()) {
1780 if (Subtarget->is64Bit()) {
1842 if (Subtarget->isVIS3()) {
1847 if (Subtarget->is64Bit()) {
1872 if (Subtarget->isV9()) {
1873 if (Subtarget->is64Bit() || Subtarget->isV8Plus())
1877 }
else if (Subtarget->hasLeonCasa())
1892 if (Subtarget->is64Bit()) {
1897 }
else if (Subtarget->isV9() && Subtarget->isV8Plus()) {
1906 if (!Subtarget->isV9()) {
1948 if (Subtarget->useSoftMulDiv()) {
1956 if (Subtarget->is64Bit()) {
1990 if (Subtarget->isV9() && Subtarget->hasHardQuad()) {
1998 if (Subtarget->hasHardQuad()) {
2006 if (Subtarget->isV9()) {
2029 if (Subtarget->hasNoFMULS()) {
2036 if (!Subtarget->useSoftFloat()) {
2037 for (
MVT VT : {MVT::f32, MVT::f64}) {
2047 for (
MVT VT : {MVT::f32, MVT::f64, MVT::f128})
2050 for (
MVT VT : {MVT::i32, MVT::i64})
2055 if (Subtarget->hasHardQuad()) {
2070 if (Subtarget->hasNoFMULS())
2075 if (!Subtarget->is64Bit())
2078 if (Subtarget->isV9())
2081 if (Subtarget->hasLeonCycleCounter())
2085 if (Subtarget->isVIS3()) {
2097 }
else if (Subtarget->usePopc()) {
2138 return Subtarget->useSoftFloat();
2154 const APInt &DemandedElts,
2156 unsigned Depth)
const {
2160 switch (
Op.getOpcode()) {
2162 case SPISD::SELECT_ICC:
2163 case SPISD::SELECT_XCC:
2164 case SPISD::SELECT_FCC:
2179 (((
LHS.getOpcode() == SPISD::SELECT_ICC ||
2180 LHS.getOpcode() == SPISD::SELECT_XCC) &&
2181 LHS.getOperand(3).getOpcode() == SPISD::CMPICC) ||
2182 (
LHS.getOpcode() == SPISD::SELECT_FCC &&
2183 (
LHS.getOperand(3).getOpcode() == SPISD::CMPFCC ||
2184 LHS.getOperand(3).getOpcode() == SPISD::CMPFCC_V9))) &&
2187 SPCC =
LHS.getConstantOperandVal(2);
2199 GA->getValueType(0),
2200 GA->getOffset(), TF);
2204 CP->getAlign(), CP->getOffset(), TF);
2214 ES->getValueType(0), TF);
2222 unsigned HiTF,
unsigned LoTF,
2225 EVT VT =
Op.getValueType();
2297 return makeHiLoPair(
Op, ELF::R_SPARC_HI22, ELF::R_SPARC_LO10, DAG);
2303 L44 = DAG.
getNode(SPISD::Lo,
DL, VT, L44);
2347 : ELF::R_SPARC_TLS_LDM_HI22);
2350 : ELF::R_SPARC_TLS_LDM_LO10);
2353 : ELF::R_SPARC_TLS_LDM_ADD);
2356 : ELF::R_SPARC_TLS_LDM_CALL);
2373 const uint32_t *Mask = Subtarget->getRegisterInfo()->getCallPreservedMask(
2375 assert(Mask &&
"Missing call preserved mask for calling convention");
2382 Chain = DAG.
getNode(SPISD::TLS_CALL,
DL, NodeTys,
Ops);
2398 return DAG.
getNode(SPISD::TLS_ADD,
DL, PtrVT, Ret, HiLo,
2403 unsigned ldTF = ((PtrVT == MVT::i64) ? ELF::R_SPARC_TLS_IE_LDX
2404 : ELF::R_SPARC_TLS_IE_LD);
2414 ELF::R_SPARC_TLS_IE_LO10, DAG);
2421 return DAG.
getNode(SPISD::TLS_ADD,
DL, PtrVT,
2452 Args.emplace_back(Arg, ArgTy);
2458 RTLIB::Libcall LibFunc,
2459 unsigned numArgs)
const {
2461 if (LibFuncImpl == RTLIB::Unsupported)
2471 Type *RetTyABI = RetTy;
2475 bool IsStrict =
Op->isStrictFPOpcode();
2477 unsigned FirstArg = IsStrict ? 1 : 0;
2486 if (!Subtarget->is64Bit()) {
2487 Entry.IsSRet =
true;
2488 Entry.IndirectType = RetTy;
2490 Entry.IsReturned =
false;
2491 Args.push_back(Entry);
2495 assert(
Op->getNumOperands() >= numArgs + FirstArg &&
"Not enough operands!");
2496 for (
unsigned i = 0, e = numArgs; i != e; ++i) {
2509 if (RetTyABI == RetTy) {
2535 bool &Invert,
bool &Signaling) {
2541 return Is64Bit ?
"_Qp_feq" :
"_Q_feq";
2544 return Is64Bit ?
"_Qp_fne" :
"_Q_fne";
2549 return Is64Bit ?
"_Qp_flt" :
"_Q_flt";
2554 return Is64Bit ?
"_Qp_fle" :
"_Q_fle";
2559 return Is64Bit ?
"_Qp_fgt" :
"_Q_fgt";
2564 return Is64Bit ?
"_Qp_fge" :
"_Q_fge";
2574 bool is64Bit = Subtarget->is64Bit();
2575 bool Invert, Signaling;
2578 bool IsPredicateCall =
LibCall !=
nullptr;
2579 if (!IsPredicateCall)
2600 if (IsPredicateCall) {
2603 return DAG.
getNode(SPISD::CMPICC,
DL, MVT::Glue, Result, RHS);
2612 return DAG.
getNode(SPISD::CMPICC,
DL, MVT::Glue, Result, RHS);
2617 return DAG.
getNode(SPISD::CMPICC,
DL, MVT::Glue, Result, RHS);
2626 return DAG.
getNode(SPISD::CMPICC,
DL, MVT::Glue, Result, RHS);
2635 return DAG.
getNode(SPISD::CMPICC,
DL, MVT::Glue, Result, RHS);
2650 bool is64Bit = Subtarget->is64Bit();
2669 auto Compare = [&](
SDValue V, uint64_t
C,
unsigned NewSPCC) {
2671 return DAG.
getNode(SPISD::CMPICC,
DL, MVT::Glue, V,
2681 EVT ResVT = GE.getValueType();
2689 bool Invert, Signaling;
2693 if (
LibCall && Signaling == IsSignaling)
2701 EVT ResVT = Result.getValueType();
2744 EVT SrcVT =
Op.getOperand(
Op->isStrictFPOpcode() ? 1 : 0).getValueType();
2746 if (SrcVT == MVT::f64)
2747 return TLI.LowerF128Op(
Op, DAG, RTLIB::FPEXT_F64_F128, 1);
2749 if (SrcVT == MVT::f32)
2750 return TLI.LowerF128Op(
Op, DAG, RTLIB::FPEXT_F32_F128, 1);
2760 if (
Op.getOperand(
Op->isStrictFPOpcode() ? 1 : 0).getValueType() != MVT::f128)
2763 if (
Op.getValueType() == MVT::f64)
2764 return TLI.LowerF128Op(
Op, DAG, RTLIB::FPROUND_F128_F64, 1);
2765 if (
Op.getValueType() == MVT::f32)
2766 return TLI.LowerF128Op(
Op, DAG, RTLIB::FPROUND_F128_F32, 1);
2776 EVT VT =
Op.getValueType();
2777 assert(VT == MVT::i32 || VT == MVT::i64);
2778 bool IsStrict =
Op->isStrictFPOpcode();
2779 SDValue Src =
Op.getOperand(IsStrict ? 1 : 0);
2782 if (Src.getValueType() == MVT::f128 &&
2783 (!hasHardQuad || !
TLI.isTypeLegal(VT))) {
2784 RTLIB::Libcall LibFunc =
2785 VT == MVT::i32 ? RTLIB::FPTOSINT_F128_I32 : RTLIB::FPTOSINT_F128_I64;
2786 return TLI.LowerF128Op(
Op, DAG, LibFunc, 1);
2790 if (!
TLI.isTypeLegal(VT))
2794 MVT FloatVT = VT == MVT::i32 ? MVT::f32 : MVT::f64;
2796 unsigned Opc = VT == MVT::i32 ? SPISD::STRICT_FTOI : SPISD::STRICT_FTOX;
2798 DAG.
getNode(
Opc, dl, {FloatVT, MVT::Other}, {
Op.getOperand(0), Src});
2803 unsigned Opc = VT == MVT::i32 ? SPISD::FTOI : SPISD::FTOX;
2812 bool IsStrict =
Op->isStrictFPOpcode();
2813 SDValue Src =
Op.getOperand(IsStrict ? 1 : 0);
2814 EVT OpVT = Src.getValueType();
2815 assert(OpVT == MVT::i32 || (OpVT == MVT::i64));
2817 EVT floatVT = (OpVT == MVT::i32) ? MVT::f32 : MVT::f64;
2820 if (
Op.getValueType() == MVT::f128
2821 && (!hasHardQuad || !
TLI.isTypeLegal(OpVT))) {
2822 RTLIB::Libcall LibFunc =
2823 OpVT == MVT::i32 ? RTLIB::SINTTOFP_I32_F128 : RTLIB::SINTTOFP_I64_F128;
2824 return TLI.LowerF128Op(
Op, DAG, LibFunc, 1);
2828 if (!
TLI.isTypeLegal(OpVT))
2837 LD->getMemOperand()->clearRanges();
2838 Tmp = DAG.
getLoad(floatVT, dl, LD->getChain(), LD->getBasePtr(),
2839 LD->getMemOperand());
2845 unsigned Opc = OpVT == MVT::i32 ? SPISD::STRICT_ITOF : SPISD::STRICT_XTOF;
2846 return DAG.
getNode(
Opc, dl, {
Op.getValueType(), MVT::Other},
2847 {
Op.getOperand(0), Tmp});
2849 unsigned opcode = (OpVT == MVT::i32)? SPISD::ITOF : SPISD::XTOF;
2850 return DAG.
getNode(opcode, dl,
Op.getValueType(), Tmp);
2856 EVT VT =
Op.getValueType();
2857 SDValue Src =
Op.getOperand(
Op->isStrictFPOpcode() ? 1 : 0);
2861 if (Src.getValueType() != MVT::f128 || (hasHardQuad &&
TLI.isTypeLegal(VT)))
2864 assert(VT == MVT::i32 || VT == MVT::i64);
2866 return TLI.LowerF128Op(
2868 VT == MVT::i32 ? RTLIB::FPTOUINT_F128_I32 : RTLIB::FPTOUINT_F128_I64, 1);
2875 EVT VT =
Op.getValueType();
2876 bool IsStrict =
Op->isStrictFPOpcode();
2877 SDValue Src =
Op.getOperand(IsStrict ? 1 : 0);
2878 EVT OpVT = Src.getValueType();
2879 assert(OpVT == MVT::i32 || OpVT == MVT::i64);
2883 if (VT == MVT::f128 && (!hasHardQuad || !
TLI.isTypeLegal(OpVT)))
2884 return TLI.LowerF128Op(
Op, DAG,
2885 OpVT == MVT::i32 ? RTLIB::UINTTOFP_I32_F128
2886 : RTLIB::UINTTOFP_I64_F128,
2893 if (OpVT == MVT::i32 &&
TLI.isTypeLegal(MVT::i64)) {
2897 {
Op.getOperand(0), Ext});
2907 if (!IsStrict && OpVT == MVT::i64 && VT == MVT::f64 &&
2908 TLI.isTypeLegal(MVT::i64)) {
2909 if (
Op->getFlags().hasNonNeg())
2924 return DAG.
getSelect(dl, MVT::f64, SignBitTest, Dbl, Cvt);
2936 bool hasHardQuad,
bool isV9) {
2943 EVT VT =
Op.getValueType();
2948 if (!hasHardQuad &&
LHS.getValueType() == MVT::f128) {
2950 TLI.LowerF128StrictCompare(Chain,
LHS,
RHS,
SPCC, IsSignaling, dl, DAG);
2951 SelectOpc = SPISD::SELECT_ICC;
2955 CmpOpc = IsSignaling ? SPISD::STRICT_CMPFCCS_V9 : SPISD::STRICT_CMPFCC_V9;
2957 CmpOpc = IsSignaling ? SPISD::STRICT_CMPFCCS : SPISD::STRICT_CMPFCC;
2959 DAG.
getNode(CmpOpc, dl, {MVT::Other, MVT::Glue}, {Chain,
LHS,
RHS});
2960 Chain = Cmp.getValue(0);
2961 CompareFlag = Cmp.getValue(1);
2962 SelectOpc = SPISD::SELECT_FCC;
2988 LHS.getOpcode() != SPISD::SELECT_FCC || !
LHS.hasOneUse() ||
2992 SDNode *Cmp =
LHS.getOperand(3).getNode();
2993 switch (Cmp->getOpcode()) {
2994 case SPISD::STRICT_CMPFCC:
2995 case SPISD::STRICT_CMPFCCS:
2996 case SPISD::STRICT_CMPFCC_V9:
2997 case SPISD::STRICT_CMPFCCS_V9:
3007 if (Chain == CmpChain) {
3015 Ops.push_back(Cmp->getOperand(0));
3018 DAG.
getNode(Cmp->getOpcode(),
DL, Cmp->getVTList(),
3019 {InChain, Cmp->getOperand(1), Cmp->getOperand(2)});
3026 SPCC =
LHS.getConstantOperandVal(2);
3047 if ((Sel.
getOpcode() == SPISD::SELECT_ICC ||
3049 Sel.
getOpcode() == SPISD::SELECT_FCC) &&
3062 return DAG.
getNode(isV9 ? SPISD::BRFCC_V9 : SPISD::BRFCC, dl, MVT::Other,
3068 if (
LHS.getValueType().isInteger()) {
3071 if (
is64Bit && isV9 &&
LHS.getValueType() == MVT::i64 &&
3073 return DAG.
getNode(SPISD::BR_REG, dl, MVT::Other, Chain, Dest,
3077 CompareFlag = DAG.
getNode(SPISD::CMPICC, dl, MVT::Glue,
LHS,
RHS);
3081 Opc =
LHS.getValueType() == MVT::i32 ? SPISD::BPICC : SPISD::BPXCC;
3086 if (!hasHardQuad &&
LHS.getValueType() == MVT::f128) {
3088 CompareFlag =
TLI.LowerF128Compare(
LHS,
RHS,
SPCC, dl, DAG);
3089 Opc = isV9 ? SPISD::BPICC : SPISD::BRICC;
3091 unsigned CmpOpc = isV9 ? SPISD::CMPFCC_V9 : SPISD::CMPFCC;
3094 Opc = isV9 ? SPISD::BRFCC_V9 : SPISD::BRFCC;
3097 return DAG.
getNode(
Opc, dl, MVT::Other, Chain, Dest,
3118 if (
LHS.getValueType().isInteger()) {
3125 EVT ValType = TrueVal.getValueType();
3126 bool IsEligibleType = ValType.isScalarInteger() || ValType == MVT::f32 ||
3127 ValType == MVT::f64 ||
3128 (ValType == MVT::f128 && hasHardQuad);
3129 if (
is64Bit && isV9 &&
LHS.getValueType() == MVT::i64 &&
3132 SPISD::SELECT_REG, dl, TrueVal.getValueType(), TrueVal, FalseVal,
3135 CompareFlag = DAG.
getNode(SPISD::CMPICC, dl, MVT::Glue,
LHS,
RHS);
3136 Opc =
LHS.getValueType() == MVT::i32 ?
3137 SPISD::SELECT_ICC : SPISD::SELECT_XCC;
3140 if (!hasHardQuad &&
LHS.getValueType() == MVT::f128) {
3142 CompareFlag =
TLI.LowerF128Compare(
LHS,
RHS,
SPCC, dl, DAG);
3143 Opc = SPISD::SELECT_ICC;
3145 unsigned CmpOpc = isV9 ? SPISD::CMPFCC_V9 : SPISD::CMPFCC;
3147 Opc = SPISD::SELECT_FCC;
3151 return DAG.
getNode(
Opc, dl, TrueVal.getValueType(), TrueVal, FalseVal,
3177 EVT VT =
Node->getValueType(0);
3202 EVT VT =
Op->getValueType(0);
3209 unsigned OffsetToStackStart =
Subtarget.getStackPointerBias();
3211 OffsetToStackStart += 16 * (
Subtarget.is64Bit() ? 8 : 4);
3214 OffsetToStackStart += 4;
3228 EVT VT =
Size->getValueType(0);
3231 unsigned SPReg = SP::O6;
3236 unsigned regSpillArea;
3266 int64_t Bias =
Subtarget->getStackPointerBias();
3277 bool IsOveraligned = MaybeAlignment.has_value();
3302 bool AlwaysFlush =
false) {
3306 EVT VT =
Op.getValueType();
3308 unsigned FrameReg = SP::I6;
3309 unsigned stackBias =
Subtarget->getStackPointerBias();
3336 uint64_t depth =
Op.getConstantOperandVal(0);
3349 EVT VT =
Op.getValueType();
3351 uint64_t depth =
Op.getConstantOperandVal(0);
3394 Lo32 = DAG.
getNode(opcode, dl, MVT::f32, Lo32);
3396 Hi32 = DAG.
getNode(opcode, dl, MVT::f32, Hi32);
3475 IsLittleEndian ? SPISD::STORE_BIG : SPISD::STORE_LITTLE,
DL,
3488 if (MemVT == MVT::f128)
3536 EVT MemVT = St->getMemoryVT();
3537 if (MemVT == MVT::f128)
3540 if (MemVT == MVT::i64 && St->getAlign() >=
Align(8)) {
3545 St->getChain(), dl, Val, St->getBasePtr(), St->getPointerInfo(),
3546 St->getBaseAlign(), St->getMemOperand()->
getFlags(), St->getAAInfo());
3555 &&
"invalid opcode");
3559 if (
Op.getValueType() == MVT::f64)
3561 if (
Op.getValueType() != MVT::f128)
3577 Lo64 = DAG.
getNode(
Op.getOpcode(), dl, MVT::f64, Lo64);
3582 Hi64 = DAG.
getNode(
Op.getOpcode(), dl, MVT::f64, Hi64);
3603 Op.getOperand(1).getValueType() == MVT::i64 &&
3607 return DAG.
getStore(AN->getChain(),
DL, Val, AN->getBasePtr(),
3608 AN->getMemOperand());
3630 EVT VT =
Op.getValueType();
3631 EVT IdxVT = Idx.getValueType();
3642 unsigned IntNo =
Op.getConstantOperandVal(0);
3645 case Intrinsic::thread_pointer: {
3655 bool hasHardQuad = Subtarget->hasHardQuad();
3656 bool isV9 = Subtarget->isV9();
3657 bool is64Bit = Subtarget->is64Bit();
3659 switch (
Op.getOpcode()) {
3735 APInt V =
C->getValueAPF().bitcastToAPInt();
3749 Src.getSimpleValueType() == MVT::f64)
3760 EVT VT =
N->getValueType(0);
3768 if (Subtarget->isV9() && IsAlignedLoad &&
Op.getNode()->hasOneUse() &&
3769 (VT == MVT::i16 || VT == MVT::i32 ||
3770 (Subtarget->is64Bit() && VT == MVT::i64))) {
3778 IsLittleEndian ? SPISD::LOAD_BIG : SPISD::LOAD_LITTLE,
DL,
3779 DAG.
getVTList(VT == MVT::i64 ? MVT::i64 : MVT::i32, MVT::Other),
Ops,
3780 LD->getMemoryVT(), LD->getMemOperand());
3798 EVT VT =
Op.getValueType();
3800 unsigned Opcode =
Op.getOpcode();
3807 if (Subtarget->isV9() && Opcode ==
ISD::BSWAP &&
Op.getNode()->hasOneUse() &&
3809 (VT == MVT::i16 || VT == MVT::i32 ||
3810 (Subtarget->is64Bit() && VT == MVT::i64))) {
3830 SDValue Ops[] = {
N->getOperand(0), BSwapOp,
N->getOperand(2),
3833 IsLittleEndian ? SPISD::STORE_BIG : SPISD::STORE_LITTLE,
DL,
3843 switch (
N->getOpcode()) {
3877 Register HiAgain =
MRI.createVirtualRegister(&SP::IntRegsRegClass);
3886 MI.eraseFromParent();
3893 switch (
MI.getOpcode()) {
3896 case SP::ReadCycleCounter:
3898 case SP::SELECT_CC_Int_ICC:
3899 case SP::SELECT_CC_FP_ICC:
3900 case SP::SELECT_CC_DFP_ICC:
3901 case SP::SELECT_CC_QFP_ICC:
3902 if (Subtarget->isV9())
3905 case SP::SELECT_CC_Int_XCC:
3906 case SP::SELECT_CC_FP_XCC:
3907 case SP::SELECT_CC_DFP_XCC:
3908 case SP::SELECT_CC_QFP_XCC:
3910 case SP::SELECT_CC_Int_FCC:
3911 case SP::SELECT_CC_FP_FCC:
3912 case SP::SELECT_CC_DFP_FCC:
3913 case SP::SELECT_CC_QFP_FCC:
3914 if (Subtarget->isV9())
3922 unsigned BROpcode)
const {
3945 F->insert(It, IfFalseMBB);
3946 F->insert(It, SinkMBB);
3966 MI.getOperand(0).getReg())
3972 MI.eraseFromParent();
3984 if (Constraint.
size() == 1) {
3985 switch (Constraint[0]) {
4007 switch (Constraint) {
4019 return isUInt<32>(Val) && (Val & 0x3ff) == 0;
4029 const char *constraint)
const {
4031 Value *CallOperandVal =
info.CallOperandVal;
4034 if (!CallOperandVal)
4038 switch (*constraint) {
4066 if (Constraint.
size() > 1)
4069 char ConstraintLetter = Constraint[0];
4070 switch (ConstraintLetter) {
4089 if (Result.getNode()) {
4090 Ops.push_back(Result);
4096std::pair<unsigned, const TargetRegisterClass *>
4100 if (Constraint.
empty())
4101 return std::make_pair(0U,
nullptr);
4103 if (Constraint.
size() == 1) {
4104 switch (Constraint[0]) {
4106 if (VT == MVT::v2i32)
4107 return std::make_pair(0U, &SP::IntPairRegClass);
4108 else if (Subtarget->is64Bit())
4109 return std::make_pair(0U, &SP::I64RegsRegClass);
4111 return std::make_pair(0U, &SP::IntRegsRegClass);
4113 if (VT == MVT::f32 || VT == MVT::i32)
4114 return std::make_pair(0U, &SP::FPRegsRegClass);
4115 else if (VT == MVT::f64 || VT == MVT::i64)
4116 return std::make_pair(0U, &SP::LowDFPRegsRegClass);
4117 else if (VT == MVT::f128)
4118 return std::make_pair(0U, &SP::LowQFPRegsRegClass);
4120 return std::make_pair(0U,
nullptr);
4122 if (VT == MVT::f32 || VT == MVT::i32)
4123 return std::make_pair(0U, &SP::FPRegsRegClass);
4124 else if (VT == MVT::f64 || VT == MVT::i64 )
4125 return std::make_pair(0U, &SP::DFPRegsRegClass);
4126 else if (VT == MVT::f128)
4127 return std::make_pair(0U, &SP::QFPRegsRegClass);
4129 return std::make_pair(0U,
nullptr);
4133 if (Constraint.
front() !=
'{')
4134 return std::make_pair(0U,
nullptr);
4136 assert(Constraint.
back() ==
'}' &&
"Not a brace enclosed constraint?");
4139 return std::make_pair(0U,
nullptr);
4142 .
Cases({
"cc",
"icc"}, SP::ICC)
4143 .Case(
"fcc0", SP::FCC0)
4144 .
Case(
"fcc1", SP::FCC1)
4145 .
Case(
"fcc2", SP::FCC2)
4146 .
Case(
"fcc3", SP::FCC3)
4148 if (CCReg == SP::ICC)
4149 return std::make_pair(CCReg, &SP::ICCRegsRegClass);
4151 return std::make_pair(CCReg, &SP::FCCRegsRegClass);
4153 unsigned long long RegNo;
4162 return std::make_pair(0U,
nullptr);
4163 const char RegTypes[] = {
'g',
'o',
'l',
'i'};
4164 char RegType = RegTypes[RegNo / 8];
4165 char RegIndex =
'0' + (RegNo % 8);
4166 char Tmp[] = {
'{', RegType, RegIndex,
'}', 0};
4171 if (VT != MVT::f32 && VT != MVT::Other &&
RegName[0] ==
'f' &&
4173 if (VT == MVT::f64 && (RegNo % 2 == 0)) {
4176 }
else if (VT == MVT::f128 && (RegNo % 4 == 0)) {
4180 return std::make_pair(0U,
nullptr);
4186 if (!ResultPair.second)
4187 return std::make_pair(0U,
nullptr);
4190 if (Subtarget->is64Bit() && VT == MVT::i64) {
4191 assert(ResultPair.second == &SP::IntRegsRegClass &&
4192 "Unexpected register class");
4193 return std::make_pair(ResultPair.first, &SP::I64RegsRegClass);
4211 RTLIB::Libcall libCall = RTLIB::UNKNOWN_LIBCALL;
4213 switch (
N->getOpcode()) {
4215 llvm_unreachable(
"Do not know how to custom type legalize this operation!");
4221 bool IsStrict =
N->isStrictFPOpcode();
4223 if (
N->getOperand(IsStrict ? 1 : 0).getValueType() != MVT::f128 ||
4224 N->getValueType(0) != MVT::i64)
4228 ? RTLIB::FPTOSINT_F128_I64
4229 : RTLIB::FPTOUINT_F128_I64);
4239 assert(Subtarget->hasLeonCycleCounter());
4242 DAG.
getNode(SPISD::READ_CYCLE_COUNTER, dl, VTs,
N->getOperand(0));
4252 bool IsStrict =
N->isStrictFPOpcode();
4254 if (
N->getValueType(0) != MVT::f128 ||
4255 N->getOperand(IsStrict ? 1 : 0).getValueType() != MVT::i64)
4260 ? RTLIB::SINTTOFP_I64_F128
4261 : RTLIB::UINTTOFP_I64_F128);
4273 if (Ld->getValueType(0) != MVT::i64 || Ld->getMemoryVT() != MVT::i64 ||
4274 Ld->getAlign() <
Align(8))
4279 Ld->getExtensionType(), dl, MVT::v2i32, Ld->getChain(),
4280 Ld->getBasePtr(), Ld->getPointerInfo(), MVT::v2i32, Ld->getBaseAlign(),
4281 Ld->getMemOperand()->getFlags(), Ld->getAAInfo());
4293 assert(AN->getMemoryVT() == MVT::i64 && !Subtarget->is64Bit());
4295 AN->getBasePtr(), AN->getMemOperand());
4303 assert(AN->getMemoryVT() == MVT::i64 && !Subtarget->is64Bit());
4304 auto [CmpLo, CmpHi] =
4305 DAG.
SplitScalar(
N->getOperand(2), dl, MVT::i32, MVT::i32);
4306 auto [NewLo, NewHi] =
4307 DAG.
SplitScalar(
N->getOperand(3), dl, MVT::i32, MVT::i32);
4308 SDValue Ops[] = {
N->getOperand(1), CmpHi, CmpLo, NewHi, NewLo,
4311 SP::CASX_V8PLUS, dl,
4312 DAG.
getVTList(MVT::i32, MVT::i32, MVT::i32, MVT::Other),
Ops);
4316 ->setUsesV8PlusRegs();
4327 if (!Subtarget->getTargetTriple().isOSLinux())
4333 if (Subtarget->isVIS3())
4334 return VT == MVT::f32 || VT == MVT::f64;
4340 bool ForCodeSize)
const {
4341 if (VT != MVT::f32 && VT != MVT::f64)
4343 if (Subtarget->isVIS() &&
Imm.isZero())
4346 if (Subtarget->isVIS3() &&
Imm.getExactLog2Abs() == -1)
4356 if (Subtarget->is64Bit() && Subtarget->usePopc())
4364 return Subtarget->isUA2007() && !Subtarget->useSoftFloat();
4369 assert(
MI.getOpcode() == SP::SUBCCrr ||
MI.getOpcode() == SP::SUBCCri);
4371 if (!
Node->hasAnyUseOfValue(0))
4372 MI.getOperand(0).setReg(SP::G0);
4378 bool HasStoreSemantics =
4396 return Builder.CreateFence(Ord);
const AArch64Subtarget & Subtarget
const TargetLowering & TLI
assert(UImm &&(UImm !=~static_cast< T >(0)) &&"Invalid immediate!")
static SDValue LowerVASTART(SDValue Op, SelectionDAG &DAG)
static SDValue LowerEXTRACT_VECTOR_ELT(SDValue Op, SelectionDAG &DAG, const ARMSubtarget *ST)
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")
const HexagonInstrInfo * TII
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 LPCC::CondCode IntCondCCodeToICC(SDValue CC, const SDLoc &DL, SDValue &RHS, SelectionDAG &DAG)
Register const TargetRegisterInfo * TRI
Promote Memory to Register
static CodeModel::Model getCodeModel(const PPCSubtarget &S, const TargetMachine &TM, const MachineOperand &MO)
static constexpr MCPhysReg SPReg
MachineRegisterInfo & MRI
static void EmitCall(MCStreamer &OutStreamer, MCOperand &Callee, const MCSubtargetInfo &STI)
static SDValue LowerFP_TO_UINT(SDValue Op, SelectionDAG &DAG, const SparcTargetLowering &TLI, bool hasHardQuad)
static bool CC_Sparc_Assign_Ret_Split_64(unsigned &ValNo, MVT &ValVT, MVT &LocVT, CCValAssign::LocInfo &LocInfo, ISD::ArgFlagsTy &ArgFlags, CCState &State)
static SDValue LowerUINT_TO_FP(SDValue Op, SelectionDAG &DAG, const SparcTargetLowering &TLI, bool hasHardQuad)
static bool CC_Sparc_Assign_Split_64(unsigned &ValNo, MVT &ValVT, MVT &LocVT, CCValAssign::LocInfo &LocInfo, ISD::ArgFlagsTy &ArgFlags, CCState &State)
static SDValue LowerSTRICT_FSETCC(SDValue Op, SelectionDAG &DAG, const SparcTargetLowering &TLI, bool hasHardQuad, bool isV9)
static SDValue getFRAMEADDR(uint64_t depth, SDValue Op, SelectionDAG &DAG, const SparcSubtarget *Subtarget, bool AlwaysFlush=false)
static unsigned toCallerWindow(unsigned Reg)
static bool isValidImmForConstraint(char Constraint, int64_t Val)
isValidImmForConstraint - Return true if constraint is satisfied
static SDValue LowerSTACKADDRESS(SDValue Op, SelectionDAG &DAG, const SparcSubtarget &Subtarget)
static SDValue LowerF128Store(SDValue Op, SelectionDAG &DAG)
static SPCC::CondCodes intCondCCodeToRcond(ISD::CondCode CC)
intCondCCodeToRcond - Convert a DAG integer condition code to a SPARC rcond condition.
static SDValue LowerLOAD(SDValue Op, SelectionDAG &DAG)
static void fixupVariableFloatArgs(SmallVectorImpl< CCValAssign > &ArgLocs, ArrayRef< ISD::OutputArg > Outs)
static SDValue LowerFP_TO_SINT(SDValue Op, SelectionDAG &DAG, const SparcTargetLowering &TLI, bool hasHardQuad)
static const char * getF128PredicateLibCall(unsigned SPCC, bool Is64Bit, bool &Invert, bool &Signaling)
static SPCC::CondCodes FPCondCCodeToFCC(ISD::CondCode CC)
FPCondCCodeToFCC - Convert a DAG floatingp oint condition code to a SPARC FCC condition.
static bool isAnyArgRegReserved(const SparcRegisterInfo *TRI, const MachineFunction &MF)
static SDValue getFLUSHW(SDValue Op, SelectionDAG &DAG)
static bool hasReturnsTwiceAttr(SelectionDAG &DAG, SDValue Callee, const CallBase *Call)
static SDValue LowerDYNAMIC_STACKALLOC(SDValue Op, SelectionDAG &DAG, const SparcSubtarget *Subtarget)
static SDValue LowerFRAMEADDR(SDValue Op, SelectionDAG &DAG, const SparcSubtarget *Subtarget)
static SDValue LowerF128_FPROUND(SDValue Op, SelectionDAG &DAG, const SparcTargetLowering &TLI)
static SDValue LowerF64Op(SDValue SrcReg64, const SDLoc &dl, SelectionDAG &DAG, unsigned opcode)
static bool RetCC_Sparc64_Full(unsigned &ValNo, MVT &ValVT, MVT &LocVT, CCValAssign::LocInfo &LocInfo, ISD::ArgFlagsTy &ArgFlags, CCState &State)
static SDValue LowerBR_CC(SDValue Op, SelectionDAG &DAG, const SparcTargetLowering &TLI, bool hasHardQuad, bool isV9, bool is64Bit)
static void emitReservedArgRegCallError(const MachineFunction &MF)
static SDValue LowerATOMIC_LOAD_STORE(SDValue Op, SelectionDAG &DAG)
static bool RetCC_Sparc64_Half(unsigned &ValNo, MVT &ValVT, MVT &LocVT, CCValAssign::LocInfo &LocInfo, ISD::ArgFlagsTy &ArgFlags, CCState &State)
static bool LookThroughStrictSetCC(SDValue &Chain, SDValue LHS, SDValue RHS, ISD::CondCode CC, unsigned &SPCC, SDValue &Glue, const SDLoc &DL, SelectionDAG &DAG)
static MachineBasicBlock * emitReadCycleCounter(MachineInstr &MI, MachineBasicBlock *BB)
static SDValue LowerSELECT_CC(SDValue Op, SelectionDAG &DAG, const SparcTargetLowering &TLI, bool hasHardQuad, bool isV9, bool is64Bit)
static SDValue LowerF128_FPEXTEND(SDValue Op, SelectionDAG &DAG, const SparcTargetLowering &TLI)
static SDValue LowerFNEGorFABS(SDValue Op, SelectionDAG &DAG, bool isV9)
static SDValue LowerVAARG(SDValue Op, SelectionDAG &DAG)
static bool CC_Sparc64_Half(unsigned &ValNo, MVT &ValVT, MVT &LocVT, CCValAssign::LocInfo &LocInfo, ISD::ArgFlagsTy &ArgFlags, CCState &State)
static bool CC_Sparc64_Full(unsigned &ValNo, MVT &ValVT, MVT &LocVT, CCValAssign::LocInfo &LocInfo, ISD::ArgFlagsTy &ArgFlags, CCState &State)
static bool CC_Sparc_Assign_SRet(unsigned &ValNo, MVT &ValVT, MVT &LocVT, CCValAssign::LocInfo &LocInfo, ISD::ArgFlagsTy &ArgFlags, CCState &State)
static bool Analyze_CC_Sparc64_Half(bool IsReturn, unsigned &ValNo, MVT &ValVT, MVT &LocVT, CCValAssign::LocInfo &LocInfo, ISD::ArgFlagsTy &ArgFlags, CCState &State)
static SDValue LowerF128Load(SDValue Op, SelectionDAG &DAG)
static SDValue LowerRETURNADDR(SDValue Op, SelectionDAG &DAG, const SparcTargetLowering &TLI, const SparcSubtarget *Subtarget)
static SDValue LowerSTORE(SDValue Op, SelectionDAG &DAG)
static void LookThroughSetCC(SDValue &LHS, SDValue &RHS, ISD::CondCode CC, unsigned &SPCC)
static bool Analyze_CC_Sparc64_Full(bool IsReturn, unsigned &ValNo, MVT &ValVT, MVT &LocVT, CCValAssign::LocInfo &LocInfo, ISD::ArgFlagsTy &ArgFlags, CCState &State)
static SDValue LowerSINT_TO_FP(SDValue Op, SelectionDAG &DAG, const SparcTargetLowering &TLI, bool hasHardQuad)
This file implements the StringSwitch template, which mimics a switch() statement whose cases are str...
This file describes how to lower LLVM code to machine code.
static bool is64Bit(const char *name)
Class for arbitrary precision integers.
This class represents an incoming formal argument to a Function.
Represent a constant reference to an array (0 or more elements consecutively in memory),...
an instruction that atomically reads a memory location, combines it with another value,...
BinOp getOperation() const
LLVM Basic Block Representation.
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,...
LLVM_ABI void AnalyzeCallResult(const SmallVectorImpl< ISD::InputArg > &Ins, CCAssignFn Fn)
AnalyzeCallResult - Analyze the return values of a call, incorporating info about the passed values i...
LLVM_ABI bool CheckReturn(const SmallVectorImpl< ISD::OutputArg > &Outs, CCAssignFn Fn)
CheckReturn - Analyze the return values of a function, returning true if the return can be performed ...
LLVM_ABI void AnalyzeReturn(const SmallVectorImpl< ISD::OutputArg > &Outs, CCAssignFn Fn)
AnalyzeReturn - Analyze the returned values of a return, incorporating info about the result values i...
LLVM_ABI void AnalyzeCallOperands(const SmallVectorImpl< ISD::OutputArg > &Outs, CCAssignFn Fn)
AnalyzeCallOperands - Analyze the outgoing arguments to a call, incorporating info about the passed v...
uint64_t getStackSize() const
Returns the size of the currently allocated portion of the stack.
LLVM_ABI void AnalyzeFormalArguments(const SmallVectorImpl< ISD::InputArg > &Ins, CCAssignFn Fn)
AnalyzeFormalArguments - Analyze an array of argument values, incorporating info about the formals in...
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)
static CCValAssign getMem(unsigned ValNo, MVT ValVT, int64_t Offset, MVT LocVT, LocInfo HTP, bool IsCustom=false)
int64_t getLocMemOffset() const
static CCValAssign getCustomMem(unsigned ValNo, MVT ValVT, int64_t Offset, MVT LocVT, LocInfo HTP)
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.
This is the shared class of boolean and integer constants.
A parsed version of the target data layout string in and methods for querying it.
bool isLittleEndian() const
Layout endianness...
LLVM_ABI TypeSize getTypeAllocSize(Type *Ty) const
Returns the offset in bytes between successive objects of the specified type, including alignment pad...
LLVM_ABI Align getPrefTypeAlign(Type *Ty) const
Returns the preferred stack/global alignment for the specified type.
Diagnostic information for unsupported feature in backend.
const Function & getFunction() const
bool hasFnAttribute(Attribute::AttrKind Kind) const
Return true if the function has the attribute.
const GlobalValue * getGlobal() const
Module * getParent()
Get the module that this global value is contained inside of...
Common base class shared among various IRBuilders.
This is an important class for using LLVM in a threaded context.
CallingConv::ID getLibcallImplCallingConv(RTLIB::LibcallImpl Call) const
Get the CallingConv that should be used for the specified libcall.
RTLIB::LibcallImpl getLibcallImpl(RTLIB::Libcall Call) const
Return the lowering's selection of implementation call for Call.
This class is used to represent ISD::LOAD nodes.
const SDValue & getBasePtr() const
const SDValue & getOffset() const
Wrapper class representing physical registers. Should be passed by value.
static auto integer_fixedlen_vector_valuetypes()
static auto integer_valuetypes()
TypeSize getSizeInBits() const
Returns the size of the specified MVT in bits.
static auto fp_valuetypes()
LLVM_ABI void transferSuccessorsAndUpdatePHIs(MachineBasicBlock *FromMBB)
Transfers all the successors, as in transferSuccessors, and update PHI operands in the successor bloc...
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 int CreateStackObject(uint64_t Size, Align Alignment, bool isSpillSlot, const AllocaInst *Alloca=nullptr, uint8_t ID=0)
Create a new statically sized stack object, returning a nonnegative identifier to represent it.
void setFrameAddressIsTaken(bool T)
void setHasTailCall(bool V=true)
void setReturnAddressIsTaken(bool s)
const TargetSubtargetInfo & getSubtarget() const
getSubtarget - Return the subtarget for which this machine code is being compiled.
MachineFrameInfo & getFrameInfo()
getFrameInfo - Return the frame info object for the current function.
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 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
Representation of each machine instruction.
@ MOLoad
The memory access reads data.
@ MOStore
The memory access writes data.
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.
An SDNode that represents everything that will be needed to construct a MachineInstr.
Align getBaseAlign() const
Returns alignment and volatility of the memory access.
const MachinePointerInfo & getPointerInfo() const
const SDValue & getChain() const
EVT getMemoryVT() const
Return the type of the in-memory value.
A Module instance is used to store all the information related to an LLVM module.
static PointerType * getUnqual(LLVMContext &C)
This constructs an opaque pointer to an object in the default address space (address space zero).
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.
iterator_range< value_op_iterator > op_values() const
SDNodeFlags getFlags() const
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.
const SDValue & getOperand(unsigned i) const
MVT getSimpleValueType() const
Return the simple ValueType of the referenced return value.
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)
const SDValue & getRoot() const
Return the root tag of the SelectionDAG.
const TargetSubtargetInfo & getSubtarget() const
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 SDValue getShiftAmountConstant(uint64_t Val, EVT VT, const SDLoc &DL)
LLVM_ABI MachineSDNode * getMachineNode(unsigned Opcode, const SDLoc &dl, EVT VT)
These are used for target selectors to create a new node with specified return type(s),...
LLVM_ABI SDValue getRegister(Register Reg, EVT VT)
LLVM_ABI SDValue getMemIntrinsicNode(unsigned Opcode, const SDLoc &dl, SDVTList VTList, ArrayRef< SDValue > Ops, EVT MemVT, MachinePointerInfo PtrInfo, Align Alignment, MachineMemOperand::Flags Flags=MachineMemOperand::MOLoad|MachineMemOperand::MOStore, LocationSize Size=LocationSize::precise(0), const AAMDNodes &AAInfo=AAMDNodes())
Creates a MemIntrinsicNode that may produce a result and takes a list of operands.
SDValue getSetCC(const SDLoc &DL, EVT VT, SDValue LHS, SDValue RHS, ISD::CondCode Cond, SDValue Chain=SDValue(), bool IsSignaling=false, SDNodeFlags Flags={})
Helper function to make it easier to build SetCC's if you just have an ISD::CondCode instead of an SD...
LLVM_ABI SDValue getMemcpy(SDValue Chain, const SDLoc &dl, SDValue Dst, SDValue Src, SDValue Size, Align 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 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 getBuildVector(EVT VT, const SDLoc &DL, ArrayRef< SDValue > Ops)
Return an ISD::BUILD_VECTOR node.
SDValue getCopyFromReg(SDValue Chain, const SDLoc &dl, Register Reg, EVT VT)
SDValue getSelect(const SDLoc &DL, EVT VT, SDValue Cond, SDValue LHS, SDValue RHS, SDNodeFlags Flags=SDNodeFlags())
Helper function to make it easier to build Select's if you just have operands and don't want to check...
LLVM_ABI void setNodeMemRefs(MachineSDNode *N, ArrayRef< MachineMemOperand * > NewMemRefs)
Mutate the specified machine node's memory references to the provided list.
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.
LLVM_ABI SDValue getMemBasePlusOffset(SDValue Base, TypeSize Offset, const SDLoc &DL, const SDNodeFlags Flags=SDNodeFlags())
Returns sum of the base pointer and offset.
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 ...
LLVM_ABI SDValue getTargetExtractSubreg(int SRIdx, const SDLoc &DL, EVT VT, SDValue Operand)
A convenience function for creating TargetInstrInfo::EXTRACT_SUBREG nodes.
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 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
const LibcallLoweringInfo & getLibcalls() 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.
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 KnownBits computeKnownBits(SDValue Op, unsigned Depth=0) const
Determine which bits of Op are known to be either zero or one and return them in Known.
LLVM_ABI SDValue getRegisterMask(const uint32_t *RegMask)
LLVMContext * getContext() const
LLVM_ABI SDValue getTargetExternalSymbol(const char *Sym, EVT VT, unsigned TargetFlags=0)
LLVM_ABI SDValue CreateStackTemporary(TypeSize Bytes, Align Alignment)
Create a stack temporary based on the size in bytes and the alignment.
SDValue getTargetConstantPool(const Constant *C, EVT VT, MaybeAlign Align=std::nullopt, int Offset=0, unsigned TargetFlags=0)
LLVM_ABI SDValue getTargetInsertSubreg(int SRIdx, const SDLoc &DL, EVT VT, SDValue Operand, SDValue Subreg)
A convenience function for creating TargetInstrInfo::INSERT_SUBREG nodes.
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.
Register getSRetReturnReg() const
int getVarArgsFrameOffset() const
void setVarArgsFrameOffset(int Offset)
void setSRetReturnReg(Register Reg)
void ReplaceNodeResults(SDNode *N, SmallVectorImpl< SDValue > &Results, SelectionDAG &DAG) const override
This callback is invoked when a node result type is illegal for the target, and the operation was reg...
SDValue withTargetFlags(SDValue Op, unsigned TF, SelectionDAG &DAG) const
bool CanLowerReturn(CallingConv::ID CallConv, MachineFunction &MF, bool isVarArg, const SmallVectorImpl< ISD::OutputArg > &Outs, LLVMContext &Context, const Type *RetTy) const override
This hook should be implemented to check whether the return values described by the Outs array can fi...
bool useSoftFloat() const override
SDValue bitcastConstantFPToInt(ConstantFPSDNode *C, const SDLoc &DL, SelectionDAG &DAG) const
MachineBasicBlock * expandSelectCC(MachineInstr &MI, MachineBasicBlock *BB, unsigned BROpcode) const
ConstraintWeight getSingleConstraintMatchWeight(AsmOperandInfo &info, const char *constraint) const override
Examine constraint string and operand type and determine a weight value.
std::pair< unsigned, const TargetRegisterClass * > getRegForInlineAsmConstraint(const TargetRegisterInfo *TRI, StringRef Constraint, MVT VT) const override
Given a physical register constraint (e.g.
bool isCtlzFast() const override
Return true if ctlz instruction is fast.
SDValue LowerFormalArguments(SDValue Chain, CallingConv::ID CallConv, bool isVarArg, const SmallVectorImpl< ISD::InputArg > &Ins, const SDLoc &dl, SelectionDAG &DAG, SmallVectorImpl< SDValue > &InVals) const override
This hook must be implemented to lower the incoming (formal) arguments, described by the Ins array,...
ConstraintType getConstraintType(StringRef Constraint) const override
getConstraintType - Given a constraint letter, return the type of constraint it is for this target.
SDValue PerformSTORECombine(SDNode *N, DAGCombinerInfo &DCI) const
SDValue LowerFormalArguments_32(SDValue Chain, CallingConv::ID CallConv, bool isVarArg, const SmallVectorImpl< ISD::InputArg > &Ins, const SDLoc &dl, SelectionDAG &DAG, SmallVectorImpl< SDValue > &InVals) const
LowerFormalArguments32 - V8 uses a very simple ABI, where all values are passed in either one or two ...
bool isCheapToSpeculateCtlz(Type *Ty) const override
Return true if it is cheap to speculate a call to intrinsic ctlz.
SDValue LowerCall(TargetLowering::CallLoweringInfo &CLI, SmallVectorImpl< SDValue > &InVals) const override
This hook must be implemented to lower calls into the specified DAG.
bool isCheapToSpeculateCttz(Type *Ty) const override
Return true if it is cheap to speculate a call to intrinsic cttz.
bool IsEligibleForTailCallOptimization(CCState &CCInfo, CallLoweringInfo &CLI, MachineFunction &MF) const
IsEligibleForTailCallOptimization - Check whether the call is eligible for tail call optimization.
bool isOffsetFoldingLegal(const GlobalAddressSDNode *GA) const override
Return true if folding a constant offset with the given GlobalAddress is legal.
bool isFNegFree(EVT VT) const override
Return true if an fneg operation is free to the point where it is never worthwhile to replace it with...
SDValue LowerF128_LibCallArg(SDValue Chain, ArgListTy &Args, SDValue Arg, const SDLoc &DL, SelectionDAG &DAG) const
SDValue makeHiLoPair(SDValue Op, unsigned HiTF, unsigned LoTF, SelectionDAG &DAG) const
SDValue LowerBlockAddress(SDValue Op, SelectionDAG &DAG) const
SDValue LowerGlobalAddress(SDValue Op, SelectionDAG &DAG) const
Instruction * emitLeadingFence(IRBuilderBase &Builder, Instruction *Inst, AtomicOrdering Ord) const override
Inserts in the IR a target-specific intrinsic specifying a fence.
void AdjustInstrPostInstrSelection(MachineInstr &MI, SDNode *Node) const override
This method should be implemented by targets that mark instructions with the 'hasPostISelHook' flag.
void computeKnownBitsForTargetNode(const SDValue Op, KnownBits &Known, const APInt &DemandedElts, const SelectionDAG &DAG, unsigned Depth=0) const override
computeKnownBitsForTargetNode - Determine which of the bits specified in Mask are known to be either ...
SDValue LowerCall_64(TargetLowering::CallLoweringInfo &CLI, SmallVectorImpl< SDValue > &InVals) const
bool isFMAFasterThanFMulAndFAdd(const MachineFunction &MF, EVT VT) const override
Return true if an FMA operation is faster than a pair of fmul and fadd instructions.
SDValue LowerReturn(SDValue Chain, CallingConv::ID CallConv, bool isVarArg, const SmallVectorImpl< ISD::OutputArg > &Outs, const SmallVectorImpl< SDValue > &OutVals, const SDLoc &dl, SelectionDAG &DAG) const override
This hook must be implemented to lower outgoing return values, described by the Outs array,...
Instruction * emitTrailingFence(IRBuilderBase &Builder, Instruction *Inst, AtomicOrdering Ord) const override
SDValue makeAddress(SDValue Op, SelectionDAG &DAG) const
MachineBasicBlock * EmitInstrWithCustomInserter(MachineInstr &MI, MachineBasicBlock *MBB) const override
This method should be implemented by targets that mark instructions with the 'usesCustomInserter' fla...
SDValue LowerINTRINSIC_WO_CHAIN(SDValue Op, SelectionDAG &DAG) const
SDValue LowerReturn_32(SDValue Chain, CallingConv::ID CallConv, bool IsVarArg, const SmallVectorImpl< ISD::OutputArg > &Outs, const SmallVectorImpl< SDValue > &OutVals, const SDLoc &DL, SelectionDAG &DAG) const
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...
SDValue PerformBITCASTCombine(SDNode *N, DAGCombinerInfo &DCI) const
SDValue LowerReturn_64(SDValue Chain, CallingConv::ID CallConv, bool IsVarArg, const SmallVectorImpl< ISD::OutputArg > &Outs, const SmallVectorImpl< SDValue > &OutVals, const SDLoc &DL, SelectionDAG &DAG) const
SDValue LowerF128Op(SDValue Op, SelectionDAG &DAG, RTLIB::Libcall LibFunc, unsigned numArgs) const
SDValue LowerGlobalTLSAddress(SDValue Op, SelectionDAG &DAG) const
EVT getSetCCResultType(const DataLayout &DL, LLVMContext &Context, EVT VT) const override
getSetCCResultType - Return the ISD::SETCC ValueType
SDValue LowerF128StrictCompare(SDValue &Chain, SDValue LHS, SDValue RHS, unsigned &SPCC, bool IsSignaling, const SDLoc &DL, SelectionDAG &DAG) const
SDValue LowerCall_32(TargetLowering::CallLoweringInfo &CLI, SmallVectorImpl< SDValue > &InVals) const
bool useLoadStackGuardNode(const Module &M) const override
Override to support customized stack guard loading.
AtomicExpansionKind shouldExpandAtomicRMWInIR(const AtomicRMWInst *AI) const override
Returns how the IR-level AtomicExpand pass should expand the given AtomicRMW, if at all.
FPImmAction getFPImmAction(const APFloat &Imm, EVT VT, bool ForCodeSize) const override
Returns how the legalizer should materialize the specified FP immediate.
SDValue LowerOperation(SDValue Op, SelectionDAG &DAG) const override
This callback is invoked for operations that are unsupported by the target, which are registered to u...
SDValue LowerConstantPool(SDValue Op, SelectionDAG &DAG) const
SDValue LowerFormalArguments_64(SDValue Chain, CallingConv::ID CallConv, bool isVarArg, const SmallVectorImpl< ISD::InputArg > &Ins, const SDLoc &dl, SelectionDAG &DAG, SmallVectorImpl< SDValue > &InVals) const
SparcTargetLowering(const TargetMachine &TM, const SparcSubtarget &STI)
SDValue LowerBSWAP(SDValue Op, SelectionDAG &DAG) const
void LowerAsmOperandForConstraint(SDValue Op, StringRef Constraint, std::vector< SDValue > &Ops, SelectionDAG &DAG) const override
LowerAsmOperandForConstraint - Lower the specified operand into the Ops vector.
Register getRegisterByName(const char *RegName, LLT VT, const MachineFunction &MF) const override
Return the register ID of the name passed in.
SDValue PerformBSWAPCombine(SDNode *N, DAGCombinerInfo &DCI) const
SDValue LowerF128Compare(SDValue LHS, SDValue RHS, unsigned &SPCC, const SDLoc &DL, SelectionDAG &DAG) const
StackOffset holds a fixed and a scalable offset in bytes.
This class is used to represent ISD::STORE nodes.
const SDValue & getBasePtr() const
const SDValue & getOffset() const
const SDValue & getValue() const
Represent a constant reference to a string, i.e.
constexpr bool empty() const
Check if the string is empty.
char back() const
Get the last character in the string.
constexpr size_t size() const
Get the string size.
char front() const
Get the first character in the string.
constexpr const char * data() const
Get a pointer to the start of the string (which may not be null terminated).
A switch()-like statement whose cases are string literals.
StringSwitch & Case(StringLiteral S, T Value)
StringSwitch & Cases(std::initializer_list< StringLiteral > CaseStrings, T Value)
TargetInstrInfo - Interface to description of machine instruction set.
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...
bool PredictableSelectIsExpensive
Tells the code generator that select is more expensive than a branch if the branch is usually predict...
EVT getValueType(const DataLayout &DL, Type *Ty, bool AllowUnknown=false) const
Return the EVT corresponding to this LLVM type.
virtual const TargetRegisterClass * getRegClassFor(MVT VT, bool isDivergent=false) const
Return the register class that should be used for the specified value type.
MVT getVectorIdxTy(const DataLayout &DL) const
Returns the type to be used for the index operand of: ISD::INSERT_VECTOR_ELT, ISD::EXTRACT_VECTOR_ELT...
const TargetMachine & getTargetMachine() const
virtual unsigned getNumRegistersForCallingConv(LLVMContext &Context, CallingConv::ID CC, EVT VT) const
Certain targets require unusual breakdowns of certain types.
virtual MVT getRegisterTypeForCallingConv(LLVMContext &Context, CallingConv::ID CC, EVT VT) const
Certain combinations of ABIs, Targets and features require that types are legal for some operations a...
bool isJumpExpensive() const
Return true if Flow Control is an expensive operation that should be avoided.
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...
void computeRegisterProperties(const TargetRegisterInfo *TRI)
Once all of the register classes are added, this allows us to compute derived properties we expose.
void addRegisterClass(MVT VT, const TargetRegisterClass *RC)
Add the specified register class as an available regclass for the specified value 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.
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
void setMinCmpXchgSizeInBits(unsigned SizeInBits)
Sets the minimum cmpxchg or ll/sc size supported by the backend.
void setStackPointerRegisterToSaveRestore(Register R)
If set to a physical register, this specifies the register that llvm.savestack/llvm....
AtomicExpansionKind
Enum that specifies what an atomic load/AtomicRMWInst is expanded to, if at all.
void setTargetDAGCombine(ArrayRef< ISD::NodeType > NTs)
Targets should invoke this method for each target independent node that they want to provide a custom...
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
void setJumpIsExpensive(bool isExpensive=true)
Tells the code generator not to expand logic operations on comparison predicates into separate sequen...
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 bool useLoadStackGuardNode(const Module &M) const
If this function returns true, SelectionDAGBuilder emits a LOAD_STACK_GUARD node when it is lowering ...
virtual void LowerAsmOperandForConstraint(SDValue Op, StringRef Constraint, std::vector< SDValue > &Ops, SelectionDAG &DAG) const
Lower the specified operand into the Ops vector.
Primary interface to the complete machine description for the target machine.
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.
TargetRegisterInfo base class - We assume that the target defines a static array of TargetRegisterDes...
virtual const TargetInstrInfo * getInstrInfo() const
static constexpr TypeSize getFixed(ScalarTy ExactSize)
The instances of the Type class are immutable: once they are created, they are never changed.
LLVM_ABI bool isEmptyTy() const
Return true if this type is empty, that is, it has no elements or all of its elements are empty.
static LLVM_ABI IntegerType * getInt32Ty(LLVMContext &C)
static LLVM_ABI Type * getVoidTy(LLVMContext &C)
bool isFP128Ty() const
Return true if this is 'fp128'.
LLVM_ABI TypeSize getPrimitiveSizeInBits() const LLVM_READONLY
Return the basic size of this type if it is a primitive type.
LLVMContext & getContext() const
Return the LLVMContext in which this type was uniqued.
LLVM Value Representation.
Type * getType() const
All values are typed, get the type of this value.
self_iterator getIterator()
#define llvm_unreachable(msg)
Marks that the current location is not supposed to be reachable.
unsigned ID
LLVM IR allows to use arbitrary numbers as calling convention identifiers.
@ C
The default llvm calling convention, compatible with C.
@ 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.
@ SMUL_LOHI
SMUL_LOHI/UMUL_LOHI - Multiply two integers of type iN, producing a signed/unsigned value of type i[2...
@ STACKADDRESS
STACKADDRESS - Represents the llvm.stackaddress intrinsic.
@ 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.
@ ADDC
Carry-setting nodes for multiple precision addition and subtraction.
@ 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.
@ SINT_TO_FP
[SU]INT_TO_FP - These operators convert integers (whose interpreted sign depends on the first letter)...
@ FADD
Simple binary floating point operators.
@ ATOMIC_FENCE
OUTCHAIN = ATOMIC_FENCE(INCHAIN, ordering, scope) This corresponds to the fence instruction.
@ SDIVREM
SDIVREM/UDIVREM - Divide two integers and produce both a quotient and remainder result.
@ FP16_TO_FP
FP16_TO_FP, FP_TO_FP16 - These operators are used to perform promotions and truncation for half-preci...
@ BITCAST
BITCAST - This operator converts between integer, vector and FP values, as if the value was stored to...
@ BUILD_PAIR
BUILD_PAIR - This is the opposite of EXTRACT_ELEMENT in some ways.
@ STRICT_FSQRT
Constrained versions of libm-equivalent floating point intrinsics.
@ BUILTIN_OP_END
BUILTIN_OP_END - This must be the last enum value in this list.
@ SIGN_EXTEND
Conversion operators.
@ READSTEADYCOUNTER
READSTEADYCOUNTER - This corresponds to the readfixedcounter intrinsic.
@ 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.
@ BRIND
BRIND - Indirect branch.
@ BR_JT
BR_JT - Jumptable branch.
@ SELECT
Select(COND, TRUEVAL, FALSEVAL).
@ ATOMIC_LOAD
Val, OUTCHAIN = ATOMIC_LOAD(INCHAIN, ptr) This corresponds to "load atomic" instruction.
@ UNDEF
UNDEF - An undefined node.
@ VACOPY
VACOPY - VACOPY has 5 operands: an input chain, a destination pointer, a source pointer,...
@ CopyFromReg
CopyFromReg - This node indicates that the input value is a virtual or physical register that is defi...
@ MULHU
MULHU/MULHS - Multiply high - Multiply two integers of type iN, producing an unsigned/signed value of...
@ SHL
Shift and rotation operations.
@ EXTRACT_VECTOR_ELT
EXTRACT_VECTOR_ELT(VECTOR, IDX) - Returns a single element from VECTOR identified by the (potentially...
@ ZERO_EXTEND
ZERO_EXTEND - Used for integer types, zeroing the new bits.
@ DEBUGTRAP
DEBUGTRAP - Trap intended to get the attention of a debugger.
@ SELECT_CC
Select with condition operator - This selects between a true value and a false value (ops #2 and #3) ...
@ ATOMIC_CMP_SWAP
Val, OUTCHAIN = ATOMIC_CMP_SWAP(INCHAIN, ptr, cmp, swap) For double-word atomic operations: ValLo,...
@ 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 ...
@ FP_EXTEND
X = FP_EXTEND(Y) - Extend a smaller FP type into a larger FP type.
@ STRICT_SINT_TO_FP
STRICT_[US]INT_TO_FP - Convert a signed or unsigned integer to a floating point value.
@ FRAMEADDR
FRAMEADDR, RETURNADDR - These nodes represent llvm.frameaddress and llvm.returnaddress on the DAG.
@ STRICT_FP_ROUND
X = STRICT_FP_ROUND(Y, TRUNC) - Rounding 'Y' from a larger floating point type down to the precision ...
@ 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.
@ STRICT_FP_EXTEND
X = STRICT_FP_EXTEND(Y) - Extend a smaller FP type into a larger FP type.
@ AND
Bitwise operators - logical and, logical or, logical xor.
@ TRAP
TRAP - Trapping instruction.
@ INTRINSIC_WO_CHAIN
RESULT = INTRINSIC_WO_CHAIN(INTRINSICID, arg1, arg2, ...) This node represents a target intrinsic fun...
@ ADDE
Carry-using nodes for multiple precision addition and subtraction.
@ STRICT_FADD
Constrained versions of the binary floating point operators.
@ INSERT_VECTOR_ELT
INSERT_VECTOR_ELT(VECTOR, VAL, IDX) - Returns VECTOR with the element at IDX replaced with VAL.
@ TokenFactor
TokenFactor - This node takes multiple tokens as input and produces a single token result.
@ ATOMIC_SWAP
Val, OUTCHAIN = ATOMIC_SWAP(INCHAIN, ptr, amt) Val, OUTCHAIN = ATOMIC_LOAD_[OpName](INCHAIN,...
@ CTTZ_ZERO_POISON
Bit counting operators with a poisoned result for zero inputs.
@ FP_ROUND
X = FP_ROUND(Y, TRUNC) - Rounding 'Y' from a larger floating point type down to the precision of the ...
@ 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.
@ BUILD_VECTOR
BUILD_VECTOR(ELT0, ELT1, ELT2, ELT3,...) - Return a fixed-width vector with the specified,...
CondCode
ISD::CondCode enum - These are ordered carefully to make the bitfields below work out,...
bool isUnsignedIntSetCC(CondCode Code)
Return true if this is a setcc instruction that performs an unsigned comparison when used with intege...
bool isNormalLoad(const SDNode *N)
Returns true if the specified node is a non-extending and unindexed load.
This is an optimization pass for GlobalISel generic memory operations.
auto size(R &&Range, std::enable_if_t< std::is_base_of< std::random_access_iterator_tag, typename std::iterator_traits< decltype(Range.begin())>::iterator_category >::value, void > *=nullptr)
Get the size of a range.
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.
@ Known
Known to have no common set bits.
decltype(auto) dyn_cast(const From &Val)
dyn_cast<X> - Return the argument parameter cast to the specified type.
bool isStrongerThanMonotonic(AtomicOrdering AO)
@ Load
The value being inserted comes from a load (InsertElement only).
@ Store
The extracted value is stored (ExtractElement only).
std::string utostr(uint64_t X, bool isNeg=false)
LLVM_ABI void reportFatalInternalError(Error Err)
Report a fatal error that indicates a bug in LLVM.
bool isReleaseOrStronger(AtomicOrdering AO)
bool any_of(R &&range, UnaryPredicate P)
Provide wrappers to std::any_of which take ranges instead of having to pass begin/end explicitly.
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.
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...
AtomicOrdering
Atomic ordering for LLVM's memory model.
@ And
Bitwise or logical AND of integers.
uint16_t MCPhysReg
An unsigned integer type large enough to represent all physical registers, but not necessarily virtua...
DWARFExpression::Operation Op
bool isAcquireOrStronger(AtomicOrdering AO)
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.
bool is_contained(R &&Range, const E &Element)
Returns true if Element is found in Range.
Align commonAlignment(Align A, uint64_t Offset)
Returns the alignment that satisfies both alignments.
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.
EVT changeVectorElementTypeToInteger() const
Return a vector with the same number of elements as this vector, but with the element type converted ...
TypeSize getStoreSize() const
Return the number of bytes overwritten by a store of the specified value type.
uint64_t getScalarStoreSize() const
bool bitsGT(EVT VT) const
Return true if this has more bits than VT.
TypeSize getSizeInBits() const
Return the size of the specified value type in bits.
static EVT getIntegerVT(LLVMContext &Context, unsigned BitWidth)
Returns the EVT that represents an integer with the given number of bits.
uint64_t getFixedSizeInBits() const
Return the size of the specified fixed width value type in 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.
This class contains a discriminated union of information about pointers in memory operands,...
MachinePointerInfo getWithOffset(int64_t O) const
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 contains information for each constraint that we are lowering.
This structure contains all information that is necessary for lowering calls.
SmallVector< ISD::InputArg, 32 > Ins
CallLoweringInfo & setDebugLoc(const SDLoc &dl)
SmallVector< ISD::OutputArg, 32 > Outs
SmallVector< SDValue, 32 > OutVals
CallLoweringInfo & setChain(SDValue InChain)
CallLoweringInfo & setCallee(CallingConv::ID CC, Type *ResultType, SDValue Target, ArgListTy &&ArgsList, AttributeSet ResultAttrs={})
LLVM_ABI SDValue CombineTo(SDNode *N, ArrayRef< SDValue > To, bool AddTo=true)