15#ifndef LLVM_CODEGEN_GLOBALISEL_GIMATCHTABLEEXECUTORIMPL_H
16#define LLVM_CODEGEN_GLOBALISEL_GIMATCHTABLEEXECUTORIMPL_H
41template <
class TgtExecutor,
class PredicateBitset,
class ComplexMatcherMemFn,
42 class CustomRendererFn>
50 const PredicateBitset &AvailableFeatures,
59 bool NoFPException = !State.MIs[0]->getDesc().mayRaiseFPException();
61 const uint32_t Flags = State.MIs[0]->getFlags();
62 bool BuilderInitialized =
false;
63 const auto initializeBuilder = [&]() {
64 if (BuilderInitialized)
68 Builder.setInstrAndDebugLoc(*State.MIs[0]);
69 BuilderInitialized =
true;
72 enum RejectAction { RejectAndGiveUp, RejectAndResume };
73 auto handleReject = [&]() -> RejectAction {
75 dbgs() << CurrentIdx <<
": Rejected\n");
76 if (OnFailResumeAt.
empty())
77 return RejectAndGiveUp;
80 dbgs() << CurrentIdx <<
": Resume at " << CurrentIdx <<
" ("
81 << OnFailResumeAt.
size() <<
" try-blocks remain)\n");
82 return RejectAndResume;
85 const auto propagateFlags = [&]() {
86 for (
auto MIB : OutMIs) {
89 uint32_t MIBFlags = Flags | MIB.getInstr()->getFlags();
90 if (NoFPException && MIB->mayRaiseFPException())
94 MIB.setMIFlags(MIBFlags);
102 const auto getTypeFromIdx = [&](int64_t Idx) ->
LLT {
105 return State.RecordedTypes[1 - Idx];
108 const auto readULEB = [&]() {
117 const auto readS8 = [&]() {
return (int8_t)MatchTable[CurrentIdx++]; };
119 const auto readU16 = [&]() {
125 const auto readU32 = [&]() {
131 const auto readU64 = [&]() {
141 if (Builder.getInsertPt() ==
MI)
142 Builder.setInsertPt(*
MI->getParent(), ++
MI->getIterator());
145 MI->eraseFromParent();
149 assert(CurrentIdx != ~0u &&
"Invalid MatchTable index");
150 uint8_t MatcherOpcode = MatchTable[CurrentIdx++];
151 switch (MatcherOpcode) {
154 dbgs() << CurrentIdx <<
": Begin try-block\n");
167 assert(NewInsnID != 0 &&
"Refusing to modify MIs[0]");
172 dbgs() << CurrentIdx <<
": Not a register\n");
173 if (handleReject() == RejectAndGiveUp)
179 dbgs() << CurrentIdx <<
": Is a physical register\n");
180 if (handleReject() == RejectAndGiveUp)
191 if ((
size_t)NewInsnID < State.MIs.size())
192 State.MIs[NewInsnID] = NewMI;
194 assert((
size_t)NewInsnID == State.MIs.size() &&
195 "Expected to store MIs in order");
196 State.MIs.push_back(NewMI);
199 dbgs() << CurrentIdx <<
": MIs[" << NewInsnID
200 <<
"] = GIM_RecordInsn(" << InsnID <<
", " <<
OpIdx
206 uint16_t ExpectedBitsetID = readU16();
209 <<
": GIM_CheckFeatures(ExpectedBitsetID="
210 << ExpectedBitsetID <<
")\n");
211 if ((AvailableFeatures & ExecInfo.
FeatureBitsets[ExpectedBitsetID]) !=
213 if (handleReject() == RejectAndGiveUp)
224 Expected1 = readU16();
226 assert(State.MIs[InsnID] !=
nullptr &&
"Used insn before defined");
227 unsigned Opcode = State.MIs[InsnID]->getOpcode();
230 dbgs() << CurrentIdx <<
": GIM_CheckOpcode(MIs[" << InsnID
231 <<
"], ExpectedOpcode=" << Expected0;
233 dbgs() <<
" || " << Expected1;
234 dbgs() <<
") // Got=" << Opcode <<
"\n";
237 if (Opcode != Expected0 && Opcode != Expected1) {
238 if (handleReject() == RejectAndGiveUp)
249 assert(State.MIs[InsnID] !=
nullptr &&
"Used insn before defined");
250 const int64_t Opcode = State.MIs[InsnID]->getOpcode();
253 dbgs() << CurrentIdx <<
": GIM_SwitchOpcode(MIs[" << InsnID <<
"], ["
254 << LowerBound <<
", " << UpperBound <<
"), Default=" <<
Default
255 <<
", JumpTable...) // Got=" << Opcode <<
"\n";
257 if (Opcode < LowerBound || UpperBound <= Opcode) {
261 const auto EntryIdx = (Opcode - LowerBound);
282 assert(State.MIs[InsnID] !=
nullptr &&
"Used insn before defined");
286 dbgs() << CurrentIdx <<
": GIM_SwitchType" << (IsShape ?
"Shape" :
"")
287 <<
"(MIs[" << InsnID <<
"]->getOperand(" <<
OpIdx <<
"), ["
288 << LowerBound <<
", " << UpperBound <<
"), Default=" <<
Default
289 <<
", JumpTable...) // Got=";
291 dbgs() <<
"Not a VReg\n";
304 const auto TyI = ExecInfo.
TypeIDMap.
find(Ty.getUniqueRAWLLTData());
309 const int64_t
TypeID = TyI->second;
314 const auto NumEntry = (
TypeID - LowerBound);
332 dbgs() << CurrentIdx <<
": GIM_CheckNumOperands"
333 << (IsLE ?
"LE" :
"GE") <<
"(MIs[" << InsnID
334 <<
"], Expected=" <<
Expected <<
")\n");
335 assert(State.MIs[InsnID] !=
nullptr &&
"Used insn before defined");
336 const unsigned NumOps = State.MIs[InsnID]->getNumOperands();
338 if (handleReject() == RejectAndGiveUp)
347 dbgs() << CurrentIdx <<
": GIM_CheckNumOperands(MIs["
348 << InsnID <<
"], Expected=" <<
Expected <<
")\n");
349 assert(State.MIs[InsnID] !=
nullptr &&
"Used insn before defined");
350 if (State.MIs[InsnID]->getNumOperands() !=
Expected) {
351 if (handleReject() == RejectAndGiveUp)
363 dbgs() << CurrentIdx <<
": GIM_CheckImmPredicate(MIs["
364 << InsnID <<
"]->getOperand(" <<
OpIdx
365 <<
"), Predicate=" <<
Predicate <<
")\n");
366 assert(State.MIs[InsnID] !=
nullptr &&
"Used insn before defined");
367 assert((State.MIs[InsnID]->getOperand(
OpIdx).isImm() ||
368 State.MIs[InsnID]->getOperand(
OpIdx).isCImm()) &&
369 "Expected immediate operand");
372 if (State.MIs[InsnID]->getOperand(
OpIdx).isCImm())
373 Value = State.MIs[InsnID]->getOperand(
OpIdx).getCImm()->getSExtValue();
374 else if (State.MIs[InsnID]->getOperand(
OpIdx).isImm())
375 Value = State.MIs[InsnID]->getOperand(
OpIdx).getImm();
380 if (handleReject() == RejectAndGiveUp)
389 << CurrentIdx <<
": GIM_CheckAPIntImmPredicate(MIs["
390 << InsnID <<
"], Predicate=" <<
Predicate <<
")\n");
391 assert(State.MIs[InsnID] !=
nullptr &&
"Used insn before defined");
392 assert(State.MIs[InsnID]->getOpcode() == TargetOpcode::G_CONSTANT &&
393 "Expected G_CONSTANT");
395 if (!State.MIs[InsnID]->getOperand(1).isCImm())
399 State.MIs[InsnID]->getOperand(1).getCImm()->getValue();
401 if (handleReject() == RejectAndGiveUp)
410 << CurrentIdx <<
": GIM_CheckAPFloatImmPredicate(MIs["
411 << InsnID <<
"], Predicate=" <<
Predicate <<
")\n");
412 assert(State.MIs[InsnID] !=
nullptr &&
"Used insn before defined");
413 assert(State.MIs[InsnID]->getOpcode() == TargetOpcode::G_FCONSTANT &&
414 "Expected G_FCONSTANT");
415 assert(State.MIs[InsnID]->getOperand(1).isFPImm() &&
416 "Expected FPImm operand");
419 State.MIs[InsnID]->getOperand(1).getFPImm()->getValueAPF();
422 if (handleReject() == RejectAndGiveUp)
432 <<
": GIM_CheckLeafOperandPredicate(MIs[" << InsnID
433 <<
"]->getOperand(" <<
OpIdx
434 <<
"), Predicate=" <<
Predicate <<
")\n");
435 assert(State.MIs[InsnID] !=
nullptr &&
"Used insn before defined");
436 assert(State.MIs[InsnID]->getOperand(
OpIdx).isReg() &&
437 "Expected register operand");
442 if (handleReject() == RejectAndGiveUp)
452 <<
": GIM_CheckBuildVectorAll{Zeros|Ones}(MIs["
453 << InsnID <<
"])\n");
454 assert(State.MIs[InsnID] !=
nullptr &&
"Used insn before defined");
457 assert((
MI->getOpcode() == TargetOpcode::G_BUILD_VECTOR ||
458 MI->getOpcode() == TargetOpcode::G_BUILD_VECTOR_TRUNC) &&
459 "Expected G_BUILD_VECTOR or G_BUILD_VECTOR_TRUNC");
463 if (handleReject() == RejectAndGiveUp)
468 if (handleReject() == RejectAndGiveUp)
482 <<
": GIM_CheckSimplePredicate(Predicate="
486 if (handleReject() == RejectAndGiveUp)
496 << CurrentIdx <<
": GIM_CheckCxxPredicate(MIs["
497 << InsnID <<
"], Predicate=" <<
Predicate <<
")\n");
498 assert(State.MIs[InsnID] !=
nullptr &&
"Used insn before defined");
502 if (handleReject() == RejectAndGiveUp)
510 dbgs() << CurrentIdx <<
": GIM_CheckHasNoUse(MIs["
514 assert(
MI &&
"Used insn before defined");
515 assert(
MI->getNumDefs() > 0 &&
"No defs");
516 const Register Res =
MI->getOperand(0).getReg();
519 if (handleReject() == RejectAndGiveUp)
528 dbgs() << CurrentIdx <<
": GIM_CheckHasOneUse(MIs["
532 assert(
MI &&
"Used insn before defined");
533 assert(
MI->getNumDefs() > 0 &&
"No defs");
534 const Register Res =
MI->getOperand(0).getReg();
537 if (handleReject() == RejectAndGiveUp)
546 dbgs() << CurrentIdx <<
": GIM_CheckAtomicOrdering(MIs["
547 << InsnID <<
"], " << (
uint64_t)Ordering <<
")\n");
548 assert(State.MIs[InsnID] !=
nullptr &&
"Used insn before defined");
549 if (!State.MIs[InsnID]->hasOneMemOperand())
550 if (handleReject() == RejectAndGiveUp)
553 for (
const auto &MMO : State.MIs[InsnID]->memoperands())
554 if (MMO->getMergedOrdering() != Ordering)
555 if (handleReject() == RejectAndGiveUp)
564 <<
": GIM_CheckAtomicOrderingOrStrongerThan(MIs["
565 << InsnID <<
"], " << (
uint64_t)Ordering <<
")\n");
566 assert(State.MIs[InsnID] !=
nullptr &&
"Used insn before defined");
567 if (!State.MIs[InsnID]->hasOneMemOperand())
568 if (handleReject() == RejectAndGiveUp)
571 for (
const auto &MMO : State.MIs[InsnID]->memoperands())
573 if (handleReject() == RejectAndGiveUp)
582 <<
": GIM_CheckAtomicOrderingWeakerThan(MIs["
583 << InsnID <<
"], " << (
uint64_t)Ordering <<
")\n");
584 assert(State.MIs[InsnID] !=
nullptr &&
"Used insn before defined");
585 if (!State.MIs[InsnID]->hasOneMemOperand())
586 if (handleReject() == RejectAndGiveUp)
589 for (
const auto &MMO : State.MIs[InsnID]->memoperands())
591 if (handleReject() == RejectAndGiveUp)
599 const uint64_t NumAddrSpace = MatchTable[CurrentIdx++];
601 if (State.MIs[InsnID]->getNumMemOperands() <= MMOIdx) {
602 if (handleReject() == RejectAndGiveUp)
609 const uint64_t LastIdx = CurrentIdx + NumAddrSpace;
612 *(State.MIs[InsnID]->memoperands_begin() + MMOIdx);
616 for (
unsigned I = 0;
I != NumAddrSpace; ++
I) {
619 dbgs() <<
"addrspace(" << MMOAddrSpace <<
") vs "
620 << AddrSpace <<
'\n');
622 if (AddrSpace == MMOAddrSpace) {
628 CurrentIdx = LastIdx;
629 if (!
Success && handleReject() == RejectAndGiveUp)
638 assert(State.MIs[InsnID] !=
nullptr &&
"Used insn before defined");
640 if (State.MIs[InsnID]->getNumMemOperands() <= MMOIdx) {
641 if (handleReject() == RejectAndGiveUp)
647 *(State.MIs[InsnID]->memoperands_begin() + MMOIdx);
649 dbgs() << CurrentIdx <<
": GIM_CheckMemoryAlignment"
650 <<
"(MIs[" << InsnID <<
"]->memoperands() + "
651 << MMOIdx <<
")->getAlignment() >= " <<
MinAlign
664 dbgs() << CurrentIdx <<
": GIM_CheckMemorySizeEqual(MIs["
665 << InsnID <<
"]->memoperands() + " << MMOIdx
666 <<
", Size=" <<
Size <<
")\n");
667 assert(State.MIs[InsnID] !=
nullptr &&
"Used insn before defined");
669 if (State.MIs[InsnID]->getNumMemOperands() <= MMOIdx) {
670 if (handleReject() == RejectAndGiveUp)
676 *(State.MIs[InsnID]->memoperands_begin() + MMOIdx);
679 <<
" bytes vs " <<
Size
682 if (handleReject() == RejectAndGiveUp)
695 TgtExecutor::getName(),
696 dbgs() << CurrentIdx <<
": GIM_CheckMemorySize"
701 <<
"LLT(MIs[" << InsnID <<
"]->memoperands() + " << MMOIdx
702 <<
", OpIdx=" <<
OpIdx <<
")\n");
703 assert(State.MIs[InsnID] !=
nullptr &&
"Used insn before defined");
708 dbgs() << CurrentIdx <<
": Not a register\n");
709 if (handleReject() == RejectAndGiveUp)
714 if (State.MIs[InsnID]->getNumMemOperands() <= MMOIdx) {
715 if (handleReject() == RejectAndGiveUp)
721 *(State.MIs[InsnID]->memoperands_begin() + MMOIdx);
726 if (handleReject() == RejectAndGiveUp)
730 if (handleReject() == RejectAndGiveUp)
734 if (handleReject() == RejectAndGiveUp)
745 dbgs() << CurrentIdx <<
": GIM_CheckType(MIs[" << InsnID
746 <<
"]->getOperand(" <<
OpIdx
747 <<
"), TypeID=" <<
TypeID <<
")\n");
748 assert(State.MIs[InsnID] !=
nullptr &&
"Used insn before defined");
751 if (handleReject() == RejectAndGiveUp)
762 dbgs() << CurrentIdx <<
": GIM_CheckPointerToAny(MIs["
763 << InsnID <<
"]->getOperand(" <<
OpIdx
764 <<
"), SizeInBits=" << SizeInBits <<
")\n");
765 assert(State.MIs[InsnID] !=
nullptr &&
"Used insn before defined");
770 if (SizeInBits == 0) {
772 const unsigned AddrSpace = Ty.getAddressSpace();
773 SizeInBits =
MF->getDataLayout().getPointerSizeInBits(AddrSpace);
776 assert(SizeInBits != 0 &&
"Pointer size must be known");
779 if (!Ty.isPointer() || Ty.getSizeInBits() != SizeInBits)
780 if (handleReject() == RejectAndGiveUp)
782 }
else if (handleReject() == RejectAndGiveUp)
793 dbgs() << CurrentIdx <<
": GIM_RecordNamedOperand(MIs["
794 << InsnID <<
"]->getOperand(" <<
OpIdx
795 <<
"), StoreIdx=" << StoreIdx <<
")\n");
796 assert(State.MIs[InsnID] !=
nullptr &&
"Used insn before defined");
797 assert(StoreIdx < State.RecordedOperands.size() &&
"Index out of range");
798 State.RecordedOperands[StoreIdx] = &State.MIs[InsnID]->getOperand(
OpIdx);
804 int TypeIdx = readS8();
807 dbgs() << CurrentIdx <<
": GIM_RecordRegType(MIs["
808 << InsnID <<
"]->getOperand(" <<
OpIdx
809 <<
"), TypeIdx=" << TypeIdx <<
")\n");
810 assert(State.MIs[InsnID] !=
nullptr &&
"Used insn before defined");
811 assert(TypeIdx < 0 &&
"Temp types always have negative indexes!");
813 TypeIdx = 1 - TypeIdx;
814 const auto &
Op = State.MIs[InsnID]->getOperand(
OpIdx);
815 if (State.RecordedTypes.size() <= (
uint64_t)TypeIdx)
816 State.RecordedTypes.resize(TypeIdx + 1,
LLT());
817 State.RecordedTypes[TypeIdx] = MRI.
getType(
Op.getReg());
828 dbgs() << CurrentIdx <<
": GIM_CheckRegBankForClass(MIs["
829 << InsnID <<
"]->getOperand(" <<
OpIdx
830 <<
"), RCEnum=" << RCEnum <<
")\n");
831 assert(State.MIs[InsnID] !=
nullptr &&
"Used insn before defined");
837 if (handleReject() == RejectAndGiveUp)
847 uint16_t ComplexPredicateID = readU16();
849 dbgs() << CurrentIdx <<
": State.Renderers[" << RendererID
850 <<
"] = GIM_CheckComplexPattern(MIs[" << InsnID
851 <<
"]->getOperand(" <<
OpIdx
852 <<
"), ComplexPredicateID=" << ComplexPredicateID
854 assert(State.MIs[InsnID] !=
nullptr &&
"Used insn before defined");
858 State.MIs[InsnID]->getOperand(
OpIdx));
860 State.Renderers[RendererID] = *Renderer;
861 else if (handleReject() == RejectAndGiveUp)
874 dbgs() << CurrentIdx <<
": GIM_CheckConstantInt(MIs["
875 << InsnID <<
"]->getOperand(" <<
OpIdx
876 <<
"), Value=" <<
Value <<
")\n");
877 assert(State.MIs[InsnID] !=
nullptr &&
"Used insn before defined");
884 if (Ty.getScalarSizeInBits() > 64) {
885 if (handleReject() == RejectAndGiveUp)
892 if (handleReject() == RejectAndGiveUp)
895 }
else if (handleReject() == RejectAndGiveUp)
904 int64_t
Value = readU64();
906 dbgs() << CurrentIdx <<
": GIM_CheckLiteralInt(MIs["
907 << InsnID <<
"]->getOperand(" <<
OpIdx
908 <<
"), Value=" <<
Value <<
")\n");
909 assert(State.MIs[InsnID] !=
nullptr &&
"Used insn before defined");
917 if (handleReject() == RejectAndGiveUp)
928 dbgs() << CurrentIdx <<
": GIM_CheckIntrinsicID(MIs["
929 << InsnID <<
"]->getOperand(" <<
OpIdx
930 <<
"), Value=" <<
Value <<
")\n");
931 assert(State.MIs[InsnID] !=
nullptr &&
"Used insn before defined");
934 if (handleReject() == RejectAndGiveUp)
943 dbgs() << CurrentIdx <<
": GIM_CheckCmpPredicate(MIs["
944 << InsnID <<
"]->getOperand(" <<
OpIdx
945 <<
"), Value=" <<
Value <<
")\n");
946 assert(State.MIs[InsnID] !=
nullptr &&
"Used insn before defined");
949 if (handleReject() == RejectAndGiveUp)
957 dbgs() << CurrentIdx <<
": GIM_CheckIsMBB(MIs[" << InsnID
958 <<
"]->getOperand(" <<
OpIdx <<
"))\n");
959 assert(State.MIs[InsnID] !=
nullptr &&
"Used insn before defined");
960 if (!State.MIs[InsnID]->getOperand(
OpIdx).isMBB()) {
961 if (handleReject() == RejectAndGiveUp)
970 dbgs() << CurrentIdx <<
": GIM_CheckIsImm(MIs[" << InsnID
971 <<
"]->getOperand(" <<
OpIdx <<
"))\n");
972 assert(State.MIs[InsnID] !=
nullptr &&
"Used insn before defined");
973 if (!State.MIs[InsnID]->getOperand(
OpIdx).isImm()) {
974 if (handleReject() == RejectAndGiveUp)
980 uint64_t NumInsn = MatchTable[CurrentIdx++];
982 dbgs() << CurrentIdx <<
": GIM_CheckIsSafeToFold(N = "
983 << NumInsn <<
")\n");
985 for (
unsigned K = 1,
E = NumInsn + 1; K <
E; ++K) {
987 if (handleReject() == RejectAndGiveUp)
1000 dbgs() << CurrentIdx <<
": GIM_CheckIsSameOperand(MIs["
1001 << InsnID <<
"][" <<
OpIdx <<
"], MIs["
1002 << OtherInsnID <<
"][" << OtherOpIdx <<
"])\n");
1003 assert(State.MIs[InsnID] !=
nullptr &&
"Used insn before defined");
1004 assert(State.MIs[OtherInsnID] !=
nullptr &&
"Used insn before defined");
1007 MachineOperand &OtherOp = State.MIs[OtherInsnID]->getOperand(OtherOpIdx);
1010 if (
Op.isReg() && OtherOp.
isReg()) {
1017 if (!
Op.isIdenticalTo(OtherOp)) {
1018 if (handleReject() == RejectAndGiveUp)
1030 dbgs() << CurrentIdx <<
": GIM_CheckCanReplaceReg(MIs["
1031 << OldInsnID <<
"][" << OldOpIdx <<
"] = MIs["
1032 << NewInsnID <<
"][" << NewOpIdx <<
"])\n");
1034 Register Old = State.MIs[OldInsnID]->getOperand(OldOpIdx).getReg();
1035 Register New = State.MIs[NewInsnID]->getOperand(NewOpIdx).getReg();
1037 if (handleReject() == RejectAndGiveUp)
1047 dbgs() << CurrentIdx <<
": GIM_MIFlags(MIs[" << InsnID
1048 <<
"], " << Flags <<
")\n");
1049 if ((State.MIs[InsnID]->getFlags() & Flags) != Flags) {
1050 if (handleReject() == RejectAndGiveUp)
1060 dbgs() << CurrentIdx <<
": GIM_MIFlagsNot(MIs[" << InsnID
1061 <<
"], " << Flags <<
")\n");
1062 if ((State.MIs[InsnID]->getFlags() & Flags)) {
1063 if (handleReject() == RejectAndGiveUp)
1070 dbgs() << CurrentIdx <<
": GIM_Reject\n");
1071 if (handleReject() == RejectAndGiveUp)
1078 if (NewInsnID >= OutMIs.
size())
1079 OutMIs.
resize(NewInsnID + 1);
1085 OutMIs[NewInsnID]->setDesc(
TII.get(NewOpcode));
1089 dbgs() << CurrentIdx <<
": GIR_MutateOpcode(OutMIs["
1090 << NewInsnID <<
"], MIs[" << OldInsnID <<
"], "
1091 << NewOpcode <<
")\n");
1099 if (NewInsnID >= OutMIs.
size())
1100 OutMIs.
resize(NewInsnID + 1);
1102 initializeBuilder();
1103 OutMIs[NewInsnID] = Builder.buildInstr(Opcode);
1105 dbgs() << CurrentIdx <<
": GIR_BuildMI(OutMIs["
1106 << NewInsnID <<
"], " << Opcode <<
")\n");
1113 initializeBuilder();
1114 Builder.buildConstant(State.TempRegisters[TempRegID], Imm);
1116 dbgs() << CurrentIdx <<
": GIR_BuildConstant(TempReg["
1117 << TempRegID <<
"], Imm=" << Imm <<
")\n");
1128 assert(OutMIs[NewInsnID] &&
"Attempted to add to undefined instruction");
1129 OutMIs[NewInsnID].add(State.MIs[OldInsnID]->getOperand(
OpIdx));
1132 << CurrentIdx <<
": GIR_Copy(OutMIs[" << NewInsnID
1133 <<
"], MIs[" << OldInsnID <<
"], " <<
OpIdx <<
")\n");
1141 assert(OutMIs[NewInsnID] &&
"Attempted to add to undefined instruction");
1147 dbgs() << CurrentIdx <<
": GIR_CopyRemaining(OutMIs["
1148 << NewInsnID <<
"], MIs[" << OldInsnID
1149 <<
"], /*start=*/" <<
OpIdx <<
")\n");
1158 assert(OutMIs[NewInsnID] &&
"Attempted to add to undefined instruction");
1161 OutMIs[NewInsnID].addReg(ZeroReg);
1163 OutMIs[NewInsnID].add(MO);
1165 dbgs() << CurrentIdx <<
": GIR_CopyOrAddZeroReg(OutMIs["
1166 << NewInsnID <<
"], MIs[" << OldInsnID <<
"], "
1167 <<
OpIdx <<
", " << ZeroReg <<
")\n");
1176 assert(OutMIs[NewInsnID] &&
"Attempted to add to undefined instruction");
1177 OutMIs[NewInsnID].addReg(State.MIs[OldInsnID]->getOperand(
OpIdx).getReg(),
1180 dbgs() << CurrentIdx <<
": GIR_CopySubReg(OutMIs["
1181 << NewInsnID <<
"], MIs[" << OldInsnID <<
"], "
1182 <<
OpIdx <<
", " << SubRegIdx <<
")\n");
1190 assert(OutMIs[InsnID] &&
"Attempted to add to undefined instruction");
1192 OutMIs[InsnID].addDef(RegNum, Flags);
1194 dbgs() << CurrentIdx <<
": GIR_AddImplicitDef(OutMIs["
1195 << InsnID <<
"], " << RegNum <<
", "
1196 <<
static_cast<uint16_t>(Flags) <<
")\n");
1203 assert(OutMIs[InsnID] &&
"Attempted to add to undefined instruction");
1206 dbgs() << CurrentIdx <<
": GIR_AddImplicitUse(OutMIs["
1207 << InsnID <<
"], " << RegNum <<
")\n");
1215 assert(OutMIs[InsnID] &&
"Attempted to add to undefined instruction");
1216 OutMIs[InsnID].addReg(RegNum, RegFlags);
1218 dbgs() << CurrentIdx <<
": GIR_AddRegister(OutMIs["
1219 << InsnID <<
"], " << RegNum <<
", "
1220 <<
static_cast<uint16_t>(RegFlags) <<
")\n");
1226 assert(OutMIs[InsnID] &&
"Attempted to add to undefined instruction");
1229 dbgs() << CurrentIdx <<
": GIR_AddIntrinsicID(OutMIs["
1230 << InsnID <<
"], " <<
Value <<
")\n");
1237 dbgs() << CurrentIdx <<
": GIR_SetImplicitDefDead(OutMIs["
1238 << InsnID <<
"], OpIdx=" <<
OpIdx <<
")\n");
1240 assert(
MI &&
"Modifying undefined instruction");
1241 MI->getOperand(
MI->getNumExplicitOperands() +
OpIdx).setIsDead();
1249 dbgs() << CurrentIdx <<
": GIR_SetMIFlags(OutMIs["
1250 << InsnID <<
"], " << Flags <<
")\n");
1252 MI->setFlags(
MI->getFlags() | Flags);
1260 dbgs() << CurrentIdx <<
": GIR_UnsetMIFlags(OutMIs["
1261 << InsnID <<
"], " << Flags <<
")\n");
1263 MI->setFlags(
MI->getFlags() & ~Flags);
1271 dbgs() << CurrentIdx <<
": GIR_CopyMIFlags(OutMIs["
1272 << InsnID <<
"], MIs[" << OldInsnID <<
"])\n");
1274 MI->setFlags(
MI->getFlags() | State.MIs[OldInsnID]->getFlags());
1284 TempRegFlags =
static_cast<RegState>(readU16());
1289 assert(OutMIs[InsnID] &&
"Attempted to add to undefined instruction");
1291 OutMIs[InsnID].addReg(State.TempRegisters[TempRegID], TempRegFlags,
1294 TgtExecutor::getName(),
1295 dbgs() << CurrentIdx <<
": GIR_AddTempRegister(OutMIs[" << InsnID
1296 <<
"], TempRegisters[" << TempRegID <<
"]";
1297 if (SubReg)
dbgs() <<
'.' <<
TRI.getSubRegIndexName(SubReg);
1298 dbgs() <<
", " <<
static_cast<uint16_t>(TempRegFlags) <<
")\n");
1304 const bool IsAdd8 = (MatcherOpcode ==
GIR_AddImm8);
1306 uint64_t Imm = IsAdd8 ? (int64_t)readS8() : readU64();
1307 assert(OutMIs[InsnID] &&
"Attempted to add to undefined instruction");
1308 OutMIs[InsnID].addImm(Imm);
1310 dbgs() << CurrentIdx <<
": GIR_AddImm(OutMIs[" << InsnID
1311 <<
"], " << Imm <<
")\n");
1319 assert(OutMIs[InsnID] &&
"Attempted to add to undefined instruction");
1323 OutMIs[InsnID].addCImm(
1326 dbgs() << CurrentIdx <<
": GIR_AddCImm(OutMIs[" << InsnID
1327 <<
"], TypeID=" <<
TypeID <<
", Imm=" << Imm
1335 assert(OutMIs[InsnID] &&
"Attempted to add to undefined instruction");
1336 for (
const auto &RenderOpFn : State.Renderers[RendererID])
1337 RenderOpFn(OutMIs[InsnID]);
1339 dbgs() << CurrentIdx <<
": GIR_ComplexRenderer(OutMIs["
1340 << InsnID <<
"], " << RendererID <<
")\n");
1347 assert(OutMIs[InsnID] &&
"Attempted to add to undefined instruction");
1348 State.Renderers[RendererID][RenderOpID](OutMIs[InsnID]);
1350 dbgs() << CurrentIdx
1351 <<
": GIR_ComplexSubOperandRenderer(OutMIs["
1352 << InsnID <<
"], " << RendererID <<
", "
1353 << RenderOpID <<
")\n");
1362 assert(
MI &&
"Attempted to add to undefined instruction");
1363 State.Renderers[RendererID][RenderOpID](
MI);
1364 MI->getOperand(
MI->getNumOperands() - 1).setSubReg(SubRegIdx);
1366 dbgs() << CurrentIdx
1367 <<
": GIR_ComplexSubOperandSubRegRenderer(OutMIs["
1368 << InsnID <<
"], " << RendererID <<
", "
1369 << RenderOpID <<
", " << SubRegIdx <<
")\n");
1376 assert(OutMIs[NewInsnID] &&
"Attempted to add to undefined instruction");
1377 assert(State.MIs[OldInsnID]->getOpcode() == TargetOpcode::G_CONSTANT &&
1378 "Expected G_CONSTANT");
1379 if (State.MIs[OldInsnID]->getOperand(1).isCImm()) {
1380 OutMIs[NewInsnID].addImm(
1381 State.MIs[OldInsnID]->getOperand(1).getCImm()->getSExtValue());
1382 }
else if (State.MIs[OldInsnID]->getOperand(1).isImm())
1383 OutMIs[NewInsnID].add(State.MIs[OldInsnID]->getOperand(1));
1387 dbgs() << CurrentIdx <<
": GIR_CopyConstantAsSImm(OutMIs["
1388 << NewInsnID <<
"], MIs[" << OldInsnID <<
"])\n");
1396 assert(OutMIs[NewInsnID] &&
"Attempted to add to undefined instruction");
1397 assert(State.MIs[OldInsnID]->getOpcode() == TargetOpcode::G_FCONSTANT &&
1398 "Expected G_FCONSTANT");
1399 if (State.MIs[OldInsnID]->getOperand(1).isFPImm())
1400 OutMIs[NewInsnID].addFPImm(
1401 State.MIs[OldInsnID]->getOperand(1).getFPImm());
1406 << CurrentIdx <<
": GIR_CopyFPConstantAsFPImm(OutMIs["
1407 << NewInsnID <<
"], MIs[" << OldInsnID <<
"])\n");
1415 assert(OutMIs[InsnID] &&
"Attempted to add to undefined instruction");
1417 dbgs() << CurrentIdx <<
": GIR_CustomRenderer(OutMIs["
1418 << InsnID <<
"], MIs[" << OldInsnID <<
"], "
1419 << RendererFnID <<
")\n");
1421 OutMIs[InsnID], *State.MIs[OldInsnID],
1428 dbgs() << CurrentIdx <<
": GIR_DoneWithCustomAction(FnID="
1436 if (handleReject() == RejectAndGiveUp)
1445 assert(OutMIs[InsnID] &&
"Attempted to add to undefined instruction");
1448 dbgs() << CurrentIdx
1449 <<
": GIR_CustomOperandRenderer(OutMIs[" << InsnID
1450 <<
"], MIs[" << OldInsnID <<
"]->getOperand("
1451 <<
OpIdx <<
"), " << RendererFnID <<
")\n");
1453 OutMIs[InsnID], *State.MIs[OldInsnID],
OpIdx);
1460 assert(OutMIs[InsnID] &&
"Attempted to add to undefined instruction");
1468 dbgs() << CurrentIdx <<
": GIR_ConstrainOperandRC(OutMIs["
1469 << InsnID <<
"], " <<
OpIdx <<
", " << RCEnum
1479 assert(OutMIs[InsnID] &&
"Attempted to add to undefined instruction");
1483 dbgs() << CurrentIdx
1484 <<
": GIR_ConstrainSelectedInstOperands(OutMIs["
1485 << InsnID <<
"])\n");
1490 uint64_t NumInsn = MatchTable[CurrentIdx++];
1491 assert(OutMIs[InsnID] &&
"Attempted to add to undefined instruction");
1494 dbgs() << CurrentIdx <<
": GIR_MergeMemOperands(OutMIs["
1496 for (
unsigned K = 0; K < NumInsn; ++K) {
1499 dbgs() <<
", MIs[" << NextID <<
"]");
1500 for (
const auto &MMO : State.MIs[NextID]->memoperands())
1501 OutMIs[InsnID].addMemOperand(MMO);
1509 assert(
MI &&
"Attempted to erase an undefined instruction");
1511 dbgs() << CurrentIdx <<
": GIR_EraseFromParent(MIs["
1512 << InsnID <<
"])\n");
1519 << CurrentIdx <<
": GIR_EraseRootFromParent_Done\n");
1520 eraseImpl(State.MIs[0]);
1528 State.TempRegisters[TempRegID] =
1531 dbgs() << CurrentIdx <<
": TempRegs[" << TempRegID
1532 <<
"] = GIR_MakeTempReg(" <<
TypeID <<
")\n");
1542 dbgs() << CurrentIdx <<
": GIR_ReplaceReg(MIs["
1543 << OldInsnID <<
"][" << OldOpIdx <<
"] = MIs["
1544 << NewInsnID <<
"][" << NewOpIdx <<
"])\n");
1546 Register Old = State.MIs[OldInsnID]->getOperand(OldOpIdx).getReg();
1547 Register New = State.MIs[NewInsnID]->getOperand(NewOpIdx).getReg();
1561 dbgs() << CurrentIdx <<
": GIR_ReplaceRegWithTempReg(MIs["
1562 << OldInsnID <<
"][" << OldOpIdx <<
"] = TempRegs["
1563 << TempRegID <<
"])\n");
1565 Register Old = State.MIs[OldInsnID]->getOperand(OldOpIdx).getReg();
1566 Register New = State.TempRegisters[TempRegID];
1580 <<
": GIR_Coverage("
1587 dbgs() << CurrentIdx <<
": GIR_Done\n");
assert(UImm &&(UImm !=~static_cast< T >(0)) &&"Invalid immediate!")
static GCRegistry::Add< CoreCLRGC > E("coreclr", "CoreCLR-compatible GC")
This file contains the declarations for the subclasses of Constant, which represent the different fla...
This contains common code to allow clients to notify changes to machine instr.
const HexagonInstrInfo * TII
const size_t AbstractManglingParser< Derived, Alloc >::NumOps
This file declares the MachineIRBuilder class.
Register const TargetRegisterInfo * TRI
MachineInstr unsigned OpIdx
This file defines the SmallVector class.
#define DEBUG_WITH_TYPE(TYPE,...)
DEBUG_WITH_TYPE macro - This macro should be used by passes to emit debug information.
Class for arbitrary precision integers.
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...
iterator find(const_arg_type_t< KeyT > Val)
Tagged union holding either a T or a Error.
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 testMOPredicate_MO(unsigned, const MachineOperand &, const MatcherState &State) 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
SmallVector< MachineInstrBuilder, 4 > NewMIVector
static Ty readBytesAs(const uint8_t *MatchTable)
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)
LLVM_ABI bool isOperandImmEqual(const MachineOperand &MO, int64_t Value, const MachineRegisterInfo &MRI, bool Splat=false) const
LLVM_ABI 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.
LLVM_ABI 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.
LLVM_ABI void changingAllUsesOfReg(const MachineRegisterInfo &MRI, Register Reg)
All the instructions using the given register are being changed.
static LLVM_ABI IntegerType * get(LLVMContext &C, unsigned NumBits)
This static method is the primary way of constructing an IntegerType.
constexpr unsigned getScalarSizeInBits() const
constexpr LLT changeElementType(LLT NewEltTy) const
If this type is a vector, return a vector with the same number of elements but the new element type.
static constexpr LLT scalar(unsigned SizeInBits)
Get a low-level scalar or aggregate "bag of bits".
constexpr TypeSize getSizeInBits() const
Returns the total size of the type. Must only be called on sized types.
This is an important class for using LLVM in a threaded context.
TypeSize getValue() const
Helper class to build MachineInstr.
const MachineInstrBuilder & add(const MachineOperand &MO) const
Representation of each machine instruction.
LLVM_ABI 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
LLVM_ABI 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,...
LLVM_ABI bool hasOneNonDBGUse(Register RegNo) const
hasOneNonDBGUse - Return true if there is exactly one non-Debug use of the specified register.
LLVM_ABI MachineInstr * getVRegDef(Register Reg) const
getVRegDef - Return the machine instr that defines the specified virtual register or null if none is ...
bool use_nodbg_empty(Register RegNo) const
use_nodbg_empty - Return true if there are no non-Debug instructions using the specified register.
LLT getType(Register Reg) const
Get the low-level type of Reg or LLT{} if Reg is not a generic (target independent) virtual register.
LLVM_ABI Register createGenericVirtualRegister(LLT Ty, StringRef Name="")
Create and return a new generic virtual register with low-level type Ty.
LLVM_ABI void replaceRegWith(Register FromReg, Register ToReg)
replaceRegWith - Replace all instances of FromReg with ToReg in the machine function.
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.
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.
LLVM_ABI 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...
LLVM_ABI 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...
RegState
Flags to represent properties of register accesses.
@ Implicit
Not emitted register (e.g. carry, or temporary result).
LLVM_ABI void 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...
LLVM_ABI 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.
LLVM_ABI bool canReplaceReg(Register DstReg, Register SrcReg, MachineRegisterInfo &MRI)
Check if DstReg can be replaced with SrcReg depending on the register constraints.
LLVM_ABI raw_ostream & dbgs()
dbgs() - This returns a reference to a raw_ostream for debugging messages.
bool isAtLeastOrStrongerThan(AtomicOrdering AO, AtomicOrdering Other)
LLVM_ABI 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...
@ Success
The lock was released successfully.
AtomicOrdering
Atomic ordering for LLVM's memory model.
DWARFExpression::Operation Op
constexpr int64_t SignExtend64(uint64_t x)
Sign-extend the number in the bottom B bits of X to a 64-bit integer.
LLVM_ABI Register getSrcRegIgnoringCopies(Register Reg, const MachineRegisterInfo &MRI)
Find the source register for Reg, folding away any trivial copies.
@ GICXXCustomAction_Invalid
@ 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_CheckLeafOperandPredicate
Check a leaf predicate on the specified instruction.
@ 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.
@ GIM_SwitchTypeShape
Switch over the shape of an LLT on the specified instruction operand.
@ 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.
@ Default
The result value is 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,...
SmallDenseMap< uint64_t, unsigned, 64 > TypeIDMap
const CustomRendererFn * CustomRenderers
const ComplexMatcherMemFn * ComplexPredicates
const PredicateBitset * FeatureBitsets