Switch the type field in DIVariable and DIGlobalVariable over to DITypeRefs.

This allows us to catch more opportunities for ODR-based type uniquing
during LTO.
Paired commit with CFE which updates some testcases to verify the new
DIBuilder behavior.

git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@204106 91177308-0d34-0410-b5e6-96231b3b80d8
This commit is contained in:
Adrian Prantl
2014-03-18 02:34:58 +00:00
parent 4d82ca7462
commit 5e8144df32
9 changed files with 51 additions and 32 deletions

View File

@@ -541,10 +541,11 @@ bool DIGlobalVariable::Verify() const {
if (getDisplayName().empty())
return false;
// Make sure context @ field 2 and type @ field 8 are MDNodes.
// Make sure context @ field 2 is an MDNode.
if (!fieldIsMDNode(DbgNode, 2))
return false;
if (!fieldIsMDNode(DbgNode, 8))
// Make sure that type @ field 8 is a DITypeRef.
if (!fieldIsTypeRef(DbgNode, 8))
return false;
// Make sure StaticDataMemberDeclaration @ field 12 is MDNode.
if (!fieldIsMDNode(DbgNode, 12))
@@ -558,10 +559,11 @@ bool DIVariable::Verify() const {
if (!isVariable())
return false;
// Make sure context @ field 1 and type @ field 5 are MDNodes.
// Make sure context @ field 1 is an MDNode.
if (!fieldIsMDNode(DbgNode, 1))
return false;
if (!fieldIsMDNode(DbgNode, 5))
// Make sure that type @ field 5 is a DITypeRef.
if (!fieldIsTypeRef(DbgNode, 5))
return false;
return DbgNode->getNumOperands() >= 8;
}
@@ -999,7 +1001,7 @@ void DebugInfoFinder::processModule(const Module &M) {
DIGlobalVariable DIG(GVs.getElement(i));
if (addGlobalVariable(DIG)) {
processScope(DIG.getContext());
processType(DIG.getType());
processType(DIG.getType().resolve(TypeIdentifierMap));
}
}
DIArray SPs = CU.getSubprograms();
@@ -1133,7 +1135,7 @@ void DebugInfoFinder::processDeclare(const Module &M,
if (!NodesSeen.insert(DV))
return;
processScope(DIVariable(N).getContext());
processType(DIVariable(N).getType());
processType(DIVariable(N).getType().resolve(TypeIdentifierMap));
}
void DebugInfoFinder::processValue(const Module &M, const DbgValueInst *DVI) {
@@ -1149,7 +1151,7 @@ void DebugInfoFinder::processValue(const Module &M, const DbgValueInst *DVI) {
if (!NodesSeen.insert(DV))
return;
processScope(DIVariable(N).getContext());
processType(DIVariable(N).getType());
processType(DIVariable(N).getType().resolve(TypeIdentifierMap));
}
/// addType - Add type into Tys.