aboutsummaryrefslogtreecommitdiff
path: root/gcc
diff options
context:
space:
mode:
authorMartin Liska <mliska@suse.cz>2014-06-04 13:11:09 +0200
committerMartin Liska <marxin@gcc.gnu.org>2014-06-04 11:11:09 +0000
commit8be2dc8cb24d93b16176d3bb049482c10cf6ed54 (patch)
treee78a59bd8a8cf8a4b394d41bfb4d7e3327aeb3cc /gcc
parent9dc7743c7864cbdc0f62a827c9af6a854ebfa98f (diff)
downloadgcc-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')
-rw-r--r--gcc/ChangeLog7
-rw-r--r--gcc/cgraph.h2
-rw-r--r--gcc/cgraphunit.c36
-rw-r--r--gcc/ipa-inline-analysis.c2
-rw-r--r--gcc/ipa-inline.h1
5 files changed, 47 insertions, 1 deletions
diff --git a/gcc/ChangeLog b/gcc/ChangeLog
index de07e5c..e892d70 100644
--- a/gcc/ChangeLog
+++ b/gcc/ChangeLog
@@ -1,5 +1,12 @@
2014-06-04 Martin Liska <mliska@suse.cz>
+ * 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.
+
+2014-06-04 Martin Liska <mliska@suse.cz>
+
* tree.h (private_lookup_attribute_starting): New function.
(lookup_attribute_starting): Likewise.
* tree.c (private_lookup_attribute_starting): Likewise.
diff --git a/gcc/cgraph.h b/gcc/cgraph.h
index 202c746..9c6f558 100644
--- a/gcc/cgraph.h
+++ b/gcc/cgraph.h
@@ -912,6 +912,8 @@ void fixup_same_cpp_alias_visibility (symtab_node *, symtab_node *target, tree);
basic_block init_lowered_empty_function (tree, bool);
void cgraph_reset_node (struct cgraph_node *);
bool expand_thunk (struct cgraph_node *, bool, bool);
+void cgraph_make_wrapper (struct cgraph_node *source,
+ struct cgraph_node *target);
/* In cgraphclones.c */
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"
diff --git a/gcc/ipa-inline-analysis.c b/gcc/ipa-inline-analysis.c
index 2bb3759..c50a722 100644
--- a/gcc/ipa-inline-analysis.c
+++ b/gcc/ipa-inline-analysis.c
@@ -3960,7 +3960,7 @@ inline_indirect_intraprocedural_analysis (struct cgraph_node *node)
/* Note function body size. */
-static void
+void
inline_analyze_function (struct cgraph_node *node)
{
push_cfun (DECL_STRUCT_FUNCTION (node->decl));
diff --git a/gcc/ipa-inline.h b/gcc/ipa-inline.h
index bddf29a..15e9d1c 100644
--- a/gcc/ipa-inline.h
+++ b/gcc/ipa-inline.h
@@ -216,6 +216,7 @@ void inline_generate_summary (void);
void inline_read_summary (void);
void inline_write_summary (void);
void inline_free_summary (void);
+void inline_analyze_function (struct cgraph_node *node);
void initialize_inline_failed (struct cgraph_edge *);
int estimate_time_after_inlining (struct cgraph_node *, struct cgraph_edge *);
int estimate_size_after_inlining (struct cgraph_node *, struct cgraph_edge *);