Makefile.in (cse.o): Add params.h dependency.
authorZdenek Dvorak <rakdver@atrey.karlin.mff.cuni.cz>
Wed, 4 Jun 2003 07:51:41 +0000 (09:51 +0200)
committerZdenek Dvorak <rakdver@gcc.gnu.org>
Wed, 4 Jun 2003 07:51:41 +0000 (07:51 +0000)
* Makefile.in (cse.o): Add params.h dependency.
* cse.c: Include params.h.
(PATHLENGTH): Removed.
(struct cse_basic_block_data): Make path array dynamic.
(cse_end_of_basic_block): Use PARAM_MAX_CSE_PATH_LENGTH instead of PATHLENGTH.
(cse_main, cse_basic_block): Allocate path array.
* params.def (PARAM_MAX_CSE_PATH_LENGTH): New.

From-SVN: r67433

gcc/ChangeLog
gcc/Makefile.in
gcc/cse.c
gcc/params.def

index b918c909fb36268d792599e0992fa934b3bb2ce8..23a9ad0a232024547c4dc4d29dbfded34994e8a8 100644 (file)
@@ -1,3 +1,13 @@
+2003-06-04  Zdenek Dvorak  <rakdver@atrey.karlin.mff.cuni.cz>
+
+       * Makefile.in (cse.o): Add params.h dependency.
+       * cse.c: Include params.h.
+       (PATHLENGTH): Removed.
+       (struct cse_basic_block_data): Make path array dynamic.
+       (cse_end_of_basic_block): Use PARAM_MAX_CSE_PATH_LENGTH instead of PATHLENGTH.
+       (cse_main, cse_basic_block): Allocate path array.
+       * params.def (PARAM_MAX_CSE_PATH_LENGTH): New.
+
 Wed Jun  4 09:49:21 CEST 2003  Jan Hubicka  <jh@suse.cz>
 
        * i386.c (ix86_reorg): Replace the jump instead of adding nop.
index b2f99b4d79e3740f6a0d28135fcff7d21a2b27ce..f0ca525716ebfe8488ff68d5056059c6a58111f8 100644 (file)
@@ -1604,7 +1604,7 @@ cselib.o : cselib.c $(CONFIG_H) $(SYSTEM_H) coretypes.h $(TM_H) $(RTL_H) $(REGS_
 cse.o : cse.c $(CONFIG_H) $(SYSTEM_H) coretypes.h $(TM_H) $(RTL_H) $(REGS_H) \
    hard-reg-set.h flags.h real.h insn-config.h $(RECOG_H) $(EXPR_H) toplev.h \
    output.h function.h $(BASIC_BLOCK_H) $(GGC_H) $(TM_P_H) $(TIMEVAR_H) \
-   except.h $(TARGET_H)
+   except.h $(TARGET_H) $(PARAMS_H)
 gcse.o : gcse.c $(CONFIG_H) $(SYSTEM_H) coretypes.h $(TM_H) $(RTL_H) $(REGS_H) \
    hard-reg-set.h flags.h real.h insn-config.h ggc.h $(RECOG_H) $(EXPR_H) \
    $(BASIC_BLOCK_H) function.h output.h toplev.h $(TM_P_H) $(PARAMS_H) except.h gt-gcse.h
index 4f59babbfc9ed5f1bf7aa5b397b6d9fdfa371ce0..65b068427848bfcba2e80660135d1c42bd337bc8 100644 (file)
--- a/gcc/cse.c
+++ b/gcc/cse.c
@@ -42,6 +42,7 @@ Software Foundation, 59 Temple Place - Suite 330, Boston, MA
 #include "timevar.h"
 #include "except.h"
 #include "target.h"
+#include "params.h"
 
 /* The basic idea of common subexpression elimination is to go
    through the code, keeping a record of expressions that would
@@ -569,10 +570,6 @@ static struct table_elt *last_jump_equiv_class;
 
 static int constant_pool_entries_cost;
 
-/* Define maximum length of a branch path.  */
-
-#define PATHLENGTH     10
-
 /* This data describes a block that will be processed by cse_basic_block.  */
 
 struct cse_basic_block_data
@@ -596,7 +593,7 @@ struct cse_basic_block_data
         except that it is used when the destination label is not preceded
        by a BARRIER.  */
       enum taken {TAKEN, NOT_TAKEN, AROUND} status;
-    } path[PATHLENGTH];
+    } *path;
 };
 
 static bool fixed_base_plus_p  PARAMS ((rtx x));
@@ -6947,7 +6944,7 @@ cse_end_of_basic_block (insn, data, follow_jumps, after_loop, skip_blocks)
         In this case invalidate_skipped_block will be called to invalidate any
         registers set in the block when following the jump.  */
 
-      else if ((follow_jumps || skip_blocks) && path_size < PATHLENGTH - 1
+      else if ((follow_jumps || skip_blocks) && path_size < PARAM_VALUE (PARAM_MAX_CSE_PATH_LENGTH) - 1
               && GET_CODE (p) == JUMP_INSN
               && GET_CODE (PATTERN (p)) == SET
               && GET_CODE (SET_SRC (PATTERN (p))) == IF_THEN_ELSE
@@ -7077,6 +7074,9 @@ cse_main (f, nregs, after_loop, file)
   rtx insn = f;
   int i;
 
+  val.path = xmalloc (sizeof (struct branch_path)
+                     * PARAM_VALUE (PARAM_MAX_CSE_PATH_LENGTH));
+
   cse_jumps_altered = 0;
   recorded_label_ref = 0;
   constant_pool_entries_cost = 0;
@@ -7200,6 +7200,7 @@ cse_main (f, nregs, after_loop, file)
   end_alias_analysis ();
   free (uid_cuid);
   free (reg_eqv_table);
+  free (val.path);
 
   return cse_jumps_altered || recorded_label_ref;
 }
@@ -7377,7 +7378,10 @@ cse_basic_block (from, to, next_branch, around_loop)
             following branches in this case.  */
          to_usage = 0;
          val.path_size = 0;
+         val.path = xmalloc (sizeof (struct branch_path)
+                             * PARAM_VALUE (PARAM_MAX_CSE_PATH_LENGTH));
          cse_end_of_basic_block (insn, &val, 0, 0, 0);
+         free (val.path);
 
          /* If the tables we allocated have enough space left
             to handle all the SETs in the next basic block,
index cd68c03929f24eddd8ea4eb4baf6e53668e02f1e..9d9d973ec0b6145613f88ddebd5fbd2fda9f42f2 100644 (file)
@@ -264,6 +264,12 @@ DEFPARAM(PARAM_MAX_CROSSJUMP_EDGES,
         "The maximum number of incoming edges to consider for crossjumping",
         100)
 
+/* The maximum length of path considered in cse.  */
+DEFPARAM(PARAM_MAX_CSE_PATH_LENGTH,
+        "max-cse-path-length",
+        "The maximum length of path considered in cse.",
+        10)
+
 #ifdef ENABLE_GC_ALWAYS_COLLECT
 # define GGC_MIN_EXPAND_DEFAULT 0
 # define GGC_MIN_HEAPSIZE_DEFAULT 0