summaryrefslogtreecommitdiffstats
path: root/gcc/rtl.c
diff options
context:
space:
mode:
authorwilson <wilson@138bc75d-0d04-0410-961f-82ee72b054a4>2003-12-22 07:42:43 +0000
committerwilson <wilson@138bc75d-0d04-0410-961f-82ee72b054a4>2003-12-22 07:42:43 +0000
commit86736f9e33c4b7981d8a621728091a44afc91d36 (patch)
tree92e1b9a44d211c848fd96269a939fdf393e245ab /gcc/rtl.c
parent3167276382f4709bd9cc3007e410770ff6ba7161 (diff)
downloadppe42-gcc-86736f9e33c4b7981d8a621728091a44afc91d36.tar.gz
ppe42-gcc-86736f9e33c4b7981d8a621728091a44afc91d36.zip
Patch from Dan Nicolaescu
* rtl.h (dump_rtx_statistics): Declare it. * rtl.c (rtx_alloc_counts, rtx_alloc_sizes, rtvec_alloc_counts, rtx_alloc_sizes): New static vars. (rtx_alloc, rtvec_alloc): Update them. (dump_rtx_statistics): New function. * toplev.c (finalize): Call it. * ggc-page.c (struct globals): Fix comments. Add new member total_allocated_per_order. (ggc_alloc): Keep track of the total allocated memory. (ggc_print_statistics): Clarify message. Print total allocated memory stats. * configure.in (gather-detailed-mem-stats): New flag. * configure: Regenerate. * config.in: Regenerate. * doc/install.texi (Configuration): Document --enable-gather-detailed-mem-stats. git-svn-id: svn+ssh://gcc.gnu.org/svn/gcc/trunk@74930 138bc75d-0d04-0410-961f-82ee72b054a4
Diffstat (limited to 'gcc/rtl.c')
-rw-r--r--gcc/rtl.c50
1 files changed, 50 insertions, 0 deletions
diff --git a/gcc/rtl.c b/gcc/rtl.c
index 26891c30d7a..313e2cb2b5c 100644
--- a/gcc/rtl.c
+++ b/gcc/rtl.c
@@ -138,6 +138,14 @@ const char * const reg_note_name[] =
"REG_VTABLE_REF"
};
+
+#ifdef GATHER_STATISTICS
+static int rtx_alloc_counts[(int) LAST_AND_UNUSED_RTX_CODE];
+static int rtx_alloc_sizes[(int) LAST_AND_UNUSED_RTX_CODE];
+static int rtvec_alloc_counts;
+static int rtvec_alloc_sizes;
+#endif
+
/* Allocate an rtx vector of N elements.
Store the length, and initialize all elements to zero. */
@@ -152,6 +160,12 @@ rtvec_alloc (int n)
memset (&rt->elem[0], 0, n * sizeof (rtx));
PUT_NUM_ELEM (rt, n);
+
+#ifdef GATHER_STATISTICS
+ rtvec_alloc_counts++;
+ rtvec_alloc_sizes += n * sizeof (rtx);
+#endif
+
return rt;
}
@@ -171,6 +185,12 @@ rtx_alloc (RTX_CODE code)
memset (rt, 0, RTX_HDR_SIZE);
PUT_CODE (rt, code);
+
+#ifdef GATHER_STATISTICS
+ rtx_alloc_counts[code]++;
+ rtx_alloc_sizes[code] += RTX_SIZE (code);
+#endif
+
return rt;
}
@@ -417,6 +437,36 @@ rtx_equal_p (rtx x, rtx y)
}
return 1;
}
+
+void dump_rtx_statistics (void)
+{
+#ifdef GATHER_STATISTICS
+ int i;
+ int total_counts = 0;
+ int total_sizes = 0;
+ fprintf (stderr, "\nRTX Kind Count Bytes\n");
+ fprintf (stderr, "---------------------------------------\n");
+ for (i = 0; i < LAST_AND_UNUSED_RTX_CODE; i++)
+ if (rtx_alloc_counts[i])
+ {
+ fprintf (stderr, "%-20s %7d %10d\n", GET_RTX_NAME (i),
+ rtx_alloc_counts[i], rtx_alloc_sizes[i]);
+ total_counts += rtx_alloc_counts[i];
+ total_sizes += rtx_alloc_sizes[i];
+ }
+ if (rtvec_alloc_counts)
+ {
+ fprintf (stderr, "%-20s %7d %10d\n", "rtvec",
+ rtvec_alloc_counts, rtvec_alloc_sizes);
+ total_counts += rtvec_alloc_counts;
+ total_sizes += rtvec_alloc_sizes;
+ }
+ fprintf (stderr, "---------------------------------------\n");
+ fprintf (stderr, "%-20s %7d %10d\n",
+ "Total", total_counts, total_sizes);
+ fprintf (stderr, "---------------------------------------\n");
+#endif
+}
#if defined ENABLE_RTL_CHECKING && (GCC_VERSION >= 2007)
void
OpenPOWER on IntegriCloud