Feature Request
Fergus Henderson
fjh@cs.mu.OZ.AU
Wed Nov 6 23:23:00 GMT 2002
On 06-Nov-2002, L C <listcatcher@shaw.ca> wrote:
> 1) I don't think the ISO code and unecessary typecasting issues would be
> a concern since the requested compiler switch would obviously not be the
> default. You would have to intentionally enable it and therefore realize
> the ramifications.
Nevertheless, adding a compiler switch like which changes the language
semantics means adding another "dialect" of C. Having a proliferation
of different dialects leads to a number of difficulties, e.g. it makes
reusing existing code more difficult. Hence it would be much nicer to
just get the compiler to optimize the code better, rather than creating
a new dialect.
> 2) I'm an experienced hardware/firmware developer and I'm afraid I
> wouldn't have a clue how to write the backend code you are talking
> about.
Well, you could have a look at the code for the IP 2022 backend.
Certainly it is true that writing or maintaining code like this
requires considerable understanding of GCC internals. But this is
a better way of doing it. It would IMHO be a bad idea to add a
compiler switch merely because no-one with the necessary expertise
to write a back-end optimization pass was willing to take on the task.
> A simple compiler switch would simplify matters greatly.
It would simplify some things, but at the expense of complicating other
things. For example, adding such a compiler switch would make it more
difficult to test GCC. The end result of that would be a compiler which
is overall less reliable and more difficult to maintain.
> 3) I think for a typical simple embedded systems program the savings
> would be greater than your 2-2.5%. I changed one arithmetic calculation
> on my AVR such that I casted every calc back to unsigned char and the
> code to do the calculation went from about 14 bytes to 4. It would also
> be especially valuable in interrupt service routines where small code
> size is key.
For interrupt service routines it is easy enough to add the desired
casts manually, no?
--
Fergus Henderson <fjh@cs.mu.oz.au> | "I have always known that the pursuit
The University of Melbourne | of excellence is a lethal habit"
WWW: <http://www.cs.mu.oz.au/~fjh> | -- the last words of T. S. Garp.
More information about the Gcc
mailing list