Commit 7de90a6c by David Malcolm Committed by David Malcolm

Change is-a.h to support typedefs of pointers

gcc/
	* is-a.h: Update comments to reflect the following changes to the
	"pointerness" of the API, making the template parameter match the
	return type, allowing use of is-a.h with typedefs of pointers.
	(is_a_helper::cast): Return a T rather then a pointer to a T, so
	that the return type matches the parameter to the is_a_helper.
	(as_a): Likewise.
	(dyn_cast): Likewise.

	* cgraph.c (cgraph_node_for_asm): Update for removal of implicit
	pointer from the is-a.h API.

	* cgraph.h (is_a_helper <cgraph_node>::test): Convert to...
	(is_a_helper <cgraph_node *>::test): ...this, matching change to
	is-a.h API.
	(is_a_helper <varpool_node>::test): Likewise, convert to...
	(is_a_helper <varpool_node *>::test): ...this.

	(varpool_first_variable): Update for removal of implicit pointer
	from the is-a.h API.
	(varpool_next_variable): Likewise.
	(varpool_first_static_initializer): Likewise.
	(varpool_next_static_initializer): Likewise.
	(varpool_first_defined_variable): Likewise.
	(varpool_next_defined_variable): Likewise.
	(cgraph_first_defined_function): Likewise.
	(cgraph_next_defined_function): Likewise.
	(cgraph_first_function): Likewise.
	(cgraph_next_function): Likewise.
	(cgraph_first_function_with_gimple_body): Likewise.
	(cgraph_next_function_with_gimple_body): Likewise.
	(cgraph_alias_target): Likewise.
	(varpool_alias_target): Likewise.
	(cgraph_function_or_thunk_node): Likewise.
	(varpool_variable_node): Likewise.
	(symtab_real_symbol_p): Likewise.
	* cgraphunit.c (referred_to_p): Likewise.
	(analyze_functions): Likewise.
	(handle_alias_pairs): Likewise.
	* gimple-fold.c (can_refer_decl_in_current_unit_p): Likewise.
	* gimple-ssa.h (gimple_vuse_op): Likewise.
	(gimple_vdef_op): Likewise.
	* gimple-streamer-in.c (input_gimple_stmt): Likewise.
	* gimple.c (gimple_build_asm_1): Likewise.
	(gimple_build_try): Likewise.
	(gimple_build_resx): Likewise.
	(gimple_build_eh_dispatch): Likewise.
	(gimple_build_omp_for): Likewise.
	(gimple_omp_for_set_clauses): Likewise.

	* gimple.h (is_a_helper <gimple_statement_asm>::test): Convert to...
	(is_a_helper <gimple_statement_asm *>::test): ...this.
	(is_a_helper <gimple_statement_bind>::test): Convert to...
	(is_a_helper <gimple_statement_bind *>::test): ...this.
	(is_a_helper <gimple_statement_call>::test): Convert to...
	(is_a_helper <gimple_statement_call *>::test): ...this.
	(is_a_helper <gimple_statement_catch>::test): Convert to...
	(is_a_helper <gimple_statement_catch *>::test): ...this.
	(is_a_helper <gimple_statement_resx>::test): Convert to...
	(is_a_helper <gimple_statement_resx *>::test): ...this.
	(is_a_helper <gimple_statement_eh_dispatch>::test): Convert to...
	(is_a_helper <gimple_statement_eh_dispatch *>::test): ...this.
	(is_a_helper <gimple_statement_eh_else>::test): Convert to...
	(is_a_helper <gimple_statement_eh_else *>::test): ...this.
	(is_a_helper <gimple_statement_eh_filter>::test): Convert to...
	(is_a_helper <gimple_statement_eh_filter *>::test): ...this.
	(is_a_helper <gimple_statement_eh_mnt>::test): Convert to...
	(is_a_helper <gimple_statement_eh_mnt *>::test): ...this.
	(is_a_helper <gimple_statement_omp_atomic_load>::test): Convert to...
	(is_a_helper <gimple_statement_omp_atomic_load *>::test): ...this.
	(is_a_helper <gimple_statement_omp_atomic_store>::test): Convert to...
	(is_a_helper <gimple_statement_omp_atomic_store *>::test): ...this.
	(is_a_helper <gimple_statement_omp_return>::test): Convert to...
	(is_a_helper <gimple_statement_omp_return *>::test): ...this.
	(is_a_helper <gimple_statement_omp_continue>::test): Convert to...
	(is_a_helper <gimple_statement_omp_continue *>::test): ...this.
	(is_a_helper <gimple_statement_omp_critical>::test): Convert to...
	(is_a_helper <gimple_statement_omp_critical *>::test): ...this.
	(is_a_helper <gimple_statement_omp_for>::test): Convert to...
	(is_a_helper <gimple_statement_omp_for *>::test): ...this.
	(is_a_helper <gimple_statement_omp_taskreg>::test): Convert to...
	(is_a_helper <gimple_statement_omp_taskreg *>::test): ...this.
	(is_a_helper <gimple_statement_omp_parallel>::test): Convert to...
	(is_a_helper <gimple_statement_omp_parallel *>::test): ...this.
	(is_a_helper <gimple_statement_omp_target>::test): Convert to...
	(is_a_helper <gimple_statement_omp_target *>::test): ...this.
	(is_a_helper <gimple_statement_omp_sections>::test): Convert to...
	(is_a_helper <gimple_statement_omp_sections *>::test): ...this.
	(is_a_helper <gimple_statement_omp_single>::test): Convert to...
	(is_a_helper <gimple_statement_omp_single *>::test): ...this.
	(is_a_helper <gimple_statement_omp_teams>::test): Convert to...
	(is_a_helper <gimple_statement_omp_teams *>::test): ...this.
	(is_a_helper <gimple_statement_omp_task>::test): Convert to...
	(is_a_helper <gimple_statement_omp_task *>::test): ...this.
	(is_a_helper <gimple_statement_phi>::test): Convert to...
	(is_a_helper <gimple_statement_phi *>::test): ...this.
	(is_a_helper <gimple_statement_transaction>::test): Convert to...
	(is_a_helper <gimple_statement_transaction *>::test): ...this.
	(is_a_helper <gimple_statement_try>::test): Convert to...
	(is_a_helper <gimple_statement_try *>::test): ...this.
	(is_a_helper <gimple_statement_wce>::test): Convert to...
	(is_a_helper <gimple_statement_wce *>::test): ...this.
	(is_a_helper <const gimple_statement_asm>::test): Convert to...
	(is_a_helper <const gimple_statement_asm *>::test): ...this.
	(is_a_helper <const gimple_statement_bind>::test): Convert to...
	(is_a_helper <const gimple_statement_bind *>::test): ...this.
	(is_a_helper <const gimple_statement_call>::test): Convert to...
	(is_a_helper <const gimple_statement_call *>::test): ...this.
	(is_a_helper <const gimple_statement_catch>::test): Convert to...
	(is_a_helper <const gimple_statement_catch *>::test): ...this.
	(is_a_helper <const gimple_statement_resx>::test): Convert to...
	(is_a_helper <const gimple_statement_resx *>::test): ...this.
	(is_a_helper <const gimple_statement_eh_dispatch>::test):
	Convert to...
	(is_a_helper <const gimple_statement_eh_dispatch *>::test):
	...this.
	(is_a_helper <const gimple_statement_eh_filter>::test): Convert
	to...
	(is_a_helper <const gimple_statement_eh_filter *>::test): ...this.
	(is_a_helper <const gimple_statement_omp_atomic_load>::test):
	Convert to...
	(is_a_helper <const gimple_statement_omp_atomic_load *>::test):
	...this.
	(is_a_helper <const gimple_statement_omp_atomic_store>::test):
	Convert to...
	(is_a_helper <const gimple_statement_omp_atomic_store *>::test):
	...this.
	(is_a_helper <const gimple_statement_omp_return>::test): Convert
	to...
	(is_a_helper <const gimple_statement_omp_return *>::test): ...this.
	(is_a_helper <const gimple_statement_omp_continue>::test): Convert
	to...
	(is_a_helper <const gimple_statement_omp_continue *>::test): ...this.
	(is_a_helper <const gimple_statement_omp_critical>::test): Convert
	to...
	(is_a_helper <const gimple_statement_omp_critical *>::test): ...this.
	(is_a_helper <const gimple_statement_omp_for>::test): Convert to...
	(is_a_helper <const gimple_statement_omp_for *>::test): ...this.
	(is_a_helper <const gimple_statement_omp_taskreg>::test): Convert
	to...
	(is_a_helper <const gimple_statement_omp_taskreg *>::test): ...this.
	(is_a_helper <const gimple_statement_omp_parallel>::test): Convert
	to...
	(is_a_helper <const gimple_statement_omp_parallel *>::test): ...this.
	(is_a_helper <const gimple_statement_omp_target>::test): Convert
	to...
	(is_a_helper <const gimple_statement_omp_target *>::test): ...this.
	(is_a_helper <const gimple_statement_omp_sections>::test): Convert
	to...
	(is_a_helper <const gimple_statement_omp_sections *>::test): ...this.
	(is_a_helper <const gimple_statement_omp_single>::test): Convert
	to...
	(is_a_helper <const gimple_statement_omp_single *>::test): ...this.
	(is_a_helper <const gimple_statement_omp_teams>::test): Convert
	to...
	(is_a_helper <const gimple_statement_omp_teams *>::test): ...this.
	(is_a_helper <const gimple_statement_omp_task>::test): Convert
	to...
	(is_a_helper <const gimple_statement_omp_task *>::test): ...this.
	(is_a_helper <const gimple_statement_phi>::test): Convert to...
	(is_a_helper <const gimple_statement_phi *>::test): ...this.
	(is_a_helper <const gimple_statement_transaction>::test): Convert
	to...
	(is_a_helper <const gimple_statement_transaction *>::test): ...this.
	(is_a_helper <const gimple_statement_with_ops>::test): Convert
	to...
	(is_a_helper <const gimple_statement_with_ops *>::test): ...this.
	(is_a_helper <gimple_statement_with_ops>::test): Convert to...
	(is_a_helper <gimple_statement_with_ops *>::test): ...this.
	(is_a_helper <const gimple_statement_with_memory_ops>::test):
	Convert to...
	(is_a_helper <const gimple_statement_with_memory_ops *>::test):
	...this.
	(is_a_helper <gimple_statement_with_memory_ops>::test): Convert
	to...
	(is_a_helper <gimple_statement_with_memory_ops *>::test): ...this.

	(gimple_use_ops): Update for removal of implicit pointer from the
	is-a.h API.
	(gimple_set_use_ops): Likewise.
	(gimple_vuse): Likewise.
	(gimple_vdef): Likewise.
	(gimple_vuse_ptr): Likewise.
	(gimple_vdef_ptr): Likewise.
	(gimple_set_vuse): Likewise.
	(gimple_set_vdef): Likewise.
	(gimple_omp_return_set_lhs): Likewise.
	(gimple_omp_return_lhs): Likewise.
	(gimple_omp_return_lhs_ptr): Likewise.
	(gimple_call_fntype): Likewise.
	(gimple_call_set_fntype): Likewise.
	(gimple_call_set_internal_fn): Likewise.
	(gimple_call_use_set): Likewise.
	(gimple_call_clobber_set): Likewise.
	(gimple_bind_vars): Likewise.
	(gimple_bind_set_vars): Likewise.
	(gimple_bind_body_ptr): Likewise.
	(gimple_bind_set_body): Likewise.
	(gimple_bind_add_stmt): Likewise.
	(gimple_bind_block): Likewise.
	(gimple_bind_set_block): Likewise.
	(gimple_asm_ninputs): Likewise.
	(gimple_asm_noutputs): Likewise.
	(gimple_asm_nclobbers): Likewise.
	(gimple_asm_nlabels): Likewise.
	(gimple_asm_input_op): Likewise.
	(gimple_asm_input_op_ptr): Likewise.
	(gimple_asm_output_op): Likewise.
	(gimple_asm_output_op_ptr): Likewise.
	(gimple_asm_set_output_op): Likewise.
	(gimple_asm_clobber_op): Likewise.
	(gimple_asm_set_clobber_op): Likewise.
	(gimple_asm_label_op): Likewise.
	(gimple_asm_set_label_op): Likewise.
	(gimple_asm_string): Likewise.
	(gimple_catch_types): Likewise.
	(gimple_catch_types_ptr): Likewise.
	(gimple_catch_handler_ptr): Likewise.
	(gimple_catch_set_types): Likewise.
	(gimple_catch_set_handler): Likewise.
	(gimple_eh_filter_types): Likewise.
	(gimple_eh_filter_types_ptr): Likewise.
	(gimple_eh_filter_failure_ptr): Likewise.
	(gimple_eh_filter_set_types): Likewise.
	(gimple_eh_filter_set_failure): Likewise.
	(gimple_eh_must_not_throw_fndecl): Likewise.
	(gimple_eh_must_not_throw_set_fndecl): Likewise.
	(gimple_eh_else_n_body_ptr): Likewise.
	(gimple_eh_else_e_body_ptr): Likewise.
	(gimple_eh_else_set_n_body): Likewise.
	(gimple_eh_else_set_e_body): Likewise.
	(gimple_try_eval_ptr): Likewise.
	(gimple_try_cleanup_ptr): Likewise.
	(gimple_try_set_eval): Likewise.
	(gimple_try_set_cleanup): Likewise.
	(gimple_wce_cleanup_ptr): Likewise.
	(gimple_wce_set_cleanup): Likewise.
	(gimple_phi_capacity): Likewise.
	(gimple_phi_num_args): Likewise.
	(gimple_phi_result): Likewise.
	(gimple_phi_result_ptr): Likewise.
	(gimple_phi_set_result): Likewise.
	(gimple_phi_arg): Likewise.
	(gimple_phi_set_arg): Likewise.
	(gimple_resx_region): Likewise.
	(gimple_resx_set_region): Likewise.
	(gimple_eh_dispatch_region): Likewise.
	(gimple_eh_dispatch_set_region): Likewise.
	(gimple_omp_critical_name): Likewise.
	(gimple_omp_critical_name_ptr): Likewise.
	(gimple_omp_critical_set_name): Likewise.
	(gimple_omp_for_clauses): Likewise.
	(gimple_omp_for_clauses_ptr): Likewise.
	(gimple_omp_for_set_clauses): Likewise.
	(gimple_omp_for_collapse): Likewise.
	(gimple_omp_for_index): Likewise.
	(gimple_omp_for_index_ptr): Likewise.
	(gimple_omp_for_set_index): Likewise.
	(gimple_omp_for_initial): Likewise.
	(gimple_omp_for_initial_ptr): Likewise.
	(gimple_omp_for_set_initial): Likewise.
	(gimple_omp_for_final): Likewise.
	(gimple_omp_for_final_ptr): Likewise.
	(gimple_omp_for_set_final): Likewise.
	(gimple_omp_for_incr): Likewise.
	(gimple_omp_for_incr_ptr): Likewise.
	(gimple_omp_for_set_incr): Likewise.
	(gimple_omp_for_pre_body_ptr): Likewise.
	(gimple_omp_for_set_pre_body): Likewise.
	(gimple_omp_parallel_clauses): Likewise.
	(gimple_omp_parallel_clauses_ptr): Likewise.
	(gimple_omp_parallel_set_clauses): Likewise.
	(gimple_omp_parallel_child_fn): Likewise.
	(gimple_omp_parallel_child_fn_ptr): Likewise.
	(gimple_omp_parallel_set_child_fn): Likewise.
	(gimple_omp_parallel_data_arg): Likewise.
	(gimple_omp_parallel_data_arg_ptr): Likewise.
	(gimple_omp_parallel_set_data_arg): Likewise.
	(gimple_omp_task_clauses): Likewise.
	(gimple_omp_task_clauses_ptr): Likewise.
	(gimple_omp_task_set_clauses): Likewise.
	(gimple_omp_task_child_fn): Likewise.
	(gimple_omp_task_child_fn_ptr): Likewise.
	(gimple_omp_task_set_child_fn): Likewise.
	(gimple_omp_task_data_arg): Likewise.
	(gimple_omp_task_data_arg_ptr): Likewise.
	(gimple_omp_task_set_data_arg): Likewise.
	(gimple_omp_taskreg_clauses): Likewise.
	(gimple_omp_taskreg_clauses_ptr): Likewise.
	(gimple_omp_taskreg_set_clauses): Likewise.
	(gimple_omp_taskreg_child_fn): Likewise.
	(gimple_omp_taskreg_child_fn_ptr): Likewise.
	(gimple_omp_taskreg_set_child_fn): Likewise.
	(gimple_omp_taskreg_data_arg): Likewise.
	(gimple_omp_taskreg_data_arg_ptr): Likewise.
	(gimple_omp_taskreg_set_data_arg): Likewise.
	(gimple_omp_task_copy_fn): Likewise.
	(gimple_omp_task_copy_fn_ptr): Likewise.
	(gimple_omp_task_set_copy_fn): Likewise.
	(gimple_omp_task_arg_size): Likewise.
	(gimple_omp_task_arg_size_ptr): Likewise.
	(gimple_omp_task_set_arg_size): Likewise.
	(gimple_omp_task_arg_align): Likewise.
	(gimple_omp_task_arg_align_ptr): Likewise.
	(gimple_omp_task_set_arg_align): Likewise.
	(gimple_omp_single_clauses): Likewise.
	(gimple_omp_single_clauses_ptr): Likewise.
	(gimple_omp_single_set_clauses): Likewise.
	(gimple_omp_target_clauses): Likewise.
	(gimple_omp_target_clauses_ptr): Likewise.
	(gimple_omp_target_set_clauses): Likewise.
	(gimple_omp_target_child_fn): Likewise.
	(gimple_omp_target_child_fn_ptr): Likewise.
	(gimple_omp_target_set_child_fn): Likewise.
	(gimple_omp_target_data_arg): Likewise.
	(gimple_omp_target_data_arg_ptr): Likewise.
	(gimple_omp_target_set_data_arg): Likewise.
	(gimple_omp_teams_clauses): Likewise.
	(gimple_omp_teams_clauses_ptr): Likewise.
	(gimple_omp_teams_set_clauses): Likewise.
	(gimple_omp_sections_clauses): Likewise.
	(gimple_omp_sections_clauses_ptr): Likewise.
	(gimple_omp_sections_set_clauses): Likewise.
	(gimple_omp_sections_control): Likewise.
	(gimple_omp_sections_control_ptr): Likewise.
	(gimple_omp_sections_set_control): Likewise.
	(gimple_omp_for_set_cond): Likewise.
	(gimple_omp_for_cond): Likewise.
	(gimple_omp_atomic_store_set_val): Likewise.
	(gimple_omp_atomic_store_val): Likewise.
	(gimple_omp_atomic_store_val_ptr): Likewise.
	(gimple_omp_atomic_load_set_lhs): Likewise.
	(gimple_omp_atomic_load_lhs): Likewise.
	(gimple_omp_atomic_load_lhs_ptr): Likewise.
	(gimple_omp_atomic_load_set_rhs): Likewise.
	(gimple_omp_atomic_load_rhs): Likewise.
	(gimple_omp_atomic_load_rhs_ptr): Likewise.
	(gimple_omp_continue_control_def): Likewise.
	(gimple_omp_continue_control_def_ptr): Likewise.
	(gimple_omp_continue_set_control_def): Likewise.
	(gimple_omp_continue_control_use): Likewise.
	(gimple_omp_continue_control_use_ptr): Likewise.
	(gimple_omp_continue_set_control_use): Likewise.
	(gimple_transaction_body_ptr): Likewise.
	(gimple_transaction_label): Likewise.
	(gimple_transaction_label_ptr): Likewise.
	(gimple_transaction_set_body): Likewise.
	(gimple_transaction_set_label): Likewise.

	* ipa-devirt.c (build_type_inheritance_graph): Likewise.
	* ipa-inline-analysis.c (inline_write_summary): Likewise.
	* ipa-ref.c (ipa_record_reference): Likewise.
	* ipa-reference.c (analyze_function): Likewise.
	(ipa_reference_write_optimization_summary): Likewise.
	* ipa.c (symtab_remove_unreachable_nodes): Likewise.
	(address_taken_from_non_vtable_p): Likewise.
	(comdat_can_be_unshared_p_1): Likewise.
	* lto-cgraph.c (lto_output_ref): Likewise.
	(add_references): Likewise.
	(compute_ltrans_boundary): Likewise.
	(output_symtab): Likewise.
	(input_ref): Likewise.
	(input_cgraph_1): Likewise.
	(output_cgraph_opt_summary): Likewise.
	* lto-streamer-out.c (lto_output): Likewise.
	(output_symbol_p): Likewise.
	* lto-streamer.h (lsei_next_function_in_partition): Likewise.
	(lsei_start_function_in_partition): Likewise.
	(lsei_next_variable_in_partition): Likewise.
	(lsei_start_variable_in_partition): Likewise.
	* symtab.c (insert_to_assembler_name_hash): Likewise.
	(unlink_from_assembler_name_hash): Likewise.
	(symtab_unregister_node): Likewise.
	(symtab_remove_node): Likewise.
	(dump_symtab_node): Likewise.
	(verify_symtab_base): Likewise.
	(verify_symtab_node): Likewise.
	(symtab_make_decl_local): Likewise.
	(symtab_alias_ultimate_target): Likewise.
	(symtab_resolve_alias): Likewise.
	(symtab_get_symbol_partitioning_class): Likewise.
	* tree-phinodes.c (allocate_phi_node): Likewise.
	(reserve_phi_args_for_new_edge): Likewise.
	(remove_phi_args): Likewise.
	* varpool.c (varpool_node_for_asm): Likewise.
	(varpool_remove_unreferenced_decls): Likewise.

gcc/lto/
	* lto-partition.c (add_references_to_partition): Update for
	removal of implicit pointer from the is-a.h API.
	(add_symbol_to_partition_1): Likewise.
	(contained_in_symbol): Likewise.
	(undo_partition): Likewise.
	(lto_balanced_map): Likewise.
	(promote_symbol): Likewise.
	* lto-symtab.c (lto_symtab_merge_symbols_1): Likewise.
	(lto_symtab_merge_symbols): Likewise.
	* lto.c (lto_wpa_write_files): Likewise.

From-SVN: r209719
parent 9219922e
...@@ -674,7 +674,7 @@ cgraph_node_for_asm (tree asmname) ...@@ -674,7 +674,7 @@ cgraph_node_for_asm (tree asmname)
node; node;
node = node->next_sharing_asm_name) node = node->next_sharing_asm_name)
{ {
cgraph_node *cn = dyn_cast <cgraph_node> (node); cgraph_node *cn = dyn_cast <cgraph_node *> (node);
if (cn && !cn->global.inlined_to) if (cn && !cn->global.inlined_to)
return cn; return cn;
} }
......
...@@ -661,7 +661,7 @@ struct GTY(()) asm_node { ...@@ -661,7 +661,7 @@ struct GTY(()) asm_node {
template <> template <>
template <> template <>
inline bool inline bool
is_a_helper <cgraph_node>::test (symtab_node *p) is_a_helper <cgraph_node *>::test (symtab_node *p)
{ {
return p->type == SYMTAB_FUNCTION; return p->type == SYMTAB_FUNCTION;
} }
...@@ -671,7 +671,7 @@ is_a_helper <cgraph_node>::test (symtab_node *p) ...@@ -671,7 +671,7 @@ is_a_helper <cgraph_node>::test (symtab_node *p)
template <> template <>
template <> template <>
inline bool inline bool
is_a_helper <varpool_node>::test (symtab_node *p) is_a_helper <varpool_node *>::test (symtab_node *p)
{ {
return p->type == SYMTAB_VARIABLE; return p->type == SYMTAB_VARIABLE;
} }
...@@ -1029,7 +1029,7 @@ varpool_first_variable (void) ...@@ -1029,7 +1029,7 @@ varpool_first_variable (void)
{ {
symtab_node *node; symtab_node *node;
for (node = symtab_nodes; node; node = node->next) for (node = symtab_nodes; node; node = node->next)
if (varpool_node *vnode = dyn_cast <varpool_node> (node)) if (varpool_node *vnode = dyn_cast <varpool_node *> (node))
return vnode; return vnode;
return NULL; return NULL;
} }
...@@ -1040,7 +1040,7 @@ varpool_next_variable (varpool_node *node) ...@@ -1040,7 +1040,7 @@ varpool_next_variable (varpool_node *node)
{ {
symtab_node *node1 = node->next; symtab_node *node1 = node->next;
for (; node1; node1 = node1->next) for (; node1; node1 = node1->next)
if (varpool_node *vnode1 = dyn_cast <varpool_node> (node1)) if (varpool_node *vnode1 = dyn_cast <varpool_node *> (node1))
return vnode1; return vnode1;
return NULL; return NULL;
} }
...@@ -1057,7 +1057,7 @@ varpool_first_static_initializer (void) ...@@ -1057,7 +1057,7 @@ varpool_first_static_initializer (void)
symtab_node *node; symtab_node *node;
for (node = symtab_nodes; node; node = node->next) for (node = symtab_nodes; node; node = node->next)
{ {
varpool_node *vnode = dyn_cast <varpool_node> (node); varpool_node *vnode = dyn_cast <varpool_node *> (node);
if (vnode && DECL_INITIAL (node->decl)) if (vnode && DECL_INITIAL (node->decl))
return vnode; return vnode;
} }
...@@ -1071,7 +1071,7 @@ varpool_next_static_initializer (varpool_node *node) ...@@ -1071,7 +1071,7 @@ varpool_next_static_initializer (varpool_node *node)
symtab_node *node1 = node->next; symtab_node *node1 = node->next;
for (; node1; node1 = node1->next) for (; node1; node1 = node1->next)
{ {
varpool_node *vnode1 = dyn_cast <varpool_node> (node1); varpool_node *vnode1 = dyn_cast <varpool_node *> (node1);
if (vnode1 && DECL_INITIAL (node1->decl)) if (vnode1 && DECL_INITIAL (node1->decl))
return vnode1; return vnode1;
} }
...@@ -1090,7 +1090,7 @@ varpool_first_defined_variable (void) ...@@ -1090,7 +1090,7 @@ varpool_first_defined_variable (void)
symtab_node *node; symtab_node *node;
for (node = symtab_nodes; node; node = node->next) for (node = symtab_nodes; node; node = node->next)
{ {
varpool_node *vnode = dyn_cast <varpool_node> (node); varpool_node *vnode = dyn_cast <varpool_node *> (node);
if (vnode && vnode->definition) if (vnode && vnode->definition)
return vnode; return vnode;
} }
...@@ -1104,7 +1104,7 @@ varpool_next_defined_variable (varpool_node *node) ...@@ -1104,7 +1104,7 @@ varpool_next_defined_variable (varpool_node *node)
symtab_node *node1 = node->next; symtab_node *node1 = node->next;
for (; node1; node1 = node1->next) for (; node1; node1 = node1->next)
{ {
varpool_node *vnode1 = dyn_cast <varpool_node> (node1); varpool_node *vnode1 = dyn_cast <varpool_node *> (node1);
if (vnode1 && vnode1->definition) if (vnode1 && vnode1->definition)
return vnode1; return vnode1;
} }
...@@ -1122,7 +1122,7 @@ cgraph_first_defined_function (void) ...@@ -1122,7 +1122,7 @@ cgraph_first_defined_function (void)
symtab_node *node; symtab_node *node;
for (node = symtab_nodes; node; node = node->next) for (node = symtab_nodes; node; node = node->next)
{ {
cgraph_node *cn = dyn_cast <cgraph_node> (node); cgraph_node *cn = dyn_cast <cgraph_node *> (node);
if (cn && cn->definition) if (cn && cn->definition)
return cn; return cn;
} }
...@@ -1136,7 +1136,7 @@ cgraph_next_defined_function (struct cgraph_node *node) ...@@ -1136,7 +1136,7 @@ cgraph_next_defined_function (struct cgraph_node *node)
symtab_node *node1 = node->next; symtab_node *node1 = node->next;
for (; node1; node1 = node1->next) for (; node1; node1 = node1->next)
{ {
cgraph_node *cn1 = dyn_cast <cgraph_node> (node1); cgraph_node *cn1 = dyn_cast <cgraph_node *> (node1);
if (cn1 && cn1->definition) if (cn1 && cn1->definition)
return cn1; return cn1;
} }
...@@ -1154,7 +1154,7 @@ cgraph_first_function (void) ...@@ -1154,7 +1154,7 @@ cgraph_first_function (void)
{ {
symtab_node *node; symtab_node *node;
for (node = symtab_nodes; node; node = node->next) for (node = symtab_nodes; node; node = node->next)
if (cgraph_node *cn = dyn_cast <cgraph_node> (node)) if (cgraph_node *cn = dyn_cast <cgraph_node *> (node))
return cn; return cn;
return NULL; return NULL;
} }
...@@ -1165,7 +1165,7 @@ cgraph_next_function (struct cgraph_node *node) ...@@ -1165,7 +1165,7 @@ cgraph_next_function (struct cgraph_node *node)
{ {
symtab_node *node1 = node->next; symtab_node *node1 = node->next;
for (; node1; node1 = node1->next) for (; node1; node1 = node1->next)
if (cgraph_node *cn1 = dyn_cast <cgraph_node> (node1)) if (cgraph_node *cn1 = dyn_cast <cgraph_node *> (node1))
return cn1; return cn1;
return NULL; return NULL;
} }
...@@ -1193,7 +1193,7 @@ cgraph_first_function_with_gimple_body (void) ...@@ -1193,7 +1193,7 @@ cgraph_first_function_with_gimple_body (void)
symtab_node *node; symtab_node *node;
for (node = symtab_nodes; node; node = node->next) for (node = symtab_nodes; node; node = node->next)
{ {
cgraph_node *cn = dyn_cast <cgraph_node> (node); cgraph_node *cn = dyn_cast <cgraph_node *> (node);
if (cn && cgraph_function_with_gimple_body_p (cn)) if (cn && cgraph_function_with_gimple_body_p (cn))
return cn; return cn;
} }
...@@ -1207,7 +1207,7 @@ cgraph_next_function_with_gimple_body (struct cgraph_node *node) ...@@ -1207,7 +1207,7 @@ cgraph_next_function_with_gimple_body (struct cgraph_node *node)
symtab_node *node1 = node->next; symtab_node *node1 = node->next;
for (; node1; node1 = node1->next) for (; node1; node1 = node1->next)
{ {
cgraph_node *cn1 = dyn_cast <cgraph_node> (node1); cgraph_node *cn1 = dyn_cast <cgraph_node *> (node1);
if (cn1 && cgraph_function_with_gimple_body_p (cn1)) if (cn1 && cgraph_function_with_gimple_body_p (cn1))
return cn1; return cn1;
} }
...@@ -1415,13 +1415,13 @@ symtab_alias_target (symtab_node *n) ...@@ -1415,13 +1415,13 @@ symtab_alias_target (symtab_node *n)
static inline struct cgraph_node * static inline struct cgraph_node *
cgraph_alias_target (struct cgraph_node *n) cgraph_alias_target (struct cgraph_node *n)
{ {
return dyn_cast <cgraph_node> (symtab_alias_target (n)); return dyn_cast <cgraph_node *> (symtab_alias_target (n));
} }
static inline varpool_node * static inline varpool_node *
varpool_alias_target (varpool_node *n) varpool_alias_target (varpool_node *n)
{ {
return dyn_cast <varpool_node> (symtab_alias_target (n)); return dyn_cast <varpool_node *> (symtab_alias_target (n));
} }
/* Given NODE, walk the alias chain to return the function NODE is alias of. /* Given NODE, walk the alias chain to return the function NODE is alias of.
...@@ -1434,8 +1434,8 @@ cgraph_function_or_thunk_node (struct cgraph_node *node, ...@@ -1434,8 +1434,8 @@ cgraph_function_or_thunk_node (struct cgraph_node *node,
{ {
struct cgraph_node *n; struct cgraph_node *n;
n = dyn_cast <cgraph_node> (symtab_alias_ultimate_target (node, n = dyn_cast <cgraph_node *> (symtab_alias_ultimate_target (node,
availability)); availability));
if (!n && availability) if (!n && availability)
*availability = AVAIL_NOT_AVAILABLE; *availability = AVAIL_NOT_AVAILABLE;
return n; return n;
...@@ -1451,8 +1451,8 @@ varpool_variable_node (varpool_node *node, ...@@ -1451,8 +1451,8 @@ varpool_variable_node (varpool_node *node,
varpool_node *n; varpool_node *n;
if (node) if (node)
n = dyn_cast <varpool_node> (symtab_alias_ultimate_target (node, n = dyn_cast <varpool_node *> (symtab_alias_ultimate_target (node,
availability)); availability));
else else
n = NULL; n = NULL;
...@@ -1502,7 +1502,7 @@ symtab_real_symbol_p (symtab_node *node) ...@@ -1502,7 +1502,7 @@ symtab_real_symbol_p (symtab_node *node)
if (DECL_ABSTRACT (node->decl)) if (DECL_ABSTRACT (node->decl))
return false; return false;
if (!is_a <cgraph_node> (node)) if (!is_a <cgraph_node *> (node))
return true; return true;
cnode = cgraph (node); cnode = cgraph (node);
if (cnode->global.inlined_to) if (cnode->global.inlined_to)
......
...@@ -406,7 +406,7 @@ referred_to_p (symtab_node *node) ...@@ -406,7 +406,7 @@ referred_to_p (symtab_node *node)
if (ipa_ref_list_referring_iterate (&node->ref_list, 0, ref)) if (ipa_ref_list_referring_iterate (&node->ref_list, 0, ref))
return true; return true;
/* For functions check also calls. */ /* For functions check also calls. */
cgraph_node *cn = dyn_cast <cgraph_node> (node); cgraph_node *cn = dyn_cast <cgraph_node *> (node);
if (cn && cn->callers) if (cn && cn->callers)
return true; return true;
return false; return false;
...@@ -994,7 +994,7 @@ analyze_functions (void) ...@@ -994,7 +994,7 @@ analyze_functions (void)
changed = true; changed = true;
node = queued_nodes; node = queued_nodes;
queued_nodes = (symtab_node *)queued_nodes->aux; queued_nodes = (symtab_node *)queued_nodes->aux;
cgraph_node *cnode = dyn_cast <cgraph_node> (node); cgraph_node *cnode = dyn_cast <cgraph_node *> (node);
if (cnode && cnode->definition) if (cnode && cnode->definition)
{ {
struct cgraph_edge *edge; struct cgraph_edge *edge;
...@@ -1045,7 +1045,7 @@ analyze_functions (void) ...@@ -1045,7 +1045,7 @@ analyze_functions (void)
} }
else else
{ {
varpool_node *vnode = dyn_cast <varpool_node> (node); varpool_node *vnode = dyn_cast <varpool_node *> (node);
if (vnode && vnode->definition && !vnode->analyzed) if (vnode && vnode->definition && !vnode->analyzed)
varpool_analyze_node (vnode); varpool_analyze_node (vnode);
} }
...@@ -1089,7 +1089,7 @@ analyze_functions (void) ...@@ -1089,7 +1089,7 @@ analyze_functions (void)
symtab_remove_node (node); symtab_remove_node (node);
continue; continue;
} }
if (cgraph_node *cnode = dyn_cast <cgraph_node> (node)) if (cgraph_node *cnode = dyn_cast <cgraph_node *> (node))
{ {
tree decl = node->decl; tree decl = node->decl;
...@@ -1179,7 +1179,7 @@ handle_alias_pairs (void) ...@@ -1179,7 +1179,7 @@ handle_alias_pairs (void)
} }
if (TREE_CODE (p->decl) == FUNCTION_DECL if (TREE_CODE (p->decl) == FUNCTION_DECL
&& target_node && is_a <cgraph_node> (target_node)) && target_node && is_a <cgraph_node *> (target_node))
{ {
struct cgraph_node *src_node = cgraph_get_node (p->decl); struct cgraph_node *src_node = cgraph_get_node (p->decl);
if (src_node && src_node->definition) if (src_node && src_node->definition)
...@@ -1188,7 +1188,7 @@ handle_alias_pairs (void) ...@@ -1188,7 +1188,7 @@ handle_alias_pairs (void)
alias_pairs->unordered_remove (i); alias_pairs->unordered_remove (i);
} }
else if (TREE_CODE (p->decl) == VAR_DECL else if (TREE_CODE (p->decl) == VAR_DECL
&& target_node && is_a <varpool_node> (target_node)) && target_node && is_a <varpool_node *> (target_node))
{ {
varpool_create_variable_alias (p->decl, target_node->decl); varpool_create_variable_alias (p->decl, target_node->decl);
alias_pairs->unordered_remove (i); alias_pairs->unordered_remove (i);
......
...@@ -96,7 +96,7 @@ can_refer_decl_in_current_unit_p (tree decl, tree from_decl) ...@@ -96,7 +96,7 @@ can_refer_decl_in_current_unit_p (tree decl, tree from_decl)
snode = symtab_get_node (decl); snode = symtab_get_node (decl);
if (!snode) if (!snode)
return false; return false;
node = dyn_cast <cgraph_node> (snode); node = dyn_cast <cgraph_node *> (snode);
return !node || !node->global.inlined_to; return !node || !node->global.inlined_to;
} }
......
...@@ -109,7 +109,7 @@ gimple_vuse_op (const_gimple g) ...@@ -109,7 +109,7 @@ gimple_vuse_op (const_gimple g)
{ {
struct use_optype_d *ops; struct use_optype_d *ops;
const gimple_statement_with_memory_ops *mem_ops_stmt = const gimple_statement_with_memory_ops *mem_ops_stmt =
dyn_cast <const gimple_statement_with_memory_ops> (g); dyn_cast <const gimple_statement_with_memory_ops *> (g);
if (!mem_ops_stmt) if (!mem_ops_stmt)
return NULL_USE_OPERAND_P; return NULL_USE_OPERAND_P;
ops = mem_ops_stmt->use_ops; ops = mem_ops_stmt->use_ops;
...@@ -125,7 +125,7 @@ static inline def_operand_p ...@@ -125,7 +125,7 @@ static inline def_operand_p
gimple_vdef_op (gimple g) gimple_vdef_op (gimple g)
{ {
gimple_statement_with_memory_ops *mem_ops_stmt = gimple_statement_with_memory_ops *mem_ops_stmt =
dyn_cast <gimple_statement_with_memory_ops> (g); dyn_cast <gimple_statement_with_memory_ops *> (g);
if (!mem_ops_stmt) if (!mem_ops_stmt)
return NULL_DEF_OPERAND_P; return NULL_DEF_OPERAND_P;
if (mem_ops_stmt->vdef) if (mem_ops_stmt->vdef)
......
...@@ -137,7 +137,7 @@ input_gimple_stmt (struct lto_input_block *ib, struct data_in *data_in, ...@@ -137,7 +137,7 @@ input_gimple_stmt (struct lto_input_block *ib, struct data_in *data_in,
case GIMPLE_ASM: case GIMPLE_ASM:
{ {
/* FIXME lto. Move most of this into a new gimple_asm_set_string(). */ /* FIXME lto. Move most of this into a new gimple_asm_set_string(). */
gimple_statement_asm *asm_stmt = as_a <gimple_statement_asm> (stmt); gimple_statement_asm *asm_stmt = as_a <gimple_statement_asm *> (stmt);
tree str; tree str;
asm_stmt->ni = streamer_read_uhwi (ib); asm_stmt->ni = streamer_read_uhwi (ib);
asm_stmt->no = streamer_read_uhwi (ib); asm_stmt->no = streamer_read_uhwi (ib);
......
...@@ -544,7 +544,7 @@ gimple_build_asm_1 (const char *string, unsigned ninputs, unsigned noutputs, ...@@ -544,7 +544,7 @@ gimple_build_asm_1 (const char *string, unsigned ninputs, unsigned noutputs,
enforced by the front end. */ enforced by the front end. */
gcc_assert (nlabels == 0 || noutputs == 0); gcc_assert (nlabels == 0 || noutputs == 0);
p = as_a <gimple_statement_asm> ( p = as_a <gimple_statement_asm *> (
gimple_build_with_ops (GIMPLE_ASM, ERROR_MARK, gimple_build_with_ops (GIMPLE_ASM, ERROR_MARK,
ninputs + noutputs + nclobbers + nlabels)); ninputs + noutputs + nclobbers + nlabels));
...@@ -671,7 +671,7 @@ gimple_build_try (gimple_seq eval, gimple_seq cleanup, ...@@ -671,7 +671,7 @@ gimple_build_try (gimple_seq eval, gimple_seq cleanup,
gimple_statement_try *p; gimple_statement_try *p;
gcc_assert (kind == GIMPLE_TRY_CATCH || kind == GIMPLE_TRY_FINALLY); gcc_assert (kind == GIMPLE_TRY_CATCH || kind == GIMPLE_TRY_FINALLY);
p = as_a <gimple_statement_try> (gimple_alloc (GIMPLE_TRY, 0)); p = as_a <gimple_statement_try *> (gimple_alloc (GIMPLE_TRY, 0));
gimple_set_subcode (p, kind); gimple_set_subcode (p, kind);
if (eval) if (eval)
gimple_try_set_eval (p, eval); gimple_try_set_eval (p, eval);
...@@ -702,7 +702,7 @@ gimple ...@@ -702,7 +702,7 @@ gimple
gimple_build_resx (int region) gimple_build_resx (int region)
{ {
gimple_statement_resx *p = gimple_statement_resx *p =
as_a <gimple_statement_resx> ( as_a <gimple_statement_resx *> (
gimple_build_with_ops (GIMPLE_RESX, ERROR_MARK, 0)); gimple_build_with_ops (GIMPLE_RESX, ERROR_MARK, 0));
p->region = region; p->region = region;
return p; return p;
...@@ -752,7 +752,7 @@ gimple ...@@ -752,7 +752,7 @@ gimple
gimple_build_eh_dispatch (int region) gimple_build_eh_dispatch (int region)
{ {
gimple_statement_eh_dispatch *p = gimple_statement_eh_dispatch *p =
as_a <gimple_statement_eh_dispatch> ( as_a <gimple_statement_eh_dispatch *> (
gimple_build_with_ops (GIMPLE_EH_DISPATCH, ERROR_MARK, 0)); gimple_build_with_ops (GIMPLE_EH_DISPATCH, ERROR_MARK, 0));
p->region = region; p->region = region;
return p; return p;
...@@ -829,7 +829,7 @@ gimple_build_omp_for (gimple_seq body, int kind, tree clauses, size_t collapse, ...@@ -829,7 +829,7 @@ gimple_build_omp_for (gimple_seq body, int kind, tree clauses, size_t collapse,
gimple_seq pre_body) gimple_seq pre_body)
{ {
gimple_statement_omp_for *p = gimple_statement_omp_for *p =
as_a <gimple_statement_omp_for> (gimple_alloc (GIMPLE_OMP_FOR, 0)); as_a <gimple_statement_omp_for *> (gimple_alloc (GIMPLE_OMP_FOR, 0));
if (body) if (body)
gimple_omp_set_body (p, body); gimple_omp_set_body (p, body);
gimple_omp_for_set_clauses (p, clauses); gimple_omp_for_set_clauses (p, clauses);
...@@ -1664,7 +1664,7 @@ gimple_copy (gimple stmt) ...@@ -1664,7 +1664,7 @@ gimple_copy (gimple stmt)
gimple_omp_for_set_clauses (copy, t); gimple_omp_for_set_clauses (copy, t);
{ {
gimple_statement_omp_for *omp_for_copy = gimple_statement_omp_for *omp_for_copy =
as_a <gimple_statement_omp_for> (copy); as_a <gimple_statement_omp_for *> (copy);
omp_for_copy->iter = omp_for_copy->iter =
static_cast <struct gimple_omp_for_iter *> ( static_cast <struct gimple_omp_for_iter *> (
ggc_internal_vec_alloc_stat (sizeof (struct gimple_omp_for_iter), ggc_internal_vec_alloc_stat (sizeof (struct gimple_omp_for_iter),
......
...@@ -619,7 +619,7 @@ build_type_inheritance_graph (void) ...@@ -619,7 +619,7 @@ build_type_inheritance_graph (void)
/* We reconstruct the graph starting of types of all methods seen in the /* We reconstruct the graph starting of types of all methods seen in the
the unit. */ the unit. */
FOR_EACH_SYMBOL (n) FOR_EACH_SYMBOL (n)
if (is_a <cgraph_node> (n) if (is_a <cgraph_node *> (n)
&& DECL_VIRTUAL_P (n->decl) && DECL_VIRTUAL_P (n->decl)
&& symtab_real_symbol_p (n)) && symtab_real_symbol_p (n))
get_odr_type (method_class_type (TREE_TYPE (n->decl)), true); get_odr_type (method_class_type (TREE_TYPE (n->decl)), true);
...@@ -643,7 +643,7 @@ build_type_inheritance_graph (void) ...@@ -643,7 +643,7 @@ build_type_inheritance_graph (void)
assume it is called externally or C is in anonymous namespace and assume it is called externally or C is in anonymous namespace and
thus we will see the vtable. */ thus we will see the vtable. */
else if (is_a <varpool_node> (n) else if (is_a <varpool_node *> (n)
&& DECL_VIRTUAL_P (n->decl) && DECL_VIRTUAL_P (n->decl)
&& TREE_CODE (DECL_CONTEXT (n->decl)) == RECORD_TYPE && TREE_CODE (DECL_CONTEXT (n->decl)) == RECORD_TYPE
&& TYPE_BINFO (DECL_CONTEXT (n->decl)) && TYPE_BINFO (DECL_CONTEXT (n->decl))
......
...@@ -4253,7 +4253,7 @@ inline_write_summary (void) ...@@ -4253,7 +4253,7 @@ inline_write_summary (void)
for (i = 0; i < lto_symtab_encoder_size (encoder); i++) for (i = 0; i < lto_symtab_encoder_size (encoder); i++)
{ {
symtab_node *snode = lto_symtab_encoder_deref (encoder, i); symtab_node *snode = lto_symtab_encoder_deref (encoder, i);
cgraph_node *cnode = dyn_cast <cgraph_node> (snode); cgraph_node *cnode = dyn_cast <cgraph_node *> (snode);
if (cnode && cnode->definition && !cnode->alias) if (cnode && cnode->definition && !cnode->alias)
count++; count++;
} }
...@@ -4262,7 +4262,7 @@ inline_write_summary (void) ...@@ -4262,7 +4262,7 @@ inline_write_summary (void)
for (i = 0; i < lto_symtab_encoder_size (encoder); i++) for (i = 0; i < lto_symtab_encoder_size (encoder); i++)
{ {
symtab_node *snode = lto_symtab_encoder_deref (encoder, i); symtab_node *snode = lto_symtab_encoder_deref (encoder, i);
cgraph_node *cnode = dyn_cast <cgraph_node> (snode); cgraph_node *cnode = dyn_cast <cgraph_node *> (snode);
if (cnode && (node = cnode)->definition && !node->alias) if (cnode && (node = cnode)->definition && !node->alias)
{ {
struct inline_summary *info = inline_summary (node); struct inline_summary *info = inline_summary (node);
......
...@@ -42,7 +42,7 @@ ipa_record_reference (symtab_node *referring_node, ...@@ -42,7 +42,7 @@ ipa_record_reference (symtab_node *referring_node,
struct ipa_ref_list *list, *list2; struct ipa_ref_list *list, *list2;
ipa_ref_t *old_references; ipa_ref_t *old_references;
gcc_checking_assert (!stmt || is_a <cgraph_node> (referring_node)); gcc_checking_assert (!stmt || is_a <cgraph_node *> (referring_node));
gcc_checking_assert (use_type != IPA_REF_ALIAS || !stmt); gcc_checking_assert (use_type != IPA_REF_ALIAS || !stmt);
list = &referring_node->ref_list; list = &referring_node->ref_list;
......
...@@ -466,7 +466,7 @@ analyze_function (struct cgraph_node *fn) ...@@ -466,7 +466,7 @@ analyze_function (struct cgraph_node *fn)
local = init_function_info (fn); local = init_function_info (fn);
for (i = 0; ipa_ref_list_reference_iterate (&fn->ref_list, i, ref); i++) for (i = 0; ipa_ref_list_reference_iterate (&fn->ref_list, i, ref); i++)
{ {
if (!is_a <varpool_node> (ref->referred)) if (!is_a <varpool_node *> (ref->referred))
continue; continue;
var = ipa_ref_varpool_node (ref)->decl; var = ipa_ref_varpool_node (ref)->decl;
if (!is_proper_for_analysis (var)) if (!is_proper_for_analysis (var))
...@@ -973,7 +973,7 @@ ipa_reference_write_optimization_summary (void) ...@@ -973,7 +973,7 @@ ipa_reference_write_optimization_summary (void)
for (i = 0; i < lto_symtab_encoder_size (encoder); i++) for (i = 0; i < lto_symtab_encoder_size (encoder); i++)
{ {
symtab_node *snode = lto_symtab_encoder_deref (encoder, i); symtab_node *snode = lto_symtab_encoder_deref (encoder, i);
varpool_node *vnode = dyn_cast <varpool_node> (snode); varpool_node *vnode = dyn_cast <varpool_node *> (snode);
if (vnode if (vnode
&& bitmap_bit_p (all_module_statics, DECL_UID (vnode->decl)) && bitmap_bit_p (all_module_statics, DECL_UID (vnode->decl))
&& referenced_from_this_partition_p (&vnode->ref_list, encoder)) && referenced_from_this_partition_p (&vnode->ref_list, encoder))
...@@ -991,7 +991,7 @@ ipa_reference_write_optimization_summary (void) ...@@ -991,7 +991,7 @@ ipa_reference_write_optimization_summary (void)
for (i = 0; i < lto_symtab_encoder_size (encoder); i++) for (i = 0; i < lto_symtab_encoder_size (encoder); i++)
{ {
symtab_node *snode = lto_symtab_encoder_deref (encoder, i); symtab_node *snode = lto_symtab_encoder_deref (encoder, i);
cgraph_node *cnode = dyn_cast <cgraph_node> (snode); cgraph_node *cnode = dyn_cast <cgraph_node *> (snode);
if (cnode && write_node_summary_p (cnode, encoder, ltrans_statics)) if (cnode && write_node_summary_p (cnode, encoder, ltrans_statics))
count++; count++;
} }
...@@ -1006,7 +1006,7 @@ ipa_reference_write_optimization_summary (void) ...@@ -1006,7 +1006,7 @@ ipa_reference_write_optimization_summary (void)
for (i = 0; i < lto_symtab_encoder_size (encoder); i++) for (i = 0; i < lto_symtab_encoder_size (encoder); i++)
{ {
symtab_node *snode = lto_symtab_encoder_deref (encoder, i); symtab_node *snode = lto_symtab_encoder_deref (encoder, i);
cgraph_node *cnode = dyn_cast <cgraph_node> (snode); cgraph_node *cnode = dyn_cast <cgraph_node *> (snode);
if (cnode && write_node_summary_p (cnode, encoder, ltrans_statics)) if (cnode && write_node_summary_p (cnode, encoder, ltrans_statics))
{ {
ipa_reference_optimization_summary_t info; ipa_reference_optimization_summary_t info;
......
...@@ -387,7 +387,7 @@ symtab_remove_unreachable_nodes (bool before_inlining_p, FILE *file) ...@@ -387,7 +387,7 @@ symtab_remove_unreachable_nodes (bool before_inlining_p, FILE *file)
before_inlining_p, reachable); before_inlining_p, reachable);
} }
if (cgraph_node *cnode = dyn_cast <cgraph_node> (node)) if (cgraph_node *cnode = dyn_cast <cgraph_node *> (node))
{ {
/* Mark the callees reachable unless they are direct calls to extern /* Mark the callees reachable unless they are direct calls to extern
inline functions we decided to not inline. */ inline functions we decided to not inline. */
...@@ -465,7 +465,7 @@ symtab_remove_unreachable_nodes (bool before_inlining_p, FILE *file) ...@@ -465,7 +465,7 @@ symtab_remove_unreachable_nodes (bool before_inlining_p, FILE *file)
/* When we see constructor of external variable, keep referred nodes in the /* When we see constructor of external variable, keep referred nodes in the
boundary. This will also hold initializers of the external vars NODE boundary. This will also hold initializers of the external vars NODE
refers to. */ refers to. */
varpool_node *vnode = dyn_cast <varpool_node> (node); varpool_node *vnode = dyn_cast <varpool_node *> (node);
if (vnode if (vnode
&& DECL_EXTERNAL (node->decl) && DECL_EXTERNAL (node->decl)
&& !vnode->alias && !vnode->alias
...@@ -694,7 +694,7 @@ address_taken_from_non_vtable_p (symtab_node *node) ...@@ -694,7 +694,7 @@ address_taken_from_non_vtable_p (symtab_node *node)
if (ref->use == IPA_REF_ADDR) if (ref->use == IPA_REF_ADDR)
{ {
varpool_node *node; varpool_node *node;
if (is_a <cgraph_node> (ref->referring)) if (is_a <cgraph_node *> (ref->referring))
return true; return true;
node = ipa_ref_referring_varpool_node (ref); node = ipa_ref_referring_varpool_node (ref);
if (!DECL_VIRTUAL_P (node->decl)) if (!DECL_VIRTUAL_P (node->decl))
...@@ -732,7 +732,7 @@ comdat_can_be_unshared_p_1 (symtab_node *node) ...@@ -732,7 +732,7 @@ comdat_can_be_unshared_p_1 (symtab_node *node)
return false; return false;
/* Non-readonly and volatile variables can not be duplicated. */ /* Non-readonly and volatile variables can not be duplicated. */
if (is_a <varpool_node> (node) if (is_a <varpool_node *> (node)
&& (!TREE_READONLY (node->decl) && (!TREE_READONLY (node->decl)
|| TREE_THIS_VOLATILE (node->decl))) || TREE_THIS_VOLATILE (node->decl)))
return false; return false;
......
...@@ -34,21 +34,21 @@ bool is_a <TYPE> (pointer) ...@@ -34,21 +34,21 @@ bool is_a <TYPE> (pointer)
Suppose you have a symtab_node *ptr, AKA symtab_node *ptr. You can test Suppose you have a symtab_node *ptr, AKA symtab_node *ptr. You can test
whether it points to a 'derived' cgraph_node as follows. whether it points to a 'derived' cgraph_node as follows.
if (is_a <cgraph_node> (ptr)) if (is_a <cgraph_node *> (ptr))
.... ....
TYPE *as_a <TYPE> (pointer) TYPE as_a <TYPE> (pointer)
Converts pointer to a TYPE*. Converts pointer to a TYPE.
You can just assume that it is such a node. You can just assume that it is such a node.
do_something_with (as_a <cgraph_node> *ptr); do_something_with (as_a <cgraph_node *> *ptr);
TYPE *dyn_cast <TYPE> (pointer) TYPE dyn_cast <TYPE> (pointer)
Converts pointer to TYPE* if and only if "is_a <TYPE> pointer". Otherwise, Converts pointer to TYPE if and only if "is_a <TYPE> pointer". Otherwise,
returns NULL. This function is essentially a checked down cast. returns NULL. This function is essentially a checked down cast.
This functions reduce compile time and increase type safety when treating a This functions reduce compile time and increase type safety when treating a
...@@ -57,7 +57,7 @@ TYPE *dyn_cast <TYPE> (pointer) ...@@ -57,7 +57,7 @@ TYPE *dyn_cast <TYPE> (pointer)
You can test and obtain a pointer to the 'derived' type in one indivisible You can test and obtain a pointer to the 'derived' type in one indivisible
operation. operation.
if (cgraph_node *cptr = dyn_cast <cgraph_node> (ptr)) if (cgraph_node *cptr = dyn_cast <cgraph_node *> (ptr))
.... ....
As an example, the code change is from As an example, the code change is from
...@@ -70,7 +70,7 @@ TYPE *dyn_cast <TYPE> (pointer) ...@@ -70,7 +70,7 @@ TYPE *dyn_cast <TYPE> (pointer)
to to
if (cgraph_node *cnode = dyn_cast <cgraph_node> (node)) if (cgraph_node *cnode = dyn_cast <cgraph_node *> (node))
{ {
.... ....
} }
...@@ -88,7 +88,7 @@ TYPE *dyn_cast <TYPE> (pointer) ...@@ -88,7 +88,7 @@ TYPE *dyn_cast <TYPE> (pointer)
becomes becomes
varpool_node *vnode = dyn_cast <varpool_node> (node); varpool_node *vnode = dyn_cast <varpool_node *> (node);
if (vnode && vnode->finalized) if (vnode && vnode->finalized)
varpool_analyze_node (vnode); varpool_analyze_node (vnode);
...@@ -110,7 +110,7 @@ example, ...@@ -110,7 +110,7 @@ example,
template <> template <>
template <> template <>
inline bool inline bool
is_a_helper <cgraph_node>::test (symtab_node *p) is_a_helper <cgraph_node *>::test (symtab_node *p)
{ {
return p->type == SYMTAB_FUNCTION; return p->type == SYMTAB_FUNCTION;
} }
...@@ -122,7 +122,7 @@ when needed may result in a crash. For example, ...@@ -122,7 +122,7 @@ when needed may result in a crash. For example,
template <> template <>
template <> template <>
inline bool inline bool
is_a_helper <cgraph_node>::cast (symtab_node *p) is_a_helper <cgraph_node *>::cast (symtab_node *p)
{ {
return &p->x_function; return &p->x_function;
} }
...@@ -140,7 +140,7 @@ struct is_a_helper ...@@ -140,7 +140,7 @@ struct is_a_helper
template <typename U> template <typename U>
static inline bool test (U *p); static inline bool test (U *p);
template <typename U> template <typename U>
static inline T *cast (U *p); static inline T cast (U *p);
}; };
/* Note that we deliberately do not define the 'test' member template. Not /* Note that we deliberately do not define the 'test' member template. Not
...@@ -154,10 +154,10 @@ struct is_a_helper ...@@ -154,10 +154,10 @@ struct is_a_helper
template <typename T> template <typename T>
template <typename U> template <typename U>
inline T * inline T
is_a_helper <T>::cast (U *p) is_a_helper <T>::cast (U *p)
{ {
return reinterpret_cast <T *> (p); return reinterpret_cast <T> (p);
} }
...@@ -178,7 +178,7 @@ is_a (U *p) ...@@ -178,7 +178,7 @@ is_a (U *p)
discussion above for when to use this function. */ discussion above for when to use this function. */
template <typename T, typename U> template <typename T, typename U>
inline T * inline T
as_a (U *p) as_a (U *p)
{ {
gcc_checking_assert (is_a <T> (p)); gcc_checking_assert (is_a <T> (p));
...@@ -189,13 +189,13 @@ as_a (U *p) ...@@ -189,13 +189,13 @@ as_a (U *p)
the discussion above for when to use this function. */ the discussion above for when to use this function. */
template <typename T, typename U> template <typename T, typename U>
inline T * inline T
dyn_cast (U *p) dyn_cast (U *p)
{ {
if (is_a <T> (p)) if (is_a <T> (p))
return is_a_helper <T>::cast (p); return is_a_helper <T>::cast (p);
else else
return static_cast <T *> (0); return static_cast <T> (0);
} }
#endif /* GCC_IS_A_H */ #endif /* GCC_IS_A_H */
...@@ -619,7 +619,7 @@ lto_output_ref (struct lto_simple_output_block *ob, struct ipa_ref *ref, ...@@ -619,7 +619,7 @@ lto_output_ref (struct lto_simple_output_block *ob, struct ipa_ref *ref,
gcc_assert (nref != LCC_NOT_FOUND); gcc_assert (nref != LCC_NOT_FOUND);
streamer_write_hwi_stream (ob->main_stream, nref); streamer_write_hwi_stream (ob->main_stream, nref);
node = dyn_cast <cgraph_node> (ref->referring); node = dyn_cast <cgraph_node *> (ref->referring);
if (node) if (node)
{ {
if (ref->stmt) if (ref->stmt)
...@@ -753,7 +753,7 @@ add_references (lto_symtab_encoder_t encoder, ...@@ -753,7 +753,7 @@ add_references (lto_symtab_encoder_t encoder,
int i; int i;
struct ipa_ref *ref; struct ipa_ref *ref;
for (i = 0; ipa_ref_list_reference_iterate (list, i, ref); i++) for (i = 0; ipa_ref_list_reference_iterate (list, i, ref); i++)
if (is_a <cgraph_node> (ref->referred)) if (is_a <cgraph_node *> (ref->referred))
add_node_to (encoder, ipa_ref_node (ref), false); add_node_to (encoder, ipa_ref_node (ref), false);
else else
lto_symtab_encoder_encode (encoder, ref->referred); lto_symtab_encoder_encode (encoder, ref->referred);
...@@ -819,7 +819,7 @@ compute_ltrans_boundary (lto_symtab_encoder_t in_encoder) ...@@ -819,7 +819,7 @@ compute_ltrans_boundary (lto_symtab_encoder_t in_encoder)
for (i = 0; i < lto_symtab_encoder_size (encoder); i++) for (i = 0; i < lto_symtab_encoder_size (encoder); i++)
{ {
symtab_node *node = lto_symtab_encoder_deref (encoder, i); symtab_node *node = lto_symtab_encoder_deref (encoder, i);
if (varpool_node *vnode = dyn_cast <varpool_node> (node)) if (varpool_node *vnode = dyn_cast <varpool_node *> (node))
{ {
if (!lto_symtab_encoder_encode_initializer_p (encoder, if (!lto_symtab_encoder_encode_initializer_p (encoder,
vnode) vnode)
...@@ -913,7 +913,7 @@ output_symtab (void) ...@@ -913,7 +913,7 @@ output_symtab (void)
for (i = 0; i < n_nodes; i++) for (i = 0; i < n_nodes; i++)
{ {
symtab_node *node = lto_symtab_encoder_deref (encoder, i); symtab_node *node = lto_symtab_encoder_deref (encoder, i);
if (cgraph_node *cnode = dyn_cast <cgraph_node> (node)) if (cgraph_node *cnode = dyn_cast <cgraph_node *> (node))
lto_output_node (ob, cnode, encoder); lto_output_node (ob, cnode, encoder);
else else
lto_output_varpool_node (ob, varpool (node), encoder); lto_output_varpool_node (ob, varpool (node), encoder);
...@@ -1199,7 +1199,7 @@ input_ref (struct lto_input_block *ib, ...@@ -1199,7 +1199,7 @@ input_ref (struct lto_input_block *ib,
node = nodes[streamer_read_hwi (ib)]; node = nodes[streamer_read_hwi (ib)];
ref = ipa_record_reference (referring_node, node, use, NULL); ref = ipa_record_reference (referring_node, node, use, NULL);
ref->speculative = speculative; ref->speculative = speculative;
if (is_a <cgraph_node> (referring_node)) if (is_a <cgraph_node *> (referring_node))
ref->lto_stmt_uid = streamer_read_hwi (ib); ref->lto_stmt_uid = streamer_read_hwi (ib);
} }
...@@ -1316,12 +1316,12 @@ input_cgraph_1 (struct lto_file_decl_data *file_data, ...@@ -1316,12 +1316,12 @@ input_cgraph_1 (struct lto_file_decl_data *file_data,
/* AUX pointers should be all non-zero for function nodes read from the stream. */ /* AUX pointers should be all non-zero for function nodes read from the stream. */
#ifdef ENABLE_CHECKING #ifdef ENABLE_CHECKING
FOR_EACH_VEC_ELT (nodes, i, node) FOR_EACH_VEC_ELT (nodes, i, node)
gcc_assert (node->aux || !is_a <cgraph_node> (node)); gcc_assert (node->aux || !is_a <cgraph_node *> (node));
#endif #endif
FOR_EACH_VEC_ELT (nodes, i, node) FOR_EACH_VEC_ELT (nodes, i, node)
{ {
int ref; int ref;
if (cgraph_node *cnode = dyn_cast <cgraph_node> (node)) if (cgraph_node *cnode = dyn_cast <cgraph_node *> (node))
{ {
ref = (int) (intptr_t) cnode->global.inlined_to; ref = (int) (intptr_t) cnode->global.inlined_to;
...@@ -1346,7 +1346,7 @@ input_cgraph_1 (struct lto_file_decl_data *file_data, ...@@ -1346,7 +1346,7 @@ input_cgraph_1 (struct lto_file_decl_data *file_data,
node->same_comdat_group = NULL; node->same_comdat_group = NULL;
} }
FOR_EACH_VEC_ELT (nodes, i, node) FOR_EACH_VEC_ELT (nodes, i, node)
node->aux = is_a <cgraph_node> (node) ? (void *)1 : NULL; node->aux = is_a <cgraph_node *> (node) ? (void *)1 : NULL;
return nodes; return nodes;
} }
...@@ -1696,7 +1696,7 @@ output_cgraph_opt_summary (void) ...@@ -1696,7 +1696,7 @@ output_cgraph_opt_summary (void)
for (i = 0; i < n_nodes; i++) for (i = 0; i < n_nodes; i++)
{ {
symtab_node *node = lto_symtab_encoder_deref (encoder, i); symtab_node *node = lto_symtab_encoder_deref (encoder, i);
cgraph_node *cnode = dyn_cast <cgraph_node> (node); cgraph_node *cnode = dyn_cast <cgraph_node *> (node);
if (cnode && output_cgraph_opt_summary_p (cnode)) if (cnode && output_cgraph_opt_summary_p (cnode))
count++; count++;
} }
...@@ -1704,7 +1704,7 @@ output_cgraph_opt_summary (void) ...@@ -1704,7 +1704,7 @@ output_cgraph_opt_summary (void)
for (i = 0; i < n_nodes; i++) for (i = 0; i < n_nodes; i++)
{ {
symtab_node *node = lto_symtab_encoder_deref (encoder, i); symtab_node *node = lto_symtab_encoder_deref (encoder, i);
cgraph_node *cnode = dyn_cast <cgraph_node> (node); cgraph_node *cnode = dyn_cast <cgraph_node *> (node);
if (cnode && output_cgraph_opt_summary_p (cnode)) if (cnode && output_cgraph_opt_summary_p (cnode))
{ {
streamer_write_uhwi (ob, i); streamer_write_uhwi (ob, i);
......
...@@ -2067,7 +2067,7 @@ lto_output (void) ...@@ -2067,7 +2067,7 @@ lto_output (void)
for (i = 0; i < n_nodes; i++) for (i = 0; i < n_nodes; i++)
{ {
symtab_node *snode = lto_symtab_encoder_deref (encoder, i); symtab_node *snode = lto_symtab_encoder_deref (encoder, i);
if (cgraph_node *node = dyn_cast <cgraph_node> (snode)) if (cgraph_node *node = dyn_cast <cgraph_node *> (snode))
{ {
if (lto_symtab_encoder_encode_body_p (encoder, node) if (lto_symtab_encoder_encode_body_p (encoder, node)
&& !node->alias) && !node->alias)
...@@ -2087,7 +2087,7 @@ lto_output (void) ...@@ -2087,7 +2087,7 @@ lto_output (void)
lto_record_function_out_decl_state (node->decl, decl_state); lto_record_function_out_decl_state (node->decl, decl_state);
} }
} }
else if (varpool_node *node = dyn_cast <varpool_node> (snode)) else if (varpool_node *node = dyn_cast <varpool_node *> (snode))
{ {
/* Wrap symbol references inside the ctor in a type /* Wrap symbol references inside the ctor in a type
preserving MEM_REF. */ preserving MEM_REF. */
...@@ -2344,7 +2344,7 @@ output_symbol_p (symtab_node *node) ...@@ -2344,7 +2344,7 @@ output_symbol_p (symtab_node *node)
/* We keep external functions in symtab for sake of inlining /* We keep external functions in symtab for sake of inlining
and devirtualization. We do not want to see them in symbol table as and devirtualization. We do not want to see them in symbol table as
references unless they are really used. */ references unless they are really used. */
cnode = dyn_cast <cgraph_node> (node); cnode = dyn_cast <cgraph_node *> (node);
if (cnode && (!node->definition || DECL_EXTERNAL (cnode->decl)) if (cnode && (!node->definition || DECL_EXTERNAL (cnode->decl))
&& cnode->callers) && cnode->callers)
return true; return true;
...@@ -2362,7 +2362,7 @@ output_symbol_p (symtab_node *node) ...@@ -2362,7 +2362,7 @@ output_symbol_p (symtab_node *node)
{ {
if (ref->use == IPA_REF_ALIAS) if (ref->use == IPA_REF_ALIAS)
continue; continue;
if (is_a <cgraph_node> (ref->referring)) if (is_a <cgraph_node *> (ref->referring))
return true; return true;
if (!DECL_EXTERNAL (ref->referring->decl)) if (!DECL_EXTERNAL (ref->referring->decl))
return true; return true;
......
...@@ -1139,7 +1139,7 @@ lsei_next_function_in_partition (lto_symtab_encoder_iterator *lsei) ...@@ -1139,7 +1139,7 @@ lsei_next_function_in_partition (lto_symtab_encoder_iterator *lsei)
{ {
lsei_next (lsei); lsei_next (lsei);
while (!lsei_end_p (*lsei) while (!lsei_end_p (*lsei)
&& (!is_a <cgraph_node> (lsei_node (*lsei)) && (!is_a <cgraph_node *> (lsei_node (*lsei))
|| !lto_symtab_encoder_in_partition_p (lsei->encoder, lsei_node (*lsei)))) || !lto_symtab_encoder_in_partition_p (lsei->encoder, lsei_node (*lsei))))
lsei_next (lsei); lsei_next (lsei);
} }
...@@ -1152,7 +1152,7 @@ lsei_start_function_in_partition (lto_symtab_encoder_t encoder) ...@@ -1152,7 +1152,7 @@ lsei_start_function_in_partition (lto_symtab_encoder_t encoder)
if (lsei_end_p (lsei)) if (lsei_end_p (lsei))
return lsei; return lsei;
if (!is_a <cgraph_node> (lsei_node (lsei)) if (!is_a <cgraph_node *> (lsei_node (lsei))
|| !lto_symtab_encoder_in_partition_p (encoder, lsei_node (lsei))) || !lto_symtab_encoder_in_partition_p (encoder, lsei_node (lsei)))
lsei_next_function_in_partition (&lsei); lsei_next_function_in_partition (&lsei);
...@@ -1165,7 +1165,7 @@ lsei_next_variable_in_partition (lto_symtab_encoder_iterator *lsei) ...@@ -1165,7 +1165,7 @@ lsei_next_variable_in_partition (lto_symtab_encoder_iterator *lsei)
{ {
lsei_next (lsei); lsei_next (lsei);
while (!lsei_end_p (*lsei) while (!lsei_end_p (*lsei)
&& (!is_a <varpool_node> (lsei_node (*lsei)) && (!is_a <varpool_node *> (lsei_node (*lsei))
|| !lto_symtab_encoder_in_partition_p (lsei->encoder, lsei_node (*lsei)))) || !lto_symtab_encoder_in_partition_p (lsei->encoder, lsei_node (*lsei))))
lsei_next (lsei); lsei_next (lsei);
} }
...@@ -1178,7 +1178,7 @@ lsei_start_variable_in_partition (lto_symtab_encoder_t encoder) ...@@ -1178,7 +1178,7 @@ lsei_start_variable_in_partition (lto_symtab_encoder_t encoder)
if (lsei_end_p (lsei)) if (lsei_end_p (lsei))
return lsei; return lsei;
if (!is_a <varpool_node> (lsei_node (lsei)) if (!is_a <varpool_node *> (lsei_node (lsei))
|| !lto_symtab_encoder_in_partition_p (encoder, lsei_node (lsei))) || !lto_symtab_encoder_in_partition_p (encoder, lsei_node (lsei)))
lsei_next_variable_in_partition (&lsei); lsei_next_variable_in_partition (&lsei);
......
2014-04-23 David Malcolm <dmalcolm@redhat.com>
* lto-partition.c (add_references_to_partition): Update for
removal of implicit pointer from the is-a.h API.
(add_symbol_to_partition_1): Likewise.
(contained_in_symbol): Likewise.
(undo_partition): Likewise.
(lto_balanced_map): Likewise.
(promote_symbol): Likewise.
* lto-symtab.c (lto_symtab_merge_symbols_1): Likewise.
(lto_symtab_merge_symbols): Likewise.
* lto.c (lto_wpa_write_files): Likewise.
2014-04-15 Richard Biener <rguenther@suse.de> 2014-04-15 Richard Biener <rguenther@suse.de>
* lto.c: Include params.h. * lto.c: Include params.h.
......
...@@ -95,7 +95,7 @@ add_references_to_partition (ltrans_partition part, symtab_node *node) ...@@ -95,7 +95,7 @@ add_references_to_partition (ltrans_partition part, symtab_node *node)
/* References to a readonly variable may be constant foled into its value. /* References to a readonly variable may be constant foled into its value.
Recursively look into the initializers of the constant variable and add Recursively look into the initializers of the constant variable and add
references, too. */ references, too. */
else if (is_a <varpool_node> (ref->referred) else if (is_a <varpool_node *> (ref->referred)
&& ctor_for_folding (ref->referred->decl) != error_mark_node && ctor_for_folding (ref->referred->decl) != error_mark_node
&& !lto_symtab_encoder_in_partition_p (part->encoder, ref->referred)) && !lto_symtab_encoder_in_partition_p (part->encoder, ref->referred))
{ {
...@@ -146,7 +146,7 @@ add_symbol_to_partition_1 (ltrans_partition part, symtab_node *node) ...@@ -146,7 +146,7 @@ add_symbol_to_partition_1 (ltrans_partition part, symtab_node *node)
} }
node->aux = (void *)((size_t)node->aux + 1); node->aux = (void *)((size_t)node->aux + 1);
if (cgraph_node *cnode = dyn_cast <cgraph_node> (node)) if (cgraph_node *cnode = dyn_cast <cgraph_node *> (node))
{ {
struct cgraph_edge *e; struct cgraph_edge *e;
if (!node->alias) if (!node->alias)
...@@ -194,14 +194,14 @@ contained_in_symbol (symtab_node *node) ...@@ -194,14 +194,14 @@ contained_in_symbol (symtab_node *node)
/* Weakrefs are never contained in anything. */ /* Weakrefs are never contained in anything. */
if (node->weakref) if (node->weakref)
return node; return node;
if (cgraph_node *cnode = dyn_cast <cgraph_node> (node)) if (cgraph_node *cnode = dyn_cast <cgraph_node *> (node))
{ {
cnode = cgraph_function_node (cnode, NULL); cnode = cgraph_function_node (cnode, NULL);
if (cnode->global.inlined_to) if (cnode->global.inlined_to)
cnode = cnode->global.inlined_to; cnode = cnode->global.inlined_to;
return cnode; return cnode;
} }
else if (varpool_node *vnode = dyn_cast <varpool_node> (node)) else if (varpool_node *vnode = dyn_cast <varpool_node *> (node))
return varpool_variable_node (vnode, NULL); return varpool_variable_node (vnode, NULL);
return node; return node;
} }
...@@ -252,7 +252,7 @@ undo_partition (ltrans_partition partition, unsigned int n_nodes) ...@@ -252,7 +252,7 @@ undo_partition (ltrans_partition partition, unsigned int n_nodes)
pointer_set_destroy (partition->initializers_visited); pointer_set_destroy (partition->initializers_visited);
partition->initializers_visited = NULL; partition->initializers_visited = NULL;
if (!node->alias && (cnode = dyn_cast <cgraph_node> (node))) if (!node->alias && (cnode = dyn_cast <cgraph_node *> (node)))
partition->insns -= inline_summary (cnode)->self_size; partition->insns -= inline_summary (cnode)->self_size;
lto_symtab_encoder_delete_node (partition->encoder, node); lto_symtab_encoder_delete_node (partition->encoder, node);
node->aux = (void *)((size_t)node->aux - 1); node->aux = (void *)((size_t)node->aux - 1);
...@@ -522,7 +522,7 @@ lto_balanced_map (int n_lto_partitions) ...@@ -522,7 +522,7 @@ lto_balanced_map (int n_lto_partitions)
symtab_node *snode = lto_symtab_encoder_deref (partition->encoder, symtab_node *snode = lto_symtab_encoder_deref (partition->encoder,
last_visited_node); last_visited_node);
if (cgraph_node *node = dyn_cast <cgraph_node> (snode)) if (cgraph_node *node = dyn_cast <cgraph_node *> (snode))
{ {
struct cgraph_edge *edge; struct cgraph_edge *edge;
...@@ -577,7 +577,7 @@ lto_balanced_map (int n_lto_partitions) ...@@ -577,7 +577,7 @@ lto_balanced_map (int n_lto_partitions)
/* Compute boundary cost of IPA REF edges and at the same time look into /* Compute boundary cost of IPA REF edges and at the same time look into
variables referenced from current partition and try to add them. */ variables referenced from current partition and try to add them. */
for (j = 0; ipa_ref_list_reference_iterate (refs, j, ref); j++) for (j = 0; ipa_ref_list_reference_iterate (refs, j, ref); j++)
if (is_a <varpool_node> (ref->referred)) if (is_a <varpool_node *> (ref->referred))
{ {
int index; int index;
...@@ -611,7 +611,7 @@ lto_balanced_map (int n_lto_partitions) ...@@ -611,7 +611,7 @@ lto_balanced_map (int n_lto_partitions)
cost++; cost++;
} }
for (j = 0; ipa_ref_list_referring_iterate (refs, j, ref); j++) for (j = 0; ipa_ref_list_referring_iterate (refs, j, ref); j++)
if (is_a <varpool_node> (ref->referring)) if (is_a <varpool_node *> (ref->referring))
{ {
int index; int index;
...@@ -811,7 +811,7 @@ promote_symbol (symtab_node *node) ...@@ -811,7 +811,7 @@ promote_symbol (symtab_node *node)
static bool static bool
may_need_named_section_p (lto_symtab_encoder_t encoder, symtab_node *node) may_need_named_section_p (lto_symtab_encoder_t encoder, symtab_node *node)
{ {
struct cgraph_node *cnode = dyn_cast <cgraph_node> (node); struct cgraph_node *cnode = dyn_cast <cgraph_node *> (node);
if (!cnode) if (!cnode)
return false; return false;
if (symtab_real_symbol_p (node)) if (symtab_real_symbol_p (node))
......
...@@ -560,10 +560,10 @@ lto_symtab_merge_symbols_1 (symtab_node *prevailing) ...@@ -560,10 +560,10 @@ lto_symtab_merge_symbols_1 (symtab_node *prevailing)
if (!lto_symtab_symbol_p (e)) if (!lto_symtab_symbol_p (e))
continue; continue;
cgraph_node *ce = dyn_cast <cgraph_node> (e); cgraph_node *ce = dyn_cast <cgraph_node *> (e);
if (ce && !DECL_BUILT_IN (e->decl)) if (ce && !DECL_BUILT_IN (e->decl))
lto_cgraph_replace_node (ce, cgraph (prevailing)); lto_cgraph_replace_node (ce, cgraph (prevailing));
if (varpool_node *ve = dyn_cast <varpool_node> (e)) if (varpool_node *ve = dyn_cast <varpool_node *> (e))
lto_varpool_replace_node (ve, varpool (prevailing)); lto_varpool_replace_node (ve, varpool (prevailing));
} }
...@@ -609,7 +609,7 @@ lto_symtab_merge_symbols (void) ...@@ -609,7 +609,7 @@ lto_symtab_merge_symbols (void)
} }
node->aux = NULL; node->aux = NULL;
if (!(cnode = dyn_cast <cgraph_node> (node)) if (!(cnode = dyn_cast <cgraph_node *> (node))
|| !cnode->clone_of || !cnode->clone_of
|| cnode->clone_of->decl != cnode->decl) || cnode->clone_of->decl != cnode->decl)
{ {
...@@ -624,11 +624,11 @@ lto_symtab_merge_symbols (void) ...@@ -624,11 +624,11 @@ lto_symtab_merge_symbols (void)
/* The user defined assembler variables are also not unified by their /* The user defined assembler variables are also not unified by their
symbol name (since it is irrelevant), but we need to unify symbol symbol name (since it is irrelevant), but we need to unify symbol
nodes if tree merging occured. */ nodes if tree merging occured. */
if ((vnode = dyn_cast <varpool_node> (node)) if ((vnode = dyn_cast <varpool_node *> (node))
&& DECL_HARD_REGISTER (vnode->decl) && DECL_HARD_REGISTER (vnode->decl)
&& (node2 = symtab_get_node (vnode->decl)) && (node2 = symtab_get_node (vnode->decl))
&& node2 != node) && node2 != node)
lto_varpool_replace_node (dyn_cast <varpool_node> (node2), lto_varpool_replace_node (dyn_cast <varpool_node *> (node2),
vnode); vnode);
......
...@@ -2625,13 +2625,13 @@ lto_wpa_write_files (void) ...@@ -2625,13 +2625,13 @@ lto_wpa_write_files (void)
if (!lto_symtab_encoder_in_partition_p (part->encoder, node)) if (!lto_symtab_encoder_in_partition_p (part->encoder, node))
{ {
fprintf (cgraph_dump_file, "%s ", node->asm_name ()); fprintf (cgraph_dump_file, "%s ", node->asm_name ());
cgraph_node *cnode = dyn_cast <cgraph_node> (node); cgraph_node *cnode = dyn_cast <cgraph_node *> (node);
if (cnode if (cnode
&& lto_symtab_encoder_encode_body_p (part->encoder, cnode)) && lto_symtab_encoder_encode_body_p (part->encoder, cnode))
fprintf (cgraph_dump_file, "(body included)"); fprintf (cgraph_dump_file, "(body included)");
else else
{ {
varpool_node *vnode = dyn_cast <varpool_node> (node); varpool_node *vnode = dyn_cast <varpool_node *> (node);
if (vnode if (vnode
&& lto_symtab_encoder_encode_initializer_p (part->encoder, vnode)) && lto_symtab_encoder_encode_initializer_p (part->encoder, vnode))
fprintf (cgraph_dump_file, "(initializer included)"); fprintf (cgraph_dump_file, "(initializer included)");
......
...@@ -192,7 +192,7 @@ eq_assembler_name (const void *p1, const void *p2) ...@@ -192,7 +192,7 @@ eq_assembler_name (const void *p1, const void *p2)
static void static void
insert_to_assembler_name_hash (symtab_node *node, bool with_clones) insert_to_assembler_name_hash (symtab_node *node, bool with_clones)
{ {
if (is_a <varpool_node> (node) && DECL_HARD_REGISTER (node->decl)) if (is_a <varpool_node *> (node) && DECL_HARD_REGISTER (node->decl))
return; return;
gcc_checking_assert (!node->previous_sharing_asm_name gcc_checking_assert (!node->previous_sharing_asm_name
&& !node->next_sharing_asm_name); && !node->next_sharing_asm_name);
...@@ -214,7 +214,7 @@ insert_to_assembler_name_hash (symtab_node *node, bool with_clones) ...@@ -214,7 +214,7 @@ insert_to_assembler_name_hash (symtab_node *node, bool with_clones)
*aslot = node; *aslot = node;
/* Update also possible inline clones sharing a decl. */ /* Update also possible inline clones sharing a decl. */
cnode = dyn_cast <cgraph_node> (node); cnode = dyn_cast <cgraph_node *> (node);
if (cnode && cnode->clones && with_clones) if (cnode && cnode->clones && with_clones)
for (cnode = cnode->clones; cnode; cnode = cnode->next_sibling_clone) for (cnode = cnode->clones; cnode; cnode = cnode->next_sibling_clone)
if (cnode->decl == decl) if (cnode->decl == decl)
...@@ -258,7 +258,7 @@ unlink_from_assembler_name_hash (symtab_node *node, bool with_clones) ...@@ -258,7 +258,7 @@ unlink_from_assembler_name_hash (symtab_node *node, bool with_clones)
node->previous_sharing_asm_name = NULL; node->previous_sharing_asm_name = NULL;
/* Update also possible inline clones sharing a decl. */ /* Update also possible inline clones sharing a decl. */
cnode = dyn_cast <cgraph_node> (node); cnode = dyn_cast <cgraph_node *> (node);
if (cnode && cnode->clones && with_clones) if (cnode && cnode->clones && with_clones)
for (cnode = cnode->clones; cnode; cnode = cnode->next_sibling_clone) for (cnode = cnode->clones; cnode; cnode = cnode->next_sibling_clone)
if (cnode->decl == decl) if (cnode->decl == decl)
...@@ -364,14 +364,14 @@ symtab_unregister_node (symtab_node *node) ...@@ -364,14 +364,14 @@ symtab_unregister_node (symtab_node *node)
if (slot && *slot && *slot == node) if (slot && *slot && *slot == node)
{ {
symtab_node *replacement_node = NULL; symtab_node *replacement_node = NULL;
if (cgraph_node *cnode = dyn_cast <cgraph_node> (node)) if (cgraph_node *cnode = dyn_cast <cgraph_node *> (node))
replacement_node = cgraph_find_replacement_node (cnode); replacement_node = cgraph_find_replacement_node (cnode);
if (!replacement_node) if (!replacement_node)
htab_clear_slot (symtab_hash, slot); htab_clear_slot (symtab_hash, slot);
else else
*slot = replacement_node; *slot = replacement_node;
} }
if (!is_a <varpool_node> (node) || !DECL_HARD_REGISTER (node->decl)) if (!is_a <varpool_node *> (node) || !DECL_HARD_REGISTER (node->decl))
unlink_from_assembler_name_hash (node, false); unlink_from_assembler_name_hash (node, false);
} }
...@@ -411,9 +411,9 @@ symtab_get_node (const_tree decl) ...@@ -411,9 +411,9 @@ symtab_get_node (const_tree decl)
void void
symtab_remove_node (symtab_node *node) symtab_remove_node (symtab_node *node)
{ {
if (cgraph_node *cnode = dyn_cast <cgraph_node> (node)) if (cgraph_node *cnode = dyn_cast <cgraph_node *> (node))
cgraph_remove_node (cnode); cgraph_remove_node (cnode);
else if (varpool_node *vnode = dyn_cast <varpool_node> (node)) else if (varpool_node *vnode = dyn_cast <varpool_node *> (node))
varpool_remove_node (vnode); varpool_remove_node (vnode);
} }
...@@ -690,9 +690,9 @@ dump_symtab_base (FILE *f, symtab_node *node) ...@@ -690,9 +690,9 @@ dump_symtab_base (FILE *f, symtab_node *node)
void void
dump_symtab_node (FILE *f, symtab_node *node) dump_symtab_node (FILE *f, symtab_node *node)
{ {
if (cgraph_node *cnode = dyn_cast <cgraph_node> (node)) if (cgraph_node *cnode = dyn_cast <cgraph_node *> (node))
dump_cgraph_node (f, cnode); dump_cgraph_node (f, cnode);
else if (varpool_node *vnode = dyn_cast <varpool_node> (node)) else if (varpool_node *vnode = dyn_cast <varpool_node *> (node))
dump_varpool_node (f, vnode); dump_varpool_node (f, vnode);
} }
...@@ -731,7 +731,7 @@ verify_symtab_base (symtab_node *node) ...@@ -731,7 +731,7 @@ verify_symtab_base (symtab_node *node)
bool error_found = false; bool error_found = false;
symtab_node *hashed_node; symtab_node *hashed_node;
if (is_a <cgraph_node> (node)) if (is_a <cgraph_node *> (node))
{ {
if (TREE_CODE (node->decl) != FUNCTION_DECL) if (TREE_CODE (node->decl) != FUNCTION_DECL)
{ {
...@@ -739,7 +739,7 @@ verify_symtab_base (symtab_node *node) ...@@ -739,7 +739,7 @@ verify_symtab_base (symtab_node *node)
error_found = true; error_found = true;
} }
} }
else if (is_a <varpool_node> (node)) else if (is_a <varpool_node *> (node))
{ {
if (TREE_CODE (node->decl) != VAR_DECL) if (TREE_CODE (node->decl) != VAR_DECL)
{ {
...@@ -762,9 +762,9 @@ verify_symtab_base (symtab_node *node) ...@@ -762,9 +762,9 @@ verify_symtab_base (symtab_node *node)
error_found = true; error_found = true;
} }
if (hashed_node != node if (hashed_node != node
&& (!is_a <cgraph_node> (node) && (!is_a <cgraph_node *> (node)
|| !dyn_cast <cgraph_node> (node)->clone_of || !dyn_cast <cgraph_node *> (node)->clone_of
|| dyn_cast <cgraph_node> (node)->clone_of->decl || dyn_cast <cgraph_node *> (node)->clone_of->decl
!= node->decl)) != node->decl))
{ {
error ("node differs from symtab decl hashtable"); error ("node differs from symtab decl hashtable");
...@@ -786,7 +786,7 @@ verify_symtab_base (symtab_node *node) ...@@ -786,7 +786,7 @@ verify_symtab_base (symtab_node *node)
hashed_node = hashed_node->next_sharing_asm_name; hashed_node = hashed_node->next_sharing_asm_name;
} }
if (!hashed_node if (!hashed_node
&& !(is_a <varpool_node> (node) && !(is_a <varpool_node *> (node)
|| DECL_HARD_REGISTER (node->decl))) || DECL_HARD_REGISTER (node->decl)))
{ {
error ("node not found in symtab assembler name hash"); error ("node not found in symtab assembler name hash");
...@@ -878,7 +878,7 @@ verify_symtab_node (symtab_node *node) ...@@ -878,7 +878,7 @@ verify_symtab_node (symtab_node *node)
return; return;
timevar_push (TV_CGRAPH_VERIFY); timevar_push (TV_CGRAPH_VERIFY);
if (cgraph_node *cnode = dyn_cast <cgraph_node> (node)) if (cgraph_node *cnode = dyn_cast <cgraph_node *> (node))
verify_cgraph_node (cnode); verify_cgraph_node (cnode);
else else
if (verify_symtab_base (node)) if (verify_symtab_base (node))
...@@ -973,7 +973,7 @@ symtab_make_decl_local (tree decl) ...@@ -973,7 +973,7 @@ symtab_make_decl_local (tree decl)
enum availability enum availability
symtab_node_availability (symtab_node *node) symtab_node_availability (symtab_node *node)
{ {
if (is_a <cgraph_node> (node)) if (is_a <cgraph_node *> (node))
return cgraph_function_body_availability (cgraph (node)); return cgraph_function_body_availability (cgraph (node));
else else
return cgraph_variable_initializer_availability (varpool (node)); return cgraph_variable_initializer_availability (varpool (node));
...@@ -1061,7 +1061,7 @@ symtab_alias_ultimate_target (symtab_node *node, enum availability *availability ...@@ -1061,7 +1061,7 @@ symtab_alias_ultimate_target (symtab_node *node, enum availability *availability
void void
fixup_same_cpp_alias_visibility (symtab_node *node, symtab_node *target) fixup_same_cpp_alias_visibility (symtab_node *node, symtab_node *target)
{ {
if (is_a <cgraph_node> (node)) if (is_a <cgraph_node *> (node))
{ {
DECL_DECLARED_INLINE_P (node->decl) DECL_DECLARED_INLINE_P (node->decl)
= DECL_DECLARED_INLINE_P (target->decl); = DECL_DECLARED_INLINE_P (target->decl);
...@@ -1108,9 +1108,9 @@ symtab_resolve_alias (symtab_node *node, symtab_node *target) ...@@ -1108,9 +1108,9 @@ symtab_resolve_alias (symtab_node *node, symtab_node *target)
n = n->analyzed ? symtab_alias_target (n) : NULL) n = n->analyzed ? symtab_alias_target (n) : NULL)
if (n == node) if (n == node)
{ {
if (is_a <cgraph_node> (node)) if (is_a <cgraph_node *> (node))
error ("function %q+D part of alias cycle", node->decl); error ("function %q+D part of alias cycle", node->decl);
else if (is_a <varpool_node> (node)) else if (is_a <varpool_node *> (node))
error ("variable %q+D part of alias cycle", node->decl); error ("variable %q+D part of alias cycle", node->decl);
else else
gcc_unreachable (); gcc_unreachable ();
...@@ -1277,7 +1277,7 @@ symtab_get_symbol_partitioning_class (symtab_node *node) ...@@ -1277,7 +1277,7 @@ symtab_get_symbol_partitioning_class (symtab_node *node)
{ {
/* Inline clones are always duplicated. /* Inline clones are always duplicated.
This include external delcarations. */ This include external delcarations. */
cgraph_node *cnode = dyn_cast <cgraph_node> (node); cgraph_node *cnode = dyn_cast <cgraph_node *> (node);
if (DECL_ABSTRACT (node->decl)) if (DECL_ABSTRACT (node->decl))
return SYMBOL_EXTERNAL; return SYMBOL_EXTERNAL;
...@@ -1293,7 +1293,7 @@ symtab_get_symbol_partitioning_class (symtab_node *node) ...@@ -1293,7 +1293,7 @@ symtab_get_symbol_partitioning_class (symtab_node *node)
if (DECL_EXTERNAL (node->decl)) if (DECL_EXTERNAL (node->decl))
return SYMBOL_EXTERNAL; return SYMBOL_EXTERNAL;
if (varpool_node *vnode = dyn_cast <varpool_node> (node)) if (varpool_node *vnode = dyn_cast <varpool_node *> (node))
{ {
/* Constant pool references use local symbol names that can not /* Constant pool references use local symbol names that can not
be promoted global. We should never put into a constant pool be promoted global. We should never put into a constant pool
......
...@@ -115,7 +115,7 @@ allocate_phi_node (size_t len) ...@@ -115,7 +115,7 @@ allocate_phi_node (size_t len)
&& gimple_phi_capacity ((*free_phinodes[bucket])[0]) >= len) && gimple_phi_capacity ((*free_phinodes[bucket])[0]) >= len)
{ {
free_phinode_count--; free_phinode_count--;
phi = as_a <gimple_statement_phi> (free_phinodes[bucket]->pop ()); phi = as_a <gimple_statement_phi *> (free_phinodes[bucket]->pop ());
if (free_phinodes[bucket]->is_empty ()) if (free_phinodes[bucket]->is_empty ())
vec_free (free_phinodes[bucket]); vec_free (free_phinodes[bucket]);
if (GATHER_STATISTICS) if (GATHER_STATISTICS)
...@@ -297,7 +297,7 @@ reserve_phi_args_for_new_edge (basic_block bb) ...@@ -297,7 +297,7 @@ reserve_phi_args_for_new_edge (basic_block bb)
for (gsi = gsi_start_phis (bb); !gsi_end_p (gsi); gsi_next (&gsi)) for (gsi = gsi_start_phis (bb); !gsi_end_p (gsi); gsi_next (&gsi))
{ {
gimple_statement_phi *stmt = gimple_statement_phi *stmt =
as_a <gimple_statement_phi> (gsi_stmt (gsi)); as_a <gimple_statement_phi *> (gsi_stmt (gsi));
if (len > gimple_phi_capacity (stmt)) if (len > gimple_phi_capacity (stmt))
{ {
...@@ -436,7 +436,7 @@ remove_phi_args (edge e) ...@@ -436,7 +436,7 @@ remove_phi_args (edge e)
gimple_stmt_iterator gsi; gimple_stmt_iterator gsi;
for (gsi = gsi_start_phis (e->dest); !gsi_end_p (gsi); gsi_next (&gsi)) for (gsi = gsi_start_phis (e->dest); !gsi_end_p (gsi); gsi_next (&gsi))
remove_phi_arg_num (as_a <gimple_statement_phi> (gsi_stmt (gsi)), remove_phi_arg_num (as_a <gimple_statement_phi *> (gsi_stmt (gsi)),
e->dest_idx); e->dest_idx);
} }
......
...@@ -238,7 +238,7 @@ varpool_node * ...@@ -238,7 +238,7 @@ varpool_node *
varpool_node_for_asm (tree asmname) varpool_node_for_asm (tree asmname)
{ {
if (symtab_node *node = symtab_node_for_asm (asmname)) if (symtab_node *node = symtab_node_for_asm (asmname))
return dyn_cast <varpool_node> (node); return dyn_cast <varpool_node *> (node);
else else
return NULL; return NULL;
} }
...@@ -521,14 +521,14 @@ varpool_remove_unreferenced_decls (void) ...@@ -521,14 +521,14 @@ varpool_remove_unreferenced_decls (void)
next != node; next != node;
next = next->same_comdat_group) next = next->same_comdat_group)
{ {
varpool_node *vnext = dyn_cast <varpool_node> (next); varpool_node *vnext = dyn_cast <varpool_node *> (next);
if (vnext && vnext->analyzed && !symtab_comdat_local_p (next)) if (vnext && vnext->analyzed && !symtab_comdat_local_p (next))
enqueue_node (vnext, &first); enqueue_node (vnext, &first);
} }
} }
for (i = 0; ipa_ref_list_reference_iterate (&node->ref_list, i, ref); i++) for (i = 0; ipa_ref_list_reference_iterate (&node->ref_list, i, ref); i++)
{ {
varpool_node *vnode = dyn_cast <varpool_node> (ref->referred); varpool_node *vnode = dyn_cast <varpool_node *> (ref->referred);
if (vnode if (vnode
&& !vnode->in_other_partition && !vnode->in_other_partition
&& (!DECL_EXTERNAL (ref->referred->decl) && (!DECL_EXTERNAL (ref->referred->decl)
......
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment