[cfe-dev] Fwd: a couple struct & alignment questions
Reid Kleckner
rnk at google.com
Mon Apr 28 13:45:36 PDT 2014
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?
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.
Second, your code would probably be ABI incompatible with all other code.
> 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.
-------------- next part --------------
An HTML attachment was scrubbed...
URL: <http://lists.llvm.org/pipermail/cfe-dev/attachments/20140428/9dae6f2a/attachment.html>
More information about the cfe-dev
mailing list