This is the mail archive of the
gcc@gcc.gnu.org
mailing list for the GCC project.
Re: optimizers for C (and C++)
- To: ecmorgan at lucent dot com
- Subject: Re: optimizers for C (and C++)
- From: "Martin v. Loewis" <martin at mira dot isdn dot cs dot tu-berlin dot de>
- Date: Tue, 27 Apr 1999 23:53:09 +0200
- CC: egcs at egcs dot cygnus dot com
- References: <3725E67E.ACA44973@lucent.com>
> I've looked in the info documents for gcc and g++, and I cant find where it
> describes which specific -f option goes with
> the -O, -O2, -O3, etc.
>
> How high does -O go? -O6? What -f option does that include?
In general, -O can't be replaced with -f options; a lot of code tests
the setting of optimize directly. Most places only care whether
optimize>0; it would be rather boring to list them all: Use the source
if you need to find out.
As for options controlled: This happens in toplev.c. Currently, we have
if (optimize >= 1)
{
flag_defer_pop = 1;
flag_thread_jumps = 1;
#ifdef DELAY_SLOTS
flag_delayed_branch = 1;
#endif
#ifdef CAN_DEBUG_WITHOUT_FP
flag_omit_frame_pointer = 1;
#endif
}
if (optimize >= 2)
{
flag_cse_follow_jumps = 1;
flag_cse_skip_blocks = 1;
flag_gcse = 1;
flag_expensive_optimizations = 1;
flag_strength_reduce = 1;
flag_rerun_cse_after_loop = 1;
flag_rerun_loop_opt = 1;
flag_caller_saves = 1;
flag_force_mem = 1;
#ifdef INSN_SCHEDULING
flag_schedule_insns = 1;
flag_schedule_insns_after_reload = 1;
#endif
flag_regmove = 1;
flag_strict_aliasing = 1;
}
if (optimize >= 3)
{
flag_inline_functions = 1;
}
Additional flags are target specific:
PDP11: flag_omit_frame_pointer, flag_inline_functions (isn't this all
unecessary?)
i960: if ((LEVEL) >= 2) \
{ \
target_flags |= TARGET_FLAG_LEAFPROC; \
target_flags |= TARGET_FLAG_TAILCALL; \
} \
i386: if (level > 1)
flag_schedule_insns = 0;
c4x, rs6000:
if (level >= 1)
flag_branch_on_count_reg = 1;
I could not find a place where gcc checks for -O4 or higher.
Regards,
Martin