diff options
author | Jan Hubicka <jh@suse.cz> | 2013-08-18 11:22:42 +0200 |
---|---|---|
committer | Jan Hubicka <hubicka@gcc.gnu.org> | 2013-08-18 09:22:42 +0000 |
commit | 1d5755efee57268b43d8fbf38c10cbdbf0a0dd04 (patch) | |
tree | e1a133f48c521b91466f3bcd74ce9eba66d5faa6 /gcc/cgraph.c | |
parent | 34fdd6b31e8b715b2dfb1490b7c77b4eddacc8df (diff) | |
download | gcc-1d5755efee57268b43d8fbf38c10cbdbf0a0dd04.zip gcc-1d5755efee57268b43d8fbf38c10cbdbf0a0dd04.tar.gz gcc-1d5755efee57268b43d8fbf38c10cbdbf0a0dd04.tar.bz2 |
cgraph.c (cgraph_create_indirect_edge): Discover polymorphic calls and record basic info into indirect_info.
* cgraph.c (cgraph_create_indirect_edge): Discover
polymorphic calls and record basic info into indirect_info.
* gimple-fold.c (gimple_fold_call): When doing BINFO based
devirtualization, ignore objc function calls.
* ipa-cp.c (initialize_node_lattices): Be ready for polymorphic
call with no parm index info.
* ipa-prop.c (ipa_analyze_call_uses): Likewise.
* tree.c (virtual_method_call_p): New function.
* tree.h (virtual_method_call_p): Declare.
From-SVN: r201824
Diffstat (limited to 'gcc/cgraph.c')
-rw-r--r-- | gcc/cgraph.c | 18 |
1 files changed, 18 insertions, 0 deletions
diff --git a/gcc/cgraph.c b/gcc/cgraph.c index a939ae8..e2f96d6 100644 --- a/gcc/cgraph.c +++ b/gcc/cgraph.c @@ -925,6 +925,7 @@ cgraph_create_indirect_edge (struct cgraph_node *caller, gimple call_stmt, { struct cgraph_edge *edge = cgraph_create_edge_1 (caller, NULL, call_stmt, count, freq); + tree target; edge->indirect_unknown_callee = 1; initialize_inline_failed (edge); @@ -932,6 +933,23 @@ cgraph_create_indirect_edge (struct cgraph_node *caller, gimple call_stmt, edge->indirect_info = cgraph_allocate_init_indirect_info (); edge->indirect_info->ecf_flags = ecf_flags; + /* Record polymorphic call info. */ + if (call_stmt + && (target = gimple_call_fn (call_stmt)) + && virtual_method_call_p (target)) + { + tree type = obj_type_ref_class (target); + + + /* Only record types can have virtual calls. */ + gcc_assert (TREE_CODE (type) == RECORD_TYPE); + edge->indirect_info->param_index = -1; + edge->indirect_info->otr_token + = tree_low_cst (OBJ_TYPE_REF_TOKEN (target), 1); + edge->indirect_info->otr_type = type; + edge->indirect_info->polymorphic = 1; + } + edge->next_callee = caller->indirect_calls; if (caller->indirect_calls) caller->indirect_calls->prev_callee = edge; |