aboutsummaryrefslogtreecommitdiff
path: root/gcc/ipa-ref.c
diff options
context:
space:
mode:
authorMartin Jambor <mjambor@suse.cz>2013-06-27 15:49:28 +0200
committerMartin Jambor <jamborm@gcc.gnu.org>2013-06-27 15:49:28 +0200
commit79ee9826b3d11323eb5b2e6b2dfc892fefeeb2b7 (patch)
treec4683ccba1c2ba8180759aa2dbf98cf9ef9d90d3 /gcc/ipa-ref.c
parente18b4a817c072f787e1a7c1c971f90752cb16e9f (diff)
downloadgcc-79ee9826b3d11323eb5b2e6b2dfc892fefeeb2b7.zip
gcc-79ee9826b3d11323eb5b2e6b2dfc892fefeeb2b7.tar.gz
gcc-79ee9826b3d11323eb5b2e6b2dfc892fefeeb2b7.tar.bz2
re PR c++/57208 (Latest chromium compilation fails with enabled LTO)
2013-06-27 Martin Jambor <mjambor@suse.cz> PR lto/57208 * ipa-ref.h (ipa_maybe_record_reference): Declare. * ipa-ref.c (ipa_maybe_record_reference): New function. * cgraphclones.c (cgraph_create_virtual_clone): Use it. * ipa-cp.c (create_specialized_node): Record potential references from aggvals. * Makefile.in (ipa-ref.o): Add IPA_REF_H to dependencies. From-SVN: r200468
Diffstat (limited to 'gcc/ipa-ref.c')
-rw-r--r--gcc/ipa-ref.c25
1 files changed, 25 insertions, 0 deletions
diff --git a/gcc/ipa-ref.c b/gcc/ipa-ref.c
index 7909805..a6ffdf3 100644
--- a/gcc/ipa-ref.c
+++ b/gcc/ipa-ref.c
@@ -25,6 +25,7 @@ along with GCC; see the file COPYING3. If not see
#include "ggc.h"
#include "target.h"
#include "cgraph.h"
+#include "ipa-utils.h"
static const char *ipa_ref_use_name[] = {"read","write","addr","alias"};
@@ -67,6 +68,30 @@ ipa_record_reference (symtab_node referring_node,
return ref;
}
+/* If VAL is a reference to a function or a variable, add a reference from
+ REFERRING_NODE to the corresponding symbol table node. USE_TYPE specify
+ type of the use and STMT the statement (if it exists). Return the new
+ reference or NULL if none was created. */
+
+struct ipa_ref *
+ipa_maybe_record_reference (symtab_node referring_node, tree val,
+ enum ipa_ref_use use_type, gimple stmt)
+{
+ STRIP_NOPS (val);
+ if (TREE_CODE (val) != ADDR_EXPR)
+ return NULL;
+ val = get_base_var (val);
+ if (val && (TREE_CODE (val) == FUNCTION_DECL
+ || TREE_CODE (val) == VAR_DECL))
+ {
+ symtab_node referred = symtab_get_node (val);
+ gcc_checking_assert (referred);
+ return ipa_record_reference (referring_node, referred,
+ use_type, stmt);
+ }
+ return NULL;
+}
+
/* Remove reference REF. */
void