GCC gprof statistics

Ishikawa ishikawa@yk.rim.or.jp
Tue Jul 1 16:43:00 GMT 2003


Sorry, cse.c also needed an additional
one line mod to shut up compiler warning.
So a new diff to cse.c is attached below.

I am tweaking the compiler setting and looking at gprof output.
Now I realize that,  depending on the -mtune parameter, the
x86-specific function can come at the top of gprof flat profile.
(I didn't notice this before.)

Also, although the speed up is real, but the total compilation time
got a little different now that I did the installation of
gcc-cvs (I used suffix option of gcc ./configure) under
/usr/local/bin as opposed to run it
directory from the GCC compilation directory. A little mystifying, but
I will figure out some time.

Flat profile:

Each sample counts as 0.01 seconds.
  %   cumulative   self              self     total           
 time   seconds   seconds    calls   s/call   s/call  name    
  3.17      0.16     0.16  2714134     0.00     0.00  ix86_find_base_term
  2.97      0.31     0.15   183273     0.00     0.00  cse_insn
  2.57      0.44     0.13  1253945     0.00     0.00  find_base_term
  2.38      0.56     0.12  1094964     0.00     0.00  ggc_alloc
  2.18      0.67     0.11  1317807     0.00     0.00  mark_set_1
  1.58      0.75     0.08   860379     0.00     0.00  canon_rtx
  1.58      0.83     0.08   247241     0.00     0.00  true_dependence
  1.58      0.91     0.08   242316     0.00     0.00  propagate_one_insn
  1.39      0.98     0.07  1776618     0.00     0.00  get_cse_reg_info
  1.39      1.05     0.07   248118     0.00     0.00  constrain_operands
  1.39      1.12     0.07   173831     0.00     0.00  side_effects_p
  1.39      1.19     0.07    91510     0.00     0.00  validate_value_data
  1.39      1.26     0.07    26630     0.00     0.00  record_reg_classes
  1.19      1.32     0.06  1805628     0.00     0.00  find_reg_note
  1.19      1.38     0.06   627038     0.00     0.00  canon_hash
  1.19      1.44     0.06   213151     0.00     0.00  invalidate
  0.99      1.49     0.05  2717892     0.00     0.00  ix86_delegitimize_address
  0.99      1.54     0.05  1728566     0.00     0.00  bitmap_bit_p
  0.99      1.59     0.05  1494045     0.00     0.00  rtx_equal_p
  0.99      1.64     0.05   257382     0.00     0.00  memrefs_conflict_p
  0.99      1.69     0.05   241352     0.00     0.00  insert
  0.99      1.74     0.05   178376     0.00     0.00  for_each_rtx
  0.99      1.79     0.05   157688     0.00     0.00  reg_scan_mark_refs
  0.99      1.84     0.05   101391     0.00     0.00  cselib_process_insn
  0.99      1.89     0.05    25741     0.00     0.00  invalidate_for_call
  0.99      1.94     0.05                             htab_find_slot_with_hash
  0.79      1.98     0.04   455035     0.00     0.00  for_each_rtx_approx_reg_cost_1




*** cse.c.save	2003-07-01 10:29:47.000000000 +0900
--- cse.c	2003-07-02 00:46:48.000000000 +0900
***************
*** 44,49 ****
--- 44,51 ----
  #include "target.h"
  #include "params.h"
  
+ #include "for_each_rtx.h"
+ 
  /* The basic idea of common subexpression elimination is to go
     through the code, keeping a record of expressions that would
     have the same value at the current scan point, and replacing
***************
*** 710,716 ****
  
  /* Subroutine of approx_reg_cost; called through for_each_rtx.  */
  
! static int
  approx_reg_cost_1 (rtx *xp, void *data)
  {
    rtx x = *xp;
--- 712,720 ----
  
  /* Subroutine of approx_reg_cost; called through for_each_rtx.  */
  
! static
! inline
! int
  approx_reg_cost_1 (rtx *xp, void *data)
  {
    rtx x = *xp;
***************
*** 736,741 ****
--- 740,748 ----
    return 0;
  }
  
+ DEFINE_FOR_EACH_RTX_ITERATOR(approx_reg_cost_1)
+ 
+ 
  /* Return an estimate of the cost of the registers used in an rtx.
     This is mostly the number of different REG expressions in the rtx;
     however for some exceptions like fixed registers we use a cost of
***************
*** 746,752 ****
  {
    int cost = 0;
  
!   if (for_each_rtx (&x, approx_reg_cost_1, (void *) &cost))
      return MAX_COST;
  
    return cost;
--- 753,759 ----
  {
    int cost = 0;
  
!   if (CALL_FOR_EACH_RTX_ITERATOR (&x, approx_reg_cost_1, (void *) &cost))
      return MAX_COST;
  
    return cost;
***************
*** 1769,1775 ****
    rtx exp;
  };
  
! static int
  check_dependence (rtx *x, void *data)
  {
    struct check_dependence_data *d = (struct check_dependence_data *) data;
--- 1776,1784 ----
    rtx exp;
  };
  
! static 
! inline
! int
  check_dependence (rtx *x, void *data)
  {
    struct check_dependence_data *d = (struct check_dependence_data *) data;
***************
*** 1778,1783 ****
--- 1787,1795 ----
    else
      return 0;
  }
+ 
+ DEFINE_FOR_EACH_RTX_ITERATOR(check_dependence)
+ 
  

  /* Remove from the hash table, or mark as invalid, all expressions whose
     values could be altered by storing in X.  X is a register, a subreg, or
***************
*** 1914,1920 ****
  		    p->canon_exp = canon_rtx (p->exp);
  		  d.exp = x;
  		  d.mode = full_mode;
! 		  if (for_each_rtx (&p->canon_exp, check_dependence, &d))
  		    remove_from_table (p, i);
  		}
  	    }
--- 1926,1932 ----
  		    p->canon_exp = canon_rtx (p->exp);
  		  d.exp = x;
  		  d.mode = full_mode;
! 		  if (CALL_FOR_EACH_RTX_ITERATOR (&p->canon_exp, check_dependence, &d))
  		    remove_from_table (p, i);
  		}
  	    }
***************
*** 7121,7126 ****
--- 7133,7140 ----
    rtx libcall_insn = NULL_RTX;
    int num_insns = 0;
  
+   DECLARE_FOR_EACH_RTX_ITERATOR(check_for_label_ref);
+ 
    /* This array is undefined before max_reg, so only allocate
       the space actually needed and adjust the start.  */
  
***************
*** 7209,7215 ****
  	  /* If we haven't already found an insn where we added a LABEL_REF,
  	     check this one.  */
  	  if (GET_CODE (insn) == INSN && ! recorded_label_ref
! 	      && for_each_rtx (&PATTERN (insn), check_for_label_ref,
  			       (void *) insn))
  	    recorded_label_ref = 1;
  	}
--- 7223,7229 ----
  	  /* If we haven't already found an insn where we added a LABEL_REF,
  	     check this one.  */
  	  if (GET_CODE (insn) == INSN && ! recorded_label_ref
! 	      && CALL_FOR_EACH_RTX_ITERATOR (&PATTERN (insn), check_for_label_ref,
  			       (void *) insn))
  	    recorded_label_ref = 1;
  	}
***************
*** 7326,7332 ****
  /* Called via for_each_rtx to see if an insn is using a LABEL_REF for which
     there isn't a REG_LABEL note.  Return one if so.  DATA is the insn.  */
  
! static int
  check_for_label_ref (rtx *rtl, void *data)
  {
    rtx insn = (rtx) data;
--- 7340,7348 ----
  /* Called via for_each_rtx to see if an insn is using a LABEL_REF for which
     there isn't a REG_LABEL note.  Return one if so.  DATA is the insn.  */
  
! static 
! inline
! int
  check_for_label_ref (rtx *rtl, void *data)
  {
    rtx insn = (rtx) data;
***************
*** 7341,7346 ****
--- 7357,7365 ----
  	  && INSN_UID (XEXP (*rtl, 0)) != 0
  	  && ! find_reg_note (insn, REG_LABEL, XEXP (*rtl, 0)));
  }
+ 
+ DEFINE_FOR_EACH_RTX_ITERATOR(check_for_label_ref)
+ 
  

  /* Count the number of times registers are used (not set) in X.
     COUNTS is an array in which we accumulate the count, INCR is how much



More information about the Gcc mailing list