[llvm] r196479 - DwarfDebug/DwarfUnit: Push abbreviation structures down into DwarfUnits to reduce duplication
Eric Christopher
echristo at gmail.com
Thu Dec 5 09:05:27 PST 2013
Hmm? We only want one FoldingSet per final .o/.dwo because
abbreviations are uniqued across all compile/partial compile/type
units. Am I missing something here in this patch?
-eric
On Wed, Dec 4, 2013 at 11:43 PM, David Blaikie <dblaikie at gmail.com> wrote:
> Author: dblaikie
> Date: Thu Dec 5 01:43:55 2013
> New Revision: 196479
>
> URL: http://llvm.org/viewvc/llvm-project?rev=196479&view=rev
> Log:
> DwarfDebug/DwarfUnit: Push abbreviation structures down into DwarfUnits to reduce duplication
>
> Modified:
> llvm/trunk/lib/CodeGen/AsmPrinter/DwarfDebug.cpp
> llvm/trunk/lib/CodeGen/AsmPrinter/DwarfDebug.h
>
> Modified: llvm/trunk/lib/CodeGen/AsmPrinter/DwarfDebug.cpp
> URL: http://llvm.org/viewvc/llvm-project/llvm/trunk/lib/CodeGen/AsmPrinter/DwarfDebug.cpp?rev=196479&r1=196478&r2=196479&view=diff
> ==============================================================================
> --- llvm/trunk/lib/CodeGen/AsmPrinter/DwarfDebug.cpp (original)
> +++ llvm/trunk/lib/CodeGen/AsmPrinter/DwarfDebug.cpp Thu Dec 5 01:43:55 2013
> @@ -114,10 +114,6 @@ static const char *const DbgTimerName =
>
> //===----------------------------------------------------------------------===//
>
> -// Configuration values for initial hash set sizes (log2).
> -//
> -static const unsigned InitAbbreviationsSetSize = 9; // log2(512)
> -
> namespace llvm {
>
> /// resolve - Look in the DwarfDebug map for the MDNode that
> @@ -182,14 +178,10 @@ static unsigned getDwarfVersionFromModul
> }
>
> DwarfDebug::DwarfDebug(AsmPrinter *A, Module *M)
> - : Asm(A), MMI(Asm->MMI), FirstCU(0),
> - AbbreviationsSet(InitAbbreviationsSetSize),
> - SourceIdMap(DIEValueAllocator), PrevLabel(NULL), GlobalCUIndexCount(0),
> - GlobalRangeCount(0), InfoHolder(A, &AbbreviationsSet, Abbreviations,
> - "info_string", DIEValueAllocator),
> - SkeletonAbbrevSet(InitAbbreviationsSetSize),
> - SkeletonHolder(A, &SkeletonAbbrevSet, SkeletonAbbrevs, "skel_string",
> - DIEValueAllocator) {
> + : Asm(A), MMI(Asm->MMI), FirstCU(0), SourceIdMap(DIEValueAllocator),
> + PrevLabel(NULL), GlobalCUIndexCount(0), GlobalRangeCount(0),
> + InfoHolder(A, "info_string", DIEValueAllocator),
> + SkeletonHolder(A, "skel_string", DIEValueAllocator) {
>
> DwarfInfoSectionSym = DwarfAbbrevSectionSym = 0;
> DwarfStrSectionSym = TextSectionSym = 0;
> @@ -288,7 +280,7 @@ unsigned DwarfUnits::getAddrPoolIndex(co
> //
> void DwarfUnits::assignAbbrevNumber(DIEAbbrev &Abbrev) {
> // Check the set for priors.
> - DIEAbbrev *InSet = AbbreviationsSet->GetOrInsertNode(&Abbrev);
> + DIEAbbrev *InSet = AbbreviationsSet.GetOrInsertNode(&Abbrev);
>
> // If it's newly added.
> if (InSet == &Abbrev) {
> @@ -2162,25 +2154,21 @@ void DwarfDebug::emitDebugInfo() {
>
> // Emit the abbreviation section.
> void DwarfDebug::emitAbbreviations() {
> - if (!useSplitDwarf())
> - emitAbbrevs(Asm->getObjFileLowering().getDwarfAbbrevSection(),
> - &Abbreviations);
> - else
> - emitAbbrevs(Asm->getObjFileLowering().getDwarfAbbrevSection(),
> - &SkeletonAbbrevs);
> + DwarfUnits &Holder = useSplitDwarf() ? SkeletonHolder : InfoHolder;
> +
> + Holder.emitAbbrevs(Asm->getObjFileLowering().getDwarfAbbrevSection());
> }
>
> -void DwarfDebug::emitAbbrevs(const MCSection *Section,
> - std::vector<DIEAbbrev *> *Abbrevs) {
> +void DwarfUnits::emitAbbrevs(const MCSection *Section) {
> // Check to see if it is worth the effort.
> - if (!Abbrevs->empty()) {
> + if (!Abbreviations.empty()) {
> // Start the debug abbrev section.
> Asm->OutStreamer.SwitchSection(Section);
>
> // For each abbrevation.
> - for (unsigned i = 0, N = Abbrevs->size(); i < N; ++i) {
> + for (unsigned i = 0, N = Abbreviations.size(); i < N; ++i) {
> // Get abbreviation data
> - const DIEAbbrev *Abbrev = Abbrevs->at(i);
> + const DIEAbbrev *Abbrev = Abbreviations[i];
>
> // Emit the abbrevations code (base 1 index.)
> Asm->EmitULEB128(Abbrev->getNumber(), "Abbreviation Code");
> @@ -3031,8 +3019,7 @@ void DwarfDebug::emitDebugInfoDWO() {
> // abbreviations for the .debug_info.dwo section.
> void DwarfDebug::emitDebugAbbrevDWO() {
> assert(useSplitDwarf() && "No split dwarf?");
> - emitAbbrevs(Asm->getObjFileLowering().getDwarfAbbrevDWOSection(),
> - &Abbreviations);
> + InfoHolder.emitAbbrevs(Asm->getObjFileLowering().getDwarfAbbrevDWOSection());
> }
>
> // Emit the .debug_str.dwo section for separated dwarf. This contains the
>
> Modified: llvm/trunk/lib/CodeGen/AsmPrinter/DwarfDebug.h
> URL: http://llvm.org/viewvc/llvm-project/llvm/trunk/lib/CodeGen/AsmPrinter/DwarfDebug.h?rev=196479&r1=196478&r2=196479&view=diff
> ==============================================================================
> --- llvm/trunk/lib/CodeGen/AsmPrinter/DwarfDebug.h (original)
> +++ llvm/trunk/lib/CodeGen/AsmPrinter/DwarfDebug.h Thu Dec 5 01:43:55 2013
> @@ -226,10 +226,10 @@ class DwarfUnits {
> AsmPrinter *Asm;
>
> // Used to uniquely define abbreviations.
> - FoldingSet<DIEAbbrev> *AbbreviationsSet;
> + FoldingSet<DIEAbbrev> AbbreviationsSet;
>
> // A list of all the unique abbreviations in use.
> - std::vector<DIEAbbrev *> &Abbreviations;
> + std::vector<DIEAbbrev *> Abbreviations;
>
> // A pointer to all units in the section.
> SmallVector<Unit *, 1> CUs;
> @@ -251,12 +251,9 @@ class DwarfUnits {
> unsigned NextAddrPoolNumber;
>
> public:
> - DwarfUnits(AsmPrinter *AP, FoldingSet<DIEAbbrev> *AS,
> - std::vector<DIEAbbrev *> &A, const char *Pref,
> - BumpPtrAllocator &DA)
> - : Asm(AP), AbbreviationsSet(AS), Abbreviations(A), StringPool(DA),
> - NextStringPoolNumber(0), StringPref(Pref), AddressPool(),
> - NextAddrPoolNumber(0) {}
> + DwarfUnits(AsmPrinter *AP, const char *Pref, BumpPtrAllocator &DA)
> + : Asm(AP), StringPool(DA), NextStringPoolNumber(0), StringPref(Pref),
> + AddressPool(), NextAddrPoolNumber(0) {}
>
> ~DwarfUnits();
>
> @@ -279,6 +276,9 @@ public:
> void emitUnits(DwarfDebug *DD, const MCSection *USection,
> const MCSection *ASection, const MCSymbol *ASectionSym);
>
> + /// \brief Emit a set of abbreviations to the specific section.
> + void emitAbbrevs(const MCSection *);
> +
> /// \brief Emit all of the strings to the section given.
> void emitStrings(const MCSection *StrSection, const MCSection *OffsetSection,
> const MCSymbol *StrSecSym);
> @@ -347,12 +347,6 @@ class DwarfDebug : public AsmPrinterHand
> /// of in CompileUnit.
> DenseMap<const MDNode *, DIE *> MDTypeNodeToDieMap;
>
> - // Used to uniquely define abbreviations.
> - FoldingSet<DIEAbbrev> AbbreviationsSet;
> -
> - // A list of all the unique abbreviations in use.
> - std::vector<DIEAbbrev *> Abbreviations;
> -
> // Stores the current file ID for a given compile unit.
> DenseMap <unsigned, unsigned> FileIDCUMap;
> // Source id map, i.e. CUID, source filename and directory,
> @@ -485,12 +479,6 @@ class DwarfDebug : public AsmPrinterHand
> // original object file, rather than things that are meant
> // to be in the .dwo sections.
>
> - // Used to uniquely define abbreviations for the skeleton emission.
> - FoldingSet<DIEAbbrev> SkeletonAbbrevSet;
> -
> - // A list of all the unique abbreviations in use.
> - std::vector<DIEAbbrev *> SkeletonAbbrevs;
> -
> // Holder for the skeleton information.
> DwarfUnits SkeletonHolder;
>
> @@ -553,9 +541,6 @@ class DwarfDebug : public AsmPrinterHand
> /// open.
> void endSections();
>
> - /// \brief Emit a set of abbreviations to the specific section.
> - void emitAbbrevs(const MCSection *, std::vector<DIEAbbrev*> *);
> -
> /// \brief Emit the debug info section.
> void emitDebugInfo();
>
>
>
> _______________________________________________
> llvm-commits mailing list
> llvm-commits at cs.uiuc.edu
> http://lists.cs.uiuc.edu/mailman/listinfo/llvm-commits
More information about the llvm-commits
mailing list