This is the mail archive of the
gcc@gcc.gnu.org
mailing list for the GCC project.
Re: optimization hints?
- To: Alfred Perlstein <bright at rush dot net>
- Subject: Re: optimization hints?
- From: Jeffrey A Law <law at cygnus dot com>
- Date: Fri, 11 Jun 1999 02:52:25 -0600
- cc: egcs at egcs dot cygnus dot com
- Reply-To: law at cygnus dot com
In message <Pine.BSF.3.96.990611035502.14320R-100000@cygnus.rush.net>you writ
e:
>
> It has always seemed weird that C, the langue usually chosen because
> it's closeness to the machine level wouldn't have a hint like
> system for doing branches.
>
> Is there such a way to do this?
Not a good way. Cygnus did something for a customer called __builtin_expect,
but it has some serious problems, so we never contributed the code.
For your particular case, a reasonable static branch predictor would catch
it since most would predict a return value of -1 has highly unlikely since
it's an extremely common error code.
Instead of building a lot of crud for programmer directed info, we're better
off putting in a real static branch predictor as well as beefing up the
code to provide runtime branch prediction to the compiler.
Once we hae that, then you can look at optimizations based on that information
like basic block reordering.
jeff