Commit 23190837 by Andreas Jaeger

gcov.c (output_data): Use HOST_WIDEST_INT_PRINT_DEC to output variables of type HOST_WIDEST_INT.

	* gcov.c (output_data): Use HOST_WIDEST_INT_PRINT_DEC to output
	variables of type HOST_WIDEST_INT.

	* libgcc2.c (__bb_exit_func): Handle gcov_type as long long.
	(__bb_exit_func): Correct type of count_max to avoid overflow.
	(num_digits): Handle long long argument.

	* combine.c (gen_lowpart_for_combine): Remove unused variable.

From-SVN: r44033
parent cc385017
2001-07-16 Andreas Jaeger <aj@suse.de>
* gcov.c (output_data): Use HOST_WIDEST_INT_PRINT_DEC to output
variables of type HOST_WIDEST_INT.
* libgcc2.c (__bb_exit_func): Handle gcov_type as long long.
(__bb_exit_func): Correct type of count_max to avoid overflow.
(num_digits): Handle long long argument.
* combine.c (gen_lowpart_for_combine): Remove unused variable.
2001-07-16 Neil Booth <neil@cat.daikokuya.demon.co.uk> 2001-07-16 Neil Booth <neil@cat.daikokuya.demon.co.uk>
* output.h (sdb_begin_function_line): Restore as an extern * output.h (sdb_begin_function_line): Restore as an extern
...@@ -271,16 +282,16 @@ Fri Jul 13 23:04:00 2001 Denis Chertykov <denisc@overta.ru> ...@@ -271,16 +282,16 @@ Fri Jul 13 23:04:00 2001 Denis Chertykov <denisc@overta.ru>
2001-07-13 Hartmut Penner <hpenner@de.ibm.com> 2001-07-13 Hartmut Penner <hpenner@de.ibm.com>
* config.gcc: Add configuration for s/390. * config.gcc: Add configuration for s/390.
* config/s390/s390.c: New. Subroutines for code generation. * config/s390/s390.c: New. Subroutines for code generation.
* config/s390/s390.h: New. Definitions for s/390. * config/s390/s390.h: New. Definitions for s/390.
* config/s390/s390-protos.h: New. Prototypes. * config/s390/s390-protos.h: New. Prototypes.
* config/s390/linux.h: New. Definitions for linux for s/390. * config/s390/linux.h: New. Definitions for linux for s/390.
* config/s390/linux64.h: New. Definitions for linux for zSeries. * config/s390/linux64.h: New. Definitions for linux for zSeries.
* config/s390/t-linux: New. Makefile fragment. * config/s390/t-linux: New. Makefile fragment.
* config/s390/s390.md: New. Machine description for s/390 and zSeries. * config/s390/s390.md: New. Machine description for s/390 and zSeries.
* config/s390/fixdfdi.h: New. Fix L_fix*di. * config/s390/fixdfdi.h: New. Fix L_fix*di.
Fri Jul 13 14:46:21 CEST 2001 Jan Hubicka <jh@suse.cz> Fri Jul 13 14:46:21 CEST 2001 Jan Hubicka <jh@suse.cz>
* emit-rtl.c (try_split): Update mark_jump_label call. * emit-rtl.c (try_split): Update mark_jump_label call.
...@@ -475,7 +486,7 @@ Wed Jul 11 21:27:25 CEST 2001 Jan Hubicka <jh@suse.cz> ...@@ -475,7 +486,7 @@ Wed Jul 11 21:27:25 CEST 2001 Jan Hubicka <jh@suse.cz>
* jump.c (rtx_renumbered_equal_p): Handle 't' fields. * jump.c (rtx_renumbered_equal_p): Handle 't' fields.
* output.h (cleanup_cfg): Update prototype. * output.h (cleanup_cfg): Update prototype.
* reg-stack.c (reg_to_stack): Use cleanup_cfg instead of jump_optimize * reg-stack.c (reg_to_stack): Use cleanup_cfg instead of jump_optimize
* sibcall.c (optimize_sibling_and_tail_recursive_call): Update * sibcall.c (optimize_sibling_and_tail_recursive_call): Update
cleanup_cfg call; kill missleading comment. cleanup_cfg call; kill missleading comment.
* toplev.c (rest_of_compilation): Update all cleanup_cfg calls. * toplev.c (rest_of_compilation): Update all cleanup_cfg calls.
* flow.c (merge_blocks, try_optimize_cfg, cleanup_cfg): Accept mode * flow.c (merge_blocks, try_optimize_cfg, cleanup_cfg): Accept mode
...@@ -506,7 +517,7 @@ Wed Jul 11 21:27:25 CEST 2001 Jan Hubicka <jh@suse.cz> ...@@ -506,7 +517,7 @@ Wed Jul 11 21:27:25 CEST 2001 Jan Hubicka <jh@suse.cz>
2001-07-11 Mark Mitchell <mark@codesourcery.com> 2001-07-11 Mark Mitchell <mark@codesourcery.com>
* stmt.c (parse_output_constraint): New function, split out * stmt.c (parse_output_constraint): New function, split out
from ... from ...
(expand_asm_operands): ... here. Use parse_output_constraint. (expand_asm_operands): ... here. Use parse_output_constraint.
* tree.h (parse_output_constraint): Declare it. * tree.h (parse_output_constraint): Declare it.
...@@ -573,7 +584,7 @@ Tue Jul 10 07:27:53 2001 Richard Kenner <kenner@vlsi1.ultra.nyu.edu> ...@@ -573,7 +584,7 @@ Tue Jul 10 07:27:53 2001 Richard Kenner <kenner@vlsi1.ultra.nyu.edu>
* recog.c (offsettable_address_p): Handle LO_SUM case. * recog.c (offsettable_address_p): Handle LO_SUM case.
* config/mips/mips.c (double_memory_operand): Use adjust_address_nv * config/mips/mips.c (double_memory_operand): Use adjust_address_nv
instead of plus_constant. instead of plus_constant.
2001-07-10 Stephane Carrez <Stephane.Carrez@worldnet.fr> 2001-07-10 Stephane Carrez <Stephane.Carrez@worldnet.fr>
* reload1.c (merge_assigned_reloads): After a RELOAD_OTHER merge, * reload1.c (merge_assigned_reloads): After a RELOAD_OTHER merge,
...@@ -640,7 +651,7 @@ Tue Jul 10 09:04:45 2001 Jeffrey A Law (law@cygnus.com) ...@@ -640,7 +651,7 @@ Tue Jul 10 09:04:45 2001 Jeffrey A Law (law@cygnus.com)
.loc support. .loc support.
* collect2.c (main): Set COLLECT_NO_DEMANGLE for subprocesses. * collect2.c (main): Set COLLECT_NO_DEMANGLE for subprocesses.
(dump_file): Only pad the demangled name with spaces if the (dump_file): Only pad the demangled name with spaces if the
mangled name was padded with spaces. mangled name was padded with spaces.
2001-07-10 Bernd Schmidt <bernds@redhat.com> 2001-07-10 Bernd Schmidt <bernds@redhat.com>
......
...@@ -1133,7 +1133,7 @@ can_combine_p (insn, i3, pred, succ, pdest, psrc) ...@@ -1133,7 +1133,7 @@ can_combine_p (insn, i3, pred, succ, pdest, psrc)
for (p = NEXT_INSN (insn); p != i3; p = NEXT_INSN (p)) for (p = NEXT_INSN (insn); p != i3; p = NEXT_INSN (p))
if (INSN_P (p) && p != succ && volatile_refs_p (PATTERN (p))) if (INSN_P (p) && p != succ && volatile_refs_p (PATTERN (p)))
return 0; return 0;
} }
/* If INSN is an asm, and DEST is a hard register, reject, since it has /* If INSN is an asm, and DEST is a hard register, reject, since it has
...@@ -1245,7 +1245,7 @@ sets_function_arg_p (pat) ...@@ -1245,7 +1245,7 @@ sets_function_arg_p (pat)
This is NOT equivalent to: This is NOT equivalent to:
(parallel [(set (subreg:SI (reg:DI 100) 0) <foo>) (parallel [(set (subreg:SI (reg:DI 100) 0) <foo>)
(set (reg:DI 101) (reg:DI 100))]) (set (reg:DI 101) (reg:DI 100))])
Not only does this modify 100 (in which case it might still be valid Not only does this modify 100 (in which case it might still be valid
if 100 were dead in I2), it sets 101 to the ORIGINAL value of 100. if 100 were dead in I2), it sets 101 to the ORIGINAL value of 100.
...@@ -1421,7 +1421,7 @@ cant_combine_insn_p (insn) ...@@ -1421,7 +1421,7 @@ cant_combine_insn_p (insn)
{ {
rtx set; rtx set;
rtx src, dest; rtx src, dest;
/* If this isn't really an insn, we can't do anything. /* If this isn't really an insn, we can't do anything.
This can occur when flow deletes an insn that it has merged into an This can occur when flow deletes an insn that it has merged into an
auto-increment address. */ auto-increment address. */
...@@ -1771,7 +1771,7 @@ try_combine (i3, i2, i1, new_direct_jump_p) ...@@ -1771,7 +1771,7 @@ try_combine (i3, i2, i1, new_direct_jump_p)
/* If I3 has an inc, then give up if I1 or I2 uses the reg that is inc'd. /* If I3 has an inc, then give up if I1 or I2 uses the reg that is inc'd.
We used to do this EXCEPT in one case: I3 has a post-inc in an We used to do this EXCEPT in one case: I3 has a post-inc in an
output operand. However, that exception can give rise to insns like output operand. However, that exception can give rise to insns like
mov r3,(r3)+ mov r3,(r3)+
which is a famous insn on the PDP-11 where the value of r3 used as the which is a famous insn on the PDP-11 where the value of r3 used as the
source was model-dependent. Avoid this sort of thing. */ source was model-dependent. Avoid this sort of thing. */
...@@ -2136,7 +2136,7 @@ try_combine (i3, i2, i1, new_direct_jump_p) ...@@ -2136,7 +2136,7 @@ try_combine (i3, i2, i1, new_direct_jump_p)
insn_code_number = recog_for_combine (&m_split, i3, &new_i3_notes); insn_code_number = recog_for_combine (&m_split, i3, &new_i3_notes);
if (insn_code_number >= 0) if (insn_code_number >= 0)
newpat = m_split; newpat = m_split;
} }
else if (m_split && GET_CODE (m_split) == SEQUENCE else if (m_split && GET_CODE (m_split) == SEQUENCE
&& XVECLEN (m_split, 0) == 2 && XVECLEN (m_split, 0) == 2
&& (next_real_insn (i2) == i3 && (next_real_insn (i2) == i3
...@@ -3786,7 +3786,7 @@ combine_simplify_rtx (x, op0_mode, last, in_dest) ...@@ -3786,7 +3786,7 @@ combine_simplify_rtx (x, op0_mode, last, in_dest)
{ {
rtx temp; rtx temp;
temp = simplify_subreg (mode, SUBREG_REG (x), op0_mode, temp = simplify_subreg (mode, SUBREG_REG (x), op0_mode,
SUBREG_BYTE (x)); SUBREG_BYTE (x));
if (temp) if (temp)
return temp; return temp;
} }
...@@ -3861,12 +3861,12 @@ combine_simplify_rtx (x, op0_mode, last, in_dest) ...@@ -3861,12 +3861,12 @@ combine_simplify_rtx (x, op0_mode, last, in_dest)
return gen_rtx_GE (mode, XEXP (XEXP (x, 0), 0), const0_rtx); return gen_rtx_GE (mode, XEXP (XEXP (x, 0), 0), const0_rtx);
/* Apply De Morgan's laws to reduce number of patterns for machines /* Apply De Morgan's laws to reduce number of patterns for machines
with negating logical insns (and-not, nand, etc.). If result has with negating logical insns (and-not, nand, etc.). If result has
only one NOT, put it first, since that is how the patterns are only one NOT, put it first, since that is how the patterns are
coded. */ coded. */
if (GET_CODE (XEXP (x, 0)) == IOR || GET_CODE (XEXP (x, 0)) == AND) if (GET_CODE (XEXP (x, 0)) == IOR || GET_CODE (XEXP (x, 0)) == AND)
{ {
rtx in1 = XEXP (XEXP (x, 0), 0), in2 = XEXP (XEXP (x, 0), 1); rtx in1 = XEXP (XEXP (x, 0), 0), in2 = XEXP (XEXP (x, 0), 1);
enum machine_mode op_mode; enum machine_mode op_mode;
...@@ -3931,7 +3931,7 @@ combine_simplify_rtx (x, op0_mode, last, in_dest) ...@@ -3931,7 +3931,7 @@ combine_simplify_rtx (x, op0_mode, last, in_dest)
temp = expand_compound_operation (XEXP (x, 0)); temp = expand_compound_operation (XEXP (x, 0));
/* For C equal to the width of MODE minus 1, (neg (ashiftrt X C)) can be /* For C equal to the width of MODE minus 1, (neg (ashiftrt X C)) can be
replaced by (lshiftrt X C). This will convert replaced by (lshiftrt X C). This will convert
(neg (sign_extract X 1 Y)) to (zero_extract X 1 Y). */ (neg (sign_extract X 1 Y)) to (zero_extract X 1 Y). */
if (GET_CODE (temp) == ASHIFTRT if (GET_CODE (temp) == ASHIFTRT
...@@ -4015,7 +4015,7 @@ combine_simplify_rtx (x, op0_mode, last, in_dest) ...@@ -4015,7 +4015,7 @@ combine_simplify_rtx (x, op0_mode, last, in_dest)
&& num_sign_bit_copies (XEXP (x, 0), GET_MODE (XEXP (x, 0))) && num_sign_bit_copies (XEXP (x, 0), GET_MODE (XEXP (x, 0)))
>= GET_MODE_BITSIZE (mode) + 1 >= GET_MODE_BITSIZE (mode) + 1
&& ! (GET_CODE (XEXP (x, 0)) == LSHIFTRT && ! (GET_CODE (XEXP (x, 0)) == LSHIFTRT
&& GET_CODE (XEXP (XEXP (x, 0), 0)) == MULT)) && GET_CODE (XEXP (XEXP (x, 0), 0)) == MULT))
return gen_lowpart_for_combine (mode, XEXP (x, 0)); return gen_lowpart_for_combine (mode, XEXP (x, 0));
/* A truncate of a comparison can be replaced with a subreg if /* A truncate of a comparison can be replaced with a subreg if
...@@ -4250,8 +4250,8 @@ combine_simplify_rtx (x, op0_mode, last, in_dest) ...@@ -4250,8 +4250,8 @@ combine_simplify_rtx (x, op0_mode, last, in_dest)
case GT: case GTU: case GE: case GEU: case GT: case GTU: case GE: case GEU:
case LT: case LTU: case LE: case LEU: case LT: case LTU: case LE: case LEU:
case UNEQ: case LTGT: case UNEQ: case LTGT:
case UNGT: case UNGE: case UNGT: case UNGE:
case UNLT: case UNLE: case UNLT: case UNLE:
case UNORDERED: case ORDERED: case UNORDERED: case ORDERED:
/* If the first operand is a condition code, we can't do anything /* If the first operand is a condition code, we can't do anything
with it. */ with it. */
...@@ -4527,7 +4527,7 @@ combine_simplify_rtx (x, op0_mode, last, in_dest) ...@@ -4527,7 +4527,7 @@ combine_simplify_rtx (x, op0_mode, last, in_dest)
} }
break; break;
default: default:
break; break;
} }
...@@ -5579,7 +5579,7 @@ expand_compound_operation (x) ...@@ -5579,7 +5579,7 @@ expand_compound_operation (x)
&& GET_RTX_CLASS (GET_CODE (XEXP (XEXP (x, 0), 0))) == '<' && GET_RTX_CLASS (GET_CODE (XEXP (XEXP (x, 0), 0))) == '<'
&& (GET_MODE_BITSIZE (GET_MODE (XEXP (x, 0))) && (GET_MODE_BITSIZE (GET_MODE (XEXP (x, 0)))
<= HOST_BITS_PER_WIDE_INT) <= HOST_BITS_PER_WIDE_INT)
&& ((HOST_WIDE_INT) STORE_FLAG_VALUE && ((HOST_WIDE_INT) STORE_FLAG_VALUE
& ~GET_MODE_MASK (GET_MODE (XEXP (x, 0)))) == 0) & ~GET_MODE_MASK (GET_MODE (XEXP (x, 0)))) == 0)
return XEXP (XEXP (x, 0), 0); return XEXP (XEXP (x, 0), 0);
...@@ -5922,9 +5922,9 @@ make_extraction (mode, inner, pos, pos_rtx, len, ...@@ -5922,9 +5922,9 @@ make_extraction (mode, inner, pos, pos_rtx, len,
new = gen_rtx_SUBREG (tmode, inner, final_word); new = gen_rtx_SUBREG (tmode, inner, final_word);
} }
else else
new = inner; new = inner;
} }
else else
new = force_to_mode (inner, tmode, new = force_to_mode (inner, tmode,
len >= HOST_BITS_PER_WIDE_INT len >= HOST_BITS_PER_WIDE_INT
...@@ -7418,7 +7418,7 @@ known_cond (x, cond, reg, val) ...@@ -7418,7 +7418,7 @@ known_cond (x, cond, reg, val)
/* Do not reverse the condition when it is NE or EQ. /* Do not reverse the condition when it is NE or EQ.
This is because we cannot conclude anything about This is because we cannot conclude anything about
the value of 'SMAX (x, y)' when x is not equal to y, the value of 'SMAX (x, y)' when x is not equal to y,
but we can when x equals y. */ but we can when x equals y. */
if ((code == SMAX || code == UMAX) if ((code == SMAX || code == UMAX)
&& ! (cond == EQ || cond == NE)) && ! (cond == EQ || cond == NE))
cond = reverse_condition (cond); cond = reverse_condition (cond);
...@@ -9717,7 +9717,6 @@ gen_lowpart_for_combine (mode, x) ...@@ -9717,7 +9717,6 @@ gen_lowpart_for_combine (mode, x)
if (GET_CODE (x) == MEM) if (GET_CODE (x) == MEM)
{ {
register int offset = 0; register int offset = 0;
rtx new;
/* Refuse to work on a volatile memory ref or one with a mode-dependent /* Refuse to work on a volatile memory ref or one with a mode-dependent
address. */ address. */
...@@ -10530,7 +10529,7 @@ simplify_comparison (code, pop0, pop1) ...@@ -10530,7 +10529,7 @@ simplify_comparison (code, pop0, pop1)
new_code = GET_CODE (op0); new_code = GET_CODE (op0);
else else
new_code = combine_reversed_comparison_code (op0); new_code = combine_reversed_comparison_code (op0);
if (new_code != UNKNOWN) if (new_code != UNKNOWN)
{ {
code = new_code; code = new_code;
......
/* Gcov.c: prepend line execution counts and branch probabilities to a /* Gcov.c: prepend line execution counts and branch probabilities to a
source file. source file.
Copyright (C) 1990, 1991, 1992, 1993, 1994, 1996, 1997, 1998, Copyright (C) 1990, 1991, 1992, 1993, 1994, 1996, 1997, 1998,
1999, 2000 Free Software Foundation, Inc. 1999, 2000, 2001 Free Software Foundation, Inc.
Contributed by James E. Wilson of Cygnus Support. Contributed by James E. Wilson of Cygnus Support.
Mangled by Bob Manson of Cygnus Support. Mangled by Bob Manson of Cygnus Support.
...@@ -218,7 +218,7 @@ static char *object_directory = 0; ...@@ -218,7 +218,7 @@ static char *object_directory = 0;
/* Output the number of times a branch was taken as opposed to the percentage /* Output the number of times a branch was taken as opposed to the percentage
of times it was taken. Turned on by the -c option */ of times it was taken. Turned on by the -c option */
static int output_branch_counts = 0; static int output_branch_counts = 0;
/* Forward declarations. */ /* Forward declarations. */
...@@ -438,7 +438,7 @@ open_files () ...@@ -438,7 +438,7 @@ open_files ()
fnotice (stderr, "Could not open data file %s.\n", da_file_name); fnotice (stderr, "Could not open data file %s.\n", da_file_name);
fnotice (stderr, "Assuming that all execution counts are zero.\n"); fnotice (stderr, "Assuming that all execution counts are zero.\n");
} }
bbg_file = fopen (bbg_file_name, "rb"); bbg_file = fopen (bbg_file_name, "rb");
if (bbg_file == NULL) if (bbg_file == NULL)
{ {
...@@ -590,7 +590,7 @@ create_program_flow_graph (bptr) ...@@ -590,7 +590,7 @@ create_program_flow_graph (bptr)
bb_graph[arcptr->target].pred_count--; bb_graph[arcptr->target].pred_count--;
} }
} }
static void static void
solve_program_flow_graph (bptr) solve_program_flow_graph (bptr)
struct bb_info_list *bptr; struct bb_info_list *bptr;
...@@ -707,7 +707,7 @@ solve_program_flow_graph (bptr) ...@@ -707,7 +707,7 @@ solve_program_flow_graph (bptr)
} }
} }
} }
/* If the graph has been correctly solved, every block will have a /* If the graph has been correctly solved, every block will have a
succ and pred count of zero. */ succ and pred count of zero. */
for (i = 0; i < num_blocks; i++) for (i = 0; i < num_blocks; i++)
...@@ -772,7 +772,7 @@ read_files () ...@@ -772,7 +772,7 @@ read_files ()
bb_data = (char *) xmalloc ((unsigned) buf.st_size); bb_data = (char *) xmalloc ((unsigned) buf.st_size);
fread (bb_data, sizeof (char), buf.st_size, bb_file); fread (bb_data, sizeof (char), buf.st_size, bb_file);
fclose (bb_file); fclose (bb_file);
if (da_file) if (da_file)
fclose (da_file); fclose (da_file);
...@@ -890,7 +890,7 @@ calculate_branch_probs (current_graph, block_num, branch_probs, last_line_num) ...@@ -890,7 +890,7 @@ calculate_branch_probs (current_graph, block_num, branch_probs, last_line_num)
if (arcptr->fall_through) if (arcptr->fall_through)
continue; continue;
a_ptr = (struct arcdata *) xmalloc (sizeof (struct arcdata)); a_ptr = (struct arcdata *) xmalloc (sizeof (struct arcdata));
a_ptr->total = total; a_ptr->total = total;
if (total == 0) if (total == 0)
...@@ -1042,7 +1042,7 @@ output_data () ...@@ -1042,7 +1042,7 @@ output_data ()
if (output_branch_probs) if (output_branch_probs)
branch_probs = (struct arcdata **) branch_probs = (struct arcdata **)
xcalloc (sizeof (struct arcdata *), s_ptr->maxlineno); xcalloc (sizeof (struct arcdata *), s_ptr->maxlineno);
/* There will be a zero at the beginning of the bb info, before the /* There will be a zero at the beginning of the bb info, before the
first list of line numbers, so must initialize block_num to 0. */ first list of line numbers, so must initialize block_num to 0. */
block_num = 0; block_num = 0;
...@@ -1066,7 +1066,7 @@ output_data () ...@@ -1066,7 +1066,7 @@ output_data ()
this_file = 0; this_file = 0;
else else
this_file = 1; this_file = 1;
/* Scan past the file name. */ /* Scan past the file name. */
do { do {
count++; count++;
...@@ -1139,7 +1139,7 @@ output_data () ...@@ -1139,7 +1139,7 @@ output_data ()
function_name); function_name);
abort (); abort ();
} }
if (output_branch_probs && this_file) if (output_branch_probs && this_file)
calculate_branch_probs (current_graph, block_num, calculate_branch_probs (current_graph, block_num,
branch_probs, last_line_num); branch_probs, last_line_num);
...@@ -1246,7 +1246,7 @@ output_data () ...@@ -1246,7 +1246,7 @@ output_data ()
/* Now the statistics are ready. Read in the source file one line /* Now the statistics are ready. Read in the source file one line
at a time, and output that line to the gcov file preceded by at a time, and output that line to the gcov file preceded by
its execution count if non zero. */ its execution count if non zero. */
source_file = fopen (source_file_name, "r"); source_file = fopen (source_file_name, "r");
if (source_file == NULL) if (source_file == NULL)
{ {
...@@ -1266,7 +1266,7 @@ output_data () ...@@ -1266,7 +1266,7 @@ output_data ()
if (output_long_names && strcmp (cptr, input_file_name)) if (output_long_names && strcmp (cptr, input_file_name))
{ {
gcov_file_name = xmalloc (count + 7 + strlen (input_file_name)); gcov_file_name = xmalloc (count + 7 + strlen (input_file_name));
cptr = strrchr (input_file_name, '/'); cptr = strrchr (input_file_name, '/');
if (cptr) if (cptr)
strcpy (gcov_file_name, cptr + 1); strcpy (gcov_file_name, cptr + 1);
...@@ -1361,11 +1361,13 @@ output_data () ...@@ -1361,11 +1361,13 @@ output_data ()
{ {
if (output_branch_counts) if (output_branch_counts)
fnotice (gcov_file, fnotice (gcov_file,
"call %d returns = %d\n", "call %d returns = "
HOST_WIDEST_INT_PRINT_DEC "\n",
i, a_ptr->total - a_ptr->hits); i, a_ptr->total - a_ptr->hits);
else else
fnotice (gcov_file, fnotice (gcov_file,
"call %d returns = %d%%\n", "call %d returns = "
HOST_WIDEST_INT_PRINT_DEC "%%\n",
i, 100 - ((a_ptr->hits * 100) + i, 100 - ((a_ptr->hits * 100) +
(a_ptr->total >> 1))/a_ptr->total); (a_ptr->total >> 1))/a_ptr->total);
} }
...@@ -1379,11 +1381,13 @@ output_data () ...@@ -1379,11 +1381,13 @@ output_data ()
{ {
if (output_branch_counts) if (output_branch_counts)
fnotice (gcov_file, fnotice (gcov_file,
"branch %d taken = %d\n", "branch %d taken = "
HOST_WIDEST_INT_PRINT_DEC "\n",
i, a_ptr->hits); i, a_ptr->hits);
else else
fnotice (gcov_file, fnotice (gcov_file,
"branch %d taken = %d%%\n", i, "branch %d taken = "
HOST_WIDEST_INT_PRINT_DEC "%%\n", i,
((a_ptr->hits * 100) + ((a_ptr->hits * 100) +
(a_ptr->total >> 1))/ (a_ptr->total >> 1))/
a_ptr->total); a_ptr->total);
......
...@@ -76,7 +76,7 @@ __addvsi3 (Wtype a, Wtype b) ...@@ -76,7 +76,7 @@ __addvsi3 (Wtype a, Wtype b)
abort (); abort ();
return w; return w;
} }
#endif #endif
#ifdef L_addvdi3 #ifdef L_addvdi3
...@@ -1069,7 +1069,7 @@ __floatdidf (DWtype u) ...@@ -1069,7 +1069,7 @@ __floatdidf (DWtype u)
/* Define codes for all the float formats that we know of. Note /* Define codes for all the float formats that we know of. Note
that this is copied from real.h. */ that this is copied from real.h. */
#define UNKNOWN_FLOAT_FORMAT 0 #define UNKNOWN_FLOAT_FORMAT 0
#define IEEE_FLOAT_FORMAT 1 #define IEEE_FLOAT_FORMAT 1
#define VAX_FLOAT_FORMAT 2 #define VAX_FLOAT_FORMAT 2
...@@ -1311,13 +1311,13 @@ char *ctime PARAMS ((const time_t *)); ...@@ -1311,13 +1311,13 @@ char *ctime PARAMS ((const time_t *));
static struct bb *bb_head; static struct bb *bb_head;
static int num_digits (long value, int base) __attribute__ ((const)); static int num_digits (long long value, int base) __attribute__ ((const));
/* Return the number of digits needed to print a value */ /* Return the number of digits needed to print a value */
/* __inline__ */ static int num_digits (long value, int base) /* __inline__ */ static int num_digits (long long value, int base)
{ {
int minus = (value < 0 && base != 16); int minus = (value < 0 && base != 16);
unsigned long v = (minus) ? -value : value; unsigned long long v = (minus) ? -value : value;
int ret = minus; int ret = minus;
do do
...@@ -1406,7 +1406,7 @@ __bb_exit_func (void) ...@@ -1406,7 +1406,7 @@ __bb_exit_func (void)
else else
{ {
long n_counts = 0; long n_counts = 0;
if (ungetc (firstchar, da_file) == EOF) if (ungetc (firstchar, da_file) == EOF)
rewind (da_file); rewind (da_file);
if (__read_long (&n_counts, da_file, 8) != 0) if (__read_long (&n_counts, da_file, 8) != 0)
...@@ -1448,7 +1448,7 @@ __bb_exit_func (void) ...@@ -1448,7 +1448,7 @@ __bb_exit_func (void)
if (__write_gcov_type (ptr->ncounts, da_file, 8) != 0) if (__write_gcov_type (ptr->ncounts, da_file, 8) != 0)
{ {
fprintf (stderr, "arc profiling: Error writing output file %s.\n", fprintf (stderr, "arc profiling: Error writing output file %s.\n",
ptr->filename); ptr->filename);
} }
...@@ -1470,7 +1470,7 @@ __bb_exit_func (void) ...@@ -1470,7 +1470,7 @@ __bb_exit_func (void)
fprintf (stderr, "arc profiling: Error writing output file %s.\n", fprintf (stderr, "arc profiling: Error writing output file %s.\n",
ptr->filename); ptr->filename);
} }
if (fclose (da_file) == EOF) if (fclose (da_file) == EOF)
fprintf (stderr, "arc profiling: Error closing output file %s.\n", fprintf (stderr, "arc profiling: Error closing output file %s.\n",
ptr->filename); ptr->filename);
...@@ -1512,7 +1512,7 @@ __bb_exit_func (void) ...@@ -1512,7 +1512,7 @@ __bb_exit_func (void)
int file_p = (func_p && ptr->filenames); int file_p = (func_p && ptr->filenames);
int addr_p = (ptr->addresses != 0); int addr_p = (ptr->addresses != 0);
long ncounts = ptr->ncounts; long ncounts = ptr->ncounts;
long cnt_max = 0; gcov_type cnt_max = 0;
long line_max = 0; long line_max = 0;
long addr_max = 0; long addr_max = 0;
int file_len = 0; int file_len = 0;
...@@ -1564,10 +1564,17 @@ __bb_exit_func (void) ...@@ -1564,10 +1564,17 @@ __bb_exit_func (void)
/* Now print out the basic block information. */ /* Now print out the basic block information. */
for (i = 0; i < ncounts; i++) for (i = 0; i < ncounts; i++)
{ {
#if LONG_TYPE_SIZE == GCOV_TYPE_SIZE
fprintf (file, fprintf (file,
" Block #%*d: executed %*ld time(s)", " Block #%*d: executed %*ld time(s)",
blk_len, i+1, blk_len, i+1,
cnt_len, ptr->counts[i]); cnt_len, ptr->counts[i]);
#else
fprintf (file,
" Block #%*d: executed %*lld time(s)",
blk_len, i+1,
cnt_len, ptr->counts[i]);
#endif
if (addr_p) if (addr_p)
fprintf (file, " address= 0x%.*lx", addr_len, fprintf (file, " address= 0x%.*lx", addr_len,
...@@ -1677,7 +1684,7 @@ struct { ...@@ -1677,7 +1684,7 @@ struct {
struct bb *blocks; struct bb *blocks;
} __bb; } __bb;
/* Vars to store addrs of source and destination basic blocks /* Vars to store addrs of source and destination basic blocks
of a jump. */ of a jump. */
static unsigned long bb_src = 0; static unsigned long bb_src = 0;
...@@ -1727,7 +1734,7 @@ gopen (char *fn, char *mode) ...@@ -1727,7 +1734,7 @@ gopen (char *fn, char *mode)
if (mode[1]) if (mode[1])
return (FILE *) 0; return (FILE *) 0;
if (mode[0] != 'r' && mode[0] != 'w') if (mode[0] != 'r' && mode[0] != 'w')
return (FILE *) 0; return (FILE *) 0;
p = fn + strlen (fn)-1; p = fn + strlen (fn)-1;
...@@ -1791,7 +1798,7 @@ __bb_exit_trace_func (void) ...@@ -1791,7 +1798,7 @@ __bb_exit_trace_func (void)
FILE *file = fopen ("bb.out", "a"); FILE *file = fopen ("bb.out", "a");
struct bb_func *f; struct bb_func *f;
struct bb *b; struct bb *b;
if (!file) if (!file)
perror ("bb.out"); perror ("bb.out");
...@@ -1832,7 +1839,7 @@ __bb_exit_trace_func (void) ...@@ -1832,7 +1839,7 @@ __bb_exit_trace_func (void)
goto found; goto found;
} }
} }
if (!printed_something) if (!printed_something)
{ {
fprintf (file, "Functions in `bb.in' not executed during basic block profiling on %s\n", ctime ((void *) &time_value)); fprintf (file, "Functions in `bb.in' not executed during basic block profiling on %s\n", ctime ((void *) &time_value));
...@@ -1843,7 +1850,7 @@ __bb_exit_trace_func (void) ...@@ -1843,7 +1850,7 @@ __bb_exit_trace_func (void)
if (p->filename) if (p->filename)
fprintf (file, " of file %s", p->filename); fprintf (file, " of file %s", p->filename);
fprintf (file, "\n" ); fprintf (file, "\n" );
found: ; found: ;
} }
...@@ -1863,7 +1870,7 @@ found: ; ...@@ -1863,7 +1870,7 @@ found: ;
} }
return; return;
} }
else if (file) else if (file)
{ {
long time_value; long time_value;
...@@ -1872,13 +1879,13 @@ found: ; ...@@ -1872,13 +1879,13 @@ found: ;
unsigned long cnt_max = 0; unsigned long cnt_max = 0;
int cnt_len; int cnt_len;
int addr_len; int addr_len;
/* This is somewhat type incorrect, but it avoids worrying about /* This is somewhat type incorrect, but it avoids worrying about
exactly where time.h is included from. It should be ok unless exactly where time.h is included from. It should be ok unless
a void * differs from other pointer formats, or if sizeof (long) a void * differs from other pointer formats, or if sizeof (long)
is < sizeof (time_t). It would be nice if we could assume the is < sizeof (time_t). It would be nice if we could assume the
use of rationale standards here. */ use of rationale standards here. */
time ((void *) &time_value); time ((void *) &time_value);
fprintf (file, "Basic block jump tracing"); fprintf (file, "Basic block jump tracing");
...@@ -1902,36 +1909,36 @@ found: ; ...@@ -1902,36 +1909,36 @@ found: ;
} }
fprintf (file, " finished on %s\n", ctime ((void *) &time_value)); fprintf (file, " finished on %s\n", ctime ((void *) &time_value));
for (i = 0; i < BB_BUCKETS; i++) for (i = 0; i < BB_BUCKETS; i++)
{ {
struct bb_edge *bucket = bb_hashbuckets[i]; struct bb_edge *bucket = bb_hashbuckets[i];
for ( ; bucket; bucket = bucket->next ) for ( ; bucket; bucket = bucket->next )
{ {
if (addr_max < bucket->src_addr) if (addr_max < bucket->src_addr)
addr_max = bucket->src_addr; addr_max = bucket->src_addr;
if (addr_max < bucket->dst_addr) if (addr_max < bucket->dst_addr)
addr_max = bucket->dst_addr; addr_max = bucket->dst_addr;
if (cnt_max < bucket->count) if (cnt_max < bucket->count)
cnt_max = bucket->count; cnt_max = bucket->count;
} }
} }
addr_len = num_digits (addr_max, 16); addr_len = num_digits (addr_max, 16);
cnt_len = num_digits (cnt_max, 10); cnt_len = num_digits (cnt_max, 10);
for ( i = 0; i < BB_BUCKETS; i++) for ( i = 0; i < BB_BUCKETS; i++)
{ {
struct bb_edge *bucket = bb_hashbuckets[i]; struct bb_edge *bucket = bb_hashbuckets[i];
for ( ; bucket; bucket = bucket->next ) for ( ; bucket; bucket = bucket->next )
{ {
fprintf (file, fprintf (file,
"Jump from block 0x%.*lx to block 0x%.*lx executed %*lu time(s)\n", "Jump from block 0x%.*lx to block 0x%.*lx executed %*lu time(s)\n",
addr_len, bucket->src_addr, addr_len, bucket->src_addr,
addr_len, bucket->dst_addr, addr_len, bucket->dst_addr,
cnt_len, bucket->count); cnt_len, bucket->count);
} }
} }
fprintf (file, "\n"); fprintf (file, "\n");
} }
...@@ -2003,14 +2010,14 @@ __bb_init_prg (void) ...@@ -2003,14 +2010,14 @@ __bb_init_prg (void)
buf[i--] = '\0'; buf[i--] = '\0';
p = buf; p = buf;
if (*p == '-') if (*p == '-')
{ {
m = TRACE_OFF; m = TRACE_OFF;
p++; p++;
} }
else else
{ {
m = TRACE_ON; m = TRACE_ON;
} }
if (!strcmp (p, "__bb_trace__")) if (!strcmp (p, "__bb_trace__"))
bb_mode |= 1; bb_mode |= 1;
...@@ -2020,7 +2027,7 @@ __bb_init_prg (void) ...@@ -2020,7 +2027,7 @@ __bb_init_prg (void)
bb_mode |= 4; bb_mode |= 4;
else if (!strcmp (p, "__bb_showret__")) else if (!strcmp (p, "__bb_showret__"))
bb_mode |= 8; bb_mode |= 8;
else else
{ {
struct bb_func *f = (struct bb_func *) malloc (sizeof (struct bb_func)); struct bb_func *f = (struct bb_func *) malloc (sizeof (struct bb_func));
if (f) if (f)
...@@ -2055,7 +2062,7 @@ __bb_init_prg (void) ...@@ -2055,7 +2062,7 @@ __bb_init_prg (void)
} }
fclose (file); fclose (file);
#ifdef HAVE_POPEN #ifdef HAVE_POPEN
if (bb_mode & 1) if (bb_mode & 1)
bb_tracefile = gopen ("bbtrace.gz", "w"); bb_tracefile = gopen ("bbtrace.gz", "w");
...@@ -2069,7 +2076,7 @@ __bb_init_prg (void) ...@@ -2069,7 +2076,7 @@ __bb_init_prg (void)
if (bb_mode & 2) if (bb_mode & 2)
{ {
bb_hashbuckets = (struct bb_edge **) bb_hashbuckets = (struct bb_edge **)
malloc (BB_BUCKETS * sizeof (struct bb_edge *)); malloc (BB_BUCKETS * sizeof (struct bb_edge *));
if (bb_hashbuckets) if (bb_hashbuckets)
/* Use a loop here rather than calling bzero to avoid having to /* Use a loop here rather than calling bzero to avoid having to
...@@ -2116,7 +2123,7 @@ __bb_trace_func (void) ...@@ -2116,7 +2123,7 @@ __bb_trace_func (void)
= & bb_hashbuckets[ (((int) bb_src*8) ^ (int) bb_dst) % BB_BUCKETS ]; = & bb_hashbuckets[ (((int) bb_src*8) ^ (int) bb_dst) % BB_BUCKETS ];
bucket = *startbucket; bucket = *startbucket;
for (bucket = *startbucket; bucket; for (bucket = *startbucket; bucket;
oldnext = &(bucket->next), bucket = *oldnext) oldnext = &(bucket->next), bucket = *oldnext)
{ {
if (bucket->src_addr == bb_src if (bucket->src_addr == bb_src
...@@ -2179,7 +2186,7 @@ __bb_trace_func_ret (void) ...@@ -2179,7 +2186,7 @@ __bb_trace_func_ret (void)
= & bb_hashbuckets[ (((int) bb_dst * 8) ^ (int) bb_src) % BB_BUCKETS ]; = & bb_hashbuckets[ (((int) bb_dst * 8) ^ (int) bb_src) % BB_BUCKETS ];
bucket = *startbucket; bucket = *startbucket;
for (bucket = *startbucket; bucket; for (bucket = *startbucket; bucket;
oldnext = &(bucket->next), bucket = *oldnext) oldnext = &(bucket->next), bucket = *oldnext)
{ {
if (bucket->src_addr == bb_dst if (bucket->src_addr == bb_dst
...@@ -2293,9 +2300,9 @@ __bb_init_trace_func (struct bb *blocks, unsigned long blockno) ...@@ -2293,9 +2300,9 @@ __bb_init_trace_func (struct bb *blocks, unsigned long blockno)
MACHINE_STATE_SAVE("3") MACHINE_STATE_SAVE("3")
if (!blocks->zero_word) if (!blocks->zero_word)
{ {
if (!trace_init) if (!trace_init)
{ {
trace_init = 1; trace_init = 1;
__bb_init_prg (); __bb_init_prg ();
} }
...@@ -2362,7 +2369,7 @@ void ...@@ -2362,7 +2369,7 @@ void
__clear_cache (char *beg __attribute__((__unused__)), __clear_cache (char *beg __attribute__((__unused__)),
char *end __attribute__((__unused__))) char *end __attribute__((__unused__)))
{ {
#ifdef CLEAR_INSN_CACHE #ifdef CLEAR_INSN_CACHE
CLEAR_INSN_CACHE (beg, end); CLEAR_INSN_CACHE (beg, end);
#else #else
#ifdef INSN_CACHE_SIZE #ifdef INSN_CACHE_SIZE
...@@ -2426,7 +2433,7 @@ __clear_cache (char *beg __attribute__((__unused__)), ...@@ -2426,7 +2433,7 @@ __clear_cache (char *beg __attribute__((__unused__)),
/* Compute the cache alignment of the place to stop clearing. */ /* Compute the cache alignment of the place to stop clearing. */
#if 0 /* This is not needed for gcc's purposes. */ #if 0 /* This is not needed for gcc's purposes. */
/* If the block to clear is bigger than a cache plane, /* If the block to clear is bigger than a cache plane,
we clear the entire cache, and OFFSET is already correct. */ we clear the entire cache, and OFFSET is already correct. */
if (end < beg + INSN_CACHE_PLANE_SIZE) if (end < beg + INSN_CACHE_PLANE_SIZE)
#endif #endif
offset = (((int) (end + INSN_CACHE_LINE_WIDTH - 1) offset = (((int) (end + INSN_CACHE_LINE_WIDTH - 1)
...@@ -2514,8 +2521,8 @@ mprotect (char *addr, int len, int prot) ...@@ -2514,8 +2521,8 @@ mprotect (char *addr, int len, int prot)
#endif /* WINNT && ! __CYGWIN__ && ! _UWIN */ #endif /* WINNT && ! __CYGWIN__ && ! _UWIN */
#ifdef TRANSFER_FROM_TRAMPOLINE #ifdef TRANSFER_FROM_TRAMPOLINE
TRANSFER_FROM_TRAMPOLINE TRANSFER_FROM_TRAMPOLINE
#endif #endif
#if defined (NeXT) && defined (__MACH__) #if defined (NeXT) && defined (__MACH__)
...@@ -2550,7 +2557,7 @@ __enable_execute_stack (char *addr) ...@@ -2550,7 +2557,7 @@ __enable_execute_stack (char *addr)
#else #else
__clear_cache ((int) addr, (int) eaddr); __clear_cache ((int) addr, (int) eaddr);
#endif #endif
} }
#endif /* defined (NeXT) && defined (__MACH__) */ #endif /* defined (NeXT) && defined (__MACH__) */
...@@ -2596,7 +2603,7 @@ __enable_execute_stack (void) ...@@ -2596,7 +2603,7 @@ __enable_execute_stack (void)
int save_errno; int save_errno;
static unsigned long lowest = USRSTACK; static unsigned long lowest = USRSTACK;
unsigned long current = (unsigned long) &save_errno & -NBPC; unsigned long current = (unsigned long) &save_errno & -NBPC;
/* Ignore errno being set. memctl sets errno to EINVAL whenever the /* Ignore errno being set. memctl sets errno to EINVAL whenever the
address is seen as 'negative'. That is the case with the stack. */ address is seen as 'negative'. That is the case with the stack. */
...@@ -2650,7 +2657,7 @@ __clear_insn_cache (void) ...@@ -2650,7 +2657,7 @@ __clear_insn_cache (void)
errno changing without explicitly calling any system-call. */ errno changing without explicitly calling any system-call. */
save_errno = errno; save_errno = errno;
/* Keep it simple : memctl (MCT_TEXT) always fully clears the insn cache. /* Keep it simple : memctl (MCT_TEXT) always fully clears the insn cache.
No need to use an address derived from _start or %sp, as 0 works also. */ No need to use an address derived from _start or %sp, as 0 works also. */
memctl(0, 4096, MCT_TEXT); memctl(0, 4096, MCT_TEXT);
errno = save_errno; errno = save_errno;
...@@ -2878,7 +2885,7 @@ atexit (func_ptr func) ...@@ -2878,7 +2885,7 @@ atexit (func_ptr func)
extern void _cleanup (void); extern void _cleanup (void);
extern void _exit (int) __attribute__ ((__noreturn__)); extern void _exit (int) __attribute__ ((__noreturn__));
void void
exit (int status) exit (int status)
{ {
if (atexit_chain) if (atexit_chain)
......
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment