X-Git-Url: http://git.sourceforge.jp/view?a=blobdiff_plain;f=gcc%2Fpostreload-gcse.c;h=57be7a5c39c5efed4fc22431a5c633a73f02defe;hb=59cb1238125a1ae910d3f09ce5ce838ca757c11e;hp=845cd1ff0d5e63a63dbc1d732af2b6dc841230fe;hpb=8c4c00c181e6df4f0a9afc76e4c9edbbc1c2fd41;p=pf3gnuchains%2Fgcc-fork.git diff --git a/gcc/postreload-gcse.c b/gcc/postreload-gcse.c index 845cd1ff0d5..57be7a5c39c 100644 --- a/gcc/postreload-gcse.c +++ b/gcc/postreload-gcse.c @@ -1,5 +1,5 @@ /* Post reload partially redundant load elimination - Copyright (C) 2004, 2005, 2006, 2007 + Copyright (C) 2004, 2005, 2006, 2007, 2008 Free Software Foundation, Inc. This file is part of GCC. @@ -175,12 +175,13 @@ static void free_mem (void); /* Support for hash table construction and transformations. */ static bool oprs_unchanged_p (rtx, rtx, bool); -static void record_last_reg_set_info (rtx, int); +static void record_last_reg_set_info (rtx, rtx); +static void record_last_reg_set_info_regno (rtx, int); static void record_last_mem_set_info (rtx); -static void record_last_set_info (rtx, rtx, void *); +static void record_last_set_info (rtx, const_rtx, void *); static void record_opr_changes (rtx); -static void find_mem_conflicts (rtx, rtx, void *); +static void find_mem_conflicts (rtx, const_rtx, void *); static int load_killed_in_block_p (int, rtx, bool); static void reset_opr_set_tables (void); @@ -522,6 +523,7 @@ oprs_unchanged_p (rtx x, rtx insn, bool after_insn) case CONST: case CONST_INT: case CONST_DOUBLE: + case CONST_FIXED: case CONST_VECTOR: case SYMBOL_REF: case LABEL_REF: @@ -571,7 +573,7 @@ static int mems_conflict_p; to a nonzero value. */ static void -find_mem_conflicts (rtx dest, rtx setter ATTRIBUTE_UNUSED, +find_mem_conflicts (rtx dest, const_rtx setter ATTRIBUTE_UNUSED, void *data) { rtx mem_op = (rtx) data; @@ -644,7 +646,19 @@ load_killed_in_block_p (int uid_limit, rtx x, bool after_insn) /* Record register first/last/block set information for REGNO in INSN. */ static inline void -record_last_reg_set_info (rtx insn, int regno) +record_last_reg_set_info (rtx insn, rtx reg) +{ + unsigned int regno, end_regno; + + regno = REGNO (reg); + end_regno = END_HARD_REGNO (reg); + do + reg_avail_info[regno] = INSN_CUID (insn); + while (++regno < end_regno); +} + +static inline void +record_last_reg_set_info_regno (rtx insn, int regno) { reg_avail_info[regno] = INSN_CUID (insn); } @@ -671,7 +685,7 @@ record_last_mem_set_info (rtx insn) the SET is taking place. */ static void -record_last_set_info (rtx dest, rtx setter ATTRIBUTE_UNUSED, void *data) +record_last_set_info (rtx dest, const_rtx setter ATTRIBUTE_UNUSED, void *data) { rtx last_set_insn = (rtx) data; @@ -679,7 +693,7 @@ record_last_set_info (rtx dest, rtx setter ATTRIBUTE_UNUSED, void *data) dest = SUBREG_REG (dest); if (REG_P (dest)) - record_last_reg_set_info (last_set_insn, REGNO (dest)); + record_last_reg_set_info (last_set_insn, dest); else if (MEM_P (dest)) { /* Ignore pushes, they don't clobber memory. They may still @@ -690,7 +704,7 @@ record_last_set_info (rtx dest, rtx setter ATTRIBUTE_UNUSED, void *data) if (! push_operand (dest, GET_MODE (dest))) record_last_mem_set_info (last_set_insn); else - record_last_reg_set_info (last_set_insn, STACK_POINTER_REGNUM); + record_last_reg_set_info_regno (last_set_insn, STACK_POINTER_REGNUM); } } @@ -721,17 +735,17 @@ record_opr_changes (rtx insn) /* Also record autoincremented REGs for this insn as changed. */ for (note = REG_NOTES (insn); note; note = XEXP (note, 1)) if (REG_NOTE_KIND (note) == REG_INC) - record_last_reg_set_info (insn, REGNO (XEXP (note, 0))); + record_last_reg_set_info (insn, XEXP (note, 0)); /* Finally, if this is a call, record all call clobbers. */ if (CALL_P (insn)) { - unsigned int regno, end_regno; + unsigned int regno; rtx link, x; for (regno = 0; regno < FIRST_PSEUDO_REGISTER; regno++) if (TEST_HARD_REG_BIT (regs_invalidated_by_call, regno)) - record_last_reg_set_info (insn, regno); + record_last_reg_set_info_regno (insn, regno); for (link = CALL_INSN_FUNCTION_USAGE (insn); link; link = XEXP (link, 1)) if (GET_CODE (XEXP (link, 0)) == CLOBBER) @@ -740,15 +754,11 @@ record_opr_changes (rtx insn) if (REG_P (x)) { gcc_assert (HARD_REGISTER_P (x)); - regno = REGNO (x); - end_regno = END_HARD_REGNO (x); - do - record_last_reg_set_info (insn, regno); - while (++regno < end_regno); + record_last_reg_set_info (insn, x); } } - if (! CONST_OR_PURE_CALL_P (insn)) + if (! RTL_CONST_OR_PURE_CALL_P (insn)) record_last_mem_set_info (insn); } } @@ -1056,7 +1066,7 @@ eliminate_partially_redundant_load (basic_block bb, rtx insn, if (/* No load can be replaced by copy. */ npred_ok == 0 /* Prevent exploding the code. */ - || (optimize_size && npred_ok > 1) + || (optimize_bb_for_size_p (bb) && npred_ok > 1) /* If we don't have profile information we cannot tell if splitting a critical edge is profitable or not so don't do it. */ || ((! profile_info || ! flag_branch_probabilities @@ -1163,7 +1173,7 @@ eliminate_partially_redundant_loads (void) continue; /* Do not try anything on cold basic blocks. */ - if (probably_cold_bb_p (bb)) + if (optimize_bb_for_size_p (bb)) continue; /* Reset the table of things changed since the start of the current @@ -1259,7 +1269,7 @@ gcse_after_reload_main (rtx f ATTRIBUTE_UNUSED) memset (&stats, 0, sizeof (stats)); - /* Allocate ememory for this pass. + /* Allocate memory for this pass. Also computes and initializes the insns' CUIDs. */ alloc_mem (); @@ -1296,7 +1306,8 @@ gcse_after_reload_main (rtx f ATTRIBUTE_UNUSED) static bool gate_handle_gcse2 (void) { - return (optimize > 0 && flag_gcse_after_reload); + return (optimize > 0 && flag_gcse_after_reload + && optimize_function_for_speed_p (cfun)); } @@ -1308,8 +1319,10 @@ rest_of_handle_gcse2 (void) return 0; } -struct tree_opt_pass pass_gcse2 = +struct rtl_opt_pass pass_gcse2 = { + { + RTL_PASS, "gcse2", /* name */ gate_handle_gcse2, /* gate */ rest_of_handle_gcse2, /* execute */ @@ -1321,8 +1334,8 @@ struct tree_opt_pass pass_gcse2 = 0, /* properties_provided */ 0, /* properties_destroyed */ 0, /* todo_flags_start */ - TODO_dump_func | - TODO_verify_flow | TODO_ggc_collect, /* todo_flags_finish */ - 'J' /* letter */ + TODO_dump_func | TODO_verify_rtl_sharing + | TODO_verify_flow | TODO_ggc_collect /* todo_flags_finish */ + } };