Commit e9237e14 authored by Christoph Mallon's avatar Christoph Mallon
Browse files

Add ir_nodeset_first() to return the "first" node in an ir_nodeset.

parent 806e4c72
......@@ -59,7 +59,6 @@ static ir_node *normal_select(void *block_env, ir_nodeset_t *ready_set)
ir_node* irn;
ir_node* next;
ir_node* last = NULL;
ir_nodeset_iterator_t iter;
for (irn = inst->curr_list; irn != NULL; last = irn, irn = next) {
next = (ir_node*)get_irn_link(irn);
......@@ -75,9 +74,7 @@ static ir_node *normal_select(void *block_env, ir_nodeset_t *ready_set)
}
}
ir_nodeset_iterator_init(&iter, ready_set);
irn = ir_nodeset_iterator_next(&iter);
return irn;
return ir_nodeset_first(ready_set);
}
......
......@@ -52,8 +52,7 @@ static ir_node *random_select(void *block_env, ir_nodeset_t *ready_set)
if (only_branches_left) {
/* at last: schedule branches */
ir_nodeset_iterator_init(&iter, ready_set);
irn = ir_nodeset_iterator_next(&iter);
irn = ir_nodeset_first(ready_set);
} else {
do {
/* take 1 random node */
......
......@@ -286,9 +286,7 @@ static ir_node *reg_pressure_select(void *block_env, ir_nodeset_t *ready_set)
*/
if (!res) {
ir_nodeset_iterator_init(&iter, ready_set);
res = ir_nodeset_iterator_next(&iter);
res = ir_nodeset_first(ready_set);
assert(res && "There must be a node scheduled.");
}
......
......@@ -61,10 +61,7 @@ typedef struct trace_env {
*/
static ir_node *get_nodeset_node(const ir_nodeset_t *nodeset)
{
ir_nodeset_iterator_t iter;
ir_nodeset_iterator_init(&iter, nodeset);
return ir_nodeset_iterator_next(&iter);
return ir_nodeset_first(nodeset);
}
/**
......
......@@ -55,10 +55,7 @@ static ir_node *trivial_select(void *block_env, ir_nodeset_t *ready_set)
}
/* at last: schedule branches */
ir_nodeset_iterator_init(&iter, ready_set);
irn = ir_nodeset_iterator_next(&iter);
return irn;
return ir_nodeset_first(ready_set);
}
static void *trivial_init_graph(ir_graph *irg)
......
......@@ -157,6 +157,13 @@ ir_node *ir_nodeset_iterator_next(ir_nodeset_iterator_t *iterator);
void ir_nodeset_remove_iterator(ir_nodeset_t *nodeset,
const ir_nodeset_iterator_t *iterator);
static inline ir_node *ir_nodeset_first(ir_nodeset_t const *const nodeset)
{
ir_nodeset_iterator_t iter;
ir_nodeset_iterator_init(&iter, nodeset);
return ir_nodeset_iterator_next(&iter);
}
#define foreach_ir_nodeset(nodeset, irn, iter) \
for(ir_nodeset_iterator_init(&iter, nodeset), \
irn = ir_nodeset_iterator_next(&iter); \
......
......@@ -210,8 +210,7 @@ static void walker(ir_node *proj, void *env)
n = ir_nodeset_size(&pi.this_mem);
if (n == 1) {
ir_nodeset_iterator_init(&iter, &pi.this_mem);
sync = ir_nodeset_iterator_next(&iter);
sync = ir_nodeset_first(&pi.this_mem);
} else {
in = XMALLOCN(ir_node*, n);
i = 0;
......
Supports Markdown
0% or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment