X-Git-Url: http://nsz.repo.hu/git/?a=blobdiff_plain;f=ir%2Fbe%2Fmips%2Fmips_scheduler.c;h=d0f9057b917e14b15affc1402877ece193dee8ba;hb=ea75e9d38674b468f602a0699fb64b9c01254797;hp=9eb93c84500029d5e7794ec53b1ec2e01c38287c;hpb=af2a5a2b5f887eecf793fae8bf932d5fd9916d81;p=libfirm diff --git a/ir/be/mips/mips_scheduler.c b/ir/be/mips/mips_scheduler.c index 9eb93c845..d0f9057b9 100644 --- a/ir/be/mips/mips_scheduler.c +++ b/ir/be/mips/mips_scheduler.c @@ -25,15 +25,12 @@ */ #include "config.h" -#ifdef HAVE_STDLIB_H -#include -#endif - #include "mips_scheduler.h" -#include "../besched_t.h" +#include "../besched.h" #include "be.h" #include "../beabi.h" +#include "../belistsched.h" #include "iredges.h" #include "ircons.h" #include "gen_mips_regalloc_if.h" @@ -89,7 +86,7 @@ static void mips_scheduler_finish_block(void* graph_env) { mips_sched_env_t *sched_env = (mips_sched_env_t*) graph_env; // attach last nop to end node (so that firm doesn't discard it) - if(sched_env->last_nop != NULL) { + if (sched_env->last_nop != NULL) { ir_node* end = get_irg_end(get_irn_irg(sched_env->block)); (void) end; // TODO @@ -102,27 +99,28 @@ static int mips_scheduler_to_appear_in_schedule(void *block_env, const ir_node * return is_mips_irn(irn) && !is_mips_zero(irn) && !is_mips_reinterpret_conv(irn) && !is_mips_fallthrough(irn); } -static void mips_collect_mflohis(pset* set, ir_node* node) { +static void mips_collect_mflohis(pset* set, ir_node* node) +{ // construct a list of nodes that need to be scheduled before // we are allowed to schedule another div or mul instruction const ir_edge_t *edge, *edge2; - if(is_mips_div(node)) { + if (is_mips_div(node)) { foreach_out_edge(node, edge) { const ir_node* node2 = get_edge_src_irn(edge); assert(is_Proj(node2)); foreach_out_edge(node2, edge2) { const ir_node* node3 = get_edge_src_irn(edge2); - if(is_mips_mfhi(node3) || is_mips_mflo(node3)) + if (is_mips_mfhi(node3) || is_mips_mflo(node3)) pset_insert_ptr(set, node3); } } - } else if(is_mips_mult(node)) { + } else if (is_mips_mult(node)) { foreach_out_edge(node, edge) { const ir_node* node2 = get_edge_src_irn(edge); - if(is_mips_mfhi(node2) || is_mips_mflo(node2)) + if (is_mips_mfhi(node2) || is_mips_mflo(node2)) pset_insert_ptr(set, node2); } } @@ -130,7 +128,7 @@ static void mips_collect_mflohis(pset* set, ir_node* node) { static int mips_scheduler_node_allowed(mips_sched_env_t *sched_env, ir_node* node) { - if(pset_count(sched_env->div_set) != 0 && (is_mips_div(node) || is_mips_mult(node))) { + if (pset_count(sched_env->div_set) != 0 && (is_mips_div(node) || is_mips_mult(node))) { return 0; } @@ -165,7 +163,7 @@ static ir_node *mips_scheduler_select(void *block_env, nodeset *ready_set, nodes if (is_mips_div(node) || is_mips_mult(node)) { mips_collect_mflohis(sched_env->div_set, node); - } else if(is_mips_mflo(node) || is_mips_mfhi(node)) { + } else if (is_mips_mflo(node) || is_mips_mfhi(node)) { pset_remove_ptr(sched_env->div_set, node); } @@ -176,9 +174,9 @@ static ir_node *mips_scheduler_select(void *block_env, nodeset *ready_set, nodes // if we arrive here no non-branch node was found that we can emit // return a branch if there are just branches left - if(!have_non_branch_nodes) { + if (!have_non_branch_nodes) { // schedule conditional branches before non-conditional ones - if(condjmp != NULL) { + if (condjmp != NULL) { return condjmp; } node = nodeset_first(ready_set); @@ -195,14 +193,13 @@ static ir_node *mips_scheduler_select(void *block_env, nodeset *ready_set, nodes #endif -static -int mips_to_appear_in_schedule(void *block_env, const ir_node *node) +static int mips_to_appear_in_schedule(void *block_env, const ir_node *node) { (void) block_env; - if(!is_mips_irn(node)) + if (!is_mips_irn(node)) return -1; - if(is_mips_zero(node) || is_mips_Immediate(node)) + if (is_mips_zero(node) || is_mips_Immediate(node)) return 0; return 1;