From b2a1ef4cf0aa43a2c785c1a2e12ecd513c4a6ab9 Mon Sep 17 00:00:00 2001 From: =?utf8?q?Christian=20W=C3=BCrdig?= Date: Sat, 8 Apr 2006 21:05:55 +0000 Subject: [PATCH] added environment pointer for distribution table iteration fixed compare function for int distrib tables changed order of typedefs [r7605] --- ir/stat/distrib.c | 11 +++++----- ir/stat/firmstat_t.h | 49 ++++++++++++++++++++++---------------------- 2 files changed, 31 insertions(+), 29 deletions(-) diff --git a/ir/stat/distrib.c b/ir/stat/distrib.c index 223e48ddb..23c38a877 100644 --- a/ir/stat/distrib.c +++ b/ir/stat/distrib.c @@ -31,6 +31,7 @@ static unsigned addr_hash(const void *object) static unsigned int_hash(const void *object) { return (unsigned)PTR_TO_INT(object); +// return (unsigned)(object); } /** @@ -38,10 +39,10 @@ static unsigned int_hash(const void *object) */ static int int_cmp_fun(const void *elt, const void *key) { - int p1 = (int)elt; - int p2 = (int)key; + const distrib_entry_t *p1 = elt; + const distrib_entry_t *p2 = key; - return p1 - p2; + return (int)(p1->object) - (int)(p2->object); } /* @@ -182,11 +183,11 @@ double stat_calc_mean_distrib_tbl(distrib_tbl_t *tbl) /** * iterates over all entries in a distribution table */ -void stat_iterate_distrib_tbl(distrib_tbl_t *tbl, eval_distrib_entry_fun eval) +void stat_iterate_distrib_tbl(distrib_tbl_t *tbl, eval_distrib_entry_fun eval, void *env) { distrib_entry_t *entry; for (entry = pset_first(tbl->hash_map); entry; entry = pset_next(tbl->hash_map)) { - eval(entry); + eval(entry, env); } } diff --git a/ir/stat/firmstat_t.h b/ir/stat/firmstat_t.h index 62dc133c8..2630c10ba 100644 --- a/ir/stat/firmstat_t.h +++ b/ir/stat/firmstat_t.h @@ -45,6 +45,27 @@ typedef pset hmap_reg_pressure_entry_t; typedef pset hmap_ir_op; typedef pset hmap_distrib_entry_t; +/** + * An entry in a distribution table + */ +typedef struct _distrib_entry_t { + counter_t cnt; /**< the current count */ + const void *object; /**< the object which is counted */ +} distrib_entry_t; + +/** The type of the hash function for objects in distribution tables. */ +typedef unsigned (*distrib_hash_fun)(const void *object); + +/** + * The distribution table. + */ +typedef struct _distrib_tbl_t { + struct obstack cnts; /**< obstack containing the distrib_entry_t entries */ + HASH_MAP(distrib_entry_t) *hash_map; /**< the hash map containing the distribution */ + distrib_hash_fun hash_func; /**< the hash function for object in this distribution */ + unsigned int_dist; /**< non-zero, if it's a integer distribution */ +} distrib_tbl_t; + /** * possible address marker values */ @@ -131,7 +152,8 @@ typedef struct _reg_pressure_entry_t { * An entry for a block or extended block in a ir-graph */ typedef struct _be_block_entry_t { - long block_nr; /**< block nr */ + long block_nr; /**< block nr */ + distrib_tbl_t *sched_ready; /**< distribution of ready nodes per block */ /**< the highest register pressures for this block for each register class */ HASH_MAP(reg_pressure_entry_t) *reg_pressure; } be_block_entry_t; @@ -250,27 +272,6 @@ struct _dumper_t { */ ir_op *stat_get_op_from_opcode(opcode code); -/** - * An entry in a distribution table - */ -typedef struct _distrib_entry_t { - counter_t cnt; /**< the current count */ - const void *object; /**< the object which is counted */ -} distrib_entry_t; - -/** The type of the hash function for objects in distribution tables. */ -typedef unsigned (*distrib_hash_fun)(const void *object); - -/** - * The distribution table. - */ -typedef struct _distrib_tbl_t { - struct obstack cnts; /**< obstack containing the distrib_entry_t entries */ - HASH_MAP(distrib_entry_t) *hash_map; /**< the hash map containing the distribution */ - distrib_hash_fun hash_func; /**< the hash function for object in this distribution */ - unsigned int_dist; /**< non-zero, if it's a integer distribution */ -} distrib_tbl_t; - /* API for distribution tables */ /** @@ -307,12 +308,12 @@ void stat_add_int_distrib_tbl(distrib_tbl_t *tbl, int key, const counter_t *cnt) double stat_calc_mean_distrib_tbl(distrib_tbl_t *tbl); /** evaluates each entry of a distribution table. */ -typedef void (*eval_distrib_entry_fun)(const distrib_entry_t *entry); +typedef void (*eval_distrib_entry_fun)(const distrib_entry_t *entry, void *env); /** * iterates over all entries in a distribution table */ -void stat_iterate_distrib_tbl(distrib_tbl_t *tbl, eval_distrib_entry_fun eval); +void stat_iterate_distrib_tbl(distrib_tbl_t *tbl, eval_distrib_entry_fun eval, void *env); /** * update info on Consts. -- 2.20.1