+
+struct pass_t {
+ ir_graph_pass_t pass;
+ unsigned spare_size;
+};
+
+/**
+ * Wrapper for running lower_switch() as a pass.
+ */
+static int pass_wrapper(ir_graph *irg, void *context) {
+ struct pass_t *pass = context;
+
+ lower_switch(irg, pass->spare_size);
+ return 0;
+}
+
+/* creates a pass for lower_switch */
+ir_graph_pass_t *lower_switch_pass(const char *name, unsigned spare_size) {
+ struct pass_t *pass = XMALLOCZ(struct pass_t);
+
+ pass->spare_size = spare_size;
+ return def_graph_pass_constructor(
+ &pass->pass, name ? name : "lower_switch", pass_wrapper);
+}