summaryrefslogtreecommitdiffstats
path: root/llvm/lib/IR/DIBuilder.cpp
diff options
context:
space:
mode:
authorManman Ren <manman.ren@gmail.com>2013-09-05 18:48:31 +0000
committerManman Ren <manman.ren@gmail.com>2013-09-05 18:48:31 +0000
commit60352032bf87498601f436c9ed77c235c82f3d29 (patch)
treec7c74d94f287cf792e7cbd171ef14d1e4e240dd9 /llvm/lib/IR/DIBuilder.cpp
parent13c68ef88b23458a5030579e651fd204c8d3a0b8 (diff)
downloadbcm5719-llvm-60352032bf87498601f436c9ed77c235c82f3d29.tar.gz
bcm5719-llvm-60352032bf87498601f436c9ed77c235c82f3d29.zip
Debug Info: Use identifier to reference DIType in base type field of
ptr_to_member. We introduce a new class DITypeRef that represents a reference to a DIType. It wraps around a Value*, which can be either an identifier in MDString or an actual MDNode. The class has a helper function "resolve" that finds the actual MDNode for a given DITypeRef. We specialize getFieldAs to return a field that is a reference to a DIType. To correctly access the base type field of ptr_to_member, getClassType now calls getFieldAs<DITypeRef> to return a DITypeRef. Also add a typedef for DITypeIdentifierMap and a helper generateDITypeIdentifierMap in DebugInfo.h. In DwarfDebug.cpp, we keep a DITypeIdentifierMap and call generateDITypeIdentifierMap to actually populate the map. Verifier is updated accordingly. llvm-svn: 190081
Diffstat (limited to 'llvm/lib/IR/DIBuilder.cpp')
-rw-r--r--llvm/lib/IR/DIBuilder.cpp14
1 files changed, 13 insertions, 1 deletions
diff --git a/llvm/lib/IR/DIBuilder.cpp b/llvm/lib/IR/DIBuilder.cpp
index 51e296383e0..2ff10b593ed 100644
--- a/llvm/lib/IR/DIBuilder.cpp
+++ b/llvm/lib/IR/DIBuilder.cpp
@@ -75,6 +75,18 @@ void DIBuilder::finalize() {
DIType(TempImportedModules).replaceAllUsesWith(IMs);
}
+/// Use the type identifier instead of the actual MDNode if possible,
+/// to help type uniquing. This function returns the identifier if it
+/// exists for the given type, otherwise returns the MDNode.
+static Value *getTypeIdentifier(DIType T) {
+ if (!T.isCompositeType())
+ return T;
+ DICompositeType DTy(T);
+ if (!DTy.getIdentifier())
+ return T;
+ return DTy.getIdentifier();
+}
+
/// getNonCompileUnitScope - If N is compile unit return NULL otherwise return
/// N.
static MDNode *getNonCompileUnitScope(MDNode *N) {
@@ -322,7 +334,7 @@ DIDerivedType DIBuilder::createMemberPointerType(DIType PointeeTy,
ConstantInt::get(Type::getInt64Ty(VMContext), 0), // Offset
ConstantInt::get(Type::getInt32Ty(VMContext), 0), // Flags
PointeeTy,
- Base
+ getTypeIdentifier(Base)
};
return DIDerivedType(MDNode::get(VMContext, Elts));
}
OpenPOWER on IntegriCloud