mirror of git://gcc.gnu.org/git/gcc.git
Don't use %z printf length specifier
* system.h (PRsa): New macro. (SIZE_AMOUNT): Cast number to uint64_t. * alloc-pool.h (pool_usage::dump): Don't use %zu but PRsa. (pool_usage::dump_footer): Likewise and also use PRIu64. * bitmap.h (bitmap_usage::dump): Likewise. * ggc-common.c (ggc_usage::dump): Likewise. * ggc-page.c (ggc_print_statistics): Likewise. * input.c (dump_line_table_statistics): Likewise. * mem-stats.h (mem_usage::dump): Likewise. (mem_usage::dump_footer): Likewise. * rtl.c (dump_rtx_statistics): Likewise. * tree-cfg.c (dump_cfg_stats): Likewise. * tree-dfa.c (dump_dfa_stats): Likewise. * tree-phinodes.c (phinodes_print_statistics): Likewise. * tree-ssanames (ssanames_print_statistics): Likewise. * vec.c (vec_usage::dump): Likewise. (vec_usage::dump_footer): Likewise. From-SVN: r266208
This commit is contained in:
parent
12eac2321b
commit
a0b4808002
|
|
@ -1,3 +1,23 @@
|
|||
2018-11-16 Michael Matz <matz@suse.de>
|
||||
|
||||
* system.h (PRsa): New macro.
|
||||
(SIZE_AMOUNT): Cast number to uint64_t.
|
||||
* alloc-pool.h (pool_usage::dump): Don't use %zu but PRsa.
|
||||
(pool_usage::dump_footer): Likewise and also use PRIu64.
|
||||
* bitmap.h (bitmap_usage::dump): Likewise.
|
||||
* ggc-common.c (ggc_usage::dump): Likewise.
|
||||
* ggc-page.c (ggc_print_statistics): Likewise.
|
||||
* input.c (dump_line_table_statistics): Likewise.
|
||||
* mem-stats.h (mem_usage::dump): Likewise.
|
||||
(mem_usage::dump_footer): Likewise.
|
||||
* rtl.c (dump_rtx_statistics): Likewise.
|
||||
* tree-cfg.c (dump_cfg_stats): Likewise.
|
||||
* tree-dfa.c (dump_dfa_stats): Likewise.
|
||||
* tree-phinodes.c (phinodes_print_statistics): Likewise.
|
||||
* tree-ssanames (ssanames_print_statistics): Likewise.
|
||||
* vec.c (vec_usage::dump): Likewise.
|
||||
(vec_usage::dump_footer): Likewise.
|
||||
|
||||
2018-11-16 Richard Biener <rguenther@suse.de>
|
||||
|
||||
PR tree-optimization/88011
|
||||
|
|
|
|||
|
|
@ -63,8 +63,8 @@ struct pool_usage: public mem_usage
|
|||
{
|
||||
char *location_string = loc->to_string ();
|
||||
|
||||
fprintf (stderr, "%-32s%-48s %5zu%c%9zu%c:%5.1f%%%9zu"
|
||||
"%c%9zu%c:%5.1f%%%12zu\n",
|
||||
fprintf (stderr, "%-32s%-48s " PRsa(5) PRsa(9) ":%5.1f%%"
|
||||
PRsa(9) PRsa(9) ":%5.1f%%%12" PRIu64 "\n",
|
||||
m_pool_name, location_string,
|
||||
SIZE_AMOUNT (m_instances),
|
||||
SIZE_AMOUNT (m_allocated),
|
||||
|
|
@ -72,7 +72,7 @@ struct pool_usage: public mem_usage
|
|||
SIZE_AMOUNT (m_peak),
|
||||
SIZE_AMOUNT (m_times),
|
||||
get_percent (m_times, total.m_times),
|
||||
m_element_size);
|
||||
(uint64_t)m_element_size);
|
||||
|
||||
free (location_string);
|
||||
}
|
||||
|
|
@ -91,7 +91,7 @@ struct pool_usage: public mem_usage
|
|||
dump_footer ()
|
||||
{
|
||||
print_dash_line ();
|
||||
fprintf (stderr, "%s%82zu%c%10zu%c\n", "Total",
|
||||
fprintf (stderr, "%s" PRsa(82) PRsa(10) "\n", "Total",
|
||||
SIZE_AMOUNT (m_instances), SIZE_AMOUNT (m_allocated));
|
||||
print_dash_line ();
|
||||
}
|
||||
|
|
|
|||
|
|
@ -239,9 +239,9 @@ struct bitmap_usage: public mem_usage
|
|||
{
|
||||
char *location_string = loc->to_string ();
|
||||
|
||||
fprintf (stderr, "%-48s %9zu%c:%5.1f%%"
|
||||
"%9zu%c%9zu%c:%5.1f%%"
|
||||
"%11" PRIu64 "%c%11" PRIu64 "%c%10s\n",
|
||||
fprintf (stderr, "%-48s " PRsa (9) ":%5.1f%%"
|
||||
PRsa (9) PRsa (9) ":%5.1f%%"
|
||||
PRsa (11) PRsa (11) "%10s\n",
|
||||
location_string, SIZE_AMOUNT (m_allocated),
|
||||
get_percent (m_allocated, total.m_allocated),
|
||||
SIZE_AMOUNT (m_peak), SIZE_AMOUNT (m_times),
|
||||
|
|
|
|||
|
|
@ -884,8 +884,8 @@ struct ggc_usage: public mem_usage
|
|||
{
|
||||
size_t balance = get_balance ();
|
||||
fprintf (stderr,
|
||||
"%-48s %9zu%c:%5.1f%%%9zu%c:%5.1f%%"
|
||||
"%9zu%c:%5.1f%%%9zu%c:%5.1f%%%9zu%c\n",
|
||||
"%-48s " PRsa (9) ":%5.1f%%" PRsa (9) ":%5.1f%%"
|
||||
PRsa (9) ":%5.1f%%" PRsa (9) ":%5.1f%%" PRsa (9) "\n",
|
||||
prefix, SIZE_AMOUNT (m_collected),
|
||||
get_percent (m_collected, total.m_collected),
|
||||
SIZE_AMOUNT (m_freed), get_percent (m_freed, total.m_freed),
|
||||
|
|
|
|||
|
|
@ -2288,14 +2288,15 @@ ggc_print_statistics (void)
|
|||
overhead += (sizeof (page_entry) - sizeof (long)
|
||||
+ BITMAP_SIZE (OBJECTS_IN_PAGE (p) + 1));
|
||||
}
|
||||
fprintf (stderr, "%-8zu %10zu%c %10zu%c %10zu%c\n",
|
||||
OBJECT_SIZE (i),
|
||||
fprintf (stderr, "%-8" PRIu64 " " PRsa (10) " " PRsa (10) " "
|
||||
PRsa (10) "\n",
|
||||
(uint64_t)OBJECT_SIZE (i),
|
||||
SIZE_AMOUNT (allocated),
|
||||
SIZE_AMOUNT (in_use),
|
||||
SIZE_AMOUNT (overhead));
|
||||
total_overhead += overhead;
|
||||
}
|
||||
fprintf (stderr, "%-8s %10zu%c %10zu%c %10zu%c\n",
|
||||
fprintf (stderr, "%-8s " PRsa (10) " " PRsa (10) " " PRsa (10) "\n",
|
||||
"Total",
|
||||
SIZE_AMOUNT (G.bytes_mapped),
|
||||
SIZE_AMOUNT (G.allocated),
|
||||
|
|
@ -2306,42 +2307,42 @@ ggc_print_statistics (void)
|
|||
fprintf (stderr, "\nTotal allocations and overheads during "
|
||||
"the compilation process\n");
|
||||
|
||||
fprintf (stderr, "Total Overhead: %9"
|
||||
HOST_LONG_LONG_FORMAT "d%c\n",
|
||||
fprintf (stderr, "Total Overhead: "
|
||||
PRsa (9) "\n",
|
||||
SIZE_AMOUNT (G.stats.total_overhead));
|
||||
fprintf (stderr, "Total Allocated: %9"
|
||||
HOST_LONG_LONG_FORMAT "d%c\n",
|
||||
fprintf (stderr, "Total Allocated: "
|
||||
PRsa (9) "\n",
|
||||
SIZE_AMOUNT (G.stats.total_allocated));
|
||||
|
||||
fprintf (stderr, "Total Overhead under 32B: %9"
|
||||
HOST_LONG_LONG_FORMAT "d%c\n",
|
||||
fprintf (stderr, "Total Overhead under 32B: "
|
||||
PRsa (9) "\n",
|
||||
SIZE_AMOUNT (G.stats.total_overhead_under32));
|
||||
fprintf (stderr, "Total Allocated under 32B: %9"
|
||||
HOST_LONG_LONG_FORMAT "d%c\n",
|
||||
fprintf (stderr, "Total Allocated under 32B: "
|
||||
PRsa (9) "\n",
|
||||
SIZE_AMOUNT (G.stats.total_allocated_under32));
|
||||
fprintf (stderr, "Total Overhead under 64B: %9"
|
||||
HOST_LONG_LONG_FORMAT "d%c\n",
|
||||
fprintf (stderr, "Total Overhead under 64B: "
|
||||
PRsa (9) "\n",
|
||||
SIZE_AMOUNT (G.stats.total_overhead_under64));
|
||||
fprintf (stderr, "Total Allocated under 64B: %9"
|
||||
HOST_LONG_LONG_FORMAT "d%c\n",
|
||||
fprintf (stderr, "Total Allocated under 64B: "
|
||||
PRsa (9) "\n",
|
||||
SIZE_AMOUNT (G.stats.total_allocated_under64));
|
||||
fprintf (stderr, "Total Overhead under 128B: %9"
|
||||
HOST_LONG_LONG_FORMAT "d%c\n",
|
||||
fprintf (stderr, "Total Overhead under 128B: "
|
||||
PRsa (9) "\n",
|
||||
SIZE_AMOUNT (G.stats.total_overhead_under128));
|
||||
fprintf (stderr, "Total Allocated under 128B: %9"
|
||||
HOST_LONG_LONG_FORMAT "d%c\n",
|
||||
fprintf (stderr, "Total Allocated under 128B: "
|
||||
PRsa (9) "\n",
|
||||
SIZE_AMOUNT (G.stats.total_allocated_under128));
|
||||
|
||||
for (i = 0; i < NUM_ORDERS; i++)
|
||||
if (G.stats.total_allocated_per_order[i])
|
||||
{
|
||||
fprintf (stderr, "Total Overhead page size %9zu: %9"
|
||||
HOST_LONG_LONG_FORMAT "d%c\n",
|
||||
OBJECT_SIZE (i),
|
||||
fprintf (stderr, "Total Overhead page size %9" PRIu64 ": "
|
||||
PRsa (9) "\n",
|
||||
(uint64_t)OBJECT_SIZE (i),
|
||||
SIZE_AMOUNT (G.stats.total_overhead_per_order[i]));
|
||||
fprintf (stderr, "Total Allocated page size %9zu: %9"
|
||||
HOST_LONG_LONG_FORMAT "d%c\n",
|
||||
OBJECT_SIZE (i),
|
||||
fprintf (stderr, "Total Allocated page size %9" PRIu64 ": "
|
||||
PRsa (9) "\n",
|
||||
(uint64_t)OBJECT_SIZE (i),
|
||||
SIZE_AMOUNT (G.stats.total_allocated_per_order[i]));
|
||||
}
|
||||
}
|
||||
|
|
|
|||
30
gcc/input.c
30
gcc/input.c
|
|
@ -940,35 +940,35 @@ dump_line_table_statistics (void)
|
|||
fprintf (stderr,
|
||||
"\nLine Table allocations during the "
|
||||
"compilation process\n");
|
||||
fprintf (stderr, "Number of ordinary maps used: %5ld%c\n",
|
||||
fprintf (stderr, "Number of ordinary maps used: " PRsa (5) "\n",
|
||||
SIZE_AMOUNT (s.num_ordinary_maps_used));
|
||||
fprintf (stderr, "Ordinary map used size: %5ld%c\n",
|
||||
fprintf (stderr, "Ordinary map used size: " PRsa (5) "\n",
|
||||
SIZE_AMOUNT (s.ordinary_maps_used_size));
|
||||
fprintf (stderr, "Number of ordinary maps allocated: %5ld%c\n",
|
||||
fprintf (stderr, "Number of ordinary maps allocated: " PRsa (5) "\n",
|
||||
SIZE_AMOUNT (s.num_ordinary_maps_allocated));
|
||||
fprintf (stderr, "Ordinary maps allocated size: %5ld%c\n",
|
||||
fprintf (stderr, "Ordinary maps allocated size: " PRsa (5) "\n",
|
||||
SIZE_AMOUNT (s.ordinary_maps_allocated_size));
|
||||
fprintf (stderr, "Number of macro maps used: %5ld%c\n",
|
||||
fprintf (stderr, "Number of macro maps used: " PRsa (5) "\n",
|
||||
SIZE_AMOUNT (s.num_macro_maps_used));
|
||||
fprintf (stderr, "Macro maps used size: %5ld%c\n",
|
||||
fprintf (stderr, "Macro maps used size: " PRsa (5) "\n",
|
||||
SIZE_AMOUNT (s.macro_maps_used_size));
|
||||
fprintf (stderr, "Macro maps locations size: %5ld%c\n",
|
||||
fprintf (stderr, "Macro maps locations size: " PRsa (5) "\n",
|
||||
SIZE_AMOUNT (s.macro_maps_locations_size));
|
||||
fprintf (stderr, "Macro maps size: %5ld%c\n",
|
||||
fprintf (stderr, "Macro maps size: " PRsa (5) "\n",
|
||||
SIZE_AMOUNT (macro_maps_size));
|
||||
fprintf (stderr, "Duplicated maps locations size: %5ld%c\n",
|
||||
fprintf (stderr, "Duplicated maps locations size: " PRsa (5) "\n",
|
||||
SIZE_AMOUNT (s.duplicated_macro_maps_locations_size));
|
||||
fprintf (stderr, "Total allocated maps size: %5ld%c\n",
|
||||
fprintf (stderr, "Total allocated maps size: " PRsa (5) "\n",
|
||||
SIZE_AMOUNT (total_allocated_map_size));
|
||||
fprintf (stderr, "Total used maps size: %5ld%c\n",
|
||||
fprintf (stderr, "Total used maps size: " PRsa (5) "\n",
|
||||
SIZE_AMOUNT (total_used_map_size));
|
||||
fprintf (stderr, "Ad-hoc table size: %5ld%c\n",
|
||||
fprintf (stderr, "Ad-hoc table size: " PRsa (5) "\n",
|
||||
SIZE_AMOUNT (s.adhoc_table_size));
|
||||
fprintf (stderr, "Ad-hoc table entries used: %5ld%c\n",
|
||||
fprintf (stderr, "Ad-hoc table entries used: " PRsa (5) "\n",
|
||||
SIZE_AMOUNT (s.adhoc_table_entries_used));
|
||||
fprintf (stderr, "optimized_ranges: %5xu%c\n",
|
||||
fprintf (stderr, "optimized_ranges: " PRsa (5) "\n",
|
||||
SIZE_AMOUNT (line_table->num_optimized_ranges));
|
||||
fprintf (stderr, "unoptimized_ranges: %5xu%c\n",
|
||||
fprintf (stderr, "unoptimized_ranges: " PRsa (5) "\n",
|
||||
SIZE_AMOUNT (line_table->num_unoptimized_ranges));
|
||||
|
||||
fprintf (stderr, "\n");
|
||||
|
|
|
|||
|
|
@ -205,8 +205,8 @@ struct mem_usage
|
|||
{
|
||||
char *location_string = loc->to_string ();
|
||||
|
||||
fprintf (stderr, "%-48s %9zu%c:%5.1f%%"
|
||||
"%9zu%c%9zu%c:%5.1f%%%10s\n",
|
||||
fprintf (stderr, "%-48s " PRsa (9) ":%5.1f%%"
|
||||
PRsa (9) PRsa (9) ":%5.1f%%%10s\n",
|
||||
location_string, SIZE_AMOUNT (m_allocated),
|
||||
get_percent (m_allocated, total.m_allocated),
|
||||
SIZE_AMOUNT (m_peak), SIZE_AMOUNT (m_times),
|
||||
|
|
@ -220,7 +220,7 @@ struct mem_usage
|
|||
dump_footer () const
|
||||
{
|
||||
print_dash_line ();
|
||||
fprintf (stderr, "%s%53zu%c%26zu%c\n", "Total",
|
||||
fprintf (stderr, "%s" PRsa (53) PRsa (26) "\n", "Total",
|
||||
SIZE_AMOUNT (m_allocated), SIZE_AMOUNT (m_times));
|
||||
print_dash_line ();
|
||||
}
|
||||
|
|
|
|||
|
|
@ -821,7 +821,7 @@ dump_rtx_statistics (void)
|
|||
unsigned j = indices[i];
|
||||
if (rtx_alloc_counts[j])
|
||||
{
|
||||
fprintf (stderr, "%-24s %6zu%c %9zu%c\n",
|
||||
fprintf (stderr, "%-24s " PRsa (6) " " PRsa (9) "\n",
|
||||
GET_RTX_NAME (j),
|
||||
SIZE_AMOUNT (rtx_alloc_counts[j]),
|
||||
SIZE_AMOUNT (rtx_alloc_sizes[j]));
|
||||
|
|
@ -832,14 +832,14 @@ dump_rtx_statistics (void)
|
|||
|
||||
if (rtvec_alloc_counts)
|
||||
{
|
||||
fprintf (stderr, "%-24s %6zu%c %9zu%c\n", "rtvec",
|
||||
fprintf (stderr, "%-24s " PRsa (6) " " PRsa (9) "\n", "rtvec",
|
||||
SIZE_AMOUNT (rtvec_alloc_counts),
|
||||
SIZE_AMOUNT (rtvec_alloc_sizes));
|
||||
total_counts += rtvec_alloc_counts;
|
||||
total_sizes += rtvec_alloc_sizes;
|
||||
}
|
||||
fprintf (stderr, "-----------------------------------------------\n");
|
||||
fprintf (stderr, "%-24s %6d%c %9d%c\n",
|
||||
fprintf (stderr, "%-24s " PRsa (6) " " PRsa (9) "\n",
|
||||
"Total", SIZE_AMOUNT (total_counts),
|
||||
SIZE_AMOUNT (total_sizes));
|
||||
fprintf (stderr, "-----------------------------------------------\n");
|
||||
|
|
|
|||
|
|
@ -1231,6 +1231,10 @@ void gcc_stablesort (void *, size_t, size_t,
|
|||
/* Display an integer amount as multiple of 1K or 1M (in base 2).
|
||||
Display the correct unit (either k, M, or ' ') after the amount, as
|
||||
well. */
|
||||
#define SIZE_AMOUNT(size) SIZE_SCALE (size), SIZE_LABEL (size)
|
||||
#define SIZE_AMOUNT(size) (uint64_t)SIZE_SCALE (size), SIZE_LABEL (size)
|
||||
|
||||
/* Format string particle for printing a SIZE_AMOUNT with N being the width
|
||||
of the number. */
|
||||
#define PRsa(n) "%" #n PRIu64 "%c"
|
||||
|
||||
#endif /* ! GCC_SYSTEM_H */
|
||||
|
|
|
|||
|
|
@ -2569,9 +2569,9 @@ dump_cfg_stats (FILE *file)
|
|||
long num_edges;
|
||||
basic_block bb;
|
||||
const char * const fmt_str = "%-30s%-13s%12s\n";
|
||||
const char * const fmt_str_1 = "%-30s%13d%11lu%c\n";
|
||||
const char * const fmt_str_2 = "%-30s%13ld%11lu%c\n";
|
||||
const char * const fmt_str_3 = "%-43s%11lu%c\n";
|
||||
const char * const fmt_str_1 = "%-30s%13d" PRsa (11) "\n";
|
||||
const char * const fmt_str_2 = "%-30s%13ld" PRsa (11) "\n";
|
||||
const char * const fmt_str_3 = "%-43s" PRsa (11) "\n";
|
||||
const char *funcname = current_function_name ();
|
||||
|
||||
fprintf (file, "\nCFG Statistics for %s\n\n", funcname);
|
||||
|
|
|
|||
|
|
@ -184,8 +184,8 @@ dump_dfa_stats (FILE *file)
|
|||
|
||||
unsigned long size, total = 0;
|
||||
const char * const fmt_str = "%-30s%-13s%12s\n";
|
||||
const char * const fmt_str_1 = "%-30s%13lu%11lu%c\n";
|
||||
const char * const fmt_str_3 = "%-43s%11lu%c\n";
|
||||
const char * const fmt_str_1 = "%-30s%13lu" PRsa (11) "\n";
|
||||
const char * const fmt_str_3 = "%-43s" PRsa (11) "\n";
|
||||
const char *funcname
|
||||
= lang_hooks.decl_printable_name (current_function_decl, 2);
|
||||
|
||||
|
|
|
|||
|
|
@ -80,9 +80,10 @@ unsigned int phi_nodes_created;
|
|||
void
|
||||
phinodes_print_statistics (void)
|
||||
{
|
||||
fprintf (stderr, "PHI nodes allocated: %u%c\n",
|
||||
fprintf (stderr, "PHI nodes allocated: " PRsa (11) "\n",
|
||||
SIZE_AMOUNT (phi_nodes_created));
|
||||
fprintf (stderr, "PHI nodes reused: %u%c\n", SIZE_AMOUNT (phi_nodes_reused));
|
||||
fprintf (stderr, "PHI nodes reused: " PRsa (11) "\n",
|
||||
SIZE_AMOUNT (phi_nodes_reused));
|
||||
}
|
||||
|
||||
/* Allocate a PHI node with at least LEN arguments. If the free list
|
||||
|
|
|
|||
|
|
@ -112,9 +112,9 @@ fini_ssanames (struct function *fn)
|
|||
void
|
||||
ssanames_print_statistics (void)
|
||||
{
|
||||
fprintf (stderr, "SSA_NAME nodes allocated: %u%c\n",
|
||||
fprintf (stderr, "SSA_NAME nodes allocated: " PRsa (11) "\n",
|
||||
SIZE_AMOUNT (ssa_name_nodes_created));
|
||||
fprintf (stderr, "SSA_NAME nodes reused: %u%c\n",
|
||||
fprintf (stderr, "SSA_NAME nodes reused: " PRsa (11) "\n",
|
||||
SIZE_AMOUNT (ssa_name_nodes_reused));
|
||||
}
|
||||
|
||||
|
|
|
|||
10
gcc/vec.c
10
gcc/vec.c
|
|
@ -83,13 +83,13 @@ struct vec_usage: public mem_usage
|
|||
s[48] = '\0';
|
||||
|
||||
fprintf (stderr,
|
||||
"%-48s %10zu%10zu%c:%4.1f%%%9zu%c%10zu"
|
||||
":%4.1f%%%10zu%c%10zu%c\n",
|
||||
"%-48s %10" PRIu64 PRsa (10) ":%4.1f%%" PRsa (9) "%10" PRIu64
|
||||
":%4.1f%%" PRsa (10) PRsa (10) "\n",
|
||||
s,
|
||||
m_element_size,
|
||||
(uint64_t)m_element_size,
|
||||
SIZE_AMOUNT (m_allocated),
|
||||
m_allocated * 100.0 / total.m_allocated,
|
||||
SIZE_AMOUNT (m_peak), m_times,
|
||||
SIZE_AMOUNT (m_peak), (uint64_t)m_times,
|
||||
m_times * 100.0 / total.m_times,
|
||||
SIZE_AMOUNT (m_items), SIZE_AMOUNT (m_items_peak));
|
||||
}
|
||||
|
|
@ -99,7 +99,7 @@ struct vec_usage: public mem_usage
|
|||
dump_footer ()
|
||||
{
|
||||
print_dash_line ();
|
||||
fprintf (stderr, "%s%64zu%c%25zu%c%16zu%c\n",
|
||||
fprintf (stderr, "%s" PRsa (64) PRsa (25) PRsa (16) "\n",
|
||||
"Total", SIZE_AMOUNT (m_allocated),
|
||||
SIZE_AMOUNT (m_times), SIZE_AMOUNT (m_items));
|
||||
print_dash_line ();
|
||||
|
|
|
|||
Loading…
Reference in New Issue