Commit f9957958 by Mostafa Hagog Committed by David Edelsohn

common.opt: Add description of the new -fgcse-after-reload flag.

2004-03-03  Mostafa Hagog  <mustafa@il.ibm.com>

        * common.opt: Add description of the new -fgcse-after-reload flag.

        * flags.h (flag_gcse_after_reload): Declaration of global variable.

        * gcse.c (reg_used_on_edge ,reg_set_between_after_reload_p,
        reg_used_between_after_reload_p, rtx 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): New functions to implement
        gcse-after-reload.
        (gcse_after_reload_main): New function, the main entry point to
        gcse-after-reload.

        * rtl.h (gcse_after_reload_main): Declaration of the new function.

        * opts.c (common_handle_option): Handle the -fgcse-after-reload flag.

        * toplev.c (flag_gcse_after_reload): Initialization.

        * passes.c (rest_of_handl_gcse2): Call gcse_after_reload_main.

        * params.def (PARAM_GCSE_AFTER_RELOAD_PARTIAL_FRACTION,
        PARAM_GCSE_AFTER_RELOAD_CRITICAL_FRACTION): New parameters for tuning
        the gcse after reload optimization.

        * params.h (GCSE_AFTER_RELOAD_PARTIAL_FRACTION,
        GCSE_AFTER_RELOAD_CRITICAL_FRACTION): Two macros to access the tuning
        parameters.

        * doc/invoke.texi: Documentation for the new flag gcse-after-reload.

From-SVN: r78842
parent 6f6dedf5
2004-03-03 Mostafa Hagog <mustafa@il.ibm.com>
* common.opt: Add description of the new -fgcse-after-reload flag.
* flags.h (flag_gcse_after_reload): Declaration of global variable.
* gcse.c (reg_used_on_edge ,reg_set_between_after_reload_p,
reg_used_between_after_reload_p, rtx 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): New functions to implement
gcse-after-reload.
(gcse_after_reload_main): New function, the main entry point to
gcse-after-reload.
* rtl.h (gcse_after_reload_main): Declaration of the new function.
* opts.c (common_handle_option): Handle the -fgcse-after-reload flag.
* toplev.c (flag_gcse_after_reload): Initialization.
* passes.c (rest_of_handl_gcse2): Call gcse_after_reload_main.
* params.def (PARAM_GCSE_AFTER_RELOAD_PARTIAL_FRACTION,
PARAM_GCSE_AFTER_RELOAD_CRITICAL_FRACTION): New parameters for tuning
the gcse after reload optimization.
* params.h (GCSE_AFTER_RELOAD_PARTIAL_FRACTION,
GCSE_AFTER_RELOAD_CRITICAL_FRACTION): Two macros to access the tuning
parameters.
* doc/invoke.texi: Documentation for the new flag gcse-after-reload.
2004-03-03 Nicolas Pitre <nico@cam.org>
* config/arm/ieee754-df.S (muldf3, divdf3): Fix denormalization of
......
......@@ -371,7 +371,13 @@ Perform store motion after global common subexpression elimination
fgcse-las
Common
Perform redundant load after store elimination in global common subexpression elimination
Perform redundant load after store elimination in global common subexpression
elimination
fgcse-after-reload
Common
Perform global common subexpression elimination after register allocation
has finished.
fguess-branch-probability
Common
......
......@@ -270,8 +270,8 @@ in the following sections.
-fdelayed-branch -fdelete-null-pointer-checks @gol
-fexpensive-optimizations -ffast-math -ffloat-store @gol
-fforce-addr -fforce-mem -ffunction-sections @gol
-fgcse -fgcse-lm -fgcse-sm -fgcse-las -floop-optimize @gol
-fcrossjumping -fif-conversion -fif-conversion2 @gol
-fgcse -fgcse-lm -fgcse-sm -fgcse-las -fgcse-after-reload @gol
-floop-optimize -fcrossjumping -fif-conversion -fif-conversion2 @gol
-finline-functions -finline-limit=@var{n} -fkeep-inline-functions @gol
-fkeep-static-consts -fmerge-constants -fmerge-all-constants @gol
-fmove-all-movables -fnew-ra -fno-branch-count-reg @gol
......@@ -3646,7 +3646,8 @@ invoking @option{-O2} on programs that use computed gotos.
@opindex O3
Optimize yet more. @option{-O3} turns on all optimizations specified by
@option{-O2} and also turns on the @option{-finline-functions},
@option{-fweb} and @option{-frename-registers} options.
@option{-fweb}, @option{-frename-registers}
and @option{-fgcse-after-reload} options.
@item -O0
@opindex O0
......@@ -3957,6 +3958,12 @@ same memory location (both partial and full redundancies).
Enabled by default when gcse is enabled.
@item -fgcse-after-reload
@opindex fgcse-after-reload
When @option{-fgcse-after-reload} is enabled, a redundant load elimination
pass is performed after reload. The purpose of this pass is to cleanup
redundant spilling.
@item -floop-optimize
@opindex floop-optimize
Perform loop optimizations: move constant expressions out of loops, simplify
......
......@@ -672,6 +672,11 @@ extern int flag_gcse_sm;
extern int flag_gcse_las;
/* Nonzero if we want to perform global redundancy elimination after
register allocation. */
extern int flag_gcse_after_reload;
/* Nonzero if value histograms should be used to optimize code. */
extern int flag_value_profile_transformations;
......
......@@ -574,6 +574,7 @@ decode_options (unsigned int argc, const char **argv)
flag_rename_registers = 1;
flag_unswitch_loops = 1;
flag_web = 1;
flag_gcse_after_reload = 1;
}
if (optimize < 2 || optimize_size)
......@@ -1035,6 +1036,10 @@ common_handle_option (size_t scode, const char *arg,
flag_gcse_sm = value;
break;
case OPT_fgcse_after_reload:
flag_gcse_after_reload = value;
break;
case OPT_fgcse_las:
flag_gcse_las = value;
break;
......
......@@ -131,7 +131,25 @@ DEFPARAM(PARAM_MAX_GCSE_PASSES,
"max-gcse-passes",
"The maximum number of passes to make when doing GCSE",
1)
/* This is the threshold ratio when to perform partial redundancy
elimination after reload. We perform partial redundancy elimination
when the following holds:
(Redundant load execution count)
------------------------------- >= GCSE_AFTER_RELOAD_PARTIAL_FRACTION
(Added loads execution count) */
DEFPARAM(PARAM_GCSE_AFTER_RELOAD_PARTIAL_FRACTION,
"gcse-after-reload-partial-fraction",
"The threshold ratio for performing partial redundancy elimination \
after reload.",
3)
/* This is the threshold ratio of the critical edges execution count compared to
the redundant loads execution count that permits performing the load
redundancy elimination in gcse after reload. */
DEFPARAM(PARAM_GCSE_AFTER_RELOAD_CRITICAL_FRACTION,
"gcse-after-reload-critical-fraction",
"The threshold ratio of critical edges execution count that permit \
performing redundancy elimination after reload.",
10)
/* This parameter limits the number of insns in a loop that will be unrolled,
and by how much the loop is unrolled.
......
......@@ -104,6 +104,10 @@ typedef enum compiler_param
((size_t) PARAM_VALUE (PARAM_MAX_GCSE_MEMORY))
#define MAX_GCSE_PASSES \
PARAM_VALUE (PARAM_MAX_GCSE_PASSES)
#define GCSE_AFTER_RELOAD_PARTIAL_FRACTION \
PARAM_VALUE (PARAM_GCSE_AFTER_RELOAD_PARTIAL_FRACTION)
#define GCSE_AFTER_RELOAD_CRITICAL_FRACTION \
PARAM_VALUE (PARAM_GCSE_AFTER_RELOAD_CRITICAL_FRACTION)
#define MAX_UNROLLED_INSNS \
PARAM_VALUE (PARAM_MAX_UNROLLED_INSNS)
#endif /* ! GCC_PARAMS_H */
......@@ -158,6 +158,7 @@ enum dump_file_index
DFI_lreg,
DFI_greg,
DFI_postreload,
DFI_gcse2,
DFI_flow2,
DFI_peephole2,
DFI_ce3,
......@@ -178,7 +179,7 @@ enum dump_file_index
Remaining -d letters:
" e m q "
" JK O Q WXY "
" K O Q WXY "
*/
static struct dump_file_info dump_file_tbl[DFI_MAX] =
......@@ -210,6 +211,7 @@ static struct dump_file_info dump_file_tbl[DFI_MAX] =
{ "lreg", 'l', 1, 0, 0 },
{ "greg", 'g', 1, 0, 0 },
{ "postreload", 'o', 1, 0, 0 },
{ "gcse2", 'J', 0, 0, 0 },
{ "flow2", 'w', 1, 0, 0 },
{ "peephole2", 'z', 1, 0, 0 },
{ "ce3", 'E', 1, 0, 0 },
......@@ -788,6 +790,23 @@ rest_of_handle_sched2 (tree decl, rtx insns)
}
#endif
static void
rest_of_handle_gcse2 (tree decl, rtx insns)
{
open_dump_file (DFI_gcse2, decl);
gcse_after_reload_main (insns, dump_file);
rebuild_jump_labels (insns);
delete_trivially_dead_insns (insns, max_reg_num ());
close_dump_file (DFI_gcse2, print_rtl_with_bb, insns);
ggc_collect ();
#ifdef ENABLE_CHECKING
verify_flow_info ();
#endif
}
/* Register allocation pre-pass, to reduce number of moves necessary
for two-address machines. */
static void
......@@ -1842,6 +1861,9 @@ rest_of_compilation (tree decl)
close_dump_file (DFI_postreload, print_rtl_with_bb, insns);
if (optimize > 0 && flag_gcse_after_reload)
rest_of_handle_gcse2 (decl, insns);
/* Re-create the death notes which were deleted during reload. */
timevar_push (TV_FLOW2);
open_dump_file (DFI_flow2, decl);
......
......@@ -2289,6 +2289,7 @@ extern rtx fis_get_condition (rtx);
#ifdef BUFSIZ
extern int gcse_main (rtx, FILE *);
extern int bypass_jumps (FILE *);
extern void gcse_after_reload_main (rtx, FILE *);
#endif
/* In global.c */
......
......@@ -526,6 +526,9 @@ int flag_gcse_sm = 1;
int flag_gcse_las = 1;
/* Nonzero means perform global cse after register allocation. */
int flag_gcse_after_reload = 0;
/* Perform target register optimization before prologue / epilogue
threading. */
......@@ -915,6 +918,7 @@ static const lang_independent_options f_options[] =
{"gcse-lm", &flag_gcse_lm, 1 },
{"gcse-sm", &flag_gcse_sm, 1 },
{"gcse-las", &flag_gcse_las, 1 },
{"gcse-after-reload", &flag_gcse_after_reload, 1},
{"branch-target-load-optimize", &flag_branch_target_load_optimize, 1 },
{"branch-target-load-optimize2", &flag_branch_target_load_optimize2, 1 },
{"btr-bb-exclusive", &flag_btr_bb_exclusive, 1 },
......
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