static bool
decide_is_function_needed (struct cgraph_node *node, tree decl)
{
- struct cgraph_node *origin;
+ tree origin;
/* If we decided it was needed before, but at the time we didn't have
the body of the function available, then it's still needed. We have
return false;
/* Nested functions of extern inline function shall not be emit unless
we inlined the origin. */
- for (origin = node->origin; origin; origin = origin->origin)
- if (DECL_EXTERNAL (origin->decl))
+ for (origin = decl_function_context (decl); origin;
+ origin = decl_function_context (origin))
+ if (DECL_EXTERNAL (origin))
return false;
/* We want to emit COMDAT functions only when absolutely necessary. */
if (DECL_COMDAT (decl))
convert_UIDs_in_bitmap (bitmap in_ann, bitmap in_decl)
{
int index;
- EXECUTE_IF_SET_IN_BITMAP(in_decl, 0, index,
- {
- splay_tree_node n =
- splay_tree_lookup (static_vars_to_consider_by_uid, index);
- if (n != NULL)
- {
- tree t = (tree)n->value;
- var_ann_t va = var_ann (t);
- if (va)
- bitmap_set_bit(in_ann, va->uid);
- }
- });
+ bitmap_iterator bi;
+
+ EXECUTE_IF_SET_IN_BITMAP(in_decl, 0, index, bi)
+ {
+ splay_tree_node n =
+ splay_tree_lookup (static_vars_to_consider_by_uid, index);
+ if (n != NULL)
+ {
+ tree t = (tree)n->value;
+ var_ann_t va = var_ann (t);
+ if (va)
+ bitmap_set_bit(in_ann, va->uid);
+ }
+ }
}
/* FIXME -- PROFILE-RESTRUCTURE: Delete all stmts initing *_decl_uid
notice_global_symbol (decl);
node->decl = decl;
node->local.finalized = true;
+ if (node->nested)
+ lower_nested_functions (decl);
+ gcc_assert (!node->nested);
/* If not unit at a time, then we need to create the call graph
now, so that called functions can be queued and emitted now. */
default:
/* Save some cycles by not walking types and declaration as we
won't find anything useful there anyway. */
- if (DECL_P (*tp) || TYPE_P (*tp))
+ if (IS_TYPE_OR_DECL_P (*tp))
{
*walk_subtrees = 0;
break;
/* Save some cycles by not walking types and declaration as we
won't find anything useful there anyway. */
- if (DECL_P (*tp) || TYPE_P (*tp))
+ if (IS_TYPE_OR_DECL_P (*tp))
*walk_subtrees = 0;
return NULL_TREE;
check_lhs_var (fn, TREE_OPERAND (t, 0));
/* Next check the operands on the rhs to see if they are ok. */
switch (TREE_CODE_CLASS (TREE_CODE (rhs))) {
- case '2':
+ case tcc_binary:
check_rhs_var (fn, TREE_OPERAND (rhs, 0));
check_rhs_var (fn, TREE_OPERAND (rhs, 1));
break;
- case '1':
- case 'r':
+ case tcc_unary:
+ case tcc_reference:
check_rhs_var (fn, TREE_OPERAND (rhs, 0));
break;
- case 'd':
+ case tcc_declaration:
check_rhs_var (fn, rhs);
break;
- case 'e':
+ case tcc_expression:
switch (TREE_CODE (rhs)) {
case ADDR_EXPR:
check_rhs_var (fn, rhs);
(i.e. have there address taken). */
{
int index;
- EXECUTE_IF_SET_IN_BITMAP (module_statics_escape,
- 0, index, clear_static_vars_maps (index));
+ bitmap_iterator bi;
+
+ EXECUTE_IF_SET_IN_BITMAP (module_statics_escape, 0, index, bi)
+ {
+ clear_static_vars_maps (index);
+ }
bitmap_operation (all_module_statics, all_module_statics,
module_statics_escape, BITMAP_AND_COMPL);
{
int index;
local_static_vars_info_t l;
+ bitmap_iterator bi;
+
node = order[i];
l = node->static_vars_info->local;
fprintf (cgraph_dump_file,
cgraph_node_name (node), node->uid);
fprintf (cgraph_dump_file, "\n locals read: ");
EXECUTE_IF_SET_IN_BITMAP (l->statics_read_by_decl_uid,
- 0, index,
- fprintf (cgraph_dump_file, "%s ",
- cgraph_get_static_name_by_uid (index)));
+ 0, index, bi)
+ {
+ fprintf (cgraph_dump_file, "%s ",
+ cgraph_get_static_name_by_uid (index));
+ }
fprintf (cgraph_dump_file, "\n locals written: ");
EXECUTE_IF_SET_IN_BITMAP (l->statics_written_by_decl_uid,
- 0, index,
- fprintf(cgraph_dump_file, "%s ",
- cgraph_get_static_name_by_uid (index)));
+ 0, index, bi)
+ {
+ fprintf(cgraph_dump_file, "%s ",
+ cgraph_get_static_name_by_uid (index));
+ }
}
}
static_vars_info_t node_info;
global_static_vars_info_t node_g;
int index;
+ bitmap_iterator bi;
+
node = order[i];
node_info = node->static_vars_info;
node_g = node_info->global;
}
fprintf (cgraph_dump_file, "\n globals read: ");
EXECUTE_IF_SET_IN_BITMAP (node_g->statics_read_by_decl_uid,
- 0, index,
- fprintf (cgraph_dump_file, "%s ",
- cgraph_get_static_name_by_uid (index)));
+ 0, index, bi)
+ {
+ fprintf (cgraph_dump_file, "%s ",
+ cgraph_get_static_name_by_uid (index));
+ }
fprintf (cgraph_dump_file, "\n globals written: ");
EXECUTE_IF_SET_IN_BITMAP (node_g->statics_written_by_decl_uid,
- 0, index,
- fprintf (cgraph_dump_file, "%s ",
- cgraph_get_static_name_by_uid (index)));
+ 0, index, bi)
+ {
+ fprintf (cgraph_dump_file, "%s ",
+ cgraph_get_static_name_by_uid (index));
+ }
}
}
/* ??? We will get called LATE in the compilation process. */
if (cgraph_global_info_ready)
- tree_rest_of_compilation (decl, false);
+ tree_rest_of_compilation (decl);
else
cgraph_finalize_function (decl, 0);