projects
/
libfirm
/ commitdiff
commit
grep
author
committer
pickaxe
?
search:
re
summary
|
shortlog
|
log
|
commit
| commitdiff |
tree
raw
|
patch
|
inline
| side by side (parent:
c47eb95
)
simplify copy interface and respect double/aligned reqs
author
Matthias Braun
<matze@braunis.de>
Mon, 15 Aug 2011 13:24:55 +0000
(15:24 +0200)
committer
Matthias Braun
<matze@braunis.de>
Wed, 17 Aug 2011 13:33:24 +0000
(15:33 +0200)
ir/be/arm/arm_transform.c
patch
|
blob
|
history
ir/be/belower.c
patch
|
blob
|
history
ir/be/benode.c
patch
|
blob
|
history
ir/be/benode.h
patch
|
blob
|
history
ir/be/beprefalloc.c
patch
|
blob
|
history
ir/be/bespill.c
patch
|
blob
|
history
ir/be/bessadestr.c
patch
|
blob
|
history
ir/be/ia32/bearch_ia32.c
patch
|
blob
|
history
ir/be/ia32/ia32_finish.c
patch
|
blob
|
history
diff --git
a/ir/be/arm/arm_transform.c
b/ir/be/arm/arm_transform.c
index
2c93a45
..
4c8f7b4
100644
(file)
--- a/
ir/be/arm/arm_transform.c
+++ b/
ir/be/arm/arm_transform.c
@@
-1282,8
+1282,8
@@
static ir_node *gen_CopyB(ir_node *node)
ir_node *src_copy;
ir_node *dst_copy;
ir_node *src_copy;
ir_node *dst_copy;
- src_copy = be_new_Copy(
&arm_reg_classes[CLASS_arm_gp],
block, new_src);
- dst_copy = be_new_Copy(
&arm_reg_classes[CLASS_arm_gp],
block, new_dst);
+ src_copy = be_new_Copy(block, new_src);
+ dst_copy = be_new_Copy(block, new_dst);
return new_bd_arm_CopyB(dbg, block, dst_copy, src_copy,
new_bd_arm_EmptyReg(dbg, block),
return new_bd_arm_CopyB(dbg, block, dst_copy, src_copy,
new_bd_arm_EmptyReg(dbg, block),
diff --git
a/ir/be/belower.c
b/ir/be/belower.c
index
aa22621
..
e564ce4
100644
(file)
--- a/
ir/be/belower.c
+++ b/
ir/be/belower.c
@@
-455,7
+455,7
@@
static void lower_perm_node(ir_node *irn, lower_env_t *env)
DB((dbg, LEVEL_1, "%+F creating copy node (%+F, %s) -> (%+F, %s)\n",
irn, arg1, cycle.elems[i]->name, res2, cycle.elems[i + 1]->name));
DB((dbg, LEVEL_1, "%+F creating copy node (%+F, %s) -> (%+F, %s)\n",
irn, arg1, cycle.elems[i]->name, res2, cycle.elems[i + 1]->name));
- cpyxchg = be_new_Copy(
reg_class,
block, arg1);
+ cpyxchg = be_new_Copy(block, arg1);
arch_set_irn_register(cpyxchg, cycle.elems[i + 1]);
/* exchange copy node and proj */
arch_set_irn_register(cpyxchg, cycle.elems[i + 1]);
/* exchange copy node and proj */
@@
-526,7
+526,7
@@
static void gen_assure_different_pattern(ir_node *irn, ir_node *other_different,
/* check if already exists such a copy in the schedule immediately before */
cpy = find_copy(skip_Proj(irn), other_different);
if (! cpy) {
/* check if already exists such a copy in the schedule immediately before */
cpy = find_copy(skip_Proj(irn), other_different);
if (! cpy) {
- cpy = be_new_Copy(
cls,
block, other_different);
+ cpy = be_new_Copy(block, other_different);
arch_set_irn_flags(cpy, arch_irn_flags_dont_spill);
DB((dbg_constr, LEVEL_1, "created non-spillable %+F for value %+F\n", cpy, other_different));
} else {
arch_set_irn_flags(cpy, arch_irn_flags_dont_spill);
DB((dbg_constr, LEVEL_1, "created non-spillable %+F for value %+F\n", cpy, other_different));
} else {
@@
-536,7
+536,7
@@
static void gen_assure_different_pattern(ir_node *irn, ir_node *other_different,
/* Add the Keep resp. CopyKeep and reroute the users */
/* of the other_different irn in case of CopyKeep. */
if (has_irn_users(other_different)) {
/* Add the Keep resp. CopyKeep and reroute the users */
/* of the other_different irn in case of CopyKeep. */
if (has_irn_users(other_different)) {
- keep = be_new_CopyKeep_single(
cls, block, cpy, irn, get_irn_mode(other_different)
);
+ keep = be_new_CopyKeep_single(
block, cpy, irn
);
be_node_set_reg_class_in(keep, 1, cls);
} else {
ir_node *in[2];
be_node_set_reg_class_in(keep, 1, cls);
} else {
ir_node *in[2];
@@
-733,10
+733,10
@@
static void melt_copykeeps(constraint_env_t *cenv)
}
#ifdef KEEP_ALIVE_COPYKEEP_HACK
}
#ifdef KEEP_ALIVE_COPYKEEP_HACK
- new_ck = be_new_CopyKeep(
entry->cls, get_nodes_block(ref), be_get_CopyKeep_op(ref), n_melt, new_ck_in, mode_ANY
);
+ new_ck = be_new_CopyKeep(
get_nodes_block(ref), be_get_CopyKeep_op(ref), n_melt, new_ck_in
);
keep_alive(new_ck);
#else
keep_alive(new_ck);
#else
- new_ck = be_new_CopyKeep(
entry->cls, get_nodes_block(ref), be_get_CopyKeep_op(ref), n_melt, new_ck_in, get_irn_mode(ref)
);
+ new_ck = be_new_CopyKeep(
get_nodes_block(ref), be_get_CopyKeep_op(ref), n_melt, new_ck_in
);
#endif /* KEEP_ALIVE_COPYKEEP_HACK */
/* set register class for all kept inputs */
#endif /* KEEP_ALIVE_COPYKEEP_HACK */
/* set register class for all kept inputs */
diff --git
a/ir/be/benode.c
b/ir/be/benode.c
index
d560bc6
..
ea8f6b1
100644
(file)
--- a/
ir/be/benode.c
+++ b/
ir/be/benode.c
@@
-422,13
+422,15
@@
ir_node *be_new_MemPerm(ir_node *block, int n, ir_node *in[])
return irn;
}
return irn;
}
-ir_node *be_new_Copy(
const arch_register_class_t *cls,
ir_node *bl, ir_node *op)
+ir_node *be_new_Copy(ir_node *bl, ir_node *op)
{
ir_node *in[1];
ir_node *res;
arch_register_req_t *req;
be_node_attr_t *attr;
ir_graph *irg = get_Block_irg(bl);
{
ir_node *in[1];
ir_node *res;
arch_register_req_t *req;
be_node_attr_t *attr;
ir_graph *irg = get_Block_irg(bl);
+ const arch_register_req_t *in_req = arch_get_irn_register_req(op);
+ const arch_register_class_t *cls = in_req->cls;
in[0] = op;
res = new_ir_node(NULL, irg, bl, op_be_Copy, get_irn_mode(op), 1, in);
in[0] = op;
res = new_ir_node(NULL, irg, bl, op_be_Copy, get_irn_mode(op), 1, in);
@@
-440,9
+442,10
@@
ir_node *be_new_Copy(const arch_register_class_t *cls, ir_node *bl, ir_node *op)
req = allocate_reg_req(res);
req->cls = cls;
req = allocate_reg_req(res);
req->cls = cls;
- req->type = arch_register_req_type_should_be_same;
+ req->type = arch_register_req_type_should_be_same
+ | (in_req->type & arch_register_req_type_aligned);
req->other_same = 1U << 0;
req->other_same = 1U << 0;
- req->width =
1
;
+ req->width =
in_req->width
;
be_set_constr_out(res, 0, req);
return res;
be_set_constr_out(res, 0, req);
return res;
@@
-738,11
+741,14
@@
ir_entity *be_get_FrameAddr_entity(const ir_node *node)
return attr->ent;
}
return attr->ent;
}
-ir_node *be_new_CopyKeep(
const arch_register_class_t *cls, ir_node *bl, ir_node *src, int n, ir_node *in_keep[], ir_mode *mode
)
+ir_node *be_new_CopyKeep(
ir_node *bl, ir_node *src, int n, ir_node *in_keep[]
)
{
ir_node *irn;
ir_node **in = ALLOCAN(ir_node*, n + 1);
ir_graph *irg = get_Block_irg(bl);
{
ir_node *irn;
ir_node **in = ALLOCAN(ir_node*, n + 1);
ir_graph *irg = get_Block_irg(bl);
+ const arch_register_req_t *req = arch_get_irn_register_req(src);
+ const arch_register_class_t *cls = req->cls;
+ ir_mode *mode = get_irn_mode(src);
be_node_attr_t *attr;
in[0] = src;
be_node_attr_t *attr;
in[0] = src;
@@
-757,9
+763,9
@@
ir_node *be_new_CopyKeep(const arch_register_class_t *cls, ir_node *bl, ir_node
return irn;
}
return irn;
}
-ir_node *be_new_CopyKeep_single(
const arch_register_class_t *cls, ir_node *bl, ir_node *src, ir_node *keep, ir_mode *mode
)
+ir_node *be_new_CopyKeep_single(
ir_node *bl, ir_node *src, ir_node *keep
)
{
{
- return be_new_CopyKeep(
cls, bl, src, 1, &keep, mode
);
+ return be_new_CopyKeep(
bl, src, 1, &keep
);
}
ir_node *be_get_CopyKeep_op(const ir_node *cpy)
}
ir_node *be_get_CopyKeep_op(const ir_node *cpy)
@@
-960,7
+966,8
@@
ir_node *be_spill(ir_node *block, ir_node *irn)
return spill;
}
return spill;
}
-ir_node *be_reload(const arch_register_class_t *cls, ir_node *insert, ir_mode *mode, ir_node *spill)
+ir_node *be_reload(const arch_register_class_t *cls, ir_node *insert,
+ ir_mode *mode, ir_node *spill)
{
ir_node *reload;
ir_node *bl = is_Block(insert) ? insert : get_nodes_block(insert);
{
ir_node *reload;
ir_node *bl = is_Block(insert) ? insert : get_nodes_block(insert);
diff --git
a/ir/be/benode.h
b/ir/be/benode.h
index
fc01db6
..
348c73b
100644
(file)
--- a/
ir/be/benode.h
+++ b/
ir/be/benode.h
@@
-104,8
+104,7
@@
enum {
/**
* Make a new Copy node.
*/
/**
* Make a new Copy node.
*/
-ir_node *be_new_Copy(const arch_register_class_t *cls, ir_node *block,
- ir_node *in);
+ir_node *be_new_Copy(ir_node *block, ir_node *in);
/** Returns the Copy Argument. */
ir_node *be_get_Copy_op(const ir_node *cpy);
/** Sets the Copy Argument. */
/** Returns the Copy Argument. */
ir_node *be_get_Copy_op(const ir_node *cpy);
/** Sets the Copy Argument. */
@@
-389,13
+388,10
@@
ir_node *be_reload(const arch_register_class_t *cls, ir_node *insert,
enum {
n_be_CopyKeep_op = 0
};
enum {
n_be_CopyKeep_op = 0
};
-ir_node *be_new_CopyKeep(const arch_register_class_t *cls, ir_node *block,
- ir_node *src, int n, ir_node *in_keep[],
- ir_mode *mode);
+ir_node *be_new_CopyKeep(ir_node *block, ir_node *src,
+ int n, ir_node *in_keep[]);
-ir_node *be_new_CopyKeep_single(const arch_register_class_t *cls,
- ir_node *block, ir_node *src, ir_node *keep,
- ir_mode *mode);
+ir_node *be_new_CopyKeep_single(ir_node *block, ir_node *src, ir_node *keep);
ir_node *be_get_CopyKeep_op(const ir_node *cpy);
ir_node *be_get_CopyKeep_op(const ir_node *cpy);
diff --git
a/ir/be/beprefalloc.c
b/ir/be/beprefalloc.c
index
b8cb95b
..
af2ece4
100644
(file)
--- a/
ir/be/beprefalloc.c
+++ b/
ir/be/beprefalloc.c
@@
-721,7
+721,7
@@
static bool try_optimistic_split(ir_node *to_split, ir_node *before,
return false;
reg = arch_register_for_index(cls, r);
return false;
reg = arch_register_for_index(cls, r);
- copy = be_new_Copy(
cls,
block, to_split);
+ copy = be_new_Copy(block, to_split);
mark_as_copy_of(copy, to_split);
/* hacky, but correct here */
if (assignments[arch_register_get_index(from_reg)] == to_split)
mark_as_copy_of(copy, to_split);
/* hacky, but correct here */
if (assignments[arch_register_get_index(from_reg)] == to_split)
@@
-922,7
+922,7
@@
static void permute_values(ir_nodeset_t *live_nodes, ir_node *before,
/* create a copy */
src = assignments[old_r];
/* create a copy */
src = assignments[old_r];
- copy = be_new_Copy(
cls,
block, src);
+ copy = be_new_Copy(block, src);
sched_add_before(before, copy);
reg = arch_register_for_index(cls, r);
DB((dbg, LEVEL_2, "Copy %+F (from %+F, before %+F) -> %s\n",
sched_add_before(before, copy);
reg = arch_register_for_index(cls, r);
DB((dbg, LEVEL_2, "Copy %+F (from %+F, before %+F) -> %s\n",
diff --git
a/ir/be/bespill.c
b/ir/be/bespill.c
index
c83653a
..
07bafe2
100644
(file)
--- a/
ir/be/bespill.c
+++ b/
ir/be/bespill.c
@@
-97,7
+97,7
@@
static void prepare_constr_insn(be_pre_spill_env_t *env, ir_node *node)
if (rbitset_is_set(req->limited, reg->index))
continue;
if (rbitset_is_set(req->limited, reg->index))
continue;
- copy = be_new_Copy(
cls,
block, op);
+ copy = be_new_Copy(block, op);
stat_ev_int("constr_copy", 1);
sched_add_before(node, copy);
set_irn_n(node, i, copy);
stat_ev_int("constr_copy", 1);
sched_add_before(node, copy);
set_irn_n(node, i, copy);
@@
-141,7
+141,7
@@
static void prepare_constr_insn(be_pre_spill_env_t *env, ir_node *node)
if (rbitsets_equal(req->limited, req2->limited, cls->n_regs))
continue;
if (rbitsets_equal(req->limited, req2->limited, cls->n_regs))
continue;
- copy = be_new_Copy(
cls,
block, in);
+ copy = be_new_Copy(block, in);
stat_ev_int("constr_copy", 1);
sched_add_before(node, copy);
stat_ev_int("constr_copy", 1);
sched_add_before(node, copy);
@@
-210,7
+210,7
@@
static void prepare_constr_insn(be_pre_spill_env_t *env, ir_node *node)
if (be_is_Copy(in))
continue;
if (be_is_Copy(in))
continue;
- copy = be_new_Copy(
cls,
block, in);
+ copy = be_new_Copy(block, in);
sched_add_before(node, copy);
set_irn_n(node, i, copy);
DBG((dbg, LEVEL_3, "inserting constr copy %+F for %+F pos %d\n",
sched_add_before(node, copy);
set_irn_n(node, i, copy);
DBG((dbg, LEVEL_3, "inserting constr copy %+F for %+F pos %d\n",
diff --git
a/ir/be/bessadestr.c
b/ir/be/bessadestr.c
index
0a393dd
..
b6e3094
100644
(file)
--- a/
ir/be/bessadestr.c
+++ b/
ir/be/bessadestr.c
@@
-242,7
+242,6
@@
static void set_regs_or_place_dupls_walker(ir_node *bl, void *data)
phi = (ir_node*)get_irn_link(phi)) {
ir_node *phi_block = get_nodes_block(phi);
const arch_register_t *phi_reg = arch_get_irn_register(phi);
phi = (ir_node*)get_irn_link(phi)) {
ir_node *phi_block = get_nodes_block(phi);
const arch_register_t *phi_reg = arch_get_irn_register(phi);
- const arch_register_class_t *cls = phi_reg->reg_class;
int max;
int i;
int max;
int i;
@@
-280,7
+279,7
@@
static void set_regs_or_place_dupls_walker(ir_node *bl, void *data)
insert it into schedule,
pin it
*/
insert it into schedule,
pin it
*/
- ir_node *dupl
= be_new_Copy(cls,
arg_block, arg);
+ ir_node *dupl
= be_new_Copy(
arg_block, arg);
set_irn_n(phi, i, dupl);
arch_set_irn_register(dupl, phi_reg);
set_irn_n(phi, i, dupl);
arch_set_irn_register(dupl, phi_reg);
@@
-336,7
+335,7
@@
static void set_regs_or_place_dupls_walker(ir_node *bl, void *data)
pin it
*/
ir_node *perm = get_Proj_pred(arg);
pin it
*/
ir_node *perm = get_Proj_pred(arg);
- ir_node *dupl = be_new_Copy(
cls,
arg_block, arg);
+ ir_node *dupl = be_new_Copy(arg_block, arg);
ir_node *ins;
set_irn_n(phi, i, dupl);
ir_node *ins;
set_irn_n(phi, i, dupl);
diff --git
a/ir/be/ia32/bearch_ia32.c
b/ir/be/ia32/bearch_ia32.c
index
741d5ca
..
5f231f7
100644
(file)
--- a/
ir/be/ia32/bearch_ia32.c
+++ b/
ir/be/ia32/bearch_ia32.c
@@
-1277,10
+1277,10
@@
static void introduce_prolog_epilog(ir_graph *irg)
sched_add_after(start, push);
/* move esp to ebp */
sched_add_after(start, push);
/* move esp to ebp */
- curr_bp = be_new_Copy(b
p->reg_class, b
lock, curr_sp);
+ curr_bp = be_new_Copy(block, curr_sp);
sched_add_after(push, curr_bp);
be_set_constr_single_reg_out(curr_bp, 0, bp, arch_register_req_type_ignore);
sched_add_after(push, curr_bp);
be_set_constr_single_reg_out(curr_bp, 0, bp, arch_register_req_type_ignore);
- curr_sp = be_new_CopyKeep_single(
sp->reg_class, block, curr_sp, curr_bp, mode_g
p);
+ curr_sp = be_new_CopyKeep_single(
block, curr_sp, curr_b
p);
sched_add_after(curr_bp, curr_sp);
be_set_constr_single_reg_out(curr_sp, 0, sp, arch_register_req_type_produces_sp);
edges_reroute(initial_bp, curr_bp);
sched_add_after(curr_bp, curr_sp);
be_set_constr_single_reg_out(curr_sp, 0, sp, arch_register_req_type_produces_sp);
edges_reroute(initial_bp, curr_bp);
diff --git
a/ir/be/ia32/ia32_finish.c
b/ir/be/ia32/ia32_finish.c
index
fc0db4f
..
2a8cc58
100644
(file)
--- a/
ir/be/ia32/ia32_finish.c
+++ b/
ir/be/ia32/ia32_finish.c
@@
-307,7
+307,7
@@
static void assure_should_be_same_requirements(ir_node *node)
* (the register can't be live since the operation will override it
* anyway) */
if (uses_out_reg == NULL) {
* (the register can't be live since the operation will override it
* anyway) */
if (uses_out_reg == NULL) {
- ir_node *copy = be_new_Copy(
cls,
block, in_node);
+ ir_node *copy = be_new_Copy(block, in_node);
DBG_OPT_2ADDRCPY(copy);
/* destination is the out register */
DBG_OPT_2ADDRCPY(copy);
/* destination is the out register */