]> git.ipfire.org Git - thirdparty/gcc.git/commitdiff
expr.c (MOVE_BY_PIECES_P, [...]): Pass speed operand.
authorJan Hubicka <jh@suse.cz>
Mon, 1 Sep 2008 09:27:39 +0000 (09:27 +0000)
committerJan Hubicka <hubicka@gcc.gnu.org>
Mon, 1 Sep 2008 09:27:39 +0000 (09:27 +0000)
* expr.c (MOVE_BY_PIECES_P, CLEAR_BY_PIECES_P, SET_BY_PIECES_P): Pass speed operand.
* expr.h (MOVE_RATIO, CLEAR_RATIO, SET_RATIO): Update.
* gimplify.c (gimplify_init_constructor): Add speed operand.
* tree-sra.c (decide_block_copy): Likewise.
* tree-inline.c (estimate_move_cost): Likewise.
* config/alpha/alpha.h (MOVE_RATIO): Update.
* config/frv/frv.c (MOVE_RATIO): Update.
* config/spu/spu.h (MOVE_RATIO): Update.
* config/sparc/sparc.h (MOVE_RATIO): Update.
* config/i386/i386.h (MOVE_RATIO, CLEAR_RATIO): Update.
* config/m68hc11/m68hc11.h (MOVE_RATIO): Update.
* config/cris/cris.h (MOVE_RATIO): Update.
* config/mn10300/mn10300.h (MOVE_RATIO): Update.
* config/arm/arm.h (MOVE_RATIO): Update.
* config/pa/pa.md: Update uses of MOVE_RATIO
* config/pa/pa.h (MOVE_RATIO): Update.
* config/mips/mips.h (MOVE_RATIO, MOVE_BY_PIECES, CLEAR_RATIO, SET_RATIO): Update.
* config/h8300/h8300.h (MOVE_RATIO): Update.
* config/v850/v850.h (MOVE_RATIO): Update.
* config/bfin/bfin.h (MOVE_RATIO): Update.

From-SVN: r139855

21 files changed:
gcc/ChangeLog
gcc/config/alpha/alpha.h
gcc/config/arm/arm.h
gcc/config/bfin/bfin.h
gcc/config/cris/cris.h
gcc/config/h8300/h8300.h
gcc/config/i386/i386.h
gcc/config/m68hc11/m68hc11.h
gcc/config/mips/mips.h
gcc/config/mn10300/mn10300.h
gcc/config/pa/pa.h
gcc/config/pa/pa.md
gcc/config/s390/s390.h
gcc/config/sparc/sparc.h
gcc/config/spu/spu.h
gcc/config/v850/v850.h
gcc/expr.c
gcc/expr.h
gcc/gimplify.c
gcc/tree-inline.c
gcc/tree-sra.c

index 768b2967a819356606c8e6a7d4bcb0a32cd8dfb6..b2bbce1a0b78c13b5bfdc667882efaf684790d33 100644 (file)
@@ -1,3 +1,26 @@
+2008-00-01  Jan Hubicka  <jh@suse.cz>
+
+       * expr.c (MOVE_BY_PIECES_P, CLEAR_BY_PIECES_P, SET_BY_PIECES_P): Pass speed operand.
+       * expr.h (MOVE_RATIO, CLEAR_RATIO, SET_RATIO): Update.
+       * gimplify.c (gimplify_init_constructor): Add speed operand.
+       * tree-sra.c (decide_block_copy): Likewise.
+       * tree-inline.c (estimate_move_cost): Likewise.
+       * config/alpha/alpha.h (MOVE_RATIO): Update.
+       * config/frv/frv.c (MOVE_RATIO): Update.
+       * config/spu/spu.h (MOVE_RATIO): Update.
+       * config/sparc/sparc.h (MOVE_RATIO): Update.
+       * config/i386/i386.h (MOVE_RATIO, CLEAR_RATIO): Update.
+       * config/m68hc11/m68hc11.h (MOVE_RATIO): Update.
+       * config/cris/cris.h (MOVE_RATIO): Update.
+       * config/mn10300/mn10300.h (MOVE_RATIO): Update.
+       * config/arm/arm.h (MOVE_RATIO): Update.
+       * config/pa/pa.md: Update uses of MOVE_RATIO
+       * config/pa/pa.h (MOVE_RATIO): Update.
+       * config/mips/mips.h (MOVE_RATIO, MOVE_BY_PIECES, CLEAR_RATIO, SET_RATIO): Update.
+       * config/h8300/h8300.h (MOVE_RATIO): Update.
+       * config/v850/v850.h (MOVE_RATIO): Update.
+       * config/bfin/bfin.h (MOVE_RATIO): Update.
+
 2008-08-31  Andrey Belevantsev  <abel@ispras.ru>
         Dmitry Melnik  <dm@ispras.ru>
         Dmitry Zhurikhin  <zhur@ispras.ru>
index 8e022d6a5f8016b965ec468dfc28ad7108d1d7ad..c462f71fb1d066964df91a23fa85a8d28913500e 100644 (file)
@@ -1079,7 +1079,7 @@ do {                                                                           \
    Without byte/word accesses, we want no more than four instructions;
    with, several single byte accesses are better.  */
 
-#define MOVE_RATIO  (TARGET_BWX ? 7 : 2)
+#define MOVE_RATIO(speed)  (TARGET_BWX ? 7 : 2)
 
 /* Largest number of bytes of an object that can be placed in a register.
    On the Alpha we have plenty of registers, so use TImode.  */
index 4132b06b0249f107cce27b121d8c9813bb08ea5d..a8820cbdcb3f9d8a55e5278c2bcd21fb955c9984 100644 (file)
@@ -2244,7 +2244,7 @@ do {                                                      \
 #define MOVE_MAX 4
 
 #undef  MOVE_RATIO
-#define MOVE_RATIO (arm_tune_xscale ? 4 : 2)
+#define MOVE_RATIO(speed) (arm_tune_xscale ? 4 : 2)
 
 /* Define if operations between registers always perform the operation
    on the full register even if a narrower mode is specified.  */
index 826e60b9e021c38035f16ac650a3ca4cc30b0b26..4ac369f10ba9de1a24a627467c6eca8f29cfe0ca 100644 (file)
@@ -998,7 +998,7 @@ do {                                               \
 /* If a memory-to-memory move would take MOVE_RATIO or more simple
    move-instruction pairs, we will do a movmem or libcall instead.  */
 
-#define MOVE_RATIO 5
+#define MOVE_RATIO(speed) 5
 
 /* STORAGE LAYOUT: target machine storage layout
    Define this macro as a C expression which is nonzero if accessing
index b8a66e96a4baa918e07379c29838ae230fab91e6..ed1ec3deb062e6a8fc04371b963b168d6a2ecdec 100644 (file)
@@ -1242,7 +1242,7 @@ struct cum_args {int regs;};
    word-length sizes will be emitted.  The "9" will translate to
    (9 - 1) * 4 = 32 bytes maximum moved, but using 16 instructions
    (8 instruction sequences) or less.  */
-#define MOVE_RATIO 9
+#define MOVE_RATIO(speed) 9
 
 
 /* Node: Sections */
index 7305fc32f85804d6eecbd2769902749905fe3be4..4edbb2f6ba2e86e0bbbc26af8ff714581544b254 100644 (file)
@@ -1189,10 +1189,8 @@ struct cum_arg
 #define FINAL_PRESCAN_INSN(insn, operand, nop) \
   final_prescan_insn (insn, operand, nop)
 
-#define MOVE_RATIO 3
 extern int h8300_move_ratio;
-#undef  MOVE_RATIO
-#define MOVE_RATIO h8300_move_ratio
+#define MOVE_RATIO(speed) h8300_move_ratio
 
 /* Machine-specific symbol_ref flags.  */
 #define SYMBOL_FLAG_FUNCVEC_FUNCTION   (SYMBOL_FLAG_MACH_DEP << 0)
index d933c5e23896e994c4e315df99cbb4196e5bf447..cb1dca7354be57a703c8eabbd0540882db4b38ee 100644 (file)
@@ -1906,12 +1906,12 @@ do {                                                                    \
 
    If you don't define this, a reasonable default is used.  */
 
-#define MOVE_RATIO (optimize_size ? 3 : ix86_cost->move_ratio)
+#define MOVE_RATIO(speed) ((speed) ? ix86_cost->move_ratio : 3)
 
 /* If a clear memory operation would take CLEAR_RATIO or more simple
    move-instruction sequences, we will do a clrmem or libcall instead.  */
 
-#define CLEAR_RATIO (optimize_size ? 2 : MIN (6, ix86_cost->move_ratio))
+#define CLEAR_RATIO(speed) ((speed) ? MIN (6, ix86_cost->move_ratio) : 2)
 
 /* Define if shifts truncate the shift count
    which implies one can omit a sign-extension or zero-extension
index cb789e1a54fe2a12e83e7b1256cfee4501678c93..302c414bb5ca67b088fe5373a79d634d7eb84349 100644 (file)
@@ -1505,7 +1505,7 @@ do {                                                                    \
 /* MOVE_RATIO is the number of move instructions that is better than a
    block move.  Make this small on 6811, since the code size grows very
    large with each move.  */
-#define MOVE_RATIO             3
+#define MOVE_RATIO(speed)      3
 
 /* Define if shifts truncate the shift count which implies one can omit
    a sign-extension or zero-extension of a shift count.  */
index e008e8047817c89fe29cc8defe6b62c97c04eedf..86b886a373f00a88431af21717edd2c1da7d198c 100644 (file)
@@ -2940,7 +2940,7 @@ while (0)
    we'll have to generate a load/store pair for each, halve the
    value of MIPS_CALL_RATIO to take that into account.  */
 
-#define MOVE_RATIO                                     \
+#define MOVE_RATIO(speed)                              \
   (HAVE_movmemsi                                       \
    ? MIPS_MAX_MOVE_BYTES_STRAIGHT / MOVE_MAX           \
    : MIPS_CALL_RATIO / 2)
@@ -2961,20 +2961,20 @@ while (0)
          ? (SIZE) < UNITS_PER_WORD                             \
          : (SIZE) <= MIPS_MAX_MOVE_BYTES_STRAIGHT))            \
    : (move_by_pieces_ninsns (SIZE, ALIGN, MOVE_MAX_PIECES + 1) \
-      < (unsigned int) MOVE_RATIO))
+      < (unsigned int) MOVE_RATIO (false)))
 
 /* For CLEAR_RATIO, when optimizing for size, give a better estimate
    of the length of a memset call, but use the default otherwise.  */
 
-#define CLEAR_RATIO \
-  (optimize_size ? MIPS_CALL_RATIO : 15)
+#define CLEAR_RATIO(speed)\
+  ((speed) ? 15 : MIPS_CALL_RATIO)
 
 /* This is similar to CLEAR_RATIO, but for a non-zero constant, so when
    optimizing for size adjust the ratio to account for the overhead of
    loading the constant and replicating it across the word.  */
 
-#define SET_RATIO \
-  (optimize_size ? MIPS_CALL_RATIO - 2 : 15)
+#define SET_RATIO(speed) \
+  ((speed) ? 15 : MIPS_CALL_RATIO - 2)
 
 /* STORE_BY_PIECES_P can be used when copying a constant string, but
    in that case each word takes 3 insns (lui, ori, sw), or more in
index 07035fbb06bb36afc9cf1accd4ead3bd2d2b2727..c1c8057942778f1cb66cd4325dfd16c86d830645 100644 (file)
@@ -814,7 +814,7 @@ while (0)
 
 /* According expr.c, a value of around 6 should minimize code size, and
    for the MN10300 series, that's our primary concern.  */
-#define MOVE_RATIO 6
+#define MOVE_RATIO(speed) 6
 
 #define TEXT_SECTION_ASM_OP "\t.section .text"
 #define DATA_SECTION_ASM_OP "\t.section .data"
index 5e272a2f346d5a2177399aecde5909756a512c34..2966a42ddb2fd427a0e54be999011ac528617c84 100644 (file)
@@ -1506,7 +1506,7 @@ do {                                                                      \
    arguments passed in registers to avoid infinite recursion during argument
    setup for a function call.  Why?  Consider how we copy the stack slots
    reserved for parameters when they may be trashed by a call.  */
-#define MOVE_RATIO (TARGET_64BIT ? 8 : 4)
+#define MOVE_RATIO(speed) (TARGET_64BIT ? 8 : 4)
 
 /* Define if operations between registers always perform the operation
    on the full register even if a narrower mode is specified.  */
index c3d686db5c420c33caf68d78e695dad43973e802..b50ab4cb6e3b1fc625d2f468db320a0d1ef0c17a 100644 (file)
     FAIL;
 
   /* This does happen, but not often enough to worry much about.  */
-  if (size / align < MOVE_RATIO)
+  if (size / align < MOVE_RATIO (optimize_insn_for_speed_p ()))
     FAIL;
   
   /* Fall through means we're going to use our block move pattern.  */
     FAIL;
 
   /* This does happen, but not often enough to worry much about.  */
-  if (size / align < MOVE_RATIO)
+  if (size / align < MOVE_RATIO (optimize_insn_for_speed_p ()))
     FAIL;
   
   /* Fall through means we're going to use our block move pattern.  */
     FAIL;
 
   /* This does happen, but not often enough to worry much about.  */
-  if (size / align < MOVE_RATIO)
+  if (size / align < MOVE_RATIO (optimize_insn_for_speed_p ()))
     FAIL;
   
   /* Fall through means we're going to use our block clear pattern.  */
     FAIL;
 
   /* This does happen, but not often enough to worry much about.  */
-  if (size / align < MOVE_RATIO)
+  if (size / align < MOVE_RATIO (optimize_insn_for_speed_p ()))
     FAIL;
   
   /* Fall through means we're going to use our block clear pattern.  */
index a31efd24a23edd52afdcf9d8199406f73c75ad43..32ec03624bb5b1820a8c1109331d90b1d8008976 100644 (file)
@@ -872,7 +872,7 @@ extern struct rtx_def *s390_compare_op0, *s390_compare_op1, *s390_compare_emitte
    in tree-sra with UNITS_PER_WORD to make a decision so we adjust it
    here to compensate for that factor since mvc costs exactly the same
    on 31 and 64 bit.  */
-#define MOVE_RATIO (TARGET_64BIT? 2 : 4)
+#define MOVE_RATIO(speed) (TARGET_64BIT? 2 : 4)
 
 
 /* Sections.  */
index c4910a20a3160c02b4df33af29bfc4de92fbb465..2e39082e1f64b3f991e859031310a17487906f26 100644 (file)
@@ -2099,7 +2099,7 @@ do {                                                                    \
 /* If a memory-to-memory move would take MOVE_RATIO or more simple
    move-instruction pairs, we will do a movmem or libcall instead.  */
 
-#define MOVE_RATIO (optimize_size ? 3 : 8)
+#define MOVE_RATIO(speed) ((speed) ? 8 : 3)
 
 /* Define if operations between registers always perform the operation
    on the full register even if a narrower mode is specified.  */
index f78eb73c429ddba086c962a148f86601a39a6433..9839822885e842420e984e03739e47ff969b0cbd 100644 (file)
@@ -438,7 +438,7 @@ targetm.resolve_overloaded_builtin = spu_resolve_overloaded_builtin;        \
 
 #define SLOW_BYTE_ACCESS 0
 
-#define MOVE_RATIO 32
+#define MOVE_RATIO(speed) 32
 
 #define NO_FUNCTION_CSE
 
index c897b121380e6009fe7f84a6fea3a81b27319802..65e731fef796faef8725c4c229c6ecfcd6533b17 100644 (file)
@@ -865,7 +865,7 @@ do {                                                                        \
 
 /* According expr.c, a value of around 6 should minimize code size, and
    for the V850 series, that's our primary concern.  */
-#define MOVE_RATIO 6
+#define MOVE_RATIO(speed) 6
 
 /* Indirect calls are expensive, never turn a direct call
    into an indirect call.  */
index 07685b228995688438df276777751ed201ddd5d6..69b40d8af7a49aa624ef86b015e0e821aecf0e24 100644 (file)
@@ -175,7 +175,7 @@ static bool float_extend_from_mem[NUM_MACHINE_MODES][NUM_MACHINE_MODES];
 #ifndef MOVE_BY_PIECES_P
 #define MOVE_BY_PIECES_P(SIZE, ALIGN) \
   (move_by_pieces_ninsns (SIZE, ALIGN, MOVE_MAX_PIECES + 1) \
-   < (unsigned int) MOVE_RATIO)
+   < (unsigned int) MOVE_RATIO (optimize_insn_for_speed_p ()))
 #endif
 
 /* This macro is used to determine whether clear_by_pieces should be
@@ -183,7 +183,7 @@ static bool float_extend_from_mem[NUM_MACHINE_MODES][NUM_MACHINE_MODES];
 #ifndef CLEAR_BY_PIECES_P
 #define CLEAR_BY_PIECES_P(SIZE, ALIGN) \
   (move_by_pieces_ninsns (SIZE, ALIGN, STORE_MAX_PIECES + 1) \
-   < (unsigned int) CLEAR_RATIO)
+   < (unsigned int) CLEAR_RATIO (optimize_insn_for_speed_p ()))
 #endif
 
 /* This macro is used to determine whether store_by_pieces should be
@@ -191,7 +191,7 @@ static bool float_extend_from_mem[NUM_MACHINE_MODES][NUM_MACHINE_MODES];
 #ifndef SET_BY_PIECES_P
 #define SET_BY_PIECES_P(SIZE, ALIGN) \
   (move_by_pieces_ninsns (SIZE, ALIGN, STORE_MAX_PIECES + 1) \
-   < (unsigned int) SET_RATIO)
+   < (unsigned int) SET_RATIO (optimize_insn_for_speed_p ()))
 #endif
 
 /* This macro is used to determine whether store_by_pieces should be
@@ -199,7 +199,7 @@ static bool float_extend_from_mem[NUM_MACHINE_MODES][NUM_MACHINE_MODES];
 #ifndef STORE_BY_PIECES_P
 #define STORE_BY_PIECES_P(SIZE, ALIGN) \
   (move_by_pieces_ninsns (SIZE, ALIGN, STORE_MAX_PIECES + 1) \
-   < (unsigned int) MOVE_RATIO)
+   < (unsigned int) MOVE_RATIO (optimize_insn_for_speed_p ()))
 #endif
 
 /* This array records the insn_code of insns to perform block moves.  */
index 30dbaef103753f7a6425d15d5d67f98cd5c5a422..48e0e2d6dcddaeda7e71993f692b71fbff0a97e9 100644 (file)
@@ -66,10 +66,10 @@ enum expand_modifier {EXPAND_NORMAL = 0, EXPAND_STACK_PARM, EXPAND_SUM,
 
 #ifndef MOVE_RATIO
 #if defined (HAVE_movmemqi) || defined (HAVE_movmemhi) || defined (HAVE_movmemsi) || defined (HAVE_movmemdi) || defined (HAVE_movmemti)
-#define MOVE_RATIO 2
+#define MOVE_RATIO(speed) 2
 #else
 /* If we are optimizing for space (-Os), cut down the default move ratio.  */
-#define MOVE_RATIO (optimize_size ? 3 : 15)
+#define MOVE_RATIO(speed) ((speed) ? 15 : 3)
 #endif
 #endif
 
@@ -78,10 +78,10 @@ enum expand_modifier {EXPAND_NORMAL = 0, EXPAND_STACK_PARM, EXPAND_SUM,
 
 #ifndef CLEAR_RATIO
 #if defined (HAVE_setmemqi) || defined (HAVE_setmemhi) || defined (HAVE_setmemsi) || defined (HAVE_setmemdi) || defined (HAVE_setmemti)
-#define CLEAR_RATIO 2
+#define CLEAR_RATIO(speed) 2
 #else
 /* If we are optimizing for space, cut down the default clear ratio.  */
-#define CLEAR_RATIO (optimize_size ? 3 : 15)
+#define CLEAR_RATIO(speed) ((speed) ? 15 :3)
 #endif
 #endif
 
@@ -89,7 +89,7 @@ enum expand_modifier {EXPAND_NORMAL = 0, EXPAND_STACK_PARM, EXPAND_SUM,
    SET_RATIO or more simple move-instruction sequences, we will do a movmem
    or libcall instead.  */
 #ifndef SET_RATIO
-#define SET_RATIO MOVE_RATIO
+#define SET_RATIO(speed) MOVE_RATIO(speed)
 #endif
 \f
 enum direction {none, upward, downward};
index b0b5e78968de23812ff3ef4e432d523a28fa2b77..0515aac6198c4e963d21f538f35b6489a8b539a0 100644 (file)
@@ -3595,7 +3595,8 @@ gimplify_init_constructor (tree *expr_p, gimple_seq *pre_p, gimple_seq *post_p,
        if (num_type_elements < 0 && int_size_in_bytes (type) >= 0)
          cleared = true;
        /* If there are "lots" of zeros, then block clear the object first.  */
-       else if (num_type_elements - num_nonzero_elements > CLEAR_RATIO
+       else if (num_type_elements - num_nonzero_elements
+                > CLEAR_RATIO (optimize_function_for_speed_p (cfun))
                 && num_nonzero_elements < num_type_elements/4)
          cleared = true;
        /* ??? This bit ought not be needed.  For any element not present
index e38ef3a8d4efe96757f67fdf988d8b3a19669169..5919b2be0c2dcddb766d14de8186d41d01fa4625 100644 (file)
@@ -2614,7 +2614,7 @@ estimate_move_cost (tree type)
 
   size = int_size_in_bytes (type);
 
-  if (size < 0 || size > MOVE_MAX_PIECES * MOVE_RATIO)
+  if (size < 0 || size > MOVE_MAX_PIECES * MOVE_RATIO (!optimize_size))
     /* Cost of a memcpy call, 3 arguments and the call.  */
     return 4;
   else
index abe0c9f530d66a1903831a4f44ee888a64474c40..ea351ea97661baff0ce53a30a9643c60ddce2546 100644 (file)
@@ -1902,10 +1902,10 @@ decide_block_copy (struct sra_elt *elt)
             sensible default.  */
          max_size = SRA_MAX_STRUCTURE_SIZE
            ? SRA_MAX_STRUCTURE_SIZE
-           : MOVE_RATIO * UNITS_PER_WORD;
+           : MOVE_RATIO (optimize_function_for_speed_p (cfun)) * UNITS_PER_WORD;
          max_count = SRA_MAX_STRUCTURE_COUNT
            ? SRA_MAX_STRUCTURE_COUNT
-           : MOVE_RATIO;
+           : MOVE_RATIO (optimize_function_for_speed_p (cfun));
 
          full_size = tree_low_cst (size_tree, 1);
          full_count = count_type_elements (elt->type, false);