diff options
author | hubicka <hubicka@138bc75d-0d04-0410-961f-82ee72b054a4> | 2006-12-20 09:09:50 +0000 |
---|---|---|
committer | hubicka <hubicka@138bc75d-0d04-0410-961f-82ee72b054a4> | 2006-12-20 09:09:50 +0000 |
commit | 960df59076491b4de4b135d99b0d09f7b3d82301 (patch) | |
tree | 21dd0c062d62565d1fbbf16f1fd779965b554ca6 /gcc/cgraph.h | |
parent | 8d665d11985d6b49622470f839796b725ab37a27 (diff) | |
download | gcc-960df59076491b4de4b135d99b0d09f7b3d82301.tar.gz |
* cgraph.h (FOR_EACH_STATIC_VARIABLE, FOR_EACH_STATIC_INITIALIZER): New
macros.
(varpool_first_static_initializer, varpol_next_static_initializer): New
inline functions.
* ipa-reference.c (analyze_variable): Simplify.
(static_execute): Use FOR_EACH_STATIC_INITIALIZER.
* ipa-type-escape.c (type_escape_execute): Use FOR_EACH_STATIC_VARIABLE.
git-svn-id: svn+ssh://gcc.gnu.org/svn/gcc/trunk@120070 138bc75d-0d04-0410-961f-82ee72b054a4
Diffstat (limited to 'gcc/cgraph.h')
-rw-r--r-- | gcc/cgraph.h | 36 |
1 files changed, 36 insertions, 0 deletions
diff --git a/gcc/cgraph.h b/gcc/cgraph.h index b60239c3662..8d4fe750b05 100644 --- a/gcc/cgraph.h +++ b/gcc/cgraph.h @@ -342,6 +342,42 @@ bool varpool_analyze_pending_decls (void); void varpool_output_debug_info (void); void varpool_remove_unreferenced_decls (void); +/* Walk all reachable static variables. */ +#define FOR_EACH_STATIC_VARIABLE(node) \ + for ((node) = varpool_nodes_queue; (node); (node) = (node)->next_needed) + +/* Return first reachable static variable with initializer. */ +static inline struct varpool_node * +varpool_first_static_initializer (void) +{ + struct varpool_node *node; + for (node = varpool_nodes_queue; node; node = node->next_needed) + { + gcc_assert (TREE_CODE (node->decl) == VAR_DECL); + if (DECL_INITIAL (node->decl)) + return node; + } + return NULL; +} + +/* Return next reachable static variable with initializer after NODE. */ +static inline struct varpool_node * +varpool_next_static_initializer (struct varpool_node *node) +{ + for (node = node->next_needed; node; node = node->next_needed) + { + gcc_assert (TREE_CODE (node->decl) == VAR_DECL); + if (DECL_INITIAL (node->decl)) + return node; + } + return NULL; +} + +/* Walk all static variables with initializer set. */ +#define FOR_EACH_STATIC_INITIALIZER(node) \ + for ((node) = varpool_first_static_initializer (); (node); \ + (node) = varpool_next_static_initializer (node)) + /* In ipa-inline.c */ bool cgraph_decide_inlining_incrementally (struct cgraph_node *, bool); void cgraph_clone_inlined_nodes (struct cgraph_edge *, bool, bool); |