projects
/
libfirm
/ blobdiff
commit
grep
author
committer
pickaxe
?
search:
re
summary
|
shortlog
|
log
|
commit
|
commitdiff
|
tree
raw
|
inline
| side by side
- add barcelona and generic32 targets
[libfirm]
/
ir
/
be
/
bechordal.c
diff --git
a/ir/be/bechordal.c
b/ir/be/bechordal.c
index
2378267
..
777bc73
100644
(file)
--- a/
ir/be/bechordal.c
+++ b/
ir/be/bechordal.c
@@
-1,5
+1,5
@@
/*
/*
- * Copyright (C) 1995-200
7
University of Karlsruhe. All right reserved.
+ * Copyright (C) 1995-200
8
University of Karlsruhe. All right reserved.
*
* This file is part of libFirm.
*
*
* This file is part of libFirm.
*
@@
-157,7
+157,7
@@
static INLINE border_t *border_add(be_chordal_env_t *env, struct list_head *head
else {
b = get_irn_link(irn);
else {
b = get_irn_link(irn);
-
assert(b && b->magic == BORDER_FOURCC && "Illegal border encountered"
);
+
DEBUG_ONLY(assert(b && b->magic == BORDER_FOURCC && "Illegal border encountered")
);
}
b->pressure = pressure;
}
b->pressure = pressure;
@@
-180,7
+180,7
@@
static INLINE border_t *border_add(be_chordal_env_t *env, struct list_head *head
*/
static INLINE int has_reg_class(const be_chordal_env_t *env, const ir_node *irn)
{
*/
static INLINE int has_reg_class(const be_chordal_env_t *env, const ir_node *irn)
{
- return arch_irn_consider_in_reg_alloc(env->birg->main_env->arch_env, env->cls, irn);
+ return arch_irn_consider_in_reg_alloc(
&
env->birg->main_env->arch_env, env->cls, irn);
}
#define has_limited_constr(req, irn) \
}
#define has_limited_constr(req, irn) \
@@
-225,7
+225,7
@@
static be_insn_t *chordal_scan_insn(be_chordal_env_t *env, ir_node *irn)
be_insn_env_t ie;
ie.ignore_colors = env->ignore_colors;
be_insn_env_t ie;
ie.ignore_colors = env->ignore_colors;
- ie.aenv = env->birg->main_env->arch_env;
+ ie.aenv =
&
env->birg->main_env->arch_env;
ie.obst = env->obst;
ie.cls = env->cls;
return be_scan_insn(&ie, irn);
ie.obst = env->obst;
ie.cls = env->cls;
return be_scan_insn(&ie, irn);
@@
-234,7
+234,7
@@
static be_insn_t *chordal_scan_insn(be_chordal_env_t *env, ir_node *irn)
static ir_node *prepare_constr_insn(be_chordal_env_t *env, ir_node *irn)
{
const be_irg_t *birg = env->birg;
static ir_node *prepare_constr_insn(be_chordal_env_t *env, ir_node *irn)
{
const be_irg_t *birg = env->birg;
- const arch_env_t *aenv = birg->main_env->arch_env;
+ const arch_env_t *aenv =
&
birg->main_env->arch_env;
bitset_t *tmp = bitset_alloca(env->cls->n_regs);
bitset_t *def_constr = bitset_alloca(env->cls->n_regs);
ir_node *bl = get_nodes_block(irn);
bitset_t *tmp = bitset_alloca(env->cls->n_regs);
bitset_t *def_constr = bitset_alloca(env->cls->n_regs);
ir_node *bl = get_nodes_block(irn);
@@
-293,6
+293,11
@@
static ir_node *prepare_constr_insn(be_chordal_env_t *env, ir_node *irn)
if(a_op->carrier != op->carrier || !a_op->has_constraints)
continue;
if(a_op->carrier != op->carrier || !a_op->has_constraints)
continue;
+ /* if the constraint is the same, no copy is necessary
+ * TODO generalise unequal but overlapping constraints */
+ if (a_op->req == op->req)
+ continue;
+
if (be_is_Copy(get_irn_n(insn->irn, a_op->pos)))
continue;
if (be_is_Copy(get_irn_n(insn->irn, a_op->pos)))
continue;
@@
-428,7
+433,7
@@
static ir_node *pre_process_constraints(be_chordal_alloc_env_t *alloc_env,
be_insn_t **the_insn)
{
be_chordal_env_t *env = alloc_env->chordal_env;
be_insn_t **the_insn)
{
be_chordal_env_t *env = alloc_env->chordal_env;
- const arch_env_t *aenv = env->birg->main_env->arch_env;
+ const arch_env_t *aenv =
&
env->birg->main_env->arch_env;
be_insn_t *insn = *the_insn;
ir_node *perm = NULL;
bitset_t *out_constr = bitset_alloca(env->cls->n_regs);
be_insn_t *insn = *the_insn;
ir_node *perm = NULL;
bitset_t *out_constr = bitset_alloca(env->cls->n_regs);
@@
-541,7
+546,7
@@
static ir_node *handle_constraints(be_chordal_alloc_env_t *alloc_env,
if(!insn->has_constraints)
goto end;
if(!insn->has_constraints)
goto end;
- aenv = env->birg->main_env->arch_env;
+ aenv =
&
env->birg->main_env->arch_env;
n_regs = env->cls->n_regs;
bs = bitset_alloca(n_regs);
alloc_nodes = alloca(n_regs * sizeof(alloc_nodes[0]));
n_regs = env->cls->n_regs;
bs = bitset_alloca(n_regs);
alloc_nodes = alloca(n_regs * sizeof(alloc_nodes[0]));
@@
-880,7
+885,7
@@
static void assign(ir_node *block, void *env_ptr)
bitset_t *live = alloc_env->live;
bitset_t *colors = alloc_env->colors;
bitset_t *in_colors = alloc_env->in_colors;
bitset_t *live = alloc_env->live;
bitset_t *colors = alloc_env->colors;
bitset_t *in_colors = alloc_env->in_colors;
- const arch_env_t *arch_env = env->birg->main_env->arch_env;
+ const arch_env_t *arch_env =
&
env->birg->main_env->arch_env;
struct list_head *head = get_block_border_head(env, block);
be_lv_t *lv = env->birg->lv;
struct list_head *head = get_block_border_head(env, block);
be_lv_t *lv = env->birg->lv;
@@
-992,11
+997,6
@@
void be_ra_chordal_color(be_chordal_env_t *chordal_env)
int colors_n = arch_register_class_n_regs(cls);
ir_graph *irg = chordal_env->irg;
int colors_n = arch_register_class_n_regs(cls);
ir_graph *irg = chordal_env->irg;
- int allocatable_regs = colors_n - be_put_ignore_regs(birg, cls, NULL);
-
- /* some special classes contain only ignore regs, no work to be done */
- if(allocatable_regs == 0)
- return;
be_assure_dom_front(birg);
lv = be_assure_liveness(birg);
be_assure_dom_front(birg);
lv = be_assure_liveness(birg);
@@
-1012,6
+1012,8
@@
void be_ra_chordal_color(be_chordal_env_t *chordal_env)
env.in_colors = bitset_alloca(colors_n);
env.pre_colored = pset_new_ptr_default();
env.in_colors = bitset_alloca(colors_n);
env.pre_colored = pset_new_ptr_default();
+ BE_TIMER_PUSH(t_constr);
+
/* Handle register targeting constraints */
dom_tree_walk_irg(irg, constraints, NULL, &env);
/* Handle register targeting constraints */
dom_tree_walk_irg(irg, constraints, NULL, &env);
@@
-1020,6
+1022,8
@@
void be_ra_chordal_color(be_chordal_env_t *chordal_env)
be_dump(chordal_env->irg, buf, dump_ir_block_graph_sched);
}
be_dump(chordal_env->irg, buf, dump_ir_block_graph_sched);
}
+ BE_TIMER_POP(t_constr);
+
env.live = bitset_malloc(get_irg_last_idx(chordal_env->irg));
/* First, determine the pressure */
env.live = bitset_malloc(get_irg_last_idx(chordal_env->irg));
/* First, determine the pressure */