summaryrefslogtreecommitdiffstats
path: root/llvm/lib/IR
diff options
context:
space:
mode:
authorFangrui Song <maskray@google.com>2019-05-07 02:06:37 +0000
committerFangrui Song <maskray@google.com>2019-05-07 02:06:37 +0000
commitda82ce99b7460164ffb841619aadb44f397d2106 (patch)
tree6eeb15bafc58fe997fd3b0666fb47331e9287746 /llvm/lib/IR
parenta400ca3f3d42de0b0aa5c441de761d182c6010e8 (diff)
downloadbcm5719-llvm-da82ce99b7460164ffb841619aadb44f397d2106.tar.gz
bcm5719-llvm-da82ce99b7460164ffb841619aadb44f397d2106.zip
[DebugInfo] Delete TypedDINodeRef
TypedDINodeRef<T> is a redundant wrapper of Metadata * that is actually a T *. Accordingly, change DI{Node,Scope,Type}Ref uses to DI{Node,Scope,Type} * or their const variants. This allows us to delete many resolve() calls that clutter the code. Reviewed By: rnk Differential Revision: https://reviews.llvm.org/D61369 llvm-svn: 360108
Diffstat (limited to 'llvm/lib/IR')
-rw-r--r--llvm/lib/IR/DIBuilder.cpp4
-rw-r--r--llvm/lib/IR/DebugInfo.cpp27
-rw-r--r--llvm/lib/IR/DebugInfoMetadata.cpp6
3 files changed, 19 insertions, 18 deletions
diff --git a/llvm/lib/IR/DIBuilder.cpp b/llvm/lib/IR/DIBuilder.cpp
index 0cd33704093..2493c6cbe53 100644
--- a/llvm/lib/IR/DIBuilder.cpp
+++ b/llvm/lib/IR/DIBuilder.cpp
@@ -166,8 +166,8 @@ createImportedModule(LLVMContext &C, dwarf::Tag Tag, DIScope *Context,
if (Line)
assert(File && "Source location has line number but no file");
unsigned EntitiesCount = C.pImpl->DIImportedEntitys.size();
- auto *M =
- DIImportedEntity::get(C, Tag, Context, DINodeRef(NS), File, Line, Name);
+ auto *M = DIImportedEntity::get(C, Tag, Context, cast_or_null<DINode>(NS),
+ File, Line, Name);
if (EntitiesCount < C.pImpl->DIImportedEntitys.size())
// A new Imported Entity was just added to the context.
// Add it to the Imported Modules list.
diff --git a/llvm/lib/IR/DebugInfo.cpp b/llvm/lib/IR/DebugInfo.cpp
index 69579047976..ce47ef20743 100644
--- a/llvm/lib/IR/DebugInfo.cpp
+++ b/llvm/lib/IR/DebugInfo.cpp
@@ -81,7 +81,7 @@ void DebugInfoFinder::processCompileUnit(DICompileUnit *CU) {
continue;
auto *GV = DIG->getVariable();
processScope(GV->getScope());
- processType(GV->getType().resolve());
+ processType(GV->getType());
}
for (auto *ET : CU->getEnumTypes())
processType(ET);
@@ -91,7 +91,7 @@ void DebugInfoFinder::processCompileUnit(DICompileUnit *CU) {
else
processSubprogram(cast<DISubprogram>(RT));
for (auto *Import : CU->getImportedEntities()) {
- auto *Entity = Import->getEntity().resolve();
+ auto *Entity = Import->getEntity();
if (auto *T = dyn_cast<DIType>(Entity))
processType(T);
else if (auto *SP = dyn_cast<DISubprogram>(Entity))
@@ -124,14 +124,14 @@ void DebugInfoFinder::processLocation(const Module &M, const DILocation *Loc) {
void DebugInfoFinder::processType(DIType *DT) {
if (!addType(DT))
return;
- processScope(DT->getScope().resolve());
+ processScope(DT->getScope());
if (auto *ST = dyn_cast<DISubroutineType>(DT)) {
- for (DITypeRef Ref : ST->getTypeArray())
- processType(Ref.resolve());
+ for (DIType *Ref : ST->getTypeArray())
+ processType(Ref);
return;
}
if (auto *DCT = dyn_cast<DICompositeType>(DT)) {
- processType(DCT->getBaseType().resolve());
+ processType(DCT->getBaseType());
for (Metadata *D : DCT->getElements()) {
if (auto *T = dyn_cast<DIType>(D))
processType(T);
@@ -141,7 +141,7 @@ void DebugInfoFinder::processType(DIType *DT) {
return;
}
if (auto *DDT = dyn_cast<DIDerivedType>(DT)) {
- processType(DDT->getBaseType().resolve());
+ processType(DDT->getBaseType());
}
}
@@ -174,7 +174,7 @@ void DebugInfoFinder::processScope(DIScope *Scope) {
void DebugInfoFinder::processSubprogram(DISubprogram *SP) {
if (!addSubprogram(SP))
return;
- processScope(SP->getScope().resolve());
+ processScope(SP->getScope());
// Some of the users, e.g. CloneFunctionInto / CloneModule, need to set up a
// ValueMap containing identity mappings for all of the DICompileUnit's, not
// just DISubprogram's, referenced from anywhere within the Function being
@@ -187,9 +187,9 @@ void DebugInfoFinder::processSubprogram(DISubprogram *SP) {
processType(SP->getType());
for (auto *Element : SP->getTemplateParams()) {
if (auto *TType = dyn_cast<DITemplateTypeParameter>(Element)) {
- processType(TType->getType().resolve());
+ processType(TType->getType());
} else if (auto *TVal = dyn_cast<DITemplateValueParameter>(Element)) {
- processType(TVal->getType().resolve());
+ processType(TVal->getType());
}
}
}
@@ -207,7 +207,7 @@ void DebugInfoFinder::processDeclare(const Module &M,
if (!NodesSeen.insert(DV).second)
return;
processScope(DV->getScope());
- processType(DV->getType().resolve());
+ processType(DV->getType());
}
void DebugInfoFinder::processValue(const Module &M, const DbgValueInst *DVI) {
@@ -222,7 +222,7 @@ void DebugInfoFinder::processValue(const Module &M, const DbgValueInst *DVI) {
if (!NodesSeen.insert(DV).second)
return;
processScope(DV->getScope());
- processType(DV->getType().resolve());
+ processType(DV->getType());
}
bool DebugInfoFinder::addType(DIType *DT) {
@@ -428,7 +428,8 @@ private:
StringRef LinkageName = MDS->getName().empty() ? MDS->getLinkageName() : "";
DISubprogram *Declaration = nullptr;
auto *Type = cast_or_null<DISubroutineType>(map(MDS->getType()));
- DITypeRef ContainingType(map(MDS->getContainingType()));
+ DIType *ContainingType =
+ cast_or_null<DIType>(map(MDS->getContainingType()));
auto *Unit = cast_or_null<DICompileUnit>(map(MDS->getUnit()));
auto Variables = nullptr;
auto TemplateParams = nullptr;
diff --git a/llvm/lib/IR/DebugInfoMetadata.cpp b/llvm/lib/IR/DebugInfoMetadata.cpp
index 4ef38b6f7fe..d23d42d29ee 100644
--- a/llvm/lib/IR/DebugInfoMetadata.cpp
+++ b/llvm/lib/IR/DebugInfoMetadata.cpp
@@ -88,7 +88,7 @@ const DILocation *DILocation::getMergedLocation(const DILocation *LocA,
DILocation *L = LocA->getInlinedAt();
while (S) {
Locations.insert(std::make_pair(S, L));
- S = S->getScope().resolve();
+ S = S->getScope();
if (!S && L) {
S = L->getScope();
L = L->getInlinedAt();
@@ -100,7 +100,7 @@ const DILocation *DILocation::getMergedLocation(const DILocation *LocA,
while (S) {
if (Locations.count(std::make_pair(S, L)))
break;
- S = S->getScope().resolve();
+ S = S->getScope();
if (!S && L) {
S = L->getScope();
L = L->getInlinedAt();
@@ -209,7 +209,7 @@ DINode::DIFlags DINode::splitFlags(DIFlags Flags,
return Flags;
}
-DIScopeRef DIScope::getScope() const {
+DIScope *DIScope::getScope() const {
if (auto *T = dyn_cast<DIType>(this))
return T->getScope();
OpenPOWER on IntegriCloud