----- Original Message -----
> From: [email protected]
> To: [email protected], "aaron ballman" <[email protected]>, 
> [email protected], [email protected], "a
> bataev" <[email protected]>
> Cc: [email protected], "nurmukhametov alex" 
> <[email protected]>
> Sent: Monday, September 8, 2014 6:38:44 PM
> Subject: Re: [PATCH] align_value attribute in Clang
> 
> Rebased, and removed from inappropriate
> isTypeDependent/isValueDependent checks (inappropriate here for the
> same reason they were inappropriate in patch D4601 for the
> assume_aligned attribute).
> 
> Work still needs to be done to allow use as a type attribute (so that
> the attribute follows type deduction, auto, etc.). I'll send a
> follow-up e-mail about this with questions.

I need this attribute to follow type deduction (auto, etc.), and as we've 
discussed, just making this a declaration attribute does not seem to do this. 
It seems to me that what I need to do, or at least might do, is hook 
align_value into AttributedType, and handle it in lib/Sema/SemaType.cpp. First, 
it is not clear where I should store the alignment parameter:
  - address_space stores its value in the type qualifiers
  - reg_parm stores its value as part of FunctionType
  - vector_type / ext_vector_type are their own Type subclasses (where 
ExtVectorType is a subclass of VectorType, but there is also 
DependentSizedExtVectorType which handles dependent attributes).

Given that align_value also needs to handle dependent alignment values, that 
seems most like the ExtVectorType/DependentSizedExtVectorType setup. I could 
create AlignValuePointerType/DependentAlignValuePointerType (or similar), maybe 
with AlignValuePointerType being a subclass of PointerType? (or maybe both 
being subclasses of PointerType?)

That having been said, creating subclasses of PointerType and/or new Type 
subclasses seems like an unfortunate amount of infrastructure for this feature. 
An alternative would be to place extra data directly into PointerType, but I 
don't like that idea because it adds memory (and some runtime) overhead to the 
common case with no corresponding benefit.

Ideally, I'd be able to use the original AlignValueAttr nodes, perhaps in 
combination with AttributedType somehow to indicate that a relevant 
AlignValueAttr node exists somewhere. Is there a way to do this?

In short, I'm not sure what the best way of doing this is, and I'm looking for 
advice.

Thanks again,
Hal

> 
> http://reviews.llvm.org/D4635
> 
> Files:
>   include/clang/Basic/Attr.td
>   include/clang/Basic/AttrDocs.td
>   include/clang/Basic/DiagnosticSemaKinds.td
>   include/clang/Sema/AttributeList.h
>   include/clang/Sema/Sema.h
>   lib/CodeGen/CGCall.cpp
>   lib/Sema/SemaDeclAttr.cpp
>   lib/Sema/SemaTemplateInstantiateDecl.cpp
>   test/CodeGen/align_value.cpp
>   test/Sema/align_value.c
>   test/SemaCXX/align_value.cpp
> 

-- 
Hal Finkel
Assistant Computational Scientist
Leadership Computing Facility
Argonne National Laboratory
_______________________________________________
cfe-commits mailing list
[email protected]
http://lists.cs.uiuc.edu/mailman/listinfo/cfe-commits

Reply via email to