mirror of
https://github.com/RPCS3/llvm.git
synced 2025-01-13 07:50:50 +00:00
DebugInfo: Simplify debug loc list handling by keeping separate lists
Rather than using a flat list with "empty" entries (ala the actual on-disk format), keep separate lists for each variable. git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@204680 91177308-0d34-0410-b5e6-96231b3b80d8
This commit is contained in:
parent
7385c3207c
commit
0f53443d82
@ -283,22 +283,10 @@ void DIEHash::hashBlockData(const SmallVectorImpl<DIEValue *> &Values) {
|
|||||||
|
|
||||||
// Hash the contents of a loclistptr class.
|
// Hash the contents of a loclistptr class.
|
||||||
void DIEHash::hashLocList(const DIELocList &LocList) {
|
void DIEHash::hashLocList(const DIELocList &LocList) {
|
||||||
SmallVectorImpl<DebugLocEntry>::const_iterator Start =
|
|
||||||
AP->getDwarfDebug()->getDebugLocEntries().begin();
|
|
||||||
Start += LocList.getValue();
|
|
||||||
HashingByteStreamer Streamer(*this);
|
HashingByteStreamer Streamer(*this);
|
||||||
for (SmallVectorImpl<DebugLocEntry>::const_iterator
|
for (const auto &Entry :
|
||||||
I = Start,
|
AP->getDwarfDebug()->getDebugLocEntries()[LocList.getValue()])
|
||||||
E = AP->getDwarfDebug()->getDebugLocEntries().end();
|
AP->getDwarfDebug()->emitDebugLocEntry(Streamer, Entry);
|
||||||
I != E; ++I) {
|
|
||||||
const DebugLocEntry &Entry = *I;
|
|
||||||
// Go through the entries until we hit the end of the list,
|
|
||||||
// which is the next empty entry.
|
|
||||||
if (Entry.isEmpty())
|
|
||||||
return;
|
|
||||||
else
|
|
||||||
AP->getDwarfDebug()->emitDebugLocEntry(Streamer, Entry);
|
|
||||||
}
|
|
||||||
}
|
}
|
||||||
|
|
||||||
// Hash an individual attribute \param Attr based on the type of attribute and
|
// Hash an individual attribute \param Attr based on the type of attribute and
|
||||||
|
@ -1260,6 +1260,7 @@ DwarfDebug::collectVariableInfo(SmallPtrSet<const MDNode *, 16> &Processed) {
|
|||||||
// Handle multiple DBG_VALUE instructions describing one variable.
|
// Handle multiple DBG_VALUE instructions describing one variable.
|
||||||
RegVar->setDotDebugLocOffset(DotDebugLocEntries.size());
|
RegVar->setDotDebugLocOffset(DotDebugLocEntries.size());
|
||||||
|
|
||||||
|
SmallVector<DebugLocEntry, 4> DebugLoc;
|
||||||
for (SmallVectorImpl<const MachineInstr *>::const_iterator
|
for (SmallVectorImpl<const MachineInstr *>::const_iterator
|
||||||
HI = History.begin(),
|
HI = History.begin(),
|
||||||
HE = History.end();
|
HE = History.end();
|
||||||
@ -1298,10 +1299,10 @@ DwarfDebug::collectVariableInfo(SmallPtrSet<const MDNode *, 16> &Processed) {
|
|||||||
LexicalScope *FnScope = LScopes.getCurrentFunctionScope();
|
LexicalScope *FnScope = LScopes.getCurrentFunctionScope();
|
||||||
DwarfCompileUnit *TheCU = SPMap.lookup(FnScope->getScopeNode());
|
DwarfCompileUnit *TheCU = SPMap.lookup(FnScope->getScopeNode());
|
||||||
DebugLocEntry Loc = getDebugLocEntry(Asm, FLabel, SLabel, Begin, TheCU);
|
DebugLocEntry Loc = getDebugLocEntry(Asm, FLabel, SLabel, Begin, TheCU);
|
||||||
if (DotDebugLocEntries.empty() || !DotDebugLocEntries.back().Merge(Loc))
|
if (DebugLoc.empty() || !DebugLoc.back().Merge(Loc))
|
||||||
DotDebugLocEntries.push_back(std::move(Loc));
|
DebugLoc.push_back(std::move(Loc));
|
||||||
}
|
}
|
||||||
DotDebugLocEntries.push_back(DebugLocEntry());
|
DotDebugLocEntries.push_back(std::move(DebugLoc));
|
||||||
}
|
}
|
||||||
|
|
||||||
// Collect info for variables that were optimized out.
|
// Collect info for variables that were optimized out.
|
||||||
@ -2383,19 +2384,10 @@ void DwarfDebug::emitDebugLoc() {
|
|||||||
Asm->OutStreamer.SwitchSection(
|
Asm->OutStreamer.SwitchSection(
|
||||||
Asm->getObjFileLowering().getDwarfLocSection());
|
Asm->getObjFileLowering().getDwarfLocSection());
|
||||||
unsigned char Size = Asm->getDataLayout().getPointerSize();
|
unsigned char Size = Asm->getDataLayout().getPointerSize();
|
||||||
Asm->OutStreamer.EmitLabel(Asm->GetTempSymbol("debug_loc", 0));
|
unsigned index = 0;
|
||||||
unsigned index = 1;
|
for (const auto &DebugLoc : DotDebugLocEntries) {
|
||||||
for (SmallVectorImpl<DebugLocEntry>::const_iterator
|
Asm->OutStreamer.EmitLabel(Asm->GetTempSymbol("debug_loc", index));
|
||||||
I = DotDebugLocEntries.begin(),
|
for (const auto &Entry : DebugLoc) {
|
||||||
E = DotDebugLocEntries.end();
|
|
||||||
I != E; ++I, ++index) {
|
|
||||||
const DebugLocEntry &Entry = *I;
|
|
||||||
|
|
||||||
if (Entry.isEmpty()) {
|
|
||||||
Asm->OutStreamer.EmitIntValue(0, Size);
|
|
||||||
Asm->OutStreamer.EmitIntValue(0, Size);
|
|
||||||
Asm->OutStreamer.EmitLabel(Asm->GetTempSymbol("debug_loc", index));
|
|
||||||
} else {
|
|
||||||
// Set up the range. This range is relative to the entry point of the
|
// Set up the range. This range is relative to the entry point of the
|
||||||
// compile unit. This is a hard coded 0 for low_pc when we're emitting
|
// compile unit. This is a hard coded 0 for low_pc when we're emitting
|
||||||
// ranges, or the DW_AT_low_pc on the compile unit otherwise.
|
// ranges, or the DW_AT_low_pc on the compile unit otherwise.
|
||||||
@ -2420,6 +2412,9 @@ void DwarfDebug::emitDebugLoc() {
|
|||||||
// Close the range.
|
// Close the range.
|
||||||
Asm->OutStreamer.EmitLabel(end);
|
Asm->OutStreamer.EmitLabel(end);
|
||||||
}
|
}
|
||||||
|
Asm->OutStreamer.EmitIntValue(0, Size);
|
||||||
|
Asm->OutStreamer.EmitIntValue(0, Size);
|
||||||
|
++index;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -366,7 +366,7 @@ class DwarfDebug : public AsmPrinterHandler {
|
|||||||
DenseMap<const MDNode *, DbgVariable *> AbstractVariables;
|
DenseMap<const MDNode *, DbgVariable *> AbstractVariables;
|
||||||
|
|
||||||
// Collection of DebugLocEntry.
|
// Collection of DebugLocEntry.
|
||||||
SmallVector<DebugLocEntry, 4> DotDebugLocEntries;
|
SmallVector<SmallVector<DebugLocEntry, 4>, 4> DotDebugLocEntries;
|
||||||
|
|
||||||
// Collection of subprogram DIEs that are marked (at the end of the module)
|
// Collection of subprogram DIEs that are marked (at the end of the module)
|
||||||
// as DW_AT_inline.
|
// as DW_AT_inline.
|
||||||
@ -763,7 +763,8 @@ public:
|
|||||||
const DwarfCompileUnit *getPrevCU() const { return PrevCU; }
|
const DwarfCompileUnit *getPrevCU() const { return PrevCU; }
|
||||||
|
|
||||||
/// Returns the entries for the .debug_loc section.
|
/// Returns the entries for the .debug_loc section.
|
||||||
const SmallVectorImpl<DebugLocEntry> &getDebugLocEntries() const {
|
const SmallVectorImpl<SmallVector<DebugLocEntry, 4>> &
|
||||||
|
getDebugLocEntries() const {
|
||||||
return DotDebugLocEntries;
|
return DotDebugLocEntries;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
Loading…
x
Reference in New Issue
Block a user