aboutsummaryrefslogtreecommitdiff
path: root/gcc
diff options
context:
space:
mode:
authorJan Hubicka <jh@suse.cz>2001-06-22 19:23:14 +0200
committerJan Hubicka <hubicka@gcc.gnu.org>2001-06-22 17:23:14 +0000
commit25c3a4ef2eec4088a0516e4021830d2629930dbc (patch)
treedd8484defdb75a57e43380239e2d1f1b2bcafed1 /gcc
parentb2aec5c0ebe5c21cf62cc40f578ebc800ea02e7a (diff)
downloadgcc-25c3a4ef2eec4088a0516e4021830d2629930dbc.zip
gcc-25c3a4ef2eec4088a0516e4021830d2629930dbc.tar.gz
gcc-25c3a4ef2eec4088a0516e4021830d2629930dbc.tar.bz2
predict.c (estimate_bb_frequencies): Do not handle conditional jumps jumping to fallthru basic block as conditional...
* predict.c (estimate_bb_frequencies): Do not handle conditional jumps jumping to fallthru basic block as conditional jumps. * tm.texi (GCOV_TYPE_SIZE): Document. * basic-block.h (gcov_type): Define. (struct edge_def): Use gcov_type for count field. (struct basic_block_def): Likewise. * defaults.h (GCOV_TYPE_SIZE): Define. * final.c (end_final): Use GCOV_TYPE_SIZE. * flow.c (dump_edge_info, dump_flow_info, dump_bb): Print count fields using HOST_WIDEST_INT_PRINT_DEC. * gcov-io.h (__fetch_gcov_type, __store_gcov_type, __read_gcov_type, __write_gcov_type): New. (store_long): Remove. * gcov.c (gcov_type): Set default. (struct adj_list): Use gcov_type for arc_count. (bb_info): Use gcov_type for succ_count, pred_count and exec_count. (create_program_flow_graph): Read arc_count properly. (solve_program_flow_graph): 'total' is gcov_type. (output_data): Line_counts is gcov_type, print it properly. * libgcc2.c (struct bb): Counts is gcov_type. (__bb_exit_func): Use __read_gcov_type and __write_gcov_type. * profile.c (LONG_TYPE_SIZE, LONG_LONG_TYPE_SIZE): Set default. (GCOV_TYPE_SIZE): Define. (struct bb_info): succ_count and pred_count is gcov_type. (compute_branch_probabilities): Use __read_gcov_type, print read edges to the dump file. (total): Is gcov_type. (gen_edge_profiler): Use GCOV_TYPE_SIZE. From-SVN: r43506
Diffstat (limited to 'gcc')
-rw-r--r--gcc/ChangeLog5
-rw-r--r--gcc/gcov-io.h64
-rw-r--r--gcc/predict.c18
3 files changed, 79 insertions, 8 deletions
diff --git a/gcc/ChangeLog b/gcc/ChangeLog
index a9ef4ef..d6c7f33 100644
--- a/gcc/ChangeLog
+++ b/gcc/ChangeLog
@@ -1,3 +1,8 @@
+Fri Jun 22 19:20:59 CEST 2001 Jan Hubicka <jh@suse.cz>
+
+ * predict.c (estimate_bb_frequencies): Do not handle conditional
+ jumps jumping to fallthru basic block as conditional jumps.
+
Fri Jun 22 19:11:28 CEST 2001 Jan Hubicka <jh@suse.cz>
* regs.h (struct reg_info_def): Add freq field.
diff --git a/gcc/gcov-io.h b/gcc/gcov-io.h
index 48f83aa..8e36022 100644
--- a/gcc/gcov-io.h
+++ b/gcc/gcov-io.h
@@ -25,9 +25,12 @@ Boston, MA 02111-1307, USA. */
#include <sys/types.h>
static int __fetch_long PARAMS ((long *, char *, size_t)) ATTRIBUTE_UNUSED;
-static int __store_long PARAMS ((long, char *, size_t)) ATTRIBUTE_UNUSED;
static int __read_long PARAMS ((long *, FILE *, size_t)) ATTRIBUTE_UNUSED;
static int __write_long PARAMS ((long, FILE *, size_t)) ATTRIBUTE_UNUSED;
+static int __fetch_gcov_type PARAMS ((gcov_type *, char *, size_t)) ATTRIBUTE_UNUSED;
+static int __store_gcov_type PARAMS ((gcov_type, char *, size_t)) ATTRIBUTE_UNUSED;
+static int __read_gcov_type PARAMS ((gcov_type *, FILE *, size_t)) ATTRIBUTE_UNUSED;
+static int __write_gcov_type PARAMS ((gcov_type, FILE *, size_t)) ATTRIBUTE_UNUSED;
/* These routines only work for signed values. */
@@ -36,8 +39,8 @@ static int __write_long PARAMS ((long, FILE *, size_t)) ATTRIBUTE_UNUSED;
to store. */
static int
-__store_long (value, dest, bytes)
- long value;
+__store_gcov_type (value, dest, bytes)
+ gcov_type value;
char *dest;
size_t bytes;
{
@@ -46,7 +49,7 @@ __store_long (value, dest, bytes)
if (value < 0)
{
- long oldvalue = value;
+ gcov_type oldvalue = value;
value = -value;
if (oldvalue != -value)
return 1;
@@ -71,6 +74,29 @@ __store_long (value, dest, bytes)
will not fit in DEST. */
static int
+__fetch_gcov_type (dest, source, bytes)
+ gcov_type *dest;
+ char *source;
+ size_t bytes;
+{
+ gcov_type value = 0;
+ int i;
+
+ for (i = bytes - 1; (size_t) i > (sizeof (*dest) - 1); i--)
+ if (source[i] & ((size_t) i == (bytes - 1) ? 127 : 255 ))
+ return 1;
+
+ for (; i >= 0; i--)
+ value = value * 256 + (source[i] & ((size_t)i == (bytes - 1) ? 127 : 255));
+
+ if ((source[bytes - 1] & 128) && (value > 0))
+ value = - value;
+
+ *dest = value;
+ return 0;
+}
+
+static int
__fetch_long (dest, source, bytes)
long *dest;
char *source;
@@ -103,6 +129,20 @@ __fetch_long (dest, source, bytes)
BYTES may be a maximum of 10. */
static int
+__write_gcov_type (value, file, bytes)
+ gcov_type value;
+ FILE *file;
+ size_t bytes;
+{
+ char c[10];
+
+ if (bytes > 10 || __store_gcov_type (value, c, bytes))
+ return 1;
+ else
+ return fwrite(c, 1, bytes, file) != bytes;
+}
+
+static int
__write_long (value, file, bytes)
long value;
FILE *file;
@@ -110,7 +150,7 @@ __write_long (value, file, bytes)
{
char c[10];
- if (bytes > 10 || __store_long (value, c, bytes))
+ if (bytes > 10 || __store_gcov_type ((gcov_type)value, c, bytes))
return 1;
else
return fwrite(c, 1, bytes, file) != bytes;
@@ -126,6 +166,20 @@ __write_long (value, file, bytes)
BYTES may be a maximum of 10. */
static int
+__read_gcov_type (dest, file, bytes)
+ gcov_type *dest;
+ FILE *file;
+ size_t bytes;
+{
+ char c[10];
+
+ if (bytes > 10 || fread(c, 1, bytes, file) != bytes)
+ return 1;
+ else
+ return __fetch_gcov_type (dest, c, bytes);
+}
+
+static int
__read_long (dest, file, bytes)
long *dest;
FILE *file;
diff --git a/gcc/predict.c b/gcc/predict.c
index 058adb5..e511282 100644
--- a/gcc/predict.c
+++ b/gcc/predict.c
@@ -187,8 +187,18 @@ dump_prediction (predictor, probability, bb)
probability * 100.0 / REG_BR_PROB_BASE);
if (bb->count)
- fprintf (rtl_dump_file, " exec %i hit %i (%.1f%%)",
- bb->count, e->count, e->count * 100.0 / bb->count);
+ {
+ fprintf (rtl_dump_file, " exec ",
+ bb->count, e->count, e->count * 100.0 / bb->count);
+ fprintf (rtl_dump_file, HOST_WIDEST_INT_PRINT_DEC,
+ (HOST_WIDEST_INT) bb->count);
+ fprintf (rtl_dump_file, " hit ",
+ e->count, e->count * 100.0 / bb->count);
+ fprintf (rtl_dump_file, HOST_WIDEST_INT_PRINT_DEC,
+ (HOST_WIDEST_INT) e->count);
+ fprintf (rtl_dump_file, " (%.1f%%)",
+ e->count, e->count * 100.0 / bb->count);
+ }
fprintf (rtl_dump_file, "\n");
}
@@ -701,7 +711,9 @@ estimate_bb_frequencies (loops)
int probability;
edge fallthru, branch;
- if (GET_CODE (last_insn) != JUMP_INSN || !any_condjump_p (last_insn))
+ if (GET_CODE (last_insn) != JUMP_INSN || !any_condjump_p (last_insn)
+ /* Avoid handling of conditionals jump jumping to fallthru edge. */
+ || BASIC_BLOCK (i)->succ->succ_next == NULL)
{
/* We can predict only conditional jumps at the moment.
Expect each edge to be equall probable.