Re: OT: alias options in gcc?
Re: OT: alias options in gcc?
- Subject: Re: OT: alias options in gcc?
- From: Herbie Robinson <email@hidden>
- Date: Tue, 26 Nov 2002 04:49:45 -0500
Slight OT I know - I'm moving some DSP algorithms across to OSX and having
done some quick performance testing it has become apparent that the default
deployment gcc settings aren't being very aggressive when optimising the
code in my inner loops. The main problem is aliasing between my process
buffers (which are float *) and member variable of the enclosing class.
I can solve the problem by declaring local variables outside my inner loops
which contain copies of the referenced member variables in the inner loop,
but there is a lot of code to update if this is the only solution...
Anyone know what compiler settings I should try for gcc to change its
aliasing policy? I'm running the August ProjectBuilder update on 10.2.2.
Regards,
Cesare
The GCC optimization option is -On (that's a capital letter O
followed by a digit). The default is zero (none). The advice I've
gotten is that up to -O2 is safe. Beyond that, programs start
breaking.
The aliasing assumption you want the compiler to make is, in fact,
not safe in C. If none of the code you are compiling ever uses a
cast, then maybe some more assumptions can be made about aliasing.
Unfortunately, I haven't seen much code that doesn't have a cast
someplace in it. More to the point, a lot of the OS header files use
aliasing. Because of things like aliasing, a C compiler pretty much
has to assume that you have modified everything except automatic and
local static whenever you assign through a pointer.
The way to get good code that remains transportable (and also works
with the next release of the compiler) is to copy things that you
know aren't changing into local variables. If you name the local
variables well, the code will probably be easier to read, too.
--
-*****************************************
**
http://www.curbside-recording.com/ **
******************************************
_______________________________________________
coreaudio-api mailing list | email@hidden
Help/Unsubscribe/Archives:
http://www.lists.apple.com/mailman/listinfo/coreaudio-api
Do not post admin requests to the list. They will be ignored.