+/* Access predecessor n, honor keep-alives. */
+ir_node *get_Block_cfg_out_ka(ir_node *bl, int pos) {
+ int i, out_pos = 0;
+ assert(bl && is_Block(bl));
+#ifdef DEBUG_libfirm
+ assert (bl->out_valid);
+#endif /* defined DEBUG_libfirm */
+ 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++;
+ }
+ return NULL;
+}
+