diff options
author | David Blaikie <dblaikie@gmail.com> | 2018-08-16 21:29:55 +0000 |
---|---|---|
committer | David Blaikie <dblaikie@gmail.com> | 2018-08-16 21:29:55 +0000 |
commit | 66cf14d06b1c5d20417e312fabd14ffaf4314ae3 (patch) | |
tree | 9c3245caddc10c62c973c81438897198a1477530 /llvm/lib/AsmParser/LLParser.cpp | |
parent | ed89d069f4d6be2913ef5a1ae8fd2f9b28ddaab2 (diff) | |
download | bcm5719-llvm-66cf14d06b1c5d20417e312fabd14ffaf4314ae3.tar.gz bcm5719-llvm-66cf14d06b1c5d20417e312fabd14ffaf4314ae3.zip |
DebugInfo: Add metadata support for disabling DWARF pub sections
In cases where the debugger load time is a worthwhile tradeoff (or less
costly - such as loading from a DWP instead of a variety of DWOs
(possibly over a high-latency/distributed filesystem)) against object
file size, it can be reasonable to disable pubnames and corresponding
gdb-index creation in the linker.
A backend-flag version of this was implemented for NVPTX in
D44385/r327994 - which was fine for NVPTX which wouldn't mix-and-match
CUs. Now that it's going to be a user-facing option (likely powered by
"-gno-pubnames", the same as GCC) it should be encoded in the
DICompileUnit so it can vary per-CU.
After this, likely the NVPTX support should be migrated to the metadata
& the previous flag implementation should be removed.
Reviewers: aprantl
Differential Revision: https://reviews.llvm.org/D50213
llvm-svn: 339939
Diffstat (limited to 'llvm/lib/AsmParser/LLParser.cpp')
-rw-r--r-- | llvm/lib/AsmParser/LLParser.cpp | 30 |
1 files changed, 28 insertions, 2 deletions
diff --git a/llvm/lib/AsmParser/LLParser.cpp b/llvm/lib/AsmParser/LLParser.cpp index 92cb53068dd..c156a60ffa7 100644 --- a/llvm/lib/AsmParser/LLParser.cpp +++ b/llvm/lib/AsmParser/LLParser.cpp @@ -3718,6 +3718,13 @@ struct EmissionKindField : public MDUnsignedField { EmissionKindField() : MDUnsignedField(0, DICompileUnit::LastEmissionKind) {} }; +struct NameTableKindField : public MDUnsignedField { + NameTableKindField() + : MDUnsignedField( + 0, (unsigned) + DICompileUnit::DebugNameTableKind::LastDebugNameTableKind) {} +}; + struct DIFlagField : public MDFieldImpl<DINode::DIFlags> { DIFlagField() : MDFieldImpl(DINode::FlagZero) {} }; @@ -3938,6 +3945,25 @@ bool LLParser::ParseMDField(LocTy Loc, StringRef Name, EmissionKindField &Result template <> bool LLParser::ParseMDField(LocTy Loc, StringRef Name, + NameTableKindField &Result) { + if (Lex.getKind() == lltok::APSInt) + return ParseMDField(Loc, Name, static_cast<MDUnsignedField &>(Result)); + + if (Lex.getKind() != lltok::NameTableKind) + return TokError("expected nameTable kind"); + + auto Kind = DICompileUnit::getNameTableKind(Lex.getStrVal()); + if (!Kind) + return TokError("invalid nameTable kind" + Twine(" '") + Lex.getStrVal() + + "'"); + assert(((unsigned)*Kind) <= Result.Max && "Expected valid nameTable kind"); + Result.assign((unsigned)*Kind); + Lex.Lex(); + return false; +} + +template <> +bool LLParser::ParseMDField(LocTy Loc, StringRef Name, DwarfAttEncodingField &Result) { if (Lex.getKind() == lltok::APSInt) return ParseMDField(Loc, Name, static_cast<MDUnsignedField &>(Result)); @@ -4448,7 +4474,7 @@ bool LLParser::ParseDICompileUnit(MDNode *&Result, bool IsDistinct) { OPTIONAL(dwoId, MDUnsignedField, ); \ OPTIONAL(splitDebugInlining, MDBoolField, = true); \ OPTIONAL(debugInfoForProfiling, MDBoolField, = false); \ - OPTIONAL(gnuPubnames, MDBoolField, = false); + OPTIONAL(nameTableKind, NameTableKindField, ); PARSE_MD_FIELDS(); #undef VISIT_MD_FIELDS @@ -4456,7 +4482,7 @@ bool LLParser::ParseDICompileUnit(MDNode *&Result, bool IsDistinct) { Context, language.Val, file.Val, producer.Val, isOptimized.Val, flags.Val, runtimeVersion.Val, splitDebugFilename.Val, emissionKind.Val, enums.Val, retainedTypes.Val, globals.Val, imports.Val, macros.Val, dwoId.Val, - splitDebugInlining.Val, debugInfoForProfiling.Val, gnuPubnames.Val); + splitDebugInlining.Val, debugInfoForProfiling.Val, nameTableKind.Val); return false; } |