+2008-05-15 Kenneth Zadeck <zadeck@naturalbridge.com>
+
+ * cgraph.h (compute_inline_parameters): Made public.
+ * tree-pass.h (ipa_opt_pass): Removed function_generate_summary,
+ variable_generate_summary, function_write_summary,
+ variable_write_summary, variable_read_summary. Added
+ generate_summary, write_summary, read_summary.
+ * cgraphunit.c (cgraph_process_new_functions): Changed call from
+ pass_ipa_inline.function_generate_summary, to
+ compute_inline_parameters.
+ * ipa-inline.c (compute_inline_parameters): Made public and added
+ node parameter.
+ (compute_inline_parameters_for_current): New function.
+ (pass_inline_param): Now calls
+ compute_inline_parameters_for_current.
+ (inline_generate_summary): Removed parameter and made to loop over
+ all cgraph nodes.
+ (pass_ipa_inline): Updated for new IPA_PASS structure.
+ * passes.c (execute_ipa_summary_passes): Now is called once per
+ pass rather than once per node*pass.
+
2008-05-15 Anatoly Sokolov <aesok@post.ru>
* config/avr/avr.c (avr_base_arch_macro, avr_have_movw_lpmx_p,
void cgraph_clone_inlined_nodes (struct cgraph_edge *, bool, bool);
void cgraph_mark_inline_edge (struct cgraph_edge *, bool);
bool cgraph_default_inline_p (struct cgraph_node *, const char **);
+unsigned int compute_inline_parameters (struct cgraph_node *);
/* Create a new static variable of type TYPE. */
cgraph_analyze_function (node);
push_cfun (DECL_STRUCT_FUNCTION (fndecl));
current_function_decl = fndecl;
- pass_ipa_inline.function_generate_summary (node);
+ compute_inline_parameters (node);
if ((cgraph_state == CGRAPH_STATE_IPA_SSA
&& !gimple_in_ssa_p (DECL_STRUCT_FUNCTION (fndecl)))
/* When not optimizing, be sure we run early local passes anyway
};
/* Compute parameters of functions used by inliner. */
-static unsigned int
-compute_inline_parameters (void)
+unsigned int
+compute_inline_parameters (struct cgraph_node *node)
{
- struct cgraph_node *node = cgraph_node (current_function_decl);
-
gcc_assert (!node->global.inlined_to);
inline_summary (node)->estimated_self_stack_size
= estimated_stack_frame_size ();
return 0;
}
+
+/* Compute parameters of functions used by inliner using
+ current_function_decl. */
+static unsigned int
+compute_inline_parameters_for_current (void)
+{
+ compute_inline_parameters (cgraph_node (current_function_decl));
+ return 0;
+}
+
/* When inlining shall be performed. */
static bool
gate_inline_passes (void)
GIMPLE_PASS,
NULL, /* name */
gate_inline_passes, /* gate */
- compute_inline_parameters, /* execute */
+ compute_inline_parameters_for_current,/* execute */
NULL, /* sub */
NULL, /* next */
0, /* static_pass_number */
/* Note function body size. */
static void
-inline_generate_summary (struct cgraph_node *node ATTRIBUTE_UNUSED)
+inline_generate_summary (void)
{
- compute_inline_parameters ();
+ struct cgraph_node **order =
+ XCNEWVEC (struct cgraph_node *, cgraph_n_nodes);
+ int nnodes = cgraph_postorder (order);
+ int i;
+
+ for (i = nnodes - 1; i >= 0; i--)
+ {
+ struct cgraph_node *node = order[i];
+
+ /* Allow possibly removed nodes to be garbage collected. */
+ order[i] = NULL;
+ if (node->analyzed && (node->needed || node->reachable))
+ {
+ push_cfun (DECL_STRUCT_FUNCTION (node->decl));
+ current_function_decl = node->decl;
+ compute_inline_parameters (node);
+ pop_cfun ();
+ }
+ }
+
+ current_function_decl = NULL;
+ free (order);
return;
}
TODO_dump_cgraph | TODO_dump_func
| TODO_remove_functions /* todo_flags_finish */
},
- inline_generate_summary, /* function_generate_summary */
- NULL, /* variable_generate_summary */
- NULL, /* function_write_summary */
- NULL, /* variable_write_summary */
+ inline_generate_summary, /* generate_summary */
+ NULL, /* write_summary */
+ NULL, /* read_summary */
NULL, /* function_read_summary */
- NULL, /* variable_read_summary */
0, /* TODOs */
inline_transform, /* function_transform */
NULL, /* variable_transform */
VEC_safe_push (ipa_opt_pass, heap, cfun->ipa_transforms_to_apply, ipa_pass);
}
-/* Execute IPA pass function summary generation. DATA is pointer to
- pass list to execute. */
+/* Execute summary generation for all of the passes in IPA_PASS. */
static void
-execute_ipa_summary_passes (void *data)
+execute_ipa_summary_passes (struct ipa_opt_pass *ipa_pass)
{
- struct ipa_opt_pass *ipa_pass = (struct ipa_opt_pass *)data;
- struct cgraph_node *node = cgraph_node (cfun->decl);
- while (ipa_pass && ipa_pass->pass.type == IPA_PASS)
+ while (ipa_pass)
{
struct opt_pass *pass = &ipa_pass->pass;
- if (!pass->gate || pass->gate ())
+
+ /* Execute all of the IPA_PASSes in the list. */
+ if (ipa_pass->pass.type == IPA_PASS
+ && (!pass->gate || pass->gate ()))
{
pass_init_dump_file (pass);
- ipa_pass->function_generate_summary (node);
+ ipa_pass->generate_summary ();
pass_fini_dump_file (pass);
}
ipa_pass = (struct ipa_opt_pass *)ipa_pass->pass.next;
{
if (!quiet_flag && !cfun)
fprintf (stderr, " <summary generate>");
- do_per_function_toporder (execute_ipa_summary_passes, pass);
+ execute_ipa_summary_passes ((struct ipa_opt_pass *) pass);
}
summaries_generated = true;
}
{
struct opt_pass pass;
- /* IPA passes can analyze function body and variable initializers using this
- hook and produce summary. */
- void (*function_generate_summary) (struct cgraph_node *);
- void (*variable_generate_summary) (struct varpool_node *);
-
- /* These hooks will be used to serialize IPA summaries on disk. For a moment
- they are just placeholders. */
- void (*function_write_summary) (struct cgraph_node *);
- void (*variable_write_summary) (struct varpool_node *);
- void (*function_read_summary) (struct cgraph_node *);
- void (*variable_read_summary) (struct varpool_node *);
+ /* IPA passes can analyze function body and variable initializers
+ using this hook and produce summary. */
+ void (*generate_summary) (void);
+
+ /* This hook is used to serialize IPA summaries on disk. */
+ void (*write_summary) (void);
+ /* For most ipa passes, the information can only be deserialized in
+ one chunk. However, function bodies are read function at a time
+ as needed so both calls are necessary. */
+ void (*read_summary) (void);
+ void (*function_read_summary) (struct cgraph_node *);
+
/* Results of interprocedural propagation of an IPA pass is applied to
function body via this hook. */
unsigned int function_transform_todo_flags_start;
unsigned int (*function_transform) (struct cgraph_node *);
void (*variable_transform) (struct varpool_node *);
-
};
/* Description of simple IPA pass. Simple IPA passes have just one execute