42#define DEBUG_TYPE "M68k-isel"
107 for (
auto VT : {MVT::i8, MVT::i16, MVT::i32}) {
115 for (
auto VT : {MVT::i8, MVT::i16, MVT::i32}) {
125 for (
auto VT : {MVT::i8, MVT::i16, MVT::i32}) {
133 for (
auto VT : {MVT::i8, MVT::i16, MVT::i32}) {
184 {MVT::i8, MVT::i16, MVT::i32},
LibCall);
229#include "M68kGenCallingConv.inc"
269 Chain,
DL, Dst, Src, SizeNode, Flags.getNonZeroByValAlign(),
313 cast<VTSDNode>(TruncInput.
getOperand(1))->getVT() ==
330 if (!Flags.isByVal()) {
334 unsigned Opcode = Def->getOpcode();
335 if ((Opcode == M68k::LEA32p || Opcode == M68k::LEA32f) &&
336 Def->getOperand(1).isFI()) {
337 FI = Def->getOperand(1).getIndex();
338 Bytes = Flags.getByValSize();
342 }
else if (
auto *Ld = dyn_cast<LoadSDNode>(Arg)) {
358 Bytes = Flags.getByValSize();
382M68kTargetLowering::getReturnAddressFrameIndex(
SelectionDAG &DAG)
const {
387 if (ReturnAddrIndex == 0) {
391 SlotSize, -(int64_t)SlotSize,
false);
401 bool IsTailCall,
int FPDiff,
404 OutRetAddr = getReturnAddressFrameIndex(DAG);
411SDValue M68kTargetLowering::EmitTailCallStoreRetAddr(
413 EVT PtrVT,
unsigned SlotSize,
int FPDiff,
const SDLoc &
DL)
const {
419 SlotSize, (int64_t)FPDiff - SlotSize,
false);
424 Chain,
DL, RetFI, NewFI,
435 unsigned ArgIdx)
const {
452 }
else if (VA.
getValVT() == MVT::i16) {
466 bool IsImmutable = !AlwaysUseMutable && !
Flags.isByVal();
468 if (
Flags.isByVal()) {
469 unsigned Bytes =
Flags.getByValSize();
492 ValVT,
DL, Chain, FIN,
512 Chain,
DL, Arg, PtrOff,
535 bool IsSibcall =
false;
543 if (Attr.getValueAsBool())
554 }
else if (IsTailCall) {
556 IsTailCall = IsEligibleForTailCallOptimization(
571 "Var args not supported with calling convention fastcc");
576 for (
const auto &Arg : CLI.
getArgs())
578 M68kCCState CCInfo(ArgTypes, CallConv, IsVarArg, MF, ArgLocs,
580 CCInfo.AnalyzeCallOperands(Outs, CC_M68k);
583 unsigned NumBytes = CCInfo.getAlignedCallFrameSize();
590 NumBytes = GetAlignedArgumentStackSize(NumBytes, DAG);
594 if (IsTailCall && !IsSibcall && !IsMustTail) {
598 FPDiff = NumBytesCallerPushed - NumBytes;
602 if (FPDiff < MFI->getTCReturnAddrDelta())
606 unsigned NumBytesToPush = NumBytes;
607 unsigned NumBytesToPop = NumBytes;
612 if (!Outs.
empty() && Outs.
back().Flags.isInAlloca()) {
614 if (!ArgLocs.
back().isMemLoc())
617 if (ArgLocs.
back().getLocMemOffset() != 0)
619 "the only memory argument");
624 NumBytes - NumBytesToPush,
DL);
628 if (IsTailCall && FPDiff)
629 Chain = EmitTailCallLoadRetAddr(DAG, RetFI, Chain, IsTailCall, FPDiff,
DL);
638 for (
unsigned i = 0, e = ArgLocs.
size(); i != e; ++i) {
642 if (
Flags.isInAlloca())
648 bool IsByVal =
Flags.isByVal();
671 int FI = cast<FrameIndexSDNode>(SpillSlot)->getIndex();
673 Chain,
DL, Arg, SpillSlot,
682 }
else if (!IsSibcall && (!IsTailCall || IsByVal)) {
689 LowerMemOpCallTo(Chain, StackPtr, Arg,
DL, DAG, VA, Flags));
693 if (!MemOpChains.
empty())
700 if (IsVarArg && IsMustTail) {
702 for (
const auto &
F : Forwards) {
704 RegsToPass.
push_back(std::make_pair(
unsigned(
F.PReg), Val));
711 if (!IsSibcall && IsTailCall) {
723 for (
unsigned i = 0, e = ArgLocs.
size(); i != e; ++i) {
731 if (
Flags.isInAlloca())
739 if (
Flags.isByVal()) {
754 ArgChain,
DL, Arg, FIN,
759 if (!MemOpChains2.
empty())
763 Chain = EmitTailCallStoreRetAddr(DAG, MF, Chain, RetFI,
771 for (
unsigned i = 0, e = RegsToPass.
size(); i != e; ++i) {
773 RegsToPass[i].second, InGlue);
806 unsigned char OpFlags =
815 if (!IsSibcall && IsTailCall) {
828 for (
unsigned i = 0, e = RegsToPass.
size(); i != e; ++i)
830 RegsToPass[i].second.getValueType()));
834 assert(Mask &&
"Missing call preserved mask for calling convention");
851 unsigned NumBytesForCalleeToPop;
854 NumBytesForCalleeToPop = NumBytes;
858 NumBytesForCalleeToPop = 4;
860 NumBytesForCalleeToPop = 0;
866 NumBytesForCalleeToPop = NumBytes;
871 Chain = DAG.
getCALLSEQ_END(Chain, NumBytesToPop, NumBytesForCalleeToPop,
878 return LowerCallResult(Chain, InGlue, CallConv, IsVarArg, Ins,
DL, DAG,
882SDValue M68kTargetLowering::LowerCallResult(
891 CCInfo.AnalyzeCallResult(Ins, RetCC_M68k);
894 for (
unsigned i = 0, e = RVLocs.
size(); i != e; ++i) {
917SDValue M68kTargetLowering::LowerFormalArguments(
934 CCInfo.AnalyzeFormalArguments(Ins, CC_M68k);
936 unsigned LastVal = ~0
U;
938 for (
unsigned i = 0, e = ArgLocs.
size(); i != e; ++i) {
940 assert(VA.
getValNo() != LastVal &&
"Same value in different locations");
948 if (RegVT == MVT::i32)
949 RC = &M68k::XR32RegClass;
974 ArgValue = LowerMemArgument(Chain, CCID, Ins,
DL, DAG, VA, MFI, i);
986 for (
unsigned i = 0, e = ArgLocs.
size(); i != e; ++i) {
995 if (Ins[i].
Flags.isSRet()) {
1008 unsigned StackSize = CCInfo.getStackSize();
1011 StackSize = GetAlignedArgumentStackSize(StackSize, DAG);
1016 if (MFI.hasVAStart()) {
1020 if (IsVarArg && MFI.hasMustTailInVarArgFunc()) {
1023 MVT IntVT = MVT::i32;
1030 CCInfo.analyzeMustTailForwardedRegisters(Forwards, RegParmTypes, CC_M68k);
1061bool M68kTargetLowering::CanLowerReturn(
1065 CCState CCInfo(CCID, IsVarArg, MF, RVLocs, Context);
1066 return CCInfo.CheckReturn(Outs, RetCC_M68k);
1080 CCInfo.AnalyzeReturn(Outs, RetCC_M68k);
1091 for (
unsigned i = 0, e = RVLocs.size(); i != e; ++i) {
1094 SDValue ValToCopy = OutVals[i];
1152 unsigned RetValReg = M68k::D0;
1202M68kTargetLowering::GetAlignedArgumentStackSize(
unsigned StackSize,
1206 uint64_t AlignMask = StackAlignment - 1;
1207 int64_t
Offset = StackSize;
1209 if ((
Offset & AlignMask) <= (StackAlignment - SlotSize)) {
1211 Offset += ((StackAlignment - SlotSize) - (
Offset & AlignMask));
1215 ((~AlignMask) &
Offset) + StackAlignment + (StackAlignment - SlotSize);
1222bool M68kTargetLowering::IsEligibleForTailCallOptimization(
1224 bool IsCalleeStructRet,
bool IsCallerStructRet,
Type *
RetTy,
1236 bool CCMatch = CallerCC == CalleeCC;
1250 if (
RegInfo->hasStackRealignment(MF))
1255 if (IsCalleeStructRet || IsCallerStructRet)
1261 if (IsVarArg && !Outs.
empty()) {
1264 CCState CCInfo(CalleeCC, IsVarArg, MF, ArgLocs,
C);
1266 CCInfo.AnalyzeCallOperands(Outs, CC_M68k);
1267 for (
unsigned i = 0, e = ArgLocs.
size(); i != e; ++i)
1268 if (!ArgLocs[i].isRegLoc())
1279 const uint32_t *CallerPreserved =
TRI->getCallPreservedMask(MF, CallerCC);
1281 const uint32_t *CalleePreserved =
TRI->getCallPreservedMask(MF, CalleeCC);
1282 if (!
TRI->regmaskSubsetEqual(CallerPreserved, CalleePreserved))
1286 unsigned StackArgsSize = 0;
1290 if (!Outs.
empty()) {
1294 CCState CCInfo(CalleeCC, IsVarArg, MF, ArgLocs,
C);
1296 CCInfo.AnalyzeCallOperands(Outs, CC_M68k);
1297 StackArgsSize = CCInfo.getStackSize();
1299 if (StackArgsSize) {
1305 for (
unsigned i = 0, e = ArgLocs.
size(); i != e; ++i) {
1325 if ((!isa<GlobalAddressSDNode>(Callee) &&
1326 !isa<ExternalSymbolSDNode>(Callee)) ||
1327 PositionIndependent) {
1328 unsigned NumInRegs = 0;
1331 unsigned MaxInRegs = PositionIndependent ? 1 : 2;
1333 for (
unsigned i = 0, e = ArgLocs.
size(); i != e; ++i) {
1343 if (++NumInRegs == MaxInRegs)
1358 if (
unsigned BytesToPop =
1361 bool CalleePopMatches = CalleeWillPop && BytesToPop == StackArgsSize;
1362 if (!CalleePopMatches)
1364 }
else if (CalleeWillPop && StackArgsSize > 0) {
1378 switch (
Op.getOpcode()) {
1387 return LowerXALUO(
Op, DAG);
1389 return LowerSETCC(
Op, DAG);
1391 return LowerSETCCCARRY(
Op, DAG);
1393 return LowerSELECT(
Op, DAG);
1395 return LowerBRCOND(
Op, DAG);
1400 return LowerADDC_ADDE_SUBC_SUBE(
Op, DAG);
1402 return LowerConstantPool(
Op, DAG);
1404 return LowerGlobalAddress(
Op, DAG);
1406 return LowerExternalSymbol(
Op, DAG);
1408 return LowerBlockAddress(
Op, DAG);
1410 return LowerJumpTable(
Op, DAG);
1412 return LowerVASTART(
Op, DAG);
1414 return LowerDYNAMIC_STACKALLOC(
Op, DAG);
1416 return LowerShiftLeftParts(
Op, DAG);
1418 return LowerShiftRightParts(
Op, DAG,
true);
1420 return LowerShiftRightParts(
Op, DAG,
false);
1422 return LowerATOMICFENCE(
Op, DAG);
1424 return LowerGlobalTLSAddress(
Op, DAG);
1431 ArgListTy &&ArgList)
const {
1433 CallLoweringInfo CLI(DAG);
1439 std::move(ArgList));
1445 unsigned TargetFlags)
const {
1457 Args.push_back(Entry);
1458 return LowerExternalSymbolCall(DAG,
SDLoc(GA),
"__tls_get_addr",
1463 return LowerExternalSymbolCall(DAG, Loc,
"__m68k_read_tp",
ArgListTy());
1508 auto *GA = cast<GlobalAddressSDNode>(
Op);
1511 switch (AccessModel) {
1513 return LowerTLSGeneralDynamic(GA, DAG);
1515 return LowerTLSLocalDynamic(GA, DAG);
1517 return LowerTLSInitialExec(GA, DAG);
1519 return LowerTLSLocalExec(GA, DAG);
1525bool M68kTargetLowering::decomposeMulByConstant(
LLVMContext &Context,
EVT VT,
1553 EVT VT =
N->getValueType(0);
1558 unsigned TruncOp = 0;
1559 auto PromoteMULO = [&](
unsigned ExtOp) {
1564 if (VT == MVT::i8) {
1572 bool NoOverflow =
false;
1573 unsigned BaseOp = 0;
1574 switch (
Op.getOpcode()) {
1595 NoOverflow = VT != MVT::i32;
1601 NoOverflow = VT != MVT::i32;
1618 Result = DAG.
getNode(TruncOp,
DL, MVT::i8, Arith);
1637 if (isa<ConstantSDNode>(CCR)) {
1657 if (Src.getValueType() == MVT::i8 || Src.getValueType() == MVT::i16)
1691 unsigned AndBitWidth =
And.getValueSizeInBits();
1694 if (Known.countMinLeadingZeros() <
BitWidth - AndBitWidth)
1700 }
else if (
auto *AndRHS = dyn_cast<ConstantSDNode>(Op1)) {
1701 uint64_t AndRHSVal = AndRHS->getZExtValue();
1723 switch (SetCCOpcode) {
1757 if (SetCCOpcode ==
ISD::SETGT && RHSC->isAllOnes()) {
1762 if (SetCCOpcode ==
ISD::SETLT && RHSC->isZero()) {
1766 if (SetCCOpcode ==
ISD::SETLT && RHSC->getZExtValue() == 1) {
1780 SetCCOpcode = getSetCCSwappedOperands(SetCCOpcode);
1784 switch (SetCCOpcode) {
1801 switch (SetCCOpcode) {
1837 "Expected TRUNCATE to i1 node");
1839 if (
Op.getOperand(0).getOpcode() !=
ISD::SRL)
1852 unsigned UOpNo = UI->getOperandNo();
1871 bool NeedCF =
false;
1872 bool NeedOF =
false;
1891 switch (
Op->getOpcode()) {
1896 if (
Op.getNode()->getFlags().hasNoSignedWrap())
1910 if (
Op.getResNo() != 0 || NeedOF || NeedCF) {
1915 unsigned Opcode = 0;
1916 unsigned NumOperands = 0;
1921 bool NeedTruncation =
false;
1935 NeedTruncation =
true;
1955 Op->hasOneUse() && isa<ConstantSDNode>(
Op->getOperand(1)) &&
1957 EVT VT =
Op.getValueType();
1959 unsigned ShAmt =
Op->getConstantOperandVal(1);
1965 if (!
Mask.isSignedIntN(32))
1980 bool IsLegalAndnType = VT == MVT::i32 || VT == MVT::i64;
1984 if ( !IsAndn || !IsLegalAndnType)
1993 for (
const auto *U :
Op.getNode()->users())
2030 if (NeedTruncation) {
2031 EVT VT =
Op.getValueType();
2034 unsigned ConvertedOp = 0;
2104 return EmitTest(Op0, M68kCC,
DL, DAG);
2107 "Unexpected comparison operation for MVT::i1 operands");
2114 (isa<ConstantSDNode>(Op0) || isa<ConstantSDNode>(Op1))) &&
2118 Op0 = DAG.
getNode(ExtendOp,
DL, MVT::i32, Op0);
2119 Op1 = DAG.
getNode(ExtendOp,
DL, MVT::i32, Op1);
2142 MVT VT =
Op.getSimpleValueType();
2143 assert(VT == MVT::i8 &&
"SetCC type must be 8-bit integer");
2157 if (
SDValue NewSetCC = LowerToBTST(Op0,
CC,
DL, DAG)) {
2202 SDValue CCR = EmitCmp(Op0, Op1, M68kCC,
DL, DAG);
2215 assert(
LHS.getSimpleValueType().isInteger() &&
"SETCCCARRY is integer only.");
2233 unsigned Opc =
Op.getNode()->getOpcode();
2236 if (
Op.getResNo() == 1 &&
2252 SDValue VOp0 = V.getOperand(0);
2254 unsigned Bits = V.getValueSizeInBits();
2260 bool addTest =
true;
2330 unsigned CondOpcode =
Cond.getOpcode();
2335 unsigned Opc =
Cmp.getOpcode();
2337 bool IllegalFPCMov =
false;
2361 CC = NewSetCC.getOperand(0);
2362 Cond = NewSetCC.getOperand(1);
2398 if (
T1.getValueType() == T2.getValueType() &&
2411 if (
auto *Const = dyn_cast<ConstantSDNode>(
Cond.getNode())) {
2413 if (
C.countr_zero() >= 5)
2415 else if (
C.countr_one() >= 5)
2428 Opc =
Op.getOpcode();
2432 Op.getOperand(0).hasOneUse() &&
2434 Op.getOperand(1).hasOneUse());
2444 Op.getOperand(0).hasOneUse();
2449 bool AddTest =
true;
2455 bool Inverted =
false;
2459 if (cast<CondCodeSDNode>(
Cond.getOperand(2))->get() ==
ISD::SETEQ &&
2461 Cond.getOperand(0).getResNo() == 1 &&
2482 unsigned CondOpcode =
Cond.getOpcode();
2487 unsigned Opc =
Cmp.getOpcode();
2493 switch (
CC->getAsZExtVal()) {
2500 Cond =
Cond.getNode()->getOperand(1);
2506 CondOpcode =
Cond.getOpcode();
2526 CC =
Cond.getOperand(0).getOperand(0);
2529 CC =
Cond.getOperand(1).getOperand(0);
2540 Op.getNode()->hasOneUse()) {
2576 Cond =
Cond.getOperand(0).getOperand(1);
2587 if (
Cond.hasOneUse()) {
2589 CC = NewSetCC.getOperand(0);
2590 Cond = NewSetCC.getOperand(1);
2607 MVT VT =
Op.getNode()->getSimpleValueType(0);
2616 bool ExtraOp =
false;
2617 switch (
Op.getOpcode()) {
2663 CP->getConstVal(), PtrVT,
CP->getAlign(),
CP->getOffset(), OpFlag);
2680 const char *
Sym = cast<ExternalSymbolSDNode>(
Op)->getSymbol();
2718 const BlockAddress *BA = cast<BlockAddressSDNode>(
Op)->getBlockAddress();
2719 int64_t
Offset = cast<BlockAddressSDNode>(
Op)->getOffset();
2789 const GlobalValue *GV = cast<GlobalAddressSDNode>(
Op)->getGlobal();
2790 int64_t
Offset = cast<GlobalAddressSDNode>(
Op)->getOffset();
2855 if (Constraint.
size() > 0) {
2856 switch (Constraint[0]) {
2870 if (Constraint.
size() == 2)
2871 switch (Constraint[1]) {
2893 std::vector<SDValue> &Ops,
2897 if (Constraint.
size() == 1) {
2899 switch (Constraint[0]) {
2908 auto *
C = dyn_cast<ConstantSDNode>(
Op);
2912 int64_t Val =
C->getSExtValue();
2913 switch (Constraint[0]) {
2915 if (Val > 0 && Val <= 8)
2923 if (Val < -0x80 || Val >= 0x80)
2927 if (Val < 0 && Val >= -8)
2931 if (Val < -0x100 || Val >= 0x100)
2935 if (Val >= 24 && Val <= 31)
2943 if (Val >= 8 && Val <= 15)
2958 if (Constraint.
size() == 2) {
2959 switch (Constraint[0]) {
2962 switch (Constraint[1]) {
2966 auto *
C = dyn_cast<ConstantSDNode>(
Op);
2970 int64_t Val =
C->getSExtValue();
2971 switch (Constraint[1]) {
2979 if (!isInt<16>(
C->getSExtValue()))
2998 if (Result.getNode()) {
2999 Ops.push_back(Result);
3006std::pair<unsigned, const TargetRegisterClass *>
3010 if (Constraint.
size() == 1) {
3011 switch (Constraint[0]) {
3016 return std::make_pair(0U, &M68k::DR8RegClass);
3018 return std::make_pair(0U, &M68k::DR16RegClass);
3020 return std::make_pair(0U, &M68k::DR32RegClass);
3028 return std::make_pair(0U, &M68k::AR16RegClass);
3030 return std::make_pair(0U, &M68k::AR32RegClass);
3053 switch (
MI.getOpcode()) {
3084 if (miI == BB->
end())
3086 if (SBB->isLiveIn(M68k::CCR))
3091 SelectItr->addRegisterKilled(M68k::CCR,
TRI);
3167 (NextMIIt->getOperand(3).getImm() ==
CC ||
3168 NextMIIt->getOperand(3).getImm() == OppCC)) {
3169 LastCMOV = &*NextMIIt;
3176 if (LastCMOV == &
MI && NextMIIt !=
MBB->
end() &&
3177 NextMIIt->getOpcode() ==
MI.getOpcode() &&
3178 NextMIIt->getOperand(2).getReg() ==
MI.getOperand(2).getReg() &&
3179 NextMIIt->getOperand(1).getReg() ==
MI.getOperand(0).getReg() &&
3180 NextMIIt->getOperand(1).isKill()) {
3181 CascadedCMOV = &*NextMIIt;
3189 Jcc1MBB =
F->CreateMachineBasicBlock(BB);
3190 F->insert(It, Jcc1MBB);
3196 F->insert(It, Copy0MBB);
3197 F->insert(It, SinkMBB);
3200 unsigned CallFrameSize =
TII->getCallFrameSizeAt(
MI);
3208 MachineInstr *LastCCRSUser = CascadedCMOV ? CascadedCMOV : LastCMOV;
3269 Register DestReg = MIIt->getOperand(0).getReg();
3270 Register Op1Reg = MIIt->getOperand(1).getReg();
3271 Register Op2Reg = MIIt->getOperand(2).getReg();
3276 if (MIIt->getOperand(3).getImm() == OppCC)
3279 if (RegRewriteTable.
find(Op1Reg) != RegRewriteTable.
end())
3280 Op1Reg = RegRewriteTable[Op1Reg].first;
3282 if (RegRewriteTable.
find(Op2Reg) != RegRewriteTable.
end())
3283 Op2Reg = RegRewriteTable[Op2Reg].second;
3286 BuildMI(*SinkMBB, SinkInsertionPoint,
DL,
TII->get(M68k::PHI), DestReg)
3293 RegRewriteTable[DestReg] = std::make_pair(Op1Reg, Op2Reg);
3302 DL,
TII->get(TargetOpcode::COPY),
3304 .
addReg(
MI.getOperand(0).getReg());
3310 (MIIt++)->eraseFromParent();
3318 llvm_unreachable(
"Cannot lower Segmented Stack Alloca with stack-split on");
3324 switch (
MI.getOpcode()) {
3330 return EmitLoweredSelect(
MI, BB);
3332 return EmitLoweredSegAlloca(
MI, BB);
3341 const Value *SV = cast<SrcValueSDNode>(
Op.getOperand(2))->getValue();
3359 const SDValue AsmOperands[4] = {
3370 DAG.
getVTList(MVT::Other, MVT::Glue), AsmOperands);
3389 unsigned Align =
Op.getConstantOperandVal(2);
3390 EVT VT =
Node->getValueType(0);
3401 Register Vreg =
MRI.createVirtualRegister(ARClass);
3408 assert(
SPReg &&
"Target cannot require DYNAMIC_STACKALLOC expansion and"
3409 " not tell us which reg is the stack pointer!");
3416 if (
Align > StackAlign)
3434 EVT VT =
Lo.getValueType();
3447 SDValue ShamtMinusRegisterSize =
3449 SDValue RegisterSizeMinus1Shamt =
3475 EVT VT =
Lo.getValueType();
3499 SDValue ShamtMinusRegisterSize =
3501 SDValue RegisterSizeMinus1Shamt =
3511 DAG.
getNode(ShiftRightOp,
DL, VT,
Hi, ShamtMinusRegisterSize);
3596 N->getOperand(1),
Cond, Flags);
3604 MVT VT =
N->getSimpleValueType(0);
3607 N->getOperand(1), Flags);
3617 MVT VT =
N->getSimpleValueType(0);
3620 N->getOperand(1), Flags);
3627 DAGCombinerInfo &DCI)
const {
3629 switch (
N->getOpcode()) {
3649 return "M68kISD::CALL";
3651 return "M68kISD::TAIL_CALL";
3653 return "M68kISD::RET";
3655 return "M68kISD::TC_RETURN";
3657 return "M68kISD::ADD";
3659 return "M68kISD::SUB";
3661 return "M68kISD::ADDX";
3663 return "M68kISD::SUBX";
3665 return "M68kISD::SMUL";
3667 return "M68kISD::UMUL";
3669 return "M68kISD::OR";
3671 return "M68kISD::XOR";
3673 return "M68kISD::AND";
3675 return "M68kISD::CMP";
3677 return "M68kISD::BTST";
3679 return "M68kISD::SELECT";
3681 return "M68kISD::CMOV";
3683 return "M68kISD::BRCOND";
3685 return "M68kISD::SETCC";
3687 return "M68kISD::SETCC_CARRY";
3689 return "M68kISD::GLOBAL_BASE_REG";
3691 return "M68kISD::Wrapper";
3693 return "M68kISD::WrapperPC";
3695 return "M68kISD::SEG_ALLOCA";
3702 bool IsVarArg)
const {
3704 return RetCC_M68k_C;
unsigned const MachineRegisterInfo * MRI
static SDValue getSETCC(AArch64CC::CondCode CC, SDValue NZCV, const SDLoc &DL, SelectionDAG &DAG)
Helper function to create 'CSET', which is equivalent to 'CSINC <Wd>, WZR, WZR, invert(<cond>)'.
static bool canGuaranteeTCO(CallingConv::ID CC, bool GuaranteeTailCalls)
Return true if the calling convention is one that we can guarantee TCO for.
static bool mayTailCallThisCC(CallingConv::ID CC)
Return true if we might ever do TCO for calls with this calling convention.
MachineBasicBlock MachineBasicBlock::iterator DebugLoc DL
const HexagonInstrInfo * TII
static SDValue CreateCopyOfByValArgument(SDValue Src, SDValue Dst, SDValue Chain, ISD::ArgFlagsTy Flags, SelectionDAG &DAG, const SDLoc &dl)
CreateCopyOfByValArgument - Make a copy of an aggregate at address specified by "Src" to address "Dst...
This file contains the custom routines for the M68k Calling Convention that aren't done by tablegen.
static SDValue LowerTruncateToBTST(SDValue Op, ISD::CondCode CC, const SDLoc &DL, SelectionDAG &DAG)
static void lowerOverflowArithmetic(SDValue Op, SelectionDAG &DAG, SDValue &Result, SDValue &CCR, unsigned &CC)
static SDValue combineADDX(SDNode *N, SelectionDAG &DAG, TargetLowering::DAGCombinerInfo &DCI)
static bool isAndOrOfSetCCs(SDValue Op, unsigned &Opc)
Return true if node is an ISD::AND or ISD::OR of two M68k::SETcc nodes each of which has no other use...
static bool hasNonFlagsUse(SDValue Op)
return true if Op has a use that doesn't just read flags.
static bool isM68kCCUnsigned(unsigned M68kCC)
Return true if the condition is an unsigned comparison operation.
static StructReturnType callIsStructReturn(const SmallVectorImpl< ISD::OutputArg > &Outs)
static bool isXor1OfSetCC(SDValue Op)
Return true if node is an ISD::XOR of a M68kISD::SETCC and 1 and that the SETCC node has a single use...
static SDValue LowerAndToBTST(SDValue And, ISD::CondCode CC, const SDLoc &DL, SelectionDAG &DAG)
Result of 'and' is compared against zero. Change to a BTST node if possible.
static SDValue combineM68kBrCond(SDNode *N, SelectionDAG &DAG, const M68kSubtarget &Subtarget)
static M68k::CondCode TranslateIntegerM68kCC(ISD::CondCode SetCCOpcode)
static StructReturnType argsAreStructReturn(const SmallVectorImpl< ISD::InputArg > &Ins)
Determines whether a function uses struct return semantics.
static bool isCMOVPseudo(MachineInstr &MI)
static bool shouldGuaranteeTCO(CallingConv::ID CC, bool GuaranteedTailCallOpt)
Return true if the function is being made into a tailcall target by changing its ABI.
static bool isM68kLogicalCmp(SDValue Op)
Return true if opcode is a M68k logical comparison.
static SDValue combineM68kSetCC(SDNode *N, SelectionDAG &DAG, const M68kSubtarget &Subtarget)
static SDValue combineSetCCCCR(SDValue CCR, M68k::CondCode &CC, SelectionDAG &DAG, const M68kSubtarget &Subtarget)
Optimize a CCR definition used according to the condition code CC into a simpler CCR value,...
static SDValue combineCarryThroughADD(SDValue CCR)
static bool isOverflowArithmetic(unsigned Opcode)
static bool MatchingStackOffset(SDValue Arg, unsigned Offset, ISD::ArgFlagsTy Flags, MachineFrameInfo &MFI, const MachineRegisterInfo *MRI, const M68kInstrInfo *TII, const CCValAssign &VA)
Return true if the given stack call argument is already available in the same position (relatively) o...
static SDValue getBitTestCondition(SDValue Src, SDValue BitNo, ISD::CondCode CC, const SDLoc &DL, SelectionDAG &DAG)
Create a BTST (Bit Test) node - Test bit BitNo in Src and set condition according to equal/not-equal ...
static bool isTruncWithZeroHighBitsInput(SDValue V, SelectionDAG &DAG)
static bool checkAndUpdateCCRKill(MachineBasicBlock::iterator SelectItr, MachineBasicBlock *BB, const TargetRegisterInfo *TRI)
static SDValue combineSUBX(SDNode *N, SelectionDAG &DAG)
static unsigned TranslateM68kCC(ISD::CondCode SetCCOpcode, const SDLoc &DL, bool IsFP, SDValue &LHS, SDValue &RHS, SelectionDAG &DAG)
Do a one-to-one translation of a ISD::CondCode to the M68k-specific condition code,...
This file defines the interfaces that M68k uses to lower LLVM code into a selection DAG.
This file declares the M68k specific subclass of MachineFunctionInfo.
This file declares the M68k specific subclass of TargetSubtargetInfo.
This file declares the M68k specific subclass of TargetMachine.
This file contains declarations for M68k ELF object file lowering.
unsigned const TargetRegisterInfo * TRI
static GCMetadataPrinterRegistry::Add< OcamlGCMetadataPrinter > Y("ocaml", "ocaml 3.10-compatible collector")
static constexpr Register SPReg
const SmallVectorImpl< MachineOperand > & Cond
assert(ImpDefSCC.getReg()==AMDGPU::SCC &&ImpDefSCC.isDef())
This file defines the 'Statistic' class, which is designed to be an easy way to expose various metric...
#define STATISTIC(VARNAME, DESC)
Class for arbitrary precision integers.
static APInt getAllOnes(unsigned numBits)
Return an APInt of a specified width with all bits set.
static APInt getHighBitsSet(unsigned numBits, unsigned hiBitsSet)
Constructs an APInt value that has the top hiBitsSet bits set.
This class represents an incoming formal argument to a Function.
an instruction that atomically reads a memory location, combines it with another value,...
LLVM Basic Block Representation.
The address of a basic block.
CCState - This class holds information needed while lowering arguments and return values.
static bool resultsCompatible(CallingConv::ID CalleeCC, CallingConv::ID CallerCC, MachineFunction &MF, LLVMContext &C, const SmallVectorImpl< ISD::InputArg > &Ins, CCAssignFn CalleeFn, CCAssignFn CallerFn)
Returns true if the results of the two calling conventions are compatible.
CCValAssign - Represent assignment of one arg/retval to a location.
Register getLocReg() const
LocInfo getLocInfo() const
int64_t getLocMemOffset() const
unsigned getValNo() const
bool isMustTailCall() const
Tests if this call site must be tail call optimized.
This is an important base class in LLVM.
This class represents an Operation in the Expression.
A parsed version of the target data layout string in and methods for querying it.
iterator find(const_arg_type_t< KeyT > Val)
iterator_range< arg_iterator > args()
Attribute getFnAttribute(Attribute::AttrKind Kind) const
Return the attribute for the given attribute kind.
bool hasMinSize() const
Optimize this function for minimum size (-Oz).
CallingConv::ID getCallingConv() const
getCallingConv()/setCallingConv(CC) - These method get and set the calling convention of this functio...
bool hasStructRetAttr() const
Determine if the function returns a structure through first or second pointer argument.
int64_t getOffset() const
const GlobalValue * getGlobal() const
bool hasDLLImportStorageClass() const
Module * getParent()
Get the module that this global value is contained inside of...
Register isLoadFromStackSlot(const MachineInstr &MI, int &FrameIndex) const override
TargetInstrInfo overrides.
This is an important class for using LLVM in a threaded context.
void setVarArgsFrameIndex(int Index)
void setSRetReturnReg(unsigned Reg)
SmallVectorImpl< ForwardedRegister > & getForwardedMustTailRegParms()
void setBytesToPopOnReturn(unsigned bytes)
unsigned getBytesToPopOnReturn() const
unsigned getSRetReturnReg() const
void setRAIndex(int Index)
int getVarArgsFrameIndex() const
void setArgumentStackSize(unsigned size)
void setTCReturnAddrDelta(int delta)
unsigned char classifyExternalReference(const Module &M) const
Classify a external variable reference for the current subtarget according to how we should reference...
unsigned char classifyBlockAddressReference() const
Classify a blockaddress reference for the current subtarget according to how we should reference it i...
unsigned getSlotSize() const
getSlotSize - Stack slot size in bytes.
const M68kInstrInfo * getInstrInfo() const override
unsigned char classifyGlobalReference(const GlobalValue *GV, const Module &M) const
Classify a global variable reference for the current subtarget according to how we should reference i...
unsigned getJumpTableEncoding() const
unsigned char classifyLocalReference(const GlobalValue *GV) const
Classify a global variable reference for the current subtarget according to how we should reference i...
const M68kRegisterInfo * getRegisterInfo() const override
bool atLeastM68020() const
unsigned char classifyGlobalFunctionReference(const GlobalValue *GV, const Module &M) const
Classify a global function reference for the current subtarget.
const M68kFrameLowering * getFrameLowering() const override
ConstraintType getConstraintType(StringRef ConstraintStr) const override
Given a constraint, return the type of constraint it is for this target.
void LowerAsmOperandForConstraint(SDValue Op, StringRef Constraint, std::vector< SDValue > &Ops, SelectionDAG &DAG) const override
Lower the specified operand into the Ops vector.
MachineBasicBlock * EmitInstrWithCustomInserter(MachineInstr &MI, MachineBasicBlock *MBB) const override
This method should be implemented by targets that mark instructions with the 'usesCustomInserter' fla...
virtual MVT getScalarShiftAmountTy(const DataLayout &, EVT) const override
EVT is not used in-tree, but is used by out-of-tree target.
const MCExpr * LowerCustomJumpTableEntry(const MachineJumpTableInfo *MJTI, const MachineBasicBlock *MBB, unsigned uid, MCContext &Ctx) const override
SDValue getPICJumpTableRelocBase(SDValue Table, SelectionDAG &DAG) const override
Returns relocation base for the given PIC jumptable.
const MCExpr * getPICJumpTableRelocBaseExpr(const MachineFunction *MF, unsigned JTI, MCContext &Ctx) const override
This returns the relocation base for the given PIC jumptable, the same as getPICJumpTableRelocBase,...
AtomicExpansionKind shouldExpandAtomicRMWInIR(AtomicRMWInst *RMW) const override
Returns how the IR-level AtomicExpand pass should expand the given AtomicRMW, if at all.
Register getExceptionPointerRegister(const Constant *PersonalityFn) const override
If a physical register, this returns the register that receives the exception address on entry to an ...
CCAssignFn * getCCAssignFn(CallingConv::ID CC, bool Return, bool IsVarArg) const
M68kTargetLowering(const M68kTargetMachine &TM, const M68kSubtarget &STI)
InlineAsm::ConstraintCode getInlineAsmMemConstraint(StringRef ConstraintCode) const override
SDValue LowerOperation(SDValue Op, SelectionDAG &DAG) const override
Provide custom lowering hooks for some operations.
EVT getSetCCResultType(const DataLayout &DL, LLVMContext &Context, EVT VT) const override
Return the value type to use for ISD::SETCC.
unsigned getJumpTableEncoding() const override
Return the entry encoding for a jump table in the current function.
const char * getTargetNodeName(unsigned Opcode) const override
This method returns the name of a target specific DAG node.
std::pair< unsigned, const TargetRegisterClass * > getRegForInlineAsmConstraint(const TargetRegisterInfo *TRI, StringRef Constraint, MVT VT) const override
Given a physical register constraint (e.g.
Register getExceptionSelectorRegister(const Constant *PersonalityFn) const override
If a physical register, this returns the register that receives the exception typeid on entry to a la...
Context object for machine code objects.
Base class for the full range of assembler expressions which are needed for parsing.
static const MCSymbolRefExpr * create(const MCSymbol *Symbol, MCContext &Ctx)
static MDTuple * get(LLVMContext &Context, ArrayRef< Metadata * > MDs)
static auto integer_valuetypes()
TypeSize getSizeInBits() const
Returns the size of the specified MVT in bits.
bool isFloatingPoint() const
Return true if this is a FP or a vector FP type.
static MVT getIntegerVT(unsigned BitWidth)
MVT getScalarType() const
If this is a vector, return the element type, otherwise return this.
void transferSuccessorsAndUpdatePHIs(MachineBasicBlock *FromMBB)
Transfers all the successors, as in transferSuccessors, and update PHI operands in the successor bloc...
MCSymbol * getSymbol() const
Return the MCSymbol for this basic block.
void setCallFrameSize(unsigned N)
Set the call frame size on entry to this basic block.
const BasicBlock * getBasicBlock() const
Return the LLVM basic block that this instance corresponded to originally.
void addSuccessor(MachineBasicBlock *Succ, BranchProbability Prob=BranchProbability::getUnknown())
Add Succ as a successor of this MachineBasicBlock.
void addLiveIn(MCRegister PhysReg, LaneBitmask LaneMask=LaneBitmask::getAll())
Adds the specified register as a live in.
const MachineFunction * getParent() const
Return the MachineFunction containing this basic block.
iterator_range< succ_iterator > successors()
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.
int CreateFixedObject(uint64_t Size, int64_t SPOffset, bool IsImmutable, bool isAliased=false)
Create a new object at a fixed location on the stack.
void setObjectZExt(int ObjectIdx, bool IsZExt)
void setObjectSExt(int ObjectIdx, bool IsSExt)
void setHasTailCall(bool V=true)
bool isObjectZExt(int ObjectIdx) const
int64_t getObjectSize(int ObjectIdx) const
Return the size of the specified object.
bool isObjectSExt(int ObjectIdx) const
int64_t getObjectOffset(int ObjectIdx) const
Return the assigned stack offset of the specified object from the incoming stack pointer.
bool isFixedObjectIndex(int ObjectIdx) const
Returns true if the specified index corresponds to a fixed stack object.
MachineFrameInfo & getFrameInfo()
getFrameInfo - Return the frame info object for the current function.
MCSymbol * getJTISymbol(unsigned JTI, MCContext &Ctx, bool isLinkerPrivate=false) const
getJTISymbol - Return the MCSymbol for the specified non-empty jump table.
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.
bool shouldSplitStack() const
Should we be emitting segmented stack stuff for the function.
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...
const TargetMachine & getTarget() const
getTarget - Return the target machine this machine code is compiled with
const MachineInstrBuilder & addReg(Register RegNo, unsigned flags=0, unsigned SubReg=0) const
Add a new virtual register operand.
const MachineInstrBuilder & addMBB(MachineBasicBlock *MBB, unsigned TargetFlags=0) const
MachineInstr * getInstr() const
If conversion operators fail, use this method to get the MachineInstr explicitly.
Representation of each machine instruction.
bool readsRegister(Register Reg, const TargetRegisterInfo *TRI) const
Return true if the MachineInstr reads the specified register.
bool killsRegister(Register Reg, const TargetRegisterInfo *TRI) const
Return true if the MachineInstr kills the specified register.
bool definesRegister(Register Reg, const TargetRegisterInfo *TRI) const
Return true if the MachineInstr fully defines the specified register.
void eraseFromParent()
Unlink 'this' from the containing basic block and delete it.
const MachineOperand & getOperand(unsigned i) const
@ EK_Custom32
EK_Custom32 - Each entry is a 32-bit value that is custom lowered by the TargetLowering::LowerCustomJ...
Register getReg() const
getReg - Returns the register number.
MachineRegisterInfo - Keep track of information for virtual and physical registers,...
Register createVirtualRegister(const TargetRegisterClass *RegClass, StringRef Name="")
createVirtualRegister - Create and return a new virtual register in the function with the specified r...
A Module instance is used to store all the information related to an LLVM module.
Class to represent pointers.
static PointerType * get(Type *ElementType, unsigned AddressSpace)
This constructs a pointer to an object of the specified type in a numbered address space.
Wrapper class representing virtual and physical registers.
static constexpr bool isVirtualRegister(unsigned Reg)
Return true if the specified register number is in the virtual register namespace.
Wrapper class for IR location info (IR ordering and DebugLoc) to be passed into SDNode creation funct...
This class provides iterator support for SDUse operands that use a specific SDNode.
Represents one node in the SelectionDAG.
bool hasOneUse() const
Return true if there is exactly one use of this node.
const SDValue & getOperand(unsigned Num) const
EVT getValueType(unsigned ResNo) const
Return the type of a specified result.
Unlike LLVM values, Selection DAG nodes may return multiple values as the result of a computation.
SDNode * getNode() const
get the SDNode which holds the desired result
bool hasOneUse() const
Return true if there is exactly one node using value ResNo of Node.
SDValue getValue(unsigned R) const
EVT getValueType() const
Return the ValueType of the referenced return value.
TypeSize getValueSizeInBits() const
Returns the size of the value in bits.
const SDValue & getOperand(unsigned i) const
uint64_t getConstantOperandVal(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)
SDValue getStackArgumentTokenFactor(SDValue Chain)
Compute a TokenFactor to force all the incoming stack arguments to be loaded from the stack.
SDValue getCopyToReg(SDValue Chain, const SDLoc &dl, Register Reg, SDValue N)
SDValue getMergeValues(ArrayRef< SDValue > Ops, const SDLoc &dl)
Create a MERGE_VALUES node from the given operands.
SDVTList getVTList(EVT VT)
Return an SDVTList that represents the list of values specified.
SDValue getMemcpy(SDValue Chain, const SDLoc &dl, SDValue Dst, SDValue Src, SDValue Size, Align Alignment, bool isVol, bool AlwaysInline, const CallInst *CI, std::optional< bool > OverrideTailCall, MachinePointerInfo DstPtrInfo, MachinePointerInfo SrcPtrInfo, const AAMDNodes &AAInfo=AAMDNodes(), AAResults *AA=nullptr)
SDValue getSetCC(const SDLoc &DL, EVT VT, SDValue LHS, SDValue RHS, ISD::CondCode Cond, SDValue Chain=SDValue(), bool IsSignaling=false)
Helper function to make it easier to build SetCC's if you just have an ISD::CondCode instead of an SD...
SDValue getRegister(Register Reg, EVT VT)
SDValue getLoad(EVT VT, const SDLoc &dl, SDValue Chain, SDValue Ptr, MachinePointerInfo PtrInfo, MaybeAlign Alignment=MaybeAlign(), MachineMemOperand::Flags MMOFlags=MachineMemOperand::MONone, const AAMDNodes &AAInfo=AAMDNodes(), const MDNode *Ranges=nullptr)
Loads are not normal binary operators: their result type is not determined by their operands,...
SDValue getGLOBAL_OFFSET_TABLE(EVT VT)
Return a GLOBAL_OFFSET_TABLE node. This does not have a useful SDLoc.
SDValue getNOT(const SDLoc &DL, SDValue Val, EVT VT)
Create a bitwise NOT operation as (XOR Val, -1).
const TargetLowering & getTargetLoweringInfo() const
SDValue getTargetJumpTable(int JTI, EVT VT, unsigned TargetFlags=0)
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 getBitcast(EVT VT, SDValue V)
Return a bitcast using the SDLoc of the value operand, and casting to the provided type.
SDValue getCopyFromReg(SDValue Chain, const SDLoc &dl, Register Reg, EVT VT)
const DataLayout & getDataLayout() const
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)
SDValue getMDNode(const MDNode *MD)
Return an MDNodeSDNode which holds an MDNode.
void ReplaceAllUsesWith(SDValue From, SDValue To)
Modify anything using 'From' to use 'To' instead.
SDValue getStore(SDValue Chain, const SDLoc &dl, SDValue Val, SDValue Ptr, MachinePointerInfo PtrInfo, Align Alignment, MachineMemOperand::Flags MMOFlags=MachineMemOperand::MONone, const AAMDNodes &AAInfo=AAMDNodes())
Helper function to build ISD::STORE nodes.
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 getExternalSymbol(const char *Sym, EVT VT)
const TargetMachine & getTarget() const
SDValue getIntPtrConstant(uint64_t Val, const SDLoc &DL, bool isTarget=false)
SDValue getValueType(EVT)
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)
MachineFunction & getMachineFunction() const
SDValue getFrameIndex(int FI, EVT VT, bool isTarget=false)
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.
SDValue getRegisterMask(const uint32_t *RegMask)
bool MaskedValueIsZero(SDValue Op, const APInt &Mask, unsigned Depth=0) const
Return true if 'Op & Mask' is known to be zero.
LLVMContext * getContext() const
SDValue getTargetExternalSymbol(const char *Sym, EVT VT, unsigned TargetFlags=0)
SDValue CreateStackTemporary(TypeSize Bytes, Align Alignment)
Create a stack temporary based on the size in bytes and the alignment.
SDNode * UpdateNodeOperands(SDNode *N, SDValue Op)
Mutate the specified node in-place to have the specified operands.
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.
This class consists of common code factored out of the SmallVector class to reduce code duplication b...
reference emplace_back(ArgTypes &&... Args)
void push_back(const T &Elt)
This is a 'vector' (really, a variable-sized array), optimized for the case when the array is small.
StringRef - Represent a constant reference to a string, i.e.
constexpr size_t size() const
size - Get the string size.
A switch()-like statement whose cases are string literals.
StringSwitch & Case(StringLiteral S, T Value)
Information about stack frame layout on the target.
unsigned getStackAlignment() const
getStackAlignment - This method returns the number of bytes to which the stack pointer must be aligne...
TargetInstrInfo - Interface to description of machine instruction set.
void setOperationAction(unsigned Op, MVT VT, LegalizeAction Action)
Indicate that the specified operation does not work with the specified type and indicate what to do a...
virtual const TargetRegisterClass * getRegClassFor(MVT VT, bool isDivergent=false) const
Return the register class that should be used for the specified value type.
const TargetMachine & getTargetMachine() const
void setMaxAtomicSizeInBitsSupported(unsigned SizeInBits)
Set the maximum atomic operation size supported by the backend.
Register getStackPointerRegisterToSaveRestore() const
If a physical register, this specifies the register that llvm.savestack/llvm.restorestack should save...
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.
bool isTypeLegal(EVT VT) const
Return true if the target has native support for the specified value type.
MVT getProgramPointerTy(const DataLayout &DL) const
Return the type for code pointers, which is determined by the program address space specified through...
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...
bool isOperationLegal(unsigned Op, EVT VT) const
Return true if the specified operation is legal on this target.
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 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 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
virtual MVT getPointerMemTy(const DataLayout &DL, uint32_t AS=0) const
Return the in-memory pointer type for the given address space, defaults to the pointer type from the ...
This class defines information used to lower LLVM code to legal SelectionDAG operators that the targe...
virtual InlineAsm::ConstraintCode getInlineAsmMemConstraint(StringRef ConstraintCode) const
virtual ConstraintType getConstraintType(StringRef Constraint) const
Given a constraint, return the type of constraint it is for this target.
bool parametersInCSRMatch(const MachineRegisterInfo &MRI, const uint32_t *CallerPreservedMask, const SmallVectorImpl< CCValAssign > &ArgLocs, const SmallVectorImpl< SDValue > &OutVals) const
Check whether parameters to a call that are passed in callee saved registers are the same as from the...
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 std::pair< unsigned, const TargetRegisterClass * > getRegForInlineAsmConstraint(const TargetRegisterInfo *TRI, StringRef Constraint, MVT VT) const
Given a physical register constraint (e.g.
virtual void LowerAsmOperandForConstraint(SDValue Op, StringRef Constraint, std::vector< SDValue > &Ops, SelectionDAG &DAG) const
Lower the specified operand into the Ops vector.
TLSModel::Model getTLSModel(const GlobalValue *GV) const
Returns the TLS model which should be used for the given global variable.
unsigned GuaranteedTailCallOpt
GuaranteedTailCallOpt - This flag is enabled when -tailcallopt is specified on the commandline.
TargetRegisterInfo base class - We assume that the target defines a static array of TargetRegisterDes...
The instances of the Type class are immutable: once they are created, they are never changed.
Value * getOperand(unsigned i) const
LLVM Value Representation.
bool hasOneUse() const
Return true if there is exactly one use of this value.
self_iterator getIterator()
#define llvm_unreachable(msg)
Marks that the current location is not supposed to be reachable.
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.
@ M68k_INTR
Used for M68k interrupt routines.
@ Swift
Calling convention for Swift.
@ M68k_RTD
Used for M68k rtd-based CC (similar to X86's stdcall).
@ C
The default llvm calling convention, compatible with C.
unsigned ID
LLVM IR allows to use arbitrary numbers as calling convention identifiers.
CondCode getSetCCInverse(CondCode Operation, bool isIntegerLike)
Return the operation corresponding to !(X op Y), where 'op' is a valid SetCC operation.
bool isNON_EXTLoad(const SDNode *N)
Returns true if the specified node is a non-extending load.
@ SETCC
SetCC operator - This evaluates to a true value iff the condition is true.
@ MERGE_VALUES
MERGE_VALUES - This node takes multiple discrete operands and returns them all as its individual resu...
@ 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.
@ SMUL_LOHI
SMUL_LOHI/UMUL_LOHI - Multiply two integers of type iN, producing a signed/unsigned value of type i[2...
@ BSWAP
Byte Swap and Counting operators.
@ VAEND
VAEND, VASTART - VAEND and VASTART have three operands: an input chain, pointer, and a SRCVALUE.
@ ADDC
Carry-setting nodes for multiple precision addition and subtraction.
@ ADD
Simple integer binary arithmetic operators.
@ ANY_EXTEND
ANY_EXTEND - Used for integer types. The high bits are undefined.
@ 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.
@ BITCAST
BITCAST - This operator converts between integer, vector and FP values, as if the value was stored to...
@ SIGN_EXTEND
Conversion operators.
@ BR
Control flow instructions. These all have token chains.
@ SETCCCARRY
Like SetCC, ops #0 and #1 are the LHS and RHS operands to compare, but op #2 is a boolean indicating ...
@ BR_CC
BR_CC - Conditional branch.
@ SSUBO
Same for subtraction.
@ BR_JT
BR_JT - Jumptable branch.
@ SELECT
Select(COND, TRUEVAL, FALSEVAL).
@ 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...
@ SADDO
RESULT, BOOL = [SU]ADDO(LHS, RHS) - Overflow-aware nodes for addition.
@ MULHU
MULHU/MULHS - Multiply high - Multiply two integers of type iN, producing an unsigned/signed value of...
@ SHL
Shift and rotation operations.
@ ZERO_EXTEND
ZERO_EXTEND - Used for integer types, zeroing the new bits.
@ SELECT_CC
Select with condition operator - This selects between a true value and a false value (ops #2 and #3) ...
@ ATOMIC_CMP_SWAP
Val, OUTCHAIN = ATOMIC_CMP_SWAP(INCHAIN, ptr, cmp, swap) For double-word atomic operations: ValLo,...
@ SMULO
Same for multiplication.
@ DYNAMIC_STACKALLOC
DYNAMIC_STACKALLOC - Allocate some number of bytes on the stack aligned to a specified boundary.
@ AND
Bitwise operators - logical and, logical or, logical xor.
@ ADDE
Carry-using nodes for multiple precision addition and subtraction.
@ 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,...
@ INLINEASM
INLINEASM - Represents an inline asm block.
@ 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...
CondCode
ISD::CondCode enum - These are ordered carefully to make the bitfields below work out,...
static bool isPCRelBlockReference(unsigned char Flag)
Return True if the Block is referenced using PC.
static bool isGlobalRelativeToPICBase(unsigned char TargetFlag)
Return true if the specified global value reference is relative to a 32-bit PIC base (M68kISD::GLOBAL...
static bool isGlobalStubReference(unsigned char TargetFlag)
Return true if the specified TargetFlag operand is a reference to a stub for a global,...
static bool isPCRelGlobalReference(unsigned char Flag)
Return True if the specified GlobalValue requires PC addressing mode.
@ MO_TLSLDM
On a symbol operand, this indicates that the immediate is the offset to the slot in GOT which stores ...
@ MO_TLSLE
On a symbol operand, this indicates that the immediate is the offset to the variable within in the th...
@ MO_TLSGD
On a symbol operand, this indicates that the immediate is the offset to the slot in GOT which stores ...
@ MO_GOTPCREL
On a symbol operand this indicates that the immediate is offset to the GOT entry for the symbol name ...
@ MO_TLSIE
On a symbol operand, this indicates that the immediate is the offset to the variable within the threa...
@ MO_TLSLD
On a symbol operand, this indicates that the immediate is the offset to variable within the thread lo...
static bool isDirectGlobalReference(unsigned char Flag)
Return True if the specified GlobalValue is a direct reference for a symbol.
@ BRCOND
M68k conditional branches.
@ CMOV
M68k conditional moves.
@ BTST
M68k bit-test instructions.
@ CMP
M68k compare and logical compare instructions.
@ WrapperPC
Special wrapper used under M68k PIC mode for PC relative displacements.
@ Wrapper
A wrapper node for TargetConstantPool, TargetExternalSymbol, and TargetGlobalAddress.
static bool IsSETCC(unsigned SETCC)
static unsigned GetCondBranchFromCond(M68k::CondCode CC)
bool isCalleePop(CallingConv::ID CallingConv, bool IsVarArg, bool GuaranteeTCO)
Determines whether the callee is required to pop its own arguments.
static M68k::CondCode GetOppositeBranchCondition(M68k::CondCode CC)
Reg
All possible values of the reg field in the ModR/M byte.
This is an optimization pass for GlobalISel generic memory operations.
MachineInstrBuilder BuildMI(MachineFunction &MF, const MIMetadata &MIMD, const MCInstrDesc &MCID)
Builder interface. Specify how to create the initial instruction itself.
bool isNullConstant(SDValue V)
Returns true if V is a constant integer zero.
unsigned Log2_64_Ceil(uint64_t Value)
Return the ceil log base 2 of the specified value, 64 if the value is zero.
constexpr bool isPowerOf2_64(uint64_t Value)
Return true if the argument is a power of two > 0 (64 bit edition.)
bool isBitwiseNot(SDValue V, bool AllowUndefs=false)
Returns true if V is a bitwise not operation.
decltype(auto) get(const PointerIntPair< PointerTy, IntBits, IntType, PtrTraits, Info > &Pair)
void report_fatal_error(Error Err, bool gen_crash_diag=true)
Report a serious error, calling any installed error handler.
@ Mod
The access may modify the value stored in memory.
bool CCAssignFn(unsigned ValNo, MVT ValVT, MVT LocVT, CCValAssign::LocInfo LocInfo, ISD::ArgFlagsTy ArgFlags, CCState &State)
CCAssignFn - This function assigns a location for Val, updating State to reflect the change.
@ Xor
Bitwise or logical XOR of integers.
@ And
Bitwise or logical AND of integers.
DWARFExpression::Operation Op
constexpr unsigned BitWidth
bool isOneConstant(SDValue V)
Returns true if V is a constant integer one.
bool isAllOnesConstant(SDValue V)
Returns true if V is an integer constant with all bits set.
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.
bool isSimple() const
Test if the given EVT is simple (as opposed to being extended).
TypeSize getSizeInBits() const
Return the size of the specified value type in bits.
uint64_t getScalarSizeInBits() const
MVT getSimpleVT() const
Return the SimpleValueType held in the specified simple EVT.
bool isVector() const
Return true if this is a vector value type.
EVT getVectorElementType() const
Given a vector type, return the type of each element.
bool bitsLE(EVT VT) const
Return true if this has no more bits than VT.
Describes a register that needs to be forwarded from the prologue to a musttail call.
Custom state to propagate llvm type info to register CC assigner.
This class contains a discriminated union of information about pointers in memory operands,...
static MachinePointerInfo getStack(MachineFunction &MF, int64_t Offset, uint8_t ID=0)
Stack pointer relative access.
static MachinePointerInfo getGOT(MachineFunction &MF)
Return a MachinePointerInfo record that refers to a GOT entry.
static MachinePointerInfo getFixedStack(MachineFunction &MF, int FI, int64_t Offset=0)
Return a MachinePointerInfo record that refers to the specified FrameIndex.
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.
CallLoweringInfo & setLibCallee(CallingConv::ID CC, Type *ResultType, SDValue Target, ArgListTy &&ArgsList)
SmallVector< ISD::InputArg, 32 > Ins
CallLoweringInfo & setDebugLoc(const SDLoc &dl)
SmallVector< ISD::OutputArg, 32 > Outs
SmallVector< SDValue, 32 > OutVals
CallLoweringInfo & setChain(SDValue InChain)