void be_liveness_nodes_live_before(be_lv_t const *const lv, arch_register_class_t const *const cls, ir_node const *const pos, ir_nodeset_t *const live)
{
- ir_node const *const bl = get_nodes_block(pos);
+ ir_node *const bl = get_nodes_block(pos);
be_liveness_end_of_block(lv, cls, bl, live);
sched_foreach_reverse(bl, irn) {
be_liveness_transfer(cls, irn, live);
* the former dead operand would be live now at the point of
* the Perm, increasing the register pressure by one.
*/
- sched_foreach_reverse_from(sched_prev(perm), irn) {
+ sched_foreach_reverse_before(perm, irn) {
be_foreach_use(irn, cls, in_req_, op, op_req_,
if (!be_values_interfere(lv, op, one_proj)) {
frontier = irn;
be_liveness_end_of_block(lv, cls, block, &live_nodes);
/* check should be same constraints */
- ir_node *last_phi = NULL;
sched_foreach_reverse(block, node) {
- if (is_Phi(node)) {
- last_phi = node;
+ if (is_Phi(node))
break;
- }
be_foreach_definition(node, cls, value, req,
congruence_def(&live_nodes, value, req);
);
be_liveness_transfer(cls, node, &live_nodes);
}
- if (!last_phi) {
- ir_nodeset_destroy(&live_nodes);
- return;
- }
/* check phi congruence classes */
- sched_foreach_reverse_from(last_phi, phi) {
- assert(is_Phi(phi));
+ sched_foreach(block, phi) {
+ if (!is_Phi(phi))
+ break;
if (!arch_irn_consider_in_reg_alloc(cls, phi))
continue;
#define sched_foreach_after(after, irn) \
for (ir_node *irn = (after); !sched_is_end(irn = sched_next(irn));)
-#define sched_foreach_reverse_from(from, irn) \
- for (ir_node *irn = from; !sched_is_begin(irn); irn = sched_prev(irn))
+#define sched_foreach_reverse_before(before, irn) \
+ for (ir_node *irn = (before); !sched_is_begin(irn = sched_prev(irn));)
/**
* A shorthand macro for iterating over a schedule.
* @param irn A ir node pointer used as an iterator.
*/
#define sched_foreach_reverse(block,irn) \
- sched_foreach_reverse_from(sched_last(block), irn)
+ sched_foreach_reverse_before((assert(is_Block(block)), block), irn)
/**
* Type for a function scheduling a graph
return;
/* check if this return is the first on the block */
- sched_foreach_reverse_from(node, irn) {
+ sched_foreach_reverse_before(node, irn) {
switch (get_irn_opcode(irn)) {
- case beo_Return:
- /* the return node itself, ignore */
- continue;
case iro_Start:
case beo_Start:
/* ignore no code generated */
}
unsigned tries = 0;
- sched_foreach_reverse_from(sched_prev(node), schedpoint) {
+ sched_foreach_reverse_before(node, schedpoint) {
if (has_delay_slot(schedpoint))
break;
if (tries++ >= PICK_DELAY_SLOT_MAX_DISTANCE)
static void finish_sparc_Return(ir_node *node)
{
/* Ensure that the restore is directly before the return. */
- sched_foreach_reverse_from(sched_prev(node), restore) {
+ sched_foreach_reverse_before(node, restore) {
if (is_sparc_Restore(restore) || is_sparc_RestoreZero(restore)) {
sched_remove(restore);
sched_add_before(node, restore);