48#include "llvm/Config/llvm-config.h"
68#define DEBUG_TYPE "livedebugvars"
74STATISTIC(NumInsertedDebugValues,
"Number of DBG_VALUEs inserted");
75STATISTIC(NumInsertedDebugLabels,
"Number of DBG_LABELs inserted");
80 "Debug Variable Analysis",
false,
false)
100class DbgVariableValue {
102 DbgVariableValue(ArrayRef<unsigned> NewLocs,
bool WasIndirect,
bool WasList,
103 const DIExpression &Expr)
104 : WasIndirect(WasIndirect), WasList(WasList), Expression(&Expr) {
105 assert(!(WasIndirect && WasList) &&
106 "DBG_VALUE_LISTs should not be indirect.");
107 SmallVector<unsigned> LocNoVec;
108 for (
unsigned LocNo : NewLocs) {
109 auto It =
find(LocNoVec, LocNo);
110 if (It == LocNoVec.
end())
116 unsigned DuplicatingIdx = std::distance(LocNoVec.
begin(), It);
127 if (LocNoVec.
size() < 64) {
128 LocNoCount = LocNoVec.
size();
129 if (LocNoCount > 0) {
130 LocNos = std::make_unique<unsigned[]>(LocNoCount);
135 "locations, dropping...\n");
140 DIExpression::get(Expr.
getContext(), {dwarf::DW_OP_LLVM_arg, 0});
143 Expression, FragmentInfoOpt->OffsetInBits,
144 FragmentInfoOpt->SizeInBits);
145 LocNos = std::make_unique<unsigned[]>(LocNoCount);
150 DbgVariableValue() : LocNoCount(0), WasIndirect(
false), WasList(
false) {}
151 DbgVariableValue(
const DbgVariableValue &
Other)
152 : LocNoCount(
Other.LocNoCount), WasIndirect(
Other.getWasIndirect()),
153 WasList(
Other.getWasList()), Expression(
Other.getExpression()) {
154 if (
Other.getLocNoCount()) {
155 LocNos.reset(new unsigned[Other.getLocNoCount()]);
156 std::copy(Other.loc_nos_begin(), Other.loc_nos_end(), loc_nos_begin());
160 DbgVariableValue &operator=(
const DbgVariableValue &
Other) {
163 if (
Other.getLocNoCount()) {
164 LocNos.reset(
new unsigned[
Other.getLocNoCount()]);
165 std::copy(
Other.loc_nos_begin(),
Other.loc_nos_end(), loc_nos_begin());
169 LocNoCount =
Other.getLocNoCount();
170 WasIndirect =
Other.getWasIndirect();
171 WasList =
Other.getWasList();
172 Expression =
Other.getExpression();
176 const DIExpression *getExpression()
const {
return Expression; }
177 uint8_t getLocNoCount()
const {
return LocNoCount; }
178 bool containsLocNo(
unsigned LocNo)
const {
181 bool getWasIndirect()
const {
return WasIndirect; }
182 bool getWasList()
const {
return WasList; }
185 DbgVariableValue decrementLocNosAfterPivot(
unsigned Pivot)
const {
186 SmallVector<unsigned, 4> NewLocNos;
187 for (
unsigned LocNo : loc_nos())
190 return DbgVariableValue(NewLocNos, WasIndirect, WasList, *Expression);
193 DbgVariableValue remapLocNos(ArrayRef<unsigned> LocNoMap)
const {
194 SmallVector<unsigned> NewLocNos;
195 for (
unsigned LocNo : loc_nos())
199 return DbgVariableValue(NewLocNos, WasIndirect, WasList, *Expression);
202 DbgVariableValue changeLocNo(
unsigned OldLocNo,
unsigned NewLocNo)
const {
203 SmallVector<unsigned> NewLocNos;
204 NewLocNos.
assign(loc_nos_begin(), loc_nos_end());
205 auto OldLocIt =
find(NewLocNos, OldLocNo);
206 assert(OldLocIt != NewLocNos.
end() &&
"Old location must be present.");
207 *OldLocIt = NewLocNo;
208 return DbgVariableValue(NewLocNos, WasIndirect, WasList, *Expression);
211 bool hasLocNoGreaterThan(
unsigned LocNo)
const {
213 [LocNo](
unsigned ThisLocNo) {
return ThisLocNo > LocNo; });
216 void printLocNos(llvm::raw_ostream &OS)
const {
217 for (
const unsigned &Loc : loc_nos())
218 OS << (&Loc == loc_nos_begin() ?
" " :
", ") << Loc;
222 const DbgVariableValue &
RHS) {
223 if (std::tie(
LHS.LocNoCount,
LHS.WasIndirect,
LHS.WasList,
225 std::tie(
RHS.LocNoCount,
RHS.WasIndirect,
RHS.WasList,
RHS.Expression))
227 return std::equal(
LHS.loc_nos_begin(),
LHS.loc_nos_end(),
228 RHS.loc_nos_begin());
232 const DbgVariableValue &
RHS) {
236 unsigned *loc_nos_begin() {
return LocNos.get(); }
237 const unsigned *loc_nos_begin()
const {
return LocNos.get(); }
238 unsigned *loc_nos_end() {
return LocNos.get() + LocNoCount; }
239 const unsigned *loc_nos_end()
const {
return LocNos.get() + LocNoCount; }
240 ArrayRef<unsigned> loc_nos()
const {
241 return ArrayRef<unsigned>(LocNos.get(), LocNoCount);
250 std::unique_ptr<unsigned[]> LocNos;
251 uint8_t LocNoCount : 6;
252 bool WasIndirect : 1;
254 const DIExpression *Expression =
nullptr;
288 const std::optional<DIExpression::FragmentInfo> Fragment;
292 UserValue *next =
nullptr;
321 std::optional<DIExpression::FragmentInfo> Fragment,
DebugLoc L,
323 : Variable(var), Fragment(Fragment), dl(std::move(L)), leader(
this),
327 UserValue *getLeader() {
328 UserValue *l = leader;
329 while (l != l->leader)
335 UserValue *getNext()
const {
return next; }
338 static UserValue *
merge(UserValue *L1, UserValue *L2) {
339 L2 = L2->getLeader();
342 L1 = L1->getLeader();
352 End->next = L1->next;
368 for (
unsigned i = 0, e = locations.
size(); i != e; ++i)
369 if (locations[i].
isReg() &&
371 locations[i].getSubReg() == LocMO.
getSubReg())
374 for (
unsigned i = 0, e = locations.
size(); i != e; ++i)
379 locations.
back().clearParent();
381 if (locations.
back().isReg()) {
382 if (locations.
back().isDef())
383 locations.
back().setIsDead(
false);
384 locations.
back().setIsUse();
386 return locations.
size() - 1;
391 void removeLocationIfUnused(
unsigned LocNo) {
393 for (LocMap::const_iterator
I = locInts.
begin();
I.valid(); ++
I) {
394 const DbgVariableValue &
DbgValue =
I.value();
401 for (LocMap::iterator
I = locInts.
begin();
I.valid(); ++
I) {
402 const DbgVariableValue &
DbgValue =
I.value();
403 if (
DbgValue.hasLocNoGreaterThan(LocNo))
404 I.setValueUnchecked(
DbgValue.decrementLocNosAfterPivot(LocNo));
409 void mapVirtRegs(
LDVImpl *LDV);
417 DbgVariableValue
DbgValue(Locs, IsIndirect, IsList, Expr);
419 LocMap::iterator
I = locInts.
find(Idx);
420 if (!
I.valid() ||
I.start() != Idx)
444 SmallDenseMap<
unsigned, std::pair<LiveRange *, const VNInfo *>>
458 void addDefsFromCopies(
511 : Label(label), dl(std::move(L)), loc(Idx) {}
516 return Label == L && dl->getInlinedAt() == IA && loc == Index;
547 std::map<unsigned, PHIValPos> PHIValToPos;
566 bool EmitDone =
false;
569 bool ModifiedMF =
false;
579 VRMap virtRegToEqClass;
587 std::optional<DIExpression::FragmentInfo> Fragment,
591 UserValue *lookupVirtReg(
Register VirtReg);
634 void computeIntervals();
646 StashedDebugInstrs.clear();
649 virtRegToEqClass.clear();
652 assert((!ModifiedMF || EmitDone) &&
653 "Dbg values are not emitted in LDV");
689 CommentOS << Scope->getFilename();
690 CommentOS <<
':' <<
DL.getLine();
691 if (
DL.getCol() != 0)
692 CommentOS <<
':' <<
DL.getCol();
717 OS << Res <<
"," << Line;
718 auto *InlinedAt =
DL ?
DL->getInlinedAt() :
nullptr;
720 if (
DebugLoc InlinedAtDL = InlinedAt) {
733 for (LocMap::const_iterator
I = locInts.begin();
I.valid(); ++
I) {
734 OS <<
" [" <<
I.start() <<
';' <<
I.stop() <<
"):";
735 if (
I.value().isUndef())
738 I.value().printLocNos(OS);
739 if (
I.value().getWasIndirect())
741 else if (
I.value().getWasList())
745 for (
unsigned i = 0, e = locations.size(); i != e; ++i) {
746 OS <<
" Loc" << i <<
'=';
747 locations[i].print(OS,
TRI);
762 OS <<
"********** DEBUG VARIABLES **********\n";
763 for (
auto &userValue : userValues)
764 userValue->print(OS, TRI);
765 OS <<
"********** DEBUG LABELS **********\n";
766 for (
auto &userLabel : userLabels)
767 userLabel->print(OS, TRI);
772 if (MO.isReg() && MO.getReg().isVirtual())
776UserValue *LiveDebugVariables::LDVImpl::getUserValue(
778 std::optional<DIExpression::FragmentInfo> Fragment,
const DebugLoc &
DL) {
782 UserValue *&UV = userVarMap[ID];
784 userValues.push_back(
785 std::make_unique<UserValue>(Var, Fragment,
DL,
allocator));
786 UV = userValues.back().get();
793 UserValue *&Leader = virtRegToEqClass[VirtReg];
794 Leader = UserValue::merge(Leader, EC);
797UserValue *LiveDebugVariables::LDVImpl::lookupVirtReg(
Register VirtReg) {
798 if (UserValue *UV = virtRegToEqClass.lookup(VirtReg))
799 return UV->getLeader();
803bool LiveDebugVariables::LDVImpl::handleDebugValue(
MachineInstr &
MI,
807 if (!
MI.isDebugValue()) {
811 if (!
MI.getDebugVariableOp().isMetadata()) {
812 LLVM_DEBUG(
dbgs() <<
"Can't handle DBG_VALUE* with invalid variable: "
816 if (
MI.isNonListDebugValue() &&
817 (
MI.getNumOperands() != 4 ||
818 !(
MI.getDebugOffset().isImm() ||
MI.getDebugOffset().isReg()))) {
827 bool Discard =
false;
828 for (
const MachineOperand &
Op :
MI.debug_operands()) {
829 if (
Op.isReg() &&
Op.getReg().isVirtual()) {
831 if (!LIS->hasInterval(
Reg)) {
835 LLVM_DEBUG(
dbgs() <<
"Discarding debug info (no LIS interval): " << Idx
841 const LiveInterval &LI = LIS->getInterval(
Reg);
842 LiveQueryResult LRQ = LI.
Query(Idx);
847 LLVM_DEBUG(
dbgs() <<
"Discarding debug info (reg not live): " << Idx
855 bool IsIndirect =
MI.isDebugOffsetImm();
857 assert(
MI.getDebugOffset().getImm() == 0 &&
858 "DBG_VALUE with nonzero offset");
859 bool IsList =
MI.isDebugValueList();
860 const DILocalVariable *Var =
MI.getDebugVariable();
861 const DIExpression *Expr =
MI.getDebugExpression();
866 MI.debug_operands().end()),
867 IsIndirect, IsList, *Expr);
875 UV->addDef(Idx, UndefMOs,
false, IsList, *Expr);
881LiveDebugVariables::LDVImpl::handleDebugInstr(MachineInstr &
MI, SlotIndex Idx) {
882 assert(
MI.isDebugValueLike() ||
MI.isDebugPHI());
886 if (
MI.isDebugValueLike())
888 [](
const MachineOperand &MO) {
889 return MO.isReg() && MO.getReg().isVirtual();
891 "MIs should not refer to Virtual Registers in InstrRef mode.");
894 auto NextInst = std::next(
MI.getIterator());
895 auto *
MBB =
MI.getParent();
896 MI.removeFromParent();
897 StashedDebugInstrs.push_back({&
MI, Idx,
MBB});
901bool LiveDebugVariables::LDVImpl::handleDebugLabel(MachineInstr &
MI,
904 if (
MI.getNumOperands() != 1 || !
MI.getOperand(0).isMetadata()) {
910 const DILabel *
Label =
MI.getDebugLabel();
913 for (
auto const &L : userLabels) {
914 if (
L->matches(Label,
DL->getInlinedAt(), Idx)) {
920 userLabels.push_back(std::make_unique<UserLabel>(Label,
DL, Idx));
925bool LiveDebugVariables::LDVImpl::collectDebugValues(MachineFunction &mf,
928 for (MachineBasicBlock &
MBB : mf) {
933 if (!
MBBI->isDebugOrPseudoInstr()) {
941 ? LIS->getMBBStartIdx(&
MBB)
942 : LIS->getInstructionIndex(*std::prev(
MBBI)).getRegSlot();
948 if (InstrRef && (
MBBI->isNonListDebugValue() ||
MBBI->isDebugPHI() ||
949 MBBI->isDebugRef())) {
950 MBBI = handleDebugInstr(*
MBBI, Idx);
954 }
else if ((
MBBI->isDebugValue() && handleDebugValue(*
MBBI, Idx)) ||
955 (
MBBI->isDebugLabel() && handleDebugLabel(*
MBBI, Idx))) {
960 }
while (
MBBI != MBBE &&
MBBI->isDebugOrPseudoInstr());
966void UserValue::extendDef(
967 SlotIndex Idx, DbgVariableValue DbgValue,
968 SmallDenseMap<
unsigned, std::pair<LiveRange *, const VNInfo *>>
970 std::optional<std::pair<SlotIndex, SmallVector<unsigned>>> &Kills,
971 LiveIntervals &LIS) {
972 SlotIndex
Start = Idx;
975 LocMap::iterator
I = locInts.find(Start);
978 for (
auto &LII : LiveIntervalInfo) {
980 assert(LR && LII.second.second &&
"Missing range info for Idx.");
982 assert(Segment && Segment->
valno == LII.second.second &&
983 "Invalid VNInfo for Idx given?");
984 if (Segment->
end < Stop) {
986 Kills = {Stop, {LII.first}};
987 }
else if (Segment->
end == Stop && Kills) {
990 Kills->second.push_back(LII.first);
995 if (
I.valid() &&
I.start() <= Start) {
998 if (
I.value() != DbgValue ||
I.stop() != Start) {
1000 Kills = std::nullopt;
1008 if (
I.valid() &&
I.start() < Stop) {
1011 Kills = std::nullopt;
1015 DbgVariableValue ExtDbgValue(DbgValue);
1016 I.insert(Start, Stop, std::move(ExtDbgValue));
1020void UserValue::addDefsFromCopies(
1021 DbgVariableValue DbgValue,
1022 SmallVectorImpl<std::pair<unsigned, LiveInterval *>> &LocIntervals,
1024 SmallVectorImpl<std::pair<SlotIndex, DbgVariableValue>> &NewDefs,
1025 MachineRegisterInfo &MRI, LiveIntervals &LIS) {
1028 [](
auto LocI) {
return !LocI.second->reg().isVirtual(); }))
1032 SmallDenseMap<unsigned,
1035 for (
auto &LocInterval : LocIntervals) {
1036 unsigned LocNo = LocInterval.first;
1037 LiveInterval *LI = LocInterval.second;
1043 Register DstReg =
MI->getOperand(0).getReg();
1055 LocMap::iterator
I = locInts.find(Idx.
getRegSlot(
true));
1056 if (!
I.valid() ||
I.value() != DbgValue)
1064 CopyValues[LocNo].push_back(std::make_pair(DstLI, DstVNI));
1068 if (CopyValues.
empty())
1072 for (
auto &LocInterval : LocIntervals)
1073 LLVM_DEBUG(
dbgs() <<
"Got " << CopyValues[LocInterval.first].size()
1074 <<
" copies of " << *LocInterval.second <<
'\n');
1079 LocMap::iterator
I = locInts.find(KilledAt);
1080 if (
I.valid() &&
I.start() <= KilledAt)
1082 DbgVariableValue NewValue(DbgValue);
1083 for (
auto &LocInterval : LocIntervals) {
1084 unsigned LocNo = LocInterval.first;
1085 bool FoundCopy =
false;
1086 for (
auto &LIAndVNI : CopyValues[LocNo]) {
1087 LiveInterval *DstLI = LIAndVNI.first;
1088 const VNInfo *DstVNI = LIAndVNI.second;
1091 LLVM_DEBUG(
dbgs() <<
"Kill at " << KilledAt <<
" covered by valno #"
1092 << DstVNI->
id <<
" in " << *DstLI <<
'\n');
1094 assert(CopyMI && CopyMI->
isCopy() &&
"Bad copy value");
1095 unsigned NewLocNo = getLocationNo(CopyMI->
getOperand(0));
1096 NewValue = NewValue.changeLocNo(LocNo, NewLocNo);
1106 NewDefs.push_back(std::make_pair(KilledAt, NewValue));
1109void UserValue::computeIntervals(MachineRegisterInfo &MRI,
1110 const TargetRegisterInfo &
TRI,
1111 LiveIntervals &LIS, LexicalScopes &LS) {
1115 for (LocMap::const_iterator
I = locInts.begin();
I.valid(); ++
I)
1116 if (!
I.value().isUndef())
1117 Defs.
push_back(std::make_pair(
I.start(),
I.value()));
1120 for (
unsigned i = 0; i != Defs.
size(); ++i) {
1121 SlotIndex Idx = Defs[i].first;
1122 DbgVariableValue DbgValue = Defs[i].second;
1123 SmallDenseMap<unsigned, std::pair<LiveRange *, const VNInfo *>> LIs;
1124 bool ShouldExtendDef =
false;
1125 for (
unsigned LocNo : DbgValue.loc_nos()) {
1126 const MachineOperand &LocMO = locations[LocNo];
1128 ShouldExtendDef |= !LocMO.
isReg();
1131 ShouldExtendDef =
true;
1132 LiveInterval *LI =
nullptr;
1133 const VNInfo *VNI =
nullptr;
1139 LIs[LocNo] = {LI, VNI};
1141 if (ShouldExtendDef) {
1142 std::optional<std::pair<SlotIndex, SmallVector<unsigned>>> Kills;
1143 extendDef(Idx, DbgValue, LIs, Kills, LIS);
1147 bool AnySubreg =
false;
1148 for (
unsigned LocNo : Kills->second) {
1149 const MachineOperand &LocMO = this->locations[LocNo];
1155 KilledLocIntervals.
push_back({LocNo, LI});
1167 addDefsFromCopies(DbgValue, KilledLocIntervals, Kills->first, Defs,
1187 if (!dl.getInlinedAt())
1190 LexicalScope *
Scope =
LS.findLexicalScope(dl);
1195 LocMap::iterator
I = locInts.begin();
1207 if (
Range.first ==
Range.first->getParent()->begin())
1212 if (PrevEnd &&
I.start() < PrevEnd) {
1213 SlotIndex IStop =
I.stop();
1214 DbgVariableValue DbgValue =
I.value();
1218 I.setStopUnchecked(PrevEnd);
1225 I.insert(RStart, IStop, DbgValue);
1229 I.advanceTo(RStart);
1233 if (
I.start() < RStart) {
1235 I.setStartUnchecked(RStart);
1237 trimmedDefs.insert(RStart);
1254 if (PrevEnd &&
I.start() < PrevEnd)
1255 I.setStopUnchecked(PrevEnd);
1258void LiveDebugVariables::LDVImpl::computeIntervals() {
1260 LS.scanFunction(*MF);
1262 for (
const auto &UV : userValues) {
1263 UV->computeIntervals(MF->getRegInfo(), *
TRI, *LIS, LS);
1264 UV->mapVirtRegs(
this);
1273 LLVM_DEBUG(
dbgs() <<
"********** COMPUTING LIVE DEBUG VARIABLES: "
1274 << mf.
getName() <<
" **********\n");
1276 bool Changed = collectDebugValues(mf, InstrRef);
1283 for (
const auto &PHIIt : MF->DebugPHIPositions) {
1287 unsigned SubReg = Position.SubReg;
1289 PHIValPos VP = {
SI, Reg, SubReg};
1290 PHIValToPos.insert(std::make_pair(PHIIt.first, VP));
1291 RegToPHIIdx[Reg].push_back(PHIIt.first);
1301 if (
MI.isDebugInstr())
1310 Impl = std::make_unique<LiveDebugVariables>();
1311 Impl->analyze(mf, LIS);
1324 LDV.analyze(MF, LIS);
1343 MachineFunctionAnalysisManager::Invalidator &) {
1348 return !PAC.preservedWhenStateless();
1359 PImpl.reset(
new LDVImpl(LIS));
1364 PImpl->runOnMachineFunction(MF, InstrRef);
1375 dbgs() <<
"Splitting Loc" << OldLocNo <<
'\t';
1378 bool DidChange =
false;
1379 LocMap::iterator LocMapI;
1380 LocMapI.setMap(locInts);
1391 if (!LocMapI.valid())
1395 while (LocMapI.valid() && LII != LIE) {
1397 LII = LI->
advanceTo(LII, LocMapI.start());
1402 if (LocMapI.value().containsLocNo(OldLocNo) &&
1403 LII->start < LocMapI.stop()) {
1407 MO.
setSubReg(locations[OldLocNo].getSubReg());
1408 NewLocNo = getLocationNo(MO);
1412 SlotIndex LStart = LocMapI.start();
1413 SlotIndex LStop = LocMapI.stop();
1414 DbgVariableValue OldDbgValue = LocMapI.value();
1417 if (LStart < LII->start)
1418 LocMapI.setStartUnchecked(LII->start);
1419 if (LStop > LII->end)
1420 LocMapI.setStopUnchecked(LII->end);
1423 LocMapI.setValue(OldDbgValue.changeLocNo(OldLocNo, NewLocNo));
1426 if (LStart < LocMapI.start()) {
1427 LocMapI.insert(LStart, LocMapI.start(), OldDbgValue);
1429 assert(LocMapI.valid() &&
"Unexpected coalescing");
1431 if (LStop > LocMapI.stop()) {
1433 LocMapI.insert(LII->end, LStop, OldDbgValue);
1439 if (LII->end < LocMapI.stop()) {
1442 LocMapI.advanceTo(LII->start);
1445 if (!LocMapI.valid())
1447 LII = LI->
advanceTo(LII, LocMapI.start());
1462 removeLocationIfUnused(OldLocNo);
1465 dbgs() <<
"Split result: \t";
1473 LiveIntervals &LIS) {
1474 bool DidChange =
false;
1477 for (
unsigned i = locations.size(); i ; --i) {
1478 unsigned LocNo = i-1;
1479 const MachineOperand *Loc = &locations[LocNo];
1482 DidChange |= splitLocation(LocNo, NewRegs, LIS);
1489 auto RegIt = RegToPHIIdx.find(OldReg);
1490 if (RegIt == RegToPHIIdx.end())
1493 std::vector<std::pair<Register, unsigned>> NewRegIdxes;
1495 for (
unsigned InstrID : RegIt->second) {
1496 auto PHIIt = PHIValToPos.find(InstrID);
1497 assert(PHIIt != PHIValToPos.end());
1498 const SlotIndex &Slot = PHIIt->second.SI;
1499 assert(OldReg == PHIIt->second.Reg);
1502 for (
auto NewReg : NewRegs) {
1504 auto LII = LI.
find(Slot);
1505 if (LII != LI.
end() && LII->start <= Slot) {
1507 NewRegIdxes.push_back(std::make_pair(NewReg, InstrID));
1509 PHIIt->second.Reg = NewReg;
1521 RegToPHIIdx.erase(RegIt);
1522 for (
auto &RegAndInstr : NewRegIdxes)
1523 RegToPHIIdx[RegAndInstr.first].push_back(RegAndInstr.second);
1533 bool DidChange =
false;
1534 for (UserValue *UV = lookupVirtReg(OldReg); UV; UV = UV->getNext())
1535 DidChange |= UV->splitRegister(OldReg, NewRegs, *LIS);
1541 UserValue *UV = lookupVirtReg(OldReg);
1549 PImpl->splitRegister(OldReg, NewRegs);
1566 for (
unsigned I = 0, E = locations.size();
I != E; ++
I) {
1567 bool Spilled =
false;
1568 unsigned SpillOffset = 0;
1571 if (
Loc.isReg() &&
Loc.getReg() &&
Loc.getReg().isVirtual()) {
1583 bool Success =
TII.getStackSlotRange(TRC,
Loc.getSubReg(), SpillSize,
1599 auto InsertResult = NewLocations.
insert({Loc, {Spilled, SpillOffset}});
1600 unsigned NewLocNo = std::distance(NewLocations.
begin(), InsertResult.first);
1601 LocNoMap[
I] = NewLocNo;
1606 SpillOffsets.
clear();
1607 for (
auto &Pair : NewLocations) {
1609 unsigned SpillOffset;
1610 std::tie(Spilled, SpillOffset) = Pair.second;
1611 locations.push_back(Pair.first);
1613 unsigned NewLocNo = std::distance(&*NewLocations.begin(), &Pair);
1614 SpillOffsets[NewLocNo] = SpillOffset;
1622 for (LocMap::iterator
I = locInts.begin();
I.valid(); ++
I) {
1623 I.setValueUnchecked(
I.value().remapLocNos(LocNoMap));
1624 I.setStart(
I.start());
1655 auto MapIt = BBSkipInstsMap.
find(
MBB);
1656 if (MapIt == BBSkipInstsMap.
end())
1657 BeginIt =
MBB->begin();
1659 BeginIt = std::next(MapIt->second);
1660 auto I =
MBB->SkipPHIsLabelsAndDebug(BeginIt);
1662 BBSkipInstsMap[
MBB] = std::prev(
I);
1669 auto It =
MI->isTerminator() ?
MBB->getFirstTerminator()
1685 return MBB->instr_end();
1688 while (
I !=
MBB->end() && !
I->isTerminator()) {
1693 return I->definesRegister(
Reg, &
TRI);
1696 return std::next(
I);
1702void UserValue::insertDebugValue(MachineBasicBlock *
MBB, SlotIndex StartIdx,
1703 SlotIndex StopIdx, DbgVariableValue DbgValue,
1705 ArrayRef<unsigned> SpillOffsets,
1706 LiveIntervals &LIS,
const TargetInstrInfo &
TII,
1707 const TargetRegisterInfo &
TRI,
1711 StopIdx = (MBBEndIdx < StopIdx) ? MBBEndIdx : StopIdx;
1717 if (DbgValue.isUndef()) {
1718 MOs.
assign(DbgValue.loc_nos().size(),
1725 for (
unsigned LocNo : DbgValue.loc_nos())
1729 ++NumInsertedDebugValues;
1733 "Expected inlined-at fields to agree");
1739 const DIExpression *Expr = DbgValue.getExpression();
1740 bool IsIndirect = DbgValue.getWasIndirect();
1741 bool IsList = DbgValue.getWasList();
1742 for (
unsigned I = 0,
E = LocSpills.
size();
I !=
E; ++
I) {
1751 SmallVector<uint64_t, 4>
Ops;
1753 Ops.push_back(dwarf::DW_OP_deref);
1758 assert((!LocSpills[
I] || MOs[
I].isFI()) &&
1759 "a spilled location must be a frame index");
1762 unsigned DbgValueOpcode =
1763 IsList ? TargetOpcode::DBG_VALUE_LIST : TargetOpcode::DBG_VALUE;
1774void UserLabel::insertDebugLabel(MachineBasicBlock *
MBB, SlotIndex Idx,
1775 LiveIntervals &LIS,
const TargetInstrInfo &
TII,
1779 ++NumInsertedDebugLabels;
1784void UserValue::emitDebugValues(VirtRegMap *VRM, LiveIntervals &LIS,
1785 const TargetInstrInfo &
TII,
1786 const TargetRegisterInfo &
TRI,
1791 for (LocMap::const_iterator
I = locInts.begin();
I.valid();) {
1792 SlotIndex
Start =
I.start();
1793 SlotIndex Stop =
I.stop();
1794 DbgVariableValue DbgValue =
I.value();
1796 SmallVector<bool> SpilledLocs;
1797 SmallVector<unsigned> LocSpillOffsets;
1798 for (
unsigned LocNo : DbgValue.loc_nos()) {
1800 !DbgValue.isUndef() ? SpillOffsets.
find(LocNo) : SpillOffsets.
end();
1801 bool Spilled = SpillIt != SpillOffsets.
end();
1803 LocSpillOffsets.
push_back(Spilled ? SpillIt->second : 0);
1809 if (trimmedDefs.count(Start))
1813 DbgValue.printLocNos(dbg));
1818 insertDebugValue(&*
MBB, Start, Stop, DbgValue, SpilledLocs, LocSpillOffsets,
1819 LIS,
TII,
TRI, BBSkipInstsMap);
1822 while (Stop > MBBEnd) {
1829 insertDebugValue(&*
MBB, Start, Stop, DbgValue, SpilledLocs,
1830 LocSpillOffsets, LIS,
TII,
TRI, BBSkipInstsMap);
1840void UserLabel::emitDebugLabel(LiveIntervals &LIS,
const TargetInstrInfo &
TII,
1846 insertDebugLabel(&*
MBB, loc, LIS,
TII, BBSkipInstsMap);
1852 LLVM_DEBUG(
dbgs() <<
"********** EMITTING LIVE DEBUG VARIABLES **********\n");
1859 for (
auto &userValue : userValues) {
1861 userValue->rewriteLocations(*VRM, *MF, *
TII, *TRI, SpillOffsets);
1862 userValue->emitDebugValues(VRM, *LIS, *
TII, *TRI, SpillOffsets,
1865 LLVM_DEBUG(
dbgs() <<
"********** EMITTING LIVE DEBUG LABELS **********\n");
1866 for (
auto &userLabel : userLabels) {
1868 userLabel->emitDebugLabel(*LIS, *
TII, BBSkipInstsMap);
1871 LLVM_DEBUG(
dbgs() <<
"********** EMITTING DEBUG PHIS **********\n");
1873 auto Slots = LIS->getSlotIndexes();
1874 for (
auto &It : PHIValToPos) {
1877 unsigned InstNum = It.first;
1878 auto Slot = It.second.SI;
1880 unsigned SubReg = It.second.SubReg;
1884 unsigned PhysReg = VRM->
getPhys(Reg);
1886 PhysReg = TRI->getSubReg(PhysReg, SubReg);
1889 TII->get(TargetOpcode::DBG_PHI));
1890 Builder.addReg(PhysReg);
1891 Builder.addImm(InstNum);
1895 unsigned SpillSize, SpillOffset;
1897 unsigned regSizeInBits = TRI->getRegSizeInBits(*TRC);
1899 regSizeInBits = TRI->getSubRegIdxSize(SubReg);
1905 TII->getStackSlotRange(TRC, SubReg, SpillSize, SpillOffset, *MF);
1907 if (
Success && SpillOffset == 0) {
1909 TII->get(TargetOpcode::DBG_PHI));
1911 Builder.addImm(InstNum);
1915 Builder.addImm(regSizeInBits);
1920 <<
" has nonzero offset\n";
1926 MF->DebugPHIPositions.clear();
1928 LLVM_DEBUG(
dbgs() <<
"********** EMITTING INSTR REFERENCES **********\n");
1936 for (
auto *StashIt = StashedDebugInstrs.begin();
1937 StashIt != StashedDebugInstrs.end(); ++StashIt) {
1942 auto EmitInstsHere = [
this, &StashIt,
MBB, Idx,
1945 MBB->insert(InsertPos,
MI);
1949 auto NextItem = std::next(StashIt);
1950 while (NextItem != StashedDebugInstrs.end() && NextItem->Idx == Idx) {
1951 assert(NextItem->MBB ==
MBB &&
"Instrs with same slot index should be"
1952 "in the same block");
1953 MBB->insert(InsertPos, NextItem->MI);
1955 NextItem = std::next(StashIt);
1961 if (Idx == Slots->getMBBStartIdx(
MBB)) {
1964 EmitInstsHere(InsertPos);
1968 if (
MachineInstr *Pos = Slots->getInstructionFromIndex(Idx)) {
1972 EmitInstsHere(PostDebug);
1977 for (; Idx < End; Idx = Slots->getNextNonNullIndex(Idx)) {
1978 Pos = Slots->getInstructionFromIndex(Idx);
1980 EmitInstsHere(Pos->getIterator());
1989 auto TermIt =
MBB->getFirstTerminator();
1990 EmitInstsHere(TermIt);
1996 BBSkipInstsMap.
clear();
2001 PImpl->emitDebugValues(VRM);
2004#if !defined(NDEBUG) || defined(LLVM_ENABLE_DUMP)
assert(UImm &&(UImm !=~static_cast< T >(0)) &&"Invalid immediate!")
MachineBasicBlock MachineBasicBlock::iterator DebugLoc DL
MachineBasicBlock MachineBasicBlock::iterator MBBI
Function Alias Analysis false
static void print(raw_ostream &Out, object::Archive::Kind Kind, T Val)
static GCRegistry::Add< CoreCLRGC > E("coreclr", "CoreCLR-compatible GC")
#define LLVM_DUMP_METHOD
Mark debug helper function definitions like dump() that should not be stripped from debug builds.
This file defines the DenseMap class.
This file contains constants used for implementing Dwarf debug support.
const HexagonInstrInfo * TII
This file implements a coalescing interval map for small objects.
const AbstractManglingParser< Derived, Alloc >::OperatorInfo AbstractManglingParser< Derived, Alloc >::Ops[]
static void printExtendedName(raw_ostream &OS, const DINode *Node, const DILocation *DL)
static MachineBasicBlock::iterator findInsertLocation(MachineBasicBlock *MBB, SlotIndex Idx, LiveIntervals &LIS, BlockSkipInstsMap &BBSkipInstsMap)
Find an iterator for inserting a DBG_VALUE instruction.
static MachineBasicBlock::iterator findNextInsertLocation(MachineBasicBlock *MBB, MachineBasicBlock::iterator I, SlotIndex StopIdx, ArrayRef< MachineOperand > LocMOs, LiveIntervals &LIS, const TargetRegisterInfo &TRI)
Find an iterator for inserting the next DBG_VALUE instruction (or end if no more insert locations fou...
DenseMap< MachineBasicBlock *, MachineBasicBlock::iterator > BlockSkipInstsMap
Cache to save the location where it can be used as the starting position as input for calling Machine...
IntervalMap< SlotIndex, DbgVariableValue, 4 > LocMap
Map of where a user value is live to that value.
static cl::opt< bool > EnableLDV("live-debug-variables", cl::init(true), cl::desc("Enable the live debug variables pass"), cl::Hidden)
static void printDebugLoc(const DebugLoc &DL, raw_ostream &CommentOS, const LLVMContext &Ctx)
DenseMap< unsigned, unsigned > SpillOffsetMap
Map of stack slot offsets for spilled locations.
static void removeDebugInstrs(MachineFunction &mf)
static LoopDeletionResult merge(LoopDeletionResult A, LoopDeletionResult B)
static bool isUndef(const MachineInstr &MI)
Register const TargetRegisterInfo * TRI
This file implements a map that provides insertion order iteration.
Promote Memory to Register
static MCRegister getReg(const MCDisassembler *D, unsigned RC, unsigned RegNo)
static bool isReg(const MCInst &MI, unsigned OpNo)
MachineInstr unsigned OpIdx
ConstantRange Range(APInt(BitWidth, Low), APInt(BitWidth, High))
#define INITIALIZE_PASS_DEPENDENCY(depName)
#define INITIALIZE_PASS_END(passName, arg, name, cfg, analysis)
#define INITIALIZE_PASS_BEGIN(passName, arg, name, cfg, analysis)
SI Optimize VGPR LiveRange
This file defines the SmallSet class.
This file defines the SmallVector class.
This file defines the 'Statistic' class, which is designed to be an easy way to expose various metric...
#define STATISTIC(VARNAME, DESC)
Class recording the (high level) value of a variable.
PassT::Result & getResult(IRUnitT &IR, ExtraArgTs... ExtraArgs)
Get the result of an analysis pass for a given IR unit.
Represent the analysis usage information of a pass.
Represent a constant reference to an array (0 or more elements consecutively in memory),...
size_t size() const
Get the array size.
static LLVM_ABI void appendOffset(SmallVectorImpl< uint64_t > &Ops, int64_t Offset)
Append Ops with operations to apply the Offset.
static LLVM_ABI DIExpression * appendOpsToArg(const DIExpression *Expr, ArrayRef< uint64_t > Ops, unsigned ArgNo, bool StackValue=false)
Create a copy of Expr by appending the given list of Ops to each instance of the operand DW_OP_LLVM_a...
static LLVM_ABI std::optional< FragmentInfo > getFragmentInfo(expr_op_iterator Start, expr_op_iterator End)
Retrieve the details of this fragment expression.
static LLVM_ABI DIExpression * replaceArg(const DIExpression *Expr, uint64_t OldArg, uint64_t NewArg)
Create a copy of Expr with each instance of DW_OP_LLVM_arg, \p OldArg replaced with DW_OP_LLVM_arg,...
static LLVM_ABI std::optional< DIExpression * > createFragmentExpression(const DIExpression *Expr, unsigned OffsetInBits, unsigned SizeInBits)
Create a DIExpression to describe one part of an aggregate variable that is fragmented across multipl...
static LLVM_ABI DIExpression * prepend(const DIExpression *Expr, uint8_t Flags, int64_t Offset=0)
Prepend DIExpr with a deref and offset operation and optionally turn it into a stack value or/and an ...
Tagged DWARF-like metadata node.
Identifies a unique instance of a variable.
iterator find(const_arg_type_t< KeyT > Val)
DISubprogram * getSubprogram() const
Get the attached subprogram.
const_iterator begin() const
typename Sizer::Allocator Allocator
const_iterator find(KeyT x) const
find - Return an iterator pointing to the first interval ending at or after x, or end().
This is an important class for using LLVM in a threaded context.
This class provides interface to collect and use lexical scoping information from machine instruction...
LLVM_ABI Result run(MachineFunction &MF, MachineFunctionAnalysisManager &MFAM)
LLVM_ABI PreservedAnalyses run(MachineFunction &MF, MachineFunctionAnalysisManager &MFAM)
LiveDebugVariablesWrapperLegacy()
bool runOnMachineFunction(MachineFunction &) override
runOnMachineFunction - This method must be overloaded to perform the desired machine code transformat...
void getAnalysisUsage(AnalysisUsage &) const override
getAnalysisUsage - This function should be overriden by passes that need analysis information to do t...
LDVImpl(LiveIntervals *LIS)
void print(raw_ostream &)
void splitRegister(Register OldReg, ArrayRef< Register > NewRegs)
Replace all references to OldReg with NewRegs.
bool runOnMachineFunction(MachineFunction &mf, bool InstrRef)
void mapVirtReg(Register VirtReg, UserValue *EC)
Map virtual register to an equivalence class.
void clear()
Release all memory.
void emitDebugValues(VirtRegMap *VRM)
Recreate DBG_VALUE instruction from data structures.
void splitPHIRegister(Register OldReg, ArrayRef< Register > NewRegs)
Replace any PHI referring to OldReg with its corresponding NewReg, if present.
LLVM_ABI ~LiveDebugVariables()
void dump() const
dump - Print data structures to dbgs().
LLVM_ABI void splitRegister(Register OldReg, ArrayRef< Register > NewRegs, LiveIntervals &LIS)
splitRegister - Move any user variables in OldReg to the live ranges in NewRegs where they are live.
LLVM_ABI LiveDebugVariables()
Implementation of the LiveDebugVariables pass.
LLVM_ABI void print(raw_ostream &OS) const
LLVM_ABI void analyze(MachineFunction &MF, LiveIntervals *LIS)
LLVM_ABI void releaseMemory()
LLVM_ABI void emitDebugValues(VirtRegMap *VRM)
emitDebugValues - Emit new DBG_VALUE instructions reflecting the changes that happened during registe...
LLVM_ABI bool invalidate(MachineFunction &MF, const PreservedAnalyses &PA, MachineFunctionAnalysisManager::Invalidator &Inv)
LiveInterval - This class represents the liveness of a register, or stack slot.
bool hasInterval(Register Reg) const
SlotIndex getMBBStartIdx(const MachineBasicBlock *mbb) const
Return the first index in the given basic block.
MachineInstr * getInstructionFromIndex(SlotIndex index) const
Returns the instruction associated with the given index.
SlotIndexes * getSlotIndexes() const
SlotIndex getInstructionIndex(const MachineInstr &Instr) const
Returns the base index of the given instruction.
SlotIndex getMBBEndIdx(const MachineBasicBlock *mbb) const
Return the last index in the given basic block.
LiveInterval & getInterval(Register Reg)
bool isNotInMIMap(const MachineInstr &Instr) const
Returns true if the specified machine instr has been removed or was never entered in the map.
MachineBasicBlock * getMBBFromIndex(SlotIndex index) const
VNInfo * valueOutOrDead() const
Returns the value alive at the end of the instruction, if any.
Segments::iterator iterator
const Segment * getSegmentContaining(SlotIndex Idx) const
Return the segment that contains the specified index, or null if there is none.
iterator advanceTo(iterator I, SlotIndex Pos)
advanceTo - Advance the specified iterator to point to the Segment containing the specified position,...
LiveQueryResult Query(SlotIndex Idx) const
Query Liveness at Idx.
SlotIndex beginIndex() const
beginIndex - Return the lowest numbered slot covered.
VNInfo * getVNInfoAt(SlotIndex Idx) const
getVNInfoAt - Return the VNInfo that is live at Idx, or NULL.
LLVM_ABI iterator find(SlotIndex Pos)
find - Return an iterator pointing to the first segment that ends after Pos, or end().
LLVMContext & getContext() const
An RAII based helper class to modify MachineFunctionProperties when running pass.
LLVM_ABI instr_iterator erase(instr_iterator I)
Remove an instruction from the instruction list and delete it.
MachineInstrBundleIterator< MachineInstr > iterator
MachineFunctionPass(char &ID)
void getAnalysisUsage(AnalysisUsage &AU) const override
getAnalysisUsage - Subclasses that override getAnalysisUsage must call this.
Location of a PHI instruction that is also a debug-info variable value, for the duration of register ...
bool useDebugInstrRef() const
Returns true if the function's variable locations are tracked with instruction referencing.
const TargetSubtargetInfo & getSubtarget() const
getSubtarget - Return the subtarget for which this machine code is being compiled.
StringRef getName() const
getName - Return the name of the corresponding LLVM function.
MachineRegisterInfo & getRegInfo()
getRegInfo - Return information about the registers currently in use.
Function & getFunction()
Return the LLVM function that this machine code represents.
BasicBlockListType::iterator iterator
const MachineInstrBuilder & addMetadata(const MDNode *MD) const
Representation of each machine instruction.
const MachineOperand & getOperand(unsigned i) const
MachineOperand class - Representation of each machine instruction operand.
void setSubReg(unsigned subReg)
unsigned getSubReg() const
bool isReg() const
isReg - Tests if this is a MO_Register operand.
LLVM_ABI void setReg(Register Reg)
Change the register this operand corresponds to.
MachineInstr * getParent()
getParent - Return the instruction that this operand belongs to.
void setIsDebug(bool Val=true)
Register getReg() const
getReg - Returns the register number.
LLVM_ABI bool isIdenticalTo(const MachineOperand &Other) const
Returns true if this operand is identical to the specified operand except for liveness related flags ...
static MachineOperand CreateReg(Register Reg, bool isDef, bool isImp=false, bool isKill=false, bool isDead=false, bool isUndef=false, bool isEarlyClobber=false, unsigned SubReg=0, bool isDebug=false, bool isInternalRead=false, bool isRenamable=false)
static MachineOperand CreateFI(int Idx)
MachineRegisterInfo - Keep track of information for virtual and physical registers,...
const TargetRegisterClass * getRegClass(Register Reg) const
Return the register class of the specified virtual register.
iterator_range< use_nodbg_iterator > use_nodbg_operands(Register Reg) const
This class implements a map that also provides access to all stored values in a deterministic order.
std::pair< iterator, bool > insert(const std::pair< KeyT, ValueT > &KV)
AnalysisType & getAnalysis() const
getAnalysis<AnalysisType>() - This function is used by subclasses to get to the analysis information ...
A set of analyses that are preserved following a run of a transformation pass.
static PreservedAnalyses all()
Construct a special preserved set that preserves all passes.
PreservedAnalysisChecker getChecker() const
Build a checker for this PreservedAnalyses and the specified analysis type.
Wrapper class representing virtual and physical registers.
constexpr bool isVirtual() const
Return true if the specified register number is in the virtual register namespace.
SlotIndex - An opaque wrapper around machine indexes.
SlotIndex getNextIndex() const
Returns the next index.
static bool isEarlierEqualInstr(SlotIndex A, SlotIndex B)
Return true if A refers to the same instruction as B or an earlier one.
SlotIndex getBaseIndex() const
Returns the base index for associated with this index.
SlotIndex getPrevIndex() const
Returns the previous index.
SlotIndex getNextSlot() const
Returns the next slot in the index list.
SlotIndex getRegSlot(bool EC=false) const
Returns the register use/def slot in the current instruction for a normal or early-clobber def.
SlotIndex getMBBStartIdx(unsigned Num) const
Returns the first index in the given basic block number.
SlotIndex getIndexBefore(const MachineInstr &MI) const
getIndexBefore - Returns the index of the last indexed instruction before MI, or the start index of i...
SmallSet - This maintains a set of unique values, optimizing for the case when the set is small (less...
This class consists of common code factored out of the SmallVector class to reduce code duplication b...
void assign(size_type NumElts, ValueParamT Elt)
iterator erase(const_iterator CI)
void push_back(const T &Elt)
This is a 'vector' (really, a variable-sized array), optimized for the case when the array is small.
Represent a constant reference to a string, i.e.
constexpr bool empty() const
Check if the string is empty.
TargetInstrInfo - Interface to description of machine instruction set.
TargetRegisterInfo base class - We assume that the target defines a static array of TargetRegisterDes...
virtual const TargetRegisterInfo * getRegisterInfo() const =0
Return the target's register information.
unsigned id
The ID number of this value.
SlotIndex def
The index of the defining instruction.
int getStackSlot(Register virtReg) const
returns the stack slot mapped to the specified virtual register
MachineFunction & getMachineFunction() const
MCRegister getPhys(Register virtReg) const
returns the physical register mapped to the specified virtual register
bool hasPhys(Register virtReg) const
returns true if the specified virtual register is mapped to a physical register
bool isAssignedReg(Register virtReg) const
returns true if the specified virtual register is not mapped to a stack slot or rematerialized.
static constexpr int NO_STACK_SLOT
self_iterator getIterator()
This class implements an extremely fast bulk output stream that can only output to a stream.
initializer< Ty > init(const Ty &Val)
Scope
Defines the scope in which this symbol should be visible: Default – Visible in the public interface o...
This is an optimization pass for GlobalISel generic memory operations.
auto find(R &&Range, const T &Val)
Provide wrappers to std::find which take ranges instead of having to pass begin/end explicitly.
MachineInstrBuilder BuildMI(MachineFunction &MF, const MIMetadata &MIMD, const MCInstrDesc &MCID)
Builder interface. Specify how to create the initial instruction itself.
decltype(auto) dyn_cast(const From &Val)
dyn_cast<X> - Return the argument parameter cast to the specified type.
bool operator!=(uint64_t V1, const APInt &V2)
iterator_range< early_inc_iterator_impl< detail::IterOfRange< RangeT > > > make_early_inc_range(RangeT &&Range)
Make a range that does early increment to allow mutation of the underlying range without disrupting i...
AnalysisManager< MachineFunction > MachineFunctionAnalysisManager
bool operator==(const AddressRangeValuePair &LHS, const AddressRangeValuePair &RHS)
std::pair< const MachineInstr *, const MachineInstr * > InsnRange
This is used to track range of instructions with identical lexical scope.
IterT skipDebugInstructionsForward(IterT It, IterT End, bool SkipPseudoOp=true)
Increment It until it points to a non-debug instruction or to End and return the resulting iterator.
bool any_of(R &&range, UnaryPredicate P)
Provide wrappers to std::any_of which take ranges instead of having to pass begin/end explicitly.
LLVM_ABI raw_ostream & dbgs()
dbgs() - This returns a reference to a raw_ostream for debugging messages.
bool none_of(R &&Range, UnaryPredicate P)
Provide wrappers to std::none_of which take ranges instead of having to pass begin/end explicitly.
class LLVM_GSL_OWNER SmallVector
Forward declaration of SmallVector so that calculateSmallVectorDefaultInlinedElements can reference s...
@ Success
The lock was released successfully.
DWARFExpression::Operation Op
ArrayRef(const T &OneElt) -> ArrayRef< T >
OutputIt copy(R &&Range, OutputIt Out)
decltype(auto) cast(const From &Val)
cast<X> - Return the argument parameter cast to the specified type.
bool is_contained(R &&Range, const E &Element)
Returns true if Element is found in Range.
LLVM_ABI 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.
LLVM_ABI Printable printMBBReference(const MachineBasicBlock &MBB)
Prints a machine basic block reference.
MCRegisterClass TargetRegisterClass
A special type used by analysis passes to provide an address that identifies that particular analysis...