/* Callgraph handling code.
- Copyright (C) 2003, 2004, 2005, 2006, 2007, 2008, 2009
+ Copyright (C) 2003, 2004, 2005, 2006, 2007, 2008, 2009, 2010
Free Software Foundation, Inc.
Contributed by Jan Hubicka
while (node->same_body)
cgraph_remove_same_body_alias (node->same_body);
+ if (node->same_comdat_group)
+ {
+ struct cgraph_node *prev;
+ for (prev = node->same_comdat_group;
+ prev->same_comdat_group != node;
+ prev = prev->same_comdat_group)
+ ;
+ if (node->same_comdat_group == prev)
+ prev->same_comdat_group = NULL;
+ else
+ prev->same_comdat_group = node->same_comdat_group;
+ node->same_comdat_group = NULL;
+ }
+
/* While all the clones are removed after being proceeded, the function
itself is kept in the cgraph even after it is compiled. Check whether
we are done with this body and reclaim it proactively if this is the case.
cgraph_node_can_be_local_p (struct cgraph_node *node)
{
return (!node->needed
- && (DECL_COMDAT (node->decl) || !node->local.externally_visible));
+ && ((DECL_COMDAT (node->decl) && !node->same_comdat_group)
+ || !node->local.externally_visible));
}
/* Bring NODE local. */
gcc_assert (cgraph_node_can_be_local_p (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;
+ 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;
+ }
node->local.externally_visible = false;
node->local.local = true;
gcc_assert (cgraph_function_body_availability (node) == AVAIL_LOCAL);
}
}
+/* Set TREE_NOTHROW on NODE's decl and on same_body aliases of NODE
+ if any to NOTHROW. */
+
+void
+cgraph_set_nothrow_flag (struct cgraph_node *node, bool nothrow)
+{
+ struct cgraph_node *alias;
+ TREE_NOTHROW (node->decl) = nothrow;
+ for (alias = node->same_body; alias; alias = alias->next)
+ TREE_NOTHROW (alias->decl) = nothrow;
+}
+
+/* Set TREE_READONLY on NODE's decl and on same_body aliases of NODE
+ if any to READONLY. */
+
+void
+cgraph_set_readonly_flag (struct cgraph_node *node, bool readonly)
+{
+ struct cgraph_node *alias;
+ TREE_READONLY (node->decl) = readonly;
+ for (alias = node->same_body; alias; alias = alias->next)
+ TREE_READONLY (alias->decl) = readonly;
+}
+
+/* Set DECL_PURE_P on NODE's decl and on same_body aliases of NODE
+ if any to PURE. */
+
+void
+cgraph_set_pure_flag (struct cgraph_node *node, bool pure)
+{
+ struct cgraph_node *alias;
+ DECL_PURE_P (node->decl) = pure;
+ for (alias = node->same_body; alias; alias = alias->next)
+ DECL_PURE_P (alias->decl) = pure;
+}
+
+/* Set DECL_LOOPING_CONST_OR_PURE_P on NODE's decl and on
+ same_body aliases of NODE if any to LOOPING_CONST_OR_PURE. */
+
+void
+cgraph_set_looping_const_or_pure_flag (struct cgraph_node *node,
+ bool looping_const_or_pure)
+{
+ struct cgraph_node *alias;
+ DECL_LOOPING_CONST_OR_PURE_P (node->decl) = looping_const_or_pure;
+ for (alias = node->same_body; alias; alias = alias->next)
+ DECL_LOOPING_CONST_OR_PURE_P (alias->decl) = looping_const_or_pure;
+}
+
#include "gt-cgraph.h"