[PATCH] D25434: Generate more debug info in -gmlt
Dehao Chen via Phabricator via llvm-commits
llvm-commits at lists.llvm.org
Wed Nov 30 09:49:13 PST 2016
danielcdh updated this revision to Diff 79769.
danielcdh added a comment.
guard the debug info change under -fprofile-debug.
https://reviews.llvm.org/D25434
Files:
include/llvm/Target/TargetOptions.h
lib/CodeGen/AsmPrinter/DwarfDebug.cpp
lib/CodeGen/AsmPrinter/DwarfUnit.cpp
Index: lib/CodeGen/AsmPrinter/DwarfUnit.cpp
===================================================================
--- lib/CodeGen/AsmPrinter/DwarfUnit.cpp
+++ lib/CodeGen/AsmPrinter/DwarfUnit.cpp
@@ -1187,20 +1187,21 @@
void DwarfUnit::applySubprogramAttributes(const DISubprogram *SP, DIE &SPDie,
bool Minimal) {
- if (!Minimal)
+ if (Asm->TM.Options.ProfileDebug || !Minimal)
if (applySubprogramDefinitionAttributes(SP, SPDie))
return;
// Constructors and operators for anonymous aggregates do not have names.
if (!SP->getName().empty())
addString(SPDie, dwarf::DW_AT_name, SP->getName());
+ if (Asm->TM.Options.ProfileDebug || !Minimal)
+ addSourceLine(SPDie, SP);
+
// Skip the rest of the attributes under -gmlt to save space.
if (Minimal)
return;
- addSourceLine(SPDie, SP);
-
// Add the prototype if we have a prototype and we have a C like
// language.
uint16_t Language = getLanguage();
Index: lib/CodeGen/AsmPrinter/DwarfDebug.cpp
===================================================================
--- lib/CodeGen/AsmPrinter/DwarfDebug.cpp
+++ lib/CodeGen/AsmPrinter/DwarfDebug.cpp
@@ -1138,7 +1138,8 @@
// Under -gmlt, skip building the subprogram if there are no inlined
// subroutines inside it.
- if (TheCU.getCUNode()->getEmissionKind() == DICompileUnit::LineTablesOnly &&
+ if (!Asm->TM.Options.ProfileDebug &&
+ TheCU.getCUNode()->getEmissionKind() == DICompileUnit::LineTablesOnly &&
LScopes.getAbstractScopesList().empty() && !IsDarwin) {
assert(InfoHolder.getScopeVariables().empty());
assert(DbgValues.empty());
Index: include/llvm/Target/TargetOptions.h
===================================================================
--- include/llvm/Target/TargetOptions.h
+++ include/llvm/Target/TargetOptions.h
@@ -108,7 +108,7 @@
DisableIntegratedAS(false), CompressDebugSections(false),
RelaxELFRelocations(false), FunctionSections(false),
DataSections(false), UniqueSectionNames(true), TrapUnreachable(false),
- EmulatedTLS(false), EnableIPRA(false),
+ EmulatedTLS(false), EnableIPRA(false), ProfileDebug(false),
FloatABIType(FloatABI::Default),
AllowFPOpFusion(FPOpFusion::Standard),
ThreadModel(ThreadModel::POSIX),
@@ -225,6 +225,9 @@
/// This flag enables InterProcedural Register Allocation (IPRA).
unsigned EnableIPRA : 1;
+ /// This flag enables emitting extra debug info for sample profiling.
+ unsigned ProfileDebug : 1;
+
/// FloatABIType - This setting is set by -float-abi=xxx option is specfied
/// on the command line. This setting may either be Default, Soft, or Hard.
/// Default selects the target's default behavior. Soft selects the ABI for
@@ -299,7 +302,8 @@
ARE_EQUAL(FPDenormalMode) &&
ARE_EQUAL(ExceptionModel) &&
ARE_EQUAL(MCOptions) &&
- ARE_EQUAL(EnableIPRA);
+ ARE_EQUAL(EnableIPRA) &&
+ ARE_EQUAL(ProfileDebug);
#undef ARE_EQUAL
}
-------------- next part --------------
A non-text attachment was scrubbed...
Name: D25434.79769.patch
Type: text/x-patch
Size: 3054 bytes
Desc: not available
URL: <http://lists.llvm.org/pipermail/llvm-commits/attachments/20161130/39a576d1/attachment.bin>
More information about the llvm-commits
mailing list