aboutsummaryrefslogtreecommitdiff
path: root/gcc/toplev.c
diff options
context:
space:
mode:
authorLawrence Crowl <crowl@google.com>2011-05-02 22:19:48 +0000
committerLawrence Crowl <crowl@gcc.gnu.org>2011-05-02 22:19:48 +0000
commit575bfb0052b008995fc992d0728f7bea2173391a (patch)
treee709db0f9ae81e48e0b44043f323c0d49b1f2a66 /gcc/toplev.c
parent9c69dcea0d67714ca0ce52317725ccf1644ce93e (diff)
downloadgcc-575bfb0052b008995fc992d0728f7bea2173391a.zip
gcc-575bfb0052b008995fc992d0728f7bea2173391a.tar.gz
gcc-575bfb0052b008995fc992d0728f7bea2173391a.tar.bz2
Upgrade the utility of timevars.
Index: gcc/ChangeLog 2011-04-27 Lawrence Crowl <crowl@google.com> * timevar.h (timevar_cond_start): Remove unused POP_TIMEVAR_AND_RETURN. (timevar_cond_start): New for starting a timer only when it is not already running. (timevar_cond_stop): New for stopping a timer when it was not already running. * timevar.c (timevar_stop): Enable start/stop timers to start again. (timevar_cond_start): New as above. (timevar_cond_stop): New as above. * timevar.def: Add start/stop timers for compiler phases, TV_PHASE_SETUP, TV_PHASE_PARSING, TV_PHASE_DEFERRED, TV_PHASE_CGRAPH, TV_PHASE_DBGINFO (C), TV_PHASE_CHECK_DBGINFO (C++), TV_PHASE_GENERATE, and TV_PHASE_FINALIZE. Change push/pop timer TV_PARSE to TV_PARSE_GLOBAL. Add push/pop timers TV_PARSE_STRUCT, TV_PARSE_ENUM, TV_PARSE_FUNC, TV_PARSE_INLINE, TV_PARSE_INMETH, TV_TEMPLATE_INST. Change push/pop timer TV_NAME_LOOKUP into a start/stop timer. Make unused TV_OVERLOAD into a start/stop timer. Remove unused timers TV_OVERLOAD, TV_TEMPLATE_INSTANTIATION. Mark the strings for TV_NAME_LOOKUP and TV_OVERLOAD with a "|" to indicate that they are start/stop timers. * toplev.c (compile_file): Change TV_PARSE to TV_PARSE_GLOBAL. Add start/stop timers TV_PHASE_PARSING and TV_PHASE_GENERATE. Move initialization to do_compile. (do_compile): Add initialization from above. Add start/stop timers TV_PHASE_SETUP and TV_PHASE_FINALIZE. * c-decl.c (c_write_global_declarations): Add start/stop of TV_PHASE_DEFERRED, TV_PHASE_CGRAPH, TV_PHASE_DBGINFO. * c-parser.c (c_parser_declaration_or_fndef): Push/pop TV_PARSE_FUNC or TV_PARSE_INLINE, as appropriate. (c_parser_enum_specifier): Push/pop TV_PARSE_ENUM. (c_parser_struct_or_union_specifier): Push/pop TV_PARSE_STRUCT. Index: gcc/cp/ChangeLog 2011-04-27 Lawrence Crowl <crowl@google.com> * decl.c: (push_local_name): Change TV_NAME_LOOKUP to start/stop. (poplevel): Refactor POP_TIMEVAR_AND_RETURN to plain code. Change TV_NAME_LOOKUP to start/stop. (define_label): Refactor timevar calls out to a wrapper function. Change TV_NAME_LOOKUP to start/stop. (xref_tag): Likewise. (lookup_label): Refactor timevar calls out to a wrapper function. Change TV_NAME_LOOKUP to start_cond/stop_cond. * pt.c: (instantiate_class_template): Add a wrapper to push/pop new TV_TEMPLATE_INST. (instantiate_template): Add a wrapper to push/pop new TV_TEMPLATE_INST. (lookup_template_class): Refactor timevar calls out to a wrapper function. Change use of TV_NAME_LOOKUP to TV_TEMPLATE_INST. (instantiate_decl): Change TV_PARSE to TV_TEMPLATE_INST. * name-lookup.c: (store_bindings): Change TV_NAME_LOOKUP to start/stop. (poplevel_class): Change TV_NAME_LOOKUP to start_cond/stop_cond. (push_namespace): Likewise. (pop_nested_namespace): Likewise. (pushdecl_namespace_level): Likewise. (store_class_bindings): Likewise. (push_to_top_level): Likewise. (identifier_type_value): Refactor timevar calls out to a wrapper function. Change TV_NAME_LOOKUP to start/stop. (find_binding): Likewise. (push_using_decl): Likewise. (lookup_arg_dependent): Likewise. (push_using_directive): Likewise. (qualified_lookup_using_namespace): Refactor POP_TIMEVAR_AND_RETURN to plain code. Change TV_NAME_LOOKUP to start/stop. (lookup_type_current_level): Likewise. Refactor inner return to break. (pushdecl_class_level): Refactor POP_TIMEVAR_AND_RETURN to plain code. Change TV_NAME_LOOKUP to start_cond/stop_cond. (pushdecl_top_level_1): Likewise. (lookup_using_namespace): Likewise. (pushdecl_with_scope): Refactor timevar calls out to a wrapper function. Change TV_NAME_LOOKUP to start_cond/stop_cond. (push_overloaded_decl): Likewise. (push_class_level_binding): Likewise. (namespace_binding): Likewise. (set_namespace_binding): Likewise. (supplement_binding): Likewise. (unqualified_namespace_lookup): Likewise. (lookup_name_real): Likewise. (lookup_type_scope): Likewise. (namespace_ancestor): Likewise. (lookup_name_innermost_nonclass_level): Likewise. (pushtag): Likewise. (pop_from_top_level): Likewise. (pushdecl_maybe_friend): Refactor timevar calls out to a wrapper function. Change TV_NAME_LOOKUP to start_cond/stop_cond. Wrap long lines. (add_using_namespace): Refactor timevar calls out to a wrapper function. Change TV_NAME_LOOKUP to start_cond/stop_cond. Bypass wrapper on call to self. * decl2.c: (cp_write_global_declarations): Add start/stop of new TV_PHASE_DEFERRED, TV_PHASE_CGRAPH, TV_PHASE_CHECK_DBGINFO. Remove push/pop calls to TV_VARCONST. * parser.c: Add include of "timevar.h". (cp_parser_explicit_instantiation): Add push/pop calls to TV_TEMPLATE_INST. (cp_parser_enum_specifier): Add push/pop calls to new TV_PARSE_ENUM. (cp_parser_class_specifier): Add wrapper to add push/pop calls to TV_PARSE_STRUCT. (cp_parser_function_definition_from_specifiers_and_declarator): Add push/pop calls to new TV_PARSE_FUNC or TV_PARSE_INLINE. (cp_parser_late_parsing_for_member): Add push/pop calls to new TV_PARSE_INMETH. * call.c: Add include of "timevar.h". (convert_class_to_reference): Wrap and add push/pop calls to TV_OVERLOAD. (build_op_call): Likewise. (build_conditional_expr): Likewise. (build_new_op): Likewise. (build_new_method_call): Likewise. (build_user_type_conversion): Reorganize to single return and add push/pop calls to TV_OVERLOAD. (perform_overload_resolution): Likewise. * Make-lang.in: Add dependence of call.o and parser.o on $(TIMEVAR_H). From-SVN: r173277
Diffstat (limited to 'gcc/toplev.c')
-rw-r--r--gcc/toplev.c52
1 files changed, 38 insertions, 14 deletions
diff --git a/gcc/toplev.c b/gcc/toplev.c
index 06014a9..d61adde 100644
--- a/gcc/toplev.c
+++ b/gcc/toplev.c
@@ -562,36 +562,34 @@ emit_debug_global_declarations (tree *vec, int len)
static void
compile_file (void)
{
- /* Initialize yet another pass. */
-
- ggc_protect_identifiers = true;
-
- init_cgraph ();
- init_final (main_input_filename);
- coverage_init (aux_base_name);
- statistics_init ();
- invoke_plugin_callbacks (PLUGIN_START_UNIT, NULL);
-
- timevar_push (TV_PARSE);
+ timevar_start (TV_PHASE_PARSING);
+ timevar_push (TV_PARSE_GLOBAL);
/* Call the parser, which parses the entire file (calling
rest_of_compilation for each function). */
lang_hooks.parse_file ();
+ timevar_pop (TV_PARSE_GLOBAL);
+ timevar_stop (TV_PHASE_PARSING);
+
/* Compilation is now finished except for writing
what's left of the symbol table output. */
- timevar_pop (TV_PARSE);
if (flag_syntax_only || flag_wpa)
return;
+ timevar_start (TV_PHASE_GENERATE);
+
ggc_protect_identifiers = false;
/* This must also call cgraph_finalize_compilation_unit. */
lang_hooks.decls.final_write_globals ();
if (seen_error ())
- return;
+ {
+ timevar_stop (TV_PHASE_GENERATE);
+ return;
+ }
varpool_assemble_pending_decls ();
finish_aliases_2 ();
@@ -671,6 +669,8 @@ compile_file (void)
into the assembly file here, and hence we can not output anything to the
assembly file after this point. */
targetm.asm_out.file_end ();
+
+ timevar_stop (TV_PHASE_GENERATE);
}
/* Indexed by enum debug_info_type. */
@@ -1899,6 +1899,8 @@ do_compile (void)
/* Don't do any more if an error has already occurred. */
if (!seen_error ())
{
+ timevar_start (TV_PHASE_SETUP);
+
/* This must be run always, because it is needed to compute the FP
predefined macros, such as __LDBL_MAX__, for targets using non
default FP formats. */
@@ -1910,9 +1912,31 @@ do_compile (void)
/* Language-dependent initialization. Returns true on success. */
if (lang_dependent_init (main_input_filename))
- compile_file ();
+ {
+ /* Initialize yet another pass. */
+
+ ggc_protect_identifiers = true;
+
+ init_cgraph ();
+ init_final (main_input_filename);
+ coverage_init (aux_base_name);
+ statistics_init ();
+ invoke_plugin_callbacks (PLUGIN_START_UNIT, NULL);
+
+ timevar_stop (TV_PHASE_SETUP);
+
+ compile_file ();
+ }
+ else
+ {
+ timevar_stop (TV_PHASE_SETUP);
+ }
+
+ timevar_start (TV_PHASE_FINALIZE);
finalize (no_backend);
+
+ timevar_stop (TV_PHASE_FINALIZE);
}
/* Stop timing and print the times. */