[LLVMdev] PR400 - alignment for LD/ST

Reid Spencer rspencer at reidspencer.com
Thu Mar 29 14:05:08 PDT 2007


Hi Mark,

On Thu, 2007-03-29 at 13:33 -0700, Schimmel, Mark wrote:
> It would be really nice if llvm-as had some extra syntax to let other
> compilers specify the exact layout of a struct.  Specifically, I'd like
> to specify what the byte offsets are for each field without having to
> insert phony fields.  Would this extra functionality fit into your work
> at all? 

I suggest you open a Bugzilla PR on this as "enhancement" and detail
exactly what your proposal is. There's lots of ways to skin this cat. I
would actually like to see the structure definition generalized so that
we accomplish the following:

1. We don't need "packed struct" at all (because its redundant with
"struct")
2. Structure definitions are expanded to not only specify the size of
each field
   (by its type) but also its byte width (for padding) and alignment.
3. Without specific padding/alignment specifications, LLVM defaults to
what is
   normal for the ABI on the given target.
4. Some kind of thing for specifying packed "portions" of a structure,
e.g.:
    struct { packed { i2, i3, i5, i6 }, i16 }
   which is just an i32 with identifiable fields. The "packed" grouping
just
   turns off the normal padding/alignment. However, as a whole the
"packed"
   grouping is aligned/padded.

Feel free to include these ideas in the PR if they make sense to you. We
can have a discussion in the PR about the best way to accomplish these
goals. I'm sure Chris and others have various comments on this.

Reid.

> 
> -----Original Message-----
> From: llvmdev-bounces at cs.uiuc.edu [mailto:llvmdev-bounces at cs.uiuc.edu]
> On Behalf Of Devang Patel
> Sent: Thursday, March 29, 2007 12:49 PM
> To: LLVM Developers Mailing List
> Subject: Re: [LLVMdev] PR400 - alignment for LD/ST
> 
> 
> On Mar 29, 2007, at 12:24 PM, Christopher Lamb wrote:
> 
> > Is anyone actively working on this currently? It's marked as  
> > unassigned in BZ.
> 
> In next few days I'll get to this. At the moment I'm enabling Packed  
> Structure support in llvm-gcc (based on patches developed by other  
> llvm developers) and adding support for packed bit fields. As part of  
> this work,  alignment for LD/ST is required to access packed structure  
> fields which are not aligned naturally.
> 
> -
> Devang
> 
> _______________________________________________
> LLVM Developers mailing list
> LLVMdev at cs.uiuc.edu         http://llvm.cs.uiuc.edu
> http://lists.cs.uiuc.edu/mailman/listinfo/llvmdev
> 
> _______________________________________________
> LLVM Developers mailing list
> LLVMdev at cs.uiuc.edu         http://llvm.cs.uiuc.edu
> http://lists.cs.uiuc.edu/mailman/listinfo/llvmdev




More information about the llvm-dev mailing list