diff options
author | Jan Hubicka <hubicka@ucw.cz> | 2014-05-18 21:11:58 +0200 |
---|---|---|
committer | Jan Hubicka <hubicka@gcc.gnu.org> | 2014-05-18 19:11:58 +0000 |
commit | d6d229c6b485d19c9eed6c572c26ed1563194487 (patch) | |
tree | 7ab76d160f176e75f7a6798d64cd1d56095ce985 /gcc | |
parent | 43a4dd826c68ecf0f79df3e907db860fa460f691 (diff) | |
download | gcc-d6d229c6b485d19c9eed6c572c26ed1563194487.zip gcc-d6d229c6b485d19c9eed6c572c26ed1563194487.tar.gz gcc-d6d229c6b485d19c9eed6c572c26ed1563194487.tar.bz2 |
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
Diffstat (limited to 'gcc')
-rw-r--r-- | gcc/ChangeLog | 9 | ||||
-rw-r--r-- | gcc/cgraph.h | 48 |
2 files changed, 53 insertions, 4 deletions
diff --git a/gcc/ChangeLog b/gcc/ChangeLog index 2775f33..18ab7bd 100644 --- a/gcc/ChangeLog +++ b/gcc/ChangeLog @@ -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. diff --git a/gcc/cgraph.h b/gcc/cgraph.h index a29a31c..8f13ecb 100644 --- a/gcc/cgraph.h +++ b/gcc/cgraph.h @@ -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 */ |