[llvm] r270613 - DWARF: Omit DW_AT_APPLE attributes (except ObjC ones) when not targeting LLDB
David Blaikie via llvm-commits
llvm-commits at lists.llvm.org
Tue May 24 14:19:28 PDT 2016
Author: dblaikie
Date: Tue May 24 16:19:28 2016
New Revision: 270613
URL: http://llvm.org/viewvc/llvm-project?rev=270613&view=rev
Log:
DWARF: Omit DW_AT_APPLE attributes (except ObjC ones) when not targeting LLDB
These attributes aren't used by other debuggers (& may be confused with
other DWARF extensions) so they just waste space (about 1.5% on .dwo
file size on a random large program I tested).
We could remove the ObjC property ones too, but I figured they were
probably more necessary when trying to understand ObjC (I could be wrong
though) & so any debugger interested in working with ObjC would use
them, perhaps? (also, there are some legacy tests in Clang that test for
them - making it one of those annoying cross-project commits and/or
cleanup to refactor those tests)
Modified:
llvm/trunk/lib/CodeGen/AsmPrinter/DwarfCompileUnit.cpp
llvm/trunk/lib/CodeGen/AsmPrinter/DwarfDebug.cpp
llvm/trunk/lib/CodeGen/AsmPrinter/DwarfDebug.h
llvm/trunk/lib/CodeGen/AsmPrinter/DwarfUnit.cpp
llvm/trunk/test/DebugInfo/Generic/2010-04-19-FramePtr.ll
Modified: llvm/trunk/lib/CodeGen/AsmPrinter/DwarfCompileUnit.cpp
URL: http://llvm.org/viewvc/llvm-project/llvm/trunk/lib/CodeGen/AsmPrinter/DwarfCompileUnit.cpp?rev=270613&r1=270612&r2=270613&view=diff
==============================================================================
--- llvm/trunk/lib/CodeGen/AsmPrinter/DwarfCompileUnit.cpp (original)
+++ llvm/trunk/lib/CodeGen/AsmPrinter/DwarfCompileUnit.cpp Tue May 24 16:19:28 2016
@@ -287,7 +287,8 @@ DIE &DwarfCompileUnit::updateSubprogramS
DIE *SPDie = getOrCreateSubprogramDIE(SP, includeMinimalInlineScopes());
attachLowHighPC(*SPDie, Asm->getFunctionBegin(), Asm->getFunctionEnd());
- if (!DD->getCurrentFunction()->getTarget().Options.DisableFramePointerElim(
+ if (DD->useAppleExtensionAttributes() &&
+ !DD->getCurrentFunction()->getTarget().Options.DisableFramePointerElim(
*DD->getCurrentFunction()))
addFlag(*SPDie, dwarf::DW_AT_APPLE_omit_frame_ptr);
Modified: llvm/trunk/lib/CodeGen/AsmPrinter/DwarfDebug.cpp
URL: http://llvm.org/viewvc/llvm-project/llvm/trunk/lib/CodeGen/AsmPrinter/DwarfDebug.cpp?rev=270613&r1=270612&r2=270613&view=diff
==============================================================================
--- llvm/trunk/lib/CodeGen/AsmPrinter/DwarfDebug.cpp (original)
+++ llvm/trunk/lib/CodeGen/AsmPrinter/DwarfDebug.cpp Tue May 24 16:19:28 2016
@@ -234,6 +234,8 @@ DwarfDebug::DwarfDebug(AsmPrinter *A, Mo
else
HasDwarfAccelTables = DwarfAccelTables == Enable;
+ HasAppleExtensionAttributes = tuneForLLDB();
+
// Handle split DWARF. Off by default for now.
if (SplitDwarf == Default)
HasSplitDwarf = false;
@@ -419,16 +421,18 @@ DwarfDebug::constructDwarfCompileUnit(co
addGnuPubAttributes(NewCU, Die);
}
- if (DIUnit->isOptimized())
- NewCU.addFlag(Die, dwarf::DW_AT_APPLE_optimized);
-
- StringRef Flags = DIUnit->getFlags();
- if (!Flags.empty())
- NewCU.addString(Die, dwarf::DW_AT_APPLE_flags, Flags);
-
- if (unsigned RVer = DIUnit->getRuntimeVersion())
- NewCU.addUInt(Die, dwarf::DW_AT_APPLE_major_runtime_vers,
- dwarf::DW_FORM_data1, RVer);
+ if (useAppleExtensionAttributes()) {
+ if (DIUnit->isOptimized())
+ NewCU.addFlag(Die, dwarf::DW_AT_APPLE_optimized);
+
+ StringRef Flags = DIUnit->getFlags();
+ if (!Flags.empty())
+ NewCU.addString(Die, dwarf::DW_AT_APPLE_flags, Flags);
+
+ if (unsigned RVer = DIUnit->getRuntimeVersion())
+ NewCU.addUInt(Die, dwarf::DW_AT_APPLE_major_runtime_vers,
+ dwarf::DW_FORM_data1, RVer);
+ }
if (useSplitDwarf())
NewCU.initSection(Asm->getObjFileLowering().getDwarfInfoDWOSection());
Modified: llvm/trunk/lib/CodeGen/AsmPrinter/DwarfDebug.h
URL: http://llvm.org/viewvc/llvm-project/llvm/trunk/lib/CodeGen/AsmPrinter/DwarfDebug.h?rev=270613&r1=270612&r2=270613&view=diff
==============================================================================
--- llvm/trunk/lib/CodeGen/AsmPrinter/DwarfDebug.h (original)
+++ llvm/trunk/lib/CodeGen/AsmPrinter/DwarfDebug.h Tue May 24 16:19:28 2016
@@ -260,6 +260,7 @@ class DwarfDebug : public DebugHandlerBa
/// DWARF5 Experimental Options
/// @{
bool HasDwarfAccelTables;
+ bool HasAppleExtensionAttributes;
bool HasSplitDwarf;
/// Separated Dwarf Variables
@@ -505,6 +506,10 @@ public:
/// use to accelerate lookup.
bool useDwarfAccelTables() const { return HasDwarfAccelTables; }
+ bool useAppleExtensionAttributes() const {
+ return HasAppleExtensionAttributes;
+ }
+
/// Returns whether or not to change the current debug info for the
/// split dwarf proposal support.
bool useSplitDwarf() const { return HasSplitDwarf; }
Modified: llvm/trunk/lib/CodeGen/AsmPrinter/DwarfUnit.cpp
URL: http://llvm.org/viewvc/llvm-project/llvm/trunk/lib/CodeGen/AsmPrinter/DwarfUnit.cpp?rev=270613&r1=270612&r2=270613&view=diff
==============================================================================
--- llvm/trunk/lib/CodeGen/AsmPrinter/DwarfUnit.cpp (original)
+++ llvm/trunk/lib/CodeGen/AsmPrinter/DwarfUnit.cpp Tue May 24 16:19:28 2016
@@ -1244,11 +1244,13 @@ void DwarfUnit::applySubprogramAttribute
if (!SP->isLocalToUnit())
addFlag(SPDie, dwarf::DW_AT_external);
- if (SP->isOptimized())
- addFlag(SPDie, dwarf::DW_AT_APPLE_optimized);
+ if (DD->useAppleExtensionAttributes()) {
+ if (SP->isOptimized())
+ addFlag(SPDie, dwarf::DW_AT_APPLE_optimized);
- if (unsigned isa = Asm->getISAEncoding())
- addUInt(SPDie, dwarf::DW_AT_APPLE_isa, dwarf::DW_FORM_flag, isa);
+ if (unsigned isa = Asm->getISAEncoding())
+ addUInt(SPDie, dwarf::DW_AT_APPLE_isa, dwarf::DW_FORM_flag, isa);
+ }
if (SP->isLValueReference())
addFlag(SPDie, dwarf::DW_AT_reference);
Modified: llvm/trunk/test/DebugInfo/Generic/2010-04-19-FramePtr.ll
URL: http://llvm.org/viewvc/llvm-project/llvm/trunk/test/DebugInfo/Generic/2010-04-19-FramePtr.ll?rev=270613&r1=270612&r2=270613&view=diff
==============================================================================
--- llvm/trunk/test/DebugInfo/Generic/2010-04-19-FramePtr.ll (original)
+++ llvm/trunk/test/DebugInfo/Generic/2010-04-19-FramePtr.ll Tue May 24 16:19:28 2016
@@ -1,7 +1,9 @@
-; RUN: %llc_dwarf -asm-verbose -O1 -o %t < %s
-; RUN: grep DW_AT_APPLE_omit_frame_ptr %t
-; RUN: %llc_dwarf -disable-fp-elim -asm-verbose -O1 -o %t < %s
-; RUN: grep -v DW_AT_APPLE_omit_frame_ptr %t
+; RUN: %llc_dwarf -debugger-tune=lldb -asm-verbose -O1 -o - < %s | FileCheck %s
+; RUN: %llc_dwarf -debugger-tune=gdb -asm-verbose -O1 -o - < %s | FileCheck %s --check-prefix=DISABLE
+; RUN: %llc_dwarf -disable-fp-elim -debugger-tune=lldb -asm-verbose -O1 -o - < %s | FileCheck %s --check-prefix=DISABLE
+
+; CHECK: DW_AT_APPLE_omit_frame_ptr
+; DISABLE-NOT: DW_AT_APPLE_omit_frame_ptr
define i32 @foo() nounwind ssp !dbg !1 {
More information about the llvm-commits
mailing list