diff options
author | hubicka <hubicka@138bc75d-0d04-0410-961f-82ee72b054a4> | 2013-08-18 09:22:42 +0000 |
---|---|---|
committer | hubicka <hubicka@138bc75d-0d04-0410-961f-82ee72b054a4> | 2013-08-18 09:22:42 +0000 |
commit | f5e35fedc7811592de814876a85a548cb2f22934 (patch) | |
tree | e1a133f48c521b91466f3bcd74ce9eba66d5faa6 /gcc/cgraph.c | |
parent | 89f4f2554ec0d99b9c6828757ba949c08e2b209a (diff) | |
download | gcc-f5e35fedc7811592de814876a85a548cb2f22934.tar.gz |
* 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.
git-svn-id: svn+ssh://gcc.gnu.org/svn/gcc/trunk@201824 138bc75d-0d04-0410-961f-82ee72b054a4
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 a939ae83484..e2f96d6436d 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; |