This is the mail archive of the
gcc@gcc.gnu.org
mailing list for the GCC project.
Re: What is exactly in O2?
- To: Jean Francois Martinez <jfm2 at club-internet dot fr>
- Subject: Re: What is exactly in O2?
- From: Phil Edwards <pedwards at disaster dot jaj dot com>
- Date: Wed, 31 Jan 2001 17:33:42 -0500
- Cc: gcc at gcc dot gnu dot org
- References: <200101312210.XAA22020@front7.grolier.fr>
Answering your questions in reverse order:
> A subsidiary question if this is the right place to ask this kind of questions.
Sure.
> I would like to learn how can I determine exactly the set of compile flags who
> are triggered by O2.
If you want an /exact/ answer you have to go to the source. In this case,
a good place to start is gcc/toplev.c, around line 4600. There you will
find the logic that eventually includes (among other things):
flag_optimize_sibling_calls = 1;
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;
flag_peephole2 = 1;
#ifdef INSN_SCHEDULING
flag_schedule_insns = 1;
flag_schedule_insns_after_reload = 1;
#endif
flag_regmove = 1;
flag_strict_aliasing = 1;
flag_delete_null_pointer_checks = 1;
flag_reorder_blocks = 1;
There are some others as well from the -O1 setting, plus any platform-
dependant tweaks.
Somewhere I have a patch to allow a -print-flags switch to the compiler,
which will parse all the other command-line switches and then print the
flag_* variables which get changed. It's useful for this kind of thing,
e.g., "-O2 -print-flags". If you would this useful I'll mail it to you.
Phil
--
pedwards at disaster dot jaj dot com | pme at sources dot redhat dot com
devphil at several other less interesting addresses in various dot domains
The gods do not protect fools. Fools are protected by more capable fools.