+2014-05-17 Jan Hubicka <hubicka@ucw.cz>
+
+ * cgraph.h (symtab_first_defined_symbol, symtab_next_defined_symbol):
+ New functions.
+ (FOR_EACH_DEFINED_SYMBOL): New macro.
+ (varpool_first_static_initializer, varpool_next_static_initializer,
+ varpool_first_defined_variable, varpool_next_defined_variable): Fix comments.
+ (symtab_in_same_comdat_p): Correctly deal with inline functions.
+
2014-05-17 Trevor Saunders <tsaunders@mozilla.com>
* ggc-page.c (ggc_handle_finalizers): Add comment.
#define FOR_EACH_SYMBOL(node) \
for ((node) = symtab_nodes; (node); (node) = (node)->next)
+/* Return first static symbol with definition. */
+static inline symtab_node *
+symtab_first_defined_symbol (void)
+{
+ symtab_node *node;
+
+ for (node = symtab_nodes; node; node = node->next)
+ if (node->definition)
+ return node;
+
+ return NULL;
+}
+
+/* Return next reachable static symbol with initializer after NODE. */
+static inline symtab_node *
+symtab_next_defined_symbol (symtab_node *node)
+{
+ symtab_node *node1 = node->next;
+
+ for (; node1; node1 = node1->next)
+ if (node1->definition)
+ return node1;
+
+ return NULL;
+}
+/* Walk all symbols with definitions in current unit. */
+#define FOR_EACH_DEFINED_SYMBOL(node) \
+ for ((node) = symtab_first_defined_symbol (); (node); \
+ (node) = symtab_next_defined_symbol (node))
/* Return first variable. */
static inline varpool_node *
(node); \
(node) = varpool_next_variable ((node)))
-/* Return first reachable static variable with initializer. */
+/* Return first static variable with initializer. */
static inline varpool_node *
varpool_first_static_initializer (void)
{
return NULL;
}
-/* Return next reachable static variable with initializer after NODE. */
+/* Return next static variable with initializer after NODE. */
static inline varpool_node *
varpool_next_static_initializer (varpool_node *node)
{
for ((node) = varpool_first_static_initializer (); (node); \
(node) = varpool_next_static_initializer (node))
-/* Return first reachable static variable with initializer. */
+/* Return first static variable with definition. */
static inline varpool_node *
varpool_first_defined_variable (void)
{
return NULL;
}
-/* Return next reachable static variable with initializer after NODE. */
+/* Return next static variable with definition after NODE. */
static inline varpool_node *
varpool_next_defined_variable (varpool_node *node)
{
static inline bool
symtab_in_same_comdat_p (symtab_node *one, symtab_node *two)
{
+ if (cgraph_node *cn = dyn_cast <cgraph_node *> (one))
+ {
+ if (cn->global.inlined_to)
+ one = cn->global.inlined_to;
+ }
+ if (cgraph_node *cn = dyn_cast <cgraph_node *> (two))
+ {
+ if (cn->global.inlined_to)
+ two = cn->global.inlined_to;
+ }
+
return DECL_COMDAT_GROUP (one->decl) == DECL_COMDAT_GROUP (two->decl);
}
#endif /* GCC_CGRAPH_H */