gcc optimization flags

bridged with qdn.public.devtools
Post Reply
Nick Cianfrocco

gcc optimization flags

Post by Nick Cianfrocco » Tue Nov 05, 2002 8:40 pm

Does anyone know the equivalent flags (both general optimization or arm
specific flags) which -O1 or -O2 uses? I see different behavior when I turn
on -O1 or -O2 then when optimizations are off and I am trying to determine
which optimization combination is actually being used. I have tried
manually setting the flags but my executables are not the same as if I
use -O1 or -O2.

I am compiling for gcc_ntoarmle (xscale actually).

Here are the flags I manually tried for -O1 and -O2 from GNUDevelopment
Tools doc:
"-O1 When you specify -O, the compiler turns on -fthr ead-jumps
and -fdefer -pop on all machines. The compiler turns on -fdelay ed-branch on
machines that have delay slots, and -f omit-frame-pointer on machines that
can support debugging even without a frame pointer. On some machines the
compiler also turns on other flags.

-O2 turns on all optional optimizations except for loop unrolling, function
inlining, and register renaming. It also turns on the -ff orce-mem option on
all machines and frame pointer elimination on machines where doing so does
not interfere with debugging."

thanks
nick

Brian K. Hlady

Re: gcc optimization flags

Post by Brian K. Hlady » Thu Nov 07, 2002 8:38 pm

Good afternoon,

The reason they aren't the same is because some optimizations look like
this:

cvs.qnx.com/tools/gcc/gcc/toplev.c (gcc 2.95.2)

....
/* Perform global cse. */

if (optimize > 0 && flag_gcse)
{
if (gcse_dump)
open_dump_file (".gcse", IDENTIFIER_POINTER (DECL_NAME (decl)));

TIMEVAR (gcse_time, tem = gcse_main (insns, rtl_dump_file));
....

If you don't specify at least -O1 with -fgcse, this statement will be
skipped. This is not the only instance where the optimize flag is anded with
one of the flags that can be specified.


Cheers,
-Brian

--
+================================================+
Brian K. Hlady bhlady@qnx.com
Technical Account Manager (613) 591 0836
QNX Software Systems, Ltd. extension 9268
+================================================+

"Nick Cianfrocco" <ncianfro@harris.com> wrote in message
news:aq99v8$399$1@inn.qnx.com...
Does anyone know the equivalent flags (both general optimization or arm
specific flags) which -O1 or -O2 uses? I see different behavior when I
turn
on -O1 or -O2 then when optimizations are off and I am trying to determine
which optimization combination is actually being used. I have tried
manually setting the flags but my executables are not the same as if I
use -O1 or -O2.

I am compiling for gcc_ntoarmle (xscale actually).

Here are the flags I manually tried for -O1 and -O2 from GNUDevelopment
Tools doc:
"-O1 When you specify -O, the compiler turns on -fthr ead-jumps
and -fdefer -pop on all machines. The compiler turns on -fdelay ed-branch
on
machines that have delay slots, and -f omit-frame-pointer on machines that
can support debugging even without a frame pointer. On some machines the
compiler also turns on other flags.

-O2 turns on all optional optimizations except for loop unrolling,
function
inlining, and register renaming. It also turns on the -ff orce-mem option
on
all machines and frame pointer elimination on machines where doing so does
not interfere with debugging."

thanks
nick

Post Reply

Return to “qdn.public.devtools”