53 class X86MCInstLower {
88 CurrentShadowSize += Code.
size();
89 if (CurrentShadowSize >= RequiredShadowSize)
94 void X86AsmPrinter::StackMapShadowTracker::emitShadowPadding(
96 if (InShadow && CurrentShadowSize < RequiredShadowSize) {
98 EmitNops(OutStreamer, RequiredShadowSize - CurrentShadowSize,
103 void X86AsmPrinter::EmitAndCountInstruction(
MCInst &Inst) {
105 EnablePrintSchedInfo &&
107 SMShadowTracker.count(Inst, getSubtargetInfo(), CodeEmitter.get());
112 : Ctx(mf.getContext()), MF(mf),
TM(mf.getTarget()), MAI(*
TM.getMCAsmInfo()),
124 "Isn't a symbol reference");
140 Suffix =
"$non_lazy_ptr";
152 }
else if (MO.
isMBB()) {
159 Sym = Ctx.getOrCreateSymbol(Name);
170 if (!StubSym.getPointer()) {
198 const MCExpr *Expr =
nullptr;
272 assert(MAI.doesSetDirectiveSuppressReloc());
302 "Unexpected instruction!");
306 if (Reg !=
X86::AL && Reg != X86::AX && Reg !=
X86::EAX && Reg != X86::RAX)
319 unsigned NewOpcode = 0;
324 case X86::MOVSX16rr8:
325 if (Op0 == X86::AX && Op1 ==
X86::AL)
326 NewOpcode = X86::CBW;
328 case X86::MOVSX32rr16:
329 if (Op0 ==
X86::EAX && Op1 == X86::AX)
330 NewOpcode = X86::CWDE;
332 case X86::MOVSX64rr32:
333 if (Op0 == X86::RAX && Op1 ==
X86::EAX)
334 NewOpcode = X86::CDQE;
338 if (NewOpcode != 0) {
353 unsigned AddrBase = IsStore;
354 unsigned RegOp = IsStore ? 0 : 5;
355 unsigned AddrOp = AddrBase + 3;
363 "Unexpected instruction!");
367 if (Reg !=
X86::AL && Reg != X86::AX && Reg !=
X86::EAX && Reg != X86::RAX)
397 return Subtarget.
is64Bit() ? X86::RETQ : X86::RETL;
437 if (
auto MaybeMCOp = LowerMachineOperand(MI, MO))
449 "Unexpected # of LEA operands");
451 "LEA has segment specified!");
456 case X86::VMOVZPQILo2PQIrr:
458 case X86::VMOVAPDYrr:
460 case X86::VMOVAPSYrr:
462 case X86::VMOVDQAYrr:
464 case X86::VMOVDQUYrr:
466 case X86::VMOVUPDYrr:
468 case X86::VMOVUPSYrr: {
474 case X86::VMOVZPQILo2PQIrr: NewOpc = X86::VMOVPQI2QIrr;
break;
475 case X86::VMOVAPDrr: NewOpc = X86::VMOVAPDrr_REV;
break;
476 case X86::VMOVAPDYrr: NewOpc = X86::VMOVAPDYrr_REV;
break;
477 case X86::VMOVAPSrr: NewOpc = X86::VMOVAPSrr_REV;
break;
478 case X86::VMOVAPSYrr: NewOpc = X86::VMOVAPSYrr_REV;
break;
479 case X86::VMOVDQArr: NewOpc = X86::VMOVDQArr_REV;
break;
480 case X86::VMOVDQAYrr: NewOpc = X86::VMOVDQAYrr_REV;
break;
481 case X86::VMOVDQUrr: NewOpc = X86::VMOVDQUrr_REV;
break;
482 case X86::VMOVDQUYrr: NewOpc = X86::VMOVDQUYrr_REV;
break;
483 case X86::VMOVUPDrr: NewOpc = X86::VMOVUPDrr_REV;
break;
484 case X86::VMOVUPDYrr: NewOpc = X86::VMOVUPDYrr_REV;
break;
485 case X86::VMOVUPSrr: NewOpc = X86::VMOVUPSrr_REV;
break;
486 case X86::VMOVUPSYrr: NewOpc = X86::VMOVUPSYrr_REV;
break;
493 case X86::VMOVSSrr: {
499 case X86::VMOVSDrr: NewOpc = X86::VMOVSDrr_REV;
break;
500 case X86::VMOVSSrr: NewOpc = X86::VMOVSSrr_REV;
break;
510 case X86::TAILJMPr64:
511 case X86::TAILJMPr64_REX:
513 case X86::CALL64pcrel32: {
523 case X86::EH_RETURN64: {
551 Opcode = X86::JMP32r;
552 goto SetTailJmpOpcode;
554 case X86::TAILJMPd64:
556 goto SetTailJmpOpcode;
557 case X86::TAILJMPd_CC:
558 case X86::TAILJMPd64_CC:
561 goto SetTailJmpOpcode;
580 case X86::DEC16r: Opcode = X86::DEC16r_alt;
break;
581 case X86::DEC32r: Opcode = X86::DEC32r_alt;
break;
582 case X86::INC16r: Opcode = X86::INC16r_alt;
break;
583 case X86::INC32r: Opcode = X86::INC32r_alt;
break;
592 case X86::ADD16rr_DB: OutMI.
setOpcode(X86::OR16rr);
goto ReSimplify;
593 case X86::ADD32rr_DB: OutMI.
setOpcode(X86::OR32rr);
goto ReSimplify;
594 case X86::ADD64rr_DB: OutMI.
setOpcode(X86::OR64rr);
goto ReSimplify;
595 case X86::ADD16ri_DB: OutMI.
setOpcode(X86::OR16ri);
goto ReSimplify;
596 case X86::ADD32ri_DB: OutMI.
setOpcode(X86::OR32ri);
goto ReSimplify;
597 case X86::ADD64ri32_DB: OutMI.
setOpcode(X86::OR64ri32);
goto ReSimplify;
598 case X86::ADD16ri8_DB: OutMI.
setOpcode(X86::OR16ri8);
goto ReSimplify;
599 case X86::ADD32ri8_DB: OutMI.
setOpcode(X86::OR32ri8);
goto ReSimplify;
600 case X86::ADD64ri8_DB: OutMI.
setOpcode(X86::OR64ri8);
goto ReSimplify;
609 case X86::MOV8mr_NOREX:
611 case X86::MOV8rm_NOREX:
620 case X86::MOV8mr_NOREX:
621 case X86::MOV8mr: NewOpc = X86::MOV8o32a;
break;
622 case X86::MOV8rm_NOREX:
623 case X86::MOV8rm: NewOpc = X86::MOV8ao32;
break;
624 case X86::MOV16mr: NewOpc = X86::MOV16o32a;
break;
625 case X86::MOV16rm: NewOpc = X86::MOV16ao32;
break;
626 case X86::MOV32mr: NewOpc = X86::MOV32o32a;
break;
627 case X86::MOV32rm: NewOpc = X86::MOV32ao32;
break;
633 case X86::ADC8ri:
case X86::ADC16ri:
case X86::ADC32ri:
case X86::ADC64ri32:
634 case X86::ADD8ri:
case X86::ADD16ri:
case X86::ADD32ri:
case X86::ADD64ri32:
635 case X86::AND8ri:
case X86::AND16ri:
case X86::AND32ri:
case X86::AND64ri32:
636 case X86::CMP8ri:
case X86::CMP16ri:
case X86::CMP32ri:
case X86::CMP64ri32:
637 case X86::OR8ri:
case X86::OR16ri:
case X86::OR32ri:
case X86::OR64ri32:
638 case X86::SBB8ri:
case X86::SBB16ri:
case X86::SBB32ri:
case X86::SBB64ri32:
639 case X86::SUB8ri:
case X86::SUB16ri:
case X86::SUB32ri:
case X86::SUB64ri32:
640 case X86::TEST8ri:
case X86::TEST16ri:
case X86::TEST32ri:
case X86::TEST64ri32:
641 case X86::XOR8ri:
case X86::XOR16ri:
case X86::XOR32ri:
case X86::XOR64ri32: {
645 case X86::ADC8ri: NewOpc = X86::ADC8i8;
break;
646 case X86::ADC16ri: NewOpc = X86::ADC16i16;
break;
647 case X86::ADC32ri: NewOpc = X86::ADC32i32;
break;
648 case X86::ADC64ri32: NewOpc = X86::ADC64i32;
break;
649 case X86::ADD8ri: NewOpc = X86::ADD8i8;
break;
650 case X86::ADD16ri: NewOpc = X86::ADD16i16;
break;
651 case X86::ADD32ri: NewOpc = X86::ADD32i32;
break;
652 case X86::ADD64ri32: NewOpc = X86::ADD64i32;
break;
653 case X86::AND8ri: NewOpc = X86::AND8i8;
break;
654 case X86::AND16ri: NewOpc = X86::AND16i16;
break;
655 case X86::AND32ri: NewOpc = X86::AND32i32;
break;
656 case X86::AND64ri32: NewOpc = X86::AND64i32;
break;
657 case X86::CMP8ri: NewOpc = X86::CMP8i8;
break;
658 case X86::CMP16ri: NewOpc = X86::CMP16i16;
break;
659 case X86::CMP32ri: NewOpc = X86::CMP32i32;
break;
660 case X86::CMP64ri32: NewOpc = X86::CMP64i32;
break;
661 case X86::OR8ri: NewOpc = X86::OR8i8;
break;
662 case X86::OR16ri: NewOpc = X86::OR16i16;
break;
663 case X86::OR32ri: NewOpc = X86::OR32i32;
break;
664 case X86::OR64ri32: NewOpc = X86::OR64i32;
break;
665 case X86::SBB8ri: NewOpc = X86::SBB8i8;
break;
666 case X86::SBB16ri: NewOpc = X86::SBB16i16;
break;
667 case X86::SBB32ri: NewOpc = X86::SBB32i32;
break;
668 case X86::SBB64ri32: NewOpc = X86::SBB64i32;
break;
669 case X86::SUB8ri: NewOpc = X86::SUB8i8;
break;
670 case X86::SUB16ri: NewOpc = X86::SUB16i16;
break;
671 case X86::SUB32ri: NewOpc = X86::SUB32i32;
break;
672 case X86::SUB64ri32: NewOpc = X86::SUB64i32;
break;
673 case X86::TEST8ri: NewOpc = X86::TEST8i8;
break;
674 case X86::TEST16ri: NewOpc = X86::TEST16i16;
break;
675 case X86::TEST32ri: NewOpc = X86::TEST32i32;
break;
676 case X86::TEST64ri32: NewOpc = X86::TEST64i32;
break;
677 case X86::XOR8ri: NewOpc = X86::XOR8i8;
break;
678 case X86::XOR16ri: NewOpc = X86::XOR16i16;
break;
679 case X86::XOR32ri: NewOpc = X86::XOR32i32;
break;
680 case X86::XOR64ri32: NewOpc = X86::XOR64i32;
break;
687 case X86::MOVSX16rr8:
688 case X86::MOVSX32rr16:
689 case X86::MOVSX64rr32:
695 void X86AsmPrinter::LowerTlsAddr(X86MCInstLower &MCInstLowering,
698 bool is64Bits = MI.
getOpcode() == X86::TLS_addr64 ||
701 bool needsPadding = MI.
getOpcode() == X86::TLS_addr64;
710 case X86::TLS_addr32:
711 case X86::TLS_addr64:
714 case X86::TLS_base_addr32:
717 case X86::TLS_base_addr64:
753 EmitAndCountInstruction(LEA);
761 StringRef name = is64Bits ?
"__tls_get_addr" :
"___tls_get_addr";
766 EmitAndCountInstruction(
767 MCInstBuilder(is64Bits ? X86::CALL64pcrel32 : X86::CALLpcrel32)
777 assert(Is64Bit &&
"EmitNops only supports X86-64");
780 unsigned Opc, BaseReg, ScaleVal, IndexReg, Displacement, SegmentReg;
781 Opc = IndexReg = Displacement = SegmentReg = 0;
839 SegmentReg = X86::CS;
843 unsigned NumPrefixes = std::min(NumBytes - NopSize, 5U);
844 NopSize += NumPrefixes;
845 for (
unsigned i = 0; i != NumPrefixes; ++i)
862 .addImm(Displacement)
867 assert(NopSize <= NumBytes &&
"We overemitted?");
874 unsigned NopsToEmit = NumBytes;
877 NumBytes -=
EmitNop(OS, NumBytes, Is64Bit, STI);
878 assert(NopsToEmit >= NumBytes &&
"Emitted more than I asked for!");
882 void X86AsmPrinter::LowerSTATEPOINT(
const MachineInstr &MI,
883 X86MCInstLower &MCIL) {
884 assert(Subtarget->
is64Bit() &&
"Statepoint currently only supports X86-64");
887 if (
unsigned PatchBytes = SOpers.getNumPatchBytes()) {
895 switch (CallTarget.
getType()) {
898 CallTargetMCOp = MCIL.LowerSymbolOperand(
899 CallTarget, MCIL.GetSymbolFromOperand(CallTarget));
900 CallOpcode = X86::CALL64pcrel32;
908 CallOpcode = X86::CALL64pcrel32;
920 CallOpcode = X86::CALL64r;
939 void X86AsmPrinter::LowerFAULTING_OP(
const MachineInstr &FaultingMI,
940 X86MCInstLower &MCIL) {
949 unsigned OperandsBeginIdx = 4;
957 if (DefRegister != X86::NoRegister)
963 if (
auto MaybeOperand = MCIL.LowerMachineOperand(&FaultingMI, *
I))
969 void X86AsmPrinter::LowerFENTRY_CALL(
const MachineInstr &MI,
970 X86MCInstLower &MCIL) {
971 bool Is64Bits = Subtarget->
is64Bit();
977 EmitAndCountInstruction(
978 MCInstBuilder(Is64Bits ? X86::CALL64pcrel32 : X86::CALLpcrel32)
982 void X86AsmPrinter::LowerPATCHABLE_OP(
const MachineInstr &MI,
983 X86MCInstLower &MCIL) {
992 if (
auto MaybeOperand = MCIL.LowerMachineOperand(&MI, MO))
1000 if (Code.
size() < MinSize) {
1001 if (MinSize == 2 && Opcode == X86::PUSH64r) {
1009 unsigned NopSize =
EmitNop(*OutStreamer, MinSize, Subtarget->
is64Bit(),
1011 assert(NopSize == MinSize &&
"Could not implement MinSize!");
1021 void X86AsmPrinter::LowerSTACKMAP(
const MachineInstr &MI) {
1025 SMShadowTracker.reset(NumShadowBytes);
1030 void X86AsmPrinter::LowerPATCHPOINT(
const MachineInstr &MI,
1031 X86MCInstLower &MCIL) {
1032 assert(Subtarget->
is64Bit() &&
"Patchpoint currently only supports X86-64");
1040 unsigned EncodedBytes = 0;
1057 CalleeMCOp = MCIL.LowerSymbolOperand(CalleeMO,
1058 MCIL.GetSymbolFromOperand(CalleeMO));
1070 EmitAndCountInstruction(
1075 "Lowering patchpoint with retpoline not yet implemented.");
1076 EmitAndCountInstruction(
MCInstBuilder(X86::CALL64r).addReg(ScratchReg));
1081 assert(NumBytes >= EncodedBytes &&
1082 "Patchpoint can't request size less than the length of a call.");
1088 void X86AsmPrinter::LowerPATCHABLE_EVENT_CALL(
const MachineInstr &MI,
1089 X86MCInstLower &MCIL) {
1090 assert(Subtarget->
is64Bit() &&
"XRay custom events only supports X86-64");
1113 OutStreamer->
AddComment(
"# XRay Custom Event Log");
1124 unsigned DestRegs[] = {X86::RDI, X86::RSI};
1125 bool UsedMask[] = {
false,
false};
1127 unsigned SrcRegs[] = {0, 0};
1135 if (
auto Op = MCIL.LowerMachineOperand(&MI, MI.
getOperand(
I))) {
1136 assert(
Op->isReg() &&
"Only support arguments in registers");
1137 SrcRegs[
I] =
Op->getReg();
1138 if (SrcRegs[
I] != DestRegs[
I]) {
1140 EmitAndCountInstruction(
1149 if (SrcRegs[
I] != DestRegs[
I])
1150 EmitAndCountInstruction(
1151 MCInstBuilder(X86::MOV64rr).addReg(DestRegs[I]).addReg(SrcRegs[I]));
1162 .
addOperand(MCIL.LowerSymbolOperand(TOp, TSym)));
1165 for (
unsigned I =
sizeof UsedMask; I-- > 0;)
1167 EmitAndCountInstruction(
MCInstBuilder(X86::POP64r).addReg(DestRegs[I]));
1171 OutStreamer->
AddComment(
"xray custom event end.");
1179 void X86AsmPrinter::LowerPATCHABLE_TYPED_EVENT_CALL(
const MachineInstr &MI,
1180 X86MCInstLower &MCIL) {
1181 assert(Subtarget->
is64Bit() &&
"XRay typed events only supports X86-64");
1204 OutStreamer->
AddComment(
"# XRay Typed Event Log");
1216 unsigned DestRegs[] = {X86::RDI, X86::RSI, X86::RDX};
1217 bool UsedMask[] = {
false,
false,
false};
1220 unsigned SrcRegs[] = {0, 0, 0};
1227 if (
auto Op = MCIL.LowerMachineOperand(&MI, MI.
getOperand(
I))) {
1229 assert(
Op->isReg() &&
"Only supports arguments in registers");
1230 SrcRegs[
I] =
Op->getReg();
1231 if (SrcRegs[
I] != DestRegs[
I]) {
1233 EmitAndCountInstruction(
1248 EmitAndCountInstruction(
1249 MCInstBuilder(X86::MOV64rr).addReg(DestRegs[I]).addReg(SrcRegs[I]));
1260 .
addOperand(MCIL.LowerSymbolOperand(TOp, TSym)));
1263 for (
unsigned I =
sizeof UsedMask; I-- > 0;)
1265 EmitAndCountInstruction(
MCInstBuilder(X86::POP64r).addReg(DestRegs[I]));
1269 OutStreamer->
AddComment(
"xray typed event end.");
1275 void X86AsmPrinter::LowerPATCHABLE_FUNCTION_ENTER(
const MachineInstr &MI,
1276 X86MCInstLower &MCIL) {
1302 void X86AsmPrinter::LowerPATCHABLE_RET(
const MachineInstr &MI,
1303 X86MCInstLower &MCIL) {
1325 if (
auto MaybeOperand = MCIL.LowerMachineOperand(&MI, MO))
1332 void X86AsmPrinter::LowerPATCHABLE_TAIL_CALL(
const MachineInstr &MI,
1333 X86MCInstLower &MCIL) {
1361 if (
auto MaybeOperand = MCIL.LowerMachineOperand(&MI, MO))
1371 while (MBBI == MBB->
begin()) {
1396 "Expected a constant of the same type!");
1402 std::string Comment;
1409 auto GetRegisterName = [](
unsigned RegNum) ->
StringRef {
1419 SrcOp1.
isReg() ? GetRegisterName(SrcOp1.
getReg()) :
"mem";
1421 SrcOp2.
isReg() ? GetRegisterName(SrcOp2.
getReg()) :
"mem";
1425 if (Src1Name == Src2Name)
1426 for (
int i = 0, e = ShuffleMask.size(); i != e; ++i)
1427 if (ShuffleMask[i] >= e)
1428 ShuffleMask[i] -= e;
1436 if (SrcOp1Idx > 1) {
1437 assert((SrcOp1Idx == 2 || SrcOp1Idx == 3) &&
"Unexpected writemask");
1440 if (WriteMaskOp.
isReg()) {
1441 CS <<
" {%" << GetRegisterName(WriteMaskOp.
getReg()) <<
"}";
1443 if (SrcOp1Idx == 2) {
1451 for (
int i = 0, e = ShuffleMask.size(); i != e; ++i) {
1461 bool isSrc1 = ShuffleMask[i] < (int)e;
1462 CS << (isSrc1 ? Src1Name : Src2Name) <<
'[';
1464 bool IsFirst =
true;
1466 (ShuffleMask[i] < (
int)e) == isSrc1) {
1474 CS << ShuffleMask[i] % (int)e;
1508 if (isa<UndefValue>(COp)) {
1510 }
else if (
auto *CI = dyn_cast<ConstantInt>(COp)) {
1512 }
else if (
auto *CF = dyn_cast<ConstantFP>(COp)) {
1519 void X86AsmPrinter::EmitSEHInstruction(
const MachineInstr *MI) {
1530 case X86::SEH_PushReg:
1533 case X86::SEH_StackAlloc:
1536 case X86::SEH_StackAlign:
1539 case X86::SEH_SetFrame:
1541 ".cv_fpo_setframe takes no offset");
1544 case X86::SEH_EndPrologue:
1547 case X86::SEH_SaveReg:
1548 case X86::SEH_SaveXMM:
1549 case X86::SEH_PushFrame:
1560 case X86::SEH_PushReg:
1565 case X86::SEH_SaveReg:
1570 case X86::SEH_SaveXMM:
1575 case X86::SEH_StackAlloc:
1579 case X86::SEH_SetFrame:
1585 case X86::SEH_PushFrame:
1589 case X86::SEH_EndPrologue:
1599 if (Info.
RegClass == X86::VR128RegClassID ||
1600 Info.
RegClass == X86::VR128XRegClassID)
1602 if (Info.
RegClass == X86::VR256RegClassID ||
1603 Info.
RegClass == X86::VR256XRegClassID)
1605 if (Info.
RegClass == X86::VR512RegClassID)
1611 X86MCInstLower MCInstLowering(*
MF, *
this);
1619 OutStreamer->
AddComment(
"EVEX TO VEX Compression ",
false);
1623 case TargetOpcode::DBG_VALUE:
1627 case X86::Int_MemBarrier:
1632 case X86::EH_RETURN64: {
1654 case X86::TAILJMPd_CC:
1655 case X86::TAILJMPr64:
1656 case X86::TAILJMPm64:
1657 case X86::TAILJMPd64:
1658 case X86::TAILJMPd64_CC:
1659 case X86::TAILJMPr64_REX:
1660 case X86::TAILJMPm64_REX:
1665 case X86::TLS_addr32:
1666 case X86::TLS_addr64:
1667 case X86::TLS_base_addr32:
1668 case X86::TLS_base_addr64:
1669 return LowerTlsAddr(MCInstLowering, *MI);
1671 case X86::MOVPC32r: {
1682 EmitAndCountInstruction(
1688 bool hasFP = FrameLowering->
hasFP(*
MF);
1696 if (HasActiveDwarfFrame && !hasFP) {
1704 EmitAndCountInstruction(
1707 if (HasActiveDwarfFrame && !hasFP) {
1713 case X86::ADD32ri: {
1745 case TargetOpcode::STATEPOINT:
1746 return LowerSTATEPOINT(*MI, MCInstLowering);
1748 case TargetOpcode::FAULTING_OP:
1749 return LowerFAULTING_OP(*MI, MCInstLowering);
1751 case TargetOpcode::FENTRY_CALL:
1752 return LowerFENTRY_CALL(*MI, MCInstLowering);
1754 case TargetOpcode::PATCHABLE_OP:
1755 return LowerPATCHABLE_OP(*MI, MCInstLowering);
1757 case TargetOpcode::STACKMAP:
1758 return LowerSTACKMAP(*MI);
1760 case TargetOpcode::PATCHPOINT:
1761 return LowerPATCHPOINT(*MI, MCInstLowering);
1763 case TargetOpcode::PATCHABLE_FUNCTION_ENTER:
1764 return LowerPATCHABLE_FUNCTION_ENTER(*MI, MCInstLowering);
1766 case TargetOpcode::PATCHABLE_RET:
1767 return LowerPATCHABLE_RET(*MI, MCInstLowering);
1769 case TargetOpcode::PATCHABLE_TAIL_CALL:
1770 return LowerPATCHABLE_TAIL_CALL(*MI, MCInstLowering);
1772 case TargetOpcode::PATCHABLE_EVENT_CALL:
1773 return LowerPATCHABLE_EVENT_CALL(*MI, MCInstLowering);
1775 case TargetOpcode::PATCHABLE_TYPED_EVENT_CALL:
1776 return LowerPATCHABLE_TYPED_EVENT_CALL(*MI, MCInstLowering);
1778 case X86::MORESTACK_RET:
1782 case X86::MORESTACK_RET_RESTORE_R10:
1785 EmitAndCountInstruction(
1786 MCInstBuilder(X86::MOV64rr).addReg(X86::R10).addReg(X86::RAX));
1789 case X86::SEH_PushReg:
1790 case X86::SEH_SaveReg:
1791 case X86::SEH_SaveXMM:
1792 case X86::SEH_StackAlloc:
1793 case X86::SEH_StackAlign:
1794 case X86::SEH_SetFrame:
1795 case X86::SEH_PushFrame:
1796 case X86::SEH_EndPrologue:
1797 EmitSEHInstruction(MI);
1800 case X86::SEH_Epilogue: {
1809 if (!MBBI->isPseudo()) {
1822 case X86::VPSHUFBrm:
1823 case X86::VPSHUFBYrm:
1824 case X86::VPSHUFBZ128rm:
1825 case X86::VPSHUFBZ128rmk:
1826 case X86::VPSHUFBZ128rmkz:
1827 case X86::VPSHUFBZ256rm:
1828 case X86::VPSHUFBZ256rmk:
1829 case X86::VPSHUFBZ256rmkz:
1830 case X86::VPSHUFBZrm:
1831 case X86::VPSHUFBZrmk:
1832 case X86::VPSHUFBZrmkz: {
1835 unsigned SrcIdx, MaskIdx;
1839 case X86::VPSHUFBrm:
1840 case X86::VPSHUFBYrm:
1841 case X86::VPSHUFBZ128rm:
1842 case X86::VPSHUFBZ256rm:
1843 case X86::VPSHUFBZrm:
1844 SrcIdx = 1; MaskIdx = 5;
break;
1845 case X86::VPSHUFBZ128rmkz:
1846 case X86::VPSHUFBZ256rmkz:
1847 case X86::VPSHUFBZrmkz:
1848 SrcIdx = 2; MaskIdx = 6;
break;
1849 case X86::VPSHUFBZ128rmk:
1850 case X86::VPSHUFBZ256rmk:
1851 case X86::VPSHUFBZrmk:
1852 SrcIdx = 3; MaskIdx = 7;
break;
1856 "We should always have at least 6 operands!");
1870 case X86::VPERMILPSrm:
1871 case X86::VPERMILPSYrm:
1872 case X86::VPERMILPSZ128rm:
1873 case X86::VPERMILPSZ128rmk:
1874 case X86::VPERMILPSZ128rmkz:
1875 case X86::VPERMILPSZ256rm:
1876 case X86::VPERMILPSZ256rmk:
1877 case X86::VPERMILPSZ256rmkz:
1878 case X86::VPERMILPSZrm:
1879 case X86::VPERMILPSZrmk:
1880 case X86::VPERMILPSZrmkz:
1881 case X86::VPERMILPDrm:
1882 case X86::VPERMILPDYrm:
1883 case X86::VPERMILPDZ128rm:
1884 case X86::VPERMILPDZ128rmk:
1885 case X86::VPERMILPDZ128rmkz:
1886 case X86::VPERMILPDZ256rm:
1887 case X86::VPERMILPDZ256rmk:
1888 case X86::VPERMILPDZ256rmkz:
1889 case X86::VPERMILPDZrm:
1890 case X86::VPERMILPDZrmk:
1891 case X86::VPERMILPDZrmkz: {
1894 unsigned SrcIdx, MaskIdx;
1898 case X86::VPERMILPSrm:
1899 case X86::VPERMILPSYrm:
1900 case X86::VPERMILPSZ128rm:
1901 case X86::VPERMILPSZ256rm:
1902 case X86::VPERMILPSZrm:
1903 SrcIdx = 1; MaskIdx = 5; ElSize = 32;
break;
1904 case X86::VPERMILPSZ128rmkz:
1905 case X86::VPERMILPSZ256rmkz:
1906 case X86::VPERMILPSZrmkz:
1907 SrcIdx = 2; MaskIdx = 6; ElSize = 32;
break;
1908 case X86::VPERMILPSZ128rmk:
1909 case X86::VPERMILPSZ256rmk:
1910 case X86::VPERMILPSZrmk:
1911 SrcIdx = 3; MaskIdx = 7; ElSize = 32;
break;
1912 case X86::VPERMILPDrm:
1913 case X86::VPERMILPDYrm:
1914 case X86::VPERMILPDZ128rm:
1915 case X86::VPERMILPDZ256rm:
1916 case X86::VPERMILPDZrm:
1917 SrcIdx = 1; MaskIdx = 5; ElSize = 64;
break;
1918 case X86::VPERMILPDZ128rmkz:
1919 case X86::VPERMILPDZ256rmkz:
1920 case X86::VPERMILPDZrmkz:
1921 SrcIdx = 2; MaskIdx = 6; ElSize = 64;
break;
1922 case X86::VPERMILPDZ128rmk:
1923 case X86::VPERMILPDZ256rmk:
1924 case X86::VPERMILPDZrmk:
1925 SrcIdx = 3; MaskIdx = 7; ElSize = 64;
break;
1929 "We should always have at least 6 operands!");
1943 case X86::VPERMIL2PDrm:
1944 case X86::VPERMIL2PSrm:
1945 case X86::VPERMIL2PDYrm:
1946 case X86::VPERMIL2PSYrm: {
1950 "We should always have at least 8 operands!");
1953 if (!CtrlOp.isImm())
1959 case X86::VPERMIL2PSrm:
case X86::VPERMIL2PSYrm: ElSize = 32;
break;
1960 case X86::VPERMIL2PDrm:
case X86::VPERMIL2PDYrm: ElSize = 64;
break;
1975 case X86::VPPERMrrm: {
1979 "We should always have at least 7 operands!");
1993 case X86::MMX_MOVQ64rm: {
1999 std::string Comment;
2003 if (
auto *CF = dyn_cast<ConstantFP>(
C)) {
2004 CS <<
"0x" << CF->getValueAPF().bitcastToAPInt().toString(16,
false);
2011 #define MOV_CASE(Prefix, Suffix) \ 2012 case X86::Prefix##MOVAPD##Suffix##rm: \ 2013 case X86::Prefix##MOVAPS##Suffix##rm: \ 2014 case X86::Prefix##MOVUPD##Suffix##rm: \ 2015 case X86::Prefix##MOVUPS##Suffix##rm: \ 2016 case X86::Prefix##MOVDQA##Suffix##rm: \ 2017 case X86::Prefix##MOVDQU##Suffix##rm: 2019 #define MOV_AVX512_CASE(Suffix) \ 2020 case X86::VMOVDQA64##Suffix##rm: \ 2021 case X86::VMOVDQA32##Suffix##rm: \ 2022 case X86::VMOVDQU64##Suffix##rm: \ 2023 case X86::VMOVDQU32##Suffix##rm: \ 2024 case X86::VMOVDQU16##Suffix##rm: \ 2025 case X86::VMOVDQU8##Suffix##rm: \ 2026 case X86::VMOVAPS##Suffix##rm: \ 2027 case X86::VMOVAPD##Suffix##rm: \ 2028 case X86::VMOVUPS##Suffix##rm: \ 2029 case X86::VMOVUPD##Suffix##rm: 2031 #define CASE_ALL_MOV_RM() \ 2035 MOV_AVX512_CASE(Z) \ 2036 MOV_AVX512_CASE(Z256) \ 2037 MOV_AVX512_CASE(Z128) 2042 case X86::VBROADCASTF128:
2043 case X86::VBROADCASTI128:
2044 case X86::VBROADCASTF32X4Z256rm:
2045 case X86::VBROADCASTF32X4rm:
2046 case X86::VBROADCASTF32X8rm:
2047 case X86::VBROADCASTF64X2Z128rm:
2048 case X86::VBROADCASTF64X2rm:
2049 case X86::VBROADCASTF64X4rm:
2050 case X86::VBROADCASTI32X4Z256rm:
2051 case X86::VBROADCASTI32X4rm:
2052 case X86::VBROADCASTI32X8rm:
2053 case X86::VBROADCASTI64X2Z128rm:
2054 case X86::VBROADCASTI64X2rm:
2055 case X86::VBROADCASTI64X4rm:
2064 case X86::VBROADCASTF128: NumLanes = 2;
break;
2065 case X86::VBROADCASTI128: NumLanes = 2;
break;
2066 case X86::VBROADCASTF32X4Z256rm: NumLanes = 2;
break;
2067 case X86::VBROADCASTF32X4rm: NumLanes = 4;
break;
2068 case X86::VBROADCASTF32X8rm: NumLanes = 2;
break;
2069 case X86::VBROADCASTF64X2Z128rm: NumLanes = 2;
break;
2070 case X86::VBROADCASTF64X2rm: NumLanes = 4;
break;
2071 case X86::VBROADCASTF64X4rm: NumLanes = 2;
break;
2072 case X86::VBROADCASTI32X4Z256rm: NumLanes = 2;
break;
2073 case X86::VBROADCASTI32X4rm: NumLanes = 4;
break;
2074 case X86::VBROADCASTI32X8rm: NumLanes = 2;
break;
2075 case X86::VBROADCASTI64X2Z128rm: NumLanes = 2;
break;
2076 case X86::VBROADCASTI64X2rm: NumLanes = 4;
break;
2077 case X86::VBROADCASTI64X4rm: NumLanes = 2;
break;
2080 std::string Comment;
2084 if (
auto *CDS = dyn_cast<ConstantDataSequential>(
C)) {
2086 for (
int l = 0; l != NumLanes; ++l) {
2087 for (
int i = 0, NumElements = CDS->getNumElements(); i < NumElements;
2089 if (i != 0 || l != 0)
2091 if (CDS->getElementType()->isIntegerTy())
2093 else if (CDS->getElementType()->isHalfTy() ||
2094 CDS->getElementType()->isFloatTy() ||
2095 CDS->getElementType()->isDoubleTy())
2103 }
else if (
auto *CV = dyn_cast<ConstantVector>(
C)) {
2105 for (
int l = 0; l != NumLanes; ++l) {
2106 for (
int i = 0, NumOperands = CV->getNumOperands(); i < NumOperands;
2108 if (i != 0 || l != 0)
2118 case X86::MOVDDUPrm:
2119 case X86::VMOVDDUPrm:
2120 case X86::VMOVDDUPZ128rm:
2121 case X86::VBROADCASTSSrm:
2122 case X86::VBROADCASTSSYrm:
2123 case X86::VBROADCASTSSZ128m:
2124 case X86::VBROADCASTSSZ256m:
2125 case X86::VBROADCASTSSZm:
2126 case X86::VBROADCASTSDYrm:
2127 case X86::VBROADCASTSDZ256m:
2128 case X86::VBROADCASTSDZm:
2129 case X86::VPBROADCASTBrm:
2130 case X86::VPBROADCASTBYrm:
2131 case X86::VPBROADCASTBZ128m:
2132 case X86::VPBROADCASTBZ256m:
2133 case X86::VPBROADCASTBZm:
2134 case X86::VPBROADCASTDrm:
2135 case X86::VPBROADCASTDYrm:
2136 case X86::VPBROADCASTDZ128m:
2137 case X86::VPBROADCASTDZ256m:
2138 case X86::VPBROADCASTDZm:
2139 case X86::VPBROADCASTQrm:
2140 case X86::VPBROADCASTQYrm:
2141 case X86::VPBROADCASTQZ128m:
2142 case X86::VPBROADCASTQZ256m:
2143 case X86::VPBROADCASTQZm:
2144 case X86::VPBROADCASTWrm:
2145 case X86::VPBROADCASTWYrm:
2146 case X86::VPBROADCASTWZ128m:
2147 case X86::VPBROADCASTWZ256m:
2148 case X86::VPBROADCASTWZm:
2157 case X86::MOVDDUPrm: NumElts = 2;
break;
2158 case X86::VMOVDDUPrm: NumElts = 2;
break;
2159 case X86::VMOVDDUPZ128rm: NumElts = 2;
break;
2160 case X86::VBROADCASTSSrm: NumElts = 4;
break;
2161 case X86::VBROADCASTSSYrm: NumElts = 8;
break;
2162 case X86::VBROADCASTSSZ128m: NumElts = 4;
break;
2163 case X86::VBROADCASTSSZ256m: NumElts = 8;
break;
2164 case X86::VBROADCASTSSZm: NumElts = 16;
break;
2165 case X86::VBROADCASTSDYrm: NumElts = 4;
break;
2166 case X86::VBROADCASTSDZ256m: NumElts = 4;
break;
2167 case X86::VBROADCASTSDZm: NumElts = 8;
break;
2168 case X86::VPBROADCASTBrm: NumElts = 16;
break;
2169 case X86::VPBROADCASTBYrm: NumElts = 32;
break;
2170 case X86::VPBROADCASTBZ128m: NumElts = 16;
break;
2171 case X86::VPBROADCASTBZ256m: NumElts = 32;
break;
2172 case X86::VPBROADCASTBZm: NumElts = 64;
break;
2173 case X86::VPBROADCASTDrm: NumElts = 4;
break;
2174 case X86::VPBROADCASTDYrm: NumElts = 8;
break;
2175 case X86::VPBROADCASTDZ128m: NumElts = 4;
break;
2176 case X86::VPBROADCASTDZ256m: NumElts = 8;
break;
2177 case X86::VPBROADCASTDZm: NumElts = 16;
break;
2178 case X86::VPBROADCASTQrm: NumElts = 2;
break;
2179 case X86::VPBROADCASTQYrm: NumElts = 4;
break;
2180 case X86::VPBROADCASTQZ128m: NumElts = 2;
break;
2181 case X86::VPBROADCASTQZ256m: NumElts = 4;
break;
2182 case X86::VPBROADCASTQZm: NumElts = 8;
break;
2183 case X86::VPBROADCASTWrm: NumElts = 8;
break;
2184 case X86::VPBROADCASTWYrm: NumElts = 16;
break;
2185 case X86::VPBROADCASTWZ128m: NumElts = 8;
break;
2186 case X86::VPBROADCASTWZ256m: NumElts = 16;
break;
2187 case X86::VPBROADCASTWZm: NumElts = 32;
break;
2190 std::string Comment;
2195 for (
int i = 0; i != NumElts; ++i) {
2206 MCInstLowering.Lower(MI, TmpInst);
2225 EmitAndCountInstruction(TmpInst);
unsigned getTargetFlags() const
MO_SECREL - On a symbol operand this indicates that the immediate is the offset from beginning of sec...
unsigned GetCondBranchFromCond(CondCode CC)
bool is64Bit() const
Is this x86_64? (disregarding specific ABI / programming model)
A parsed version of the target data layout string in and methods for querying it. ...
mop_iterator operands_end()
raw_ostream & errs()
This returns a reference to a raw_ostream for standard error.
unsigned getNextScratchIdx(unsigned StartIdx=0) const
Get the next scratch register operand index.
static const char * getRegisterName(unsigned RegNo)
uint64_t getZExtValue() const
Get zero extended value.
virtual void EmitWinCFIPushReg(unsigned Register, SMLoc Loc=SMLoc())
MO_COFFSTUB - On a symbol operand "FOO", this indicates that the reference is actually to the "...
virtual bool emitFPOSetFrame(unsigned Reg, SMLoc L={})=0
bool isCall(QueryType Type=AnyInBundle) const
MachineBasicBlock * getMBB() const
std::unique_ptr< MCStreamer > OutStreamer
This is the MCStreamer object for the file we are generating.
static const MCSymbolRefExpr * create(const MCSymbol *Symbol, MCContext &Ctx)
MCTargetOptions MCOptions
Machine level options.
LLVM_ATTRIBUTE_NORETURN void report_fatal_error(Error Err, bool gen_crash_diag=true)
Report a serious error, calling any installed error handler.
This class represents lattice values for constants.
PointerTy getPointer() const
static MachineOperand CreateMCSymbol(MCSymbol *Sym, unsigned char TargetFlags=0)
void setTargetFlags(unsigned F)
StringRef getPrivateGlobalPrefix() const
MCSymbol - Instances of this class represent a symbol name in the MC file, and MCSymbols are created ...
void DecodeVPPERMMask(ArrayRef< uint64_t > RawMask, const APInt &UndefElts, SmallVectorImpl< int > &ShuffleMask)
Decode a VPPERM mask from a raw array of constants such as from BUILD_VECTOR.
MO_TLSLD - On a symbol operand this indicates that the immediate is the offset of the GOT entry with ...
MO_TLVP_PIC_BASE - On a symbol operand this indicates that the immediate is some TLS offset from the ...
MCContext & OutContext
This is the context for the output file that we are streaming.
static MachineModuleInfoMachO & getMachOMMI(AsmPrinter &AP)
static MCOperand createExpr(const MCExpr *Val)
unsigned getNumWords() const
Get the number of words.
bool EnablePrintSchedInfo
Enable print [latency:throughput] in output.
const MCSubtargetInfo & getSubtargetInfo() const
Return information about subtarget.
virtual void EmitWinCFISaveXMM(unsigned Register, unsigned Offset, SMLoc Loc=SMLoc())
This provides a very simple, boring adaptor for a begin and end iterator into a range type...
unsigned getReg() const
getReg - Returns the register number.
virtual void EmitBytes(StringRef Data)
Emit the bytes in Data into the output.
Address of indexed Jump Table for switch.
This class represents a function call, abstracting a target machine's calling convention.
AddrNumOperands - Total number of operands in a memory reference.
PointerIntPair< MCSymbol *, 1, bool > StubValueTy
static std::string getShuffleComment(const MachineInstr *MI, unsigned SrcOp1Idx, unsigned SrcOp2Idx, ArrayRef< int > Mask)
A raw_ostream that writes to an SmallVector or SmallString.
MachineBasicBlock reference.
MachineFunction * MF
The current machine function.
bool isCPI() const
isCPI - Tests if this is a MO_ConstantPoolIndex operand.
MachineInstrBundleIterator< const MachineInstr > const_iterator
MO_GOTPCREL - On a symbol operand this indicates that the immediate is offset to the GOT entry for th...
MO_DTPOFF - On a symbol operand this indicates that the immediate is the offset of the GOT entry with...
static void EmitNops(MCStreamer &OS, unsigned NumBytes, bool Is64Bit, const MCSubtargetInfo &STI)
Emit the optimal amount of multi-byte nops on X86.
virtual bool emitFPOPushReg(unsigned Reg, SMLoc L={})=0
iterator_range< mop_iterator > operands()
print alias Alias Set Printer
bool isImm() const
isImm - Tests if this is a MO_Immediate operand.
unsigned getSlotSize() const
virtual void EmitInstruction(const MCInst &Inst, const MCSubtargetInfo &STI, bool PrintSchedInfo=false)
Emit the given Instruction into the current section.
unsigned getBitWidth() const
Return the number of bits in the APInt.
Mask of preserved registers.
static MCDisassembler::DecodeStatus addOperand(MCInst &Inst, const MCOperand &Opnd)
MCContext & getContext() const
void recordSled(MCSymbol *Sled, const MachineInstr &MI, SledKind Kind, uint8_t Version=0)
CLEANUPRET - Represents a return from a cleanup block funclet.
MO_DARWIN_NONLAZY_PIC_BASE - On a symbol operand "FOO", this indicates that the reference is actually...
amdgpu Simplify well known AMD library false Value Value const Twine & Name
bool isMachineConstantPoolEntry() const
isMachineConstantPoolEntry - Return true if the MachineConstantPoolEntry is indeed a target specific ...
static MCOperand createReg(unsigned Reg)
This file declares the MachineConstantPool class which is an abstract constant pool to keep track of ...
virtual bool emitFPOStackAlloc(unsigned StackAlloc, SMLoc L={})=0
MachineModuleInfoCOFF - This is a MachineModuleInfoImpl implementation for COFF targets.
unsigned getNumOperands() const
Retuns the total number of operands.
void DecodeVPERMILPMask(unsigned NumElts, unsigned ScalarBits, ArrayRef< uint64_t > RawMask, const APInt &UndefElts, SmallVectorImpl< int > &ShuffleMask)
Decode a VPERMILPD/VPERMILPS variable mask from a raw array of constants.
virtual void encodeInstruction(const MCInst &Inst, raw_ostream &OS, SmallVectorImpl< MCFixup > &Fixups, const MCSubtargetInfo &STI) const =0
EncodeInstruction - Encode the given Inst to bytes on the output stream OS.
Base class for the full range of assembler expressions which are needed for parsing.
Name of external global symbol.
Represent a reference to a symbol from inside an expression.
unsigned getOpcode() const
Returns the opcode of this MachineInstr.
const char * getSymbolName() const
#define CASE_ALL_MOV_RM()
unsigned getReg() const
Returns the register number.
Context object for machine code objects.
void recordFaultingOp(FaultKind FaultTy, const MCSymbol *HandlerLabel)
virtual void AddComment(const Twine &T, bool EOL=true)
Add a textual comment.
bool hasFP(const MachineFunction &MF) const override
hasFP - Return true if the specified function should have a dedicated frame pointer register...
const MCInstrDesc & getDesc() const
Returns the target instruction descriptor of this MachineInstr.
Type * getType() const
All values are typed, get the type of this value.
static const MCBinaryExpr * createSub(const MCExpr *LHS, const MCExpr *RHS, MCContext &Ctx)
void toString(SmallVectorImpl< char > &Str, unsigned FormatPrecision=0, unsigned FormatMaxPadding=3, bool TruncateZero=true) const
bool isPositionIndependent() const
MO_GOT - On a symbol operand this indicates that the immediate is the offset to the GOT entry for the...
MO_GOTTPOFF - On a symbol operand this indicates that the immediate is the offset of the GOT entry wi...
MO_ABS8 - On a symbol operand this indicates that the symbol is known to be an absolute symbol in ran...
LLVM_NODISCARD LLVM_ATTRIBUTE_ALWAYS_INLINE bool empty() const
empty - Check if the string is empty.
ArrayRef - Represent a constant reference to an array (0 or more elements consecutively in memory)...
virtual void emitRawComment(const Twine &T, bool TabPrefix=true)
Print T and prefix it with the comment string (normally #) and optionally a tab.
This class is a data container for one entry in a MachineConstantPool.
virtual void EmitBinaryData(StringRef Data)
Functionally identical to EmitBytes.
const MCExpr * getExpr() const
static const MCBinaryExpr * createAdd(const MCExpr *LHS, const MCExpr *RHS, MCContext &Ctx)
MO_DARWIN_NONLAZY - On a symbol operand "FOO", this indicates that the reference is actually to the "...
void recordStatepoint(const MachineInstr &MI)
Generate a stackmap record for a statepoint instruction.
Analysis containing CSE Info
Instances of this class represent a single low-level machine instruction.
auto count(R &&Range, const E &Element) -> typename std::iterator_traits< decltype(adl_begin(Range))>::difference_type
Wrapper function around std::count to count the number of times an element Element occurs in the give...
virtual bool emitFPOStackAlign(unsigned Align, SMLoc L={})=0
bool isX86_64ExtendedReg(unsigned RegNo)
isX86_64ExtendedReg - Is the MachineOperand a x86-64 extended (r8 or higher) register? e.g.
const Constant * ConstVal
This class is intended to be used as a base class for asm properties and features specific to the tar...
Address of a global value.
Streaming machine code generation interface.
MCSymbol * createTempSymbol(bool CanBeUnnamed=true)
Create and return a new assembler temporary symbol with a unique but unspecified name.
MCTargetStreamer * getTargetStreamer()
bool getAsmPrinterFlag(CommentFlag Flag) const
Return whether an AsmPrinter flag is set.
MO_GOT_ABSOLUTE_ADDRESS - On a symbol operand, this represents a relocation of: SYMBOL_LABEL + [...
PointerIntPair - This class implements a pair of a pointer and small integer.
const TargetSubtargetInfo & getSubtarget() const
getSubtarget - Return the subtarget for which this machine code is being compiled.
MO_GOTNTPOFF - On a symbol operand this indicates that the immediate is the offset of the GOT entry w...
MO_TLVP - On a symbol operand this indicates that the immediate is some TLS offset.
static GCRegistry::Add< CoreCLRGC > E("coreclr", "CoreCLR-compatible GC")
This is an important base class in LLVM.
unsigned getFlags() const
const GlobalValue * getGlobal() const
MO_TLSLDM - On a symbol operand this indicates that the immediate is the offset of the GOT entry with...
MCCodeEmitter - Generic instruction encoding interface.
TargetMachine & TM
Target machine description.
This class is intended to be used as a driving class for all asm writers.
void getNameWithPrefix(SmallVectorImpl< char > &Name, const GlobalValue *GV) const
bool hasInternalLinkage() const
Address of a basic block.
static void SimplifyShortMoveForm(X86AsmPrinter &Printer, MCInst &Inst, unsigned Opcode)
Simplify things like MOV32rm to MOV32o32a.
MO_NTPOFF - On a symbol operand this indicates that the immediate is the negative thread-pointer offs...
MI-level patchpoint operands.
unsigned getNumOperands() const
int getSEHRegNum(unsigned i) const
void print(raw_ostream &OS, bool IsStandalone=true, bool SkipOpers=false, bool SkipDebugLoc=false, bool AddNewLine=true, const TargetInstrInfo *TII=nullptr) const
Print this MI to OS.
MachineConstantPool * getConstantPool()
getConstantPool - Return the constant pool object for the current function.
static const Constant * getConstantFromPool(const MachineInstr &MI, const MachineOperand &Op)
const MachineBasicBlock & front() const
bool useRetpolineIndirectCalls() const
virtual MCSymbol * GetCPISymbol(unsigned CPID) const
Return the symbol for the specified constant pool entry.
StubValueTy & getGVStubEntry(MCSymbol *Sym)
void DecodeVPERMIL2PMask(unsigned NumElts, unsigned ScalarBits, unsigned M2Z, ArrayRef< uint64_t > RawMask, const APInt &UndefElts, SmallVectorImpl< int > &ShuffleMask)
Decode a VPERMIL2PD/VPERMIL2PS variable mask from a raw array of constants.
virtual void EmitWinCFISetFrame(unsigned Register, unsigned Offset, SMLoc Loc=SMLoc())
std::string & str()
Flushes the stream contents to the target string and returns the string's reference.
#define llvm_unreachable(msg)
Marks that the current location is not supposed to be reachable.
void recordPatchPoint(const MachineInstr &MI)
Generate a stackmap record for a patchpoint instruction.
MO_TLSGD - On a symbol operand this indicates that the immediate is the offset of the GOT entry with ...
const std::vector< MachineConstantPoolEntry > & getConstants() const
virtual void EmitWinCFIPushFrame(bool Code, SMLoc Loc=SMLoc())
MO_TPOFF - On a symbol operand this indicates that the immediate is the thread-pointer offset for the...
static void printConstant(const APInt &Val, raw_ostream &CS)
iterator_range< T > make_range(T x, T y)
Convenience function for iterating over sub-ranges.
void setFlags(unsigned F)
void setOpcode(unsigned Op)
MCSymbol * GetBlockAddressSymbol(const BlockAddress *BA) const
Return the MCSymbol used to satisfy BlockAddress uses of the specified basic block.
bool isJTI() const
isJTI - Tests if this is a MO_JumpTableIndex operand.
bool isGlobal() const
isGlobal - Tests if this is a MO_GlobalAddress operand.
static MCOperand LowerSymbolOperand(const MachineInstr *MI, const MachineOperand &MO, AsmPrinter &AP)
MCSymbol * getSymbol(const GlobalValue *GV) const
MachineOperand class - Representation of each machine instruction operand.
This is a 'vector' (really, a variable-sized array), optimized for the case when the array is small...
virtual void EmitWinCFIEndProlog(SMLoc Loc=SMLoc())
virtual void EmitCodeAlignment(unsigned ByteAlignment, unsigned MaxBytesToEmit=0)
Emit nops until the byte alignment ByteAlignment is reached.
const MCOperand & getOperand(unsigned i) const
virtual void EmitWinCFIAllocStack(unsigned Size, SMLoc Loc=SMLoc())
X86 target streamer implementing x86-only assembly directives.
MCSymbol reference (for debug/eh info)
StubValueTy & getGVStubEntry(MCSymbol *Sym)
Target - Wrapper for Target specific information.
Class for arbitrary precision integers.
union llvm::MachineConstantPoolEntry::@159 Val
The constant itself.
void recordStackMap(const MachineInstr &MI)
Generate a stackmap record for a stackmap instruction.
virtual bool emitFPOEndPrologue(SMLoc L={})=0
CATCHRET - Represents a return from a catch block funclet.
const MachineBasicBlock * getParent() const
const uint64_t * getRawData() const
This function returns a pointer to the internal storage of the APInt.
Representation of each machine instruction.
const MachineFunction * getParent() const
Return the MachineFunction containing this basic block.
MO_GOTOFF - On a symbol operand this indicates that the immediate is the offset to the location of th...
static unsigned getRetOpcode(const X86Subtarget &Subtarget)
unsigned getNumFrameInfos()
MCSymbol * GetJTISymbol(unsigned JTID, bool isLinkerPrivate=false) const
Return the symbol for the specified jump table entry.
MO_INDNTPOFF - On a symbol operand this indicates that the immediate is the absolute address of the G...
virtual void EmitWinCFISaveReg(unsigned Register, unsigned Offset, SMLoc Loc=SMLoc())
MCSymbol * getOrCreateSymbol(const Twine &Name)
Lookup the symbol inside with the specified Name.
int16_t RegClass
This specifies the register class enumeration of the operand if the operand is a register.
int64_t getOffset() const
Return the offset from the symbol in this operand.
const BlockAddress * getBlockAddress() const
MCSymbol * getSymbol() const
Return the MCSymbol for this basic block.
Generic base class for all target subtargets.
MI-level Statepoint operands.
uint32_t getNumPatchBytes() const
Return the number of patchable bytes the given patchpoint should emit.
void EmitInstruction(const MachineInstr *MI) override
Targets should implement this to emit instructions.
bool isSymbol() const
isSymbol - Tests if this is a MO_ExternalSymbol operand.
MachineModuleInfoMachO - This is a MachineModuleInfoImpl implementation for MachO targets...
bool isReg() const
isReg - Tests if this is a MO_Register operand.
OUTCHAIN = EH_RETURN(INCHAIN, OFFSET, HANDLER) - This node represents 'eh_return' gcc dwarf builtin...
MO_PLT - On a symbol operand this indicates that the immediate is offset to the PLT entry of symbol n...
assert(ImpDefSCC.getReg()==AMDGPU::SCC &&ImpDefSCC.isDef())
A raw_ostream that writes to an std::string.
MCSymbol * getMCSymbol() const
mop_iterator operands_begin()
ArrayRef< MCDwarfFrameInfo > getDwarfFrameInfos() const
MCSymbol * getPICBaseSymbol() const
getPICBaseSymbol - Return a function-local symbol to represent the PIC base.
const MCOperandInfo * OpInfo
std::underlying_type< E >::type Mask()
Get a bitmask with 1s in all places up to the high-order bit of E's largest value.
virtual void EmitLabel(MCSymbol *Symbol, SMLoc Loc=SMLoc())
Emit a label for Symbol into the current section.
This class implements an extremely fast bulk output stream that can only output to a stream...
Primary interface to the complete machine description for the target machine.
MO_PIC_BASE_OFFSET - On a symbol operand this indicates that the immediate should get the value of th...
void getNameWithPrefix(raw_ostream &OS, const GlobalValue *GV, bool CannotUsePrivateLabel) const
Print the appropriate prefix and the specified global variable's name.
static MachineBasicBlock::const_iterator PrevCrossBBInst(MachineBasicBlock::const_iterator MBBI)
const MachineOperand & getCallTarget() const
Returns the target of the underlying call.
void addOperand(const MCOperand &Op)
StringRef - Represent a constant reference to a string, i.e.
bool isMBB() const
isMBB - Tests if this is a MO_MachineBasicBlock operand.
Address of indexed Constant in Constant Pool.
AddrSegmentReg - The operand # of the segment in the memory operand.
static MCSymbol * GetSymbolFromOperand(const MachineOperand &MO, AsmPrinter &AP)
This holds information about one operand of a machine instruction, indicating the register class for ...
unsigned getOpcode() const
virtual bool isVerboseAsm() const
Return true if this streamer supports verbose assembly and if it is enabled.
const MachineOperand & getOperand(unsigned i) const
Instances of this class represent operands of the MCInst class.
MachineOperandType getType() const
getType - Returns the MachineOperandType for this operand.
static MCOperand createImm(int64_t Val)
static unsigned EmitNop(MCStreamer &OS, unsigned NumBytes, bool Is64Bit, const MCSubtargetInfo &STI)
Emit the largest nop instruction smaller than or equal to NumBytes bytes.
const X86Subtarget & getSubtarget() const
static void SimplifyShortImmForm(MCInst &Inst, unsigned Opcode)
Simplify FOO $imm, %{al,ax,eax,rax} to FOO $imm, for instruction with a short fixed-register form...
static const MCConstantExpr * create(int64_t Value, MCContext &Ctx)
virtual void EmitCFIAdjustCfaOffset(int64_t Adjustment)
static void SimplifyMOVSX(MCInst &Inst)
If a movsx instruction has a shorter encoding for the used register simplify the instruction to use i...
uint8_t getAsmPrinterFlags() const
Return the asm printer flags bitvector.
MO_DLLIMPORT - On a symbol operand "FOO", this indicates that the reference is actually to the "__imp...
void DecodePSHUFBMask(ArrayRef< uint64_t > RawMask, const APInt &UndefElts, SmallVectorImpl< int > &ShuffleMask)
Decode a PSHUFB mask from a raw array of constants such as from BUILD_VECTOR.
static unsigned getRegisterWidth(const MCOperandInfo &Info)