This is the mail archive of the
gcc-patches@gcc.gnu.org
mailing list for the GCC project.
[3.4-BIB] fix profiling
- From: Jan Hubicka <jh at suse dot cz>
- To: gcc-patches at gcc dot gnu dot org
- Date: Mon, 14 Oct 2002 19:25:22 +0200
- Subject: [3.4-BIB] fix profiling
Hi,
This patch fixes two places where we get merging conflict from mainline
and also fixes types so profiling works on 64bit targets again.
I've installed it as obvious.
Honza
Mon Oct 14 19:18:24 CEST 2002 Jan Hubicka <jh@suse.cz>
* gcov-io.h (gcov_info): Fix type.
* profile.c (get_exec_counts): use symbol name.
(branch_prob): Likewise.
(create_profiler): Fix type missmatch.
Index: gcov-io.h
===================================================================
RCS file: /cvsroot/gcc/egcs/gcc/gcov-io.h,v
retrieving revision 1.16.8.2
diff -c -3 -p -r1.16.8.2 gcov-io.h
*** gcov-io.h 1 Oct 2002 17:31:47 -0000 1.16.8.2
--- gcov-io.h 14 Oct 2002 17:16:11 -0000
*************** struct function_info
*** 231,237 ****
/* Information about a single object file. */
struct gcov_info
{
! unsigned version; /* expected version number */
struct gcov_info *next; /* link to next, used by libgcc */
const char *filename; /* output file name */
--- 231,237 ----
/* Information about a single object file. */
struct gcov_info
{
! unsigned long version; /* expected version number */
struct gcov_info *next; /* link to next, used by libgcc */
const char *filename; /* output file name */
Index: profile.c
===================================================================
RCS file: /cvsroot/gcc/egcs/gcc/profile.c,v
retrieving revision 1.97.4.4
diff -c -3 -p -r1.97.4.4 profile.c
*** profile.c 24 Sep 2002 19:23:40 -0000 1.97.4.4
--- profile.c 14 Oct 2002 17:16:12 -0000
*************** get_exec_counts ()
*** 217,222 ****
--- 217,224 ----
2 = seen fn, 3 = seen prog summaries */
unsigned magic, version;
unsigned ix;
+ const char *name = IDENTIFIER_POINTER
+ (DECL_ASSEMBLER_NAME (current_function_decl));
profile_info.max_counter_in_program = 0;
profile_info.count_profiles_merged = 0;
*************** get_exec_counts ()
*** 305,311 ****
|| gcov_read_unsigned (da_file, &checksum))
goto corrupt;
! if (strcmp (current_function_name, function_name_buffer))
;
else if (checksum != profile_info.current_function_cfg_checksum)
{
--- 307,313 ----
|| gcov_read_unsigned (da_file, &checksum))
goto corrupt;
! if (strcmp (name, function_name_buffer))
;
else if (checksum != profile_info.current_function_cfg_checksum)
{
*************** branch_prob ()
*** 755,760 ****
--- 757,764 ----
int i;
int num_edges, ignored_edges;
struct edge_list *el;
+ const char *name = IDENTIFIER_POINTER
+ (DECL_ASSEMBLER_NAME (current_function_decl));
profile_info.current_function_cfg_checksum = compute_checksum ();
*************** branch_prob ()
*** 913,920 ****
/* Announce function */
if (gcov_write_unsigned (bbg_file, GCOV_TAG_FUNCTION)
|| !(offset = gcov_reserve_length (bbg_file))
! || gcov_write_string (bbg_file, current_function_name,
! strlen (current_function_name))
|| gcov_write_unsigned (bbg_file,
profile_info.current_function_cfg_checksum)
|| gcov_write_length (bbg_file, offset))
--- 917,924 ----
/* Announce function */
if (gcov_write_unsigned (bbg_file, GCOV_TAG_FUNCTION)
|| !(offset = gcov_reserve_length (bbg_file))
! || gcov_write_string (bbg_file, name,
! strlen (name))
|| gcov_write_unsigned (bbg_file,
profile_info.current_function_cfg_checksum)
|| gcov_write_length (bbg_file, offset))
*************** branch_prob ()
*** 1061,1067 ****
functions_tail = &item->next;
item->next = 0;
! item->name = xstrdup (current_function_name);
item->cfg_checksum = profile_info.current_function_cfg_checksum;
item->count_edges = profile_info.count_edges_instrumented_now;
}
--- 1065,1071 ----
functions_tail = &item->next;
item->next = 0;
! item->name = xstrdup (name);
item->cfg_checksum = profile_info.current_function_cfg_checksum;
item->count_edges = profile_info.count_edges_instrumented_now;
}
*************** create_profiler ()
*** 1354,1360 ****
/* Version ident */
fields = build_decl (FIELD_DECL, NULL_TREE, long_unsigned_type_node);
! value = tree_cons (fields, convert (unsigned_type_node, build_int_2
(GCOV_VERSION, 0)), value);
/* NULL */
--- 1358,1364 ----
/* Version ident */
fields = build_decl (FIELD_DECL, NULL_TREE, long_unsigned_type_node);
! value = tree_cons (fields, convert (long_unsigned_type_node, build_int_2
(GCOV_VERSION, 0)), value);
/* NULL */
*************** create_profiler ()
*** 1394,1400 ****
field = build_decl (FIELD_DECL, NULL_TREE, long_integer_type_node);
TREE_CHAIN (field) = fields;
fields = field;
! value = tree_cons (fields, integer_zero_node, value);
/* function_info table */
{
--- 1398,1406 ----
field = build_decl (FIELD_DECL, NULL_TREE, long_integer_type_node);
TREE_CHAIN (field) = fields;
fields = field;
! value = tree_cons (fields,
! convert (long_integer_type_node, integer_zero_node),
! value);
/* function_info table */
{