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 ?

Some people, particularly those who use embedded processors need it.

Historically, the problem has been it is a lot of work to add the support, and
often times when potential customers hear how much it would cost to add the
support (either in terms of developer time and skill level needed, or cost if
they are paying somebody else to do the work) they decide they don't need it as
much.

For many users, the place where they need the support is limited to a few
places that deal with network packets or memory based hardware devices, and
usually you can define a macro abstraction layer that does the right stuff
(such as the ntoh/hton macros).  In addition to endianess, you often times need
to make sure the compiler's structure layout matches the device/network
defintion.

I have seen this come multiple times over the last 20 years I have been
associated with GCC.  It would be nice to have it in, but unless enough people
dig in and add the support, it won't get done.

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.

Another problem is you need to do it at all levels (gimple, rtl, etc.) and
often times people specialize in one level or another.  It can also be
challenging to get something like this through the approval process.

However, those are all reasons why it hasn't been done in the past.  Things do
change, so don't read this as meaning it can never be done.  Often times,
things like this can be done if people are motivated enough, so the fact it
hasn't been done before shouldn't deter you or others from trying to do it, by
working in a branch and doing merges, etc.  I would make sure you take some
time to understand the process for contributing changes if you aren't familar
with them already.

-- 
Michael Meissner, IBM
4 Technology Place Drive, MS 2203A, Westford, MA, 01886, USA
[EMAIL PROTECTED]

Reply via email to