summaryrefslogtreecommitdiffstats
path: root/llvm/lib
diff options
context:
space:
mode:
authorBill Wendling <isanbard@gmail.com>2012-12-04 06:20:49 +0000
committerBill Wendling <isanbard@gmail.com>2012-12-04 06:20:49 +0000
commitbfc0e5725f94a52e92d8f53ab5285a8a0eb1a314 (patch)
tree90d7edc33226261d8deab66915dd823edff6747b /llvm/lib
parent628c2dba60ea6978ba9aa9292c8a7e2064cbd0ef (diff)
downloadbcm5719-llvm-bfc0e5725f94a52e92d8f53ab5285a8a0eb1a314.tar.gz
bcm5719-llvm-bfc0e5725f94a52e92d8f53ab5285a8a0eb1a314.zip
Add a 'count' field to the DWARF subrange.
The count field is necessary because there isn't a difference between the 'lo' and 'hi' attributes for a one-element array and a zero-element array. When the count is '0', we know that this is a zero-element array. When it's >=1, then it's a normal constant sized array. When it's -1, then the array is unbounded. llvm-svn: 169218
Diffstat (limited to 'llvm/lib')
-rw-r--r--llvm/lib/CodeGen/AsmPrinter/DwarfCompileUnit.cpp4
-rw-r--r--llvm/lib/VMCore/DIBuilder.cpp6
2 files changed, 7 insertions, 3 deletions
diff --git a/llvm/lib/CodeGen/AsmPrinter/DwarfCompileUnit.cpp b/llvm/lib/CodeGen/AsmPrinter/DwarfCompileUnit.cpp
index 718e0dceb06..f5f36e461f1 100644
--- a/llvm/lib/CodeGen/AsmPrinter/DwarfCompileUnit.cpp
+++ b/llvm/lib/CodeGen/AsmPrinter/DwarfCompileUnit.cpp
@@ -1252,6 +1252,7 @@ void CompileUnit::constructSubrangeDIE(DIE &Buffer, DISubrange SR,
addDIEEntry(DW_Subrange, dwarf::DW_AT_type, dwarf::DW_FORM_ref4, IndexTy);
uint64_t L = SR.getLo();
uint64_t H = SR.getHi();
+ int64_t Count = SR.getCount();
// The L value defines the lower bounds which is typically zero for C/C++. The
// H value is the upper bounds. Values are 64 bit. H - L + 1 is the size
@@ -1265,7 +1266,8 @@ void CompileUnit::constructSubrangeDIE(DIE &Buffer, DISubrange SR,
}
if (L)
addUInt(DW_Subrange, dwarf::DW_AT_lower_bound, 0, L);
- addUInt(DW_Subrange, dwarf::DW_AT_upper_bound, 0, H);
+ if (H > 0 || Count != 0)
+ addUInt(DW_Subrange, dwarf::DW_AT_upper_bound, 0, H);
Buffer.addChild(DW_Subrange);
}
diff --git a/llvm/lib/VMCore/DIBuilder.cpp b/llvm/lib/VMCore/DIBuilder.cpp
index 74b69e46172..2b77edc7f99 100644
--- a/llvm/lib/VMCore/DIBuilder.cpp
+++ b/llvm/lib/VMCore/DIBuilder.cpp
@@ -741,11 +741,13 @@ DIArray DIBuilder::getOrCreateArray(ArrayRef<Value *> Elements) {
/// getOrCreateSubrange - Create a descriptor for a value range. This
/// implicitly uniques the values returned.
-DISubrange DIBuilder::getOrCreateSubrange(int64_t Lo, int64_t Hi) {
+DISubrange DIBuilder::getOrCreateSubrange(int64_t Lo, int64_t Hi,
+ int64_t Count) {
Value *Elts[] = {
GetTagConstant(VMContext, dwarf::DW_TAG_subrange_type),
ConstantInt::get(Type::getInt64Ty(VMContext), Lo),
- ConstantInt::get(Type::getInt64Ty(VMContext), Hi)
+ ConstantInt::get(Type::getInt64Ty(VMContext), Hi),
+ ConstantInt::get(Type::getInt64Ty(VMContext), Count)
};
return DISubrange(MDNode::get(VMContext, Elts));
OpenPOWER on IntegriCloud