[PATCH] Add support for profile merging hooks

Jan Hubicka jh@suse.cz
Wed Apr 23 13:55:00 GMT 2003


> Hello,
> 
> some of the rtlopt profiling features require other info in addition
> to counters be stored in .da file. Merging this extra information by
> summing it clearly is not the right thing to do, so we added a support
> for section specific merging functions.
Is this patch enought so I can simply copy libgcov.c around during next
rtlopt branch merge?
> 
> Zdenek
> 
> 	* gcov-io.h (merger_function, profile_merger_for_tag): Declare.
> 	* gcov-io.c (profile_merger_for_tag): New.
> 	* libgcov.c (gcov_exit): Use it.
> 
...
> *** 248,255 ****
>   		  if (n_counters != length / 8)
>   		    goto read_mismatch;
>   		 
> ! 		  for (jx = 0; jx < n_counters; jx++)
> ! 		    counters[sect_index][jx] += gcov_read_counter ();
>   		  
>   		  counters[sect_index] += n_counters;
>   		}
> --- 249,264 ----
>   		  if (n_counters != length / 8)
>   		    goto read_mismatch;
>   		 
> ! 		  if ((merger = profile_merger_for_tag (tag)))
> ! 		    {
> ! 		      if ((*merger) (counters[sect_index], n_counters))
> ! 			goto read_error;
> ! 		    }
> ! 		  else
> ! 		    {
> ! 		      for (jx = 0; jx < n_counters; jx++)
> ! 			counters[sect_index][jx] += gcov_read_counter ();
> ! 		    }

Is there any reason for not doing the adding as merger function too?
(I guess it would be easier to read that way)
Also what about merging done at profile.c side?

Honza
>   		  
>   		  counters[sect_index] += n_counters;
>   		}



More information about the Gcc-patches mailing list