aboutsummaryrefslogtreecommitdiff
path: root/gcc/cgraph.c
diff options
context:
space:
mode:
authorAlan Modra <amodra@gmail.com>2010-02-20 10:08:20 +1030
committerAlan Modra <amodra@gcc.gnu.org>2010-02-20 10:08:20 +1030
commit715a4e08d04dbefdf690ee11bb07521ad8a6b6ea (patch)
tree4156f0a5645b211f5f05d7ffb8bef1344cef32d4 /gcc/cgraph.c
parentad3b056c2757bf130f4b88c85d734137768a6410 (diff)
downloadgcc-715a4e08d04dbefdf690ee11bb07521ad8a6b6ea.zip
gcc-715a4e08d04dbefdf690ee11bb07521ad8a6b6ea.tar.gz
gcc-715a4e08d04dbefdf690ee11bb07521ad8a6b6ea.tar.bz2
re PR middle-end/42344 (ICE in rs6000.md with ipa-sra for 252.eon)
PR middle-end/42344 * cgraph.h (cgraph_make_decl_local): Declare. * cgraph.c (cgraph_make_decl_local): New function. (cgraph_make_node_local): Use it. * cgraphunit.c (cgraph_function_versioning): Likewise. * ipa.c (function_and_variable_visibility): Likewise. From-SVN: r156914
Diffstat (limited to 'gcc/cgraph.c')
-rw-r--r--gcc/cgraph.c53
1 files changed, 41 insertions, 12 deletions
diff --git a/gcc/cgraph.c b/gcc/cgraph.c
index baaf601..0e02bae 100644
--- a/gcc/cgraph.c
+++ b/gcc/cgraph.c
@@ -86,6 +86,7 @@ The callgraph:
#include "value-prof.h"
#include "except.h"
#include "diagnostic.h"
+#include "rtl.h"
static void cgraph_node_remove_callers (struct cgraph_node *node);
static inline void cgraph_edge_remove_caller (struct cgraph_edge *e);
@@ -2190,6 +2191,42 @@ cgraph_node_can_be_local_p (struct cgraph_node *node)
|| !node->local.externally_visible));
}
+/* Make DECL local. FIXME: We shouldn't need to mess with rtl this early,
+ but other code such as notice_global_symbol generates rtl. */
+void
+cgraph_make_decl_local (tree decl)
+{
+ rtx rtl, symbol;
+
+ if (TREE_CODE (decl) == VAR_DECL)
+ DECL_COMMON (decl) = 0;
+ else if (TREE_CODE (decl) == FUNCTION_DECL)
+ {
+ DECL_COMDAT (decl) = 0;
+ DECL_COMDAT_GROUP (decl) = 0;
+ DECL_WEAK (decl) = 0;
+ DECL_EXTERNAL (decl) = 0;
+ }
+ else
+ gcc_unreachable ();
+ TREE_PUBLIC (decl) = 0;
+ if (!DECL_RTL_SET_P (decl))
+ return;
+
+ /* Update rtl flags. */
+ make_decl_rtl (decl);
+
+ rtl = DECL_RTL (decl);
+ if (!MEM_P (rtl))
+ return;
+
+ symbol = XEXP (rtl, 0);
+ if (GET_CODE (symbol) != SYMBOL_REF)
+ return;
+
+ SYMBOL_REF_WEAK (symbol) = DECL_WEAK (decl);
+}
+
/* Bring NODE local. */
void
cgraph_make_node_local (struct cgraph_node *node)
@@ -2198,19 +2235,11 @@ cgraph_make_node_local (struct cgraph_node *node)
if (DECL_COMDAT (node->decl) || DECL_EXTERNAL (node->decl))
{
struct cgraph_node *alias;
- DECL_COMDAT (node->decl) = 0;
- DECL_COMDAT_GROUP (node->decl) = 0;
- TREE_PUBLIC (node->decl) = 0;
- DECL_WEAK (node->decl) = 0;
- DECL_EXTERNAL (node->decl) = 0;
+ cgraph_make_decl_local (node->decl);
+
for (alias = node->same_body; alias; alias = alias->next)
- {
- DECL_COMDAT (alias->decl) = 0;
- DECL_COMDAT_GROUP (alias->decl) = 0;
- TREE_PUBLIC (alias->decl) = 0;
- DECL_WEAK (alias->decl) = 0;
- DECL_EXTERNAL (alias->decl) = 0;
- }
+ cgraph_make_decl_local (alias->decl);
+
node->local.externally_visible = false;
node->local.local = true;
gcc_assert (cgraph_function_body_availability (node) == AVAIL_LOCAL);