static unsigned int_hash(const void *object)
{
return (unsigned)PTR_TO_INT(object);
+// return (unsigned)(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);
}
/*
/**
* 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);
}
}
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
*/
* 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;
*/
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 */
/**
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.