From: Christian Würdig Date: Fri, 7 Apr 2006 13:10:11 +0000 (+0000) Subject: added const irn classifier X-Git-Url: http://nsz.repo.hu/git/?a=commitdiff_plain;h=9a77543a5e702fe3aba888f56137cf309ba0b605;hp=1752786900095fecb07aa28fa6eeb75e0e3f8d1a;p=libfirm added const irn classifier modified scheduler --- diff --git a/ir/be/bearch.h b/ir/be/bearch.h index 9a093d66a..a6b5ca0eb 100644 --- a/ir/be/bearch.h +++ b/ir/be/bearch.h @@ -183,7 +183,8 @@ typedef enum _arch_irn_class_t { arch_irn_class_copy, arch_irn_class_perm, arch_irn_class_branch, - arch_irn_class_call + arch_irn_class_call, + arch_irn_class_const, } arch_irn_class_t; /** diff --git a/ir/be/belistsched.c b/ir/be/belistsched.c index 83589866e..98e028c78 100644 --- a/ir/be/belistsched.c +++ b/ir/be/belistsched.c @@ -84,15 +84,30 @@ static ir_node *trivial_select(void *block_env, nodeset *ready_set) { const arch_env_t *arch_env = block_env; ir_node *irn = NULL; + int const_last = 0; - /* assure that branches are executed last */ + /* assure that branches and constants are executed last */ for (irn = nodeset_first(ready_set); irn; irn = nodeset_next(ready_set)) { - if (arch_irn_classify(arch_env, irn) != arch_irn_class_branch) { + arch_irn_class_t irn_class = arch_irn_classify(arch_env, irn); + + if (irn_class != arch_irn_class_branch && (const_last ? (irn_class != arch_irn_class_const) : 1)) { nodeset_break(ready_set); return irn; } } + /* assure that constants are executed before branches */ + if (const_last) { + for (irn = nodeset_first(ready_set); irn; irn = nodeset_next(ready_set)) { + if (arch_irn_classify(arch_env, irn) != arch_irn_class_branch) { + nodeset_break(ready_set); + return irn; + } + } + } + + + /* at last: schedule branches */ irn = nodeset_first(ready_set); nodeset_break(ready_set);