From d0f5813e27f892d1b4a3a6406003440eb1fa4dfe Mon Sep 17 00:00:00 2001 From: =?utf8?q?G=C3=B6tz=20Lindenmaier?= Date: Fri, 3 Sep 2004 08:08:03 +0000 Subject: [PATCH 1/1] access routines for memops, fixed header for firmjni dump analyses info [r3820] --- ir/ir/irdump.h | 6 ++++-- ir/ir/irdumptxt.c | 37 ++++++++++++++++++++++++++++++++++++- ir/ir/irnode.c | 25 +++++++++++++++++++++++++ ir/ir/irnode.h | 11 +++++++++++ 4 files changed, 76 insertions(+), 3 deletions(-) diff --git a/ir/ir/irdump.h b/ir/ir/irdump.h index 21dc4dcf3..08aaac4f2 100644 --- a/ir/ir/irdump.h +++ b/ir/ir/irdump.h @@ -263,7 +263,7 @@ void dump_callgraph_loop_tree(const char *suffix); /** Verbosity for text dumpers */ typedef enum { - dump_verbosity_onlynames = 0x00000001, /**< only dump type names. turns off all other + dump_verbosity_onlynames = 0x00000001, /**< only dump names. turns off all other flags up to 0x00010000. */ dump_verbosity_fields = 0x00000002, /**< dump types and fields (like a type declaration) */ dump_verbosity_methods = 0x00000004, /**< dump types and methods (like a type declaration) */ @@ -271,6 +271,8 @@ typedef enum { dump_verbosity_entattrs = 0x00000010, /**< dump all entity attributes */ dump_verbosity_entconsts = 0x00000020, /**< dump entity constants */ + dump_verbosity_accessStats = 0x00000100, /**< dump entity access statistics */ + dump_verbosity_noClassTypes = 0x00001000, /**< dump no class types */ dump_verbosity_noStructTypes = 0x00002000, /**< dump no struct types */ dump_verbosity_noUnionTypes = 0x00004000, /**< dump no union types */ @@ -289,7 +291,7 @@ typedef enum { dump_verbosity_onlyPrimitiveTypes = 0x000BF000, /**< dump only primitive types */ dump_verbosity_onlyEnumerationTypes=0x0008F000, /**< dump only enumeration types */ - dump_verbosity_max = 0x48888887, /**< turn on all verbosity. */ + dump_verbosity_max = 0x48888887 /**< turn on all verbosity. */ } dump_verbosity; diff --git a/ir/ir/irdumptxt.c b/ir/ir/irdumptxt.c index 39be89f62..ce931a8be 100644 --- a/ir/ir/irdumptxt.c +++ b/ir/ir/irdumptxt.c @@ -22,6 +22,8 @@ #include "irprog_t.h" #include "entity_t.h" +#include "field_temperature.h" + int dump_node_opcode(FILE *F, ir_node *n); /* from irdump.c */ @@ -89,10 +91,19 @@ void dump_entity_to_file_prefix (FILE *F, entity *ent, char *prefix, unsigned X(variability_constant); } fprintf(F, "\n"); - } else { /* no entityattrs */ + } else { /* no entattrs */ fprintf(F, "%s(%3d) %*s: %s", prefix, get_entity_offset_bits(ent), -40, get_type_name(get_entity_type(ent)), get_entity_name(ent)); if (is_method_type(get_entity_type(ent))) fprintf(F, "(...)"); + + if (verbosity & dump_verbosity_accessStats) { + if (get_entity_allocation(ent) == allocation_static) { + fprintf(F, " (stat)"); + } else { + if (get_entity_peculiarity(ent) == peculiarity_description) fprintf(F, " (desc)"); + if (get_entity_peculiarity(ent) == peculiarity_inherited) fprintf(F, " (inh)"); + } + } fprintf(F, "\n"); } @@ -148,6 +159,27 @@ void dump_entity_to_file_prefix (FILE *F, entity *ent, char *prefix, unsigned } fprintf(F, "\n"); } + + if (verbosity & dump_verbosity_accessStats) { + int n_acc = get_entity_n_accesses(ent); + fprintf(F, "%s Access Stats", prefix); + char comma = ':'; + for (i = 0; i < n_acc; ++i) { + ir_node *acc = get_entity_access(ent, i); + if (get_irn_op(acc) == op_Load) { + fprintf(F, "%c L", comma); + } else if (get_irn_op(acc) == op_Store) { + fprintf(F, "%c S", comma); + } else { + assert(0); + } + fprintf(F, " %d", get_weighted_loop_depth(acc)); + comma = ','; + } + fprintf(F, "\n"); + } + + } #undef X @@ -287,6 +319,9 @@ void dump_types_as_text(unsigned verbosity, const char *suffix) { for (i = 0; i < n_types; ++i) { type *t = get_irp_type(i); + + if (is_jack_rts_class(t)) continue; + dump_type_to_file(F, t, verbosity); } diff --git a/ir/ir/irnode.c b/ir/ir/irnode.c index 535e356a9..08bd78e7f 100644 --- a/ir/ir/irnode.c +++ b/ir/ir/irnode.c @@ -1498,6 +1498,31 @@ set_Phi_pred (ir_node *node, int pos, ir_node *pred) { set_irn_n(node, pos, pred); } + +int is_memop(ir_node *node) { + return ((get_irn_op(node) == op_Load) || (get_irn_op(node) == op_Load)); +} + +ir_node *get_memop_mem (ir_node *node) { + assert(is_memop(node)); + return get_irn_n(node, 0); +} + +void set_memop_mem (ir_node *node, ir_node *mem) { + assert(is_memop(node)); + set_irn_n(node, 0, mem); +} + +ir_node *get_memop_ptr (ir_node *node) { + assert(is_memop(node)); + return get_irn_n(node, 1); +} + +void set_memop_ptr (ir_node *node, ir_node *ptr) { + assert(is_memop(node)); + set_irn_n(node, 1, ptr); +} + ir_node * get_Load_mem (ir_node *node) { assert (node->op == op_Load); diff --git a/ir/ir/irnode.h b/ir/ir/irnode.h index 252b225ce..10840a000 100644 --- a/ir/ir/irnode.h +++ b/ir/ir/irnode.h @@ -719,6 +719,17 @@ void set_Filter_cg_pred(ir_node * node, int pos, ir_node * pred); int get_Filter_n_cg_preds(ir_node *node); ir_node *get_Filter_cg_pred(ir_node *node, int pos); +/** Return true if parameter is a memory operation. + * + * A memory operation is an operation that directly changes the + * memory. I.e., a Load or a Store operation. + */ +int is_memop(ir_node *node); +ir_node *get_memop_mem (ir_node *node); +void set_memop_mem (ir_node *node, ir_node *mem); +ir_node *get_memop_ptr (ir_node *node); +void set_memop_ptr (ir_node *node, ir_node *ptr); + /** * Projection numbers for Load: use for Proj nodes! */ -- 2.20.1