diff options
author | Martin Liska <mliska@suse.cz> | 2014-06-04 13:11:09 +0200 |
---|---|---|
committer | Martin Liska <marxin@gcc.gnu.org> | 2014-06-04 11:11:09 +0000 |
commit | 8be2dc8cb24d93b16176d3bb049482c10cf6ed54 (patch) | |
tree | e78a59bd8a8cf8a4b394d41bfb4d7e3327aeb3cc /gcc/cgraphunit.c | |
parent | 9dc7743c7864cbdc0f62a827c9af6a854ebfa98f (diff) | |
download | gcc-8be2dc8cb24d93b16176d3bb049482c10cf6ed54.zip gcc-8be2dc8cb24d93b16176d3bb049482c10cf6ed54.tar.gz gcc-8be2dc8cb24d93b16176d3bb049482c10cf6ed54.tar.bz2 |
New callgraph wrapper function creation added
* cgraph.h (cgraph_make_wrapper): New function introduced.
* cgraphunit.c (cgraph_make_wrapper): The function implementation.
* ipa-inline.h (inline_analyze_function): The function is global.
* ipa-inline-analysis.c (inline_analyze_function): Likewise.
From-SVN: r211222
Diffstat (limited to 'gcc/cgraphunit.c')
-rw-r--r-- | gcc/cgraphunit.c | 36 |
1 files changed, 36 insertions, 0 deletions
diff --git a/gcc/cgraphunit.c b/gcc/cgraphunit.c index 55bf378..7b40583 100644 --- a/gcc/cgraphunit.c +++ b/gcc/cgraphunit.c @@ -2344,5 +2344,41 @@ finalize_compilation_unit (void) timevar_pop (TV_CGRAPH); } +/* Creates a wrapper from SOURCE node to TARGET node. Thunk is used for this + kind of wrapper method. */ + +void +cgraph_make_wrapper (struct cgraph_node *source, struct cgraph_node *target) +{ + /* Preserve DECL_RESULT so we get right by reference flag. */ + tree decl_result = DECL_RESULT (source->decl); + + /* Remove the function's body. */ + cgraph_release_function_body (source); + cgraph_reset_node (source); + + DECL_RESULT (source->decl) = decl_result; + DECL_INITIAL (source->decl) = NULL; + allocate_struct_function (source->decl, false); + set_cfun (NULL); + + /* Turn alias into thunk and expand it into GIMPLE representation. */ + source->definition = true; + source->thunk.thunk_p = true; + source->thunk.this_adjusting = false; + + struct cgraph_edge *e = cgraph_create_edge (source, target, NULL, 0, + CGRAPH_FREQ_BASE); + + if (!expand_thunk (source, false, true)) + source->analyzed = true; + + e->call_stmt_cannot_inline_p = true; + + /* Inline summary set-up. */ + + analyze_function (source); + inline_analyze_function (source); +} #include "gt-cgraphunit.h" |