[cfe-dev] Fwd: a couple struct & alignment questions

Matthew O'Connor thegreendragon at gmail.com
Mon Apr 28 14:35:58 PDT 2014


On Mon, Apr 28, 2014 at 2:45 PM, Reid Kleckner <rnk at google.com> wrote:

> On Mon, Apr 21, 2014 at 1:33 PM, Matthew O'Connor <
> thegreendragon at gmail.com> wrote:
>>
>> 1. Is there a way to force Clang to respect a struct being passed by
>> value in the source (either as arguments or the return value from a
>> function) and not converted to pointers in & out?
>>
>> I think, roughly, what I want is to be able to "disable" Clang's use of
>> ABIArgInfo's Kind's Indirect & Expand.
>>
>
> What exactly do you want clang to do?  Do you want it to pass the value as
> an LLVM first class aggregate, or to use a pointer with the byval attribute?
>

Pass the value as an LLVM first class aggregate.


> Either way, there is no flag to do this.  You would have to modify Clang.
>
> First, this would break all C++, which may not matter to you.
>

How/what would this cause to break in C++?

Second, your code would probably be ABI incompatible with all other code.
>

I kind of assumed this would happen. I'm not too concerned because I have
control over what is & isn't compiled in this way & can do the necessary
ABI conversions.


> 2. Is there a way to make Clang only perform aligned loads & stores?
>>
>
> Are you asking if it's possible to force the alignment of loads and stores
> up to the natural alignment of the storage type?  Clang will already add
> alignment annotations to loads and stores as required by the language.  It
> only leaves them off in cases where it knows the alignment is lost, like
> packed structs or explicitly underaligned types.
>

That is what I'm asking.

Thanks.
-------------- next part --------------
An HTML attachment was scrubbed...
URL: <http://lists.llvm.org/pipermail/cfe-dev/attachments/20140428/0c585d85/attachment.html>


More information about the cfe-dev mailing list