tree_stmt_iterator i;
tree t, x;
- if (TREE_CODE (bind) != BIND_EXPR)
- abort ();
+ gcc_assert (TREE_CODE (bind) == BIND_EXPR);
data.block = DECL_INITIAL (current_function_decl);
BLOCK_SUBBLOCKS (data.block) = NULL_TREE;
tsi_link_after (&i, x, TSI_CONTINUE_LINKING);
}
- if (data.block != DECL_INITIAL (current_function_decl))
- abort ();
+ gcc_assert (data.block == DECL_INITIAL (current_function_decl));
BLOCK_SUBBLOCKS (data.block)
= blocks_nreverse (BLOCK_SUBBLOCKS (data.block));
PROP_gimple_lcf, /* properties_provided */
PROP_gimple_any, /* properties_destroyed */
0, /* todo_flags_start */
- TODO_dump_func /* todo_flags_finish */
+ TODO_dump_func, /* todo_flags_finish */
+ 0 /* letter */
};
break;
default:
+#ifdef ENABLE_CHECKING
print_node_brief (stderr, "", stmt, 0);
+ internal_error ("unexpected node");
+#endif
case COMPOUND_EXPR:
- abort ();
+ gcc_unreachable ();
}
tsi_next (tsi);
/* The outermost block of the original function may not be the
outermost statement chain of the gimplified function. So we
may see the outermost block just inside the function. */
- if (new_block != DECL_INITIAL (current_function_decl))
- abort ();
+ gcc_assert (new_block == DECL_INITIAL (current_function_decl));
new_block = NULL;
}
else
{
/* We do not expect to handle duplicate blocks. */
- if (TREE_ASM_WRITTEN (new_block))
- abort ();
+ gcc_assert (!TREE_ASM_WRITTEN (new_block));
TREE_ASM_WRITTEN (new_block) = 1;
/* Block tree may get clobbered by inlining. Normally this would
if (new_block)
{
- if (data->block != new_block)
- abort ();
+ gcc_assert (data->block == new_block);
BLOCK_SUBBLOCKS (new_block)
= blocks_nreverse (BLOCK_SUBBLOCKS (new_block));
0, /* properties_provided */
0, /* properties_destroyed */
0, /* todo_flags_start */
- TODO_dump_func /* todo_flags_finish */
+ TODO_dump_func, /* todo_flags_finish */
+ 0 /* letter */
+};
+
+/* Mark BLOCK used if it has a used variable in it, then recurse over its
+ subblocks. */
+
+static void
+mark_blocks_with_used_vars (tree block)
+{
+ tree var;
+ tree subblock;
+
+ if (!TREE_USED (block))
+ {
+ for (var = BLOCK_VARS (block);
+ var;
+ var = TREE_CHAIN (var))
+ {
+ if (TREE_USED (var))
+ {
+ TREE_USED (block) = true;
+ break;
+ }
+ }
+ }
+ for (subblock = BLOCK_SUBBLOCKS (block);
+ subblock;
+ subblock = BLOCK_CHAIN (subblock))
+ mark_blocks_with_used_vars (subblock);
+}
+
+/* Mark the used attribute on blocks correctly. */
+
+static void
+mark_used_blocks (void)
+{
+ mark_blocks_with_used_vars (DECL_INITIAL (current_function_decl));
+}
+
+
+struct tree_opt_pass pass_mark_used_blocks =
+{
+ "blocks", /* name */
+ NULL, /* gate */
+ mark_used_blocks, /* execute */
+ NULL, /* sub */
+ NULL, /* next */
+ 0, /* static_pass_number */
+ 0, /* tv_id */
+ 0, /* properties_required */
+ 0, /* properties_provided */
+ 0, /* properties_destroyed */
+ 0, /* todo_flags_start */
+ TODO_dump_func, /* todo_flags_finish */
+ 0 /* letter */
};