- ir_extblk *extbb = get_Block_extbb(block);
- env_t *env = ctx;
- ir_extblk *sentinel = &_sentinel;
-
- if (! extbb) {
- ir_node *curr, *prev;
-
- /*
- * Search the leader. It can happen, that we fall into an endless
- * loop, because we enter an unreachable loop that is not yet detected.
- * We break the loop using a sentinel.
- */
- for (curr = block; !extbb; curr = prev) {
- prev = get_Block_cfgpred_block(curr, 0);
- extbb = get_Block_extbb(prev);
- set_Block_extbb(curr, sentinel);
- }
-
- if (extbb == sentinel) {
- /* We detect a dead loop. We fix this by allocating an
- * special Extended block
- */
- ir_printf("Dead loop detected starting with %+F::%+F\n", get_irg_entity(current_ir_graph), block);
-
- allocate_extblk(block, env);
- extbb = get_Block_extbb(block);
- set_Block_extbb(block, sentinel);
- }
-
- /* replace all sentinels by the extbb info */
- prev = block;
- while (1) {
- if (get_Block_extbb(prev) != sentinel)
- break;
- set_Block_extbb(prev, extbb);
+ ir_extblk *extbb = get_Block_extbb(block);
+ env_t *env = (env_t*) ctx;
+ ir_extblk *sentinel = &_sentinel;
+
+ if (! extbb) {
+ ir_node *curr, *prev, *list;
+
+ /*
+ * Search the leader. It can happen, that we fall into an endless
+ * loop, because we enter an unreachable loop that is not yet detected.
+ * We break the loop using a sentinel.
+ */
+ for (curr = block; !extbb; curr = prev) {
+ prev = get_Block_cfgpred_block(curr, 0);
+ extbb = get_Block_extbb(prev);
+ set_Block_extbb(curr, sentinel);
+ }
+
+ if (extbb == sentinel) {
+ /* We detect a dead loop. We fix this by allocating a
+ * special Extended block
+ */
+ ir_printf("Dead loop detected starting with %+F::%+F\n", get_irg_entity(current_ir_graph), block);
+
+ allocate_extblk(block, env);
+ extbb = get_Block_extbb(block);
+ set_Block_extbb(block, sentinel);
+ }
+
+ /* replace all sentinels by the extbb info */
+ prev = block;
+ list = NULL;
+ for (;;) {
+ if (get_Block_extbb(prev) != sentinel)
+ break;
+ set_irn_link(prev, list);
+ list = prev;
+ prev = get_Block_cfgpred_block(prev, 0);
+ }
+ /* arg, the list is in wrong order, turn around and add to the extbb list */
+ for (curr = list; curr; curr = prev) {
+ prev = (ir_node*) get_irn_link(curr);
+ set_irn_link(curr, extbb->link);
+ extbb->link = curr;
+ set_Block_extbb(curr, extbb);