This is the mail archive of the gcc-patches@gcc.gnu.org mailing list for the GCC project.


Index Nav: [Date Index] [Subject Index] [Author Index] [Thread Index]
Message Nav: [Date Prev] [Date Next] [Thread Prev] [Thread Next]
Other format: [Raw text]

[committed]: Move coverage_finish to ipa_passes()


This patch moves coverage_finish to ipa_passes.  This changes
nothing other than the sequencing of the call.  It's going to be
needed when LTO streaming is merged in mainline so that the
functions and symbols generated by gcov can be streamed out.

The change to get_base_var was needed to handle CONSTRUCTORs
generated by coverage_finish.

Bootstrapped and tested on x86_64.  Committed to mainline.


Diego.



	* toplev.c (compile_file): Move call to coverage_finish ...
	* cgraphunit.c (ipa_passes): ... here.
	Call cgraph_process_new_functions.
	* ipa-utils.c (get_base_var): Handle CONSTRUCTOR.
	* Makefile.in (cgraphunit.o): Add dependency on COVERAGE_H.

Index: toplev.c
===================================================================
--- toplev.c	(revision 146353)
+++ toplev.c	(working copy)
@@ -993,11 +993,6 @@ compile_file (void)
   varpool_assemble_pending_decls ();
   finish_aliases_2 ();

-  /* This must occur after the loop to output deferred functions.
-     Else the coverage initializer would not be emitted if all the
-     functions in this compilation unit were deferred.  */
-  coverage_finish ();
-
   /* Likewise for mudflap static object registrations.  */
   if (flag_mudflap)
     mudflap_finish_file ();
Index: cgraphunit.c
===================================================================
--- cgraphunit.c	(revision 146353)
+++ cgraphunit.c	(working copy)
@@ -134,6 +134,7 @@ along with GCC; see the file COPYING3.
 #include "tree-iterator.h"
 #include "tree-pass.h"
 #include "output.h"
+#include "coverage.h"

 static void cgraph_expand_all_functions (void);
 static void cgraph_mark_functions_to_output (void);
@@ -978,6 +979,8 @@ cgraph_finalize_compilation_unit (void)
   cgraph_analyze_functions ();
   timevar_pop (TV_CGRAPH);
 }
+
+
 /* Figure out what functions we want to assemble.  */

 static void
@@ -1238,6 +1241,15 @@ ipa_passes (void)
   gimple_register_cfg_hooks ();
   bitmap_obstack_initialize (NULL);
   execute_ipa_pass_list (all_ipa_passes);
+
+  /* Generate coverage variables and constructors.  */
+  coverage_finish ();
+
+  /* Process new functions added.  */
+  set_cfun (NULL);
+  current_function_decl = NULL;
+  cgraph_process_new_functions ();
+
   bitmap_obstack_release (NULL);
 }

Index: ipa-utils.c
===================================================================
--- ipa-utils.c	(revision 146353)
+++ ipa-utils.c	(working copy)
@@ -222,7 +222,8 @@ get_base_var (tree t)
 	 && (!CONSTANT_CLASS_P (t))
 	 && TREE_CODE (t) != LABEL_DECL
 	 && TREE_CODE (t) != FUNCTION_DECL
-	 && TREE_CODE (t) != CONST_DECL)
+	 && TREE_CODE (t) != CONST_DECL
+	 && TREE_CODE (t) != CONSTRUCTOR)
     {
       t = TREE_OPERAND (t, 0);
     }
Index: Makefile.in
===================================================================
--- Makefile.in	(revision 146353)
+++ Makefile.in	(revision 146354)
@@ -2615,7 +2615,7 @@ cgraphunit.o : cgraphunit.c $(CONFIG_H)
    $(TARGET_H) $(CGRAPH_H) intl.h pointer-set.h $(FUNCTION_H) $(GIMPLE_H) \
    $(TREE_FLOW_H) $(TREE_PASS_H) $(C_COMMON_H) debug.h $(DIAGNOSTIC_H) \
    $(FIBHEAP_H) output.h $(PARAMS_H) $(RTL_H) $(TIMEVAR_H) $(IPA_PROP_H) \
-   gt-cgraphunit.h tree-iterator.h
+   gt-cgraphunit.h tree-iterator.h $(COVERAGE_H)
 cgraphbuild.o : cgraphbuild.c $(CONFIG_H) $(SYSTEM_H) coretypes.h $(TM_H) \
    $(TREE_H) langhooks.h $(CGRAPH_H) intl.h pointer-set.h $(GIMPLE_H) \
    $(TREE_FLOW_H) $(TREE_PASS_H)


Index Nav: [Date Index] [Subject Index] [Author Index] [Thread Index]
Message Nav: [Date Prev] [Date Next] [Thread Prev] [Thread Next]