Partial fix for PR opt/10776
authorJan Hubicka <jh@suse.cz>
Sun, 11 Jan 2004 15:56:26 +0000 (16:56 +0100)
committerJan Hubicka <hubicka@gcc.gnu.org>
Sun, 11 Jan 2004 15:56:26 +0000 (15:56 +0000)
Partial fix for PR opt/10776
* Makefile.in (reload.o): Include param.h
* params.def (PARAM_MAX_RELOAD_SEARCH_INSNS): New parameter.
* reload.c: Include params.h.
(find_equiv_reg): Work limiting check.
* invoke.texi: Document.

From-SVN: r75679

gcc/ChangeLog
gcc/Makefile.in
gcc/doc/invoke.texi
gcc/params.def
gcc/reload.c

index 6d23396e3e96f57426434fd71e23d8ffcfbcbe29..5dee099d179e1b215312b42adfa66ef4b1d4ab31 100644 (file)
@@ -1,3 +1,12 @@
+2004-01-11  Jan Hubicka  <jh@suse.cz>
+
+       Partial fix for PR opt/10776
+       * Makefile.in (reload.o): Include param.h
+       * params.def (PARAM_MAX_RELOAD_SEARCH_INSNS): New parameter.
+       * reload.c: Include params.h.
+       (find_equiv_reg): Work limiting check.
+       * invoke.texi: Document.
+
 2004-01-11  Richard Sandiford  <rsandifo@redhat.com>
 
        * config/mips/mips.c (mips_symbolic_constant_p): Don't allow
index 101408e925dcc5d4b70031da631a15d5d71f7f3d..fde9b844cbb87e306fafbd32f9388f0d87e55a54 100644 (file)
@@ -1755,7 +1755,7 @@ ra-rewrite.o : ra-rewrite.c $(CONFIG_H) $(SYSTEM_H) coretypes.h $(TM_H) $(RTL_H)
    output.h except.h ra.h reload.h insn-config.h
 reload.o : reload.c $(CONFIG_H) $(SYSTEM_H) coretypes.h $(TM_H) $(RTL_H) flags.h output.h \
    $(EXPR_H) $(OPTABS_H) reload.h $(RECOG_H) hard-reg-set.h insn-config.h \
-   $(REGS_H) function.h real.h toplev.h $(TM_P_H)
+   $(REGS_H) function.h real.h toplev.h $(TM_P_H) $(PARAMS_H)
 reload1.o : reload1.c $(CONFIG_H) $(SYSTEM_H) coretypes.h $(TM_H) $(RTL_H) real.h flags.h \
    $(EXPR_H) $(OPTABS_H) reload.h $(REGS_H) hard-reg-set.h insn-config.h \
    $(BASIC_BLOCK_H) $(RECOG_H) output.h function.h toplev.h $(TM_P_H) \
index b57ccd9cb586a623389f4bcabdc869473ed5593e..2431cc7af312ce7f4672afb77261a3562bd2ffa3 100644 (file)
@@ -4853,6 +4853,14 @@ parameter very large effectively disables garbage collection.  Setting
 this parameter and @option{ggc-min-expand} to zero causes a full
 collection to occur at every opportunity.
 
+@table @gcctabopt
+@item max-reload-search-insns
+The maximum number of instruction reload should look backward for equivalent
+register.  Increasing values mean more aggressive optimization, making the
+compile time increase with probably slightly better performance.  The default
+value is 100.
+
+
 @item reorder-blocks-duplicate
 @itemx reorder-blocks-duplicate-feedback
 
index d665ad57ba45b59473ce6965b0985b75fb6230a1..a5b3099ca0e0b148799ce27c70d650fbe62b8b93 100644 (file)
@@ -260,6 +260,11 @@ DEFPARAM(GGC_MIN_HEAPSIZE,
 #undef GGC_MIN_EXPAND_DEFAULT
 #undef GGC_MIN_HEAPSIZE_DEFAULT
 
+DEFPARAM(PARAM_MAX_RELOAD_SEARCH_INSNS,
+        "max-reload-search-insns",
+        "The maximum number of instructions to search backward when looking for equivalent reload",
+        100)
+
 /*
 Local variables:
 mode:c
index 13f6900ce3d500f807a95c0346b35028b057ddc8..361a5029cee484f3ee4fd8921708ae58a0873150 100644 (file)
@@ -104,6 +104,7 @@ a register with any other reload.  */
 #include "output.h"
 #include "function.h"
 #include "toplev.h"
+#include "params.h"
 
 #ifndef REGNO_MODE_OK_FOR_BASE_P
 #define REGNO_MODE_OK_FOR_BASE_P(REGNO, MODE) REGNO_OK_FOR_BASE_P (REGNO)
@@ -6383,6 +6384,7 @@ find_equiv_reg (rtx goal, rtx insn, enum reg_class class, int other,
   int need_stable_sp = 0;
   int nregs;
   int valuenregs;
+  int num = 0;
 
   if (goal == 0)
     regno = goalreg;
@@ -6423,6 +6425,7 @@ find_equiv_reg (rtx goal, rtx insn, enum reg_class class, int other,
   else
     return 0;
 
+  num = 0;
   /* Scan insns back from INSN, looking for one that copies
      a value into or out of GOAL.
      Stop and give up if we reach a label.  */
@@ -6430,7 +6433,9 @@ find_equiv_reg (rtx goal, rtx insn, enum reg_class class, int other,
   while (1)
     {
       p = PREV_INSN (p);
-      if (p == 0 || GET_CODE (p) == CODE_LABEL)
+      num++;
+      if (p == 0 || GET_CODE (p) == CODE_LABEL
+         || num > PARAM_VALUE (PARAM_MAX_RELOAD_SEARCH_INSNS))
        return 0;
 
       if (GET_CODE (p) == INSN