Commit 3afe8891 authored by Matthias Braun's avatar Matthias Braun
Browse files

invoke switch lowerer in target specific lowering pass

[r28000]
parent 9b64e1f1
......@@ -163,18 +163,6 @@ FIRM_API void lower_CopyB(ir_graph *irg, unsigned max_size,
*/
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.
*
......
......@@ -674,6 +674,17 @@ static int arm_is_valid_clobber(const char *clobber)
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.
*/
......@@ -692,7 +703,7 @@ static const backend_params *arm_get_libfirm_params(void)
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) */
......
......@@ -2264,10 +2264,12 @@ static void ia32_lower_for_target(void)
};
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);
}
}
......
......@@ -551,7 +551,15 @@ static int sparc_get_reg_class_alignment(const arch_register_class_t *cls)
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);
}
}
/**
......
......@@ -322,29 +322,3 @@ void lower_switch(ir_graph *irg, unsigned spare_size)
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);
}
Markdown is supported
0% or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment