gnu/gcc/6481867ae01355a2fbf296561daee9af0376f736 ipa: Implement a summary for callback edges
Currently in trunk, every edge contains a 16 bit field called
callback_id, which is used to link callback edges to their attributes,
from which all additional information is calculated as is needed.
This patch adds a new summary struct for callback edges, called
callback_info. It allows us to remove callback_id from the main class
and aggregate all relevant information, without having to recalculate it
every single time.
gcc/ChangeLog:
* Makefile.in: Add callback-info.o to OBJS.
* attr-callback.cc (callback_fetch_attr_by_edge): Use fn_idx
from the summary.
(callback_get_arg_mapping): Replaced by
callback_get_arg_mapping_from_attr and the summary field.
(callback_get_arg_mapping_from_attr): New function, parses the
attr and returns the computed argument mapping.
(callback_fetch_fn_position): Delete, obsoleted by the summary.
(callback_edge_useful_p): Check for the redirected flag in the
summary instead of cgraph_node fields.
* attr-callback.h (enum callback_position): Add comment.
(enum arg_mapping_constants): New enum, defines the identifier
for -1 in the arg_mapping vector.
(callback_get_arg_mapping): Delete.
(callback_fetch_fn_position): Delete.
(callback_get_arg_mapping_from_attr): Add decl.
* cgraph.cc (symbol_table::create_edge): Remove callback_id initializer.
(cgraph_edge::make_callback): Initialize the callback_info
summary, add necessary arguments.
(cgraph_edge::redirect_callee): Set the redirected flag when
redirecting a callback edge.
(cgraph_edge::redirect_call_stmt_to_callee): Use the summary.
(cgraph_node::verify_node): Remove callback_id checks.
(cgraph_cc_finalize): Free the summaries.
* cgraph.h: Remove callback_id from cgraph_edge, adjust decl of
cgraph_edge::make_callback.
* cgraphclones.cc (cgraph_edge::clone): Remove callback_id.
* ipa-cp.cc (ipcp_driver): Initialize the summary sum.
* ipa-prop.cc (ipa_compute_jump_functions_for_edge): Remove
callback_id, adjust call to make_callback, use the summary.
(ipa_analyze_node): Initialize the summary sum.
(ipa_register_cgraph_hooks): Likewise.
* lto-cgraph.cc (lto_output_edge): Remove callback_id, stream
out the summary.
(output_symtab): Initialize the summary sum.
(input_edge): Remove callback_id, stream in the summary.
(input_cgraph_1): Initialize the summary sum.
* callback-info.cc: New file.
* callback-info.h: New file.
Signed-off-by: Josef Melcr <josef.melcr@suse.com>
11 files changed