cgraph.h (symtab_first_defined_symbol, [...]): New functions.

* 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.

From-SVN: r210586
This commit is contained in:
Jan Hubicka 2014-05-18 21:11:58 +02:00 committed by Jan Hubicka
parent 43a4dd826c
commit d6d229c6b4
2 changed files with 53 additions and 4 deletions

View File

@ -1,3 +1,12 @@
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.

View File

@ -1024,6 +1024,35 @@ varpool_get_node (const_tree decl)
#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 *
@ -1052,7 +1081,7 @@ varpool_next_variable (varpool_node *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)
{
@ -1066,7 +1095,7 @@ 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)
{
@ -1085,7 +1114,7 @@ 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)
{
@ -1099,7 +1128,7 @@ 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)
{
@ -1539,6 +1568,17 @@ symtab_comdat_local_p (symtab_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 */