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]

gcc/config/dsp16xx/dsp16xx.h contains inconsistant OPTIMIZATION_OPTIONS


In gcc/toplev.c line 3829 till 3875, the only place where 
OPTIMIZATION_OPTIONS is "called":

-------------------------------------------------------------------------------
  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;
      /* We don't set flag_strict_aliasing here because we're still
         testing the functionality.  After it has been tested, it
         should be turned on here.  */
    }

  if (optimize >= 3)
    {
      flag_inline_functions = 1;
    }

  /* Initialize target_flags before OPTIMIZATION_OPTIONS so the latter can
     modify it.  */
  target_flags = 0;
  set_target_switch ("");

#ifdef OPTIMIZATION_OPTIONS
  /* Allow default optimizations to be specified on a per-machine basis.  */
  OPTIMIZATION_OPTIONS (optimize, optimize_size);
#endif

-------------------------------------------------------------------------------
In gcc/config/dsp16xx/dsp16xx.h we have:

#define OPTIMIZATION_OPTIONS(LEVEL,SIZE)              \
{                                                     \
    flag_gnu_linker             = FALSE;              \
                                                      \
    if (LEVEL)                                        \
    {                                                 \
        flag_omit_frame_pointer = TRUE;               \
        flag_thread_jumps       = TRUE;               \
    }                                                 \
                                                      \
    if (LEVEL >= 2)                                   \
    {                                                 \
        if (! SIZE)                                   \
          flag_strength_reduce       = TRUE;          \
        flag_cse_follow_jumps        = TRUE;          \
        flag_cse_skip_blocks         = TRUE;          \
        flag_expensive_optimizations = TRUE;          \
        flag_rerun_cse_after_loop    = TRUE;          \
    }                                                 \
                                                      \
    if ((LEVEL >= 3) && ! SIZE)                       \
    {                                                 \
       flag_inline_functions = 1;                     \
    }                                                 \
}

This macro is completely without any effect: It never sets variables that
are not already set and it never resets variables (except flag_gnu_linker).

It seems more logically to me to change it to:

#define OPTIMIZATION_OPTIONS(LEVEL, SIZE)             \
  do {                                                \
    flag_gnu_linker             = 0;                  \
                                                      \
    if (SIZE)                                         \
    {                                                 \
       flag_strength_reduce     = 0;                  \
       flag_inline_functions    = 0;                  \
    }                                                 \
  } while(0)

That is, if it is really wanted to reset `flag_strength_reduce' and
`flag_inline_functions' when `optimize_size' is set.

Shall I make a path for this?

-- 
 Carlo Wood  <carlo@runaway.xs4all.nl>


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