public inbox for gcc-cvs@sourceware.org
help / color / mirror / Atom feed
* [gcc r12-5237] More ipa-modref-tree.h cleanups
@ 2021-11-13 22:19 Jan Hubicka
0 siblings, 0 replies; only message in thread
From: Jan Hubicka @ 2021-11-13 22:19 UTC (permalink / raw)
To: gcc-cvs
https://gcc.gnu.org/g:e30bf330443da67fe56bea021b9d70c0f76deedb
commit r12-5237-ge30bf330443da67fe56bea021b9d70c0f76deedb
Author: Jan Hubicka <jh@suse.cz>
Date: Sat Nov 13 23:18:38 2021 +0100
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.
Diff:
---
gcc/ipa-modref-tree.c | 42 ++++++++++++++++++++++++++++++++++++++++++
gcc/ipa-modref-tree.h | 22 +++++++++++-----------
gcc/ipa-modref.c | 48 ++++++++++--------------------------------------
3 files changed, 63 insertions(+), 49 deletions(-)
diff --git a/gcc/ipa-modref-tree.c b/gcc/ipa-modref-tree.c
index 4b7d510ad37..70ec71c3808 100644
--- a/gcc/ipa-modref-tree.c
+++ b/gcc/ipa-modref-tree.c
@@ -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 {
diff --git a/gcc/ipa-modref-tree.h b/gcc/ipa-modref-tree.h
index b35cf3a4aed..1fafd59debe 100644
--- a/gcc/ipa-modref-tree.h
+++ b/gcc/ipa-modref-tree.h
@@ -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,
diff --git a/gcc/ipa-modref.c b/gcc/ipa-modref.c
index 3b94dc0c91d..b75ed84135b 100644
--- a/gcc/ipa-modref.c
+++ b/gcc/ipa-modref.c
@@ -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);
^ permalink raw reply [flat|nested] only message in thread
only message in thread, other threads:[~2021-11-13 22:19 UTC | newest]
Thread overview: (only message) (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2021-11-13 22:19 [gcc r12-5237] More ipa-modref-tree.h cleanups Jan Hubicka
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for read-only IMAP folder(s) and NNTP newsgroup(s).