summaryrefslogtreecommitdiffstats
path: root/llvm/lib
diff options
context:
space:
mode:
authorAdrian McCarthy <amccarth@google.com>2016-06-08 18:22:59 +0000
committerAdrian McCarthy <amccarth@google.com>2016-06-08 18:22:59 +0000
commitf3c3c13206ce76f46a633d9665d88997587cbd9c (patch)
tree021ad29a085e2c97eaab5027927dbf6c5839f526 /llvm/lib
parent1b488eb88128f07c8ffc37cacbab195dc3000b19 (diff)
downloadbcm5719-llvm-f3c3c13206ce76f46a633d9665d88997587cbd9c.tar.gz
bcm5719-llvm-f3c3c13206ce76f46a633d9665d88997587cbd9c.zip
Generate codeview for array type metadata.
Differential Revision: http://reviews.llvm.org/D21107 llvm-svn: 272187
Diffstat (limited to 'llvm/lib')
-rw-r--r--llvm/lib/CodeGen/AsmPrinter/CodeViewDebug.cpp14
-rw-r--r--llvm/lib/CodeGen/AsmPrinter/CodeViewDebug.h1
2 files changed, 15 insertions, 0 deletions
diff --git a/llvm/lib/CodeGen/AsmPrinter/CodeViewDebug.cpp b/llvm/lib/CodeGen/AsmPrinter/CodeViewDebug.cpp
index db1dc519ed5..530b1febeae 100644
--- a/llvm/lib/CodeGen/AsmPrinter/CodeViewDebug.cpp
+++ b/llvm/lib/CodeGen/AsmPrinter/CodeViewDebug.cpp
@@ -726,6 +726,8 @@ void CodeViewDebug::beginFunction(const MachineFunction *MF) {
TypeIndex CodeViewDebug::lowerType(const DIType *Ty) {
// Generic dispatch for lowering an unknown type.
switch (Ty->getTag()) {
+ case dwarf::DW_TAG_array_type:
+ return lowerTypeArray(cast<DICompositeType>(Ty));
case dwarf::DW_TAG_typedef:
return lowerTypeAlias(cast<DIDerivedType>(Ty));
case dwarf::DW_TAG_base_type:
@@ -765,6 +767,18 @@ TypeIndex CodeViewDebug::lowerTypeAlias(const DIDerivedType *Ty) {
return UnderlyingTypeIndex;
}
+TypeIndex CodeViewDebug::lowerTypeArray(const DICompositeType *Ty) {
+ DITypeRef ElementTypeRef = Ty->getBaseType();
+ TypeIndex ElementTypeIndex = getTypeIndex(ElementTypeRef);
+ // IndexType is size_t, which depends on the bitness of the target.
+ TypeIndex IndexType = Asm->MAI->getPointerSize() == 8
+ ? TypeIndex(SimpleTypeKind::UInt64Quad)
+ : TypeIndex(SimpleTypeKind::UInt32Long);
+ uint64_t Size = Ty->getSizeInBits() / 8;
+ ArrayRecord Record(ElementTypeIndex, IndexType, Size, Ty->getName());
+ return TypeTable.writeArray(Record);
+}
+
TypeIndex CodeViewDebug::lowerTypeBasic(const DIBasicType *Ty) {
TypeIndex Index;
dwarf::TypeKind Kind;
diff --git a/llvm/lib/CodeGen/AsmPrinter/CodeViewDebug.h b/llvm/lib/CodeGen/AsmPrinter/CodeViewDebug.h
index 69c9c966f93..6029243bcf4 100644
--- a/llvm/lib/CodeGen/AsmPrinter/CodeViewDebug.h
+++ b/llvm/lib/CodeGen/AsmPrinter/CodeViewDebug.h
@@ -201,6 +201,7 @@ class LLVM_LIBRARY_VISIBILITY CodeViewDebug : public DebugHandlerBase {
codeview::TypeIndex lowerType(const DIType *Ty);
codeview::TypeIndex lowerTypeAlias(const DIDerivedType *Ty);
+ codeview::TypeIndex lowerTypeArray(const DICompositeType *Ty);
codeview::TypeIndex lowerTypeBasic(const DIBasicType *Ty);
codeview::TypeIndex lowerTypePointer(const DIDerivedType *Ty);
codeview::TypeIndex lowerTypeMemberPointer(const DIDerivedType *Ty);
OpenPOWER on IntegriCloud