From 598a47d62e95de423eb42af3836dddc9c61cac27 Mon Sep 17 00:00:00 2001 From: hubicka Date: Fri, 22 Mar 2002 15:32:00 +0000 Subject: [PATCH] * toplev.c (flag_loop_optimize, flag_crossjumping): New static variables. (rest_of_compilation): Conditionalize crossjumping and loop optimizer. (parse_options_and_default_flags): Default loop_optimize and crossjumping. (lang_independent_options): Add -fcrossjumping and -floop-optimize * invoke.texi (crossjumping, loop-optimize): Document. git-svn-id: svn+ssh://gcc.gnu.org/svn/gcc/trunk@51175 138bc75d-0d04-0410-961f-82ee72b054a4 --- gcc/ChangeLog | 11 +++++++++++ gcc/doc/invoke.texi | 13 ++++++++++++- gcc/toplev.c | 21 ++++++++++++++++++--- 3 files changed, 41 insertions(+), 4 deletions(-) diff --git a/gcc/ChangeLog b/gcc/ChangeLog index e5f30ad..7e49d23 100644 --- a/gcc/ChangeLog +++ b/gcc/ChangeLog @@ -1,3 +1,14 @@ +Fri Mar 22 16:30:42 CET 2002 Jan Hubicka + + * toplev.c (flag_loop_optimize, flag_crossjumping): + New static variables. + (rest_of_compilation): Conditionalize crossjumping and + loop optimizer. + (parse_options_and_default_flags): Default loop_optimize and + crossjumping. + (lang_independent_options): Add -fcrossjumping and -floop-optimize + * invoke.texi (crossjumping, loop-optimize): Document. + 2002-03-22 Richard Sandiford * real.c (eiisneg): Move outside #ifdef NANS. diff --git a/gcc/doc/invoke.texi b/gcc/doc/invoke.texi index 52af61d..533fda1 100644 --- a/gcc/doc/invoke.texi +++ b/gcc/doc/invoke.texi @@ -266,7 +266,7 @@ 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 @gol +-fgcse -fgcse-lm -fgcse-sm -floop-optimize -fcrossjumping @gol -finline-functions -finline-limit=@var{n} -fkeep-inline-functions @gol -fkeep-static-consts -fmerge-constants -fmerge-all-constants @gol -fmove-all-movables -fno-default-inline -fno-defer-pop @gol @@ -3495,6 +3495,17 @@ subexpression elimination. This pass will attempt to move stores out of loops. When used in conjunction with @option{-fgcse-lm}, loops containing a load/store sequence can be changed to a load before the loop and a store after the loop. +@item -floop-optimize +@opindex floop-optimize +Perform loop optimizations: move constant expressions out of loops, simplify +exit test conditions and optionally do strength-reduction and loop unrolling as +well. + +@item -fcrossjumping +@opindex crossjumping +Perform cross-jumping transformation. This transformation unifies equivalent code and save code size. The +resulting code may or may not perform better than without cross-jumping. + @item -fdelete-null-pointer-checks @opindex fdelete-null-pointer-checks Use global dataflow analysis to identify and eliminate useless checks diff --git a/gcc/toplev.c b/gcc/toplev.c index 121d3f7..ca26e7f 100644 --- a/gcc/toplev.c +++ b/gcc/toplev.c @@ -605,6 +605,14 @@ int flag_syntax_only = 0; static int flag_gcse; +/* Nonzero means perform loop optimizer. */ + +static int flag_loop_optimize; + +/* Nonzero means perform crossjumping. */ + +static int flag_crossjumping; + /* Nonzero means to use global dataflow analysis to eliminate useless null pointer tests. */ @@ -1017,6 +1025,10 @@ static const lang_independent_options f_options[] = N_("Perform enhanced load motion during global subexpression elimination") }, {"gcse-sm", &flag_gcse_sm, 1, N_("Perform store motion after global subexpression elimination") }, + {"loop-optimize", &flag_loop_optimize, 1, + N_("Perform the loop optimizations") }, + {"crossjumping", &flag_crossjumping, 1, + N_("Perform cross-jumping optimization") }, {"rerun-cse-after-loop", &flag_rerun_cse_after_loop, 1, N_("Run CSE pass after loop optimizations") }, {"rerun-loop-opt", &flag_rerun_loop_opt, 1, @@ -2846,7 +2858,7 @@ rest_of_compilation (decl) /* Move constant computations out of loops. */ - if (optimize > 0) + if (optimize > 0 && flag_loop_optimize) { timevar_push (TV_LOOP); delete_dead_jumptables (); @@ -3244,7 +3256,8 @@ rest_of_compilation (decl) if (optimize) { life_analysis (insns, rtl_dump_file, PROP_FINAL); - cleanup_cfg (CLEANUP_EXPENSIVE | CLEANUP_CROSSJUMP | CLEANUP_UPDATE_LIFE); + cleanup_cfg (CLEANUP_EXPENSIVE | CLEANUP_UPDATE_LIFE + | (flag_crossjumping ? CLEANUP_CROSSJUMP : 0)); /* This is kind of a heuristic. We need to run combine_stack_adjustments even for machines with possibly nonzero RETURN_POPS_ARGS @@ -3350,7 +3363,7 @@ rest_of_compilation (decl) and insn splitting possibly introduced more crossjumping oppurtuntities. */ cleanup_cfg (CLEANUP_EXPENSIVE | CLEANUP_POST_REGSTACK - | CLEANUP_CROSSJUMP); + | (flag_crossjumping ? CLEANUP_CROSSJUMP : 0)); if (flag_reorder_blocks) { reorder_basic_blocks (); @@ -4645,6 +4658,8 @@ parse_options_and_default_flags (argc, argv) #endif flag_guess_branch_prob = 1; flag_cprop_registers = 1; + flag_loop_optimize = 1; + flag_crossjumping = 1; } if (optimize >= 2) -- 2.7.4