#include "dbginfo_t.h"
#include "iropt_dbg.h"
#include "irflag_t.h"
-#include "firmstat.h"
+#include "irhooks.h"
#include "ircons.h"
#include "irarch.h"
-#include "firmstat.h"
#undef DEB
opts = the_opts;
}
+/* check, wheater a mode allows a Mulh instruction */
+static int allow_Mulh(ir_mode *mode)
+{
+ if (get_mode_size_bits(mode) > params->max_bits_for_mulh)
+ return 0;
+ return (mode_is_signed(mode) && params->allow_mulhs) || (!mode_is_signed(mode) && params->allow_mulhu);
+}
+
ir_node *arch_dep_replace_mul_with_shifts(ir_node *irn)
{
ir_node *res = irn;
}
if (res != irn)
- stat_arch_dep_replace_mul_with_shifts(irn);
+ hook_arch_dep_replace_mul_with_shifts(irn);
return res;
}
}
else {
/* other constant */
- if ((mode_is_signed(mode) && params->allow_mulhs) ||
- (!mode_is_signed(mode) && params->allow_mulhu))
+ if (allow_Mulh(mode))
res = replace_div_by_mulh(irn, tv);
}
}
if (res != irn)
- stat_arch_dep_replace_div_by_const(irn);
+ hook_arch_dep_replace_div_by_const(irn);
return res;
}
}
else {
/* other constant */
- if ((mode_is_signed(mode) && params->allow_mulhs) ||
- (!mode_is_signed(mode) && params->allow_mulhu)) {
+ if (allow_Mulh(mode)) {
res = replace_div_by_mulh(irn, tv);
res = new_rd_Mul(dbg, current_ir_graph, block, res, c, mode);
}
if (res != irn)
- stat_arch_dep_replace_mod_by_const(irn);
+ hook_arch_dep_replace_mod_by_const(irn);
return res;
}
}
else {
/* other constant */
- if ((mode_is_signed(mode) && params->allow_mulhs) ||
- (!mode_is_signed(mode) && params->allow_mulhu)) {
+ if (allow_Mulh(mode)) {
ir_node *t;
*div = replace_div_by_mulh(irn, tv);
}
if (*div)
- stat_arch_dep_replace_DivMod_by_const(irn);
+ hook_arch_dep_replace_DivMod_by_const(irn);
}