*/
void do_loop_peeling(ir_graph *irg);
+/**
+ * Creates an ir_graph pass for loop inversion.
+ *
+ * @param name the name of this pass or NULL
+ *
+ * @return the newly created ir_graph pass
+ */
+ir_graph_pass_t *loop_inversion_pass(const char *name);
+
+/**
+ * Creates an ir_graph pass for loop unrolling.
+ *
+ * @param name the name of this pass or NULL
+ *
+ * @return the newly created ir_graph pass
+ */
+ir_graph_pass_t *loop_unroll_pass(const char *name);
+
+/**
+ * Creates an ir_graph pass for loop peeling.
+ *
+ * @param name the name of this pass or NULL
+ *
+ * @return the newly created ir_graph pass
+ */
+ir_graph_pass_t *loop_peeling_pass(const char *name);
+
typedef ir_type *(*get_Alloc_func)(ir_node *n);
/** Set a new get_Alloc_func and returns the old one. */
get_Alloc_func firm_set_Alloc_func(get_Alloc_func newf);
*/
void lower_mux(ir_graph *irg, lower_mux_callback *cb_func);
+/**
+ * Creates an ir_graph pass for lower_mux().
+ *
+ * @param name the name of this pass or NULL
+ * @param cb_func The callback function for mux selection. Can be NULL,
+ * to lower all mux nodes.
+ *
+ * @return the newly created ir_graph pass
+ */
+ir_graph_pass_t *lower_mux_pass(const char *name, lower_mux_callback *cb_func);
+
/**
* An intrinsic mapper function.
*
#include "irgmod.h"
#include "ircons.h"
#include "irvrfy.h"
+#include "irpass_t.h"
typedef struct walk_env {
lower_mux_callback *cb_func;
}
DEL_ARR_F(env.muxes);
}
+
+struct pass_t {
+ ir_graph_pass_t pass;
+ lower_mux_callback *cb_func;
+};
+
+/**
+ * Wrapper to run ir_lower_mux() as an ir_graph pass
+ */
+static int pass_wrapper(ir_graph *irg, void *context)
+{
+ struct pass_t *pass = context;
+
+ lower_mux(irg, pass->cb_func);
+ return 0;
+}
+
+ir_graph_pass_t *lower_mux_pass(const char *name, lower_mux_callback *cb_func) {
+ struct pass_t *pass = XMALLOCZ(struct pass_t);
+
+ pass->cb_func = cb_func;
+ return def_graph_pass_constructor(
+ &pass->pass, name ? name : "lower_mux", pass_wrapper);
+}
#include "array_t.h" /* automatic array */
#include "beutil.h" /* get_block */
#include "irloop_t.h" /* set_irn_loop*/
+#include "irpass.h"
#if 0
#include "irdump_t.h"
}
+ir_graph_pass_t *loop_inversion_pass(const char *name) {
+ return def_graph_pass(name ? name : "loop_inversion", do_loop_inversion);
+}
+
+ir_graph_pass_t *loop_unroll_pass(const char *name) {
+ return def_graph_pass(name ? name : "loop_unroll", do_loop_unrolling);
+}
+
+ir_graph_pass_t *loop_peeling_pass(const char *name) {
+ return def_graph_pass(name ? name : "loop_peeling", do_loop_peeling);
+}
+
void firm_init_loop_opt(void)
{
FIRM_DBG_REGISTER(dbg, "firm.opt.loop");