Commit 0516f6fe by Steven Bosscher Committed by Steven Bosscher

Makefile.in (OBJS-common): Add postreload-gcse.c.

	* Makefile.in (OBJS-common): Add postreload-gcse.c.
	Add new postreload-gcse.o.
	* cse.c (SAFE_HASH): Define as wrapper around safe_hash.
	(lookup_as_function, insert, rehash_using_reg, use_related_value,
	equiv_constant): Use SAFE_HASH instead of safe_hash.
	(exp_equiv_p): Export.  Add for_gcse argument when comparing
	for GCSE.
	(lookup, lookup_for_remove, merge_equiv_classes, find_best_addr,
	find_comparison_args, fold_rtx, cse_insn): Update callers.
	(hash_rtx): New function derived from old canon_hash and bits
	from gcse.c hash_expr_1.
	(canon_hash_string): Rename to hash_rtx_string.
	(canon_hash, safe_hash): Make static inline.  Call hash_rtx.
	* cselib.c (hash_rtx): Rename to cselib_hash_rtx.
	(cselib_lookup): Update this caller.
	* gcse.c (modify_mem_list_set, canon_modify_mem_list_set):
	Make static.
	(hash_expr): Call hash_rtx.
	(ldst_entry): Likewise.
	(expr_equiv_p): Call exp_equiv_p.
	(struct unoccr, hash_expr_1, hash_string_1, lookup_expr,
	reg_used_on_edge, reg_set_between_after_reload_p,
	reg_used_between_after_reload_p, get_avail_load_store_reg,
	is_jump_table_basic_block, bb_has_well_behaved_predecessors,
	get_bb_avail_insn, hash_scan_set_after_reload,
	compute_hash_table_after_reload,
	eliminate_partially_redundant_loads, gcse_after_reload,
	get_bb_avail_insn, gcse_after_reload_main): Remove.
	* postreload-gcse.c: New file, reincarnating most of the above.
	* rtl.h (exp_equiv_p, hash_rtx): New prototypes.
	(gcse_after_reload_main): Update prototype.
	* timevar.def (TV_GCSE_AFTER_RELOAD): New timevar.
	* passes.c (rest_of_handle_gcse2): Use it.

From-SVN: r86206
parent 95013377
2004-08-18 Steven Bosscher <stevenb@suse.de>
* Makefile.in (OBJS-common): Add postreload-gcse.c.
Add new postreload-gcse.o.
* cse.c (SAFE_HASH): Define as wrapper around safe_hash.
(lookup_as_function, insert, rehash_using_reg, use_related_value,
equiv_constant): Use SAFE_HASH instead of safe_hash.
(exp_equiv_p): Export. Add for_gcse argument when comparing
for GCSE.
(lookup, lookup_for_remove, merge_equiv_classes, find_best_addr,
find_comparison_args, fold_rtx, cse_insn): Update callers.
(hash_rtx): New function derived from old canon_hash and bits
from gcse.c hash_expr_1.
(canon_hash_string): Rename to hash_rtx_string.
(canon_hash, safe_hash): Make static inline. Call hash_rtx.
* cselib.c (hash_rtx): Rename to cselib_hash_rtx.
(cselib_lookup): Update this caller.
* gcse.c (modify_mem_list_set, canon_modify_mem_list_set):
Make static.
(hash_expr): Call hash_rtx.
(ldst_entry): Likewise.
(expr_equiv_p): Call exp_equiv_p.
(struct unoccr, hash_expr_1, hash_string_1, lookup_expr,
reg_used_on_edge, reg_set_between_after_reload_p,
reg_used_between_after_reload_p, get_avail_load_store_reg,
is_jump_table_basic_block, bb_has_well_behaved_predecessors,
get_bb_avail_insn, hash_scan_set_after_reload,
compute_hash_table_after_reload,
eliminate_partially_redundant_loads, gcse_after_reload,
get_bb_avail_insn, gcse_after_reload_main): Remove.
* postreload-gcse.c: New file, reincarnating most of the above.
* rtl.h (exp_equiv_p, hash_rtx): New prototypes.
(gcse_after_reload_main): Update prototype.
* timevar.def (TV_GCSE_AFTER_RELOAD): New timevar.
* passes.c (rest_of_handle_gcse2): Use it.
2004-08-18 Diego Novillo <dnovillo@redhat.com> 2004-08-18 Diego Novillo <dnovillo@redhat.com>
* tree-ssa-loop.c (pass_loop_init): Add TODO_dump_func. * tree-ssa-loop.c (pass_loop_init): Add TODO_dump_func.
......
...@@ -899,15 +899,18 @@ OBJS-common = \ ...@@ -899,15 +899,18 @@ OBJS-common = \
genrtl.o ggc-common.o global.o graph.o gtype-desc.o \ genrtl.o ggc-common.o global.o graph.o gtype-desc.o \
haifa-sched.o hooks.o ifcvt.o insn-attrtab.o insn-emit.o insn-modes.o \ haifa-sched.o hooks.o ifcvt.o insn-attrtab.o insn-emit.o insn-modes.o \
insn-extract.o insn-opinit.o insn-output.o insn-peep.o insn-recog.o \ insn-extract.o insn-opinit.o insn-output.o insn-peep.o insn-recog.o \
insn-preds.o integrate.o intl.o jump.o langhooks.o lcm.o lists.o \ integrate.o intl.o jump.o langhooks.o lcm.o lists.o local-alloc.o \
local-alloc.o loop.o modulo-sched.o \ loop.o modulo-sched.o optabs.o options.o opts.o \
optabs.o options.o opts.o params.o postreload.o predict.o \ params.o postreload.o postreload-gcse.o predict.o \
insn-preds.o integrate.o intl.o jump.o langhooks.o lcm.o lists.o \
local-alloc.o loop.o modulo-sched.o optabs.o options.o opts.o \
params.o postreload.o postreload-gcse.o predict.o \
print-rtl.o print-tree.o value-prof.o var-tracking.o \ print-rtl.o print-tree.o value-prof.o var-tracking.o \
profile.o ra.o ra-build.o ra-colorize.o ra-debug.o ra-rewrite.o \ profile.o ra.o ra-build.o ra-colorize.o ra-debug.o ra-rewrite.o \
real.o recog.o reg-stack.o regclass.o regmove.o regrename.o \ real.o recog.o reg-stack.o regclass.o regmove.o regrename.o \
reload.o reload1.o reorg.o resource.o rtl.o rtlanal.o rtl-error.o \ reload.o reload1.o reorg.o resource.o rtl.o rtlanal.o rtl-error.o \
sbitmap.o sched-deps.o sched-ebb.o sched-rgn.o sched-vis.o sdbout.o \ sbitmap.o sched-deps.o sched-ebb.o sched-rgn.o sched-vis.o sdbout.o \
simplify-rtx.o sreal.o stmt.o stor-layout.o stringpool.o \ simplify-rtx.o sreal.o stmt.o stor-layout.o stringpool.o \
targhooks.o timevar.o toplev.o tracer.o tree.o tree-dump.o unroll.o \ targhooks.o timevar.o toplev.o tracer.o tree.o tree-dump.o unroll.o \
varasm.o varray.o vec.o version.o vmsdbgout.o xcoffout.o alloc-pool.o \ varasm.o varray.o vec.o version.o vmsdbgout.o xcoffout.o alloc-pool.o \
et-forest.o cfghooks.o bt-load.o pretty-print.o $(GGC) web.o passes.o \ et-forest.o cfghooks.o bt-load.o pretty-print.o $(GGC) web.o passes.o \
...@@ -2047,6 +2050,10 @@ postreload.o : postreload.c $(CONFIG_H) $(SYSTEM_H) coretypes.h $(TM_H) $(RTL_H) ...@@ -2047,6 +2050,10 @@ postreload.o : postreload.c $(CONFIG_H) $(SYSTEM_H) coretypes.h $(TM_H) $(RTL_H)
$(EXPR_H) $(OPTABS_H) reload.h $(REGS_H) hard-reg-set.h insn-config.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 cselib.h $(TM_P_H) \ $(BASIC_BLOCK_H) $(RECOG_H) output.h function.h toplev.h cselib.h $(TM_P_H) \
except.h $(TREE_H) except.h $(TREE_H)
postreload-gcse.o : postreload-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) \
except.h $(TREE_H)
caller-save.o : caller-save.c $(CONFIG_H) $(SYSTEM_H) coretypes.h $(TM_H) $(RTL_H) \ caller-save.o : caller-save.c $(CONFIG_H) $(SYSTEM_H) coretypes.h $(TM_H) $(RTL_H) \
$(FLAGS_H) $(REGS_H) hard-reg-set.h insn-config.h $(BASIC_BLOCK_H) function.h \ $(FLAGS_H) $(REGS_H) hard-reg-set.h insn-config.h $(BASIC_BLOCK_H) function.h \
$(RECOG_H) reload.h $(EXPR_H) toplev.h $(TM_P_H) $(RECOG_H) reload.h $(EXPR_H) toplev.h $(TM_P_H)
......
...@@ -55,7 +55,7 @@ static int discard_useless_locs (void **, void *); ...@@ -55,7 +55,7 @@ static int discard_useless_locs (void **, void *);
static int discard_useless_values (void **, void *); static int discard_useless_values (void **, void *);
static void remove_useless_values (void); static void remove_useless_values (void);
static rtx wrap_constant (enum machine_mode, rtx); static rtx wrap_constant (enum machine_mode, rtx);
static unsigned int hash_rtx (rtx, enum machine_mode, int); static unsigned int cselib_hash_rtx (rtx, enum machine_mode, int);
static cselib_val *new_cselib_val (unsigned int, enum machine_mode); static cselib_val *new_cselib_val (unsigned int, enum machine_mode);
static void add_mem_for_addr (cselib_val *, cselib_val *, rtx); static void add_mem_for_addr (cselib_val *, cselib_val *, rtx);
static cselib_val *cselib_lookup_mem (rtx, int); static cselib_val *cselib_lookup_mem (rtx, int);
...@@ -257,8 +257,8 @@ entry_and_rtx_equal_p (const void *entry, const void *x_arg) ...@@ -257,8 +257,8 @@ entry_and_rtx_equal_p (const void *entry, const void *x_arg)
} }
/* The hash function for our hash table. The value is always computed with /* The hash function for our hash table. The value is always computed with
hash_rtx when adding an element; this function just extracts the hash cselib_hash_rtx when adding an element; this function just extracts the
value from a cselib_val structure. */ hash value from a cselib_val structure. */
static hashval_t static hashval_t
get_value_hash (const void *entry) get_value_hash (const void *entry)
...@@ -554,7 +554,7 @@ wrap_constant (enum machine_mode mode, rtx x) ...@@ -554,7 +554,7 @@ wrap_constant (enum machine_mode mode, rtx x)
otherwise the mode of X is used. */ otherwise the mode of X is used. */
static unsigned int static unsigned int
hash_rtx (rtx x, enum machine_mode mode, int create) cselib_hash_rtx (rtx x, enum machine_mode mode, int create)
{ {
cselib_val *e; cselib_val *e;
int i, j; int i, j;
...@@ -600,7 +600,7 @@ hash_rtx (rtx x, enum machine_mode mode, int create) ...@@ -600,7 +600,7 @@ hash_rtx (rtx x, enum machine_mode mode, int create)
for (i = 0; i < units; ++i) for (i = 0; i < units; ++i)
{ {
elt = CONST_VECTOR_ELT (x, i); elt = CONST_VECTOR_ELT (x, i);
hash += hash_rtx (elt, GET_MODE (elt), 0); hash += cselib_hash_rtx (elt, GET_MODE (elt), 0);
} }
return hash; return hash;
...@@ -646,7 +646,7 @@ hash_rtx (rtx x, enum machine_mode mode, int create) ...@@ -646,7 +646,7 @@ hash_rtx (rtx x, enum machine_mode mode, int create)
if (fmt[i] == 'e') if (fmt[i] == 'e')
{ {
rtx tem = XEXP (x, i); rtx tem = XEXP (x, i);
unsigned int tem_hash = hash_rtx (tem, 0, create); unsigned int tem_hash = cselib_hash_rtx (tem, 0, create);
if (tem_hash == 0) if (tem_hash == 0)
return 0; return 0;
...@@ -656,7 +656,7 @@ hash_rtx (rtx x, enum machine_mode mode, int create) ...@@ -656,7 +656,7 @@ hash_rtx (rtx x, enum machine_mode mode, int create)
else if (fmt[i] == 'E') else if (fmt[i] == 'E')
for (j = 0; j < XVECLEN (x, i); j++) for (j = 0; j < XVECLEN (x, i); j++)
{ {
unsigned int tem_hash = hash_rtx (XVECEXP (x, i, j), 0, create); unsigned int tem_hash = cselib_hash_rtx (XVECEXP (x, i, j), 0, create);
if (tem_hash == 0) if (tem_hash == 0)
return 0; return 0;
...@@ -926,7 +926,7 @@ cselib_lookup (rtx x, enum machine_mode mode, int create) ...@@ -926,7 +926,7 @@ cselib_lookup (rtx x, enum machine_mode mode, int create)
if (MEM_P (x)) if (MEM_P (x))
return cselib_lookup_mem (x, create); return cselib_lookup_mem (x, create);
hashval = hash_rtx (x, mode, create); hashval = cselib_hash_rtx (x, mode, create);
/* Can't even create if hashing is not possible. */ /* Can't even create if hashing is not possible. */
if (! hashval) if (! hashval)
return 0; return 0;
......
...@@ -841,10 +841,10 @@ rest_of_handle_sched2 (void) ...@@ -841,10 +841,10 @@ rest_of_handle_sched2 (void)
static void static void
rest_of_handle_gcse2 (void) rest_of_handle_gcse2 (void)
{ {
timevar_push (TV_RELOAD_CSE_REGS); timevar_push (TV_GCSE_AFTER_RELOAD);
open_dump_file (DFI_gcse2, current_function_decl); open_dump_file (DFI_gcse2, current_function_decl);
gcse_after_reload_main (get_insns (), dump_file); gcse_after_reload_main (get_insns ());
rebuild_jump_labels (get_insns ()); rebuild_jump_labels (get_insns ());
delete_trivially_dead_insns (get_insns (), max_reg_num ()); delete_trivially_dead_insns (get_insns (), max_reg_num ());
close_dump_file (DFI_gcse2, print_rtl_with_bb, get_insns ()); close_dump_file (DFI_gcse2, print_rtl_with_bb, get_insns ());
...@@ -855,7 +855,7 @@ rest_of_handle_gcse2 (void) ...@@ -855,7 +855,7 @@ rest_of_handle_gcse2 (void)
verify_flow_info (); verify_flow_info ();
#endif #endif
timevar_pop (TV_RELOAD_CSE_REGS); timevar_pop (TV_GCSE_AFTER_RELOAD);
} }
/* Register allocation pre-pass, to reduce number of moves necessary /* Register allocation pre-pass, to reduce number of moves necessary
......
...@@ -2119,6 +2119,8 @@ extern int rtx_to_tree_code (enum rtx_code); ...@@ -2119,6 +2119,8 @@ extern int rtx_to_tree_code (enum rtx_code);
extern int delete_trivially_dead_insns (rtx, int); extern int delete_trivially_dead_insns (rtx, int);
extern int cse_main (rtx, int, int, FILE *); extern int cse_main (rtx, int, int, FILE *);
extern void cse_condition_code_reg (void); extern void cse_condition_code_reg (void);
extern int exp_equiv_p (rtx, rtx, int, bool);
extern unsigned hash_rtx (rtx x, enum machine_mode, int *, int *, bool);
/* In jump.c */ /* In jump.c */
extern int comparison_dominates_p (enum rtx_code, enum rtx_code); extern int comparison_dominates_p (enum rtx_code, enum rtx_code);
...@@ -2265,7 +2267,9 @@ extern bool can_copy_p (enum machine_mode); ...@@ -2265,7 +2267,9 @@ extern bool can_copy_p (enum machine_mode);
extern rtx fis_get_condition (rtx); extern rtx fis_get_condition (rtx);
extern int gcse_main (rtx, FILE *); extern int gcse_main (rtx, FILE *);
extern int bypass_jumps (FILE *); extern int bypass_jumps (FILE *);
extern void gcse_after_reload_main (rtx, FILE *);
/* In postreload-gcse.c */
extern void gcse_after_reload_main (rtx);
/* In global.c */ /* In global.c */
extern void mark_elimination (int, int); extern void mark_elimination (int, int);
......
...@@ -122,6 +122,7 @@ DEFTIMEVAR (TV_SCHED , "scheduling") ...@@ -122,6 +122,7 @@ DEFTIMEVAR (TV_SCHED , "scheduling")
DEFTIMEVAR (TV_LOCAL_ALLOC , "local alloc") DEFTIMEVAR (TV_LOCAL_ALLOC , "local alloc")
DEFTIMEVAR (TV_GLOBAL_ALLOC , "global alloc") DEFTIMEVAR (TV_GLOBAL_ALLOC , "global alloc")
DEFTIMEVAR (TV_RELOAD_CSE_REGS , "reload CSE regs") DEFTIMEVAR (TV_RELOAD_CSE_REGS , "reload CSE regs")
DEFTIMEVAR (TV_GCSE_AFTER_RELOAD , "load CSE after reload")
DEFTIMEVAR (TV_FLOW2 , "flow 2") DEFTIMEVAR (TV_FLOW2 , "flow 2")
DEFTIMEVAR (TV_IFCVT2 , "if-conversion 2") DEFTIMEVAR (TV_IFCVT2 , "if-conversion 2")
DEFTIMEVAR (TV_PEEPHOLE2 , "peephole 2") DEFTIMEVAR (TV_PEEPHOLE2 , "peephole 2")
......
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment