return NULL;
}
-#ifdef FIRM_STATISTICS
-/* return the mode index, only needed for statistics */
-int stat_find_mode_index(const ir_mode *m)
-{
- int i;
- for (i = ARR_LEN(mode_list) - 1; i >= 0; --i) {
- ir_mode *n = mode_list[i];
- if (modes_are_equal(n, m))
- return i;
- }
- return -1;
-}
-
-/* return the mode for a given index, only needed for statistics */
-ir_mode *stat_mode_for_index(int idx)
-{
- if (0 <= idx && idx < ARR_LEN(mode_list))
- return mode_list[idx];
- return NULL;
-}
-#endif
-
/**
* sets special values of modes
*/
return e1->addr != e2->addr;
} /* addr_cmp */
+static unsigned find_mode_index(const ir_mode *mode)
+{
+ int n = get_irp_n_modes();
+ int i;
+
+ for (i = 0; i < n; ++i) {
+ if (get_irp_mode(i) == mode)
+ return i;
+ }
+ return -1;
+}
+
/**
* Encodes an IR-node, recursive worker.
*
ir_mode *mode = get_irn_mode(node);
if (mode)
- put_code(env->buf, stat_find_mode_index(mode));
+ put_code(env->buf, find_mode_index(mode));
else
put_tag(env->buf, VLC_TAG_EMPTY);
} /* if */
{
vcg_private_t *priv = self->data;
ir_op *op = stat_get_op_from_opcode(op_code);
- ir_mode *mode = stat_mode_for_index(mode_code);
+ ir_mode *mode = get_irp_mode(mode_code);
long l = attr ? *(long *)attr : 0;
if (priv->pattern_id > priv->max_pattern)
{
FILE *f = self->data;
ir_op *op = stat_get_op_from_opcode(op_code);
- ir_mode *mode = stat_mode_for_index(mode_code);
+ ir_mode *mode = get_irp_mode(mode_code);
(void) attr;
/* if (env->options & OPT_ENC_GRAPH) */
*/
pattern_dumper_t *new_vcg_dumper(const char *vcg_name, unsigned max_pattern);
-/**
- * return the mode index, only needed for statistics
- */
-int stat_find_mode_index(const ir_mode *m);
-
-/**
- * return the mode for a given index, only needed for statistics
- */
-ir_mode *stat_mode_for_index(int idx);
-
#endif /* FIRM_STAT_PATTERN_DMP_H */