[Lldb-commits] [PATCH] D17501: Fix test for homogeneity in case of aggregate consisting of containerized vector types
Muhammad Omair Javaid via lldb-commits
lldb-commits at lists.llvm.org
Mon Feb 22 03:38:03 PST 2016
omjavaid created this revision.
omjavaid added a reviewer: clayborg.
omjavaid added a subscriber: lldb-commits.
Herald added a subscriber: aemerson.
This patch ClangASTContext::IsHomogeneousAggregate test for homogeneity in light of Arm procedure call standard definition of a homogeneous aggregate given below:
A Homogeneous Aggregate is a Composite Type where all of the Fundamental Data Types that compose the type
are the same. The test for homogeneity is applied after data layout is completed and without regard to access
control or other source language restrictions.
An aggregate consisting of containerized vector types is treated as homogeneous if all the members are of the
same size, even if the internal format of the containerized members are different. For example, a structure
containing a vector of 8 bytes and a vector of 4 half-words satisfies the requirements for a homogeneous
aggregate.
A Homogenous Aggregate has a Base Type, which is the Fundamental Data Type of each Element. The overall
size is the size of the Base Type multiplied by the number of Elements; its alignment will be the alignment of the
Base Type.
ClangASTContext::IsHomogeneousAggregate functions is currently only used by ARM ABI and I have not seen a conflicting definition of a Homogenous Aggregate elsewhere so seems safe to use ARM's definition as is.
LGTM?
http://reviews.llvm.org/D17501
Files:
source/Symbol/ClangASTContext.cpp
Index: source/Symbol/ClangASTContext.cpp
===================================================================
--- source/Symbol/ClangASTContext.cpp
+++ source/Symbol/ClangASTContext.cpp
@@ -3100,9 +3100,11 @@
bool is_hva = false;
bool is_hfa = false;
clang::QualType base_qual_type;
+ uint64_t base_bitwidth = 0;
for (field_pos = record_decl->field_begin(); field_pos != field_end; ++field_pos)
{
clang::QualType field_qual_type = field_pos->getType();
+ uint64_t field_bitwidth = getASTContext()->getTypeSize (qual_type);
if (field_qual_type->isFloatingType())
{
if (field_qual_type->isComplexType())
@@ -3123,22 +3125,21 @@
}
else if (field_qual_type->isVectorType() || field_qual_type->isExtVectorType())
{
- const clang::VectorType *array = field_qual_type.getTypePtr()->getAs<clang::VectorType>();
- if (array && array->getNumElements() <= 4)
+ if (num_fields == 0)
{
- if (num_fields == 0)
- base_qual_type = array->getElementType();
- else
- {
- if (is_hfa)
- return 0;
- is_hva = true;
- if (field_qual_type.getTypePtr() != base_qual_type.getTypePtr())
- return 0;
- }
+ base_qual_type = field_qual_type;
+ base_bitwidth = field_bitwidth;
}
else
- return 0;
+ {
+ if (is_hfa)
+ return 0;
+ is_hva = true;
+ if (base_bitwidth != field_bitwidth)
+ return 0;
+ if (field_qual_type.getTypePtr() != base_qual_type.getTypePtr())
+ return 0;
+ }
}
else
return 0;
-------------- next part --------------
A non-text attachment was scrubbed...
Name: D17501.48663.patch
Type: text/x-patch
Size: 2834 bytes
Desc: not available
URL: <http://lists.llvm.org/pipermail/lldb-commits/attachments/20160222/a64fe546/attachment-0001.bin>
More information about the lldb-commits
mailing list