aboutsummaryrefslogtreecommitdiff
path: root/gcc/cgraph.c
diff options
context:
space:
mode:
authorJan Hubicka <hubicka@ucw.cz>2014-09-25 03:48:34 +0200
committerJan Hubicka <hubicka@gcc.gnu.org>2014-09-25 01:48:34 +0000
commitba3923391e896c0efdfcd49eb0334525ed8bd2c0 (patch)
treed4102419e20affeb7736989b54eabee0db65012a /gcc/cgraph.c
parent20149bd284864c06f0051f50d73ff50be46505f8 (diff)
downloadgcc-ba3923391e896c0efdfcd49eb0334525ed8bd2c0.zip
gcc-ba3923391e896c0efdfcd49eb0334525ed8bd2c0.tar.gz
gcc-ba3923391e896c0efdfcd49eb0334525ed8bd2c0.tar.bz2
cgraph.h (class ipa_polymorphic_call_context): Move here from ipa-utils.h; add stream_int and stream_out methods.
* cgraph.h (class ipa_polymorphic_call_context): Move here from ipa-utils.h; add stream_int and stream_out methods. (cgraph_indirect_call_info): Remove SPECILATIVE_OFFSET, OUTER_TYPE, SPECULATIVE_OUTER_TYPE, MAYBE_IN_CONSTRUCTION MAYBE_DERIVED_TYPE and SPECULATIEVE_MAYBE_DERIVED_TYPE; add CONTEXT. (ipa_polymorphic_call_context::ipa_polymorphic_call_context, ipa_polymorphic_call_context::ipa_polymorphic_call_context, ipa_polymorphic_call_context::clear_speculation, ipa_polymorphic_call_context::clear_outer_type): Move here from ipa-utils.h * ipa-utils.h (class ipa_polymorphic_call_context): Move to cgraph.h (ipa_polymorphic_call_context::ipa_polymorphic_call_context, ipa_polymorphic_call_context::ipa_polymorphic_call_context, ipa_polymorphic_call_context::clear_speculation, ipa_polymorphic_call_context::clear_outer_type): Likewise. * ipa-devirt.c: Include data-streamer.h, lto-streamer.h and streamer-hooks.h (ipa_polymorphic_call_context::stream_out): New method. (ipa_polymorphic_call_context::stream_in): New method. (noncall_stmt_may_be_vtbl_ptr_store): Add forgotten static. * ipa-prop.c (ipa_analyze_indirect_call_uses): Do not care about OUTER_TYPE. (ipa_analyze_call_uses): Simplify. (update_indirect_edges_after_inlining): Do not care about outer_type. (ipa_write_indirect_edge_info): Update. (ipa_write_indirect_edge_info): Likewise. * cgraph.c (cgraph_node::create_indirect_edge): Simplify. (dump_edge_flags): Break out from ... (cgraph_node::dump): ... here; dump indirect edges. From-SVN: r215575
Diffstat (limited to 'gcc/cgraph.c')
-rw-r--r--gcc/cgraph.c89
1 files changed, 46 insertions, 43 deletions
diff --git a/gcc/cgraph.c b/gcc/cgraph.c
index 8f04284..1cfc783 100644
--- a/gcc/cgraph.c
+++ b/gcc/cgraph.c
@@ -893,16 +893,7 @@ cgraph_node::create_indirect_edge (gimple call_stmt, int ecf_flags,
= tree_to_uhwi (OBJ_TYPE_REF_TOKEN (target));
edge->indirect_info->otr_type = obj_type_ref_class (target);
gcc_assert (TREE_CODE (edge->indirect_info->otr_type) == RECORD_TYPE);
- edge->indirect_info->outer_type = context.outer_type;
- edge->indirect_info->speculative_outer_type
- = context.speculative_outer_type;
- edge->indirect_info->offset = context.offset;
- edge->indirect_info->speculative_offset = context.speculative_offset;
- edge->indirect_info->maybe_in_construction
- = context.maybe_in_construction;
- edge->indirect_info->maybe_derived_type = context.maybe_derived_type;
- edge->indirect_info->speculative_maybe_derived_type
- = context.speculative_maybe_derived_type;
+ edge->indirect_info->context = context;
}
edge->next_callee = indirect_calls;
@@ -1851,6 +1842,26 @@ cgraph_inline_failed_type (cgraph_inline_failed_t reason)
const char * const cgraph_availability_names[] =
{"unset", "not_available", "overwritable", "available", "local"};
+/* Output flags of edge E. */
+
+static void
+dump_edge_flags (FILE *f, struct cgraph_edge *edge)
+{
+ if (edge->speculative)
+ fprintf (f, "(speculative) ");
+ if (!edge->inline_failed)
+ fprintf (f, "(inlined) ");
+ if (edge->indirect_inlining_edge)
+ fprintf (f, "(indirect_inlining) ");
+ if (edge->count)
+ fprintf (f, "(%"PRId64"x) ",
+ (int64_t)edge->count);
+ if (edge->frequency)
+ fprintf (f, "(%.2f per call) ",
+ edge->frequency / (double)CGRAPH_FREQ_BASE);
+ if (edge->can_throw_external)
+ fprintf (f, "(can throw external) ");
+}
/* Dump call graph node to file F. */
@@ -1858,7 +1869,6 @@ void
cgraph_node::dump (FILE *f)
{
cgraph_edge *edge;
- int indirect_calls_count = 0;
dump_base (f);
@@ -1937,20 +1947,7 @@ cgraph_node::dump (FILE *f)
{
fprintf (f, "%s/%i ", edge->caller->asm_name (),
edge->caller->order);
- if (count)
- fprintf (f, "(%"PRId64"x) ",
- (int64_t)count);
- if (frequency)
- fprintf (f, "(%.2f per call) ",
- frequency / (double)CGRAPH_FREQ_BASE);
- if (edge->speculative)
- fprintf (f, "(speculative) ");
- if (!edge->inline_failed)
- fprintf (f, "(inlined) ");
- if (edge->indirect_inlining_edge)
- fprintf (f, "(indirect_inlining) ");
- if (edge->can_throw_external)
- fprintf (f, "(can throw external) ");
+ dump_edge_flags (f, edge);
}
fprintf (f, "\n Calls: ");
@@ -1958,28 +1955,34 @@ cgraph_node::dump (FILE *f)
{
fprintf (f, "%s/%i ", edge->callee->asm_name (),
edge->callee->order);
- if (edge->speculative)
- fprintf (f, "(speculative) ");
- if (!edge->inline_failed)
- fprintf (f, "(inlined) ");
- if (edge->indirect_inlining_edge)
- fprintf (f, "(indirect_inlining) ");
- if (edge->count)
- fprintf (f, "(%"PRId64"x) ",
- (int64_t)count);
- if (edge->frequency)
- fprintf (f, "(%.2f per call) ",
- frequency / (double)CGRAPH_FREQ_BASE);
- if (edge->can_throw_external)
- fprintf (f, "(can throw external) ");
+ dump_edge_flags (f, edge);
}
fprintf (f, "\n");
for (edge = indirect_calls; edge; edge = edge->next_callee)
- indirect_calls_count++;
- if (indirect_calls_count)
- fprintf (f, " Has %i outgoing edges for indirect calls.\n",
- indirect_calls_count);
+ {
+ if (edge->indirect_info->polymorphic)
+ {
+ fprintf (f, " Polymorphic indirect call of type ");
+ print_generic_expr (f, edge->indirect_info->otr_type, TDF_SLIM);
+ fprintf (f, " token:%i", (int) edge->indirect_info->otr_token);
+ }
+ else
+ fprintf (f, " Indirect call");
+ dump_edge_flags (f, edge);
+ if (edge->indirect_info->param_index != -1)
+ {
+ fprintf (f, " of param:%i", edge->indirect_info->param_index);
+ if (edge->indirect_info->agg_contents)
+ fprintf (f, " loaded from %s %s at offset %i",
+ edge->indirect_info->member_ptr ? "member ptr" : "aggregate",
+ edge->indirect_info->by_ref ? "passed by reference":"",
+ (int)edge->indirect_info->offset);
+ }
+ fprintf (f, "\n");
+ if (edge->indirect_info->polymorphic)
+ edge->indirect_info->context.dump (f);
+ }
}
/* Dump call graph node NODE to stderr. */