File pathlength.patch of Package gcc33
* 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.
Index: Makefile.in
===================================================================
RCS file: /cvsroot/gcc/gcc/gcc/Makefile.in,v
retrieving revision 1.955.2.17
diff -c -3 -p -r1.955.2.17 Makefile.in
*** gcc/Makefile.in 1 May 2003 09:55:35 -0000 1.955.2.17
--- gcc/Makefile.in 2 Jun 2003 14:27:16 -0000
*************** cselib.o : cselib.c $(CONFIG_H) $(SYSTEM
*** 1508,1514 ****
output.h function.h cselib.h $(GGC_H) $(TM_P_H) gt-cselib.h
cse.o : cse.c $(CONFIG_H) $(SYSTEM_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)
gcse.o : gcse.c $(CONFIG_H) $(SYSTEM_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
--- 1508,1514 ----
output.h function.h cselib.h $(GGC_H) $(TM_P_H) gt-cselib.h
cse.o : cse.c $(CONFIG_H) $(SYSTEM_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) $(PARAMS_H)
gcse.o : gcse.c $(CONFIG_H) $(SYSTEM_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: cse.c
===================================================================
RCS file: /cvsroot/gcc/gcc/gcc/cse.c,v
retrieving revision 1.243.2.3
diff -c -3 -p -r1.243.2.3 cse.c
*** gcc/cse.c 1 May 2003 09:55:38 -0000 1.243.2.3
--- gcc/cse.c 2 Jun 2003 14:27:16 -0000
*************** Software Foundation, 59 Temple Place - S
*** 38,43 ****
--- 38,44 ----
#include "output.h"
#include "ggc.h"
#include "timevar.h"
+ #include "params.h"
/* The basic idea of common subexpression elimination is to go
through the code, keeping a record of expressions that would
*************** static struct table_elt *last_jump_equiv
*** 561,570 ****
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
--- 562,567 ----
*************** struct cse_basic_block_data
*** 588,594 ****
except that it is used when the destination label is not preceded
by a BARRIER. */
enum taken {TAKEN, NOT_TAKEN, AROUND} status;
! } path[PATHLENGTH];
};
/* Nonzero if X has the form (PLUS frame-pointer integer). We check for
--- 585,591 ----
except that it is used when the destination label is not preceded
by a BARRIER. */
enum taken {TAKEN, NOT_TAKEN, AROUND} status;
! } *path;
};
/* Nonzero if X has the form (PLUS frame-pointer integer). We check for
*************** cse_end_of_basic_block (insn, data, foll
*** 6981,6987 ****
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
&& GET_CODE (p) == JUMP_INSN
&& GET_CODE (PATTERN (p)) == SET
&& GET_CODE (SET_SRC (PATTERN (p))) == IF_THEN_ELSE
--- 6978,6984 ----
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 < 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
*************** cse_main (f, nregs, after_loop, file)
*** 7111,7116 ****
--- 7108,7116 ----
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;
*************** cse_main (f, nregs, after_loop, file)
*** 7234,7239 ****
--- 7234,7240 ----
end_alias_analysis ();
free (uid_cuid);
free (reg_eqv_table);
+ free (val.path);
return cse_jumps_altered || recorded_label_ref;
}
*************** cse_basic_block (from, to, next_branch,
*** 7411,7417 ****
--- 7412,7421 ----
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: params.def
===================================================================
RCS file: /cvsroot/gcc/gcc/gcc/params.def,v
retrieving revision 1.16.2.6
diff -c -3 -p -r1.16.2.6 params.def
*** gcc/params.def 1 May 2003 09:55:43 -0000 1.16.2.6
--- gcc/params.def 2 Jun 2003 14:27:16 -0000
*************** DEFPARAM(PARAM_MAX_CROSSJUMP_EDGES,
*** 257,262 ****
--- 257,268 ----
"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