typedef enum {
arch_dep_none = 0,
arch_dep_mul_to_shift = 1, /**< optimize Mul into Shift/Add/Sub */
- arch_dep_div_to_shift = 2 /**< optimize Div into Shift/Add/Mul */
+ arch_dep_div_to_shift = 2, /**< optimize Div into Shift/Add/Mul */
+ arch_dep_mod_to_shift = 4 /**< optimize Mod into Shift/Add/Mul */
} arch_dep_opts_t;
/**
*/
ir_node *arch_dep_replace_div_with_shifts(ir_node *irn);
+/**
+ * Replace Mods with Shifts and Add/Subs.
+ * This function is driven by the 3 parameters:
+ * - also_use_subs
+ * - maximum_shifts
+ * - highest_shift_amount
+ *
+ * If irn is a Div with a Const, The constant is inspected, if it meets the
+ * requirements of the three variables stated above. If a Shl/Add/Sub
+ * sequence can be generated, that meets these requirements, this expression
+ * is returned. In each other case, irn is returned unmodified.
+ *
+ * @param irn The Firm node to inspect.
+ * @return A replacement expression for irn.
+ */
+ir_node *arch_dep_replace_mod_with_shifts(ir_node *irn);
+
+/**
+ * Replace Mods with Shifts and Add/Subs.
+ * This function is driven by the 3 parameters:
+ * - also_use_subs
+ * - maximum_shifts
+ * - highest_shift_amount
+ *
+ * If irn is a Div with a Const, The constant is inspected, if it meets the
+ * requirements of the three variables stated above. If a Shl/Add/Sub
+ * sequence can be generated, that meets these requirements, this expression
+ * is returned. In each other case, irn is returned unmodified.
+ *
+ * @param div After call contains the Firm node div result or NULL.
+ * @param mod After call contains the Firm node mod result or NULL.
+ * @param irn The Firm node to inspect.
+ * @return A replacement expression for irn.
+ */
+void arch_dep_replace_divmod_with_shifts(ir_node **div, ir_node **mod, ir_node *irn);
+
#endif