This is the mail archive of the gcc@gcc.gnu.org mailing list for the GCC project.


Index Nav: [Date Index] [Subject Index] [Author Index] [Thread Index]
Message Nav: [Date Prev] [Date Next] [Thread Prev] [Thread Next]

Re: What is exactly in O2?



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.

Index Nav: [Date Index] [Subject Index] [Author Index] [Thread Index]
Message Nav: [Date Prev] [Date Next] [Thread Prev] [Thread Next]