Commit bdf67bcb by David Li Committed by Xinliang David Li

Gator cleanup

From-SVN: r174848
parent 0d1d0dc8
2011-06-09 David Li <davidxl@google.com>
* tree-complex.c (tree_lower_complex): Gate cleanup.
* tree-stdarg.c (check_all_va_list_escapes): Ditto.
(execute_optimize_stdarg): Ditto.
* tree-eh.c (execute_lower_eh_dispatch): Ditto.
(execute_cleanup_eh_1): Ditto.
(execute_cleanup_eh): Ditto.
* gcse.c (gate_rtl_pre): Ditto.
(execute_rtl_pre): Ditto.
* except.c (finish_eh_generation): Ditto.
(convert_to_eh_region_ranges): Ditto.
* cprop.c (one_cprop_pass): Ditto.
2011-06-09 Bernd Schmidt <bernds@codesourcery.com> 2011-06-09 Bernd Schmidt <bernds@codesourcery.com>
PR target/48673 PR target/48673
......
...@@ -1843,15 +1843,17 @@ one_cprop_pass (void) ...@@ -1843,15 +1843,17 @@ one_cprop_pass (void)
static bool static bool
gate_rtl_cprop (void) gate_rtl_cprop (void)
{ {
return optimize > 0 && flag_gcse return optimize > 0 && flag_gcse;
&& !cfun->calls_setjmp
&& dbg_cnt (cprop);
} }
static unsigned int static unsigned int
execute_rtl_cprop (void) execute_rtl_cprop (void)
{ {
int changed; int changed;
if (cfun->calls_setjmp || !dbg_cnt (cprop))
return 0;
delete_unreachable_blocks (); delete_unreachable_blocks ();
df_set_flags (DF_LR_RUN_DCE); df_set_flags (DF_LR_RUN_DCE);
df_analyze (); df_analyze ();
...@@ -1882,4 +1884,3 @@ struct rtl_opt_pass pass_rtl_cprop = ...@@ -1882,4 +1884,3 @@ struct rtl_opt_pass pass_rtl_cprop =
TODO_verify_flow | TODO_ggc_collect /* todo_flags_finish */ TODO_verify_flow | TODO_ggc_collect /* todo_flags_finish */
} }
}; };
...@@ -1440,14 +1440,17 @@ finish_eh_generation (void) ...@@ -1440,14 +1440,17 @@ finish_eh_generation (void)
static bool static bool
gate_handle_eh (void) gate_handle_eh (void)
{ {
/* Nothing to do if no regions created. */ return true;
return cfun->eh->region_tree != NULL;
} }
/* Complete generation of exception handling code. */ /* Complete generation of exception handling code. */
static unsigned int static unsigned int
rest_of_handle_eh (void) rest_of_handle_eh (void)
{ {
/* Nothing to do if no regions created. */
if (cfun->eh->region_tree == NULL)
return 0;
finish_eh_generation (); finish_eh_generation ();
cleanup_cfg (CLEANUP_NO_INSN_DEL); cleanup_cfg (CLEANUP_NO_INSN_DEL);
return 0; return 0;
...@@ -2392,6 +2395,9 @@ convert_to_eh_region_ranges (void) ...@@ -2392,6 +2395,9 @@ convert_to_eh_region_ranges (void)
int min_labelno = 0, max_labelno = 0; int min_labelno = 0, max_labelno = 0;
int saved_call_site_base = call_site_base; int saved_call_site_base = call_site_base;
if (cfun->eh->region_tree == NULL)
return 0;
crtl->eh.action_record_data = VEC_alloc (uchar, gc, 64); crtl->eh.action_record_data = VEC_alloc (uchar, gc, 64);
ar_hash = htab_create (31, action_record_hash, action_record_eq, free); ar_hash = htab_create (31, action_record_hash, action_record_eq, free);
...@@ -2643,8 +2649,6 @@ static bool ...@@ -2643,8 +2649,6 @@ static bool
gate_convert_to_eh_region_ranges (void) gate_convert_to_eh_region_ranges (void)
{ {
/* Nothing to do for SJLJ exceptions or if no regions created. */ /* Nothing to do for SJLJ exceptions or if no regions created. */
if (cfun->eh->region_tree == NULL)
return false;
if (targetm.except_unwind_info (&global_options) == UI_SJLJ) if (targetm.except_unwind_info (&global_options) == UI_SJLJ)
return false; return false;
return true; return true;
......
...@@ -3713,15 +3713,17 @@ static bool ...@@ -3713,15 +3713,17 @@ static bool
gate_rtl_pre (void) gate_rtl_pre (void)
{ {
return optimize > 0 && flag_gcse return optimize > 0 && flag_gcse
&& !cfun->calls_setjmp && optimize_function_for_speed_p (cfun);
&& optimize_function_for_speed_p (cfun)
&& dbg_cnt (pre);
} }
static unsigned int static unsigned int
execute_rtl_pre (void) execute_rtl_pre (void)
{ {
int changed; int changed;
if (cfun->calls_setjmp || !dbg_cnt (pre))
return 0;
delete_unreachable_blocks (); delete_unreachable_blocks ();
df_analyze (); df_analyze ();
changed = one_pre_gcse_pass (); changed = one_pre_gcse_pass ();
...@@ -3735,18 +3737,20 @@ static bool ...@@ -3735,18 +3737,20 @@ static bool
gate_rtl_hoist (void) gate_rtl_hoist (void)
{ {
return optimize > 0 && flag_gcse return optimize > 0 && flag_gcse
&& !cfun->calls_setjmp
/* It does not make sense to run code hoisting unless we are optimizing /* It does not make sense to run code hoisting unless we are optimizing
for code size -- it rarely makes programs faster, and can make then for code size -- it rarely makes programs faster, and can make then
bigger if we did PRE (when optimizing for space, we don't run PRE). */ bigger if we did PRE (when optimizing for space, we don't run PRE). */
&& optimize_function_for_size_p (cfun) && optimize_function_for_size_p (cfun);
&& dbg_cnt (hoist);
} }
static unsigned int static unsigned int
execute_rtl_hoist (void) execute_rtl_hoist (void)
{ {
int changed; int changed;
if (cfun->calls_setjmp || !dbg_cnt (hoist))
return 0;
delete_unreachable_blocks (); delete_unreachable_blocks ();
df_analyze (); df_analyze ();
changed = one_code_hoisting_pass (); changed = one_code_hoisting_pass ();
...@@ -3799,4 +3803,3 @@ struct rtl_opt_pass pass_rtl_hoist = ...@@ -3799,4 +3803,3 @@ struct rtl_opt_pass pass_rtl_hoist =
}; };
#include "gt-gcse.h" #include "gt-gcse.h"
...@@ -1569,6 +1569,11 @@ tree_lower_complex (void) ...@@ -1569,6 +1569,11 @@ tree_lower_complex (void)
gimple_stmt_iterator gsi; gimple_stmt_iterator gsi;
basic_block bb; basic_block bb;
/* With errors, normal optimization passes are not run. If we don't
lower complex operations at all, rtl expansion will abort. */
if (cfun->curr_properties & PROP_gimple_lcx)
return 0;
if (!init_dont_simulate_again ()) if (!init_dont_simulate_again ())
return 0; return 0;
...@@ -1634,9 +1639,7 @@ struct gimple_opt_pass pass_lower_complex = ...@@ -1634,9 +1639,7 @@ struct gimple_opt_pass pass_lower_complex =
static bool static bool
gate_no_optimization (void) gate_no_optimization (void)
{ {
/* With errors, normal optimization passes are not run. If we don't return true;
lower complex operations at all, rtl expansion will abort. */
return !(cfun->curr_properties & PROP_gimple_lcx);
} }
struct gimple_opt_pass pass_lower_complex_O0 = struct gimple_opt_pass pass_lower_complex_O0 =
......
...@@ -3234,6 +3234,9 @@ execute_lower_eh_dispatch (void) ...@@ -3234,6 +3234,9 @@ execute_lower_eh_dispatch (void)
bool any_rewritten = false; bool any_rewritten = false;
bool redirected = false; bool redirected = false;
if (cfun->eh->region_tree == NULL)
return 0;
assign_filter_values (); assign_filter_values ();
FOR_EACH_BB (bb) FOR_EACH_BB (bb)
...@@ -3254,7 +3257,7 @@ execute_lower_eh_dispatch (void) ...@@ -3254,7 +3257,7 @@ execute_lower_eh_dispatch (void)
static bool static bool
gate_lower_eh_dispatch (void) gate_lower_eh_dispatch (void)
{ {
return cfun->eh->region_tree != NULL; return true;
} }
struct gimple_opt_pass pass_lower_eh_dispatch = struct gimple_opt_pass pass_lower_eh_dispatch =
...@@ -3983,8 +3986,12 @@ execute_cleanup_eh_1 (void) ...@@ -3983,8 +3986,12 @@ execute_cleanup_eh_1 (void)
static unsigned int static unsigned int
execute_cleanup_eh (void) execute_cleanup_eh (void)
{ {
int ret = execute_cleanup_eh_1 (); int ret;
if (cfun->eh == NULL || cfun->eh->region_tree == NULL)
return 0;
ret = execute_cleanup_eh_1 ();
/* If the function no longer needs an EH personality routine /* If the function no longer needs an EH personality routine
clear it. This exposes cross-language inlining opportunities clear it. This exposes cross-language inlining opportunities
and avoids references to a never defined personality routine. */ and avoids references to a never defined personality routine. */
...@@ -3998,7 +4005,7 @@ execute_cleanup_eh (void) ...@@ -3998,7 +4005,7 @@ execute_cleanup_eh (void)
static bool static bool
gate_cleanup_eh (void) gate_cleanup_eh (void)
{ {
return cfun->eh != NULL && cfun->eh->region_tree != NULL; return true;
} }
struct gimple_opt_pass pass_cleanup_eh = { struct gimple_opt_pass pass_cleanup_eh = {
......
...@@ -627,8 +627,7 @@ check_all_va_list_escapes (struct stdarg_info *si) ...@@ -627,8 +627,7 @@ check_all_va_list_escapes (struct stdarg_info *si)
static bool static bool
gate_optimize_stdarg (void) gate_optimize_stdarg (void)
{ {
/* This optimization is only for stdarg functions. */ return true;
return cfun->stdarg != 0;
} }
...@@ -645,6 +644,10 @@ execute_optimize_stdarg (void) ...@@ -645,6 +644,10 @@ execute_optimize_stdarg (void)
const char *funcname = NULL; const char *funcname = NULL;
tree cfun_va_list; tree cfun_va_list;
/* This optimization is only for stdarg functions. */
if (cfun->stdarg == 0)
return 0;
cfun->va_list_gpr_size = 0; cfun->va_list_gpr_size = 0;
cfun->va_list_fpr_size = 0; cfun->va_list_fpr_size = 0;
memset (&si, 0, sizeof (si)); memset (&si, 0, sizeof (si));
......
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