Remove the intermediate AccelObjC maps in DWARF units
authorDavid Blaikie <dblaikie@gmail.com>
Thu, 24 Apr 2014 00:53:32 +0000 (00:53 +0000)
committerDavid Blaikie <dblaikie@gmail.com>
Thu, 24 Apr 2014 00:53:32 +0000 (00:53 +0000)
git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@207057 91177308-0d34-0410-b5e6-96231b3b80d8

lib/CodeGen/AsmPrinter/DwarfDebug.cpp
lib/CodeGen/AsmPrinter/DwarfDebug.h
lib/CodeGen/AsmPrinter/DwarfUnit.cpp
lib/CodeGen/AsmPrinter/DwarfUnit.h

index b4ae7c517f7c7be0db5dc9df6fa350f27b9b44ca..549e991829e7f689143f121a5763c3692a6a8e39 100644 (file)
@@ -170,7 +170,9 @@ DwarfDebug::DwarfDebug(AsmPrinter *A, Module *M)
       UsedNonDefaultText(false),
       SkeletonHolder(A, "skel_string", DIEValueAllocator),
       AccelNames(DwarfAccelTable::Atom(dwarf::DW_ATOM_die_offset,
-                                       dwarf::DW_FORM_data4)) {
+                                       dwarf::DW_FORM_data4)),
+      AccelObjC(DwarfAccelTable::Atom(dwarf::DW_ATOM_die_offset,
+                                      dwarf::DW_FORM_data4)) {
 
   DwarfInfoSectionSym = DwarfAbbrevSectionSym = DwarfStrSectionSym = 0;
   DwarfDebugRangeSectionSym = DwarfDebugLocSectionSym = DwarfLineSectionSym = 0;
@@ -277,9 +279,9 @@ void DwarfDebug::addSubprogramNames(DwarfUnit &TheU, DISubprogram SP,
   if (isObjCClass(SP.getName())) {
     StringRef Class, Category;
     getObjCClassCategory(SP.getName(), Class, Category);
-    TheU.addAccelObjC(Class, Die);
+    addAccelObjC(Class, Die);
     if (Category != "")
-      TheU.addAccelObjC(Category, Die);
+      addAccelObjC(Category, Die);
     // Also add the base method name to the name table.
     addAccelName(getObjCMethodName(SP.getName()), Die);
   }
@@ -1871,24 +1873,14 @@ void DwarfDebug::emitAccelNames() {
 // Emit objective C classes and categories into a hashed accelerator table
 // section.
 void DwarfDebug::emitAccelObjC() {
-  DwarfAccelTable AT(
-      DwarfAccelTable::Atom(dwarf::DW_ATOM_die_offset, dwarf::DW_FORM_data4));
-  for (const auto &TheU : getUnits()) {
-    for (const auto &GI : TheU->getAccelObjC()) {
-      StringRef Name = GI.getKey();
-      for (const DIE *D : GI.second)
-        AT.AddName(Name, D);
-    }
-  }
-
-  AT.FinalizeTable(Asm, "ObjC");
+  AccelObjC.FinalizeTable(Asm, "ObjC");
   Asm->OutStreamer.SwitchSection(
       Asm->getObjFileLowering().getDwarfAccelObjCSection());
   MCSymbol *SectionBegin = Asm->GetTempSymbol("objc_begin");
   Asm->OutStreamer.EmitLabel(SectionBegin);
 
   // Emit the full data.
-  AT.Emit(Asm, SectionBegin, &InfoHolder);
+  AccelObjC.Emit(Asm, SectionBegin, &InfoHolder);
 }
 
 // Emit namespace dies into a hashed accelerator table.
@@ -2569,3 +2561,10 @@ void DwarfDebug::addAccelName(StringRef Name, const DIE *Die) {
   InfoHolder.getStringPoolEntry(Name);
   AccelNames.AddName(Name, Die);
 }
+
+void DwarfDebug::addAccelObjC(StringRef Name, const DIE *Die) {
+  if (!useDwarfAccelTables())
+    return;
+  InfoHolder.getStringPoolEntry(Name);
+  AccelObjC.AddName(Name, Die);
+}
index 537010c5e9d899327a09615a6f9aa6c14c368b1a..901561bd321e9a6786c266ddc4af55b369445d7f 100644 (file)
@@ -325,6 +325,7 @@ class DwarfDebug : public AsmPrinterHandler {
   AddressPool AddrPool;
 
   DwarfAccelTable AccelNames;
+  DwarfAccelTable AccelObjC;
 
   MCDwarfDwoLineTable *getDwoLineTable(const DwarfCompileUnit &);
 
@@ -642,6 +643,8 @@ public:
   AddressPool &getAddressPool() { return AddrPool; }
 
   void addAccelName(StringRef Name, const DIE *Die);
+
+  void addAccelObjC(StringRef Name, const DIE *Die);
 };
 } // End of namespace llvm
 
index 1545f35489d92d03ce2a9d54884aabbfcaed8686..02bce18d56960708dd0bebb09024be1e83f44f6e 100644 (file)
@@ -1065,14 +1065,6 @@ void DwarfUnit::addType(DIE *Entity, DIType Ty, dwarf::Attribute Attribute) {
   addDIEEntry(Entity, Attribute, Entry);
 }
 
-void DwarfUnit::addAccelObjC(StringRef Name, const DIE *Die) {
-  if (!DD->useDwarfAccelTables())
-    return;
-  DU->getStringPoolEntry(Name);
-  std::vector<const DIE *> &DIEs = AccelObjC[Name];
-  DIEs.push_back(Die);
-}
-
 void DwarfUnit::addAccelNamespace(StringRef Name, const DIE *Die) {
   if (!DD->useDwarfAccelTables())
     return;
index 053bc334a9cd6d3e721fdf0fbdd9367ab8d79fbb..4fd1e91b2dfba522c1d05d1f1eb2f35480224c39 100644 (file)
@@ -102,9 +102,6 @@ protected:
   /// GlobalTypes - A map of globally visible types for this unit.
   StringMap<const DIE *> GlobalTypes;
 
-  /// AccelObjC - A map of objc spec for the objc accelerator table.
-  StringMap<std::vector<const DIE *> > AccelObjC;
-
   /// AccelNamespace - A map of names for the namespace accelerator table.
   StringMap<std::vector<const DIE *> > AccelNamespace;
 
@@ -228,9 +225,6 @@ public:
   const StringMap<const DIE *> &getGlobalNames() const { return GlobalNames; }
   const StringMap<const DIE *> &getGlobalTypes() const { return GlobalTypes; }
 
-  const StringMap<std::vector<const DIE *> > &getAccelObjC() const {
-    return AccelObjC;
-  }
   const StringMap<std::vector<const DIE *> > &getAccelNamespace() const {
     return AccelNamespace;
   }
@@ -269,9 +263,6 @@ public:
   ///
   void addGlobalName(StringRef Name, DIE *Die, DIScope Context);
 
-  /// addAccelObjC - Add a new name to the ObjC accelerator table.
-  void addAccelObjC(StringRef Name, const DIE *Die);
-
   /// addAccelNamespace - Add a new name to the namespace accelerator table.
   void addAccelNamespace(StringRef Name, const DIE *Die);