diff options
Diffstat (limited to 'gcc/cgraph.c')
-rw-r--r-- | gcc/cgraph.c | 25 |
1 files changed, 25 insertions, 0 deletions
diff --git a/gcc/cgraph.c b/gcc/cgraph.c index 86e72072eab..09aad60c4d2 100644 --- a/gcc/cgraph.c +++ b/gcc/cgraph.c @@ -1630,6 +1630,31 @@ cgraph_remove_node (struct cgraph_node *node) free_nodes = node; } +/* Add NEW_ to the same comdat group that OLD is in. */ + +void +cgraph_add_to_same_comdat_group (struct cgraph_node *new_, + struct cgraph_node *old) +{ + gcc_assert (DECL_ONE_ONLY (old->decl)); + gcc_assert (!new_->same_comdat_group); + gcc_assert (new_ != old); + + DECL_COMDAT_GROUP (new_->decl) = DECL_COMDAT_GROUP (old->decl); + new_->same_comdat_group = old; + if (!old->same_comdat_group) + old->same_comdat_group = new_; + else + { + struct cgraph_node *n; + for (n = old->same_comdat_group; + n->same_comdat_group != old; + n = n->same_comdat_group) + ; + n->same_comdat_group = new_; + } +} + /* Remove the node from cgraph. */ void |