*/
FIRM_API void lower_switch(ir_graph *irg, unsigned spare_size);
-/**
- * Creates an ir_graph pass for lower_switch().
- *
- * @param name the name of this pass or NULL
- * @param spare_size Allowed spare size for table switches in machine words.
- * (Default in edgfe: 128)
- *
- * @return the newly created ir_graph pass
- */
-FIRM_API ir_graph_pass_t *lower_switch_pass(const char *name,
- unsigned spare_size);
-
/**
* A callback type for creating an intrinsic entity for a given opcode.
*
return 0;
}
+static void arm_lower_for_target(void)
+{
+ int i;
+ int n_irgs = get_irp_n_irgs();
+
+ for (i = 0; i < n_irgs; ++i) {
+ ir_graph *irg = get_irp_irg(i);
+ lower_switch(irg, 128);
+ }
+}
+
/**
* Returns the libFirm configuration parameter for this backend.
*/
0, /* don't support inline assembler yet */
1, /* support Rotl nodes */
1, /* big endian */
- NULL, /* lowering function */
+ arm_lower_for_target, /* lowering function */
&ad, /* will be set later */
arm_is_mux_allowed, /* allow_ifconv function */
NULL, /* float arithmetic mode (TODO) */
};
lower_dw_ops(&lower_dw_params);
- /* lower for mode_b stuff */
for (i = 0; i < n_irgs; ++i) {
ir_graph *irg = get_irp_irg(i);
+ /* lower for mode_b stuff */
ir_lower_mode_b(irg, &lower_mode_b_config);
+ /* break up switches with wide ranges */
+ lower_switch(irg, 128);
}
}
static void sparc_lower_for_target(void)
{
+ int i;
+ int n_irgs = get_irp_n_irgs();
+
/* TODO, doubleword lowering and others */
+
+ for (i = 0; i < n_irgs; ++i) {
+ ir_graph *irg = get_irp_irg(i);
+ lower_switch(irg, 128);
+ }
}
/**
set_irg_loopinfo_inconsistent(irg);
}
}
-
-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);
-}