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]

Patch to tweak timevar handling


This patch adds TV_EXPAND so the C++ frontend can distinguish between
time spent building up trees and time spent converting them to RTL.
It also changes timevar_print to update timings so that it's more
useful when called in the middle of a compilation.

2000-06-09  Jason Merrill  <jason@casey.soma.redhat.com>

	* timevar.def: Add TV_EXPAND.
	* timevar.c (timevar_print): Update timing information.
	* calls.c (try_to_integrate): Push to TV_INTEGRATION for inlining.

cp/:
2000-06-09  Jason Merrill  <jason@casey.soma.redhat.com>

	* semantics.c (expand_body): Push to TV_EXPAND.
	* optimize.c (optimize_function): Push to TV_INTEGRATION.
	* decl.c (start_function): Always call announce_function.

Index: timevar.c
===================================================================
RCS file: /cvs/gcc/egcs/gcc/timevar.c,v
retrieving revision 1.5
diff -c -p -r1.5 timevar.c
*** timevar.c	2000/05/04 12:16:27	1.5
--- timevar.c	2000/06/09 16:00:44
*************** timevar_print (fp)
*** 405,413 ****
--- 405,431 ----
  #if defined (HAVE_USER_TIME) || defined (HAVE_SYS_TIME) || defined (HAVE_WALL_TIME)
    timevar_id_t id;
    struct timevar_time_def *total = &timevars[TV_TOTAL].elapsed;
+   struct timevar_time_def now;
  
    if (!TIMEVAR_ENABLE)
      return;
+ 
+   /* Update timing information in case we're calling this from GDB.  */
+ 
+   if (fp == 0)
+     fp = stderr;
+ 
+   /* What time is it?  */
+   get_time (&now);
+ 
+   /* If the stack isn't empty, attribute the current elapsed time to
+      the old topmost element.  */
+   if (stack)
+     timevar_accumulate (&stack->timevar->elapsed, &start_time, &now);
+ 
+   /* Reset the start time; from now on, time is attributed to
+      TIMEVAR. */
+   start_time = now;
  
    fprintf (fp, "\nExecution times (seconds)\n");
    for (id = 0; id < TIMEVAR_LAST; ++id)
Index: calls.c
===================================================================
RCS file: /cvs/gcc/egcs/gcc/calls.c,v
retrieving revision 1.140
diff -c -p -r1.140 calls.c
*** calls.c	2000/06/03 01:57:44	1.140
--- calls.c	2000/06/09 16:00:45
*************** Boston, MA 02111-1307, USA.  */
*** 31,36 ****
--- 31,37 ----
  #include "toplev.h"
  #include "output.h"
  #include "tm_p.h"
+ #include "timevar.h"
  
  #ifndef ACCUMULATE_OUTGOING_ARGS
  #define ACCUMULATE_OUTGOING_ARGS 0
*************** load_register_parameters (args, num_actu
*** 1733,1739 ****
      }
  }
  
! /* Try to integreate function.  See expand_inline_function for documentation
     about the parameters.  */
  
  static rtx
--- 1734,1740 ----
      }
  }
  
! /* Try to integrate function.  See expand_inline_function for documentation
     about the parameters.  */
  
  static rtx
*************** try_to_integrate (fndecl, actparms, targ
*** 1761,1769 ****
--- 1762,1774 ----
  
    before_call = get_last_insn ();
  
+   timevar_push (TV_INTEGRATION);
+ 
    temp = expand_inline_function (fndecl, actparms, target,
  				 ignore, type,
  				 structure_value_addr);
+ 
+   timevar_pop (TV_INTEGRATION);
  
    /* If inlining succeeded, return.  */
    if (temp != (rtx) (HOST_WIDE_INT) - 1)
Index: cp/semantics.c
===================================================================
RCS file: /cvs/gcc/egcs/gcc/cp/semantics.c,v
retrieving revision 1.146
diff -c -p -r1.146 semantics.c
*** cp/semantics.c	2000/05/26 21:05:05	1.146
--- cp/semantics.c	2000/06/09 16:00:45
***************
*** 35,40 ****
--- 35,41 ----
  #include "ggc.h"
  #include "rtl.h"
  #include "output.h"
+ #include "timevar.h"
  
  /* There routines provide a modular interface to perform many parsing
     operations.  They may therefore be used during actual parsing, or
*************** expand_body (fn)
*** 2788,2793 ****
--- 2789,2796 ----
        return;
      }
  
+   timevar_push (TV_EXPAND);
+ 
    /* Optimize the body of the function before expanding it.  */
    optimize_function (fn);
  
*************** expand_body (fn)
*** 2838,2841 ****
--- 2841,2846 ----
    /* And restore the current source position.  */
    lineno = saved_lineno;
    input_filename = saved_input_filename;
+ 
+   timevar_pop (TV_EXPAND);
  }
Index: cp/optimize.c
===================================================================
RCS file: /cvs/gcc/egcs/gcc/cp/optimize.c,v
retrieving revision 1.34
diff -c -p -r1.34 optimize.c
*** cp/optimize.c	2000/05/25 23:27:18	1.34
--- cp/optimize.c	2000/06/09 16:00:45
*************** Software Foundation, 59 Temple Place - S
*** 28,33 ****
--- 28,34 ----
  #include "input.h"
  #include "integrate.h"
  #include "varray.h"
+ #include "timevar.h"
  
  /* To Do:
  
*************** optimize_function (fn)
*** 806,811 ****
--- 807,814 ----
        tree prev_fn;
        struct saved_scope *s;
  
+       timevar_push (TV_INTEGRATION);
+       
        /* Clear out ID.  */
        memset (&id, 0, sizeof (id));
  
*************** optimize_function (fn)
*** 836,841 ****
--- 839,846 ----
        /* Clean up.  */
        VARRAY_FREE (id.fns);
        VARRAY_FREE (id.target_exprs);
+ 
+       timevar_pop (TV_INTEGRATION);
      }
  }
  
Index: cp/decl.c
===================================================================
RCS file: /cvs/gcc/egcs/gcc/cp/decl.c,v
retrieving revision 1.628
diff -c -p -r1.628 decl.c
*** cp/decl.c	2000/06/07 07:59:00	1.628
--- cp/decl.c	2000/06/09 16:00:47
*************** start_function (declspecs, declarator, a
*** 13687,13694 ****
      begin_stmt_tree (&DECL_SAVED_TREE (decl1));
  
    /* Let the user know we're compiling this function.  */
!   if (processing_template_decl || !building_stmt_tree ())
!     announce_function (decl1);
  
    /* Record the decl so that the function name is defined.
       If we already have a decl for this name, and it is a FUNCTION_DECL,
--- 13687,13693 ----
      begin_stmt_tree (&DECL_SAVED_TREE (decl1));
  
    /* Let the user know we're compiling this function.  */
!   announce_function (decl1);
  
    /* Record the decl so that the function name is defined.
       If we already have a decl for this name, and it is a FUNCTION_DECL,

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