[llvm] r207060 - Remove the intermediate AccelTypes maps in DWARF units.
David Blaikie
dblaikie at gmail.com
Wed Apr 23 18:23:50 PDT 2014
Author: dblaikie
Date: Wed Apr 23 20:23:49 2014
New Revision: 207060
URL: http://llvm.org/viewvc/llvm-project?rev=207060&view=rev
Log:
Remove the intermediate AccelTypes maps in DWARF units.
Modified:
llvm/trunk/lib/CodeGen/AsmPrinter/DwarfAccelTable.h
llvm/trunk/lib/CodeGen/AsmPrinter/DwarfDebug.cpp
llvm/trunk/lib/CodeGen/AsmPrinter/DwarfDebug.h
llvm/trunk/lib/CodeGen/AsmPrinter/DwarfUnit.cpp
llvm/trunk/lib/CodeGen/AsmPrinter/DwarfUnit.h
Modified: llvm/trunk/lib/CodeGen/AsmPrinter/DwarfAccelTable.h
URL: http://llvm.org/viewvc/llvm-project/llvm/trunk/lib/CodeGen/AsmPrinter/DwarfAccelTable.h?rev=207060&r1=207059&r2=207060&view=diff
==============================================================================
--- llvm/trunk/lib/CodeGen/AsmPrinter/DwarfAccelTable.h (original)
+++ llvm/trunk/lib/CodeGen/AsmPrinter/DwarfAccelTable.h Wed Apr 23 20:23:49 2014
@@ -18,6 +18,7 @@
#include "llvm/ADT/ArrayRef.h"
#include "llvm/ADT/StringMap.h"
#include "llvm/MC/MCSymbol.h"
+#include "llvm/Support/Compiler.h"
#include "llvm/Support/DataTypes.h"
#include "llvm/Support/Debug.h"
#include "llvm/Support/Dwarf.h"
@@ -125,7 +126,8 @@ public:
uint16_t type; // enum AtomType
uint16_t form; // DWARF DW_FORM_ defines
- Atom(uint16_t type, uint16_t form) : type(type), form(form) {}
+ LLVM_CONSTEXPR Atom(uint16_t type, uint16_t form)
+ : type(type), form(form) {}
#ifndef NDEBUG
void print(raw_ostream &O) {
O << "Type: " << dwarf::AtomTypeString(type) << "\n"
Modified: llvm/trunk/lib/CodeGen/AsmPrinter/DwarfDebug.cpp
URL: http://llvm.org/viewvc/llvm-project/llvm/trunk/lib/CodeGen/AsmPrinter/DwarfDebug.cpp?rev=207060&r1=207059&r2=207060&view=diff
==============================================================================
--- llvm/trunk/lib/CodeGen/AsmPrinter/DwarfDebug.cpp (original)
+++ llvm/trunk/lib/CodeGen/AsmPrinter/DwarfDebug.cpp Wed Apr 23 20:23:49 2014
@@ -164,6 +164,11 @@ DIType DbgVariable::getType() const {
return Ty;
}
+static LLVM_CONSTEXPR DwarfAccelTable::Atom TypeAtoms[] = {
+ DwarfAccelTable::Atom(dwarf::DW_ATOM_die_offset, dwarf::DW_FORM_data4),
+ DwarfAccelTable::Atom(dwarf::DW_ATOM_die_tag, dwarf::DW_FORM_data2),
+ DwarfAccelTable::Atom(dwarf::DW_ATOM_type_flags, dwarf::DW_FORM_data1)};
+
DwarfDebug::DwarfDebug(AsmPrinter *A, Module *M)
: Asm(A), MMI(Asm->MMI), FirstCU(0), PrevLabel(NULL), GlobalRangeCount(0),
InfoHolder(A, "info_string", DIEValueAllocator),
@@ -174,7 +179,8 @@ DwarfDebug::DwarfDebug(AsmPrinter *A, Mo
AccelObjC(DwarfAccelTable::Atom(dwarf::DW_ATOM_die_offset,
dwarf::DW_FORM_data4)),
AccelNamespace(DwarfAccelTable::Atom(dwarf::DW_ATOM_die_offset,
- dwarf::DW_FORM_data4)) {
+ dwarf::DW_FORM_data4)),
+ AccelTypes(TypeAtoms) {
DwarfInfoSectionSym = DwarfAbbrevSectionSym = DwarfStrSectionSym = 0;
DwarfDebugRangeSectionSym = DwarfDebugLocSectionSym = DwarfLineSectionSym = 0;
@@ -1899,27 +1905,15 @@ void DwarfDebug::emitAccelNamespaces() {
// Emit type dies into a hashed accelerator table.
void DwarfDebug::emitAccelTypes() {
- DwarfAccelTable::Atom Atoms[] = {
- DwarfAccelTable::Atom(dwarf::DW_ATOM_die_offset, dwarf::DW_FORM_data4),
- DwarfAccelTable::Atom(dwarf::DW_ATOM_die_tag, dwarf::DW_FORM_data2),
- DwarfAccelTable::Atom(dwarf::DW_ATOM_type_flags, dwarf::DW_FORM_data1)};
- DwarfAccelTable AT(Atoms);
- for (const auto &TheU : getUnits()) {
- for (const auto &GI : TheU->getAccelTypes()) {
- StringRef Name = GI.getKey();
- for (const auto &DI : GI.second)
- AT.AddName(Name, DI.first, DI.second);
- }
- }
- AT.FinalizeTable(Asm, "types");
+ AccelTypes.FinalizeTable(Asm, "types");
Asm->OutStreamer.SwitchSection(
Asm->getObjFileLowering().getDwarfAccelTypesSection());
MCSymbol *SectionBegin = Asm->GetTempSymbol("types_begin");
Asm->OutStreamer.EmitLabel(SectionBegin);
// Emit the full data.
- AT.Emit(Asm, SectionBegin, &InfoHolder);
+ AccelTypes.Emit(Asm, SectionBegin, &InfoHolder);
}
// Public name handling.
@@ -2567,3 +2561,10 @@ void DwarfDebug::addAccelNamespace(Strin
InfoHolder.getStringPoolEntry(Name);
AccelNamespace.AddName(Name, Die);
}
+
+void DwarfDebug::addAccelType(StringRef Name, const DIE *Die, char Flags) {
+ if (!useDwarfAccelTables())
+ return;
+ InfoHolder.getStringPoolEntry(Name);
+ AccelTypes.AddName(Name, Die, Flags);
+}
Modified: llvm/trunk/lib/CodeGen/AsmPrinter/DwarfDebug.h
URL: http://llvm.org/viewvc/llvm-project/llvm/trunk/lib/CodeGen/AsmPrinter/DwarfDebug.h?rev=207060&r1=207059&r2=207060&view=diff
==============================================================================
--- llvm/trunk/lib/CodeGen/AsmPrinter/DwarfDebug.h (original)
+++ llvm/trunk/lib/CodeGen/AsmPrinter/DwarfDebug.h Wed Apr 23 20:23:49 2014
@@ -327,6 +327,7 @@ class DwarfDebug : public AsmPrinterHand
DwarfAccelTable AccelNames;
DwarfAccelTable AccelObjC;
DwarfAccelTable AccelNamespace;
+ DwarfAccelTable AccelTypes;
MCDwarfDwoLineTable *getDwoLineTable(const DwarfCompileUnit &);
@@ -648,6 +649,8 @@ public:
void addAccelObjC(StringRef Name, const DIE *Die);
void addAccelNamespace(StringRef Name, const DIE *Die);
+
+ void addAccelType(StringRef Name, const DIE *Die, char Flags);
};
} // End of namespace llvm
Modified: llvm/trunk/lib/CodeGen/AsmPrinter/DwarfUnit.cpp
URL: http://llvm.org/viewvc/llvm-project/llvm/trunk/lib/CodeGen/AsmPrinter/DwarfUnit.cpp?rev=207060&r1=207059&r2=207060&view=diff
==============================================================================
--- llvm/trunk/lib/CodeGen/AsmPrinter/DwarfUnit.cpp (original)
+++ llvm/trunk/lib/CodeGen/AsmPrinter/DwarfUnit.cpp Wed Apr 23 20:23:49 2014
@@ -1035,7 +1035,7 @@ void DwarfUnit::updateAcceleratorTables(
IsImplementation = (CT.getRunTimeLang() == 0) || CT.isObjcClassComplete();
}
unsigned Flags = IsImplementation ? dwarf::DW_FLAG_type_implementation : 0;
- addAccelType(Ty.getName(), std::make_pair(TyDIE, Flags));
+ DD->addAccelType(Ty.getName(), TyDIE, Flags);
if ((!Context || Context.isCompileUnit() || Context.isFile() ||
Context.isNameSpace()) &&
@@ -1065,15 +1065,6 @@ void DwarfUnit::addType(DIE *Entity, DIT
addDIEEntry(Entity, Attribute, Entry);
}
-void DwarfUnit::addAccelType(StringRef Name,
- std::pair<const DIE *, unsigned> Die) {
- if (!DD->useDwarfAccelTables())
- return;
- DU->getStringPoolEntry(Name);
- std::vector<std::pair<const DIE *, unsigned> > &DIEs = AccelTypes[Name];
- DIEs.push_back(Die);
-}
-
/// addGlobalName - Add a new global name to the compile unit.
void DwarfUnit::addGlobalName(StringRef Name, DIE *Die, DIScope Context) {
if (getCUNode().getEmissionKind() == DIBuilder::LineTablesOnly)
Modified: llvm/trunk/lib/CodeGen/AsmPrinter/DwarfUnit.h
URL: http://llvm.org/viewvc/llvm-project/llvm/trunk/lib/CodeGen/AsmPrinter/DwarfUnit.h?rev=207060&r1=207059&r2=207060&view=diff
==============================================================================
--- llvm/trunk/lib/CodeGen/AsmPrinter/DwarfUnit.h (original)
+++ llvm/trunk/lib/CodeGen/AsmPrinter/DwarfUnit.h Wed Apr 23 20:23:49 2014
@@ -102,9 +102,6 @@ protected:
/// GlobalTypes - A map of globally visible types for this unit.
StringMap<const DIE *> GlobalTypes;
- /// AccelTypes - A map of names for the type accelerator table.
- StringMap<std::vector<std::pair<const DIE *, unsigned> > > AccelTypes;
-
/// DIEBlocks - A list of all the DIEBlocks in use.
std::vector<DIEBlock *> DIEBlocks;
@@ -222,11 +219,6 @@ public:
const StringMap<const DIE *> &getGlobalNames() const { return GlobalNames; }
const StringMap<const DIE *> &getGlobalTypes() const { return GlobalTypes; }
- const StringMap<std::vector<std::pair<const DIE *, unsigned> > > &
- getAccelTypes() const {
- return AccelTypes;
- }
-
unsigned getDebugInfoOffset() const { return DebugInfoOffset; }
void setDebugInfoOffset(unsigned DbgInfoOff) { DebugInfoOffset = DbgInfoOff; }
@@ -260,9 +252,6 @@ public:
/// addAccelNamespace - Add a new name to the namespace accelerator table.
void addAccelNamespace(StringRef Name, const DIE *Die);
- /// addAccelType - Add a new type to the type accelerator table.
- void addAccelType(StringRef Name, std::pair<const DIE *, unsigned> Die);
-
/// getDIE - Returns the debug information entry map slot for the
/// specified debug variable. We delegate the request to DwarfDebug
/// when the MDNode can be part of the type system, since DIEs for
More information about the llvm-commits
mailing list