87 struct MachineVerifier {
88 MachineVerifier(
Pass *
pass,
const char *b) : PASS(pass), Banner(b) {}
100 unsigned foundErrors;
103 bool isFunctionRegBankSelected;
104 bool isFunctionSelected;
114 BlockSet FunctionBlocks;
118 RegVector regsDefined, regsDead, regsKilled;
119 RegMaskVector regMasks;
124 void addRegWithSubRegs(RegVector &RV,
unsigned Reg) {
133 bool reachable =
false;
153 RegSet vregsRequired;
156 BlockSet Preds, Succs;
162 bool addPassed(
unsigned Reg) {
165 if (regsKilled.count(Reg) || regsLiveOut.count(Reg))
167 return vregsPassed.insert(Reg).second;
171 bool addPassed(
const RegSet &RS) {
172 bool changed =
false;
173 for (RegSet::const_iterator
I = RS.begin(),
E = RS.end();
I !=
E; ++
I)
181 bool addRequired(
unsigned Reg) {
184 if (regsLiveOut.count(Reg))
186 return vregsRequired.insert(Reg).second;
190 bool addRequired(
const RegSet &RS) {
191 bool changed =
false;
192 for (RegSet::const_iterator
I = RS.begin(),
E = RS.end();
I !=
E; ++
I)
199 bool addRequired(
const RegMap &
RM) {
200 bool changed =
false;
201 for (RegMap::const_iterator
I = RM.begin(),
E = RM.end();
I !=
E; ++
I)
202 if (addRequired(
I->first))
209 return regsLiveOut.count(Reg) || vregsPassed.count(Reg);
216 bool isReserved(
unsigned Reg) {
217 return Reg < regsReserved.
size() && regsReserved.
test(Reg);
220 bool isAllocatable(
unsigned Reg)
const {
222 !regsReserved.
test(Reg);
231 void visitMachineFunctionBefore();
238 void visitMachineOperand(
const MachineOperand *MO,
unsigned MONum);
242 void visitMachineFunctionAfter();
247 void report(
const char *msg,
const MachineOperand *MO,
unsigned MONum,
251 void report_context(
const LiveRange &LR,
unsigned VRegUnit,
254 void report_context(
const VNInfo &VNI)
const;
255 void report_context(
SlotIndex Pos)
const;
256 void report_context(
MCPhysReg PhysReg)
const;
257 void report_context_liverange(
const LiveRange &LR)
const;
258 void report_context_lanemask(
LaneBitmask LaneMask)
const;
259 void report_context_vreg(
unsigned VReg)
const;
260 void report_context_vreg_regunit(
unsigned VRegOrUnit)
const;
270 bool SubRangeCheck =
false,
274 void calcRegsPassed();
277 void calcRegsRequired();
278 void verifyLiveVariables();
279 void verifyLiveIntervals();
283 void verifyLiveRangeSegment(
const LiveRange&,
286 void verifyLiveRange(
const LiveRange&,
unsigned,
289 void verifyStackFrame();
291 void verifySlotIndexes()
const;
298 const std::string Banner;
300 MachineVerifierPass(std::string banner = std::string())
311 unsigned FoundErrors = MachineVerifier(
this, Banner.c_str()).
verify(MF);
323 "Verify generated machine code",
false,
false)
326 return new MachineVerifierPass(Banner);
332 unsigned FoundErrors = MachineVerifier(p, Banner).verify(MF);
333 if (AbortOnErrors && FoundErrors)
335 return FoundErrors == 0;
338 void MachineVerifier::verifySlotIndexes()
const {
339 if (Indexes ==
nullptr)
358 report(
"Function has NoVRegs property but there are VReg operands", &MF);
376 if (isFunctionFailedISel)
379 isFunctionRegBankSelected =
380 !isFunctionFailedISel &&
383 isFunctionSelected = !isFunctionFailedISel &&
401 verifyProperties(MF);
403 visitMachineFunctionBefore();
406 visitMachineBasicBlockBefore(&*MFI);
410 bool InBundle =
false;
413 MBBE = MFI->instr_end(); MBBI != MBBE; ++MBBI) {
414 if (MBBI->getParent() != &*MFI) {
415 report(
"Bad instruction parent pointer", &*MFI);
416 errs() <<
"Instruction: " << *MBBI;
421 if (InBundle && !MBBI->isBundledWithPred())
422 report(
"Missing BundledPred flag, " 423 "BundledSucc was set on predecessor",
425 if (!InBundle && MBBI->isBundledWithPred())
426 report(
"BundledPred flag is set, " 427 "but BundledSucc not set on predecessor",
431 if (!MBBI->isInsideBundle()) {
433 visitMachineBundleAfter(CurBundle);
435 visitMachineBundleBefore(CurBundle);
436 }
else if (!CurBundle)
437 report(
"No bundle header", &*MBBI);
438 visitMachineInstrBefore(&*MBBI);
439 for (
unsigned I = 0,
E = MBBI->getNumOperands();
I !=
E; ++
I) {
445 report(
"Instruction has operand with wrong parent set", &MI);
448 visitMachineOperand(&Op,
I);
451 visitMachineInstrAfter(&*MBBI);
454 InBundle = MBBI->isBundledWithSucc();
457 visitMachineBundleAfter(CurBundle);
459 report(
"BundledSucc flag set on last instruction in block", &MFI->back());
460 visitMachineBasicBlockAfter(&*MFI);
462 visitMachineFunctionAfter();
475 void MachineVerifier::report(
const char *msg,
const MachineFunction *MF) {
478 if (!foundErrors++) {
480 errs() <<
"# " << Banner <<
'\n';
481 if (LiveInts !=
nullptr)
486 errs() <<
"*** Bad machine code: " << msg <<
" ***\n" 487 <<
"- function: " << MF->
getName() <<
"\n";
494 << MBB->
getName() <<
" (" << (
const void *)MBB <<
')';
501 void MachineVerifier::report(
const char *msg,
const MachineInstr *
MI) {
504 errs() <<
"- instruction: ";
505 if (Indexes && Indexes->
hasIndex(*MI))
510 void MachineVerifier::report(
const char *msg,
const MachineOperand *MO,
511 unsigned MONum,
LLT MOVRegType) {
514 errs() <<
"- operand " << MONum <<
": ";
519 void MachineVerifier::report_context(
SlotIndex Pos)
const {
520 errs() <<
"- at: " << Pos <<
'\n';
523 void MachineVerifier::report_context(
const LiveInterval &LI)
const {
524 errs() <<
"- interval: " << LI <<
'\n';
527 void MachineVerifier::report_context(
const LiveRange &LR,
unsigned VRegUnit,
529 report_context_liverange(LR);
530 report_context_vreg_regunit(VRegUnit);
532 report_context_lanemask(LaneMask);
536 errs() <<
"- segment: " << S <<
'\n';
539 void MachineVerifier::report_context(
const VNInfo &VNI)
const {
540 errs() <<
"- ValNo: " << VNI.
id <<
" (def " << VNI.
def <<
")\n";
543 void MachineVerifier::report_context_liverange(
const LiveRange &LR)
const {
544 errs() <<
"- liverange: " << LR <<
'\n';
547 void MachineVerifier::report_context(
MCPhysReg PReg)
const {
548 errs() <<
"- p. register: " <<
printReg(PReg, TRI) <<
'\n';
551 void MachineVerifier::report_context_vreg(
unsigned VReg)
const {
552 errs() <<
"- v. register: " <<
printReg(VReg, TRI) <<
'\n';
555 void MachineVerifier::report_context_vreg_regunit(
unsigned VRegOrUnit)
const {
557 report_context_vreg(VRegOrUnit);
563 void MachineVerifier::report_context_lanemask(
LaneBitmask LaneMask)
const {
568 BBInfo &MInfo = MBBInfoMap[MBB];
569 if (!MInfo.reachable) {
570 MInfo.reachable =
true;
572 SuE = MBB->
succ_end(); SuI != SuE; ++SuI)
577 void MachineVerifier::visitMachineFunctionBefore() {
583 markReachable(&MF->
front());
586 FunctionBlocks.
clear();
587 for (
const auto &MBB : *MF) {
588 FunctionBlocks.insert(&MBB);
589 BBInfo &MInfo = MBBInfoMap[&MBB];
592 if (MInfo.Preds.size() != MBB.
pred_size())
593 report(
"MBB has duplicate entries in its predecessor list.", &MBB);
596 if (MInfo.Succs.size() != MBB.
succ_size())
597 report(
"MBB has duplicate entries in its successor list.", &MBB);
619 FirstTerminator =
nullptr;
620 FirstNonPHI =
nullptr;
626 for (
const auto &LI : MBB->
liveins()) {
627 if (isAllocatable(LI.PhysReg) && !MBB->
isEHPad() &&
629 report(
"MBB has allocatable live-in, but isn't entry or landing-pad.", MBB);
630 report_context(LI.PhysReg);
641 if (!FunctionBlocks.count(*
I))
642 report(
"MBB has successor that isn't part of the function.", MBB);
643 if (!MBBInfoMap[*
I].Preds.
count(MBB)) {
644 report(
"Inconsistent CFG", MBB);
645 errs() <<
"MBB is not in the predecessor list of the successor " 653 if (!FunctionBlocks.count(*
I))
654 report(
"MBB has predecessor that isn't part of the function.", MBB);
655 if (!MBBInfoMap[*
I].Succs.
count(MBB)) {
656 report(
"Inconsistent CFG", MBB);
657 errs() <<
"MBB is not in the successor list of the predecessor " 665 if (LandingPadSuccs.
size() > 1 &&
670 report(
"MBB has more than one landing pad successor", MBB);
675 if (!TII->
analyzeBranch(*const_cast<MachineBasicBlock *>(MBB), TBB, FBB,
683 if (MBBI == MF->
end()) {
692 report(
"MBB exits via unconditional fall-through but doesn't have " 693 "exactly one CFG successor!", MBB);
695 report(
"MBB exits via unconditional fall-through but its successor " 696 "differs from its CFG successor!", MBB);
700 report(
"MBB exits via unconditional fall-through but ends with a " 701 "barrier instruction!", MBB);
704 report(
"MBB exits via unconditional fall-through but has a condition!",
707 }
else if (TBB && !FBB && Cond.
empty()) {
714 report(
"MBB exits via unconditional branch but doesn't have " 715 "exactly one CFG successor!", MBB);
717 report(
"MBB exits via unconditional branch but the CFG " 718 "successor doesn't match the actual successor!", MBB);
721 report(
"MBB exits via unconditional branch but doesn't contain " 722 "any instructions!", MBB);
724 report(
"MBB exits via unconditional branch but doesn't end with a " 725 "barrier instruction!", MBB);
727 report(
"MBB exits via unconditional branch but the branch isn't a " 728 "terminator instruction!", MBB);
730 }
else if (TBB && !FBB && !Cond.
empty()) {
734 if (MBBI == MF->
end()) {
735 report(
"MBB conditionally falls through out of function!", MBB);
739 report(
"MBB exits via conditional branch/fall-through but only has " 740 "one CFG successor!", MBB);
742 report(
"MBB exits via conditional branch/fall-through but the CFG " 743 "successor don't match the actual successor!", MBB);
745 report(
"MBB exits via conditional branch/fall-through but doesn't have " 746 "exactly two CFG successors!", MBB);
748 report(
"MBB exits via conditional branch/fall-through but the CFG " 749 "successors don't match the actual successors!", MBB);
752 report(
"MBB exits via conditional branch/fall-through but doesn't " 753 "contain any instructions!", MBB);
755 report(
"MBB exits via conditional branch/fall-through but ends with a " 756 "barrier instruction!", MBB);
758 report(
"MBB exits via conditional branch/fall-through but the branch " 759 "isn't a terminator instruction!", MBB);
761 }
else if (TBB && FBB) {
767 report(
"MBB exits via conditional branch/branch through but only has " 768 "one CFG successor!", MBB);
770 report(
"MBB exits via conditional branch/branch through but the CFG " 771 "successor don't match the actual successor!", MBB);
773 report(
"MBB exits via conditional branch/branch but doesn't have " 774 "exactly two CFG successors!", MBB);
776 report(
"MBB exits via conditional branch/branch but the CFG " 777 "successors don't match the actual successors!", MBB);
780 report(
"MBB exits via conditional branch/branch but doesn't " 781 "contain any instructions!", MBB);
783 report(
"MBB exits via conditional branch/branch but doesn't end with a " 784 "barrier instruction!", MBB);
786 report(
"MBB exits via conditional branch/branch but the branch " 787 "isn't a terminator instruction!", MBB);
790 report(
"MBB exits via conditional branch/branch but there's no " 794 report(
"AnalyzeBranch returned invalid data!", MBB);
800 for (
const auto &LI : MBB->
liveins()) {
802 report(
"MBB live-in list contains non-physical register", MBB);
826 void MachineVerifier::visitMachineBundleBefore(
const MachineInstr *MI) {
827 if (Indexes && Indexes->
hasIndex(*MI)) {
829 if (!(idx > lastIndex)) {
830 report(
"Instruction index out of order", MI);
831 errs() <<
"Last instruction was at " << lastIndex <<
'\n';
840 if (!FirstTerminator)
841 FirstTerminator =
MI;
843 report(
"Non-terminator instruction after the first terminator", MI);
844 errs() <<
"First terminator was:\t" << *FirstTerminator;
850 void MachineVerifier::verifyInlineAsm(
const MachineInstr *MI) {
853 report(
"Too few operands on inline asm", MI);
857 report(
"Asm string must be an external symbol", MI);
859 report(
"Asm flags must be an immediate", MI);
864 report(
"Unknown asm flags", &MI->
getOperand(1), 1);
879 report(
"Missing operands in last group", MI);
889 report(
"Expected implicit register after groups", &MO, OpNo);
896 bool MachineVerifier::verifyVectorElementMatch(
LLT Ty0,
LLT Ty1,
899 report(
"operand types must be all-vector or all-scalar", MI);
909 report(
"operand types must preserve number of vector elements", MI);
916 void MachineVerifier::verifyPreISelGenericInstruction(
const MachineInstr *MI) {
917 if (isFunctionSelected)
918 report(
"Unexpected generic instruction in a Selected function", MI);
936 report(
"generic instruction must use register operands", MI);
946 if (!Types[TypeIdx].isValid())
947 Types[TypeIdx] = OpTy;
948 else if (Types[TypeIdx] != OpTy)
949 report(
"Type mismatch in generic instruction", MO,
I, OpTy);
952 report(
"Generic instruction is missing a virtual register type", MO,
I);
960 report(
"Generic instruction cannot have physical register", MO,
I);
969 report(ErrorInfo.
data(),
MI);
973 case TargetOpcode::G_CONSTANT:
974 case TargetOpcode::G_FCONSTANT: {
980 report(
"Instruction cannot use a vector result type", MI);
982 if (MI->
getOpcode() == TargetOpcode::G_CONSTANT) {
984 report(
"G_CONSTANT operand must be cimm", MI);
990 report(
"inconsistent constant size", MI);
993 report(
"G_FCONSTANT operand must be fpimm", MI);
1000 report(
"inconsistent constant size", MI);
1006 case TargetOpcode::G_LOAD:
1007 case TargetOpcode::G_STORE:
1008 case TargetOpcode::G_ZEXTLOAD:
1009 case TargetOpcode::G_SEXTLOAD: {
1013 report(
"Generic memory instruction must access a pointer", MI);
1018 report(
"Generic instruction accessing memory must have one mem operand",
1022 if (MI->
getOpcode() == TargetOpcode::G_ZEXTLOAD ||
1023 MI->
getOpcode() == TargetOpcode::G_SEXTLOAD) {
1025 report(
"Generic extload must have a narrower memory type", MI);
1026 }
else if (MI->
getOpcode() == TargetOpcode::G_LOAD) {
1028 report(
"load memory size cannot exceed result size", MI);
1029 }
else if (MI->
getOpcode() == TargetOpcode::G_STORE) {
1031 report(
"store memory size cannot exceed value size", MI);
1037 case TargetOpcode::G_PHI: {
1045 if (!Ty.
isValid() || (Ty != DstTy))
1049 report(
"Generic Instruction G_PHI has operands with incompatible/missing " 1054 case TargetOpcode::G_BITCAST: {
1061 report(
"bitcast cannot convert between pointers and other types", MI);
1064 report(
"bitcast sizes must match", MI);
1067 case TargetOpcode::G_INTTOPTR:
1068 case TargetOpcode::G_PTRTOINT:
1069 case TargetOpcode::G_ADDRSPACE_CAST: {
1075 verifyVectorElementMatch(DstTy, SrcTy, MI);
1080 if (MI->
getOpcode() == TargetOpcode::G_INTTOPTR) {
1082 report(
"inttoptr result type must be a pointer", MI);
1084 report(
"inttoptr source type must not be a pointer", MI);
1085 }
else if (MI->
getOpcode() == TargetOpcode::G_PTRTOINT) {
1087 report(
"ptrtoint source type must be a pointer", MI);
1089 report(
"ptrtoint result type must not be a pointer", MI);
1093 report(
"addrspacecast types must be pointers", MI);
1096 report(
"addrspacecast must convert different address spaces", MI);
1102 case TargetOpcode::G_PTR_ADD: {
1110 report(
"gep first operand must be a pointer", MI);
1113 report(
"gep offset operand must not be a pointer", MI);
1118 case TargetOpcode::G_SEXT:
1119 case TargetOpcode::G_ZEXT:
1120 case TargetOpcode::G_ANYEXT:
1121 case TargetOpcode::G_TRUNC:
1122 case TargetOpcode::G_FPEXT:
1123 case TargetOpcode::G_FPTRUNC: {
1132 if (!DstTy.isValid() || !SrcTy.
isValid())
1138 report(
"Generic extend/truncate can not operate on pointers", MI);
1140 verifyVectorElementMatch(DstTy, SrcTy, MI);
1146 if (DstSize <= SrcSize)
1147 report(
"Generic extend has destination type no larger than source", MI);
1149 case TargetOpcode::G_TRUNC:
1150 case TargetOpcode::G_FPTRUNC:
1151 if (DstSize >= SrcSize)
1152 report(
"Generic truncate has destination type no smaller than source",
1158 case TargetOpcode::G_SELECT: {
1166 verifyVectorElementMatch(SelTy, CondTy, MI);
1169 case TargetOpcode::G_MERGE_VALUES: {
1177 report(
"G_MERGE_VALUES cannot operate on vectors", MI);
1181 report(
"G_MERGE_VALUES result size is inconsistent", MI);
1183 for (
unsigned I = 2;
I != NumOps; ++
I) {
1185 report(
"G_MERGE_VALUES source types do not match", MI);
1190 case TargetOpcode::G_UNMERGE_VALUES: {
1196 report(
"G_UNMERGE_VALUES destination types do not match", MI);
1200 report(
"G_UNMERGE_VALUES source operand does not cover dest operands",
1205 case TargetOpcode::G_BUILD_VECTOR: {
1211 report(
"G_BUILD_VECTOR must produce a vector from scalar operands", MI);
1216 report(
"G_BUILD_VECTOR result element type must match source type", MI);
1219 report(
"G_BUILD_VECTOR must have an operand for each elemement", MI);
1224 report(
"G_BUILD_VECTOR source operand types are not homogeneous", MI);
1229 case TargetOpcode::G_BUILD_VECTOR_TRUNC: {
1235 report(
"G_BUILD_VECTOR_TRUNC must produce a vector from scalar operands",
1240 report(
"G_BUILD_VECTOR_TRUNC source operand types are not homogeneous",
1244 report(
"G_BUILD_VECTOR_TRUNC source operand types are not larger than " 1249 case TargetOpcode::G_CONCAT_VECTORS: {
1255 report(
"G_CONCAT_VECTOR requires vector source and destination operands",
1260 report(
"G_CONCAT_VECTOR source operand types are not homogeneous", MI);
1264 report(
"G_CONCAT_VECTOR num dest and source elements should match", MI);
1267 case TargetOpcode::G_ICMP:
1268 case TargetOpcode::G_FCMP: {
1274 report(
"Generic vector icmp/fcmp must preserve number of lanes", MI);
1278 case TargetOpcode::G_EXTRACT: {
1280 if (!SrcOp.
isReg()) {
1281 report(
"extract source must be a register", MI);
1286 if (!OffsetOp.
isImm()) {
1287 report(
"extract offset must be a constant", MI);
1293 if (SrcSize == DstSize)
1294 report(
"extract source must be larger than result", MI);
1296 if (DstSize + OffsetOp.
getImm() > SrcSize)
1297 report(
"extract reads past end of register", MI);
1300 case TargetOpcode::G_INSERT: {
1302 if (!SrcOp.
isReg()) {
1303 report(
"insert source must be a register", MI);
1308 if (!OffsetOp.
isImm()) {
1309 report(
"insert offset must be a constant", MI);
1316 if (DstSize <= SrcSize)
1317 report(
"inserted size must be smaller than total register", MI);
1319 if (SrcSize + OffsetOp.
getImm() > DstSize)
1320 report(
"insert writes past end of register", MI);
1324 case TargetOpcode::G_JUMP_TABLE: {
1326 report(
"G_JUMP_TABLE source operand must be a jump table index", MI);
1329 report(
"G_JUMP_TABLE dest operand must have a pointer type", MI);
1332 case TargetOpcode::G_BRJT: {
1334 report(
"G_BRJT src operand 0 must be a pointer type", MI);
1337 report(
"G_BRJT src operand 1 must be a jump table index", MI);
1341 report(
"G_BRJT src operand 2 must be a scalar reg type", MI);
1344 case TargetOpcode::G_INTRINSIC:
1345 case TargetOpcode::G_INTRINSIC_W_SIDE_EFFECTS: {
1350 report(
"G_INTRINSIC first src operand must be an intrinsic ID", MI);
1354 bool NoSideEffects = MI->
getOpcode() == TargetOpcode::G_INTRINSIC;
1356 if (IntrID != 0 && IntrID < Intrinsic::num_intrinsics) {
1360 bool DeclHasSideEffects = !Attrs.
hasFnAttribute(Attribute::ReadNone);
1361 if (NoSideEffects && DeclHasSideEffects) {
1362 report(
"G_INTRINSIC used with intrinsic that accesses memory", MI);
1365 if (!NoSideEffects && !DeclHasSideEffects) {
1366 report(
"G_INTRINSIC_W_SIDE_EFFECTS used with readnone intrinsic", MI);
1371 case Intrinsic::memcpy:
1373 report(
"Expected memcpy intrinsic to have 5 operands", MI);
1375 case Intrinsic::memmove:
1377 report(
"Expected memmove intrinsic to have 5 operands", MI);
1379 case Intrinsic::memset:
1381 report(
"Expected memset intrinsic to have 5 operands", MI);
1386 case TargetOpcode::G_SEXT_INREG: {
1388 report(
"G_SEXT_INREG expects an immediate operand #2", MI);
1394 verifyVectorElementMatch(DstTy, SrcTy, MI);
1398 report(
"G_SEXT_INREG size must be >= 1", MI);
1400 report(
"G_SEXT_INREG size must be less than source bit width", MI);
1403 case TargetOpcode::G_SHUFFLE_VECTOR: {
1406 report(
"Incorrect mask operand type for G_SHUFFLE_VECTOR", MI);
1414 if (Src0Ty != Src1Ty)
1415 report(
"Source operands must be the same type", MI);
1418 report(
"G_SHUFFLE_VECTOR cannot change element type", MI);
1427 if (static_cast<int>(MaskIdxes.
size()) != DstNumElts)
1428 report(
"Wrong result type for shufflemask", MI);
1430 for (
int Idx : MaskIdxes) {
1434 if (Idx >= 2 * SrcNumElts)
1435 report(
"Out of bounds shuffle index", MI);
1440 case TargetOpcode::G_DYN_STACKALLOC: {
1446 report(
"dst operand 0 must be a pointer type", MI);
1451 report(
"src operand 1 must be a scalar reg type", MI);
1455 if (!AlignOp.
isImm()) {
1456 report(
"src operand 2 must be an immediate type", MI);
1466 void MachineVerifier::visitMachineInstrBefore(
const MachineInstr *MI) {
1469 report(
"Too few operands", MI);
1477 report(
"Found PHI instruction with NoPHIs property set", MI);
1480 report(
"Found PHI instruction after non-PHI", MI);
1481 }
else if (FirstNonPHI ==
nullptr)
1486 verifyInlineAsm(MI);
1492 if ((*I)->isLoad() && !MI->
mayLoad())
1493 report(
"Missing mayLoad flag", MI);
1494 if ((*I)->isStore() && !MI->
mayStore())
1495 report(
"Missing mayStore flag", MI);
1504 report(
"Debug instruction has a slot index", MI);
1507 report(
"Instruction inside bundle has a slot index", MI);
1510 report(
"Missing slot index", MI);
1515 verifyPreISelGenericInstruction(MI);
1521 report(ErrorInfo.
data(),
MI);
1525 case TargetOpcode::COPY: {
1534 if (SrcTy != DstTy) {
1535 report(
"Copy Instruction is illegal with mismatching types", MI);
1536 errs() <<
"Def = " << DstTy <<
", Src = " << SrcTy <<
"\n";
1544 assert(SrcSize &&
"Expecting size here");
1545 assert(DstSize &&
"Expecting size here");
1546 if (SrcSize != DstSize)
1548 report(
"Copy Instruction is illegal with mismatching sizes", MI);
1549 errs() <<
"Def Size = " << DstSize <<
", Src Size = " << SrcSize
1555 case TargetOpcode::STATEPOINT:
1559 report(
"meta operands to STATEPOINT not constant!", MI);
1562 auto VerifyStackMapConstant = [&](
unsigned Offset) {
1566 report(
"stack map constant to STATEPOINT not well formed!", MI);
1579 MachineVerifier::visitMachineOperand(
const MachineOperand *MO,
unsigned MONum) {
1583 if (MCID.
getOpcode() == TargetOpcode::PATCHPOINT)
1584 NumDefs = (MONum == 0 && MO->
isReg()) ? NumDefs : 0;
1587 if (MONum < NumDefs) {
1590 report(
"Explicit definition must be a register", MO, MONum);
1592 report(
"Explicit definition marked as use", MO, MONum);
1594 report(
"Explicit definition marked as implicit", MO, MONum);
1603 report(
"Explicit operand marked as def", MO, MONum);
1605 report(
"Explicit operand marked as implicit", MO, MONum);
1611 report(
"Expected a register operand.", MO, MONum);
1614 report(
"Expected a non-register operand.", MO, MONum);
1620 report(
"Tied use must be a register", MO, MONum);
1622 report(
"Operand should be tied", MO, MONum);
1624 report(
"Tied def doesn't match MCInstrDesc", MO, MONum);
1627 if (!MOTied.
isReg())
1628 report(
"Tied counterpart must be a register", &MOTied, TiedTo);
1631 report(
"Tied physical registers must match.", &MOTied, TiedTo);
1634 report(
"Explicit operand should not be tied", MO, MONum);
1638 report(
"Extra explicit operand on non-variadic instruction", MO, MONum);
1647 checkLiveness(MO, MONum);
1653 if (!OtherMO.
isReg())
1654 report(
"Must be tied to a register", MO, MONum);
1656 report(
"Missing tie flags on tied operand", MO, MONum);
1658 report(
"Inconsistent tie links", MO, MONum);
1662 report(
"Explicit def tied to explicit use without tie constraint",
1666 report(
"Explicit def should be tied to implicit use", MO, MONum);
1676 report(
"Two-address instruction operands must be identical", MO, MONum);
1683 report(
"Illegal subregister index for physical register", MO, MONum);
1689 if (!DRC->contains(Reg)) {
1690 report(
"Illegal physical register for instruction", MO, MONum);
1698 report(
"isRenamable set on reserved register", MO, MONum);
1703 report(
"Use-reg is not IsDebug in a DBG_VALUE", MO, MONum);
1713 if (isFunctionSelected) {
1714 report(
"Generic virtual register invalid in a Selected function",
1722 report(
"Generic virtual register must have a valid type", MO,
1730 if (!RegBank && isFunctionRegBankSelected) {
1731 report(
"Generic virtual register must have a bank in a " 1732 "RegBankSelected function",
1738 if (RegBank && Ty.
isValid() &&
1740 report(
"Register bank is too small for virtual register", MO,
1742 errs() <<
"Register bank " << RegBank->
getName() <<
" too small(" 1748 report(
"Generic virtual register does not allow subregister index", MO,
1759 report(
"Virtual register does not match instruction constraint", MO,
1761 errs() <<
"Expect register class " 1764 <<
" but got nothing\n";
1774 report(
"Invalid subregister index for virtual register", MO, MONum);
1776 <<
" does not support subreg index " << SubIdx <<
"\n";
1780 report(
"Invalid register class for subregister index", MO, MONum);
1782 <<
" does not fully support subreg index " << SubIdx <<
"\n";
1793 report(
"No largest legal super class exists.", MO, MONum);
1798 report(
"No matching super-reg register class.", MO, MONum);
1803 report(
"Illegal virtual register for instruction", MO, MONum);
1820 report(
"PHI operand is not in the CFG", MO, MONum);
1835 if (stores && loads) {
1838 if (PSV ==
nullptr)
continue;
1841 if (Value ==
nullptr)
continue;
1850 if (loads == stores)
1851 report(
"Missing fixed stack memoperand.", MI);
1854 report(
"Instruction loads from dead spill slot", MO, MONum);
1855 errs() <<
"Live stack: " << LI <<
'\n';
1858 report(
"Instruction stores to dead spill slot", MO, MONum);
1859 errs() <<
"Live stack: " << LI <<
'\n';
1869 void MachineVerifier::checkLivenessAtUse(
const MachineOperand *MO,
1876 report(
"No live segment at use", MO, MONum);
1877 report_context_liverange(LR);
1878 report_context_vreg_regunit(VRegOrUnit);
1879 report_context(UseIdx);
1882 report(
"Live range continues after kill flag", MO, MONum);
1883 report_context_liverange(LR);
1884 report_context_vreg_regunit(VRegOrUnit);
1886 report_context_lanemask(LaneMask);
1887 report_context(UseIdx);
1891 void MachineVerifier::checkLivenessAtDef(
const MachineOperand *MO,
1895 assert(VNI &&
"NULL valno is not allowed");
1896 if (VNI->
def != DefIdx) {
1897 report(
"Inconsistent valno->def", MO, MONum);
1898 report_context_liverange(LR);
1899 report_context_vreg_regunit(VRegOrUnit);
1901 report_context_lanemask(LaneMask);
1902 report_context(*VNI);
1903 report_context(DefIdx);
1906 report(
"No live segment at def", MO, MONum);
1907 report_context_liverange(LR);
1908 report_context_vreg_regunit(VRegOrUnit);
1910 report_context_lanemask(LaneMask);
1911 report_context(DefIdx);
1918 "Expecting a virtual register.");
1924 if (SubRangeCheck || MO->
getSubReg() == 0) {
1925 report(
"Live range continues after dead def flag", MO, MONum);
1926 report_context_liverange(LR);
1927 report_context_vreg_regunit(VRegOrUnit);
1929 report_context_lanemask(LaneMask);
1935 void MachineVerifier::checkLiveness(
const MachineOperand *MO,
unsigned MONum) {
1937 const unsigned Reg = MO->
getReg();
1942 addRegWithSubRegs(regsKilled, Reg);
1948 report(
"Kill missing from LiveVariables", MO, MONum);
1960 checkLivenessAtUse(MO, MONum, UseIdx, *LR, *Units);
1968 checkLivenessAtUse(MO, MONum, UseIdx, LI, Reg);
1977 if ((MOMask & SR.LaneMask).none())
1979 checkLivenessAtUse(MO, MONum, UseIdx, SR, Reg, SR.LaneMask);
1982 LiveInMask |= SR.LaneMask;
1985 if ((LiveInMask & MOMask).none()) {
1986 report(
"No live subrange at use", MO, MONum);
1988 report_context(UseIdx);
1992 report(
"Virtual register has no live interval", MO, MONum);
1998 if (!regsLive.count(Reg)) {
2001 bool Bad = !isReserved(Reg);
2006 if (regsLive.count(
SubReg)) {
2018 if (!MOP.isReg() || !MOP.isImplicit())
2033 report(
"Using an undefined physical register", MO, MONum);
2035 report(
"Reading virtual register without a def", MO, MONum);
2037 BBInfo &MInfo = MBBInfoMap[MI->
getParent()];
2041 if (MInfo.regsKilled.count(Reg))
2042 report(
"Using a killed virtual register", MO, MONum);
2043 else if (!MI->
isPHI())
2044 MInfo.vregsLiveIn.insert(std::make_pair(Reg, MI));
2053 addRegWithSubRegs(regsDead, Reg);
2055 addRegWithSubRegs(regsDefined, Reg);
2060 report(
"Multiple virtual register defs in SSA form", MO, MONum);
2070 checkLivenessAtDef(MO, MONum, DefIdx, LI, Reg);
2078 if ((SR.LaneMask & MOMask).none())
2080 checkLivenessAtDef(MO, MONum, DefIdx, SR, Reg,
true, SR.LaneMask);
2084 report(
"Virtual register has no Live interval", MO, MONum);
2091 void MachineVerifier::visitMachineInstrAfter(
const MachineInstr *MI) {}
2097 void MachineVerifier::visitMachineBundleAfter(
const MachineInstr *MI) {
2098 BBInfo &MInfo = MBBInfoMap[MI->
getParent()];
2099 set_union(MInfo.regsKilled, regsKilled);
2100 set_subtract(regsLive, regsKilled); regsKilled.clear();
2102 while (!regMasks.empty()) {
2104 for (RegSet::iterator
I = regsLive.begin(),
E = regsLive.end();
I !=
E; ++
I)
2107 regsDead.push_back(*
I);
2110 set_union(regsLive, regsDefined); regsDefined.clear();
2115 MBBInfoMap[MBB].regsLiveOut = regsLive;
2120 if (!(stop > lastIndex)) {
2121 report(
"Block ends before last instruction index", MBB);
2122 errs() <<
"Block ends at " << stop
2123 <<
" last instruction was at " << lastIndex <<
'\n';
2132 void MachineVerifier::calcRegsPassed() {
2136 for (
const auto &MBB : *MF) {
2137 BBInfo &MInfo = MBBInfoMap[&MBB];
2138 if (!MInfo.reachable)
2141 SuE = MBB.
succ_end(); SuI != SuE; ++SuI) {
2142 BBInfo &SInfo = MBBInfoMap[*SuI];
2143 if (SInfo.addPassed(MInfo.regsLiveOut))
2150 while (!todo.
empty()) {
2153 BBInfo &MInfo = MBBInfoMap[MBB];
2155 SuE = MBB->
succ_end(); SuI != SuE; ++SuI) {
2158 BBInfo &SInfo = MBBInfoMap[*SuI];
2159 if (SInfo.addPassed(MInfo.vregsPassed))
2168 void MachineVerifier::calcRegsRequired() {
2171 for (
const auto &MBB : *MF) {
2172 BBInfo &MInfo = MBBInfoMap[&MBB];
2174 PrE = MBB.
pred_end(); PrI != PrE; ++PrI) {
2175 BBInfo &PInfo = MBBInfoMap[*PrI];
2176 if (PInfo.addRequired(MInfo.vregsLiveIn))
2183 while (!todo.
empty()) {
2186 BBInfo &MInfo = MBBInfoMap[MBB];
2188 PrE = MBB->
pred_end(); PrI != PrE; ++PrI) {
2191 BBInfo &SInfo = MBBInfoMap[*PrI];
2192 if (SInfo.addRequired(MInfo.vregsRequired))
2201 BBInfo &MInfo = MBBInfoMap[&MBB];
2211 report(
"Expected first PHI operand to be a register def", &MODef, 0);
2216 report(
"Unexpected flag on PHI operand", &MODef, 0);
2219 report(
"Expected first PHI operand to be a virtual register", &MODef, 0);
2221 for (
unsigned I = 1,
E = Phi.getNumOperands();
I !=
E;
I += 2) {
2224 report(
"Expected PHI operand to be a register", &MO0,
I);
2229 report(
"Unexpected flag on PHI operand", &MO0,
I);
2233 report(
"Expected PHI operand to be a basic block", &MO1,
I + 1);
2239 report(
"PHI input is not a predecessor block", &MO1,
I + 1);
2243 if (MInfo.reachable) {
2245 BBInfo &PrInfo = MBBInfoMap[&Pre];
2246 if (!MO0.
isUndef() && PrInfo.reachable &&
2247 !PrInfo.isLiveOut(MO0.
getReg()))
2248 report(
"PHI operand is not live-out from predecessor", &MO0,
I);
2253 if (MInfo.reachable) {
2255 if (!seen.
count(Pred)) {
2256 report(
"Missing PHI operand", &Phi);
2258 <<
" is a predecessor according to the CFG.\n";
2265 void MachineVerifier::visitMachineFunctionAfter() {
2275 for (
const auto &MBB : *MF) {
2276 BBInfo &MInfo = MBBInfoMap[&MBB];
2277 for (RegSet::iterator
2278 I = MInfo.vregsRequired.begin(),
E = MInfo.vregsRequired.end();
I !=
E;
2280 if (MInfo.regsKilled.count(*
I)) {
2281 report(
"Virtual register killed in block, but needed live out.", &MBB);
2283 <<
" is used after the block.\n";
2288 BBInfo &MInfo = MBBInfoMap[&MF->front()];
2289 for (RegSet::iterator
2290 I = MInfo.vregsRequired.begin(),
E = MInfo.vregsRequired.end();
I !=
E;
2292 report(
"Virtual register defs don't dominate all uses.", MF);
2293 report_context_vreg(*
I);
2298 verifyLiveVariables();
2300 verifyLiveIntervals();
2310 for (
const auto &MBB : *MF)
2314 if (hasAliases || isAllocatable(LiveInReg) || isReserved(LiveInReg))
2317 BBInfo &PInfo = MBBInfoMap[Pred];
2318 if (!PInfo.regsLiveOut.count(LiveInReg)) {
2319 report(
"Live in register not found to be live out from predecessor.",
2322 <<
" not found to be live out from " 2328 for (
auto CSInfo : MF->getCallSitesInfo())
2329 if (!CSInfo.first->isCall())
2330 report(
"Call site info referencing instruction that is not call", MF);
2333 void MachineVerifier::verifyLiveVariables() {
2334 assert(LiveVars &&
"Don't call verifyLiveVariables without LiveVars");
2338 for (
const auto &MBB : *MF) {
2339 BBInfo &MInfo = MBBInfoMap[&MBB];
2342 if (MInfo.vregsRequired.count(Reg)) {
2344 report(
"LiveVariables: Block missing from AliveBlocks", &MBB);
2346 <<
" must be live through the block.\n";
2350 report(
"LiveVariables: Block should not be in AliveBlocks", &MBB);
2352 <<
" is not needed live through the block.\n";
2359 void MachineVerifier::verifyLiveIntervals() {
2360 assert(LiveInts &&
"Don't call verifyLiveIntervals without LiveInts");
2369 report(
"Missing live interval for virtual register", MF);
2370 errs() <<
printReg(Reg, TRI) <<
" still has defs or uses\n";
2375 assert(Reg == LI.
reg &&
"Invalid reg to interval mapping");
2376 verifyLiveInterval(LI);
2382 verifyLiveRange(*LR, i);
2385 void MachineVerifier::verifyLiveRangeValue(
const LiveRange &LR,
2386 const VNInfo *VNI,
unsigned Reg,
2394 report(
"Value not live at VNInfo def and not marked unused", MF);
2395 report_context(LR, Reg, LaneMask);
2396 report_context(*VNI);
2400 if (DefVNI != VNI) {
2401 report(
"Live segment at def has different VNInfo", MF);
2402 report_context(LR, Reg, LaneMask);
2403 report_context(*VNI);
2409 report(
"Invalid VNInfo definition index", MF);
2410 report_context(LR, Reg, LaneMask);
2411 report_context(*VNI);
2417 report(
"PHIDef VNInfo is not defined at MBB start", MBB);
2418 report_context(LR, Reg, LaneMask);
2419 report_context(*VNI);
2427 report(
"No instruction at VNInfo def index", MBB);
2428 report_context(LR, Reg, LaneMask);
2429 report_context(*VNI);
2434 bool hasDef =
false;
2435 bool isEarlyClobber =
false;
2437 if (!MOI->isReg() || !MOI->isDef())
2440 if (MOI->getReg() !=
Reg)
2447 if (LaneMask.
any() &&
2451 if (MOI->isEarlyClobber())
2452 isEarlyClobber =
true;
2456 report(
"Defining instruction does not modify register", MI);
2457 report_context(LR, Reg, LaneMask);
2458 report_context(*VNI);
2463 if (isEarlyClobber) {
2465 report(
"Early clobber def must be at an early-clobber slot", MBB);
2466 report_context(LR, Reg, LaneMask);
2467 report_context(*VNI);
2470 report(
"Non-PHI, non-early clobber def must be at a register slot", MBB);
2471 report_context(LR, Reg, LaneMask);
2472 report_context(*VNI);
2477 void MachineVerifier::verifyLiveRangeSegment(
const LiveRange &LR,
2483 assert(VNI &&
"Live segment has no valno");
2486 report(
"Foreign valno in live segment", MF);
2487 report_context(LR, Reg, LaneMask);
2489 report_context(*VNI);
2493 report(
"Live segment valno is marked unused", MF);
2494 report_context(LR, Reg, LaneMask);
2500 report(
"Bad start of live segment, no basic block", MF);
2501 report_context(LR, Reg, LaneMask);
2507 report(
"Live segment must begin at MBB entry or valno def", MBB);
2508 report_context(LR, Reg, LaneMask);
2515 report(
"Bad end of live segment, no basic block", MF);
2516 report_context(LR, Reg, LaneMask);
2534 report(
"Live segment doesn't end at a valid instruction", EndMBB);
2535 report_context(LR, Reg, LaneMask);
2542 report(
"Live segment ends at B slot of an instruction", EndMBB);
2543 report_context(LR, Reg, LaneMask);
2551 report(
"Live segment ending at dead slot spans instructions", EndMBB);
2552 report_context(LR, Reg, LaneMask);
2560 if (I+1 == LR.
end() || (I+1)->start != S.
end) {
2561 report(
"Live segment ending at early clobber slot must be " 2562 "redefined by an EC def in the same instruction", EndMBB);
2563 report_context(LR, Reg, LaneMask);
2573 bool hasRead =
false;
2574 bool hasSubRegDef =
false;
2575 bool hasDeadDef =
false;
2577 if (!MOI->isReg() || MOI->getReg() !=
Reg)
2579 unsigned Sub = MOI->getSubReg();
2584 hasSubRegDef =
true;
2593 if (LaneMask.
any() && (LaneMask & SLM).none())
2595 if (MOI->readsReg())
2602 if (LaneMask.
none() && !hasDeadDef) {
2603 report(
"Instruction ending live segment on dead slot has no dead flag",
2605 report_context(LR, Reg, LaneMask);
2614 report(
"Instruction ending live segment doesn't read the register",
2616 report_context(LR, Reg, LaneMask);
2635 if (LaneMask.
any()) {
2644 if (&*MFI == EndMBB)
2656 PE = MFI->pred_end(); PI != PE; ++PI) {
2664 if (!PVNI && (LaneMask.
none() || !IsPHI)) {
2667 report(
"Register not marked live out of predecessor", *PI);
2668 report_context(LR, Reg, LaneMask);
2669 report_context(*VNI);
2677 if (!IsPHI && PVNI != VNI) {
2678 report(
"Different value live out of predecessor", *PI);
2679 report_context(LR, Reg, LaneMask);
2680 errs() <<
"Valno #" << PVNI->
id <<
" live out of " 2686 if (&*MFI == EndMBB)
2692 void MachineVerifier::verifyLiveRange(
const LiveRange &LR,
unsigned Reg,
2695 verifyLiveRangeValue(LR, VNI, Reg, LaneMask);
2698 verifyLiveRangeSegment(LR, I, Reg, LaneMask);
2701 void MachineVerifier::verifyLiveInterval(
const LiveInterval &LI) {
2702 unsigned Reg = LI.
reg;
2704 verifyLiveRange(LI, Reg);
2709 if ((Mask & SR.LaneMask).any()) {
2710 report(
"Lane masks of sub ranges overlap in live interval", MF);
2713 if ((SR.LaneMask & ~MaxMask).any()) {
2714 report(
"Subrange lanemask is invalid", MF);
2718 report(
"Subrange must not be empty", MF);
2719 report_context(SR, LI.
reg, SR.LaneMask);
2721 Mask |= SR.LaneMask;
2722 verifyLiveRange(SR, LI.
reg, SR.LaneMask);
2724 report(
"A Subrange is not covered by the main range", MF);
2731 unsigned NumComp = ConEQ.
Classify(LI);
2733 report(
"Multiple connected components in live interval", MF);
2735 for (
unsigned comp = 0; comp != NumComp; ++comp) {
2736 errs() << comp <<
": valnos";
2740 errs() <<
' ' << (*I)->id;
2752 struct StackStateOfBB {
2753 StackStateOfBB() =
default;
2754 StackStateOfBB(
int EntryVal,
int ExitVal,
bool EntrySetup,
bool ExitSetup) :
2755 EntryValue(EntryVal), ExitValue(ExitVal), EntryIsSetup(EntrySetup),
2756 ExitIsSetup(ExitSetup) {}
2761 bool EntryIsSetup =
false;
2762 bool ExitIsSetup =
false;
2770 void MachineVerifier::verifyStackFrame() {
2773 if (FrameSetupOpcode == ~0u && FrameDestroyOpcode == ~0u)
2784 DFI != DFE; ++DFI) {
2787 StackStateOfBB BBState;
2789 if (DFI.getPathLength() >= 2) {
2792 "DFS stack predecessor is already visited.\n");
2793 BBState.EntryValue = SPState[StackPred->
getNumber()].ExitValue;
2794 BBState.EntryIsSetup = SPState[StackPred->
getNumber()].ExitIsSetup;
2795 BBState.ExitValue = BBState.EntryValue;
2796 BBState.ExitIsSetup = BBState.EntryIsSetup;
2800 for (
const auto &I : *MBB) {
2801 if (I.getOpcode() == FrameSetupOpcode) {
2802 if (BBState.ExitIsSetup)
2803 report(
"FrameSetup is after another FrameSetup", &I);
2805 BBState.ExitIsSetup =
true;
2808 if (I.getOpcode() == FrameDestroyOpcode) {
2810 if (!BBState.ExitIsSetup)
2811 report(
"FrameDestroy is not after a FrameSetup", &I);
2812 int AbsSPAdj = BBState.ExitValue < 0 ? -BBState.ExitValue :
2814 if (BBState.ExitIsSetup && AbsSPAdj != Size) {
2815 report(
"FrameDestroy <n> is after FrameSetup <m>", &I);
2816 errs() <<
"FrameDestroy <" << Size <<
"> is after FrameSetup <" 2817 << AbsSPAdj <<
">.\n";
2819 BBState.ExitValue +=
Size;
2820 BBState.ExitIsSetup =
false;
2823 SPState[MBB->getNumber()] = BBState;
2828 E = MBB->pred_end(); I !=
E; ++
I) {
2829 if (Reachable.
count(*I) &&
2830 (SPState[(*I)->getNumber()].ExitValue != BBState.EntryValue ||
2831 SPState[(*I)->getNumber()].ExitIsSetup != BBState.EntryIsSetup)) {
2832 report(
"The exit stack state of a predecessor is inconsistent.", MBB);
2834 <<
" has exit state (" << SPState[(*I)->getNumber()].ExitValue
2835 <<
", " << SPState[(*I)->getNumber()].ExitIsSetup <<
"), while " 2837 << BBState.EntryValue <<
", " << BBState.EntryIsSetup <<
").\n";
2844 E = MBB->succ_end(); I !=
E; ++
I) {
2845 if (Reachable.
count(*I) &&
2846 (SPState[(*I)->getNumber()].EntryValue != BBState.ExitValue ||
2847 SPState[(*I)->getNumber()].EntryIsSetup != BBState.ExitIsSetup)) {
2848 report(
"The entry stack state of a successor is inconsistent.", MBB);
2850 <<
" has entry state (" << SPState[(*I)->getNumber()].EntryValue
2851 <<
", " << SPState[(*I)->getNumber()].EntryIsSetup <<
"), while " 2853 << BBState.ExitValue <<
", " << BBState.ExitIsSetup <<
").\n";
2858 if (!MBB->empty() && MBB->back().isReturn()) {
2859 if (BBState.ExitIsSetup)
2860 report(
"A return block ends with a FrameSetup.", MBB);
2861 if (BBState.ExitValue)
2862 report(
"A return block ends with a nonzero stack adjustment.", MBB);
ArrayRef< int > getShuffleMask() const
Pass interface - Implemented by all 'passes'.
bool isPHIDef() const
Returns true if this value is defined by a PHI instruction (or was, PHI instructions may have been el...
bool isRegister() const
isRegister - Returns true if this is a normal register use/def slot.
mop_iterator operands_end()
A common definition of LaneBitmask for use in TableGen and CodeGen.
raw_ostream & errs()
This returns a reference to a raw_ostream for standard error.
MachineInstr * getParent()
getParent - Return the instruction that this operand belongs to.
static PassRegistry * getPassRegistry()
getPassRegistry - Access the global registry object, which is automatically initialized at applicatio...
bool isReserved(Register PhysReg) const
isReserved - Returns true when PhysReg is a reserved register.
MachineBasicBlock * getMBB() const
SlotIndex def
The index of the defining instruction.
LaneBitmask getMaxLaneMaskForVReg(unsigned Reg) const
Returns a mask covering all bits that can appear in lane masks of subregisters of the virtual registe...
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.
iterator_range< mop_iterator > uses()
Returns a range that includes all operands that are register uses.
const char * getName() const
Get a user friendly name of this register bank.
unsigned getScalarSizeInBits() const
virtual const TargetRegisterInfo * getRegisterInfo() const
getRegisterInfo - If register information is available, return it.
unsigned getNumBlockIDs() const
getNumBlockIDs - Return the number of MBB ID's allocated.
unsigned getSizeInBits(Register Reg, const MachineRegisterInfo &MRI, const TargetRegisterInfo &TRI) const
Get the size in bits of Reg.
const MachineFunctionProperties & getProperties() const
Get the function properties.
int64_t getFrameTotalSize(const MachineInstr &I) const
Returns the total frame size, which is made up of the space set up inside the pair of frame start-sto...
setjmp/longjmp based exceptions
bool isShuffleMask() const
static bool isPhysicalRegister(unsigned Reg)
Return true if the specified register number is in the physical register namespace.
LiveInterval - This class represents the liveness of a register, or stack slot.
Describe properties that are true of each instruction in the target description file.
static bool matchPair(MachineBasicBlock::const_succ_iterator i, const MachineBasicBlock *a, const MachineBasicBlock *b)
unsigned getSubReg() const
MBBIndexIterator MBBIndexEnd() const
Return an iterator for the end of the idx2MBBMap.
bool isValid() const
isValid - Returns true until all the operands have been visited.
bool test(unsigned Idx) const
LLT getScalarType() const
bool isDead() const
isDead - Returns true if this is a dead def kill slot.
LiveInterval & getInterval(int Slot)
LLT getType(unsigned Reg) const
Get the low-level type of Reg or LLT{} if Reg is not a generic (target independent) virtual register...
uint64_t getSize() const
Return the size in bytes of the memory reference.
bool isDeadDef() const
Return true if this instruction has a dead def.
static unsigned getSizeInBits(const fltSemantics &Sem)
Returns the size of the floating point number (in bits) in the given semantics.
A live range for subregisters.
bool isMetadata() const
isMetadata - Tests if this is a MO_Metadata operand.
bool all_of(R &&range, UnaryPredicate P)
Provide wrappers to std::all_of which take ranges instead of having to pass begin/end explicitly...
bool isValid() const
Returns true if this is a valid index.
MachineBasicBlock reference.
This represents a simple continuous liveness interval for a value.
VarInfo - This represents the regions where a virtual register is live in the program.
unsigned const TargetRegisterInfo * TRI
Printable PrintLaneMask(LaneBitmask LaneMask)
Create Printable object to print LaneBitmasks on a raw_ostream.
int getFrameIndex() const
const fltSemantics & getSemantics() const
unsigned getCallFrameDestroyOpcode() const
Printable printReg(Register Reg, const TargetRegisterInfo *TRI=nullptr, unsigned SubIdx=0, const MachineRegisterInfo *MRI=nullptr)
Prints virtual and physical registers with or without a TRI instance.
static unsigned index2VirtReg(unsigned Index)
Convert a 0-based index to a virtual register number.
const Instruction * getTerminator() const LLVM_READONLY
Returns the terminator instruction if the block is well formed or null if the block is not well forme...
bool reservedRegsFrozen() const
reservedRegsFrozen - Returns true after freezeReservedRegs() was called to ensure the set of reserved...
std::vector< MachineBasicBlock * >::const_iterator const_pred_iterator
VNInfo - Value Number Information.
void print(raw_ostream &O, const Module *=nullptr) const override
Implement the dump method.
bool isImm() const
isImm - Tests if this is a MO_Immediate operand.
void verifyUseLists() const
Verify the use list of all registers.
unsigned getNumRegUnits() const
Return the number of (native) register units in the target.
unsigned getSizeInBytes() const
Returns the total size of the type in bytes, i.e.
unsigned getBitWidth() const
getBitWidth - Return the bitwidth of this constant.
LegalityPredicate isPointer(unsigned TypeIdx)
True iff the specified type index is a pointer (with any address space).
bool isInternalRead() const
This class represents the liveness of a register, stack slot, etc.
void initializeMachineVerifierPassPass(PassRegistry &)
bool isUnused() const
Returns true if this value is unused.
Mask of preserved registers.
bool isEarlyClobber() const
bool isIntrinsicID() const
const char * getRegClassName(const TargetRegisterClass *Class) const
Returns the name of the register class.
bool test(unsigned Idx) const
FunctionPass * createMachineVerifierPass(const std::string &Banner)
createMachineVerifierPass - This pass verifies cenerated machine code instructions for correctness...
bool isNotInMIMap(const MachineInstr &Instr) const
Returns true if the specified machine instr has been removed or was never entered in the map...
bool isBlock() const
isBlock - Returns true if this is a block boundary slot.
A description of a memory reference used in the backend.
void clear()
clear - Removes all bits from the bitvector. Does not change capacity.
SlotIndex getDeadSlot() const
Returns the dead def kill slot for the current instruction.
MachineFunctionPass - This class adapts the FunctionPass interface to allow convenient creation of pa...
Twine - A lightweight data structure for efficiently representing the concatenation of temporary valu...
unsigned getNumOperands() const
Return the number of declared MachineOperands for this MachineInstruction.
const HexagonInstrInfo * TII
Printable printMBBReference(const MachineBasicBlock &MBB)
Prints a machine basic block reference.
unsigned getVarIdx() const
Get starting index of non call related arguments (calling convention, statepoint flags, vm state and gc state).
bool isLiveInToMBB(const LiveRange &LR, const MachineBasicBlock *mbb) const
const ConstantFP * getFPImm() const
unsigned getNumOperands() const
Retuns the total number of operands.
virtual const TargetRegisterClass * getRegClass(const MCInstrDesc &MCID, unsigned OpNum, const TargetRegisterInfo *TRI, const MachineFunction &MF) const
Given a machine instruction descriptor, returns the register class constraint for OpNum...
iterator_range< subrange_iterator > subranges()
Result of a LiveRange query.
static constexpr LaneBitmask getAll()
bool isTerminator(QueryType Type=AnyInBundle) const
Returns true if this instruction part of the terminator for a basic block.
SlotIndex getInstructionIndex(const MachineInstr &MI) const
Returns the base index for the given instruction.
The MachineFrameInfo class represents an abstract stack frame until prolog/epilog code is inserted...
unsigned getOpcode() const
Returns the opcode of this MachineInstr.
bool hasSubRanges() const
Returns true if subregister liveness information is available.
SmallVectorImpl< IdxMBBPair >::const_iterator MBBIndexIterator
Iterator over the idx2MBBMap (sorted pairs of slot index of basic block begin and basic block) ...
virtual const TargetRegisterClass * getSubClassWithSubReg(const TargetRegisterClass *RC, unsigned Idx) const
Returns the largest legal sub-class of RC that supports the sub-register index Idx.
def_iterator def_begin(unsigned RegNo) const
SparseBitVector AliveBlocks
AliveBlocks - Set of blocks in which this value is alive completely through.
static constexpr LaneBitmask getNone()
LLT getElementType() const
Returns the vector's element type. Only valid for vector types.
Printable printRegUnit(unsigned Unit, const TargetRegisterInfo *TRI)
Create Printable object to print register units on a raw_ostream.
unsigned getEqClass(const VNInfo *VNI) const
getEqClass - Classify creates equivalence classes numbered 0..N.
bool isScopedEHPersonality(EHPersonality Pers)
Returns true if this personality uses scope-style EH IR instructions: catchswitch, catchpad/ret, and cleanuppad/ret.
AttributeList getAttributes(LLVMContext &C, ID id)
Return the attributes for an intrinsic.
uint8_t OperandType
Information about the type of the operand.
bool hasRegUnit(unsigned Reg, unsigned RegUnit) const
Returns true if Reg contains RegUnit.
MachineInstr * getInstructionFromIndex(SlotIndex index) const
Returns the instruction associated with the given index.
bool readsReg() const
readsReg - Returns true if this operand reads the previous value of its register. ...
const MCInstrDesc & getDesc() const
Returns the target instruction descriptor of this MachineInstr.
bool hasInterval(Register Reg) const
SlotIndex getRegSlot(bool EC=false) const
Returns the register use/def slot in the current instruction for a normal or early-clobber def...
uint64_t getSizeInBits() const
Return the size in bits of the memory reference.
bool isFPImm() const
isFPImm - Tests if this is a MO_FPImmediate operand.
virtual const TargetRegisterClass * getLargestLegalSuperClass(const TargetRegisterClass *RC, const MachineFunction &) const
Returns the largest super class of RC that is legal to use in the current sub-target and has the same...
int getNumber() const
MachineBasicBlocks are uniquely numbered at the function level, unless they're not in a MachineFuncti...
virtual const TargetInstrInfo * getInstrInfo() const
constexpr char Attrs[]
Key for Kernel::Metadata::mAttrs.
bool isInsideBundle() const
Return true if MI is in a bundle (but not the first MI in a bundle).
iterator_range< mc_subreg_iterator > subregs_inclusive(MCRegister Reg) const
Return an iterator range over all sub-registers of Reg, including Reg.
bool isKill() const
Return true if the live-in value is killed by this instruction.
LiveRange * getCachedRegUnit(unsigned Unit)
Return the live range for register unit Unit if it has already been computed, or nullptr if it hasn't...
StringRef getName() const
getName - Return the name of the corresponding LLVM function.
uint16_t MCPhysReg
An unsigned integer type large enough to represent all physical registers, but not necessarily virtua...
VNInfo * valueIn() const
Return the value that is live-in to the instruction.
LiveQueryResult Query(SlotIndex Idx) const
Query Liveness at Idx.
TargetInstrInfo - Interface to description of machine instruction set.
This class is intended to be used as a base class for asm properties and features specific to the tar...
VNInfo * getVNInfoAt(SlotIndex Idx) const
getVNInfoAt - Return the VNInfo that is live at Idx, or NULL.
bool isGenericType() const
bool mayStore(QueryType Type=AnyInBundle) const
Return true if this instruction could possibly modify memory.
unsigned getNumRegs() const
Return the number of registers this target has (useful for sizing arrays holding per register informa...
unsigned const MachineRegisterInfo * MRI
VNInfoList::const_iterator const_vni_iterator
StringRef getName() const
Return the name of the corresponding LLVM basic block, or an empty string.
bool hasSuperClassEq(const TargetRegisterClass *RC) const
Returns true if RC is a super-class of or equal to this class.
ArrayRef< MachineMemOperand * > memoperands() const
Access to memory operands of the instruction.
LLVM Basic Block Representation.
bool isOptionalDef() const
Set if this operand is a optional def.
const TargetSubtargetInfo & getSubtarget() const
getSubtarget - Return the subtarget for which this machine code is being compiled.
void getAnalysisUsage(AnalysisUsage &AU) const override
getAnalysisUsage - Subclasses that override getAnalysisUsage must call this.
df_ext_iterator< T, SetTy > df_ext_end(const T &G, SetTy &S)
bool liveAt(SlotIndex index) const
MachineFrameInfo & getFrameInfo()
getFrameInfo - Return the frame info object for the current function.
size_t size() const
size - Get the array size.
static GCRegistry::Add< CoreCLRGC > E("coreclr", "CoreCLR-compatible GC")
LLVM_NODISCARD bool empty() const
unsigned Classify(const LiveRange &LR)
Classify the values in LR into connected components.
const MCAsmInfo * getMCAsmInfo() const
Return target specific asm information.
ConstantFP - Floating Point Values [float, double].
std::pair< iterator, bool > insert(PtrType Ptr)
Inserts Ptr if and only if there is no element in the container equal to Ptr.
bool hasIndex(const MachineInstr &instr) const
Returns true if the given machine instr is mapped to an index, otherwise returns false.
bool isCImm() const
isCImm - Test if this is a MO_CImmediate operand.
static unsigned getNumOperandRegisters(unsigned Flag)
getNumOperandRegisters - Extract the number of registers field from the inline asm operand flag...
virtual bool verifyInstruction(const MachineInstr &MI, StringRef &ErrInfo) const
Perform target-specific instruction verification.
unsigned getCallFrameSetupOpcode() const
These methods return the opcode of the frame setup/destroy instructions if they exist (-1 otherwise)...
EHPersonality classifyEHPersonality(const Value *Pers)
See if the given exception handling personality function is one that we understand.
SlotIndex getMBBStartIdx(unsigned Num) const
Returns the first index in the given basic block number.
MCRegAliasIterator enumerates all registers aliasing Reg.
Represent the analysis usage information of a pass.
df_ext_iterator< T, SetTy > df_ext_begin(const T &G, SetTy &S)
bool hasOneMemOperand() const
Return true if this instruction has exactly one MachineMemOperand.
constexpr bool none() const
bool reg_nodbg_empty(Register RegNo) const
reg_nodbg_empty - Return true if the only instructions using or defining Reg are Debug instructions...
FunctionPass class - This class is used to implement most global optimizations.
bool isRegTiedToDefOperand(unsigned UseOpIdx, unsigned *DefOpIdx=nullptr) const
Return true if the use operand of the specified index is tied to a def operand.
virtual const TargetRegisterClass * getMatchingSuperRegClass(const TargetRegisterClass *A, const TargetRegisterClass *B, unsigned Idx) const
Return a subclass of the specified register class A so that each register in it has a sub-register of...
bool def_empty(unsigned RegNo) const
def_empty - Return true if there are no instructions defining the specified register (it may be live-...
MBBIndexIterator MBBIndexBegin() const
Returns an iterator for the begin of the idx2MBBMap.
const RegisterBank * getRegBankOrNull(unsigned Reg) const
Return the register bank of Reg, or null if Reg has not been assigned a register bank or has been ass...
std::vector< MachineBasicBlock * >::const_iterator const_succ_iterator
size_type count(ConstPtrType Ptr) const
count - Return 1 if the specified pointer is in the set, 0 otherwise.
self_iterator getIterator()
LiveInterval & getInterval(Register Reg)
unsigned getAddressSpace() const
iterator_range< pred_iterator > predecessors()
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.
MachineBasicBlock * getMBBFromIndex(SlotIndex index) const
unsigned getNumVirtRegs() const
getNumVirtRegs - Return the number of virtual registers created.
SlotIndex getMBBStartIdx(const MachineBasicBlock *mbb) const
Return the first index in the given basic block.
LLVMContext & getContext() const
getContext - Return a reference to the LLVMContext associated with this function. ...
succ_iterator succ_begin()
SlotIndex getMBBEndIdx(unsigned Num) const
Returns the last index in the given basic block number.
VarInfo & getVarInfo(unsigned RegIdx)
getVarInfo - Return the VarInfo structure for the specified VIRTUAL register.
virtual bool analyzeBranch(MachineBasicBlock &MBB, MachineBasicBlock *&TBB, MachineBasicBlock *&FBB, SmallVectorImpl< MachineOperand > &Cond, bool AllowModify=false) const
Analyze the branching code at the end of MBB, returning true if it cannot be understood (e...
TargetRegisterInfo base class - We assume that the target defines a static array of TargetRegisterDes...
const MachineBasicBlock & front() const
pred_iterator pred_begin()
virtual bool isPredicated(const MachineInstr &MI) const
Returns true if the instruction is already predicated.
bool isDebugInstr() const
void print(raw_ostream &OS, const SlotIndexes *=nullptr) const
print - Print out the MachineFunction in a format suitable for debugging to the specified stream...
bool verify(const TargetRegisterInfo &TRI) const
Check that information hold by this instance make sense for the given TRI.
const APFloat & getValueAPF() const
std::vector< MachineInstr * > Kills
Kills - List of MachineInstruction's which are the last use of this virtual register (kill it) in the...
unsigned id
The ID number of this value.
int getOperandConstraint(unsigned OpNum, MCOI::OperandConstraint Constraint) const
Returns the value of the specific constraint if it is set.
unsigned findTiedOperandIdx(unsigned OpIdx) const
Given the index of a tied register operand, find the operand it is tied to.
Iterator for intrusive lists based on ilist_node.
bool covers(const LiveRange &Other) const
Returns true if all segments of the Other live range are completely covered by this live range...
ConstMIBundleOperands - Iterate over all operands in a const bundle of machine instructions.
bool isJTI() const
isJTI - Tests if this is a MO_JumpTableIndex operand.
This is the shared class of boolean and integer constants.
Align max(MaybeAlign Lhs, Align Rhs)
bool erase(PtrType Ptr)
erase - If the set contains the specified pointer, remove it and return true, otherwise return false...
static bool isSameInstr(SlotIndex A, SlotIndex B)
isSameInstr - Return true if A and B refer to the same instruction.
mmo_iterator memoperands_begin() const
Access to memory operands of the instruction.
Segments::const_iterator const_iterator
void print(raw_ostream &os, const TargetRegisterInfo *TRI=nullptr, const TargetIntrinsicInfo *IntrinsicInfo=nullptr) const
Print the MachineOperand to os.
bool isDebugValue() const
ConnectedVNInfoEqClasses - Helper class that can divide VNInfos in a LiveInterval into equivalence cl...
MachineOperand class - Representation of each machine instruction operand.
bool isInAllocatableClass(unsigned RegNo) const
Return true if the register is in the allocation of any register class.
Intrinsic::ID getIntrinsicID() const
modulo schedule Modulo Schedule test pass
unsigned getSizeInBits() const
Returns the total size of the type. Must only be called on sized types.
bool isReservedRegUnit(unsigned Unit) const
Returns true when the given register unit is considered reserved.
LaneBitmask getSubRegIndexLaneMask(unsigned SubIdx) const
Return a bitmask representing the parts of a register that are covered by SubIdx. ...
LegalityPredicate isScalar(unsigned TypeIdx)
True iff the specified type index is a scalar.
unsigned getNumDefs() const
Return the number of MachineOperands that are register definitions.
bool isVariadic(QueryType Type=IgnoreBundle) const
Return true if this instruction can have a variable number of operands.
This class implements the register bank concept.
unsigned pred_size() const
const Function & getFunction() const
Return the LLVM function that this machine code represents.
INITIALIZE_PASS(MachineVerifierPass, "machineverifier", "Verify generated machine code", false, false) FunctionPass *llvm
static bool clobbersPhysReg(const uint32_t *RegMask, unsigned PhysReg)
clobbersPhysReg - Returns true if this RegMask clobbers PhysReg.
const uint32_t * getRegMask() const
getRegMask - Returns a bit mask of registers preserved by this RegMask operand.
VNInfo * getVNInfoBefore(SlotIndex Idx) const
getVNInfoBefore - Return the VNInfo that is live up to but not necessarilly including Idx...
void computeSubRangeUndefs(SmallVectorImpl< SlotIndex > &Undefs, LaneBitmask LaneMask, const MachineRegisterInfo &MRI, const SlotIndexes &Indexes) const
For a given lane mask LaneMask, compute indexes at which the lane is marked undefined by subregister ...
virtual BitVector getReservedRegs(const MachineFunction &MF) const =0
Returns a bitset indexed by physical register number indicating if a register is a special register t...
Special value supplied for machine level alias analysis.
bool isValid() const
isValid - returns true if this iterator is not yet at the end.
static unsigned getReg(const void *D, unsigned RC, unsigned RegNo)
const char * getName(MCRegister RegNo) const
Return the human-readable symbolic target-specific name for the specified physical register...
void setPreservesAll()
Set by analyses that do not transform their input at all.
bool isEarlyClobber() const
isEarlyClobber - Returns true if this is an early-clobber slot.
bool isRenamable() const
isRenamable - Returns true if this register may be renamed, i.e.
SlotIndex getMBBEndIdx(const MachineBasicBlock *mbb) const
Return the last index in the given basic block.
Base class for user error types.
const BitVector & getReservedRegs() const
getReservedRegs - Returns a reference to the frozen set of reserved registers.
unsigned succ_size() const
VNInfo * getValNumInfo(unsigned ValNo)
getValNumInfo - Returns pointer to the specified val#.
SlotIndex getInstructionIndex(const MachineInstr &Instr) const
Returns the base index of the given instruction.
const MachineBasicBlock * getParent() const
MachineRegisterInfo - Keep track of information for virtual and physical registers, including vreg register classes, use/def chains for registers, etc.
unsigned getNumValNums() const
void set_subtract(S1Ty &S1, const S2Ty &S2)
set_subtract(A, B) - Compute A := A - B
Representation of each machine instruction.
const MachineFunction * getParent() const
Return the MachineFunction containing this basic block.
MachineRegisterInfo & getRegInfo()
getRegInfo - Return information about the registers currently in use.
SlotIndex getPrevSlot() const
Returns the previous slot in the index list.
bool isEHPad() const
Returns true if the block is a landing pad.
LLVM_NODISCARD bool empty() const
bool verify(Pass *p=nullptr, const char *Banner=nullptr, bool AbortOnError=true) const
Run the current MachineFunction through the machine code verifier, useful for debugger use...
constexpr bool any() const
Pair of physical register and lane mask.
bool isFI() const
isFI - Tests if this is a MO_FrameIndex operand.
MI-level Statepoint operands.
const BasicBlock * getBasicBlock() const
Return the LLVM basic block that this instance corresponded to originally.
bool tracksLiveness() const
tracksLiveness - Returns true when tracking register liveness accurately.
LLVM_NODISCARD std::enable_if<!is_simple_type< Y >::value, typename cast_retty< X, const Y >::ret_type >::type dyn_cast(const Y &Val)
size_type size() const
size - Returns the number of bits in this bitvector.
bool isSuccessor(const MachineBasicBlock *MBB) const
Return true if the specified MBB is a successor of this block.
Abstract Stack Frame Index.
const LLVMTargetMachine & getTarget() const
getTarget - Return the target machine this machine code is compiled with
bool shouldTrackSubRegLiveness(const TargetRegisterClass &RC) const
Returns true if liveness for register class RC should be tracked at the subregister level...
size_type count(const_arg_type_t< KeyT > Val) const
Return 1 if the specified key is in the map, 0 otherwise.
bool isSymbol() const
isSymbol - Tests if this is a MO_ExternalSymbol operand.
bool isDebugEntryValue() const
A DBG_VALUE is an entry value iff its debug expression contains the DW_OP_LLVM_entry_value operation...
unsigned getNumExplicitDefs() const
Returns the number of non-implicit definitions.
iterator_range< livein_iterator > liveins() const
bool isReg() const
isReg - Tests if this is a MO_Register operand.
iterator_range< mc_subreg_iterator > subregs(MCRegister Reg) const
Return an iterator range over all sub-registers of Reg, excluding Reg.
LLVM_NODISCARD const char * data() const
data - Get a pointer to the start of the string (which may not be null terminated).
bool hasFnAttribute(Attribute::AttrKind Kind) const
Equivalent to hasAttribute(AttributeList::FunctionIndex, Kind) but may be faster. ...
bool mayLoad(QueryType Type=AnyInBundle) const
Return true if this instruction could possibly read memory.
const TargetRegisterClass * getRegClassOrNull(unsigned Reg) const
Return the register class of Reg, or null if Reg has not been assigned a register class yet...
assert(ImpDefSCC.getReg()==AMDGPU::SCC &&ImpDefSCC.isDef())
bool hasProperty(Property P) const
bool hasInterval(int Slot) const
static def_iterator def_end()
unsigned getSize() const
Get the maximal size in bits that fits in this register bank.
bool isPreISelGenericOpcode(unsigned Opcode)
Check whether the given Opcode is a generic opcode that is not supposed to appear after ISel...
iterator_range< const_set_bits_iterator > set_bits() const
LLVM Value Representation.
Constant * getPersonalityFn() const
Get the personality function associated with this function.
mop_iterator operands_begin()
uint16_t getNumElements() const
Returns the number of elements in a vector LLT.
AnalysisType * getAnalysisIfAvailable() const
getAnalysisIfAvailable<AnalysisType>() - Subclasses use this function to get analysis information tha...
static bool isVirtualRegister(unsigned Reg)
Return true if the specified register number is in the virtual register namespace.
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.
ExceptionHandling getExceptionHandlingType() const
unsigned getOpcode() const
Return the opcode number for this descriptor.
Primary interface to the complete machine description for the target machine.
static bool isLiveOut(const MachineBasicBlock &MBB, unsigned Reg)
unsigned getGenericTypeIndex() const
bool isBarrier(QueryType Type=AnyInBundle) const
Returns true if the specified instruction stops control flow from executing the instruction immediate...
StringRef - Represent a constant reference to a string, i.e.
BitVector getPristineRegs(const MachineFunction &MF) const
Return a set of physical registers that are pristine.
bool isMBB() const
isMBB - Tests if this is a MO_MachineBasicBlock operand.
unsigned getRegSizeInBits(const TargetRegisterClass &RC) const
Return the size in bits of a register from class RC.
A specialized PseudoSourceValue for holding FixedStack values, which must include a frame index...
Register getReg() const
getReg - Returns the register number.
This holds information about one operand of a machine instruction, indicating the register class for ...
const MachineOperand & getOperand(unsigned i) const
const ConstantInt * getCImm() const
SlotIndex - An opaque wrapper around machine indexes.
MachineOperandType getType() const
getType - Returns the MachineOperandType for this operand.
bool set_union(S1Ty &S1, const S2Ty &S2)
set_union(A, B) - Compute A := A u B, return whether A changed.
static LLVM_ATTRIBUTE_UNUSED bool isJointlyDominated(const MachineBasicBlock *MBB, ArrayRef< SlotIndex > Defs, const SlotIndexes &Indexes)
A diagnostic function to check if the end of the block MBB is jointly dominated by the blocks corresp...
Wrapper class representing virtual and physical registers.
mmo_iterator memoperands_end() const
Access to memory operands of the instruction.
bool is_contained(R &&Range, const E &Element)
Wrapper function around std::find to detect if an element exists in a container.