- for (i = 1; i <= PTR_TO_INT(bl->out[0]); ++i)
- if (get_irn_mode(bl->out[i]) == mode_X) {
- /* ignore End if we are in the Endblock */
- if (get_irn_op(bl->out[i]) == op_End &&
- get_irn_n(bl->out[i], -1) == bl)
- continue;
- if (out_pos == pos) {
- ir_node *cfop = bl->out[i];
- /* handle keep-alive here */
- if (get_irn_op(cfop) == op_End)
- return get_irn_n(cfop, -1);
- return cfop->out[1];
- } else
- ++out_pos;
+ for (i = 1; i <= PTR_TO_INT(bl->out[0]); ++i) {
+ ir_node *succ = bl->out[i];
+ if (get_irn_mode(succ) == mode_X) {
+ if (get_irn_op(succ) == op_End) {
+ if (get_irn_n(succ, -1) == bl) {
+ /* ignore End if we are in the Endblock */
+ continue;
+ }
+ if (pos == 0) {
+ /* handle keep-alive here: return the Endblock instead of the End node */
+ return get_irn_n(succ, -1);
+ } else
+ --pos;
+ } else {
+ n_outs = PTR_TO_INT(succ->out[0]);
+ if (pos < n_outs)
+ return succ->out[pos + 1];
+ else
+ pos -= n_outs;
+ }