??? Move this to separate file after tree-ssa merge.
We separate inlining decisions from the inliner itself and store it
- inside callgraph as so called inline plan. Reffer to cgraph.c
+ inside callgraph as so called inline plan. Refer to cgraph.c
documentation about particular representation of inline plans in the
callgraph
/* Additionally this file gathers information about how local statics
- are used. This is done in cgraph_charactize_statics. After the
+ are used. This is done in cgraph_characterize_statics. After the
call graph has been built, each function is analyzed to determine
which local static variables are either read or written or have
their address taken. Any local static that has its address taken
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 to see if T is a read or address of operation on a static var
- we are interrested in analyzing. FN is passed in to get access to
+ we are interested in analyzing. FN is passed in to get access to
its bit vectors. */
static void
}
}
-/* Check to see if T is an assignement to a static var we are
+/* Check to see if T is an assignment to a static var we are
interrested in analyzing. FN is passed in to get access to its bit
vectors.
*/
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);
/* FIXME -- PROFILE-RESTRUCTURE: Change all *_decl_uid to *_ann_uid. */
/* Or in all of the bits from every callee into X, the caller's, bit
- vector. There are several cases to check to avoid the sparce
+ vector. There are several cases to check to avoid the sparse
bitmap oring. */
static void
cgraph_propagate_bits (struct cgraph_node *x)
(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);