summaryrefslogtreecommitdiffhomepage
path: root/ir/be/bespilldaemel.c
diff options
context:
space:
mode:
authorMatthias Braun <matze@braunis.de>2012-11-27 17:49:06 +0100
committerMatthias Braun <matze@braunis.de>2012-11-28 11:27:13 +0100
commit1376e7ac003f5d209b72056c62798cbb6d928de3 (patch)
treebd332d20cdcf4d1b710ca5ccc3c453734315b674 /ir/be/bespilldaemel.c
parentae1da4394ecac110c79fdf1f07cbca598c1ef4be (diff)
introduce be_foreach_use and use it
Diffstat (limited to 'ir/be/bespilldaemel.c')
-rw-r--r--ir/be/bespilldaemel.c12
1 files changed, 5 insertions, 7 deletions
diff --git a/ir/be/bespilldaemel.c b/ir/be/bespilldaemel.c
index f248de4..88cf06a 100644
--- a/ir/be/bespilldaemel.c
+++ b/ir/be/bespilldaemel.c
@@ -148,14 +148,11 @@ static void do_spilling(ir_nodeset_t *live_nodes, ir_node *node)
/* we need registers for the non-live argument values */
size_t free_regs_needed = 0;
- int arity = get_irn_arity(node);
- for (int i = 0; i < arity; ++i) {
- ir_node *pred = get_irn_n(node, i);
- if (arch_irn_consider_in_reg_alloc(cls, pred)
- && !ir_nodeset_contains(live_nodes, pred)) {
- free_regs_needed += get_value_width(pred);
+ be_foreach_use(node, cls, in_req_, use, pred_req_,
+ if (!ir_nodeset_contains(live_nodes, use)) {
+ free_regs_needed += get_value_width(use);
}
- }
+ );
/* we can reuse all reloaded values for the defined values, but we might
* need even more registers */
@@ -203,6 +200,7 @@ static void do_spilling(ir_nodeset_t *live_nodes, ir_node *node)
/* make sure the node is not an argument of the instruction */
bool is_use = false;
+ int arity = get_irn_arity(node);
for (int i = 0; i < arity; ++i) {
ir_node *in = get_irn_n(node, i);
if (in == cand_node) {