]> git.ipfire.org Git - thirdparty/gcc.git/commitdiff
2010-04-12 Diego Novillo <dnovillo@google.com>
authordnovillo <dnovillo@138bc75d-0d04-0410-961f-82ee72b054a4>
Tue, 13 Apr 2010 13:30:31 +0000 (13:30 +0000)
committerdnovillo <dnovillo@138bc75d-0d04-0410-961f-82ee72b054a4>
Tue, 13 Apr 2010 13:30:31 +0000 (13:30 +0000)
* Makefile.in (c-pch.o, ggc-common.o): Depend on timevar.h.
* c-pch.c: Include timevar.h.
(c_common_write_pch): Use TV_PCH_SAVE and TV_PCH_CPP_SAVE timers.
(c_common_read_pch): Use TV_PCH_RESTORE and TV_PCH_CPP_RESTORE
timers.
* ggc-common.c: Include timevar.h.
(gt_pch_save): Use TV_PCH_PTR_REALLOC and TV_PCH_PTR_SORT
timers.
* timevar.def (TV_PCH_SAVE): Define.
(TV_PCH_CPP_SAVE): Define.
(TV_PCH_PTR_REALLOC): Define.
(TV_PCH_PTR_SORT): Define.
(TV_PCH_RESTORE): Define.
(TV_PCH_CPP_RESTORE): Define.

git-svn-id: svn+ssh://gcc.gnu.org/svn/gcc/trunk@158266 138bc75d-0d04-0410-961f-82ee72b054a4

gcc/Makefile.in
gcc/c-pch.c
gcc/ggc-common.c
gcc/timevar.def

index 3fada585d950b5fb4d93acbfc74562cf294716ce..77665fd38dd66409c43851747c3136a1fa6cfac5 100644 (file)
@@ -2088,7 +2088,8 @@ c-dump.o : c-dump.c $(CONFIG_H) $(SYSTEM_H) coretypes.h $(TM_H) $(TREE_H) \
 
 c-pch.o : c-pch.c $(CONFIG_H) $(SYSTEM_H) coretypes.h $(CPPLIB_H) $(TREE_H) \
        $(C_COMMON_H) output.h $(TOPLEV_H) $(C_PRAGMA_H) $(GGC_H) debug.h \
-       langhooks.h $(FLAGS_H) hosthooks.h version.h $(TARGET_H) opts.h
+       langhooks.h $(FLAGS_H) hosthooks.h version.h $(TARGET_H) opts.h \
+       timevar.h
        $(COMPILER) -c $(ALL_COMPILERFLAGS) $(ALL_CPPFLAGS) \
          -DHOST_MACHINE=\"$(host)\" -DTARGET_MACHINE=\"$(target)\" \
          $< $(OUTPUT_OPTION)
@@ -2183,7 +2184,7 @@ gtype-desc.o: gtype-desc.c $(CONFIG_H) $(SYSTEM_H) coretypes.h $(TM_H) \
 
 ggc-common.o: ggc-common.c $(CONFIG_H) $(SYSTEM_H) coretypes.h         \
        $(GGC_H) $(HASHTAB_H) $(TOPLEV_H) $(PARAMS_H) hosthooks.h       \
-       $(HOSTHOOKS_DEF_H) vec.h $(PLUGIN_H)
+       $(HOSTHOOKS_DEF_H) vec.h $(PLUGIN_H) timevar.h
 
 ggc-page.o: ggc-page.c $(CONFIG_H) $(SYSTEM_H) coretypes.h $(TM_H) $(RTL_H) $(TREE_H) \
        $(FLAGS_H) $(TOPLEV_H) $(GGC_H) $(TIMEVAR_H) $(TM_P_H) $(PARAMS_H) $(TREE_FLOW_H) $(PLUGIN_H)
index 8433f8633dd779036607298d29f970ff06e8ab8f..951ab1fc303bd0c2e69a86bcc3e3ed5737f7405f 100644 (file)
@@ -35,6 +35,7 @@ along with GCC; see the file COPYING3.  If not see
 #include "hosthooks.h"
 #include "target.h"
 #include "opts.h"
+#include "timevar.h"
 
 /* This is a list of flag variables that must match exactly, and their
    names for the error message.  The possible values for *flag_var must
@@ -178,6 +179,8 @@ c_common_write_pch (void)
   long written;
   struct c_pch_header h;
 
+  timevar_push (TV_PCH_SAVE);
+
   (*debug_hooks->handle_pch) (1);
 
   cpp_write_pch_deps (parse_in, pch_outfile);
@@ -211,13 +214,18 @@ c_common_write_pch (void)
     fatal_error ("can%'t seek in %s: %m", asm_file_name);
 
   gt_pch_save (pch_outfile);
+
+  timevar_push (TV_PCH_CPP_SAVE);
   cpp_write_pch_state (parse_in, pch_outfile);
+  timevar_pop (TV_PCH_CPP_SAVE);
 
   if (fseek (pch_outfile, 0, SEEK_SET) != 0
       || fwrite (get_ident (), IDENT_LENGTH, 1, pch_outfile) != 1)
     fatal_error ("can%'t write %s: %m", pch_file);
 
   fclose (pch_outfile);
+
+  timevar_pop (TV_PCH_SAVE);
 }
 
 /* Check the PCH file called NAME, open on FD, to see if it can be
@@ -371,12 +379,14 @@ c_common_read_pch (cpp_reader *pfile, const char *name,
   expanded_location saved_loc;
   bool saved_trace_includes;
 
+  timevar_push (TV_PCH_RESTORE);
+
   f = fdopen (fd, "rb");
   if (f == NULL)
     {
       cpp_errno (pfile, CPP_DL_ERROR, "calling fdopen");
       close (fd);
-      return;
+      goto end;
     }
 
   cpp_get_callbacks (parse_in)->valid_pch = NULL;
@@ -385,7 +395,7 @@ c_common_read_pch (cpp_reader *pfile, const char *name,
     {
       cpp_errno (pfile, CPP_DL_ERROR, "reading");
       fclose (f);
-      return;
+      goto end;
     }
 
   if (!flag_preprocess_only)
@@ -417,15 +427,21 @@ c_common_read_pch (cpp_reader *pfile, const char *name,
   saved_loc = expand_location (line_table->highest_line);
   saved_trace_includes = line_table->trace_includes;
 
+  timevar_push (TV_PCH_CPP_RESTORE);
   cpp_prepare_state (pfile, &smd);
+  timevar_pop (TV_PCH_CPP_RESTORE);
 
   gt_pch_restore (f);
 
+  timevar_push (TV_PCH_CPP_RESTORE);
   if (cpp_read_state (pfile, name, f, smd) != 0)
     {
       fclose (f);
-      return;
+      timevar_pop (TV_PCH_CPP_RESTORE);
+      goto end;
     }
+  timevar_pop (TV_PCH_CPP_RESTORE);
+
 
   fclose (f);
 
@@ -437,6 +453,9 @@ c_common_read_pch (cpp_reader *pfile, const char *name,
      been loaded.  */
   if (lang_post_pch_load)
     (*lang_post_pch_load) ();
+
+end:
+  timevar_pop (TV_PCH_RESTORE);
 }
 
 /* Indicate that no more PCH files should be read.  */
index fc42f45d59c2bd4ba44b75d076040275a222ee2c..28c2b793f22d605d2a06349d8896cca5421b2b3f 100644 (file)
@@ -32,6 +32,7 @@ along with GCC; see the file COPYING3.  If not see
 #include "hosthooks-def.h"
 #include "plugin.h"
 #include "vec.h"
+#include "timevar.h"
 
 #ifdef HAVE_SYS_RESOURCE_H
 # include <sys/resource.h>
@@ -501,6 +502,7 @@ gt_pch_save (FILE *f)
 
   gt_pch_save_stringpool ();
 
+  timevar_push (TV_PCH_PTR_REALLOC);
   saving_htab = htab_create (50000, saving_htab_hash, saving_htab_eq, free);
 
   for (rt = gt_ggc_rtab; *rt; rt++)
@@ -532,8 +534,13 @@ gt_pch_save (FILE *f)
 
   state.ptrs = XNEWVEC (struct ptr_data *, state.count);
   state.ptrs_i = 0;
+
   htab_traverse (saving_htab, call_alloc, &state);
+  timevar_pop (TV_PCH_PTR_REALLOC);
+
+  timevar_push (TV_PCH_PTR_SORT);
   qsort (state.ptrs, state.count, sizeof (*state.ptrs), compare_ptr_data);
+  timevar_pop (TV_PCH_PTR_SORT);
 
   /* Write out all the scalar variables.  */
   for (rt = gt_pch_scalar_rtab; *rt; rt++)
index deb853aad50494fdbb1e2c2aca9c6e2c8b844d5d..19dec149a28af8a348ba35ded9e3bd4472e761e1 100644 (file)
@@ -39,6 +39,14 @@ DEFTIMEVAR (TV_GC                    , "garbage collection")
 /* Time spent generating dump files.  */
 DEFTIMEVAR (TV_DUMP                  , "dump files")
 
+/* Time spent saving/restoring PCH state.  */
+DEFTIMEVAR (TV_PCH_SAVE              , "PCH main state save")
+DEFTIMEVAR (TV_PCH_CPP_SAVE          , "PCH preprocessor state save")
+DEFTIMEVAR (TV_PCH_PTR_REALLOC       , "PCH pointer reallocation")
+DEFTIMEVAR (TV_PCH_PTR_SORT          , "PCH pointer sort")
+DEFTIMEVAR (TV_PCH_RESTORE           , "PCH main state restore")
+DEFTIMEVAR (TV_PCH_CPP_RESTORE       , "PCH preprocessor state restore")
+
 DEFTIMEVAR (TV_CGRAPH                , "callgraph construction")
 DEFTIMEVAR (TV_CGRAPHOPT             , "callgraph optimization")
 DEFTIMEVAR (TV_IPA_CONSTANT_PROP     , "ipa cp")