This is the mail archive of the gcc@gcc.gnu.org mailing list for the GCC project.


Index Nav: [Date Index] [Subject Index] [Author Index] [Thread Index]
Message Nav: [Date Prev] [Date Next] [Thread Prev] [Thread Next]
Other format: [Raw text]

Re: Endianess attributes


On Thursday 13 November 2008, Michael Meissner wrote:
> On Thu, Nov 13, 2008 at 09:14:06PM +0100, Paul Chavent wrote:
> > Hi.
> >
> > I wonder why there aren't any endianess attributes ?
> >
> > For example we could write this :
> > int x __attribute__ ((endianess (lil))) = 0;
> >
> > Is it a silly suggestion ?
> > No one need it ?
> > Is it a bad design need ?
> >
> > Could someone give me some information ?
>
> One of the problems has been you often times lose the endianess information
> in the rtl phases, and when you recreate a MEM, it might be for the wrong
> endianess.  The memory attributes that keep track of const, volatile (and
> soon named address support) are probably sufficient so that may not be as
> much of a problem nowadays.

The biggest problem is probably that you really what the attribute to apply to 
pointers and types, not variables. In the example above you want to be able 
to do p = &x; *p = 42; and have it DTRT.  It's the same problem that you have 
with taking the address of __attribute__((packed)) stricture members[1].

Last time I checked gcc didn't have any real support for different types of 
pointer, so it's quite a bit more work than you might expect to implement 
this feature.

Paul

[1] The short answer is that you currently can't in any useful way.


Index Nav: [Date Index] [Subject Index] [Author Index] [Thread Index]
Message Nav: [Date Prev] [Date Next] [Thread Prev] [Thread Next]