[PATCH] D82971: [DebugInfo] Refactor .debug_macro checks. NFCI
David Stenberg via Phabricator via llvm-commits
llvm-commits at lists.llvm.org
Tue Aug 11 04:31:30 PDT 2020
This revision was landed with ongoing or failed builds.
This revision was automatically updated to reflect the committed changes.
Closed by commit rGa73008c1aed2: [DebugInfo] Refactor .debug_macro checks. NFCI (authored by dstenb).
Changed prior to commit:
https://reviews.llvm.org/D82971?vs=274829&id=284653#toc
Repository:
rG LLVM Github Monorepo
CHANGES SINCE LAST ACTION
https://reviews.llvm.org/D82971/new/
https://reviews.llvm.org/D82971
Files:
llvm/lib/CodeGen/AsmPrinter/DwarfDebug.cpp
llvm/lib/CodeGen/AsmPrinter/DwarfDebug.h
Index: llvm/lib/CodeGen/AsmPrinter/DwarfDebug.h
===================================================================
--- llvm/lib/CodeGen/AsmPrinter/DwarfDebug.h
+++ llvm/lib/CodeGen/AsmPrinter/DwarfDebug.h
@@ -372,6 +372,9 @@
/// Generate DWARF v4 type units.
bool GenerateTypeUnits;
+ /// Emit a .debug_macro section instead of .debug_macinfo.
+ bool UseDebugMacroSection;
+
/// DWARF5 Experimental Options
/// @{
AccelTableKind TheAccelTableKind;
Index: llvm/lib/CodeGen/AsmPrinter/DwarfDebug.cpp
===================================================================
--- llvm/lib/CodeGen/AsmPrinter/DwarfDebug.cpp
+++ llvm/lib/CodeGen/AsmPrinter/DwarfDebug.cpp
@@ -428,6 +428,8 @@
// the debug entry values feature. It can also be enabled explicitly.
EmitDebugEntryValues = Asm->TM.Options.ShouldEmitDebugEntryValues();
+ UseDebugMacroSection = DwarfVersion >= 5;
+
Asm->OutStreamer->getContext().setDwarfVersion(DwarfVersion);
}
@@ -1346,7 +1348,7 @@
// If compile Unit has macros, emit "DW_AT_macro_info/DW_AT_macros"
// attribute.
if (CUNode->getMacros()) {
- if (getDwarfVersion() >= 5) {
+ if (UseDebugMacroSection) {
if (useSplitDwarf())
TheCU.addSectionDelta(
TheCU.getUnitDie(), dwarf::DW_AT_macros, U.getMacroLabelBegin(),
@@ -3016,9 +3018,8 @@
void DwarfDebug::emitMacro(DIMacro &M) {
StringRef Name = M.getName();
StringRef Value = M.getValue();
- bool UseMacro = getDwarfVersion() >= 5;
- if (UseMacro) {
+ if (UseDebugMacroSection) {
unsigned Type = M.getMacinfoType() == dwarf::DW_MACINFO_define
? dwarf::DW_MACRO_define_strx
: dwarf::DW_MACRO_undef_strx;
@@ -3079,8 +3080,7 @@
// DWARFv5 macro and DWARFv4 macinfo share some common encodings,
// so for readibility/uniformity, We are explicitly emitting those.
assert(F.getMacinfoType() == dwarf::DW_MACINFO_start_file);
- bool UseMacro = getDwarfVersion() >= 5;
- if (UseMacro)
+ if (UseDebugMacroSection)
emitMacroFileImpl(F, U, dwarf::DW_MACRO_start_file,
dwarf::DW_MACRO_end_file, dwarf::MacroString);
else
@@ -3099,7 +3099,7 @@
continue;
Asm->OutStreamer->SwitchSection(Section);
Asm->OutStreamer->emitLabel(U.getMacroLabelBegin());
- if (getDwarfVersion() >= 5)
+ if (UseDebugMacroSection)
emitMacroHeader(Asm, *this, U);
handleMacroNodes(Macros, U);
Asm->OutStreamer->AddComment("End Of Macro List Mark");
@@ -3110,14 +3110,14 @@
/// Emit macros into a debug macinfo/macro section.
void DwarfDebug::emitDebugMacinfo() {
auto &ObjLower = Asm->getObjFileLowering();
- emitDebugMacinfoImpl(getDwarfVersion() >= 5
+ emitDebugMacinfoImpl(UseDebugMacroSection
? ObjLower.getDwarfMacroSection()
: ObjLower.getDwarfMacinfoSection());
}
void DwarfDebug::emitDebugMacinfoDWO() {
auto &ObjLower = Asm->getObjFileLowering();
- emitDebugMacinfoImpl(getDwarfVersion() >= 5
+ emitDebugMacinfoImpl(UseDebugMacroSection
? ObjLower.getDwarfMacroDWOSection()
: ObjLower.getDwarfMacinfoDWOSection());
}
-------------- next part --------------
A non-text attachment was scrubbed...
Name: D82971.284653.patch
Type: text/x-patch
Size: 3228 bytes
Desc: not available
URL: <http://lists.llvm.org/pipermail/llvm-commits/attachments/20200811/7d84865c/attachment.bin>
More information about the llvm-commits
mailing list