This is the mail archive of the gcc-patches@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]
Other format: [Raw text]

[PATCH] Use optimize_function_for_size_p to assign register frequency


This patch uses optimize_function_for_size_p to replace old
optimize_size check in regs.h and ira-int.h to make it consistent.

Bootstrapped and testing on-going.

OK for trunk if test passes?

Thanks,
Dehao

gcc/ChangeLog:
2014-05-16  Dehao Chen  <dehao@google.com>

        * ira-int.h (REG_FREQ_FROM_EDGE_FREQ): Use optimize_function_for_size_p.
        * regs.h (REG_FREQ_FROM_BB): Likewise.

Index: gcc/ira-int.h
===================================================================
--- gcc/ira-int.h       (revision 210527)
+++ gcc/ira-int.h       (working copy)
@@ -42,9 +42,8 @@ along with GCC; see the file COPYING3.  If not see
    profile driven feedback is available and the function is never
    executed, frequency is always equivalent.  Otherwise rescale the
    edge frequency.  */
-#define REG_FREQ_FROM_EDGE_FREQ(freq)                                     \
-  (optimize_size || (flag_branch_probabilities                            \
-                    && !ENTRY_BLOCK_PTR_FOR_FN (cfun)->count)             \
+#define REG_FREQ_FROM_EDGE_FREQ(freq)                             \
+  (optimize_function_for_size_p (cfun)                            \
    ? REG_FREQ_MAX : (freq * REG_FREQ_MAX / BB_FREQ_MAX)                   \
    ? (freq * REG_FREQ_MAX / BB_FREQ_MAX) : 1)

Index: gcc/regs.h
===================================================================
--- gcc/regs.h  (revision 210527)
+++ gcc/regs.h  (working copy)
@@ -135,9 +135,7 @@ extern size_t reg_info_p_size;
    or profile driven feedback is available and the function is never executed,
    frequency is always equivalent.  Otherwise rescale the basic block
    frequency.  */
-#define REG_FREQ_FROM_BB(bb) (optimize_size                                  \
-                             || (flag_branch_probabilities                   \
-                                 && !ENTRY_BLOCK_PTR_FOR_FN (cfun)->count)   \
+#define REG_FREQ_FROM_BB(bb) (optimize_function_for_size_p (cfun)            \
                              ? REG_FREQ_MAX                                  \
                              : ((bb)->frequency * REG_FREQ_MAX / BB_FREQ_MAX)\
                              ? ((bb)->frequency * REG_FREQ_MAX / BB_FREQ_MAX)\


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