ipa-cp: Make dumping of bit masks representing -1 nicer
Dumps of the lattices representing bit-values and of propagation results of bit-values can print a really long hexadecimal value when the bit-value represents -1 (all bits set). This patch simply detect that situation and prints the string "-1" in that case, making the dumps somewhat nicer. gcc/ChangeLog: 2025-01-03 Martin Jambor <mjambor@suse.cz> * ipa-cp.cc (ipcp_print_widest_int): New function. (ipcp_store_vr_results): Use it. (ipcp_bits_lattice::print): Likewise. Fix formatting.
This commit is contained in:
parent
668cad04b1
commit
72b273152f
1 changed files with 17 additions and 3 deletions
|
@ -307,6 +307,18 @@ ipcp_lattice<valtype>::print (FILE * f, bool dump_sources, bool dump_benefits)
|
|||
fprintf (f, "\n");
|
||||
}
|
||||
|
||||
/* If VALUE has all bits set to one, print "-1" to F, otherwise simply print it
|
||||
hexadecimally to F. */
|
||||
|
||||
static void
|
||||
ipcp_print_widest_int (FILE *f, const widest_int &value)
|
||||
{
|
||||
if (wi::eq_p (wi::bit_not (value), 0))
|
||||
fprintf (f, "-1");
|
||||
else
|
||||
print_hex (value, f);
|
||||
}
|
||||
|
||||
void
|
||||
ipcp_bits_lattice::print (FILE *f)
|
||||
{
|
||||
|
@ -316,8 +328,10 @@ ipcp_bits_lattice::print (FILE *f)
|
|||
fprintf (f, " Bits unusable (BOTTOM)\n");
|
||||
else
|
||||
{
|
||||
fprintf (f, " Bits: value = "); print_hex (get_value (), f);
|
||||
fprintf (f, ", mask = "); print_hex (get_mask (), f);
|
||||
fprintf (f, " Bits: value = ");
|
||||
ipcp_print_widest_int (f, get_value ());
|
||||
fprintf (f, ", mask = ");
|
||||
print_hex (get_mask (), f);
|
||||
fprintf (f, "\n");
|
||||
}
|
||||
}
|
||||
|
@ -6375,7 +6389,7 @@ ipcp_store_vr_results (void)
|
|||
dumped_sth = true;
|
||||
}
|
||||
fprintf (dump_file, " param %i: value = ", i);
|
||||
print_hex (bits->get_value (), dump_file);
|
||||
ipcp_print_widest_int (dump_file, bits->get_value ());
|
||||
fprintf (dump_file, ", mask = ");
|
||||
print_hex (bits->get_mask (), dump_file);
|
||||
fprintf (dump_file, "\n");
|
||||
|
|
Loading…
Add table
Reference in a new issue