summaryrefslogtreecommitdiffstats
path: root/llvm/lib/CodeGen
diff options
context:
space:
mode:
authorDuncan P. N. Exon Smith <dexonsmith@apple.com>2016-04-23 21:08:00 +0000
committerDuncan P. N. Exon Smith <dexonsmith@apple.com>2016-04-23 21:08:00 +0000
commita59d3e5af889662139b8b08f2175f12567491441 (patch)
treec91b05e3c724401c8bf6bcbf8ff3bdfd80450ef3 /llvm/lib/CodeGen
parentdc88bd6e1fc483d6927604e6b2dc58f9d4d06316 (diff)
downloadbcm5719-llvm-a59d3e5af889662139b8b08f2175f12567491441.tar.gz
bcm5719-llvm-a59d3e5af889662139b8b08f2175f12567491441.zip
DebugInfo: Remove MDString-based type references
Eliminate DITypeIdentifierMap and make DITypeRef a thin wrapper around DIType*. It is no longer legal to refer to a DICompositeType by its 'identifier:', and DIBuilder no longer retains all types with an 'identifier:' automatically. Aside from the bitcode upgrade, this is mainly removing logic to resolve an MDString-based reference to an actualy DIType. The commits leading up to this have made the implicit type map in DICompileUnit's 'retainedTypes:' field superfluous. This does not remove DITypeRef, DIScopeRef, DINodeRef, and DITypeRefArray, or stop using them in DI-related metadata. Although as of this commit they aren't serving a useful purpose, there are patchces under review to reuse them for CodeView support. The tests in LLVM were updated with deref-typerefs.sh, which is attached to the thread "[RFC] Lazy-loading of debug info metadata": http://lists.llvm.org/pipermail/llvm-dev/2016-April/098318.html llvm-svn: 267296
Diffstat (limited to 'llvm/lib/CodeGen')
-rw-r--r--llvm/lib/CodeGen/AsmPrinter/DwarfDebug.cpp24
-rw-r--r--llvm/lib/CodeGen/AsmPrinter/DwarfDebug.h21
-rw-r--r--llvm/lib/CodeGen/AsmPrinter/DwarfUnit.cpp2
-rw-r--r--llvm/lib/CodeGen/AsmPrinter/DwarfUnit.h2
4 files changed, 14 insertions, 35 deletions
diff --git a/llvm/lib/CodeGen/AsmPrinter/DwarfDebug.cpp b/llvm/lib/CodeGen/AsmPrinter/DwarfDebug.cpp
index 373b7e7daa3..dcd49acb250 100644
--- a/llvm/lib/CodeGen/AsmPrinter/DwarfDebug.cpp
+++ b/llvm/lib/CodeGen/AsmPrinter/DwarfDebug.cpp
@@ -145,21 +145,13 @@ bool DebugLocDwarfExpression::isFrameRegister(unsigned MachineReg) {
//===----------------------------------------------------------------------===//
-/// resolve - Look in the DwarfDebug map for the MDNode that
-/// corresponds to the reference.
-template <typename T> T *DbgVariable::resolve(TypedDINodeRef<T> Ref) const {
- return DD->resolve(Ref);
-}
-
bool DbgVariable::isBlockByrefVariable() const {
assert(Var && "Invalid complex DbgVariable!");
- return Var->getType()
- .resolve(DD->getTypeIdentifierMap())
- ->isBlockByrefStruct();
+ return Var->getType().resolve()->isBlockByrefStruct();
}
const DIType *DbgVariable::getType() const {
- DIType *Ty = Var->getType().resolve(DD->getTypeIdentifierMap());
+ DIType *Ty = Var->getType().resolve();
// FIXME: isBlockByrefVariable should be reformulated in terms of complex
// addresses instead.
if (Ty->isBlockByrefStruct()) {
@@ -474,7 +466,6 @@ void DwarfDebug::beginModule() {
const Module *M = MMI->getModule();
- TypeIdentifierMap = generateDITypeIdentifierMap(*M);
unsigned NumDebugCUs = 0;
for (DICompileUnit *CUNode : M->debug_compile_units()) {
(void)CUNode;
@@ -494,12 +485,12 @@ void DwarfDebug::beginModule() {
for (auto *Ty : CUNode->getEnumTypes()) {
// The enum types array by design contains pointers to
// MDNodes rather than DIRefs. Unique them here.
- CU.getOrCreateTypeDIE(cast<DIType>(resolve(Ty->getRef())));
+ CU.getOrCreateTypeDIE(cast<DIType>(Ty));
}
for (auto *Ty : CUNode->getRetainedTypes()) {
// The retained types array by design contains pointers to
// MDNodes rather than DIRefs. Unique them here.
- if (DIType *RT = dyn_cast<DIType>(resolve(Ty->getRef())))
+ if (DIType *RT = dyn_cast<DIType>(Ty))
if (!RT->isExternalTypeRef())
// There is no point in force-emitting a forward declaration.
CU.getOrCreateTypeDIE(RT);
@@ -705,7 +696,7 @@ DbgVariable *DwarfDebug::getExistingAbstractVariable(InlinedVariable IV) {
void DwarfDebug::createAbstractVariable(const DILocalVariable *Var,
LexicalScope *Scope) {
- auto AbsDbgVariable = make_unique<DbgVariable>(Var, /* IA */ nullptr, this);
+ auto AbsDbgVariable = make_unique<DbgVariable>(Var, /* IA */ nullptr);
InfoHolder.addScopeVariable(Scope, AbsDbgVariable.get());
AbstractVariables[Var] = std::move(AbsDbgVariable);
}
@@ -749,7 +740,7 @@ void DwarfDebug::collectVariableInfoFromMMITable(
continue;
ensureAbstractVariableIsCreatedIfScoped(Var, Scope->getScopeNode());
- auto RegVar = make_unique<DbgVariable>(Var.first, Var.second, this);
+ auto RegVar = make_unique<DbgVariable>(Var.first, Var.second);
RegVar->initializeMMI(VI.Expr, VI.Slot);
if (InfoHolder.addScopeVariable(Scope, RegVar.get()))
ConcreteVariables.push_back(std::move(RegVar));
@@ -923,8 +914,7 @@ DwarfDebug::buildLocationList(SmallVectorImpl<DebugLocEntry> &DebugLoc,
DbgVariable *DwarfDebug::createConcreteVariable(LexicalScope &Scope,
InlinedVariable IV) {
ensureAbstractVariableIsCreatedIfScoped(IV, Scope.getScopeNode());
- ConcreteVariables.push_back(
- make_unique<DbgVariable>(IV.first, IV.second, this));
+ ConcreteVariables.push_back(make_unique<DbgVariable>(IV.first, IV.second));
InfoHolder.addScopeVariable(&Scope, ConcreteVariables.back().get());
return ConcreteVariables.back().get();
}
diff --git a/llvm/lib/CodeGen/AsmPrinter/DwarfDebug.h b/llvm/lib/CodeGen/AsmPrinter/DwarfDebug.h
index ad0241cb99b..039a5b9fc99 100644
--- a/llvm/lib/CodeGen/AsmPrinter/DwarfDebug.h
+++ b/llvm/lib/CodeGen/AsmPrinter/DwarfDebug.h
@@ -68,15 +68,14 @@ class DbgVariable {
unsigned DebugLocListIndex = ~0u; /// Offset in DebugLocs.
const MachineInstr *MInsn = nullptr; /// DBG_VALUE instruction.
SmallVector<int, 1> FrameIndex; /// Frame index.
- DwarfDebug *DD;
public:
/// Construct a DbgVariable.
///
/// Creates a variable without any DW_AT_location. Call \a initializeMMI()
/// for MMI entries, or \a initializeDbgValue() for DBG_VALUE instructions.
- DbgVariable(const DILocalVariable *V, const DILocation *IA, DwarfDebug *DD)
- : Var(V), IA(IA), DD(DD) {}
+ DbgVariable(const DILocalVariable *V, const DILocation *IA)
+ : Var(V), IA(IA) {}
/// Initialize from the MMI table.
void initializeMMI(const DIExpression *E, int FI) {
@@ -177,9 +176,9 @@ public:
const DIType *getType() const;
private:
- /// Look in the DwarfDebug map for the MDNode that
- /// corresponds to the reference.
- template <typename T> T *resolve(TypedDINodeRef<T> Ref) const;
+ template <typename T> T *resolve(TypedDINodeRef<T> Ref) const {
+ return Ref.resolve();
+ }
};
@@ -255,9 +254,6 @@ class DwarfDebug : public DebugHandlerBase {
/// Version of dwarf we're emitting.
unsigned DwarfVersion;
- /// Maps from a type identifier to the actual MDNode.
- DITypeIdentifierMap TypeIdentifierMap;
-
/// DWARF5 Experimental Options
/// @{
bool HasDwarfAccelTables;
@@ -525,12 +521,7 @@ public:
/// Find the MDNode for the given reference.
template <typename T> T *resolve(TypedDINodeRef<T> Ref) const {
- return Ref.resolve(TypeIdentifierMap);
- }
-
- /// Return the TypeIdentifierMap.
- const DITypeIdentifierMap &getTypeIdentifierMap() const {
- return TypeIdentifierMap;
+ return Ref.resolve();
}
/// Find the DwarfCompileUnit for the given CU Die.
diff --git a/llvm/lib/CodeGen/AsmPrinter/DwarfUnit.cpp b/llvm/lib/CodeGen/AsmPrinter/DwarfUnit.cpp
index 9003af528d0..91c490f0e9d 100644
--- a/llvm/lib/CodeGen/AsmPrinter/DwarfUnit.cpp
+++ b/llvm/lib/CodeGen/AsmPrinter/DwarfUnit.cpp
@@ -718,8 +718,6 @@ DIE *DwarfUnit::getOrCreateTypeDIE(const MDNode *TyNode) {
return nullptr;
auto *Ty = cast<DIType>(TyNode);
- assert(Ty == resolve(Ty->getRef()) &&
- "type was not uniqued, possible ODR violation.");
// DW_TAG_restrict_type is not supported in DWARF2
if (Ty->getTag() == dwarf::DW_TAG_restrict_type && DD->getDwarfVersion() <= 2)
diff --git a/llvm/lib/CodeGen/AsmPrinter/DwarfUnit.h b/llvm/lib/CodeGen/AsmPrinter/DwarfUnit.h
index a79add630b3..e225f92116d 100644
--- a/llvm/lib/CodeGen/AsmPrinter/DwarfUnit.h
+++ b/llvm/lib/CodeGen/AsmPrinter/DwarfUnit.h
@@ -328,7 +328,7 @@ protected:
/// Look in the DwarfDebug map for the MDNode that corresponds to the
/// reference.
template <typename T> T *resolve(TypedDINodeRef<T> Ref) const {
- return DD->resolve(Ref);
+ return Ref.resolve();
}
private:
OpenPOWER on IntegriCloud