[llvm] r195696 - DebugInfo: Pubtypes: Coelesce pubtype registration with accelerator type registration.
David Blaikie
dblaikie at gmail.com
Mon Nov 25 16:15:27 PST 2013
Author: dblaikie
Date: Mon Nov 25 18:15:27 2013
New Revision: 195696
URL: http://llvm.org/viewvc/llvm-project?rev=195696&view=rev
Log:
DebugInfo: Pubtypes: Coelesce pubtype registration with accelerator type registration.
It might be possible to eventually use one data structure, but I haven't
looked at the exact criteria used for accelerator tables and pubtypes to
see if there's good reason for the differences between the two or not.
Modified:
llvm/trunk/lib/CodeGen/AsmPrinter/DwarfCompileUnit.cpp
llvm/trunk/lib/CodeGen/AsmPrinter/DwarfCompileUnit.h
llvm/trunk/lib/CodeGen/AsmPrinter/DwarfDebug.cpp
Modified: llvm/trunk/lib/CodeGen/AsmPrinter/DwarfCompileUnit.cpp
URL: http://llvm.org/viewvc/llvm-project/llvm/trunk/lib/CodeGen/AsmPrinter/DwarfCompileUnit.cpp?rev=195696&r1=195695&r2=195696&view=diff
==============================================================================
--- llvm/trunk/lib/CodeGen/AsmPrinter/DwarfCompileUnit.cpp (original)
+++ llvm/trunk/lib/CodeGen/AsmPrinter/DwarfCompileUnit.cpp Mon Nov 25 18:15:27 2013
@@ -913,7 +913,8 @@ DIE *CompileUnit::getOrCreateContextDIE(
}
DIE *CompileUnit::createTypeDIE(DICompositeType Ty) {
- DIE *ContextDIE = getOrCreateContextDIE(resolve(Ty.getContext()));
+ DIScope Context = resolve(Ty.getContext());
+ DIE *ContextDIE = getOrCreateContextDIE(Context);
DIE *TyDIE = getDIE(Ty);
if (TyDIE)
@@ -924,7 +925,7 @@ DIE *CompileUnit::createTypeDIE(DICompos
constructTypeDIEImpl(*TyDIE, Ty);
- updateAcceleratorTables(Ty, TyDIE);
+ updateAcceleratorTables(Context, Ty, TyDIE);
return TyDIE;
}
@@ -939,7 +940,8 @@ DIE *CompileUnit::getOrCreateTypeDIE(con
// Construct the context before querying for the existence of the DIE in case
// such construction creates the DIE.
- DIE *ContextDIE = getOrCreateContextDIE(resolve(Ty.getContext()));
+ DIScope Context = resolve(Ty.getContext());
+ DIE *ContextDIE = getOrCreateContextDIE(Context);
assert(ContextDIE);
DIE *TyDIE = getDIE(Ty);
@@ -958,12 +960,13 @@ DIE *CompileUnit::getOrCreateTypeDIE(con
constructTypeDIE(*TyDIE, DIDerivedType(Ty));
}
- updateAcceleratorTables(Ty, TyDIE);
+ updateAcceleratorTables(Context, Ty, TyDIE);
return TyDIE;
}
-void CompileUnit::updateAcceleratorTables(DIType Ty, const DIE *TyDIE) {
+void CompileUnit::updateAcceleratorTables(DIScope Context, DIType Ty,
+ const DIE *TyDIE) {
if (!Ty.getName().empty() && !Ty.isForwardDecl()) {
bool IsImplementation = 0;
if (Ty.isCompositeType()) {
@@ -974,6 +977,10 @@ void CompileUnit::updateAcceleratorTable
}
unsigned Flags = IsImplementation ? dwarf::DW_FLAG_type_implementation : 0;
addAccelType(Ty.getName(), std::make_pair(TyDIE, Flags));
+
+ if (!Context || Context.isCompileUnit() || Context.isFile() ||
+ Context.isNameSpace())
+ GlobalTypes[getParentContextString(Context) + Ty.getName().str()] = TyDIE;
}
}
@@ -996,10 +1003,6 @@ void CompileUnit::addType(DIE *Entity, D
Entry = createDIEEntry(Buffer);
insertDIEEntry(Ty, Entry);
addDIEEntry(Entity, Attribute, Entry);
-
- // If this is a complete composite type then include it in the
- // list of global types.
- addGlobalType(Ty);
}
// Accelerator table mutators - add each name along with its companion
@@ -1037,20 +1040,6 @@ void CompileUnit::addGlobalName(StringRe
GlobalNames[FullName] = Die;
}
-/// addGlobalType - Add a new global type to the compile unit.
-///
-void CompileUnit::addGlobalType(DIType Ty) {
- DIScope Context = resolve(Ty.getContext());
- if (!Ty.getName().empty() && !Ty.isForwardDecl() &&
- (!Context || Context.isCompileUnit() || Context.isFile() ||
- Context.isNameSpace()))
- if (DIEEntry *Entry = getDIEEntry(Ty)) {
- std::string FullName =
- getParentContextString(Context) + Ty.getName().str();
- GlobalTypes[FullName] = Entry->getEntry();
- }
-}
-
/// getParentContextString - Walks the metadata parent chain in a language
/// specific manner (using the compile unit language) and returns
/// it as a string. This is done at the metadata level because DIEs may
@@ -1091,22 +1080,6 @@ std::string CompileUnit::getParentContex
return CS;
}
-/// addPubTypes - Add subprogram argument types for pubtypes section.
-void CompileUnit::addPubTypes(DISubprogram SP) {
- DICompositeType SPTy = SP.getType();
- uint16_t SPTag = SPTy.getTag();
- if (SPTag != dwarf::DW_TAG_subroutine_type)
- return;
-
- DIArray Args = SPTy.getTypeArray();
- for (unsigned i = 0, e = Args.getNumElements(); i != e; ++i) {
- DIType ATy(Args.getElement(i));
- if (!ATy.isType())
- continue;
- addGlobalType(ATy);
- }
-}
-
/// constructTypeDIE - Construct basic type die from DIBasicType.
void CompileUnit::constructTypeDIE(DIE &Buffer, DIBasicType BTy) {
// Get core information.
Modified: llvm/trunk/lib/CodeGen/AsmPrinter/DwarfCompileUnit.h
URL: http://llvm.org/viewvc/llvm-project/llvm/trunk/lib/CodeGen/AsmPrinter/DwarfCompileUnit.h?rev=195696&r1=195695&r2=195696&view=diff
==============================================================================
--- llvm/trunk/lib/CodeGen/AsmPrinter/DwarfCompileUnit.h (original)
+++ llvm/trunk/lib/CodeGen/AsmPrinter/DwarfCompileUnit.h Mon Nov 25 18:15:27 2013
@@ -143,12 +143,6 @@ public:
///
void addGlobalName(StringRef Name, DIE *Die, DIScope Context);
- /// addGlobalType - Add a new global type to the compile unit.
- void addGlobalType(DIType Ty);
-
- /// addPubTypes - Add a set of types from the subprogram to the global types.
- void addPubTypes(DISubprogram SP);
-
/// addAccelName - Add a new name to the name accelerator table.
void addAccelName(StringRef Name, const DIE *Die);
@@ -417,7 +411,7 @@ private:
/// If this is a named finished type then include it in the list of types for
/// the accelerator tables.
- void updateAcceleratorTables(DIType Ty, const DIE *TyDIE);
+ void updateAcceleratorTables(DIScope Context, DIType Ty, const DIE *TyDIE);
};
} // end llvm namespace
Modified: llvm/trunk/lib/CodeGen/AsmPrinter/DwarfDebug.cpp
URL: http://llvm.org/viewvc/llvm-project/llvm/trunk/lib/CodeGen/AsmPrinter/DwarfDebug.cpp?rev=195696&r1=195695&r2=195696&view=diff
==============================================================================
--- llvm/trunk/lib/CodeGen/AsmPrinter/DwarfDebug.cpp (original)
+++ llvm/trunk/lib/CodeGen/AsmPrinter/DwarfDebug.cpp Mon Nov 25 18:15:27 2013
@@ -685,9 +685,6 @@ DIE *DwarfDebug::constructScopeDIE(Compi
if (DS.isSubprogram() && ObjectPointer != NULL)
TheCU->addDIEEntry(ScopeDIE, dwarf::DW_AT_object_pointer, ObjectPointer);
- if (DS.isSubprogram())
- TheCU->addPubTypes(DISubprogram(DS));
-
return ScopeDIE;
}
More information about the llvm-commits
mailing list