===================================================================
@@ -326,6 +326,8 @@ copy_rtx (rtx orig)
return copy;
}
+unsigned long mem_attrs_shared_copy;
+
/* Create a new copy of an rtx. Only copy just one level. */
rtx
@@ -333,6 +335,8 @@ shallow_copy_rtx_stat (const_rtx orig ME
{
const unsigned int size = rtx_size (orig);
rtx const copy = ggc_alloc_rtx_def_stat (size PASS_MEM_STAT);
+ if (MEM_P (orig) && MEM_ATTRS (orig))
+ mem_attrs_shared_copy++;
return (rtx) memcpy (copy, orig, size);
}
===================================================================
@@ -290,6 +290,12 @@ mem_attrs_htab_eq (const void *x, const
return mem_attrs_eq_p ((const mem_attrs *) x, (const mem_attrs *) y);
}
+unsigned long mem_attrs_dropped;
+unsigned long mem_attrs_new;
+unsigned long mem_attrs_new_modified;
+unsigned long mem_attrs_shared;
+unsigned long mem_attrs_shared_modified;
+
/* Set MEM's memory attributes so that they are the same as ATTRS. */
static void
@@ -300,6 +306,8 @@ set_mem_attrs (rtx mem, mem_attrs *attrs
/* If everything is the default, we can just clear the attributes. */
if (mem_attrs_eq_p (attrs, mode_mem_attrs[(int) GET_MODE (mem)]))
{
+ if (MEM_ATTRS (mem))
+ mem_attrs_dropped++;
MEM_ATTRS (mem) = 0;
return;
}
@@ -309,6 +317,20 @@ set_mem_attrs (rtx mem, mem_attrs *attrs
{
*slot = ggc_alloc_mem_attrs ();
memcpy (*slot, attrs, sizeof (mem_attrs));
+ if (MEM_ATTRS (mem))
+ mem_attrs_new_modified++;
+ else
+ mem_attrs_new++;
+ }
+ else
+ {
+ if (MEM_ATTRS (mem))
+ {
+ if (MEM_ATTRS (mem) != *slot)
+ mem_attrs_shared_modified++;
+ }
+ else
+ mem_attrs_shared++;
}
MEM_ATTRS (mem) = (mem_attrs *) *slot;
===================================================================
@@ -1989,6 +2023,26 @@ toplev_main (int argc, char **argv)
if (!exit_after_options)
do_compile ();
+ {
+ extern unsigned long mem_attrs_dropped;
+ extern unsigned long mem_attrs_new;
+ extern unsigned long mem_attrs_new_modified;
+ extern unsigned long mem_attrs_shared;
+ extern unsigned long mem_attrs_shared_modified;
+ extern unsigned long mem_attrs_shared_copy;
+ fprintf (stderr, "%lu mem_attrs created (%lu for new, %lu for "
+ "modification)\n",
+ mem_attrs_new + mem_attrs_new_modified,
+ mem_attrs_new, mem_attrs_new_modified);
+ fprintf (stderr, "%lu mem_attrs shared (%lu for new, %lu for "
+ "modification, %lu by rtx copying)\n",
+ mem_attrs_shared + mem_attrs_shared_modified
+ + mem_attrs_shared_copy,
+ mem_attrs_shared, mem_attrs_shared_modified,
+ mem_attrs_shared_copy);
+ fprintf (stderr, "%lu mem_attrs dropped\n", mem_attrs_dropped);
+ }
+
if (warningcount || errorcount || werrorcount)
print_ignored_options ();