This is the mail archive of the
gcc-patches@gcc.gnu.org
mailing list for the GCC project.
[tuples] Annotate gimple allocators for better stats
- From: Jan Hubicka <jh at suse dot cz>
- To: gcc-patches at gcc dot gnu dot org
- Date: Tue, 17 Jun 2008 19:38:30 +0200
- Subject: [tuples] Annotate gimple allocators for better stats
Hi,
this patch annotate basic gimple tuples allocators with MEM_STAT_INFO so we see
from where the gimple is being allocated in the stats of --enable-gather-detailed-mem-stats
THere is nothing exciting going on here and I've annotated only the allocators
that shows top in the report. Same strategy is used on other places (like RTL
and tree allocators).
Honza
Bootstrapped/regtested i686-linx, OK?
Honza
* gimple.c (gimple_alloc): Annotate with MEM_STAT_INFO
(gimple_build_with_ops): Likewise.
(gimple_build_assign): Likewise.
(gimple_build_assign_with_ops): Likewise.
* gimple.h (gimple_build_assign, gimple_build_assign_with_ops):
* Annotate with MEM_STAT_INFO.
Index: gimple.c
===================================================================
*** gimple.c (revision 136865)
--- gimple.c (working copy)
*************** gimple_size (enum gimple_code code)
*** 204,211 ****
/* Allocate memory for a GIMPLE statement with code CODE and NUM_OPS
operands. */
static gimple
! gimple_alloc (enum gimple_code code, unsigned num_ops)
{
size_t size;
gimple stmt;
--- 204,212 ----
/* Allocate memory for a GIMPLE statement with code CODE and NUM_OPS
operands. */
+ #define gimple_alloc(c, n) gimple_alloc_stat (c, n MEM_STAT_INFO)
static gimple
! gimple_alloc_stat (enum gimple_code code, unsigned num_ops MEM_STAT_DECL)
{
size_t size;
gimple stmt;
*************** gimple_alloc (enum gimple_code code, uns
*** 222,228 ****
}
#endif
! stmt = ggc_alloc_cleared (size);
gimple_set_code (stmt, code);
gimple_set_num_ops (stmt, num_ops);
--- 223,229 ----
}
#endif
! stmt = ggc_alloc_cleared_stat (size PASS_MEM_STAT);
gimple_set_code (stmt, code);
gimple_set_num_ops (stmt, num_ops);
*************** gimple_alloc (enum gimple_code code, uns
*** 238,248 ****
must be one of the GIMPLE_WITH_OPS tuples). SUBCODE is the sub-code
for the new tuple. NUM_OPS is the number of operands to allocate. */
static gimple
! gimple_build_with_ops (enum gimple_code code, enum tree_code subcode,
! unsigned num_ops)
{
! gimple s = gimple_alloc (code, num_ops);
gimple_set_subcode (s, subcode);
return s;
--- 239,251 ----
must be one of the GIMPLE_WITH_OPS tuples). SUBCODE is the sub-code
for the new tuple. NUM_OPS is the number of operands to allocate. */
+ #define gimple_build_with_ops(c, s, n) \
+ gimple_build_with_ops_stat (c, s, n MEM_STAT_INFO)
static gimple
! gimple_build_with_ops_stat (enum gimple_code code, enum tree_code subcode,
! unsigned num_ops MEM_STAT_DECL)
{
! gimple s = gimple_alloc_stat (code, num_ops PASS_MEM_STAT);
gimple_set_subcode (s, subcode);
return s;
*************** extract_ops_from_tree (tree expr, enum t
*** 387,399 ****
RHS of the assignment which can be unary or binary. */
gimple
! gimple_build_assign (tree lhs, tree rhs)
{
enum tree_code subcode;
tree op1, op2;
extract_ops_from_tree (rhs, &subcode, &op1, &op2);
! return gimple_build_assign_with_ops (subcode, lhs, op1, op2);
}
--- 390,403 ----
RHS of the assignment which can be unary or binary. */
gimple
! gimple_build_assign_stat (tree lhs, tree rhs MEM_STAT_DECL)
{
enum tree_code subcode;
tree op1, op2;
extract_ops_from_tree (rhs, &subcode, &op1, &op2);
! return gimple_build_assign_with_ops_stat (subcode, lhs, op1, op2
! PASS_MEM_STAT);
}
*************** gimple_build_assign (tree lhs, tree rhs)
*** 402,409 ****
GIMPLE_UNARY_RHS or GIMPLE_SINGLE_RHS. */
gimple
! gimple_build_assign_with_ops (enum tree_code subcode, tree lhs, tree op1,
! tree op2)
{
unsigned num_ops;
gimple p;
--- 406,413 ----
GIMPLE_UNARY_RHS or GIMPLE_SINGLE_RHS. */
gimple
! gimple_build_assign_with_ops_stat (enum tree_code subcode, tree lhs, tree op1,
! tree op2 MEM_STAT_DECL)
{
unsigned num_ops;
gimple p;
*************** gimple_build_assign_with_ops (enum tree_
*** 412,418 ****
code). */
num_ops = get_gimple_rhs_num_ops (subcode) + 1;
! p = gimple_build_with_ops (GIMPLE_ASSIGN, subcode, num_ops);
gimple_assign_set_lhs (p, lhs);
gimple_assign_set_rhs1 (p, op1);
if (op2)
--- 416,423 ----
code). */
num_ops = get_gimple_rhs_num_ops (subcode) + 1;
! p = gimple_build_with_ops_stat (GIMPLE_ASSIGN, subcode, num_ops
! PASS_MEM_STAT);
gimple_assign_set_lhs (p, lhs);
gimple_assign_set_rhs1 (p, op1);
if (op2)
Index: gimple.h
===================================================================
*** gimple.h (revision 136865)
--- gimple.h (working copy)
*************** union gimple_statement_d GTY ((desc ("gi
*** 749,757 ****
/* In gimple.c. */
gimple gimple_build_return (tree);
! gimple gimple_build_assign (tree, tree);
void extract_ops_from_tree (tree, enum tree_code *, tree *, tree *);
! gimple gimple_build_assign_with_ops (enum tree_code, tree, tree, tree);
gimple gimple_build_call_vec (tree, VEC(tree, heap) *);
gimple gimple_build_call (tree, unsigned, ...);
gimple gimple_build_call_from_tree (tree);
--- 749,760 ----
/* In gimple.c. */
gimple gimple_build_return (tree);
! gimple gimple_build_assign_stat (tree, tree MEM_STAT_DECL);
! #define gimple_build_assign(l,r) gimple_build_assign_stat (l, r MEM_STAT_INFO)
void extract_ops_from_tree (tree, enum tree_code *, tree *, tree *);
! gimple gimple_build_assign_with_ops_stat (enum tree_code, tree, tree, tree MEM_STAT_DECL);
! #define gimple_build_assign_with_ops(c,o1,o2,o3) \
! gimple_build_assign_with_ops_stat (c, o1, o2, o3 MEM_STAT_INFO)
gimple gimple_build_call_vec (tree, VEC(tree, heap) *);
gimple gimple_build_call (tree, unsigned, ...);
gimple gimple_build_call_from_tree (tree);