diff options
Diffstat (limited to 'gcc/tree-optimize.c')
-rw-r--r-- | gcc/tree-optimize.c | 254 |
1 files changed, 0 insertions, 254 deletions
diff --git a/gcc/tree-optimize.c b/gcc/tree-optimize.c index 3d18d20a003..d69a504d7de 100644 --- a/gcc/tree-optimize.c +++ b/gcc/tree-optimize.c @@ -45,108 +45,6 @@ along with GCC; see the file COPYING3. If not see #include "cfgloop.h" #include "except.h" #include "plugin.h" -#include "regset.h" /* FIXME: For reg_obstack. */ - -/* Gate: execute, or not, all of the non-trivial optimizations. */ - -static bool -gate_all_optimizations (void) -{ - return (optimize >= 1 - /* Don't bother doing anything if the program has errors. - We have to pass down the queue if we already went into SSA */ - && (!seen_error () || gimple_in_ssa_p (cfun))); -} - -struct gimple_opt_pass pass_all_optimizations = -{ - { - GIMPLE_PASS, - "*all_optimizations", /* name */ - gate_all_optimizations, /* gate */ - NULL, /* execute */ - NULL, /* sub */ - NULL, /* next */ - 0, /* static_pass_number */ - TV_OPTIMIZE, /* tv_id */ - 0, /* properties_required */ - 0, /* properties_provided */ - 0, /* properties_destroyed */ - 0, /* todo_flags_start */ - 0 /* todo_flags_finish */ - } -}; - -/* Gate: execute, or not, all of the non-trivial optimizations. */ - -static bool -gate_all_early_local_passes (void) -{ - /* Don't bother doing anything if the program has errors. */ - return (!seen_error () && !in_lto_p); -} - -static unsigned int -execute_all_early_local_passes (void) -{ - /* Once this pass (and its sub-passes) are complete, all functions - will be in SSA form. Technically this state change is happening - a tad early, since the sub-passes have not yet run, but since - none of the sub-passes are IPA passes and do not create new - functions, this is ok. We're setting this value for the benefit - of IPA passes that follow. */ - if (cgraph_state < CGRAPH_STATE_IPA_SSA) - cgraph_state = CGRAPH_STATE_IPA_SSA; - return 0; -} - -struct simple_ipa_opt_pass pass_early_local_passes = -{ - { - SIMPLE_IPA_PASS, - "early_local_cleanups", /* name */ - gate_all_early_local_passes, /* gate */ - execute_all_early_local_passes, /* execute */ - NULL, /* sub */ - NULL, /* next */ - 0, /* static_pass_number */ - TV_EARLY_LOCAL, /* tv_id */ - 0, /* properties_required */ - 0, /* properties_provided */ - 0, /* properties_destroyed */ - 0, /* todo_flags_start */ - TODO_remove_functions /* todo_flags_finish */ - } -}; - -/* Gate: execute, or not, all of the non-trivial optimizations. */ - -static bool -gate_all_early_optimizations (void) -{ - return (optimize >= 1 - /* Don't bother doing anything if the program has errors. */ - && !seen_error ()); -} - -struct gimple_opt_pass pass_all_early_optimizations = -{ - { - GIMPLE_PASS, - "early_optimizations", /* name */ - gate_all_early_optimizations, /* gate */ - NULL, /* execute */ - NULL, /* sub */ - NULL, /* next */ - 0, /* static_pass_number */ - TV_NONE, /* tv_id */ - 0, /* properties_required */ - 0, /* properties_provided */ - 0, /* properties_destroyed */ - 0, /* todo_flags_start */ - 0 /* todo_flags_finish */ - } -}; /* Pass: cleanup the CFG just before expanding trees to RTL. @@ -214,21 +112,6 @@ struct gimple_opt_pass pass_cleanup_cfg_post_optimizing = } }; -/* Pass: do the actions required to finish with tree-ssa optimization - passes. */ - -unsigned int -execute_free_datastructures (void) -{ - free_dominance_info (CDI_DOMINATORS); - free_dominance_info (CDI_POST_DOMINATORS); - - /* And get rid of annotations we no longer need. */ - delete_tree_cfg_annotations (); - - return 0; -} - /* IPA passes, compilation of earlier functions or inlining might have changed some properties, such as marked functions nothrow, pure, const or noreturn. @@ -336,140 +219,3 @@ struct gimple_opt_pass pass_fixup_cfg = 0 /* todo_flags_finish */ } }; - -/* Do the actions required to initialize internal data structures used - in tree-ssa optimization passes. */ - -static unsigned int -execute_init_datastructures (void) -{ - /* Allocate hash tables, arrays and other structures. */ - init_tree_ssa (cfun); - return 0; -} - -struct gimple_opt_pass pass_init_datastructures = -{ - { - GIMPLE_PASS, - "*init_datastructures", /* name */ - NULL, /* gate */ - execute_init_datastructures, /* execute */ - NULL, /* sub */ - NULL, /* next */ - 0, /* static_pass_number */ - TV_NONE, /* tv_id */ - PROP_cfg, /* properties_required */ - 0, /* properties_provided */ - 0, /* properties_destroyed */ - 0, /* todo_flags_start */ - 0 /* todo_flags_finish */ - } -}; - -void -tree_lowering_passes (tree fn) -{ - tree saved_current_function_decl = current_function_decl; - - current_function_decl = fn; - push_cfun (DECL_STRUCT_FUNCTION (fn)); - gimple_register_cfg_hooks (); - bitmap_obstack_initialize (NULL); - execute_pass_list (all_lowering_passes); - if (optimize && cgraph_global_info_ready) - execute_pass_list (pass_early_local_passes.pass.sub); - free_dominance_info (CDI_POST_DOMINATORS); - free_dominance_info (CDI_DOMINATORS); - compact_blocks (); - current_function_decl = saved_current_function_decl; - bitmap_obstack_release (NULL); - pop_cfun (); -} - -/* For functions-as-trees languages, this performs all optimization and - compilation for FNDECL. */ - -void -tree_rest_of_compilation (tree fndecl) -{ - location_t saved_loc; - - timevar_push (TV_REST_OF_COMPILATION); - - gcc_assert (cgraph_global_info_ready); - - /* Initialize the default bitmap obstack. */ - bitmap_obstack_initialize (NULL); - - /* Initialize the RTL code for the function. */ - current_function_decl = fndecl; - saved_loc = input_location; - input_location = DECL_SOURCE_LOCATION (fndecl); - init_function_start (fndecl); - - gimple_register_cfg_hooks (); - - bitmap_obstack_initialize (®_obstack); /* FIXME, only at RTL generation*/ - - execute_all_ipa_transforms (); - - /* Perform all tree transforms and optimizations. */ - - /* Signal the start of passes. */ - invoke_plugin_callbacks (PLUGIN_ALL_PASSES_START, NULL); - - execute_pass_list (all_passes); - - /* Signal the end of passes. */ - invoke_plugin_callbacks (PLUGIN_ALL_PASSES_END, NULL); - - bitmap_obstack_release (®_obstack); - - /* Release the default bitmap obstack. */ - bitmap_obstack_release (NULL); - - set_cfun (NULL); - - /* If requested, warn about function definitions where the function will - return a value (usually of some struct or union type) which itself will - take up a lot of stack space. */ - if (warn_larger_than && !DECL_EXTERNAL (fndecl) && TREE_TYPE (fndecl)) - { - tree ret_type = TREE_TYPE (TREE_TYPE (fndecl)); - - if (ret_type && TYPE_SIZE_UNIT (ret_type) - && TREE_CODE (TYPE_SIZE_UNIT (ret_type)) == INTEGER_CST - && 0 < compare_tree_int (TYPE_SIZE_UNIT (ret_type), - larger_than_size)) - { - unsigned int size_as_int - = TREE_INT_CST_LOW (TYPE_SIZE_UNIT (ret_type)); - - if (compare_tree_int (TYPE_SIZE_UNIT (ret_type), size_as_int) == 0) - warning (OPT_Wlarger_than_, "size of return value of %q+D is %u bytes", - fndecl, size_as_int); - else - warning (OPT_Wlarger_than_, "size of return value of %q+D is larger than %wd bytes", - fndecl, larger_than_size); - } - } - - gimple_set_body (fndecl, NULL); - if (DECL_STRUCT_FUNCTION (fndecl) == 0 - && !cgraph_get_node (fndecl)->origin) - { - /* Stop pointing to the local nodes about to be freed. - But DECL_INITIAL must remain nonzero so we know this - was an actual function definition. - For a nested function, this is done in c_pop_function_context. - If rest_of_compilation set this to 0, leave it 0. */ - if (DECL_INITIAL (fndecl) != 0) - DECL_INITIAL (fndecl) = error_mark_node; - } - - input_location = saved_loc; - - ggc_collect (); - timevar_pop (TV_REST_OF_COMPILATION); -} |