mirror of
https://github.com/c64scene-ar/llvm-6502.git
synced 2025-07-26 05:25:47 +00:00
DebugInfo: Move getOrCreateSourceID from DwarfDebug to DwarfCompileUnit
We still do a few lookups into the line table mapping in MCContext that could be factored out into a single lookup (rather than looking it up once for the table label, once to set the compilation unit, once for each time we need a file ID, etc... ) but assembly output complicates that somewhat as we still need a virtual dispatch back to the MCAsmStreamer in that case. git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@204092 91177308-0d34-0410-b5e6-96231b3b80d8
This commit is contained in:
@@ -296,6 +296,17 @@ void DwarfCompileUnit::addLabelAddress(DIE *Die, dwarf::Attribute Attribute,
|
||||
}
|
||||
}
|
||||
|
||||
unsigned DwarfCompileUnit::getOrCreateSourceID(StringRef FileName, StringRef DirName) {
|
||||
// If we print assembly, we can't separate .file entries according to
|
||||
// compile units. Thus all files will belong to the default compile unit.
|
||||
|
||||
// FIXME: add a better feature test than hasRawTextSupport. Even better,
|
||||
// extend .file to support this.
|
||||
return Asm->OutStreamer.EmitDwarfFileDirective(
|
||||
0, DirName, FileName,
|
||||
Asm->OutStreamer.hasRawTextSupport() ? 0 : getUniqueID());
|
||||
}
|
||||
|
||||
/// addOpAddress - Add a dwarf op address data and value using the
|
||||
/// form given and an op of either DW_FORM_addr or DW_FORM_GNU_addr_index.
|
||||
///
|
||||
@@ -383,8 +394,7 @@ void DwarfUnit::addSourceLine(DIE *Die, unsigned Line, StringRef File,
|
||||
if (Line == 0)
|
||||
return;
|
||||
|
||||
unsigned FileID =
|
||||
DD->getOrCreateSourceID(File, Directory, getCU().getUniqueID());
|
||||
unsigned FileID = getCU().getOrCreateSourceID(File, Directory);
|
||||
assert(FileID && "Invalid file id");
|
||||
addUInt(Die, dwarf::DW_AT_decl_file, None, FileID);
|
||||
addUInt(Die, dwarf::DW_AT_decl_line, None, Line);
|
||||
|
Reference in New Issue
Block a user