Commit c4c2f9fa by Steven Bosscher

bitmap.c (struct bitmap_descriptor_d): Use unsigned HOST_WIDEST_INT for all counters.

	* bitmap.c (struct bitmap_descriptor_d): Use unsigned HOST_WIDEST_INT
	for all counters.
	(struct output_info): Likewise.
	(register_overhead): Remove bad gcc_assert.
	(bitmap_find_bit): If there is only a single bitmap element, do not
	count a miss as a search.
	(print_statistics): Update for counter type changes.
	(dump_bitmap_statistics): Likewise.  Print headers such that they
	are properly lined up with the printed counters.

From-SVN: r196525
parent d415f879
2013-03-07 Steven Bosscher <steven@gcc.gnu.org>
* bitmap.c (struct bitmap_descriptor_d): Use unsigned HOST_WIDEST_INT
for all counters.
(struct output_info): Likewise.
(register_overhead): Remove bad gcc_assert.
(bitmap_find_bit): If there is only a single bitmap element, do not
count a miss as a search.
(print_statistics): Update for counter type changes.
(dump_bitmap_statistics): Likewise. Print headers such that they
are properly lined up with the printed counters.
2013-03-07 Jakub Jelinek <jakub@redhat.com> 2013-03-07 Jakub Jelinek <jakub@redhat.com>
PR tree-optimization/56559 PR tree-optimization/56559
......
...@@ -34,11 +34,11 @@ struct bitmap_descriptor_d ...@@ -34,11 +34,11 @@ struct bitmap_descriptor_d
const char *file; const char *file;
int line; int line;
int created; int created;
HOST_WIDEST_INT allocated; unsigned HOST_WIDEST_INT allocated;
HOST_WIDEST_INT peak; unsigned HOST_WIDEST_INT peak;
HOST_WIDEST_INT current; unsigned HOST_WIDEST_INT current;
int nsearches; unsigned HOST_WIDEST_INT nsearches;
int search_iter; unsigned HOST_WIDEST_INT search_iter;
}; };
typedef struct bitmap_descriptor_d *bitmap_descriptor; typedef struct bitmap_descriptor_d *bitmap_descriptor;
...@@ -121,7 +121,6 @@ register_overhead (bitmap b, int amount) ...@@ -121,7 +121,6 @@ register_overhead (bitmap b, int amount)
desc->current += amount; desc->current += amount;
if (amount > 0) if (amount > 0)
desc->allocated += amount; desc->allocated += amount;
gcc_assert (desc->current >= 0);
if (desc->peak < desc->current) if (desc->peak < desc->current)
desc->peak = desc->current; desc->peak = desc->current;
} }
...@@ -565,10 +564,15 @@ bitmap_find_bit (bitmap head, unsigned int bit) ...@@ -565,10 +564,15 @@ bitmap_find_bit (bitmap head, unsigned int bit)
bitmap_element *element; bitmap_element *element;
unsigned int indx = bit / BITMAP_ELEMENT_ALL_BITS; unsigned int indx = bit / BITMAP_ELEMENT_ALL_BITS;
if (head->current == 0 if (head->current == NULL
|| head->indx == indx) || head->indx == indx)
return head->current; return head->current;
if (head->current == head->first
&& head->first->next == NULL)
return NULL;
/* This bitmap has more than one element, and we're going to look
through the elements list. Count that as a search. */
if (GATHER_STATISTICS) if (GATHER_STATISTICS)
bitmap_descriptors[head->descriptor_id]->nsearches++; bitmap_descriptors[head->descriptor_id]->nsearches++;
...@@ -2132,8 +2136,8 @@ bitmap_print (FILE *file, const_bitmap head, const char *prefix, const char *suf ...@@ -2132,8 +2136,8 @@ bitmap_print (FILE *file, const_bitmap head, const char *prefix, const char *suf
/* Used to accumulate statistics about bitmap sizes. */ /* Used to accumulate statistics about bitmap sizes. */
struct output_info struct output_info
{ {
HOST_WIDEST_INT size; unsigned HOST_WIDEST_INT size;
int count; unsigned HOST_WIDEST_INT count;
}; };
/* Called via htab_traverse. Output bitmap descriptor pointed out by SLOT /* Called via htab_traverse. Output bitmap descriptor pointed out by SLOT
...@@ -2153,10 +2157,14 @@ print_statistics (void **slot, void *b) ...@@ -2153,10 +2157,14 @@ print_statistics (void **slot, void *b)
s1 = s2 + 4; s1 = s2 + 4;
sprintf (s, "%s:%i (%s)", s1, d->line, d->function); sprintf (s, "%s:%i (%s)", s1, d->line, d->function);
s[41] = 0; s[41] = 0;
fprintf (stderr, "%-41s %8d %15"HOST_WIDEST_INT_PRINT"d %15" fprintf (stderr,
HOST_WIDEST_INT_PRINT"d %15"HOST_WIDEST_INT_PRINT"d %10d %10d\n", "%-41s %9u"
s, d->created, d->allocated, d->peak, d->current, d->nsearches, " %15"HOST_WIDEST_INT_PRINT"d %15"HOST_WIDEST_INT_PRINT"d"
d->search_iter); " %15"HOST_WIDEST_INT_PRINT"d"
" %10"HOST_WIDEST_INT_PRINT"d %10"HOST_WIDEST_INT_PRINT"d\n",
s, d->created,
d->allocated, d->peak, d->current,
d->nsearches, d->search_iter);
i->size += d->allocated; i->size += d->allocated;
i->count += d->created; i->count += d->created;
} }
...@@ -2175,15 +2183,18 @@ dump_bitmap_statistics (void) ...@@ -2175,15 +2183,18 @@ dump_bitmap_statistics (void)
if (!bitmap_desc_hash) if (!bitmap_desc_hash)
return; return;
fprintf (stderr, "\nBitmap Overall " fprintf (stderr,
" Allocated Peak Leak searched " "\n%-41s %9s %15s %15s %15s %10s %10s\n",
" search itr\n"); "Bitmap", "Overall",
"Allocated", "Peak", "Leak",
"searched", "search_itr");
fprintf (stderr, "---------------------------------------------------------------------------------\n"); fprintf (stderr, "---------------------------------------------------------------------------------\n");
info.count = 0; info.count = 0;
info.size = 0; info.size = 0;
htab_traverse (bitmap_desc_hash, print_statistics, &info); htab_traverse (bitmap_desc_hash, print_statistics, &info);
fprintf (stderr, "---------------------------------------------------------------------------------\n"); fprintf (stderr, "---------------------------------------------------------------------------------\n");
fprintf (stderr, "%-40s %9d %15"HOST_WIDEST_INT_PRINT"d\n", fprintf (stderr,
"%-41s %9"HOST_WIDEST_INT_PRINT"d %15"HOST_WIDEST_INT_PRINT"d\n",
"Total", info.count, info.size); "Total", info.count, info.size);
fprintf (stderr, "---------------------------------------------------------------------------------\n"); fprintf (stderr, "---------------------------------------------------------------------------------\n");
} }
......
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