15#ifndef LLVM_CODEGEN_GLOBALISEL_GIMATCHTABLEEXECUTORIMPL_H
16#define LLVM_CODEGEN_GLOBALISEL_GIMATCHTABLEEXECUTORIMPL_H
44template <
class TgtExecutor,
class PredicateBitset,
class ComplexMatcherMemFn,
45 class CustomRendererFn>
53 const PredicateBitset &AvailableFeatures,
62 bool NoFPException = !State.
MIs[0]->getDesc().mayRaiseFPException();
66 enum RejectAction { RejectAndGiveUp, RejectAndResume };
67 auto handleReject = [&]() -> RejectAction {
69 dbgs() << CurrentIdx <<
": Rejected\n");
70 if (OnFailResumeAt.
empty())
71 return RejectAndGiveUp;
74 dbgs() << CurrentIdx <<
": Resume at " << CurrentIdx <<
" ("
75 << OnFailResumeAt.
size() <<
" try-blocks remain)\n");
76 return RejectAndResume;
79 const auto propagateFlags = [&]() {
80 for (
auto MIB : OutMIs) {
84 if (NoFPException && MIB->mayRaiseFPException())
88 MIB.setMIFlags(MIBFlags);
96 const auto getTypeFromIdx = [&](int64_t
Idx) ->
LLT {
102 const auto readULEB = [&]() {
111 const auto readS8 = [&]() {
return (int8_t)MatchTable[CurrentIdx++]; };
113 const auto readU16 = [&]() {
114 auto V = readBytesAs<uint16_t>(MatchTable + CurrentIdx);
119 const auto readU32 = [&]() {
120 auto V = readBytesAs<uint32_t>(MatchTable + CurrentIdx);
125 const auto readU64 = [&]() {
126 auto V = readBytesAs<uint64_t>(MatchTable + CurrentIdx);
138 MI->eraseFromParent();
142 assert(CurrentIdx != ~0u &&
"Invalid MatchTable index");
143 uint8_t MatcherOpcode = MatchTable[CurrentIdx++];
144 switch (MatcherOpcode) {
147 dbgs() << CurrentIdx <<
": Begin try-block\n");
160 assert(NewInsnID != 0 &&
"Refusing to modify MIs[0]");
165 dbgs() << CurrentIdx <<
": Not a register\n");
166 if (handleReject() == RejectAndGiveUp)
172 dbgs() << CurrentIdx <<
": Is a physical register\n");
173 if (handleReject() == RejectAndGiveUp)
184 if ((
size_t)NewInsnID < State.
MIs.
size())
185 State.
MIs[NewInsnID] = NewMI;
188 "Expected to store MIs in order");
192 dbgs() << CurrentIdx <<
": MIs[" << NewInsnID
193 <<
"] = GIM_RecordInsn(" << InsnID <<
", " << OpIdx
199 uint16_t ExpectedBitsetID = readU16();
202 <<
": GIM_CheckFeatures(ExpectedBitsetID="
203 << ExpectedBitsetID <<
")\n");
204 if ((AvailableFeatures & ExecInfo.
FeatureBitsets[ExpectedBitsetID]) !=
206 if (handleReject() == RejectAndGiveUp)
217 Expected1 = readU16();
219 assert(State.
MIs[InsnID] !=
nullptr &&
"Used insn before defined");
220 unsigned Opcode = State.
MIs[InsnID]->getOpcode();
223 dbgs() << CurrentIdx <<
": GIM_CheckOpcode(MIs[" << InsnID
224 <<
"], ExpectedOpcode=" << Expected0;
226 dbgs() <<
" || " << Expected1;
227 dbgs() <<
") // Got=" << Opcode <<
"\n";
230 if (Opcode != Expected0 && Opcode != Expected1) {
231 if (handleReject() == RejectAndGiveUp)
242 assert(State.
MIs[InsnID] !=
nullptr &&
"Used insn before defined");
243 const int64_t Opcode = State.
MIs[InsnID]->getOpcode();
246 dbgs() << CurrentIdx <<
": GIM_SwitchOpcode(MIs[" << InsnID <<
"], ["
247 << LowerBound <<
", " << UpperBound <<
"), Default=" <<
Default
248 <<
", JumpTable...) // Got=" << Opcode <<
"\n";
250 if (Opcode < LowerBound || UpperBound <= Opcode) {
254 const auto EntryIdx = (Opcode - LowerBound);
257 readBytesAs<uint32_t>(MatchTable + CurrentIdx + (EntryIdx * 4));
273 assert(State.
MIs[InsnID] !=
nullptr &&
"Used insn before defined");
277 dbgs() << CurrentIdx <<
": GIM_SwitchType(MIs[" << InsnID
278 <<
"]->getOperand(" << OpIdx <<
"), [" << LowerBound <<
", "
279 << UpperBound <<
"), Default=" <<
Default
280 <<
", JumpTable...) // Got=";
282 dbgs() <<
"Not a VReg\n";
291 const auto TyI = ExecInfo.
TypeIDMap.find(Ty);
296 const int64_t
TypeID = TyI->second;
301 const auto NumEntry = (
TypeID - LowerBound);
304 readBytesAs<uint32_t>(MatchTable + CurrentIdx + (NumEntry * 4));
319 dbgs() << CurrentIdx <<
": GIM_CheckNumOperands"
320 << (IsLE ?
"LE" :
"GE") <<
"(MIs[" << InsnID
321 <<
"], Expected=" <<
Expected <<
")\n");
322 assert(State.
MIs[InsnID] !=
nullptr &&
"Used insn before defined");
323 const unsigned NumOps = State.
MIs[InsnID]->getNumOperands();
325 if (handleReject() == RejectAndGiveUp)
334 dbgs() << CurrentIdx <<
": GIM_CheckNumOperands(MIs["
335 << InsnID <<
"], Expected=" <<
Expected <<
")\n");
336 assert(State.
MIs[InsnID] !=
nullptr &&
"Used insn before defined");
337 if (State.
MIs[InsnID]->getNumOperands() !=
Expected) {
338 if (handleReject() == RejectAndGiveUp)
350 dbgs() << CurrentIdx <<
": GIM_CheckImmPredicate(MIs["
351 << InsnID <<
"]->getOperand(" << OpIdx
352 <<
"), Predicate=" << Predicate <<
")\n");
353 assert(State.
MIs[InsnID] !=
nullptr &&
"Used insn before defined");
354 assert((State.
MIs[InsnID]->getOperand(OpIdx).isImm() ||
355 State.
MIs[InsnID]->getOperand(OpIdx).isCImm()) &&
356 "Expected immediate operand");
359 if (State.
MIs[InsnID]->getOperand(OpIdx).isCImm())
360 Value = State.
MIs[InsnID]->getOperand(OpIdx).getCImm()->getSExtValue();
361 else if (State.
MIs[InsnID]->getOperand(OpIdx).isImm())
362 Value = State.
MIs[InsnID]->getOperand(OpIdx).getImm();
367 if (handleReject() == RejectAndGiveUp)
376 << CurrentIdx <<
": GIM_CheckAPIntImmPredicate(MIs["
377 << InsnID <<
"], Predicate=" << Predicate <<
")\n");
378 assert(State.
MIs[InsnID] !=
nullptr &&
"Used insn before defined");
379 assert(State.
MIs[InsnID]->getOpcode() == TargetOpcode::G_CONSTANT &&
380 "Expected G_CONSTANT");
382 if (!State.
MIs[InsnID]->getOperand(1).isCImm())
386 State.
MIs[InsnID]->getOperand(1).getCImm()->getValue();
388 if (handleReject() == RejectAndGiveUp)
397 << CurrentIdx <<
": GIM_CheckAPFloatImmPredicate(MIs["
398 << InsnID <<
"], Predicate=" << Predicate <<
")\n");
399 assert(State.
MIs[InsnID] !=
nullptr &&
"Used insn before defined");
400 assert(State.
MIs[InsnID]->getOpcode() == TargetOpcode::G_FCONSTANT &&
401 "Expected G_FCONSTANT");
402 assert(State.
MIs[InsnID]->getOperand(1).isFPImm() &&
403 "Expected FPImm operand");
406 State.
MIs[InsnID]->getOperand(1).getFPImm()->getValueAPF();
409 if (handleReject() == RejectAndGiveUp)
419 <<
": GIM_CheckBuildVectorAll{Zeros|Ones}(MIs["
420 << InsnID <<
"])\n");
421 assert(State.
MIs[InsnID] !=
nullptr &&
"Used insn before defined");
424 assert((
MI->getOpcode() == TargetOpcode::G_BUILD_VECTOR ||
425 MI->getOpcode() == TargetOpcode::G_BUILD_VECTOR_TRUNC) &&
426 "Expected G_BUILD_VECTOR or G_BUILD_VECTOR_TRUNC");
430 if (handleReject() == RejectAndGiveUp)
435 if (handleReject() == RejectAndGiveUp)
449 <<
": GIM_CheckSimplePredicate(Predicate="
450 << Predicate <<
")\n");
453 if (handleReject() == RejectAndGiveUp)
463 << CurrentIdx <<
": GIM_CheckCxxPredicate(MIs["
464 << InsnID <<
"], Predicate=" << Predicate <<
")\n");
465 assert(State.
MIs[InsnID] !=
nullptr &&
"Used insn before defined");
469 if (handleReject() == RejectAndGiveUp)
477 dbgs() << CurrentIdx <<
": GIM_CheckHasNoUse(MIs["
481 assert(
MI &&
"Used insn before defined");
482 assert(
MI->getNumDefs() > 0 &&
"No defs");
483 const Register Res =
MI->getOperand(0).getReg();
485 if (!
MRI.use_nodbg_empty(Res)) {
486 if (handleReject() == RejectAndGiveUp)
495 dbgs() << CurrentIdx <<
": GIM_CheckHasOneUse(MIs["
499 assert(
MI &&
"Used insn before defined");
500 assert(
MI->getNumDefs() > 0 &&
"No defs");
501 const Register Res =
MI->getOperand(0).getReg();
503 if (!
MRI.hasOneNonDBGUse(Res)) {
504 if (handleReject() == RejectAndGiveUp)
513 dbgs() << CurrentIdx <<
": GIM_CheckAtomicOrdering(MIs["
514 << InsnID <<
"], " << (
uint64_t)Ordering <<
")\n");
515 assert(State.
MIs[InsnID] !=
nullptr &&
"Used insn before defined");
516 if (!State.
MIs[InsnID]->hasOneMemOperand())
517 if (handleReject() == RejectAndGiveUp)
520 for (
const auto &MMO : State.
MIs[InsnID]->memoperands())
521 if (MMO->getMergedOrdering() != Ordering)
522 if (handleReject() == RejectAndGiveUp)
531 <<
": GIM_CheckAtomicOrderingOrStrongerThan(MIs["
532 << InsnID <<
"], " << (
uint64_t)Ordering <<
")\n");
533 assert(State.
MIs[InsnID] !=
nullptr &&
"Used insn before defined");
534 if (!State.
MIs[InsnID]->hasOneMemOperand())
535 if (handleReject() == RejectAndGiveUp)
538 for (
const auto &MMO : State.
MIs[InsnID]->memoperands())
540 if (handleReject() == RejectAndGiveUp)
549 <<
": GIM_CheckAtomicOrderingWeakerThan(MIs["
550 << InsnID <<
"], " << (
uint64_t)Ordering <<
")\n");
551 assert(State.
MIs[InsnID] !=
nullptr &&
"Used insn before defined");
552 if (!State.
MIs[InsnID]->hasOneMemOperand())
553 if (handleReject() == RejectAndGiveUp)
556 for (
const auto &MMO : State.
MIs[InsnID]->memoperands())
558 if (handleReject() == RejectAndGiveUp)
566 const uint64_t NumAddrSpace = MatchTable[CurrentIdx++];
568 if (State.
MIs[InsnID]->getNumMemOperands() <= MMOIdx) {
569 if (handleReject() == RejectAndGiveUp)
576 const uint64_t LastIdx = CurrentIdx + NumAddrSpace;
579 *(State.
MIs[InsnID]->memoperands_begin() + MMOIdx);
583 for (
unsigned I = 0;
I != NumAddrSpace; ++
I) {
586 dbgs() <<
"addrspace(" << MMOAddrSpace <<
") vs "
587 << AddrSpace <<
'\n');
589 if (AddrSpace == MMOAddrSpace) {
595 CurrentIdx = LastIdx;
596 if (!
Success && handleReject() == RejectAndGiveUp)
605 assert(State.
MIs[InsnID] !=
nullptr &&
"Used insn before defined");
607 if (State.
MIs[InsnID]->getNumMemOperands() <= MMOIdx) {
608 if (handleReject() == RejectAndGiveUp)
614 *(State.
MIs[InsnID]->memoperands_begin() + MMOIdx);
616 dbgs() << CurrentIdx <<
": GIM_CheckMemoryAlignment"
617 <<
"(MIs[" << InsnID <<
"]->memoperands() + "
618 << MMOIdx <<
")->getAlignment() >= " <<
MinAlign
631 dbgs() << CurrentIdx <<
": GIM_CheckMemorySizeEqual(MIs["
632 << InsnID <<
"]->memoperands() + " << MMOIdx
633 <<
", Size=" <<
Size <<
")\n");
634 assert(State.
MIs[InsnID] !=
nullptr &&
"Used insn before defined");
636 if (State.
MIs[InsnID]->getNumMemOperands() <= MMOIdx) {
637 if (handleReject() == RejectAndGiveUp)
643 *(State.
MIs[InsnID]->memoperands_begin() + MMOIdx);
646 <<
" bytes vs " <<
Size
649 if (handleReject() == RejectAndGiveUp)
662 TgtExecutor::getName(),
663 dbgs() << CurrentIdx <<
": GIM_CheckMemorySize"
668 <<
"LLT(MIs[" << InsnID <<
"]->memoperands() + " << MMOIdx
669 <<
", OpIdx=" << OpIdx <<
")\n");
670 assert(State.
MIs[InsnID] !=
nullptr &&
"Used insn before defined");
675 dbgs() << CurrentIdx <<
": Not a register\n");
676 if (handleReject() == RejectAndGiveUp)
681 if (State.
MIs[InsnID]->getNumMemOperands() <= MMOIdx) {
682 if (handleReject() == RejectAndGiveUp)
688 *(State.
MIs[InsnID]->memoperands_begin() + MMOIdx);
693 if (handleReject() == RejectAndGiveUp)
697 if (handleReject() == RejectAndGiveUp)
701 if (handleReject() == RejectAndGiveUp)
712 dbgs() << CurrentIdx <<
": GIM_CheckType(MIs[" << InsnID
713 <<
"]->getOperand(" << OpIdx
714 <<
"), TypeID=" <<
TypeID <<
")\n");
715 assert(State.
MIs[InsnID] !=
nullptr &&
"Used insn before defined");
718 if (handleReject() == RejectAndGiveUp)
729 dbgs() << CurrentIdx <<
": GIM_CheckPointerToAny(MIs["
730 << InsnID <<
"]->getOperand(" << OpIdx
731 <<
"), SizeInBits=" << SizeInBits <<
")\n");
732 assert(State.
MIs[InsnID] !=
nullptr &&
"Used insn before defined");
737 if (SizeInBits == 0) {
743 assert(SizeInBits != 0 &&
"Pointer size must be known");
747 if (handleReject() == RejectAndGiveUp)
749 }
else if (handleReject() == RejectAndGiveUp)
760 dbgs() << CurrentIdx <<
": GIM_RecordNamedOperand(MIs["
761 << InsnID <<
"]->getOperand(" << OpIdx
762 <<
"), StoreIdx=" << StoreIdx <<
")\n");
763 assert(State.
MIs[InsnID] !=
nullptr &&
"Used insn before defined");
771 int TypeIdx = readS8();
774 dbgs() << CurrentIdx <<
": GIM_RecordRegType(MIs["
775 << InsnID <<
"]->getOperand(" << OpIdx
776 <<
"), TypeIdx=" << TypeIdx <<
")\n");
777 assert(State.
MIs[InsnID] !=
nullptr &&
"Used insn before defined");
778 assert(TypeIdx < 0 &&
"Temp types always have negative indexes!");
780 TypeIdx = 1 - TypeIdx;
781 const auto &
Op = State.
MIs[InsnID]->getOperand(OpIdx);
795 dbgs() << CurrentIdx <<
": GIM_CheckRegBankForClass(MIs["
796 << InsnID <<
"]->getOperand(" << OpIdx
797 <<
"), RCEnum=" << RCEnum <<
")\n");
798 assert(State.
MIs[InsnID] !=
nullptr &&
"Used insn before defined");
804 if (handleReject() == RejectAndGiveUp)
814 uint16_t ComplexPredicateID = readU16();
816 dbgs() << CurrentIdx <<
": State.Renderers[" << RendererID
817 <<
"] = GIM_CheckComplexPattern(MIs[" << InsnID
818 <<
"]->getOperand(" << OpIdx
819 <<
"), ComplexPredicateID=" << ComplexPredicateID
821 assert(State.
MIs[InsnID] !=
nullptr &&
"Used insn before defined");
825 State.
MIs[InsnID]->getOperand(OpIdx));
828 else if (handleReject() == RejectAndGiveUp)
841 dbgs() << CurrentIdx <<
": GIM_CheckConstantInt(MIs["
842 << InsnID <<
"]->getOperand(" << OpIdx
843 <<
"), Value=" <<
Value <<
")\n");
844 assert(State.
MIs[InsnID] !=
nullptr &&
"Used insn before defined");
852 if (handleReject() == RejectAndGiveUp)
859 if (handleReject() == RejectAndGiveUp)
862 }
else if (handleReject() == RejectAndGiveUp)
871 int64_t
Value = readU64();
873 dbgs() << CurrentIdx <<
": GIM_CheckLiteralInt(MIs["
874 << InsnID <<
"]->getOperand(" << OpIdx
875 <<
"), Value=" <<
Value <<
")\n");
876 assert(State.
MIs[InsnID] !=
nullptr &&
"Used insn before defined");
884 if (handleReject() == RejectAndGiveUp)
895 dbgs() << CurrentIdx <<
": GIM_CheckIntrinsicID(MIs["
896 << InsnID <<
"]->getOperand(" << OpIdx
897 <<
"), Value=" <<
Value <<
")\n");
898 assert(State.
MIs[InsnID] !=
nullptr &&
"Used insn before defined");
901 if (handleReject() == RejectAndGiveUp)
910 dbgs() << CurrentIdx <<
": GIM_CheckCmpPredicate(MIs["
911 << InsnID <<
"]->getOperand(" << OpIdx
912 <<
"), Value=" <<
Value <<
")\n");
913 assert(State.
MIs[InsnID] !=
nullptr &&
"Used insn before defined");
916 if (handleReject() == RejectAndGiveUp)
924 dbgs() << CurrentIdx <<
": GIM_CheckIsMBB(MIs[" << InsnID
925 <<
"]->getOperand(" << OpIdx <<
"))\n");
926 assert(State.
MIs[InsnID] !=
nullptr &&
"Used insn before defined");
927 if (!State.
MIs[InsnID]->getOperand(OpIdx).isMBB()) {
928 if (handleReject() == RejectAndGiveUp)
937 dbgs() << CurrentIdx <<
": GIM_CheckIsImm(MIs[" << InsnID
938 <<
"]->getOperand(" << OpIdx <<
"))\n");
939 assert(State.
MIs[InsnID] !=
nullptr &&
"Used insn before defined");
940 if (!State.
MIs[InsnID]->getOperand(OpIdx).isImm()) {
941 if (handleReject() == RejectAndGiveUp)
947 uint64_t NumInsn = MatchTable[CurrentIdx++];
949 dbgs() << CurrentIdx <<
": GIM_CheckIsSafeToFold(N = "
950 << NumInsn <<
")\n");
952 for (
unsigned K = 1,
E = NumInsn + 1; K <
E; ++K) {
954 if (handleReject() == RejectAndGiveUp)
967 dbgs() << CurrentIdx <<
": GIM_CheckIsSameOperand(MIs["
968 << InsnID <<
"][" << OpIdx <<
"], MIs["
969 << OtherInsnID <<
"][" << OtherOpIdx <<
"])\n");
970 assert(State.
MIs[InsnID] !=
nullptr &&
"Used insn before defined");
971 assert(State.
MIs[OtherInsnID] !=
nullptr &&
"Used insn before defined");
977 if (
Op.isReg() && OtherOp.
isReg()) {
984 if (!
Op.isIdenticalTo(OtherOp)) {
985 if (handleReject() == RejectAndGiveUp)
997 dbgs() << CurrentIdx <<
": GIM_CheckCanReplaceReg(MIs["
998 << OldInsnID <<
"][" << OldOpIdx <<
"] = MIs["
999 << NewInsnID <<
"][" << NewOpIdx <<
"])\n");
1001 Register Old = State.
MIs[OldInsnID]->getOperand(OldOpIdx).getReg();
1002 Register New = State.
MIs[NewInsnID]->getOperand(NewOpIdx).getReg();
1004 if (handleReject() == RejectAndGiveUp)
1014 dbgs() << CurrentIdx <<
": GIM_MIFlags(MIs[" << InsnID
1015 <<
"], " << Flags <<
")\n");
1016 if ((State.
MIs[InsnID]->getFlags() & Flags) != Flags) {
1017 if (handleReject() == RejectAndGiveUp)
1027 dbgs() << CurrentIdx <<
": GIM_MIFlagsNot(MIs[" << InsnID
1028 <<
"], " << Flags <<
")\n");
1029 if ((State.
MIs[InsnID]->getFlags() & Flags)) {
1030 if (handleReject() == RejectAndGiveUp)
1037 dbgs() << CurrentIdx <<
": GIM_Reject\n");
1038 if (handleReject() == RejectAndGiveUp)
1045 if (NewInsnID >= OutMIs.
size())
1046 OutMIs.
resize(NewInsnID + 1);
1052 OutMIs[NewInsnID]->setDesc(
TII.get(NewOpcode));
1056 dbgs() << CurrentIdx <<
": GIR_MutateOpcode(OutMIs["
1057 << NewInsnID <<
"], MIs[" << OldInsnID <<
"], "
1058 << NewOpcode <<
")\n");
1066 if (NewInsnID >= OutMIs.
size())
1067 OutMIs.
resize(NewInsnID + 1);
1069 OutMIs[NewInsnID] = Builder.
buildInstr(Opcode);
1071 dbgs() << CurrentIdx <<
": GIR_BuildMI(OutMIs["
1072 << NewInsnID <<
"], " << Opcode <<
")\n");
1081 dbgs() << CurrentIdx <<
": GIR_BuildConstant(TempReg["
1082 << TempRegID <<
"], Imm=" << Imm <<
")\n");
1093 assert(OutMIs[NewInsnID] &&
"Attempted to add to undefined instruction");
1094 OutMIs[NewInsnID].add(State.
MIs[OldInsnID]->getOperand(OpIdx));
1097 << CurrentIdx <<
": GIR_Copy(OutMIs[" << NewInsnID
1098 <<
"], MIs[" << OldInsnID <<
"], " << OpIdx <<
")\n");
1106 assert(OutMIs[NewInsnID] &&
"Attempted to add to undefined instruction");
1112 dbgs() << CurrentIdx <<
": GIR_CopyRemaining(OutMIs["
1113 << NewInsnID <<
"], MIs[" << OldInsnID
1114 <<
"], /*start=*/" << OpIdx <<
")\n");
1123 assert(OutMIs[NewInsnID] &&
"Attempted to add to undefined instruction");
1126 OutMIs[NewInsnID].addReg(ZeroReg);
1128 OutMIs[NewInsnID].add(MO);
1130 dbgs() << CurrentIdx <<
": GIR_CopyOrAddZeroReg(OutMIs["
1131 << NewInsnID <<
"], MIs[" << OldInsnID <<
"], "
1132 << OpIdx <<
", " << ZeroReg <<
")\n");
1141 assert(OutMIs[NewInsnID] &&
"Attempted to add to undefined instruction");
1142 OutMIs[NewInsnID].addReg(State.
MIs[OldInsnID]->getOperand(OpIdx).getReg(),
1145 dbgs() << CurrentIdx <<
": GIR_CopySubReg(OutMIs["
1146 << NewInsnID <<
"], MIs[" << OldInsnID <<
"], "
1147 << OpIdx <<
", " << SubRegIdx <<
")\n");
1155 assert(OutMIs[InsnID] &&
"Attempted to add to undefined instruction");
1157 OutMIs[InsnID].addDef(RegNum, Flags);
1159 dbgs() << CurrentIdx <<
": GIR_AddImplicitDef(OutMIs["
1160 << InsnID <<
"], " << RegNum <<
")\n");
1167 assert(OutMIs[InsnID] &&
"Attempted to add to undefined instruction");
1170 dbgs() << CurrentIdx <<
": GIR_AddImplicitUse(OutMIs["
1171 << InsnID <<
"], " << RegNum <<
")\n");
1179 assert(OutMIs[InsnID] &&
"Attempted to add to undefined instruction");
1180 OutMIs[InsnID].addReg(RegNum, RegFlags);
1183 << CurrentIdx <<
": GIR_AddRegister(OutMIs[" << InsnID
1184 <<
"], " << RegNum <<
", " << RegFlags <<
")\n");
1190 assert(OutMIs[InsnID] &&
"Attempted to add to undefined instruction");
1193 dbgs() << CurrentIdx <<
": GIR_AddIntrinsicID(OutMIs["
1194 << InsnID <<
"], " <<
Value <<
")\n");
1201 dbgs() << CurrentIdx <<
": GIR_SetImplicitDefDead(OutMIs["
1202 << InsnID <<
"], OpIdx=" << OpIdx <<
")\n");
1204 assert(
MI &&
"Modifying undefined instruction");
1205 MI->getOperand(
MI->getNumExplicitOperands() + OpIdx).setIsDead();
1213 dbgs() << CurrentIdx <<
": GIR_SetMIFlags(OutMIs["
1214 << InsnID <<
"], " << Flags <<
")\n");
1216 MI->setFlags(
MI->getFlags() | Flags);
1224 dbgs() << CurrentIdx <<
": GIR_UnsetMIFlags(OutMIs["
1225 << InsnID <<
"], " << Flags <<
")\n");
1227 MI->setFlags(
MI->getFlags() & ~Flags);
1235 dbgs() << CurrentIdx <<
": GIR_CopyMIFlags(OutMIs["
1236 << InsnID <<
"], MIs[" << OldInsnID <<
"])\n");
1238 MI->setFlags(
MI->getFlags() | State.
MIs[OldInsnID]->getFlags());
1248 TempRegFlags = readU16();
1253 assert(OutMIs[InsnID] &&
"Attempted to add to undefined instruction");
1255 OutMIs[InsnID].addReg(State.
TempRegisters[TempRegID], TempRegFlags,
1258 TgtExecutor::getName(),
1259 dbgs() << CurrentIdx <<
": GIR_AddTempRegister(OutMIs[" << InsnID
1260 <<
"], TempRegisters[" << TempRegID <<
"]";
1262 dbgs() <<
", " << TempRegFlags <<
")\n");
1268 const bool IsAdd8 = (MatcherOpcode ==
GIR_AddImm8);
1270 uint64_t Imm = IsAdd8 ? (int64_t)readS8() : readU64();
1271 assert(OutMIs[InsnID] &&
"Attempted to add to undefined instruction");
1272 OutMIs[InsnID].addImm(Imm);
1274 dbgs() << CurrentIdx <<
": GIR_AddImm(OutMIs[" << InsnID
1275 <<
"], " << Imm <<
")\n");
1283 assert(OutMIs[InsnID] &&
"Attempted to add to undefined instruction");
1287 OutMIs[InsnID].addCImm(
1290 dbgs() << CurrentIdx <<
": GIR_AddCImm(OutMIs[" << InsnID
1291 <<
"], TypeID=" <<
TypeID <<
", Imm=" << Imm
1299 assert(OutMIs[InsnID] &&
"Attempted to add to undefined instruction");
1300 for (
const auto &RenderOpFn : State.
Renderers[RendererID])
1301 RenderOpFn(OutMIs[InsnID]);
1303 dbgs() << CurrentIdx <<
": GIR_ComplexRenderer(OutMIs["
1304 << InsnID <<
"], " << RendererID <<
")\n");
1311 assert(OutMIs[InsnID] &&
"Attempted to add to undefined instruction");
1312 State.
Renderers[RendererID][RenderOpID](OutMIs[InsnID]);
1314 dbgs() << CurrentIdx
1315 <<
": GIR_ComplexSubOperandRenderer(OutMIs["
1316 << InsnID <<
"], " << RendererID <<
", "
1317 << RenderOpID <<
")\n");
1326 assert(
MI &&
"Attempted to add to undefined instruction");
1328 MI->getOperand(
MI->getNumOperands() - 1).setSubReg(SubRegIdx);
1330 dbgs() << CurrentIdx
1331 <<
": GIR_ComplexSubOperandSubRegRenderer(OutMIs["
1332 << InsnID <<
"], " << RendererID <<
", "
1333 << RenderOpID <<
", " << SubRegIdx <<
")\n");
1340 assert(OutMIs[NewInsnID] &&
"Attempted to add to undefined instruction");
1341 assert(State.
MIs[OldInsnID]->getOpcode() == TargetOpcode::G_CONSTANT &&
1342 "Expected G_CONSTANT");
1343 if (State.
MIs[OldInsnID]->getOperand(1).isCImm()) {
1344 OutMIs[NewInsnID].addImm(
1345 State.
MIs[OldInsnID]->getOperand(1).getCImm()->getSExtValue());
1346 }
else if (State.
MIs[OldInsnID]->getOperand(1).isImm())
1347 OutMIs[NewInsnID].add(State.
MIs[OldInsnID]->getOperand(1));
1351 dbgs() << CurrentIdx <<
": GIR_CopyConstantAsSImm(OutMIs["
1352 << NewInsnID <<
"], MIs[" << OldInsnID <<
"])\n");
1360 assert(OutMIs[NewInsnID] &&
"Attempted to add to undefined instruction");
1361 assert(State.
MIs[OldInsnID]->getOpcode() == TargetOpcode::G_FCONSTANT &&
1362 "Expected G_FCONSTANT");
1363 if (State.
MIs[OldInsnID]->getOperand(1).isFPImm())
1364 OutMIs[NewInsnID].addFPImm(
1365 State.
MIs[OldInsnID]->getOperand(1).getFPImm());
1370 << CurrentIdx <<
": GIR_CopyFPConstantAsFPImm(OutMIs["
1371 << NewInsnID <<
"], MIs[" << OldInsnID <<
"])\n");
1379 assert(OutMIs[InsnID] &&
"Attempted to add to undefined instruction");
1381 dbgs() << CurrentIdx <<
": GIR_CustomRenderer(OutMIs["
1382 << InsnID <<
"], MIs[" << OldInsnID <<
"], "
1383 << RendererFnID <<
")\n");
1385 OutMIs[InsnID], *State.
MIs[OldInsnID],
1392 dbgs() << CurrentIdx <<
": GIR_DoneWithCustomAction(FnID="
1400 if (handleReject() == RejectAndGiveUp)
1409 assert(OutMIs[InsnID] &&
"Attempted to add to undefined instruction");
1412 dbgs() << CurrentIdx
1413 <<
": GIR_CustomOperandRenderer(OutMIs[" << InsnID
1414 <<
"], MIs[" << OldInsnID <<
"]->getOperand("
1415 << OpIdx <<
"), " << RendererFnID <<
")\n");
1417 OutMIs[InsnID], *State.
MIs[OldInsnID], OpIdx);
1424 assert(OutMIs[InsnID] &&
"Attempted to add to undefined instruction");
1432 dbgs() << CurrentIdx <<
": GIR_ConstrainOperandRC(OutMIs["
1433 << InsnID <<
"], " << OpIdx <<
", " << RCEnum
1443 assert(OutMIs[InsnID] &&
"Attempted to add to undefined instruction");
1447 dbgs() << CurrentIdx
1448 <<
": GIR_ConstrainSelectedInstOperands(OutMIs["
1449 << InsnID <<
"])\n");
1454 uint64_t NumInsn = MatchTable[CurrentIdx++];
1455 assert(OutMIs[InsnID] &&
"Attempted to add to undefined instruction");
1458 dbgs() << CurrentIdx <<
": GIR_MergeMemOperands(OutMIs["
1460 for (
unsigned K = 0; K < NumInsn; ++K) {
1463 dbgs() <<
", MIs[" << NextID <<
"]");
1464 for (
const auto &MMO : State.
MIs[NextID]->memoperands())
1465 OutMIs[InsnID].addMemOperand(MMO);
1473 assert(
MI &&
"Attempted to erase an undefined instruction");
1475 dbgs() << CurrentIdx <<
": GIR_EraseFromParent(MIs["
1476 << InsnID <<
"])\n");
1483 << CurrentIdx <<
": GIR_EraseRootFromParent_Done\n");
1484 eraseImpl(State.
MIs[0]);
1493 MRI.createGenericVirtualRegister(getTypeFromIdx(
TypeID));
1495 dbgs() << CurrentIdx <<
": TempRegs[" << TempRegID
1496 <<
"] = GIR_MakeTempReg(" <<
TypeID <<
")\n");
1506 dbgs() << CurrentIdx <<
": GIR_ReplaceReg(MIs["
1507 << OldInsnID <<
"][" << OldOpIdx <<
"] = MIs["
1508 << NewInsnID <<
"][" << NewOpIdx <<
"])\n");
1510 Register Old = State.
MIs[OldInsnID]->getOperand(OldOpIdx).getReg();
1511 Register New = State.
MIs[NewInsnID]->getOperand(NewOpIdx).getReg();
1514 MRI.replaceRegWith(Old, New);
1525 dbgs() << CurrentIdx <<
": GIR_ReplaceRegWithTempReg(MIs["
1526 << OldInsnID <<
"][" << OldOpIdx <<
"] = TempRegs["
1527 << TempRegID <<
"])\n");
1529 Register Old = State.
MIs[OldInsnID]->getOperand(OldOpIdx).getReg();
1533 MRI.replaceRegWith(Old, New);
1544 <<
": GIR_Coverage("
1551 dbgs() << CurrentIdx <<
": GIR_Done\n");
unsigned const MachineRegisterInfo * MRI
static GCRegistry::Add< CoreCLRGC > E("coreclr", "CoreCLR-compatible GC")
This file contains the declarations for the subclasses of Constant, which represent the different fla...
Returns the sub type a function will return at a given Idx Should correspond to the result type of an ExtractValue instruction executed with just that one unsigned Idx
#define DEBUG_WITH_TYPE(TYPE,...)
DEBUG_WITH_TYPE macro - This macro should be used by passes to emit debug information.
This contains common code to allow clients to notify changes to machine instr.
const HexagonInstrInfo * TII
This file declares the MachineIRBuilder class.
unsigned const TargetRegisterInfo * TRI
assert(ImpDefSCC.getReg()==AMDGPU::SCC &&ImpDefSCC.isDef())
This file defines the SmallVector class.
Class for arbitrary precision integers.
void setCovered(uint64_t RuleID)
bool equalsInt(uint64_t V) const
A helper method that can be used to determine if the constant contained within is equal to a constant...
This class represents an Operation in the Expression.
unsigned getPointerSizeInBits(unsigned AS=0) const
Layout pointer size, in bits FIXME: The defaults need to be removed once all of the backends/clients ...
Tagged union holding either a T or a Error.
LLVMContext & getContext() const
getContext - Return a reference to the LLVMContext associated with this function.
virtual bool testSimplePredicate(unsigned) const
bool executeMatchTable(TgtExecutor &Exec, MatcherState &State, const ExecInfoTy< PredicateBitset, ComplexMatcherMemFn, CustomRendererFn > &ExecInfo, MachineIRBuilder &Builder, const uint8_t *MatchTable, const TargetInstrInfo &TII, MachineRegisterInfo &MRI, const TargetRegisterInfo &TRI, const RegisterBankInfo &RBI, const PredicateBitset &AvailableFeatures, CodeGenCoverage *CoverageInfo) const
Execute a given matcher table and return true if the match was successful and false otherwise.
virtual bool testImmPredicate_APFloat(unsigned, const APFloat &) const
virtual bool testImmPredicate_APInt(unsigned, const APInt &) const
virtual bool testMIPredicate_MI(unsigned, const MachineInstr &, const MatcherState &State) const
virtual bool testImmPredicate_I64(unsigned, int64_t) const
std::optional< SmallVector< std::function< void(MachineInstrBuilder &)>, 4 > > ComplexRendererFns
static LLVM_ATTRIBUTE_ALWAYS_INLINE uint64_t fastDecodeULEB128(const uint8_t *LLVM_ATTRIBUTE_RESTRICT MatchTable, uint64_t &CurrentIdx)
bool isOperandImmEqual(const MachineOperand &MO, int64_t Value, const MachineRegisterInfo &MRI, bool Splat=false) const
bool isObviouslySafeToFold(MachineInstr &MI, MachineInstr &IntoMI) const
Return true if MI can obviously be folded into IntoMI.
virtual bool runCustomAction(unsigned, const MatcherState &State, NewMIVector &OutMIs) const
CodeGenCoverage * CoverageInfo
Abstract class that contains various methods for clients to notify about changes.
virtual void changingInstr(MachineInstr &MI)=0
This instruction is about to be mutated in some way.
void finishedChangingAllUsesOfReg()
All instructions reported as changing by changingAllUsesOfReg() have finished being changed.
virtual void changedInstr(MachineInstr &MI)=0
This instruction was mutated in some way.
virtual void erasingInstr(MachineInstr &MI)=0
An instruction is about to be erased.
void changingAllUsesOfReg(const MachineRegisterInfo &MRI, Register Reg)
All the instructions using the given register are being changed.
static IntegerType * get(LLVMContext &C, unsigned NumBits)
This static method is the primary way of constructing an IntegerType.
constexpr unsigned getScalarSizeInBits() const
constexpr TypeSize getSizeInBits() const
Returns the total size of the type. Must only be called on sized types.
constexpr bool isPointer() const
constexpr unsigned getAddressSpace() const
This is an important class for using LLVM in a threaded context.
TypeSize getValue() const
MachineRegisterInfo & getRegInfo()
getRegInfo - Return information about the registers currently in use.
const DataLayout & getDataLayout() const
Return the DataLayout attached to the Module associated to this MF.
Function & getFunction()
Return the LLVM function that this machine code represents.
Helper class to build MachineInstr.
GISelChangeObserver * getObserver()
void setInsertPt(MachineBasicBlock &MBB, MachineBasicBlock::iterator II)
Set the insertion point before the specified position.
MachineBasicBlock::iterator getInsertPt()
Current insertion point for new instructions.
MachineInstrBuilder buildInstr(unsigned Opcode)
Build and insert <empty> = Opcode <empty>.
virtual MachineInstrBuilder buildConstant(const DstOp &Res, const ConstantInt &Val)
Build and insert Res = G_CONSTANT Val.
const MachineInstrBuilder & add(const MachineOperand &MO) const
Representation of each machine instruction.
iterator_range< mop_iterator > operands()
const MachineFunction * getMF() const
Return the function that contains the basic block that this instruction belongs to.
A description of a memory reference used in the backend.
LocationSize getSize() const
Return the size in bytes of the memory reference.
unsigned getAddrSpace() const
Align getAlign() const
Return the minimum known alignment in bytes of the actual memory reference.
LocationSize getSizeInBits() const
Return the size in bits of the memory reference.
MachineOperand class - Representation of each machine instruction operand.
const ConstantInt * getCImm() const
bool isCImm() const
isCImm - Test if this is a MO_CImmediate operand.
bool isIntrinsicID() const
bool isReg() const
isReg - Tests if this is a MO_Register operand.
bool isImm() const
isImm - Tests if this is a MO_Immediate operand.
Register getReg() const
getReg - Returns the register number.
Intrinsic::ID getIntrinsicID() const
unsigned getPredicate() const
MachineRegisterInfo - Keep track of information for virtual and physical registers,...
Holds all the information related to register banks.
const RegisterBank & getRegBank(unsigned ID)
Get the register bank identified by ID.
virtual const RegisterBank & getRegBankFromRegClass(const TargetRegisterClass &RC, LLT Ty) const
Get a register bank that covers RC.
Wrapper class representing virtual and physical registers.
constexpr bool isPhysical() const
Return true if the specified register number is in the physical register namespace.
void push_back(const T &Elt)
This is a 'vector' (really, a variable-sized array), optimized for the case when the array is small.
TargetInstrInfo - Interface to description of machine instruction set.
TargetRegisterInfo base class - We assume that the target defines a static array of TargetRegisterDes...
LLVM Value Representation.
static constexpr bool isKnownLE(const FixedOrScalableQuantity &LHS, const FixedOrScalableQuantity &RHS)
static constexpr bool isKnownGE(const FixedOrScalableQuantity &LHS, const FixedOrScalableQuantity &RHS)
#define llvm_unreachable(msg)
Marks that the current location is not supposed to be reachable.
@ Implicit
Not emitted register (e.g. carry, or temporary result).
This is an optimization pass for GlobalISel generic memory operations.
auto drop_begin(T &&RangeOrContainer, size_t N=1)
Return a range covering RangeOrContainer with the first N elements excluded.
bool isBuildVectorAllZeros(const MachineInstr &MI, const MachineRegisterInfo &MRI, bool AllowUndef=false)
Return true if the specified instruction is a G_BUILD_VECTOR or G_BUILD_VECTOR_TRUNC where all of the...
Register constrainOperandRegClass(const MachineFunction &MF, const TargetRegisterInfo &TRI, MachineRegisterInfo &MRI, const TargetInstrInfo &TII, const RegisterBankInfo &RBI, MachineInstr &InsertPt, const TargetRegisterClass &RegClass, MachineOperand &RegMO)
Constrain the Register operand OpIdx, so that it is now constrained to the TargetRegisterClass passed...
@ GIR_AddIntrinsicID
Adds an intrinsic ID to the specified instruction.
@ GIR_ComplexRenderer
Render complex operands to the specified instruction.
@ GIR_ReplaceRegWithTempReg
Replaces all references to a register with a temporary register.
@ GIR_ComplexSubOperandRenderer
Render sub-operands of complex operands to the specified instruction.
@ GIR_MakeTempReg
Create a new temporary register that's not constrained.
@ GIM_CheckMemorySizeEqualTo
Check the size of the memory access for the given machine memory operand.
@ GIM_RootCheckType
GIM_CheckType but InsnID is omitted and defaults to zero.
@ GIM_RootCheckRegBankForClass
GIM_CheckRegBankForClass but InsnID is omitted and defaults to zero.
@ GIR_Done
A successful emission.
@ GIM_RecordNamedOperand
Predicates with 'let PredicateCodeUsesOperands = 1' need to examine some named operands that will be ...
@ GIM_Try
Begin a try-block to attempt a match and jump to OnFail if it is unsuccessful.
@ GIR_RootConstrainSelectedInstOperands
GIR_ConstrainSelectedInstOperands but InsnID is omitted and defaults to zero.
@ GIM_CheckIsBuildVectorAllOnes
Check if this is a vector that can be treated as a vector splat constant.
@ GIM_CheckNumOperands
Check the instruction has the right number of operands.
@ GIR_AddCImm
Add an CImm to the specified instruction.
@ GIR_ConstrainOperandRC
Constrain an instruction operand to a register class.
@ GIM_CheckI64ImmPredicate
Check an immediate predicate on the specified instruction.
@ GIR_AddImplicitDef
Add an implicit register def to the specified instruction.
@ GIM_CheckAPIntImmPredicate
Check an immediate predicate on the specified instruction via an APInt.
@ GIM_CheckHasNoUse
Check if there's no use of the first result.
@ GIM_CheckPointerToAny
Check the type of a pointer to any address space.
@ GIM_CheckMemorySizeEqualToLLT
Check the size of the memory access for the given machine memory operand against the size of an opera...
@ GIM_CheckComplexPattern
Check the operand matches a complex predicate.
@ GIR_CopyConstantAsSImm
Render a G_CONSTANT operator as a sign-extended immediate.
@ GIR_EraseFromParent
Erase from parent.
@ GIM_SwitchType
Switch over the LLT on the specified instruction operand.
@ GIR_CopySubReg
Copy an operand to the specified instruction.
@ GIR_MutateOpcode
Mutate an instruction.
@ GIM_CheckIsBuildVectorAllZeros
@ GIM_CheckAtomicOrderingOrStrongerThan
@ GIR_AddRegister
Add an register to the specified instruction.
@ GIR_AddTempSubRegister
Add a temporary register to the specified instruction.
@ GIM_CheckIsSafeToFold
Checks if the matched instructions numbered [1, 1+N) can be folded into the root (inst 0).
@ GIM_CheckOpcode
Check the opcode on the specified instruction.
@ GIR_ReplaceReg
Replaces all references to a register from an instruction with another register from another instruct...
@ GIM_SwitchOpcode
Switch over the opcode on the specified instruction.
@ GIM_CheckAPFloatImmPredicate
Check a floating point immediate predicate on the specified instruction.
@ GIM_Reject
Fail the current try-block, or completely fail to match if there is no current try-block.
@ GIR_AddSimpleTempRegister
Add a temporary register to the specified instruction without setting any flags.
@ GIR_AddTempRegister
Add a temporary register to the specified instruction.
@ GIR_Copy
Copy an operand to the specified instruction.
@ GIR_AddImm
Add an immediate to the specified instruction.
@ GIR_CopyFConstantAsFPImm
Render a G_FCONSTANT operator as a sign-extended immediate.
@ GIR_CopyRemaining
Copies all operand starting from OpIdx in OldInsnID into the new instruction NewInsnID.
@ GIM_MIFlags
Check that a matched instruction has, or doesn't have a MIFlag.
@ GIR_CopyOrAddZeroReg
Copy an operand to the specified instruction or add a zero register if the operand is a zero immediat...
@ GIM_CheckMemoryAlignment
Check the minimum alignment of the memory access for the given machine memory operand.
@ GIM_CheckIsSameOperand
Check the specified operands are identical.
@ GIR_AddImm8
Add signed 8 bit immediate to the specified instruction.
@ GIM_CheckIsSameOperandIgnoreCopies
@ GIM_CheckIsMBB
Check the specified operand is an MBB.
@ GIM_CheckNumOperandsLE
Check the instruction has a number of operands <= or >= than given number.
@ GIM_CheckMemorySizeGreaterThanLLT
@ GIM_CheckRegBankForClass
Check the register bank for the specified operand.
@ GIM_CheckLiteralInt
Check the operand is a specific literal integer (i.e.
@ GIM_CheckMemorySizeLessThanLLT
@ GIM_RecordRegType
Records an operand's register type into the set of temporary types.
@ GIM_CheckHasOneUse
Check if there's one use of the first result.
@ GIR_EraseRootFromParent_Done
Combines both a GIR_EraseFromParent 0 + GIR_Done.
@ GIR_CopyMIFlags
Copy the MIFlags of a matched instruction into an output instruction.
@ GIR_DoneWithCustomAction
Calls a C++ function that concludes the current match.
@ GIR_BuildMI
Build a new instruction.
@ GIM_RecordInsn
Record the specified instruction.
@ GIM_CheckIsImm
Check the specified operand is an Imm.
@ GIR_BuildRootMI
GIR_BuildMI but InsnID is omitted and defaults to zero.
@ GIM_CheckFeatures
Check the feature bits Feature(2) - Expected features.
@ GIM_CheckCanReplaceReg
Check we can replace all uses of a register with another.
@ GIM_CheckMemoryAddressSpace
Check the address space of the memory access for the given machine memory operand.
@ GIR_CustomRenderer
Render operands to the specified instruction using a custom function.
@ GIM_CheckAtomicOrdering
Check a memory operation has the specified atomic ordering.
@ GIM_CheckType
Check the type for the specified operand.
@ GIM_CheckConstantInt8
Check the operand is a specific 8-bit signed integer.
@ GIM_CheckCmpPredicate
Check the operand is a specific predicate.
@ GIM_CheckOpcodeIsEither
Check the opcode on the specified instruction, checking 2 acceptable alternatives.
@ GIR_SetImplicitDefDead
Marks the implicit def of a register as dead.
@ GIR_BuildConstant
Builds a constant and stores its result in a TempReg.
@ GIR_AddImplicitUse
Add an implicit register use to the specified instruction.
@ GIR_Coverage
Increment the rule coverage counter.
@ GIR_MergeMemOperands
Merge all memory operands into instruction.
@ GIM_CheckImmOperandPredicate
Check an immediate predicate on the specified instruction.
@ GIM_CheckAtomicOrderingWeakerThan
@ GIR_SetMIFlags
Set or unset a MIFlag on an instruction.
@ GIM_CheckIntrinsicID
Check the operand is a specific intrinsic ID.
@ GIM_CheckConstantInt
Check the operand is a specific integer.
@ GIR_RootToRootCopy
GIR_Copy but with both New/OldInsnIDs omitted and defaulting to zero.
@ GIR_ComplexSubOperandSubRegRenderer
Render subregisters of suboperands of complex operands to the specified instruction.
@ GIM_RecordInsnIgnoreCopies
@ GIR_CustomOperandRenderer
Render operands to the specified instruction using a custom function, reading from a specific operand...
@ GIR_ConstrainSelectedInstOperands
Constrain an instructions operands according to the instruction description.
@ GIM_CheckCxxInsnPredicate
Check a generic C++ instruction predicate.
@ GIM_CheckSimplePredicate
Check a trivial predicate which takes no arguments.
bool constrainSelectedInstRegOperands(MachineInstr &I, const TargetInstrInfo &TII, const TargetRegisterInfo &TRI, const RegisterBankInfo &RBI)
Mutate the newly-selected instruction I to constrain its (possibly generic) virtual register operands...
@ GICXXCustomAction_Invalid
MachineInstr * getDefIgnoringCopies(Register Reg, const MachineRegisterInfo &MRI)
Find the def instruction for Reg, folding away any trivial copies.
constexpr T MinAlign(U A, V B)
A and B are either alignments or offsets.
bool canReplaceReg(Register DstReg, Register SrcReg, MachineRegisterInfo &MRI)
Check if DstReg can be replaced with SrcReg depending on the register constraints.
raw_ostream & dbgs()
dbgs() - This returns a reference to a raw_ostream for debugging messages.
bool isAtLeastOrStrongerThan(AtomicOrdering AO, AtomicOrdering Other)
bool isBuildVectorAllOnes(const MachineInstr &MI, const MachineRegisterInfo &MRI, bool AllowUndef=false)
Return true if the specified instruction is a G_BUILD_VECTOR or G_BUILD_VECTOR_TRUNC where all of the...
AtomicOrdering
Atomic ordering for LLVM's memory model.
constexpr int64_t SignExtend64(uint64_t x)
Sign-extend the number in the bottom B bits of X to a 64-bit integer.
Register getSrcRegIgnoringCopies(Register Reg, const MachineRegisterInfo &MRI)
Find the source register for Reg, folding away any trivial copies.
@ Default
The result values are uniform if and only if all operands are uniform.
bool isStrongerThan(AtomicOrdering AO, AtomicOrdering Other)
Returns true if ao is stronger than other as defined by the AtomicOrdering lattice,...
const CustomRendererFn * CustomRenderers
SmallDenseMap< LLT, unsigned, 64 > TypeIDMap
const ComplexMatcherMemFn * ComplexPredicates
const PredicateBitset * FeatureBitsets
std::array< const MachineOperand *, 3 > RecordedOperands
Named operands that predicate with 'let PredicateCodeUsesOperands = 1' referenced in its argument lis...
SmallVector< LLT, 4 > RecordedTypes
Types extracted from an instruction's operand.
DenseMap< unsigned, unsigned > TempRegisters
std::vector< ComplexRendererFns::value_type > Renderers