47 #include "llvm/Config/llvm-config.h" 68 #define DEBUG_TYPE "livedebugvars" 74 STATISTIC(NumInsertedDebugValues,
"Number of DBG_VALUEs inserted");
75 STATISTIC(NumInsertedDebugLabels,
"Number of DBG_LABELs inserted");
80 "Debug Variable Analysis",
false,
false)
86 void LiveDebugVariables::getAnalysisUsage(
AnalysisUsage &AU)
const {
104 : LocNo(LocNo), WasIndirect(WasIndirect) {
105 static_assert(
sizeof(*
this) ==
sizeof(
unsigned),
"bad bitfield packing");
106 assert(locNo() == LocNo &&
"location truncation");
124 return LHS.LocNo == RHS.LocNo && LHS.WasIndirect == RHS.WasIndirect;
129 return !(LHS == RHS);
134 unsigned WasIndirect : 1;
163 UserValue *next =
nullptr;
191 : Variable(var), Expression(expr), dl(std::move(L)), leader(
this),
195 UserValue *getLeader() {
196 UserValue *l = leader;
197 while (l != l->leader)
203 UserValue *getNext()
const {
return next; }
210 return Var == Variable && Expr == Expression && dl->getInlinedAt() == IA;
214 static UserValue *merge(UserValue *L1, UserValue *L2) {
215 L2 = L2->getLeader();
218 L1 = L1->getLeader();
228 End->next = L1->next;
244 for (
unsigned i = 0,
e = locations.
size(); i !=
e; ++i)
245 if (locations[i].
isReg() &&
246 locations[i].getReg() == LocMO.
getReg() &&
247 locations[i].getSubReg() == LocMO.
getSubReg())
250 for (
unsigned i = 0,
e = locations.
size(); i !=
e; ++i)
255 locations.
back().clearParent();
257 if (locations.
back().isReg()) {
258 if (locations.
back().isDef())
259 locations.
back().setIsDead(
false);
260 locations.
back().setIsUse();
262 return locations.
size() - 1;
267 void removeLocationIfUnused(
unsigned LocNo) {
271 if (Loc.
locNo() == LocNo)
285 void mapVirtRegs(LDVImpl *LDV);
327 void addDefsFromCopies(
377 : Label(label), dl(std::move(L)), loc(Idx) {}
382 return Label == L && dl->getInlinedAt() == IA && loc ==
Index;
403 bool EmitDone =
false;
406 bool ModifiedMF =
false;
416 VRMap virtRegToEqClass;
427 UserValue *lookupVirtReg(
unsigned VirtReg);
455 void computeIntervals();
467 virtRegToEqClass.clear();
470 assert((!ModifiedMF || EmitDone) &&
471 "Dbg values are not emitted in LDV");
477 void mapVirtReg(
unsigned VirtReg, UserValue *EC);
490 #if !defined(NDEBUG) || defined(LLVM_ENABLE_DUMP) 498 CommentOS <<
Scope->getFilename();
499 CommentOS <<
':' << DL.
getLine();
501 CommentOS <<
':' << DL.
getCol();
517 if (
const auto *V = dyn_cast<const DILocalVariable>(Node)) {
520 }
else if (
const auto *L = dyn_cast<const DILabel>(Node)) {
526 OS << Res <<
"," << Line;
527 auto *InlinedAt = DL ? DL->getInlinedAt() :
nullptr;
529 if (
DebugLoc InlinedAtDL = InlinedAt) {
543 OS <<
" [" <<
I.start() <<
';' <<
I.stop() <<
"):";
544 if (
I.value().isUndef())
547 OS <<
I.value().locNo();
548 if (
I.value().wasIndirect())
552 for (
unsigned i = 0,
e = locations.size(); i !=
e; ++i) {
553 OS <<
" Loc" << i <<
'=';
554 locations[i].print(OS, TRI);
569 OS <<
"********** DEBUG VARIABLES **********\n";
570 for (
auto &userValue : userValues)
571 userValue->print(OS, TRI);
572 OS <<
"********** DEBUG LABELS **********\n";
573 for (
auto &userLabel : userLabels)
574 userLabel->print(OS, TRI);
578 void UserValue::mapVirtRegs(LDVImpl *LDV) {
579 for (
unsigned i = 0,
e = locations.size(); i !=
e; ++i)
580 if (locations[i].
isReg() &&
582 LDV->mapVirtReg(locations[i].getReg(),
this);
587 UserValue *&Leader = userVarMap[Var];
589 UserValue *UV = Leader->getLeader();
591 for (; UV; UV = UV->getNext())
592 if (UV->match(Var, Expr, DL->getInlinedAt()))
596 userValues.push_back(
597 std::make_unique<UserValue>(Var, Expr, DL,
allocator));
598 UserValue *UV = userValues.back().get();
599 Leader = UserValue::merge(Leader, UV);
603 void LDVImpl::mapVirtReg(
unsigned VirtReg, UserValue *EC) {
605 UserValue *&Leader = virtRegToEqClass[VirtReg];
606 Leader = UserValue::merge(Leader, EC);
609 UserValue *LDVImpl::lookupVirtReg(
unsigned VirtReg) {
610 if (UserValue *UV = virtRegToEqClass.lookup(VirtReg))
611 return UV->getLeader();
631 bool Discard =
false;
635 if (!LIS->hasInterval(Reg)) {
639 LLVM_DEBUG(
dbgs() <<
"Discarding debug info (no LIS interval): " << Idx
651 LLVM_DEBUG(
dbgs() <<
"Discarding debug info (reg not live): " << Idx
666 UV->addDef(Idx, MI.
getOperand(0), IsIndirect);
670 UV->addDef(Idx, MO,
false);
686 for (
auto const &L : userLabels) {
687 if (L->match(Label, DL->getInlinedAt(), Idx)) {
693 userLabels.push_back(std::make_unique<UserLabel>(Label, DL, Idx));
699 bool Changed =
false;
707 if (!MBBI->isDebugInstr()) {
715 ? LIS->getMBBStartIdx(MBB)
716 : LIS->getInstructionIndex(*std::prev(MBBI)).getRegSlot();
721 if ((MBBI->isDebugValue() && handleDebugValue(*MBBI, Idx)) ||
722 (MBBI->isDebugLabel() && handleDebugLabel(*MBBI, Idx))) {
723 MBBI = MBB->
erase(MBBI);
727 }
while (MBBI != MBBE && MBBI->isDebugInstr());
745 if (!Segment || Segment->valno != VNI) {
750 if (Segment->end < Stop) {
760 if (I.
value() != Loc || I.
stop() != Start)
770 else if (!ToEnd && Kills)
774 I.
insert(Start, Stop, Loc);
777 void UserValue::addDefsFromCopies(
793 if (MO.getSubReg() || !MI->
isCopy())
816 CopyValues.
push_back(std::make_pair(DstLI, DstVNI));
819 if (CopyValues.
empty())
826 for (
unsigned i = 0,
e = Kills.
size(); i !=
e; ++i) {
828 for (
unsigned j = 0,
e = CopyValues.
size(); j !=
e; ++j) {
830 const VNInfo *DstVNI = CopyValues[j].second;
838 << DstVNI->
id <<
" in " << *DstLI <<
'\n');
841 unsigned LocNo = getLocationNo(CopyMI->
getOperand(0));
844 NewDefs.push_back(std::make_pair(Idx, NewLoc));
857 if (!
I.value().isUndef())
858 Defs.
push_back(std::make_pair(
I.start(),
I.value()));
861 for (
unsigned i = 0; i != Defs.
size(); ++i) {
866 if (!LocMO.
isReg()) {
867 extendDef(Idx, Loc,
nullptr,
nullptr,
nullptr, LIS);
874 const VNInfo *VNI =
nullptr;
880 extendDef(Idx, Loc, LI, VNI, &Kills, LIS);
926 if (Range.first == Range.first->getParent()->begin())
931 if (PrevEnd && I.
start() < PrevEnd) {
944 I.
insert(RStart, IStop, Loc);
952 if (I.
start() < RStart) {
956 trimmedDefs.insert(RStart);
973 if (PrevEnd && I.
start() < PrevEnd)
977 void LDVImpl::computeIntervals() {
981 for (
unsigned i = 0,
e = userValues.size(); i !=
e; ++i) {
982 userValues[i]->computeIntervals(MF->getRegInfo(), *
TRI, *LIS,
LS);
983 userValues[i]->mapVirtRegs(
this);
992 LLVM_DEBUG(
dbgs() <<
"********** COMPUTING LIVE DEBUG VARIABLES: " 993 << mf.
getName() <<
" **********\n");
995 bool Changed = collectDebugValues(mf);
998 ModifiedMF = Changed;
1004 for (
auto MBBI = MBB.begin(), MBBE = MBB.end(); MBBI != MBBE; ) {
1005 if (!MBBI->isDebugValue()) {
1009 MBBI = MBB.erase(MBBI);
1022 pImpl =
new LDVImpl(
this);
1023 return static_cast<LDVImpl*
>(pImpl)->runOnMachineFunction(mf);
1026 void LiveDebugVariables::releaseMemory() {
1028 static_cast<LDVImpl*
>(pImpl)->
clear();
1033 delete static_cast<LDVImpl*
>(pImpl);
1044 dbgs() <<
"Splitting Loc" << OldLocNo <<
'\t';
1047 bool DidChange =
false;
1050 for (
unsigned i = 0; i != NewRegs.
size(); ++i) {
1060 if (!LocMapI.
valid())
1064 while (LocMapI.
valid() && LII != LIE) {
1071 if (LocMapI.
value().locNo() == OldLocNo && LII->start < LocMapI.
stop()) {
1075 MO.
setSubReg(locations[OldLocNo].getSubReg());
1076 NewLocNo = getLocationNo(MO);
1085 if (LStart < LII->start)
1087 if (LStop > LII->end)
1094 if (LStart < LocMapI.
start()) {
1097 assert(LocMapI.
valid() &&
"Unexpected coalescing");
1099 if (LStop > LocMapI.
stop()) {
1101 LocMapI.
insert(LII->end, LStop, OldLoc);
1107 if (LII->end < LocMapI.
stop()) {
1113 if (!LocMapI.
valid())
1127 removeLocationIfUnused(OldLocNo);
1130 dbgs() <<
"Split result: \t";
1139 bool DidChange =
false;
1142 for (
unsigned i = locations.size(); i ; --i) {
1143 unsigned LocNo = i-1;
1147 DidChange |= splitLocation(LocNo, NewRegs, LIS);
1153 bool DidChange =
false;
1154 for (UserValue *UV = lookupVirtReg(OldReg); UV; UV = UV->getNext())
1155 DidChange |= UV->splitRegister(OldReg, NewRegs, *LIS);
1161 UserValue *UV = lookupVirtReg(OldReg);
1162 for (
unsigned i = 0; i != NewRegs.
size(); ++i)
1163 mapVirtReg(NewRegs[i], UV);
1169 static_cast<LDVImpl*
>(pImpl)->
splitRegister(OldReg, NewRegs);
1186 for (
unsigned I = 0,
E = locations.size();
I !=
E; ++
I) {
1187 bool Spilled =
false;
1188 unsigned SpillOffset = 0;
1221 auto InsertResult = NewLocations.
insert({Loc, {Spilled, SpillOffset}});
1222 unsigned NewLocNo = std::distance(NewLocations.
begin(), InsertResult.first);
1223 LocNoMap[
I] = NewLocNo;
1228 SpillOffsets.
clear();
1229 for (
auto &Pair : NewLocations) {
1231 unsigned SpillOffset;
1232 std::tie(Spilled, SpillOffset) = Pair.second;
1233 locations.push_back(Pair.first);
1235 unsigned NewLocNo = std::distance(&*NewLocations.begin(), &Pair);
1236 SpillOffsets[NewLocNo] = SpillOffset;
1250 unsigned NewLocNo = LocNoMap[Loc.
locNo()];
1252 I.setStart(
I.start());
1292 while (I != MBB->
end() && !I->isTerminator()) {
1296 if (I->definesRegister(Reg, &TRI))
1298 return std::next(I);
1306 bool Spilled,
unsigned SpillOffset,
1311 StopIdx = (MBBEndIdx < StopIdx) ? MBBEndIdx : StopIdx;
1316 locations[Loc.
locNo()] :
1322 ++NumInsertedDebugValues;
1324 assert(cast<DILocalVariable>(Variable)
1326 "Expected inlined-at fields to agree");
1343 assert((!Spilled || MO.
isFI()) &&
"a spilled location must be a frame index");
1347 IsIndirect, MO, Variable, Expr);
1352 }
while (I != MBB->
end());
1359 ++NumInsertedDebugLabels;
1361 .addMetadata(Label);
1376 bool Spilled = SpillIt != SpillOffsets.
end();
1377 unsigned SpillOffset = Spilled ? SpillIt->second : 0;
1382 if (trimmedDefs.count(Start))
1390 insertDebugValue(&*MBB, Start, Stop, Loc, Spilled, SpillOffset, LIS, TII,
1394 while (Stop > MBBEnd) {
1401 insertDebugValue(&*MBB, Start, Stop, Loc, Spilled, SpillOffset, LIS, TII,
1417 insertDebugLabel(&*MBB, loc, LIS, TII);
1422 void LDVImpl::emitDebugValues(
VirtRegMap *VRM) {
1423 LLVM_DEBUG(
dbgs() <<
"********** EMITTING LIVE DEBUG VARIABLES **********\n");
1428 for (
auto &userValue : userValues) {
1430 userValue->rewriteLocations(*VRM, *MF, *TII, *TRI, SpillOffsets);
1431 userValue->emitDebugValues(VRM, *LIS, *TII, *TRI, SpillOffsets);
1433 LLVM_DEBUG(
dbgs() <<
"********** EMITTING LIVE DEBUG LABELS **********\n");
1434 for (
auto &userLabel : userLabels) {
1436 userLabel->emitDebugLabel(*LIS, *TII);
1446 bool LiveDebugVariables::doInitialization(
Module &M) {
1450 #if !defined(NDEBUG) || defined(LLVM_ENABLE_DUMP) 1453 static_cast<LDVImpl*
>(pImpl)->
print(
dbgs());
Scope
Defines the scope in which this symbol should be visible: Default – Visible in the public interface ...
static bool isReg(const MCInst &MI, unsigned OpNo)
void setValue(ValT x)
setValue - Change the mapped value of the current interval.
int getStackSlot(Register virtReg) const
returns the stack slot mapped to the specified virtual register
static PassRegistry * getPassRegistry()
getPassRegistry - Access the global registry object, which is automatically initialized at applicatio...
instr_iterator instr_end()
SlotIndex getBaseIndex() const
Returns the base index for associated with this index.
SlotIndex def
The index of the defining instruction.
This class represents lattice values for constants.
#define LLVM_DUMP_METHOD
Mark debug helper function definitions like dump() that should not be stripped from debug builds...
A Module instance is used to store all the information related to an LLVM module. ...
SlotIndex getPrevIndex() const
Returns the previous index.
static void printDebugLoc(const DebugLoc &DL, raw_ostream &CommentOS, const LLVMContext &Ctx)
virtual const TargetRegisterInfo * getRegisterInfo() const
getRegisterInfo - If register information is available, return it.
Segments::iterator iterator
void push_back(const T &Elt)
const DebugLoc & getDebugLoc() const
Returns the debug location id of this MachineInstr.
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.
iterator_range< use_nodbg_iterator > use_nodbg_operands(unsigned Reg) const
iterator getFirstTerminator()
Returns an iterator to the first terminator instruction of this basic block.
void initializeLiveDebugVariablesPass(PassRegistry &)
iterator advanceTo(iterator I, SlotIndex Pos)
advanceTo - Advance the specified iterator to point to the Segment containing the specified position...
unsigned getSubReg() const
SmallVectorImpl< InsnRange > & getRanges()
This class implements a map that also provides access to all stored values in a deterministic order...
bool isMetadata() const
isMetadata - Tests if this is a MO_Metadata operand.
STATISTIC(NumFunctions, "Total number of functions")
unsigned const TargetRegisterInfo * TRI
bool valid() const
valid - Return true if the current position is valid, false for end().
void setMap(const IntervalMap &m)
setMap - Change the map iterated over.
VNInfo - Value Number Information.
LexicalScope - This class is used to track scope information.
void dump() const
dump - Print data structures to dbgs().
bool isImm() const
isImm - Tests if this is a MO_Immediate operand.
Tagged DWARF-like metadata node.
const_iterator begin() const
const TargetRegisterClass * getRegClass(Register Reg) const
Return the register class of the specified virtual register.
This class represents the liveness of a register, stack slot, etc.
static 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 ...
bool isNotInMIMap(const MachineInstr &Instr) const
Returns true if the specified machine instr has been removed or was never entered in the map...
bool match(Val *V, const Pattern &P)
#define INITIALIZE_PASS_DEPENDENCY(depName)
void substPhysReg(MCRegister Reg, const TargetRegisterInfo &)
substPhysReg - Substitute the current register with the physical register Reg, taking any existing Su...
SlotIndex getNextIndex() const
Returns the next index.
MachineFunction & getMachineFunction() const
instr_iterator erase(instr_iterator I)
Remove an instruction from the instruction list and delete it.
~LiveDebugVariables() override
void emitDebugValues(VirtRegMap *VRM)
emitDebugValues - Emit new DBG_VALUE instructions reflecting the changes that happened during registe...
MachineFunctionPass - This class adapts the FunctionPass interface to allow convenient creation of pa...
const HexagonInstrInfo * TII
Printable printMBBReference(const MachineBasicBlock &MBB)
Prints a machine basic block reference.
unsigned getNumOperands() const
Retuns the total number of operands.
MachineBasicBlock iterator that automatically skips over MIs that are inside bundles (i...
This class consists of common code factored out of the SmallVector class to reduce code duplication b...
Result of a LiveRange query.
void advanceTo(KeyT x)
advanceTo - Move to the first interval with stop >= x, or end().
bool isTerminator(QueryType Type=AnyInBundle) const
Returns true if this instruction part of the terminator for a basic block.
DbgValueLocation(unsigned LocNo, bool WasIndirect)
LLVM_NODISCARD bool empty() const
empty - Check if the string is empty.
friend bool operator==(const DbgValueLocation &LHS, const DbgValueLocation &RHS)
MachineInstr * getInstructionFromIndex(SlotIndex index) const
Returns the instruction associated with the given index.
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...
void initialize(const MachineFunction &)
initialize - Scan machine function and constuct lexical scope nest, resets the instance if necessary...
LLVMContext & getContext() const
SlotIndex getNextSlot() const
Returns the next slot in the index list.
LexicalScope * findLexicalScope(const DILocation *DL)
findLexicalScope - Find lexical scope, either regular or inlined, for the given DebugLoc.
void setReg(Register Reg)
Change the register this operand corresponds to.
virtual const TargetInstrInfo * getInstrInfo() const
bool isAssignedReg(Register virtReg) const
returns true if the specified virtual register is not mapped to a stack slot or rematerialized.
const_iterator find(KeyT x) const
find - Return an iterator pointing to the first interval ending at or after x, or end()...
virtual bool doInitialization(Module &)
doInitialization - Virtual method overridden by subclasses to do any necessary initialization before ...
StringRef getName() const
getName - Return the name of the corresponding LLVM function.
void setStartUnchecked(KeyT a)
setStartUnchecked - Move the start of the current interval without checking for coalescing or overlap...
DbgValueLocation changeLocNo(unsigned NewLocNo) const
LiveQueryResult Query(SlotIndex Idx) const
Query Liveness at Idx.
TargetInstrInfo - Interface to description of machine instruction set.
iterator find(const_arg_type_t< KeyT > Val)
bool isIdenticalTo(const MachineOperand &Other) const
Returns true if this operand is identical to the specified operand except for liveness related flags ...
VNInfo * getVNInfoAt(SlotIndex Idx) const
getVNInfoAt - Return the VNInfo that is live at Idx, or NULL.
MachineInstrBuilder BuildMI(MachineFunction &MF, const DebugLoc &DL, const MCInstrDesc &MCID)
Builder interface. Specify how to create the initial instruction itself.
initializer< Ty > init(const Ty &Val)
unsigned const MachineRegisterInfo * MRI
static void removeDebugValues(MachineFunction &mf)
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.
typename Sizer::Allocator Allocator
This is an important class for using LLVM in a threaded context.
DISubprogram * getSubprogram() const
Get the attached subprogram.
size_t size() const
size - Get the array size.
static GCRegistry::Add< CoreCLRGC > E("coreclr", "CoreCLR-compatible GC")
INITIALIZE_PASS_BEGIN(LiveDebugVariables, DEBUG_TYPE, "Debug Variable Analysis", false, false) INITIALIZE_PASS_END(LiveDebugVariables
SmallSet - This maintains a set of unique values, optimizing for the case when the set is small (less...
void find(KeyT x)
find - Move to the first interval with stop >= x, or end().
const KeyT & start() const
start - Return the beginning of the current interval.
SlotIndex getIndexBefore(const MachineInstr &MI) const
getIndexBefore - Returns the index of the last indexed instruction before MI, or the start index of i...
Represent the analysis usage information of a pass.
const DILabel * getDebugLabel() const
Return the debug label referenced by this DBG_LABEL instruction.
static void print(raw_ostream &Out, object::Archive::Kind Kind, T Val)
self_iterator getIterator()
LiveInterval & getInterval(Register Reg)
MachineBasicBlock * getMBBFromIndex(SlotIndex index) const
MDNode * getScope() const
SlotIndex getMBBStartIdx(const MachineBasicBlock *mbb) const
Return the first index in the given basic block.
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)
virtual bool getStackSlotRange(const TargetRegisterClass *RC, unsigned SubIdx, unsigned &Size, unsigned &Offset, const MachineFunction &MF) const
Compute the size in bytes and offset within a stack slot of a spilled register or subregister...
iterator erase(const_iterator CI)
TargetRegisterInfo base class - We assume that the target defines a static array of TargetRegisterDes...
DILocation * getInlinedAt() const
INITIALIZE_PASS_END(RegBankSelect, DEBUG_TYPE, "Assign register bank of generic virtual registers", false, false) RegBankSelect
const DIExpression * getDebugExpression() const
Return the complex address expression referenced by this DBG_VALUE instruction.
unsigned id
The ID number of this value.
std::pair< iterator, bool > insert(const std::pair< KeyT, ValueT > &KV)
Iterator for intrusive lists based on ilist_node.
void splitRegister(unsigned OldReg, ArrayRef< unsigned > NewRegs, LiveIntervals &LIS)
splitRegister - Move any user variables in OldReg to the live ranges in NewRegs where they are live...
MachineOperand class - Representation of each machine instruction operand.
This is a 'vector' (really, a variable-sized array), optimized for the case when the array is small...
friend bool operator!=(const DbgValueLocation &LHS, const DbgValueLocation &RHS)
modulo schedule Modulo Schedule test pass
const Function & getFunction() const
Return the LLVM function that this machine code represents.
raw_ostream & dbgs()
dbgs() - This returns a reference to a raw_ostream for debugging messages.
const ValT & value() const
value - Return the mapped value at the current interval.
static unsigned getReg(const void *D, unsigned RC, unsigned RegNo)
VNInfo * valueOutOrDead() const
Returns the value alive at the end of the instruction, if any.
SlotIndex getMBBEndIdx(const MachineBasicBlock *mbb) const
Return the last index in the given basic block.
static void clear(coro::Shape &Shape)
SlotIndex getInstructionIndex(const MachineInstr &Instr) const
Returns the base index of the given instruction.
const KeyT & stop() const
stop - Return the end of the current interval.
const MachineBasicBlock * getParent() const
MachineRegisterInfo - Keep track of information for virtual and physical registers, including vreg register classes, use/def chains for registers, etc.
void insert(KeyT a, KeyT b, ValT y)
insert - Insert mapping [a;b] -> y before the current position.
Representation of each machine instruction.
static bool isEarlierEqualInstr(SlotIndex A, SlotIndex B)
Return true if A refers to the same instruction as B or an earlier one.
MachineRegisterInfo & getRegInfo()
getRegInfo - Return information about the registers currently in use.
static DebugLoc getDebugLoc(MachineBasicBlock::instr_iterator FirstMI, MachineBasicBlock::instr_iterator LastMI)
Return the first found DebugLoc that has a DILocation, given a range of instructions.
Register getPhys(Register virtReg) const
returns the physical register mapped to the specified virtual register
LexicalScopes - This class provides interface to collect and use lexical scoping information from mac...
LLVM_NODISCARD bool empty() const
static MachineBasicBlock::iterator findNextInsertLocation(MachineBasicBlock *MBB, MachineBasicBlock::iterator I, SlotIndex StopIdx, MachineOperand &LocMO, LiveIntervals &LIS, const TargetRegisterInfo &TRI)
Find an iterator for inserting the next DBG_VALUE instruction (or end if no more insert locations fou...
const MCInstrDesc & get(unsigned Opcode) const
Return the machine instruction descriptor that corresponds to the specified instruction opcode...
static cl::opt< bool > EnableLDV("live-debug-variables", cl::init(true), cl::desc("Enable the live debug variables pass"), cl::Hidden)
void setSubReg(unsigned subReg)
bool isFI() const
isFI - Tests if this is a MO_FrameIndex operand.
virtual void print(raw_ostream &OS, const Module *M) const
print - Print out the internal state of the pass.
Describes a location by number along with some flags about the original usage of the location...
SlotIndexes * getSlotIndexes() const
bool isReg() const
isReg - Tests if this is a MO_Register operand.
const Segment * getSegmentContaining(SlotIndex Idx) const
Return the segment that contains the specified index, or null if there is none.
void setStopUnchecked(KeyT b)
setStopUnchecked - Move the end of the current interval without checking for coalescing or overlaps...
assert(ImpDefSCC.getReg()==AMDGPU::SCC &&ImpDefSCC.isDef())
SlotIndex beginIndex() const
beginIndex - Return the lowest numbered slot covered.
static void printExtendedName(raw_ostream &OS, const DINode *Node, const DILocation *DL)
static cl::opt< bool, true > Debug("debug", cl::desc("Enable debug output"), cl::Hidden, cl::location(DebugFlag))
static bool isVirtualRegister(unsigned Reg)
Return true if the specified register number is in the virtual register namespace.
const DILocalVariable * getDebugVariable() const
Return the debug variable referenced by this DBG_VALUE instruction.
This class implements an extremely fast bulk output stream that can only output to a stream...
iterator SkipPHIsLabelsAndDebug(iterator I)
Return the first instruction in MBB after I that is not a PHI, label or debug.
StringRef - Represent a constant reference to a string, i.e.
Register getReg() const
getReg - Returns the register number.
static MachineBasicBlock::iterator findInsertLocation(MachineBasicBlock *MBB, SlotIndex Idx, LiveIntervals &LIS)
Find an iterator for inserting a DBG_VALUE instruction.
void setIsDebug(bool Val=true)
const MachineOperand & getOperand(unsigned i) const
SlotIndex - An opaque wrapper around machine indexes.
static MachineOperand CreateFI(int Idx)
DominatorTree Class - Concrete subclass of DominatorTreeBase that is used to compute a normal dominat...
std::pair< const MachineInstr *, const MachineInstr * > InsnRange
InsnRange - This is used to track range of instructions with identical lexical scope.
Wrapper class representing virtual and physical registers.