More ipa-modref-tree.h cleanups
Move access dumping to member function and cleanup formating. gcc/ChangeLog: 2021-11-13 Jan Hubicka <hubicka@ucw.cz> * ipa-modref-tree.c (modref_access_node::range_info_useful_p): Offline from ipa-modref-tree.h. (modref_access_node::dump): Move from ipa-modref.c; make member function. * ipa-modref-tree.h (modref_access_node::range_info_useful_p. modref_access_node::dump): Declare. * ipa-modref.c (dump_access): Remove. (dump_records): Update. (dump_lto_records): Update. (record_access): Update. (record_access_lto): Update.
This commit is contained in:
parent
5aa91072e2
commit
e30bf33044
3 changed files with 63 additions and 49 deletions
|
@ -561,6 +561,48 @@ modref_access_node::insert (vec <modref_access_node, va_gc> *&accesses,
|
|||
return 1;
|
||||
}
|
||||
|
||||
/* Return true if range info is useful. */
|
||||
bool
|
||||
modref_access_node::range_info_useful_p () const
|
||||
{
|
||||
return parm_index != MODREF_UNKNOWN_PARM && parm_offset_known
|
||||
&& (known_size_p (size)
|
||||
|| known_size_p (max_size)
|
||||
|| known_ge (offset, 0));
|
||||
}
|
||||
|
||||
/* Dump range to debug OUT. */
|
||||
void
|
||||
modref_access_node::dump (FILE *out)
|
||||
{
|
||||
if (parm_index != MODREF_UNKNOWN_PARM)
|
||||
{
|
||||
if (parm_index >= 0)
|
||||
fprintf (out, " Parm %i", parm_index);
|
||||
else if (parm_index == MODREF_STATIC_CHAIN_PARM)
|
||||
fprintf (out, " Static chain");
|
||||
else
|
||||
gcc_unreachable ();
|
||||
if (parm_offset_known)
|
||||
{
|
||||
fprintf (out, " param offset:");
|
||||
print_dec ((poly_int64_pod)parm_offset, out, SIGNED);
|
||||
}
|
||||
}
|
||||
if (range_info_useful_p ())
|
||||
{
|
||||
fprintf (out, " offset:");
|
||||
print_dec ((poly_int64_pod)offset, out, SIGNED);
|
||||
fprintf (out, " size:");
|
||||
print_dec ((poly_int64_pod)size, out, SIGNED);
|
||||
fprintf (out, " max_size:");
|
||||
print_dec ((poly_int64_pod)max_size, out, SIGNED);
|
||||
if (adjustments)
|
||||
fprintf (out, " adjusted %i times", adjustments);
|
||||
}
|
||||
fprintf (out, "\n");
|
||||
}
|
||||
|
||||
#if CHECKING_P
|
||||
|
||||
namespace selftest {
|
||||
|
|
|
@ -54,7 +54,11 @@ enum modref_special_parms {
|
|||
MODREF_LOCAL_MEMORY_PARM = -4
|
||||
};
|
||||
|
||||
/* Memory access. */
|
||||
/* Modref record accesses relative to function parameters.
|
||||
This is entry for single access specifying its base and access range.
|
||||
|
||||
Accesses can be collected to boundedly sized arrays using
|
||||
modref_access_node::insert. */
|
||||
struct GTY(()) modref_access_node
|
||||
{
|
||||
/* Access range information (in bits). */
|
||||
|
@ -78,18 +82,14 @@ struct GTY(()) modref_access_node
|
|||
{
|
||||
return parm_index != MODREF_UNKNOWN_PARM;
|
||||
}
|
||||
/* Return true if range info is useful. */
|
||||
bool range_info_useful_p () const
|
||||
{
|
||||
return parm_index != MODREF_UNKNOWN_PARM && parm_offset_known
|
||||
&& (known_size_p (size)
|
||||
|| known_size_p (max_size)
|
||||
|| known_ge (offset, 0));
|
||||
}
|
||||
/* Dump range to debug OUT. */
|
||||
void dump (FILE *out);
|
||||
/* Return true if both accesses are the same. */
|
||||
bool operator == (modref_access_node &a) const;
|
||||
/* Insert A into ACCESSES. Limit size of vector to MAX_ACCESSES and if
|
||||
RECORD_ADJUSTMENT is true keep track of adjustment counts.
|
||||
/* Return true if range info is useful. */
|
||||
bool range_info_useful_p () const;
|
||||
/* Insert A into vector ACCESSES. Limit size of vector to MAX_ACCESSES and
|
||||
if RECORD_ADJUSTMENT is true keep track of adjustment counts.
|
||||
Return 0 if nothing changed, 1 is insertion suceeded and -1 if
|
||||
failed. */
|
||||
static int insert (vec <modref_access_node, va_gc> *&accesses,
|
||||
|
|
|
@ -405,40 +405,6 @@ modref_summary_lto::useful_p (int ecf_flags, bool check_flags)
|
|||
return stores && !stores->every_base;
|
||||
}
|
||||
|
||||
/* Dump A to OUT. */
|
||||
|
||||
static void
|
||||
dump_access (modref_access_node *a, FILE *out)
|
||||
{
|
||||
fprintf (out, " access:");
|
||||
if (a->parm_index != MODREF_UNKNOWN_PARM)
|
||||
{
|
||||
if (a->parm_index >= 0)
|
||||
fprintf (out, " Parm %i", a->parm_index);
|
||||
else if (a->parm_index == MODREF_STATIC_CHAIN_PARM)
|
||||
fprintf (out, " Static chain");
|
||||
else
|
||||
gcc_unreachable ();
|
||||
if (a->parm_offset_known)
|
||||
{
|
||||
fprintf (out, " param offset:");
|
||||
print_dec ((poly_int64_pod)a->parm_offset, out, SIGNED);
|
||||
}
|
||||
}
|
||||
if (a->range_info_useful_p ())
|
||||
{
|
||||
fprintf (out, " offset:");
|
||||
print_dec ((poly_int64_pod)a->offset, out, SIGNED);
|
||||
fprintf (out, " size:");
|
||||
print_dec ((poly_int64_pod)a->size, out, SIGNED);
|
||||
fprintf (out, " max_size:");
|
||||
print_dec ((poly_int64_pod)a->max_size, out, SIGNED);
|
||||
if (a->adjustments)
|
||||
fprintf (out, " adjusted %i times", a->adjustments);
|
||||
}
|
||||
fprintf (out, "\n");
|
||||
}
|
||||
|
||||
/* Dump records TT to OUT. */
|
||||
|
||||
static void
|
||||
|
@ -474,7 +440,10 @@ dump_records (modref_records *tt, FILE *out)
|
|||
size_t k;
|
||||
modref_access_node *a;
|
||||
FOR_EACH_VEC_SAFE_ELT (r->accesses, k, a)
|
||||
dump_access (a, out);
|
||||
{
|
||||
fprintf (out, " access:");
|
||||
a->dump (out);
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
|
@ -520,7 +489,10 @@ dump_lto_records (modref_records_lto *tt, FILE *out)
|
|||
size_t k;
|
||||
modref_access_node *a;
|
||||
FOR_EACH_VEC_SAFE_ELT (r->accesses, k, a)
|
||||
dump_access (a, out);
|
||||
{
|
||||
fprintf (out, " access:");
|
||||
a->dump (out);
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
|
@ -801,7 +773,7 @@ record_access (modref_records *tt, ao_ref *ref)
|
|||
{
|
||||
fprintf (dump_file, " - Recording base_set=%i ref_set=%i ",
|
||||
base_set, ref_set);
|
||||
dump_access (&a, dump_file);
|
||||
a.dump (dump_file);
|
||||
}
|
||||
tt->insert (base_set, ref_set, a, false);
|
||||
}
|
||||
|
@ -866,7 +838,7 @@ record_access_lto (modref_records_lto *tt, ao_ref *ref)
|
|||
print_generic_expr (dump_file, ref_type);
|
||||
fprintf (dump_file, " (alias set %i) ",
|
||||
ref_type ? get_alias_set (ref_type) : 0);
|
||||
dump_access (&a, dump_file);
|
||||
a.dump (dump_file);
|
||||
}
|
||||
|
||||
tt->insert (base_type, ref_type, a, false);
|
||||
|
|
Loading…
Add table
Reference in a new issue