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.
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 {
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). */
{
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,
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
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);
+ }
}
}
}
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);
+ }
}
}
}
{
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);
}
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);