summaryrefslogtreecommitdiffstats
path: root/llvm/lib/CodeGen
diff options
context:
space:
mode:
authorHans Wennborg <hans@hanshq.net>2016-06-23 22:57:25 +0000
committerHans Wennborg <hans@hanshq.net>2016-06-23 22:57:25 +0000
commit4b63a98de3589a8f62629cfcffc4b022d2716873 (patch)
tree57f223449c6e8804bf8654748959e751c67f1579 /llvm/lib/CodeGen
parent586fc7c5be10959e35ad6b110b591ec47fa44215 (diff)
downloadbcm5719-llvm-4b63a98de3589a8f62629cfcffc4b022d2716873.tar.gz
bcm5719-llvm-4b63a98de3589a8f62629cfcffc4b022d2716873.zip
[codeview] Add classes and unions to the Local/Global UDTs lists
Differential Revision: http://reviews.llvm.org/D21655 llvm-svn: 273626
Diffstat (limited to 'llvm/lib/CodeGen')
-rw-r--r--llvm/lib/CodeGen/AsmPrinter/CodeViewDebug.cpp46
-rw-r--r--llvm/lib/CodeGen/AsmPrinter/CodeViewDebug.h2
2 files changed, 29 insertions, 19 deletions
diff --git a/llvm/lib/CodeGen/AsmPrinter/CodeViewDebug.cpp b/llvm/lib/CodeGen/AsmPrinter/CodeViewDebug.cpp
index 4c46e5177fa..ed06c5a5daa 100644
--- a/llvm/lib/CodeGen/AsmPrinter/CodeViewDebug.cpp
+++ b/llvm/lib/CodeGen/AsmPrinter/CodeViewDebug.cpp
@@ -829,6 +829,27 @@ void CodeViewDebug::beginFunction(const MachineFunction *MF) {
}
}
+void CodeViewDebug::addToUDTs(const DIType *Ty, TypeIndex TI) {
+ SmallVector<StringRef, 5> QualifiedNameComponents;
+ const DISubprogram *ClosestSubprogram = getQualifiedNameComponents(
+ Ty->getScope().resolve(), QualifiedNameComponents);
+
+ std::string FullyQualifiedName =
+ getQualifiedName(QualifiedNameComponents, Ty->getName());
+
+ if (ClosestSubprogram == nullptr)
+ GlobalUDTs.emplace_back(std::move(FullyQualifiedName), TI);
+ else if (ClosestSubprogram == CurrentSubprogram)
+ LocalUDTs.emplace_back(std::move(FullyQualifiedName), TI);
+
+ // TODO: What if the ClosestSubprogram is neither null or the current
+ // subprogram? Currently, the UDT just gets dropped on the floor.
+ //
+ // The current behavior is not desirable. To get maximal fidelity, we would
+ // need to perform all type translation before beginning emission of .debug$S
+ // and then make LocalUDTs a member of FunctionInfo
+}
+
TypeIndex CodeViewDebug::lowerType(const DIType *Ty, const DIType *ClassTy) {
// Generic dispatch for lowering an unknown type.
switch (Ty->getTag()) {
@@ -873,25 +894,7 @@ TypeIndex CodeViewDebug::lowerTypeAlias(const DIDerivedType *Ty) {
TypeIndex UnderlyingTypeIndex = getTypeIndex(UnderlyingTypeRef);
StringRef TypeName = Ty->getName();
- SmallVector<StringRef, 5> QualifiedNameComponents;
- const DISubprogram *ClosestSubprogram = getQualifiedNameComponents(
- Ty->getScope().resolve(), QualifiedNameComponents);
-
- if (ClosestSubprogram == nullptr) {
- std::string FullyQualifiedName =
- getQualifiedName(QualifiedNameComponents, TypeName);
- GlobalUDTs.emplace_back(std::move(FullyQualifiedName), UnderlyingTypeIndex);
- } else if (ClosestSubprogram == CurrentSubprogram) {
- std::string FullyQualifiedName =
- getQualifiedName(QualifiedNameComponents, TypeName);
- LocalUDTs.emplace_back(std::move(FullyQualifiedName), UnderlyingTypeIndex);
- }
- // TODO: What if the ClosestSubprogram is neither null or the current
- // subprogram? Currently, the UDT just gets dropped on the floor.
- //
- // The current behavior is not desirable. To get maximal fidelity, we would
- // need to perform all type translation before beginning emission of .debug$S
- // and then make LocalUDTs a member of FunctionInfo
+ addToUDTs(Ty, UnderlyingTypeIndex);
if (UnderlyingTypeIndex == TypeIndex(SimpleTypeKind::Int32Long) &&
TypeName == "HRESULT")
@@ -899,6 +902,7 @@ TypeIndex CodeViewDebug::lowerTypeAlias(const DIDerivedType *Ty) {
if (UnderlyingTypeIndex == TypeIndex(SimpleTypeKind::UInt16Short) &&
TypeName == "wchar_t")
return TypeIndex(SimpleTypeKind::WideCharacter);
+
return UnderlyingTypeIndex;
}
@@ -1419,6 +1423,8 @@ TypeIndex CodeViewDebug::lowerCompleteTypeClass(const DICompositeType *Ty) {
TypeIndex(0x0), getFullFilepath(Ty->getFile()))),
Ty->getLine()));
+ addToUDTs(Ty, ClassTI);
+
return ClassTI;
}
@@ -1453,6 +1459,8 @@ TypeIndex CodeViewDebug::lowerCompleteTypeUnion(const DICompositeType *Ty) {
TypeIndex(0x0), getFullFilepath(Ty->getFile()))),
Ty->getLine()));
+ addToUDTs(Ty, UnionTI);
+
return UnionTI;
}
diff --git a/llvm/lib/CodeGen/AsmPrinter/CodeViewDebug.h b/llvm/lib/CodeGen/AsmPrinter/CodeViewDebug.h
index 93480d11610..7db4e041096 100644
--- a/llvm/lib/CodeGen/AsmPrinter/CodeViewDebug.h
+++ b/llvm/lib/CodeGen/AsmPrinter/CodeViewDebug.h
@@ -230,6 +230,8 @@ class LLVM_LIBRARY_VISIBILITY CodeViewDebug : public DebugHandlerBase {
codeview::TypeIndex getScopeIndex(const DIScope *Scope);
+ void addToUDTs(const DIType *Ty, codeview::TypeIndex TI);
+
codeview::TypeIndex lowerType(const DIType *Ty, const DIType *ClassTy);
codeview::TypeIndex lowerTypeAlias(const DIDerivedType *Ty);
codeview::TypeIndex lowerTypeArray(const DICompositeType *Ty);
OpenPOWER on IntegriCloud