aboutsummaryrefslogtreecommitdiff
path: root/gcc/cgraph.h
diff options
context:
space:
mode:
authorJan Hubicka <jh@suse.cz>2012-04-22 23:28:07 +0200
committerJan Hubicka <hubicka@gcc.gnu.org>2012-04-22 21:28:07 +0000
commit660584689a4397f18cda03b458703bbbf909dd12 (patch)
treea4cd93cef18f73580dc0226c3ce10cbae70f9f08 /gcc/cgraph.h
parentf04e40afc115bcf2143f541baa9e4cccef19922a (diff)
downloadgcc-660584689a4397f18cda03b458703bbbf909dd12.zip
gcc-660584689a4397f18cda03b458703bbbf909dd12.tar.gz
gcc-660584689a4397f18cda03b458703bbbf909dd12.tar.bz2
lto-symtab.c (lto_varpool_replace_node): Do not merge needed flags.
* lto-symtab.c (lto_varpool_replace_node): Do not merge needed flags. * cgraphbuild.c (record_reference, record_type_list, mark_address, mark_load, mark_store): Do not mark varpool nodes as needed. * cgraph.c (cgraph_new_nodes): Remove. (cgraph_create_function_alias): Do not mark nodes as reachable. (cgraph_add_thunk): Likewise. (cgraph_mark_reachable_node): Do not manage the queue. * cgraph.h (cgraph_node): Remove next_needed. (varpool_nodes_queue): Remove next_needed and prev_needed. (x_cgraph_nodes_queue, x_cgraph_nodes_queue, cgraph_new_nodes): Remove. (cgraph_new_nodes): Declare. (x_varpool_nodes_queue, varpool_nodes_queue); Remove. (varpool_analyze_pending_decls): Remove. (varpool_analyze_node): New. (varpool_mark_needed_node): Remove. (varpool_first_variable, varpool_next_variable): New inlines. (varpool_first_static_initializer, varpool_next_static_initializer): Update. (FOR_EACH_STATIC_VARIABLE): Remove unused walker. (varpool_first_defined_variable): New inline. (varpool_next_defined_variable): New inline (FOR_EACH_VARIABLE): Reimplement. (FOR_EACH_DEFINED_VARIABLE): Reimplement. * toplev.c (wrapup_global_declaration_2): Use analyzed instead of needed flag. * cgraphunit.c (cgraph_new_nodes): Declare here. (enqueue_node): New function. (cgraph_process_new_functions): update for new node set; when constructing cgraph enqueue node for processing. (cgraph_add_new_function): Use new node set. (process_function_and_variable_attributes): Do not set varpool needed flags. (referred_to_p): New function. (varpool_finalize_decl): Move here from varpool.c; enqueue needed node when varpool is in construction. (cgraph_analyze_functions): Rewrite. (cgraph_expand_all_functions): Update. (cgraph_output_in_order): Do not analyze pending decls; do not set needed flags. (cgraph_optimize): Do not analyze pending decls. * lto-cgraph.c (input_varpool_node): Clear analyzed flag for objects in other partition; do not mark node as needed. * dwarf2out.c (reference_to_unused): Use analyzed flag. (premark_types_used_by_global_vars_helper): Likewise. * ipa.c (process_references): Do not call varpool_mark_needed_node. (cgraph_remove_unreachable_nodes): Do not rely on varpool and cgrpah queues. (function_and_variable_visibility): Do not mark node as needed. (whole_program_function_and_variable_visibility): Likewise. * Makefile.in (gt-varpool.h): No longer needed. * passes.c (execute_one_pass, execute_ipa_pass_list): Update. (ipa_write_summaries): Do not use needed flag. * varpool.c: Do not include gt-varpool.h (x_varpool_nodes_queue, x_varpool_last_needed_node, x_varpool_last_needed_node, x_varpool_first_unanalyzed_node, x_varpool_first_unanalyzed_node, varpool_assembled_nodes_queue): Remove. (varpool_remove_node): Do not update the lists. (dump_varpool_node): Do not dump needed flag. (varpool_enqueue_needed_node): Remove. (varpool_mark_needed_node): Remove. (varpool_reset_queue): Remove. (varpool_finalize_decl): Move to cgraphunit.c (varpool_analyze_node): New functions based on former varpool_analyze_pending_decls. (varpool_analyze_pending_decls): Remove. (varpool_assemble_decl): Do not update the lists. (enqueue_node): New function. (varpool_remove_unreferenced_decls): Rewrite. (varpool_empty_needed_queue): Remove. (add_new_static_var): Do not mark node as needed. (varpool_create_variable_alias): Handle expansion state creation. * except.c (output_ttype): Do not mark node as needed. * varasm.c (mark_decl_referenced): Do not use mark_needed_node. * tree-profile.c (init_ic_make_global_vars, init_ic_make_global_vars): Likewise. * tree-switch-conversion.c (build_one_array): Likewise. * class.c (build_utf8_ref): Do not mark varpool node as needed. * gcc-interface/utils.c (gnat_write_global_declarations): Do not mark needed node. * lto-partition.c (partition_varpool_node_p): Do not use needed flag. * decl2.c (maybe_make_one_only): Mark keyed COMDATs as USED so they gets finalized. From-SVN: r186687
Diffstat (limited to 'gcc/cgraph.h')
-rw-r--r--gcc/cgraph.h97
1 files changed, 54 insertions, 43 deletions
diff --git a/gcc/cgraph.h b/gcc/cgraph.h
index 5915a14..8e06fc1 100644
--- a/gcc/cgraph.h
+++ b/gcc/cgraph.h
@@ -215,10 +215,6 @@ struct GTY(()) cgraph_node {
struct cgraph_node *
GTY ((nested_ptr (union symtab_node_def, "(struct cgraph_node *)(%h)", "(symtab_node)%h")))
next_nested;
- /* Pointer to the next function in cgraph_nodes_queue. */
- struct cgraph_node *
- GTY ((nested_ptr (union symtab_node_def, "(struct cgraph_node *)(%h)", "(symtab_node)%h")))
- next_needed;
/* Pointer to the next clone. */
struct cgraph_node *next_sibling_clone;
struct cgraph_node *prev_sibling_clone;
@@ -419,13 +415,6 @@ struct GTY(()) varpool_node {
struct symtab_node_base symbol;
/* For aliases points to declaration DECL is alias of. */
tree alias_of;
- /* Pointer to the next function in varpool_nodes_queue. */
- struct varpool_node *
- GTY ((nested_ptr (union symtab_node_def, "(struct varpool_node *)(%h)", "(symtab_node)%h")))
- next_needed;
- struct varpool_node *
- GTY ((nested_ptr (union symtab_node_def, "(struct varpool_node *)(%h)", "(symtab_node)%h")))
- prev_needed;
/* Set when function must be output - it is externally visible
or its address is taken. */
@@ -471,6 +460,8 @@ extern GTY(()) int cgraph_edge_max_uid;
extern bool cgraph_global_info_ready;
enum cgraph_state
{
+ /* Frontend is parsing and finalizing functions. */
+ CGRAPH_STATE_PARSING,
/* Callgraph is being constructed. It is safe to add new functions. */
CGRAPH_STATE_CONSTRUCTION,
/* Callgraph is built and IPA passes are being run. */
@@ -484,9 +475,7 @@ enum cgraph_state
};
extern enum cgraph_state cgraph_state;
extern bool cgraph_function_flags_ready;
-extern GTY(()) symtab_node x_cgraph_nodes_queue;
-#define cgraph_nodes_queue ((struct cgraph_node *)x_cgraph_nodes_queue)
-extern GTY(()) struct cgraph_node *cgraph_new_nodes;
+extern cgraph_node_set cgraph_new_nodes;
extern GTY(()) struct cgraph_asm_node *cgraph_asm_nodes;
extern GTY(()) int symtab_order;
@@ -687,9 +676,6 @@ bool cgraph_maybe_hot_edge_p (struct cgraph_edge *e);
bool cgraph_optimize_for_size_p (struct cgraph_node *);
/* In varpool.c */
-extern GTY(()) symtab_node x_varpool_nodes_queue;
-#define varpool_nodes_queue ((struct varpool_node *)x_varpool_nodes_queue)
-
struct varpool_node *varpool_node (tree);
struct varpool_node *varpool_node_for_asm (tree asmname);
void varpool_mark_needed_node (struct varpool_node *);
@@ -709,9 +695,8 @@ void varpool_remove_node (struct varpool_node *node);
void varpool_finalize_named_section_flags (struct varpool_node *node);
bool varpool_assemble_pending_decls (void);
bool varpool_assemble_decl (struct varpool_node *node);
-bool varpool_analyze_pending_decls (void);
+void varpool_analyze_node (struct varpool_node *);
void varpool_remove_unreferenced_decls (void);
-void varpool_empty_needed_queue (void);
struct varpool_node * varpool_extra_name_alias (tree, tree);
struct varpool_node * varpool_create_variable_alias (tree, tree);
void varpool_reset_queue (void);
@@ -799,16 +784,48 @@ varpool_node_name(struct varpool_node *node)
#define FOR_EACH_SYMBOL(node) \
for ((node) = symtab_nodes; (node); (node) = (node)->symbol.next)
+
+/* Return first variable. */
+static inline struct varpool_node *
+varpool_first_variable (void)
+{
+ symtab_node node;
+ for (node = symtab_nodes; node; node = node->symbol.next)
+ {
+ if (symtab_variable_p (node))
+ return varpool (node);
+ }
+ return NULL;
+}
+
+/* Return next variable after NODE. */
+static inline struct varpool_node *
+varpool_next_variable (struct varpool_node *node)
+{
+ symtab_node node1 = (symtab_node) node->symbol.next;
+ for (; node1; node1 = node1->symbol.next)
+ {
+ if (symtab_variable_p (node1))
+ return varpool (node1);
+ }
+ return NULL;
+}
+/* Walk all variables. */
+#define FOR_EACH_VARIABLE(node) \
+ for ((node) = varpool_first_variable (); \
+ (node); \
+ (node) = varpool_next_variable ((node)))
+
/* 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)
+ symtab_node node;
+ for (node = symtab_nodes; node; node = node->symbol.next)
{
- gcc_checking_assert (TREE_CODE (node->symbol.decl) == VAR_DECL);
- if (DECL_INITIAL (node->symbol.decl))
- return node;
+ if (symtab_variable_p (node)
+ && DECL_INITIAL (node->symbol.decl))
+ return varpool (node);
}
return NULL;
}
@@ -817,56 +834,50 @@ varpool_first_static_initializer (void)
static inline struct varpool_node *
varpool_next_static_initializer (struct varpool_node *node)
{
- for (node = node->next_needed; node; node = node->next_needed)
+ symtab_node node1 = (symtab_node) node->symbol.next;
+ for (; node1; node1 = node1->symbol.next)
{
- gcc_checking_assert (TREE_CODE (node->symbol.decl) == VAR_DECL);
- if (DECL_INITIAL (node->symbol.decl))
- return node;
+ if (symtab_variable_p (node1)
+ && DECL_INITIAL (node1->symbol.decl))
+ return varpool (node1);
}
return NULL;
}
-/* Walk all reachable static variables. */
-#define FOR_EACH_STATIC_VARIABLE(node) \
- for ((node) = varpool_nodes_queue; (node); (node) = (node)->next_needed)
/* 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))
-/* Return first variable. */
+/* Return first reachable static variable with initializer. */
static inline struct varpool_node *
-varpool_first_variable (void)
+varpool_first_defined_variable (void)
{
symtab_node node;
for (node = symtab_nodes; node; node = node->symbol.next)
{
- if (symtab_variable_p (node))
+ if (symtab_variable_p (node) && varpool (node)->analyzed)
return varpool (node);
}
return NULL;
}
-/* Return next variable after NODE. */
+/* Return next reachable static variable with initializer after NODE. */
static inline struct varpool_node *
-varpool_next_variable (struct varpool_node *node)
+varpool_next_defined_variable (struct varpool_node *node)
{
symtab_node node1 = (symtab_node) node->symbol.next;
for (; node1; node1 = node1->symbol.next)
{
- if (symtab_variable_p (node1))
+ if (symtab_variable_p (node1) && varpool (node1)->analyzed)
return varpool (node1);
}
return NULL;
}
-/* Walk all variables. */
-#define FOR_EACH_VARIABLE(node) \
- for ((node) = varpool_first_variable (); \
- (node); \
- (node) = varpool_next_variable ((node)))
/* Walk all variables with definitions in current unit. */
#define FOR_EACH_DEFINED_VARIABLE(node) \
- for ((node) = varpool_nodes_queue; (node); (node) = (node)->next_needed)
+ for ((node) = varpool_first_defined_variable (); (node); \
+ (node) = varpool_next_defined_variable (node))
/* Return first function with body defined. */
static inline struct cgraph_node *