#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);
+}