* [PATCH] Use VAR_P and/or VAR_OR_FUNCTION_DECL_P macros
@ 2016-10-08 19:11 Jakub Jelinek
2016-10-09 6:31 ` Richard Biener
0 siblings, 1 reply; 2+ messages in thread
From: Jakub Jelinek @ 2016-10-08 19:11 UTC (permalink / raw)
To: Richard Biener; +Cc: gcc-patches
Hi!
This patch changes various TREE_CODE (xyz) == VAR_DECL into VAR_P (xyz),
TREE_CODE (xyz) != VAR_DECL into !VAR_P (xyz) and
TREE_CODE (xyz) == VAR_DECL || TREE_CODE (xyz) == FUNCTION_DECL
into VAR_OR_FUNCTION_DECL_P (xyz).
Bootstrapped/regtested on x86_64-linux and i686-linux, ok for trunk?
2016-10-08 Jakub Jelinek <jakub@redhat.com>
* tree-ssa.c (target_for_debug_bind, verify_phi_args,
ssa_undefined_value_p, maybe_optimize_var): Use VAR_P and/or
VAR_OR_FUNCTION_DECL_P macros.
* tree-chkp.c (chkp_register_var_initializer, chkp_make_static_bounds,
chkp_get_bounds_for_decl_addr, chkp_parse_array_and_component_ref,
chkp_find_bounds_1): Likewise.
* ipa-polymorphic-call.c (decl_maybe_in_construction_p): Likewise.
* hsa-gen.c (get_symbol_for_decl): Likewise.
* cgraphunit.c (check_global_declaration, analyze_functions,
handle_alias_pairs, thunk_adjust, cgraph_node::expand_thunk):
Likewise.
* gimple-fold.c (can_refer_decl_in_current_unit_p,
canonicalize_constructor_val, gimple_get_virt_method_for_vtable):
Likewise.
* tree.c (set_decl_section_name, copy_node_stat,
need_assembler_name_p, free_lang_data_in_decl, find_decls_types_r,
merge_dllimport_decl_attributes, handle_dll_attribute,
decl_init_priority_insert, auto_var_in_fn_p, array_at_struct_end_p,
verify_type): Likewise.
* gimple-ssa-isolate-paths.c (find_implicit_erroneous_behavior,
find_explicit_erroneous_behavior): Likewise.
* sdbout.c (sdbout_toplevel_data, sdbout_late_global_decl): Likewise.
* ipa.c (process_references): Likewise.
* tree-chkp-opt.c (chkp_get_check_result): Likewise.
* varasm.c (get_block_for_decl, use_blocks_for_decl_p, make_decl_rtl,
notice_global_symbol, assemble_variable, mark_decl_referenced,
build_constant_desc, output_constant_def_contents, do_assemble_alias,
make_decl_one_only, default_section_type_flags,
categorize_decl_for_section, default_encode_section_info): Likewise.
* trans-mem.c (requires_barrier): Likewise.
* gimple-expr.c (mark_addressable): Likewise.
* cfgexpand.c (add_scope_conflicts_1, expand_one_var,
expand_used_vars_for_block, clear_tree_used, stack_protect_decl_p,
expand_debug_expr): Likewise.
* tree-dump.c (dequeue_and_dump): Likewise.
* ubsan.c (instrument_bool_enum_load): Likewise.
* tree-pretty-print.c (print_declaration): Likewise.
* simplify-rtx.c (delegitimize_mem_from_attrs): Likewise.
* tree-ssa-uninit.c (warn_uninitialized_vars): Likewise.
* asan.c (asan_protect_global, instrument_derefs): Likewise.
* tree-into-ssa.c (rewrite_stmt, maybe_register_def,
pass_build_ssa::execute): Likewise.
* var-tracking.c (var_debug_decl, track_expr_p): Likewise.
* tree-ssa-loop-ivopts.c (force_expr_to_var_cost, split_address_cost):
Likewise.
* ipa-split.c (test_nonssa_use, consider_split, mark_nonssa_use):
Likewise.
* tree-inline.c (insert_debug_decl_map, remap_ssa_name,
can_be_nonlocal, remap_decls, copy_debug_stmt,
initialize_inlined_parameters, add_local_variables,
reset_debug_binding, replace_locals_op): Likewise.
* dse.c (can_escape): Likewise.
* ipa-devirt.c (compare_virtual_tables, referenced_from_vtable_p):
Likewise.
* tree-diagnostic.c (default_tree_printer): Likewise.
* tree-streamer-in.c (unpack_ts_decl_common_value_fields,
unpack_ts_decl_with_vis_value_fields,
lto_input_ts_decl_common_tree_pointers): Likewise.
* builtins.c (builtin_save_expr, fold_builtin_expect,
readonly_data_expr): Likewise.
* tree-ssa-structalias.c (new_var_info, get_constraint_for_ssa_var,
create_variable_info_for, set_uids_in_ptset, visit_loadstore):
Likewise.
* gimple-streamer-out.c (output_gimple_stmt): Likewise.
* gimplify.c (force_constant_size, gimplify_bind_expr,
gimplify_decl_expr, gimplify_var_or_parm_decl,
gimplify_compound_lval, gimplify_init_constructor,
gimplify_modify_expr, gimplify_asm_expr, gimplify_oacc_declare,
gimplify_type_sizes): Likewise.
* cgraphbuild.c (record_reference, record_type_list, mark_address,
mark_load, mark_store, pass_build_cgraph_edges::execute): Likewise.
* tree-ssa-live.c (mark_all_vars_used_1, remove_unused_scope_block_p,
remove_unused_locals): Likewise.
* tree-ssa-alias.c (ptr_deref_may_alias_decl_p, ptrs_compare_unequal,
ref_maybe_used_by_call_p_1, call_may_clobber_ref_p_1): Likewise.
* function.c (instantiate_expr, instantiate_decls_1,
setjmp_vars_warning, add_local_decl): Likewise.
* alias.c (ao_ref_from_mem, get_alias_set, compare_base_symbol_refs):
Likewise.
* tree-stdarg.c (find_va_list_reference, va_list_counter_struct_op,
va_list_ptr_read, va_list_ptr_write, check_all_va_list_escapes,
optimize_va_list_gpr_fpr_size): Likewise.
* tree-nrv.c (pass_nrv::execute): Likewise.
* tsan.c (instrument_expr): Likewise.
* tree-ssa-dce.c (remove_dead_stmt): Likewise.
* vtable-verify.c (verify_bb_vtables): Likewise.
* tree-dfa.c (ssa_default_def, set_ssa_default_def,
get_ref_base_and_extent): Likewise.
* toplev.c (wrapup_global_declaration_1, wrapup_global_declaration_2):
Likewise.
* tree-sra.c (static bool constant_decl_p, find_var_candidates,
analyze_all_variable_accesses): Likewise.
* tree-nested.c (get_nonlocal_debug_decl,
convert_nonlocal_omp_clauses, note_nonlocal_vla_type,
note_nonlocal_block_vlas, convert_nonlocal_reference_stmt,
get_local_debug_decl, convert_local_omp_clauses,
convert_local_reference_stmt, nesting_copy_decl, remap_vla_decls):
Likewise.
* tree-vect-data-refs.c (vect_can_force_dr_alignment_p): Likewise.
* stmt.c (decl_overlaps_hard_reg_set_p): Likewise.
* dbxout.c (dbxout_late_global_decl, dbxout_type_fields,
dbxout_symbol, dbxout_common_check): Likewise.
* expr.c (expand_assignment, expand_expr_real_2, expand_expr_real_1,
string_constant): Likewise.
* hsa.c (hsa_get_declaration_name): Likewise.
* passes.c (rest_of_decl_compilation): Likewise.
* tree-ssanames.c (make_ssa_name_fn): Likewise.
* tree-streamer-out.c (pack_ts_decl_common_value_fields,
pack_ts_decl_with_vis_value_fields,
write_ts_decl_common_tree_pointers): Likewise.
* stor-layout.c (place_field): Likewise.
* symtab.c (symtab_node::maybe_create_reference,
symtab_node::verify_base, symtab_node::make_decl_local,
symtab_node::copy_visibility_from,
symtab_node::can_increase_alignment_p): Likewise.
* dwarf2out.c (add_var_loc_to_decl, tls_mem_loc_descriptor,
decl_by_reference_p, reference_to_unused, rtl_for_decl_location,
fortran_common, add_location_or_const_value_attribute,
add_scalar_info, add_linkage_name, set_block_abstract_flags,
local_function_static, gen_variable_die, dwarf2out_late_global_decl,
optimize_one_addr_into_implicit_ptr,
optimize_location_into_implicit_ptr): Likewise.
* gimple-low.c (record_vars_into): Likewise.
* ipa-visibility.c (update_vtable_references): Likewise.
* tree-ssa-address.c (fixed_address_object_p, copy_ref_info):
Likewise.
* lto-streamer-out.c (tree_is_indexable, get_symbol_initial_value,
DFS::DFS_write_tree_body, write_symbol): Likewise.
* langhooks.c (lhd_warn_unused_global_decl,
lhd_set_decl_assembler_name): Likewise.
* attribs.c (decl_attributes): Likewise.
* except.c (output_ttype): Likewise.
* varpool.c (varpool_node::get_create, ctor_for_folding,
varpool_node::assemble_decl, varpool_node::create_alias): Likewise.
* fold-const.c (fold_unary_loc): Likewise.
* ipa-prop.c (ipa_compute_jump_functions_for_edge,
ipa_find_agg_cst_from_init): Likewise.
* omp-low.c (expand_omp_regimplify_p, expand_omp_taskreg,
expand_omp_target, lower_omp_regimplify_p,
grid_reg_assignment_to_local_var_p, grid_remap_prebody_decls,
find_link_var_op): Likewise.
* tree-chrec.c (chrec_contains_symbols): Likewise.
* tree-cfg.c (verify_address, verify_expr, verify_expr_location_1,
gimple_duplicate_bb, move_stmt_op, replace_block_vars_by_duplicates,
execute_fixup_cfg): Likewise.
--- gcc/tree-ssa.c.jj 2016-10-07 21:36:01.775423576 +0200
+++ gcc/tree-ssa.c 2016-10-08 18:45:22.732284375 +0200
@@ -246,8 +246,7 @@ target_for_debug_bind (tree var)
return NULL_TREE;
}
- if ((TREE_CODE (var) != VAR_DECL
- || VAR_DECL_IS_VIRTUAL_OPERAND (var))
+ if ((!VAR_P (var) || VAR_DECL_IS_VIRTUAL_OPERAND (var))
&& TREE_CODE (var) != PARM_DECL)
return NULL_TREE;
@@ -974,7 +973,7 @@ verify_phi_args (gphi *phi, basic_block
tree base = TREE_OPERAND (op, 0);
while (handled_component_p (base))
base = TREE_OPERAND (base, 0);
- if ((TREE_CODE (base) == VAR_DECL
+ if ((VAR_P (base)
|| TREE_CODE (base) == PARM_DECL
|| TREE_CODE (base) == RESULT_DECL)
&& !TREE_ADDRESSABLE (base))
@@ -1246,7 +1245,7 @@ ssa_undefined_value_p (tree t, bool part
else if (TREE_CODE (var) == RESULT_DECL && DECL_BY_REFERENCE (var))
return false;
/* Hard register variables get their initial value from the ether. */
- else if (TREE_CODE (var) == VAR_DECL && DECL_HARD_REGISTER (var))
+ else if (VAR_P (var) && DECL_HARD_REGISTER (var))
return false;
/* The value is undefined iff its definition statement is empty. */
@@ -1538,7 +1537,7 @@ maybe_optimize_var (tree var, bitmap add
&& (TREE_CODE (TREE_TYPE (var)) == COMPLEX_TYPE
|| TREE_CODE (TREE_TYPE (var)) == VECTOR_TYPE)
&& !TREE_THIS_VOLATILE (var)
- && (TREE_CODE (var) != VAR_DECL || !DECL_HARD_REGISTER (var)))
+ && (!VAR_P (var) || !DECL_HARD_REGISTER (var)))
{
DECL_GIMPLE_REG_P (var) = 1;
bitmap_set_bit (suitable_for_renaming, DECL_UID (var));
--- gcc/tree-chkp.c.jj 2016-08-06 12:11:47.074554628 +0200
+++ gcc/tree-chkp.c 2016-10-08 18:40:28.256977151 +0200
@@ -1002,7 +1002,7 @@ chkp_register_var_initializer (tree var)
|| DECL_INITIAL (var) == error_mark_node)
return false;
- gcc_assert (TREE_CODE (var) == VAR_DECL);
+ gcc_assert (VAR_P (var));
gcc_assert (DECL_INITIAL (var));
if (TREE_STATIC (var)
@@ -2936,7 +2936,7 @@ chkp_make_static_bounds (tree obj)
chkp_static_var_bounds map. It allows to
avoid duplicating bound vars for decls
sharing assembler name. */
- if (TREE_CODE (obj) == VAR_DECL)
+ if (VAR_P (obj))
{
tree name = DECL_ASSEMBLER_NAME (obj);
slot = chkp_static_var_bounds->get (name);
@@ -2952,7 +2952,7 @@ chkp_make_static_bounds (tree obj)
}
/* Build decl for bounds var. */
- if (TREE_CODE (obj) == VAR_DECL)
+ if (VAR_P (obj))
{
if (DECL_IGNORED_P (obj))
{
@@ -3014,7 +3014,7 @@ chkp_make_static_bounds (tree obj)
if (!chkp_static_var_bounds)
chkp_static_var_bounds = new hash_map<tree, tree>;
- if (TREE_CODE (obj) == VAR_DECL)
+ if (VAR_P (obj))
{
tree name = DECL_ASSEMBLER_NAME (obj);
chkp_static_var_bounds->put (name, bnd_var);
@@ -3117,7 +3117,7 @@ chkp_get_bounds_for_decl_addr (tree decl
{
tree bounds;
- gcc_assert (TREE_CODE (decl) == VAR_DECL
+ gcc_assert (VAR_P (decl)
|| TREE_CODE (decl) == PARM_DECL
|| TREE_CODE (decl) == RESULT_DECL);
@@ -3144,7 +3144,7 @@ chkp_get_bounds_for_decl_addr (tree decl
return chkp_get_zero_bounds ();
if (flag_chkp_use_static_bounds
- && TREE_CODE (decl) == VAR_DECL
+ && VAR_P (decl)
&& (TREE_STATIC (decl)
|| DECL_EXTERNAL (decl)
|| TREE_PUBLIC (decl))
@@ -3164,7 +3164,7 @@ chkp_get_bounds_for_decl_addr (tree decl
|| DECL_EXTERNAL (decl)
|| TREE_PUBLIC (decl))))
{
- gcc_assert (TREE_CODE (decl) == VAR_DECL);
+ gcc_assert (VAR_P (decl));
bounds = chkp_generate_extern_var_bounds (decl);
}
else
@@ -3399,7 +3399,7 @@ chkp_parse_array_and_component_ref (tree
}
else
{
- gcc_assert (TREE_CODE (var) == VAR_DECL
+ gcc_assert (VAR_P (var)
|| TREE_CODE (var) == PARM_DECL
|| TREE_CODE (var) == RESULT_DECL
|| TREE_CODE (var) == STRING_CST
@@ -3562,7 +3562,7 @@ chkp_find_bounds_1 (tree ptr, tree ptr_s
case MEM_REF:
case VAR_DECL:
if (BOUNDED_P (ptr_src))
- if (TREE_CODE (ptr) == VAR_DECL && DECL_REGISTER (ptr))
+ if (VAR_P (ptr) && DECL_REGISTER (ptr))
bounds = chkp_get_zero_bounds ();
else
{
@@ -3581,7 +3581,7 @@ chkp_find_bounds_1 (tree ptr, tree ptr_s
|| TREE_CODE (addr) == TARGET_MEM_REF)
{
if (BOUNDED_P (ptr_src))
- if (TREE_CODE (ptr) == VAR_DECL && DECL_REGISTER (ptr))
+ if (VAR_P (ptr) && DECL_REGISTER (ptr))
bounds = chkp_get_zero_bounds ();
else
{
--- gcc/ipa-polymorphic-call.c.jj 2016-08-10 00:21:07.097351508 +0200
+++ gcc/ipa-polymorphic-call.c 2016-10-08 18:30:45.042297763 +0200
@@ -575,7 +575,7 @@ decl_maybe_in_construction_p (tree base,
return true;
}
- if (!base || (TREE_CODE (base) == VAR_DECL && is_global_var (base)))
+ if (!base || (VAR_P (base) && is_global_var (base)))
{
if (TREE_CODE (TREE_TYPE (function)) != METHOD_TYPE
|| (!DECL_CXX_CONSTRUCTOR_P (function)
--- gcc/hsa-gen.c.jj 2016-09-23 09:33:36.752328278 +0200
+++ gcc/hsa-gen.c 2016-10-08 18:30:13.720691207 +0200
@@ -883,12 +883,11 @@ get_symbol_for_decl (tree decl)
gcc_assert (TREE_CODE (decl) == PARM_DECL
|| TREE_CODE (decl) == RESULT_DECL
- || TREE_CODE (decl) == VAR_DECL);
+ || VAR_P (decl));
dummy.m_decl = decl;
- bool is_in_global_vars
- = TREE_CODE (decl) == VAR_DECL && is_global_var (decl);
+ bool is_in_global_vars = VAR_P (decl) && is_global_var (decl);
if (is_in_global_vars)
slot = hsa_global_variable_symbols->find_slot (&dummy, INSERT);
@@ -925,7 +924,7 @@ get_symbol_for_decl (tree decl)
else
{
hsa_symbol *sym;
- gcc_assert (TREE_CODE (decl) == VAR_DECL);
+ gcc_assert (VAR_P (decl));
BrigAlignment8_t align = hsa_object_alignment (decl);
if (is_in_global_vars)
@@ -952,7 +951,7 @@ get_symbol_for_decl (tree decl)
align = MAX ((BrigAlignment8_t) BRIG_ALIGNMENT_8, align);
/* PARM_DECL and RESULT_DECL should be already in m_local_symbols. */
- gcc_assert (TREE_CODE (decl) == VAR_DECL);
+ gcc_assert (VAR_P (decl));
sym = new hsa_symbol (BRIG_TYPE_NONE, BRIG_SEGMENT_PRIVATE,
BRIG_LINKAGE_FUNCTION);
--- gcc/cgraphunit.c.jj 2016-09-26 12:06:38.606878025 +0200
+++ gcc/cgraphunit.c 2016-10-08 18:23:20.765878503 +0200
@@ -662,7 +662,7 @@ symbol_table::process_same_body_aliases
FOR_EACH_SYMBOL (node)
if (node->cpp_implicit_alias && !node->analyzed)
node->resolve_alias
- (TREE_CODE (node->alias_target) == VAR_DECL
+ (VAR_P (node->alias_target)
? (symtab_node *)varpool_node::get_create (node->alias_target)
: (symtab_node *)cgraph_node::get_create (node->alias_target));
cpp_implicit_aliases_done = true;
@@ -950,7 +950,7 @@ check_global_declaration (symtab_node *s
&& (decl_file = DECL_SOURCE_FILE (decl)) != NULL
&& filename_cmp (main_input_filename,
decl_file) == 0))))
- && TREE_CODE (decl) == VAR_DECL))
+ && VAR_P (decl)))
&& ! DECL_IN_SYSTEM_HEADER (decl)
&& ! snode->referred_to_p (/*include_self=*/false)
/* This TREE_USED check is needed in addition to referred_to_p
@@ -967,7 +967,7 @@ check_global_declaration (symtab_node *s
/* A volatile variable might be used in some non-obvious way. */
&& (! VAR_P (decl) || ! TREE_THIS_VOLATILE (decl))
/* Global register variables must be declared to reserve them. */
- && ! (TREE_CODE (decl) == VAR_DECL && DECL_REGISTER (decl))
+ && ! (VAR_P (decl) && DECL_REGISTER (decl))
/* Global ctors and dtors are called by the runtime. */
&& (TREE_CODE (decl) != FUNCTION_DECL
|| (!DECL_STATIC_CONSTRUCTOR (decl)
@@ -1194,7 +1194,7 @@ analyze_functions (bool first_time)
at looking at optimized away DECLs, since
late_global_decl will subsequently be called from the
contents of the now pruned symbol table. */
- if (TREE_CODE (node->decl) == VAR_DECL
+ if (VAR_P (node->decl)
&& !decl_function_context (node->decl))
{
/* We are reclaiming totally unreachable code and variables
@@ -1305,7 +1305,7 @@ handle_alias_pairs (void)
cgraph_node::create_alias (p->decl, target_node->decl);
alias_pairs->unordered_remove (i);
}
- else if (TREE_CODE (p->decl) == VAR_DECL
+ else if (VAR_P (p->decl)
&& target_node && is_a <varpool_node *> (target_node))
{
varpool_node::create_alias (p->decl, target_node->decl);
@@ -1559,7 +1559,7 @@ thunk_adjust (gimple_stmt_iterator * bsi
{
tree ptrtmp;
- if (TREE_CODE (ptr) == VAR_DECL)
+ if (VAR_P (ptr))
ptrtmp = ptr;
else
{
@@ -1738,7 +1738,7 @@ cgraph_node::expand_thunk (bool output_a
{
restmp = resdecl;
- if (TREE_CODE (restmp) == VAR_DECL)
+ if (VAR_P (restmp))
add_local_decl (cfun, restmp);
BLOCK_VARS (DECL_INITIAL (current_function_decl)) = restmp;
}
--- gcc/gimple-fold.c.jj 2016-10-05 17:01:34.831595012 +0200
+++ gcc/gimple-fold.c 2016-10-08 18:28:22.955082580 +0200
@@ -105,7 +105,7 @@ can_refer_decl_in_current_unit_p (tree d
/* We are concerned only about static/external vars and functions. */
if ((!TREE_STATIC (decl) && !DECL_EXTERNAL (decl))
- || (TREE_CODE (decl) != VAR_DECL && TREE_CODE (decl) != FUNCTION_DECL))
+ || !VAR_OR_FUNCTION_DECL_P (decl))
return true;
/* Static objects can be referred only if they was not optimized out yet. */
@@ -126,7 +126,7 @@ can_refer_decl_in_current_unit_p (tree d
So we are concerned only when DECL comes from initializer of
external var or var that has been optimized out. */
if (!from_decl
- || TREE_CODE (from_decl) != VAR_DECL
+ || !VAR_P (from_decl)
|| (!DECL_EXTERNAL (from_decl)
&& (vnode = varpool_node::get (from_decl)) != NULL
&& vnode->definition)
@@ -206,13 +206,12 @@ canonicalize_constructor_val (tree cval,
if (!base)
return NULL_TREE;
- if ((TREE_CODE (base) == VAR_DECL
- || TREE_CODE (base) == FUNCTION_DECL)
+ if (VAR_OR_FUNCTION_DECL_P (base)
&& !can_refer_decl_in_current_unit_p (base, from_decl))
return NULL_TREE;
if (TREE_TYPE (base) == error_mark_node)
return NULL_TREE;
- if (TREE_CODE (base) == VAR_DECL)
+ if (VAR_P (base))
TREE_ADDRESSABLE (base) = 1;
else if (TREE_CODE (base) == FUNCTION_DECL)
{
@@ -6057,8 +6056,7 @@ gimple_get_virt_method_for_vtable (HOST_
*can_refer = true;
/* First of all double check we have virtual table. */
- if (TREE_CODE (v) != VAR_DECL
- || !DECL_VIRTUAL_P (v))
+ if (!VAR_P (v) || !DECL_VIRTUAL_P (v))
{
/* Pass down that we lost track of the target. */
if (can_refer)
--- gcc/tree.c.jj 2016-08-29 12:17:13.369684226 +0200
+++ gcc/tree.c 2016-10-08 18:39:26.322753817 +0200
@@ -716,7 +716,7 @@ set_decl_section_name (tree node, const
if (!snode)
return;
}
- else if (TREE_CODE (node) == VAR_DECL)
+ else if (VAR_P (node))
snode = varpool_node::get_create (node);
else
snode = cgraph_node::get_create (node);
@@ -1156,19 +1156,19 @@ copy_node_stat (tree node MEM_STAT_DECL)
if (DECL_PT_UID_SET_P (node))
SET_DECL_PT_UID (t, DECL_PT_UID (node));
}
- if ((TREE_CODE (node) == PARM_DECL || TREE_CODE (node) == VAR_DECL)
+ if ((TREE_CODE (node) == PARM_DECL || VAR_P (node))
&& DECL_HAS_VALUE_EXPR_P (node))
{
SET_DECL_VALUE_EXPR (t, DECL_VALUE_EXPR (node));
DECL_HAS_VALUE_EXPR_P (t) = 1;
}
/* DECL_DEBUG_EXPR is copied explicitely by callers. */
- if (TREE_CODE (node) == VAR_DECL)
+ if (VAR_P (node))
{
DECL_HAS_DEBUG_EXPR_P (t) = 0;
t->decl_with_vis.symtab_node = NULL;
}
- if (TREE_CODE (node) == VAR_DECL && DECL_HAS_INIT_PRIORITY_P (node))
+ if (VAR_P (node) && DECL_HAS_INIT_PRIORITY_P (node))
{
SET_DECL_INIT_PRIORITY (t, DECL_INIT_PRIORITY (node));
DECL_HAS_INIT_PRIORITY_P (t) = 1;
@@ -5330,8 +5330,7 @@ need_assembler_name_p (tree decl)
&& !variably_modified_type_p (TREE_TYPE (decl), NULL_TREE))
return !DECL_ASSEMBLER_NAME_SET_P (decl);
/* Only FUNCTION_DECLs and VAR_DECLs are considered. */
- if (TREE_CODE (decl) != FUNCTION_DECL
- && TREE_CODE (decl) != VAR_DECL)
+ if (!VAR_OR_FUNCTION_DECL_P (decl))
return false;
/* If DECL already has its assembler name set, it does not need a
@@ -5346,7 +5345,7 @@ need_assembler_name_p (tree decl)
/* For VAR_DECLs, only static, public and external symbols need an
assembler name. */
- if (TREE_CODE (decl) == VAR_DECL
+ if (VAR_P (decl)
&& !TREE_STATIC (decl)
&& !TREE_PUBLIC (decl)
&& !DECL_EXTERNAL (decl))
@@ -5460,7 +5459,7 @@ free_lang_data_in_decl (tree decl)
if (DECL_VINDEX (decl) && !tree_fits_shwi_p (DECL_VINDEX (decl)))
DECL_VINDEX (decl) = NULL_TREE;
}
- else if (TREE_CODE (decl) == VAR_DECL)
+ else if (VAR_P (decl))
{
if ((DECL_EXTERNAL (decl)
&& (!TREE_STATIC (decl) || !TREE_READONLY (decl)))
@@ -5632,7 +5631,7 @@ find_decls_types_r (tree *tp, int *ws, v
fld_worklist_push (DECL_FCONTEXT (t), fld);
}
- if ((TREE_CODE (t) == VAR_DECL || TREE_CODE (t) == PARM_DECL)
+ if ((VAR_P (t) || TREE_CODE (t) == PARM_DECL)
&& DECL_HAS_VALUE_EXPR_P (t))
fld_worklist_push (DECL_VALUE_EXPR (t), fld);
@@ -6329,14 +6328,13 @@ merge_dllimport_decl_attributes (tree ol
decl may already have had TREE_CONSTANT computed.
We still remove the attribute so that assembler code refers
to '&foo rather than '_imp__foo'. */
- if (TREE_CODE (old) == VAR_DECL && TREE_ADDRESSABLE (old))
+ if (VAR_P (old) && TREE_ADDRESSABLE (old))
DECL_DLLIMPORT_P (new_tree) = 1;
}
/* Let an inline definition silently override the external reference,
but otherwise warn about attribute inconsistency. */
- else if (TREE_CODE (new_tree) == VAR_DECL
- || !DECL_DECLARED_INLINE_P (new_tree))
+ else if (VAR_P (new_tree) || !DECL_DECLARED_INLINE_P (new_tree))
warning (OPT_Wattributes, "%q+D redeclared without dllimport attribute: "
"previous dllimport ignored", new_tree);
}
@@ -6387,9 +6385,7 @@ handle_dll_attribute (tree * pnode, tree
}
}
- if (TREE_CODE (node) != FUNCTION_DECL
- && TREE_CODE (node) != VAR_DECL
- && TREE_CODE (node) != TYPE_DECL)
+ if (!VAR_OR_FUNCTION_DECL_P (node) && TREE_CODE (node) != TYPE_DECL)
{
*no_add_attrs = true;
warning (OPT_Wattributes, "%qE attribute ignored",
@@ -6432,7 +6428,7 @@ handle_dll_attribute (tree * pnode, tree
*no_add_attrs = true;
}
- else if (TREE_CODE (node) == VAR_DECL)
+ else if (VAR_P (node))
{
if (DECL_INITIAL (node))
{
@@ -6460,9 +6456,7 @@ handle_dll_attribute (tree * pnode, tree
DECL_EXTERNAL (node) = 0;
/* Report error if symbol is not accessible at global scope. */
- if (!TREE_PUBLIC (node)
- && (TREE_CODE (node) == VAR_DECL
- || TREE_CODE (node) == FUNCTION_DECL))
+ if (!TREE_PUBLIC (node) && VAR_OR_FUNCTION_DECL_P (node))
{
error ("external linkage required for symbol %q+D because of "
"%qE attribute", node, name);
@@ -6822,7 +6816,7 @@ decl_init_priority_insert (tree decl, pr
if (!snode)
return;
}
- else if (TREE_CODE (decl) == VAR_DECL)
+ else if (VAR_P (decl))
snode = varpool_node::get_create (decl);
else
snode = cgraph_node::get_create (decl);
@@ -9196,7 +9190,7 @@ bool
auto_var_in_fn_p (const_tree var, const_tree fn)
{
return (DECL_P (var) && DECL_CONTEXT (var) == fn
- && ((((TREE_CODE (var) == VAR_DECL && ! DECL_EXTERNAL (var))
+ && ((((VAR_P (var) && ! DECL_EXTERNAL (var))
|| TREE_CODE (var) == PARM_DECL)
&& ! TREE_STATIC (var))
|| TREE_CODE (var) == LABEL_DECL
@@ -13139,7 +13133,7 @@ array_at_struct_end_p (tree ref)
&& (!size || (DECL_SIZE (ref) != NULL
&& operand_equal_p (DECL_SIZE (ref), size, 0)))
&& !(flag_unconstrained_commons
- && TREE_CODE (ref) == VAR_DECL && DECL_COMMON (ref)))
+ && VAR_P (ref) && DECL_COMMON (ref)))
return false;
return true;
@@ -13971,7 +13965,7 @@ verify_type (const_tree t)
;
else if (TREE_CODE (fld) == CONST_DECL)
;
- else if (TREE_CODE (fld) == VAR_DECL)
+ else if (VAR_P (fld))
;
else if (TREE_CODE (fld) == TEMPLATE_DECL)
;
--- gcc/gimple-ssa-isolate-paths.c.jj 2016-02-12 00:50:55.792885920 +0100
+++ gcc/gimple-ssa-isolate-paths.c 2016-10-08 18:28:49.427750046 +0200
@@ -268,8 +268,7 @@ find_implicit_erroneous_behavior (void)
if (TREE_CODE (op) == ADDR_EXPR)
{
tree valbase = get_base_address (TREE_OPERAND (op, 0));
- if ((TREE_CODE (valbase) == VAR_DECL
- && !is_global_var (valbase))
+ if ((VAR_P (valbase) && !is_global_var (valbase))
|| TREE_CODE (valbase) == PARM_DECL)
{
FOR_EACH_IMM_USE_STMT (use_stmt, iter, lhs)
@@ -426,8 +425,7 @@ find_explicit_erroneous_behavior (void)
if (val && TREE_CODE (val) == ADDR_EXPR)
{
tree valbase = get_base_address (TREE_OPERAND (val, 0));
- if ((TREE_CODE (valbase) == VAR_DECL
- && !is_global_var (valbase))
+ if ((VAR_P (valbase) && !is_global_var (valbase))
|| TREE_CODE (valbase) == PARM_DECL)
{
/* We only need it for this particular case. */
--- gcc/sdbout.c.jj 2016-09-20 10:26:02.718767879 +0200
+++ gcc/sdbout.c 2016-10-08 18:35:47.586497380 +0200
@@ -906,7 +906,7 @@ sdbout_toplevel_data (tree decl)
if (DECL_IGNORED_P (decl))
return;
- gcc_assert (TREE_CODE (decl) == VAR_DECL);
+ gcc_assert (VAR_P (decl));
gcc_assert (MEM_P (DECL_RTL (decl)));
gcc_assert (DECL_INITIAL (decl));
@@ -1434,9 +1434,7 @@ sdbout_early_global_decl (tree decl ATTR
static void
sdbout_late_global_decl (tree decl)
{
- if (TREE_CODE (decl) == VAR_DECL
- && !DECL_EXTERNAL (decl)
- && DECL_RTL_SET_P (decl))
+ if (VAR_P (decl) && !DECL_EXTERNAL (decl) && DECL_RTL_SET_P (decl))
{
/* The COFF linker can move initialized global vars to the end.
And that can screw up the symbol ordering. Defer those for
--- gcc/ipa.c.jj 2016-09-21 08:54:17.084104510 +0200
+++ gcc/ipa.c 2016-10-08 18:30:27.114522962 +0200
@@ -128,7 +128,7 @@ process_references (symtab_node *snode,
/* We use variable constructors during late compilation for
constant folding. Keep references alive so partitioning
knows about potential references. */
- || (TREE_CODE (node->decl) == VAR_DECL
+ || (VAR_P (node->decl)
&& flag_wpa
&& ctor_for_folding (node->decl)
!= error_mark_node))))
--- gcc/tree-chkp-opt.c.jj 2016-09-23 18:57:51.590500469 +0200
+++ gcc/tree-chkp-opt.c 2016-10-08 18:40:34.235902174 +0200
@@ -610,7 +610,7 @@ chkp_get_check_result (struct check_info
chkp_collect_value (DECL_INITIAL (bnd_var), bound_val);
if (ci->type == CHECK_UPPER_BOUND)
{
- if (TREE_CODE (var) == VAR_DECL)
+ if (VAR_P (var))
{
if (DECL_SIZE (var)
&& !chkp_variable_size_type (TREE_TYPE (var)))
--- gcc/varasm.c.jj 2016-09-28 21:17:52.386301063 +0200
+++ gcc/varasm.c 2016-10-08 18:50:24.605498828 +0200
@@ -170,8 +170,7 @@ static GTY(()) section *unnamed_sections
/* Return a nonzero value if DECL has a section attribute. */
#define IN_NAMED_SECTION(DECL) \
- ((TREE_CODE (DECL) == FUNCTION_DECL || TREE_CODE (DECL) == VAR_DECL) \
- && DECL_SECTION_NAME (DECL) != NULL)
+ (VAR_OR_FUNCTION_DECL_P (DECL) && DECL_SECTION_NAME (DECL) != NULL)
struct section_hasher : ggc_ptr_hash<section>
{
@@ -1188,7 +1187,7 @@ get_block_for_decl (tree decl)
{
section *sect;
- if (TREE_CODE (decl) == VAR_DECL)
+ if (VAR_P (decl))
{
/* The object must be defined in this translation unit. */
if (DECL_EXTERNAL (decl))
@@ -1209,7 +1208,7 @@ get_block_for_decl (tree decl)
/* Find out which section should contain DECL. We cannot put it into
an object block if it requires a standalone definition. */
- if (TREE_CODE (decl) == VAR_DECL)
+ if (VAR_P (decl))
align_variable (decl, 0);
sect = get_variable_section (decl, true);
if (SECTION_STYLE (sect) == SECTION_NOSWITCH)
@@ -1238,7 +1237,7 @@ use_blocks_for_decl_p (tree decl)
struct symtab_node *snode;
/* Only data DECLs can be placed into object blocks. */
- if (TREE_CODE (decl) != VAR_DECL && TREE_CODE (decl) != CONST_DECL)
+ if (!VAR_P (decl) && TREE_CODE (decl) != CONST_DECL)
return false;
/* Detect decls created by dw2_force_const_mem. Such decls are
@@ -1250,7 +1249,7 @@ use_blocks_for_decl_p (tree decl)
/* If this decl is an alias, then we don't want to emit a
definition. */
- if (TREE_CODE (decl) == VAR_DECL
+ if (VAR_P (decl)
&& (snode = symtab_node::get (decl)) != NULL
&& snode->alias)
return false;
@@ -1304,7 +1303,7 @@ make_decl_rtl (tree decl)
&& TREE_CODE (decl) != RESULT_DECL);
/* A weak alias has TREE_PUBLIC set but not the other bits. */
- gcc_assert (TREE_CODE (decl) != VAR_DECL
+ gcc_assert (!VAR_P (decl)
|| TREE_STATIC (decl)
|| TREE_PUBLIC (decl)
|| DECL_EXTERNAL (decl)
@@ -1348,7 +1347,7 @@ make_decl_rtl (tree decl)
/* If this variable belongs to the global constant pool, retrieve the
pre-computed RTL or recompute it in LTO mode. */
- if (TREE_CODE (decl) == VAR_DECL && DECL_IN_CONSTANT_POOL (decl))
+ if (VAR_P (decl) && DECL_IN_CONSTANT_POOL (decl))
{
SET_DECL_RTL (decl, output_constant_def (DECL_INITIAL (decl), 1));
return;
@@ -1457,7 +1456,7 @@ make_decl_rtl (tree decl)
visibility pass is doing the same work. But notice_global_symbol
is called early and it needs to make DECL_RTL to get the name.
we take care of recomputing the DECL_RTL after visibility is changed. */
- if (TREE_CODE (decl) == VAR_DECL
+ if (VAR_P (decl)
&& (TREE_STATIC (decl) || DECL_EXTERNAL (decl))
&& DECL_SECTION_NAME (decl) != NULL
&& DECL_INITIAL (decl) == NULL_TREE
@@ -1465,7 +1464,7 @@ make_decl_rtl (tree decl)
DECL_COMMON (decl) = 0;
/* Variables can't be both common and weak. */
- if (TREE_CODE (decl) == VAR_DECL && DECL_WEAK (decl))
+ if (VAR_P (decl) && DECL_WEAK (decl))
DECL_COMMON (decl) = 0;
if (use_object_blocks_p () && use_blocks_for_decl_p (decl))
@@ -1639,9 +1638,9 @@ notice_global_symbol (tree decl)
|| !TREE_PUBLIC (decl)
|| DECL_EXTERNAL (decl)
|| !DECL_NAME (decl)
- || (TREE_CODE (decl) == VAR_DECL && DECL_HARD_REGISTER (decl))
+ || (VAR_P (decl) && DECL_HARD_REGISTER (decl))
|| (TREE_CODE (decl) != FUNCTION_DECL
- && (TREE_CODE (decl) != VAR_DECL
+ && (!VAR_P (decl)
|| (DECL_COMMON (decl)
&& (DECL_INITIAL (decl) == 0
|| DECL_INITIAL (decl) == error_mark_node)))))
@@ -2111,7 +2110,7 @@ assemble_variable (tree decl, int top_le
bool asan_protected = false;
/* This function is supposed to handle VARIABLES. Ensure we have one. */
- gcc_assert (TREE_CODE (decl) == VAR_DECL);
+ gcc_assert (VAR_P (decl));
/* Emulated TLS had better not get this far. */
gcc_checking_assert (targetm.have_tls || !DECL_THREAD_LOCAL_P (decl));
@@ -2487,7 +2486,7 @@ mark_decl_referenced (tree decl)
&& !node->definition)
node->mark_force_output ();
}
- else if (TREE_CODE (decl) == VAR_DECL)
+ else if (VAR_P (decl))
{
varpool_node *node = varpool_node::get_create (decl);
/* C++ frontend use mark_decl_references to force COMDAT variables
@@ -3272,8 +3271,7 @@ build_constant_desc (tree exp)
if (use_object_blocks_p ())
{
int align = (TREE_CODE (decl) == CONST_DECL
- || (TREE_CODE (decl) == VAR_DECL
- && DECL_IN_CONSTANT_POOL (decl))
+ || (VAR_P (decl) && DECL_IN_CONSTANT_POOL (decl))
? DECL_ALIGN (decl)
: symtab_node::get (decl)->definition_alignment ());
section *sect = get_constant_section (exp, align);
@@ -3430,8 +3428,7 @@ output_constant_def_contents (rtx symbol
else
{
int align = (TREE_CODE (decl) == CONST_DECL
- || (TREE_CODE (decl) == VAR_DECL
- && DECL_IN_CONSTANT_POOL (decl))
+ || (VAR_P (decl) && DECL_IN_CONSTANT_POOL (decl))
? DECL_ALIGN (decl)
: symtab_node::get (decl)->definition_alignment ());
switch_to_section (get_constant_section (exp, align));
@@ -5619,7 +5616,7 @@ do_assemble_alias (tree decl, tree targe
/* Emulated TLS had better not get this var. */
gcc_assert (!(!targetm.have_tls
- && TREE_CODE (decl) == VAR_DECL
+ && VAR_P (decl)
&& DECL_THREAD_LOCAL_P (decl)));
if (TREE_ASM_WRITTEN (decl))
@@ -6022,12 +6019,11 @@ void
make_decl_one_only (tree decl, tree comdat_group)
{
struct symtab_node *symbol;
- gcc_assert (TREE_CODE (decl) == VAR_DECL
- || TREE_CODE (decl) == FUNCTION_DECL);
+ gcc_assert (VAR_OR_FUNCTION_DECL_P (decl));
TREE_PUBLIC (decl) = 1;
- if (TREE_CODE (decl) == VAR_DECL)
+ if (VAR_P (decl))
symbol = varpool_node::get_create (decl);
else
symbol = cgraph_node::get_create (decl);
@@ -6039,7 +6035,7 @@ make_decl_one_only (tree decl, tree comd
#endif
symbol->set_comdat_group (comdat_group);
}
- else if (TREE_CODE (decl) == VAR_DECL
+ else if (VAR_P (decl)
&& (DECL_INITIAL (decl) == 0
|| (!in_lto_p && DECL_INITIAL (decl) == error_mark_node)))
DECL_COMMON (decl) = 1;
@@ -6190,7 +6186,7 @@ default_section_type_flags (tree decl, c
if (strcmp (name, ".vtable_map_vars") == 0)
flags |= SECTION_LINKONCE;
- if (decl && TREE_CODE (decl) == VAR_DECL && DECL_THREAD_LOCAL_P (decl))
+ if (decl && VAR_P (decl) && DECL_THREAD_LOCAL_P (decl))
flags |= SECTION_TLS | SECTION_WRITE;
if (strcmp (name, ".bss") == 0
@@ -6412,7 +6408,7 @@ categorize_decl_for_section (const_tree
else
return SECCAT_RODATA_MERGE_STR;
}
- else if (TREE_CODE (decl) == VAR_DECL)
+ else if (VAR_P (decl))
{
if (bss_initializer_p (decl))
ret = SECCAT_BSS;
@@ -6456,7 +6452,7 @@ categorize_decl_for_section (const_tree
ret = SECCAT_RODATA;
/* There are no read-only thread-local sections. */
- if (TREE_CODE (decl) == VAR_DECL && DECL_THREAD_LOCAL_P (decl))
+ if (VAR_P (decl) && DECL_THREAD_LOCAL_P (decl))
{
/* Note that this would be *just* SECCAT_BSS, except that there's
no concept of a read-only thread-local-data section. */
@@ -6732,7 +6728,7 @@ default_encode_section_info (tree decl,
flags |= SYMBOL_FLAG_FUNCTION;
if (targetm.binds_local_p (decl))
flags |= SYMBOL_FLAG_LOCAL;
- if (TREE_CODE (decl) == VAR_DECL && DECL_THREAD_LOCAL_P (decl))
+ if (VAR_P (decl) && DECL_THREAD_LOCAL_P (decl))
flags |= DECL_TLS_MODEL (decl) << SYMBOL_FLAG_TLS_SHIFT;
else if (targetm.in_small_data_p (decl))
flags |= SYMBOL_FLAG_SMALL;
--- gcc/trans-mem.c.jj 2016-09-27 20:12:44.806147361 +0200
+++ gcc/trans-mem.c 2016-10-08 18:37:17.849364898 +0200
@@ -1545,7 +1545,7 @@ requires_barrier (basic_block entry_bloc
x = TREE_OPERAND (TMR_BASE (x), 0);
if (TREE_CODE (x) == PARM_DECL)
return false;
- gcc_assert (TREE_CODE (x) == VAR_DECL);
+ gcc_assert (VAR_P (x));
/* FALLTHRU */
case PARM_DECL:
--- gcc/gimple-expr.c.jj 2016-04-22 18:21:54.934933633 +0200
+++ gcc/gimple-expr.c 2016-10-08 18:27:07.976024423 +0200
@@ -888,7 +888,7 @@ mark_addressable (tree x)
if (TREE_CODE (x) == MEM_REF
&& TREE_CODE (TREE_OPERAND (x, 0)) == ADDR_EXPR)
x = TREE_OPERAND (TREE_OPERAND (x, 0), 0);
- if (TREE_CODE (x) != VAR_DECL
+ if (!VAR_P (x)
&& TREE_CODE (x) != PARM_DECL
&& TREE_CODE (x) != RESULT_DECL)
return;
--- gcc/cfgexpand.c.jj 2016-09-16 22:19:42.546446617 +0200
+++ gcc/cfgexpand.c 2016-10-08 18:21:59.865894722 +0200
@@ -576,7 +576,7 @@ add_scope_conflicts_1 (basic_block bb, b
size_t *v;
/* Nested function lowering might introduce LHSs
that are COMPONENT_REFs. */
- if (TREE_CODE (lhs) != VAR_DECL)
+ if (!VAR_P (lhs))
continue;
if (DECL_RTL_IF_SET (lhs) == pc_rtx
&& (v = decl_to_stack_part->get (lhs)))
@@ -1571,7 +1571,7 @@ expand_one_var (tree var, bool toplevel,
var = SSAVAR (var);
- if (TREE_TYPE (var) != error_mark_node && TREE_CODE (var) == VAR_DECL)
+ if (TREE_TYPE (var) != error_mark_node && VAR_P (var))
{
if (is_global_var (var))
return 0;
@@ -1608,7 +1608,7 @@ expand_one_var (tree var, bool toplevel,
if (TREE_CODE (origvar) == SSA_NAME)
{
- gcc_assert (TREE_CODE (var) != VAR_DECL
+ gcc_assert (!VAR_P (var)
|| (!DECL_EXTERNAL (var)
&& !DECL_HAS_VALUE_EXPR_P (var)
&& !TREE_STATIC (var)
@@ -1616,7 +1616,7 @@ expand_one_var (tree var, bool toplevel,
&& !DECL_HARD_REGISTER (var)
&& really_expand));
}
- if (TREE_CODE (var) != VAR_DECL && TREE_CODE (origvar) != SSA_NAME)
+ if (!VAR_P (var) && TREE_CODE (origvar) != SSA_NAME)
;
else if (DECL_EXTERNAL (var))
;
@@ -1631,7 +1631,7 @@ expand_one_var (tree var, bool toplevel,
if (really_expand)
expand_one_error_var (var);
}
- else if (TREE_CODE (var) == VAR_DECL && DECL_HARD_REGISTER (var))
+ else if (VAR_P (var) && DECL_HARD_REGISTER (var))
{
if (really_expand)
{
@@ -1689,7 +1689,7 @@ expand_used_vars_for_block (tree block,
/* Expand all variables at this level. */
for (t = BLOCK_VARS (block); t ; t = DECL_CHAIN (t))
if (TREE_USED (t)
- && ((TREE_CODE (t) != VAR_DECL && TREE_CODE (t) != RESULT_DECL)
+ && ((!VAR_P (t) && TREE_CODE (t) != RESULT_DECL)
|| !DECL_NONSHAREABLE (t)))
expand_one_var (t, toplevel, true);
@@ -1708,7 +1708,7 @@ clear_tree_used (tree block)
for (t = BLOCK_VARS (block); t ; t = DECL_CHAIN (t))
/* if (!TREE_STATIC (t) && !DECL_EXTERNAL (t)) */
- if ((TREE_CODE (t) != VAR_DECL && TREE_CODE (t) != RESULT_DECL)
+ if ((!VAR_P (t) && TREE_CODE (t) != RESULT_DECL)
|| !DECL_NONSHAREABLE (t))
TREE_USED (t) = 0;
@@ -1984,7 +1984,7 @@ stack_protect_decl_p ()
if (!is_global_var (var))
{
tree var_type = TREE_TYPE (var);
- if (TREE_CODE (var) == VAR_DECL
+ if (VAR_P (var)
&& (TREE_CODE (var_type) == ARRAY_TYPE
|| TREE_ADDRESSABLE (var)
|| (RECORD_OR_UNION_TYPE_P (var_type)
@@ -4275,7 +4275,7 @@ expand_debug_expr (tree exp)
/* This decl was probably optimized away. */
if (!op0)
{
- if (TREE_CODE (exp) != VAR_DECL
+ if (!VAR_P (exp)
|| DECL_EXTERNAL (exp)
|| !TREE_STATIC (exp)
|| !DECL_NAME (exp)
@@ -4876,7 +4876,7 @@ expand_debug_expr (tree exp)
tree decl
= get_ref_base_and_extent (TREE_OPERAND (exp, 0), &bitoffset,
&bitsize, &maxsize, &reverse);
- if ((TREE_CODE (decl) == VAR_DECL
+ if ((VAR_P (decl)
|| TREE_CODE (decl) == PARM_DECL
|| TREE_CODE (decl) == RESULT_DECL)
&& (!TREE_ADDRESSABLE (decl)
--- gcc/tree-dump.c.jj 2016-09-23 09:33:36.754328252 +0200
+++ gcc/tree-dump.c 2016-10-08 18:41:30.419197625 +0200
@@ -536,8 +536,7 @@ dequeue_and_dump (dump_info_p di)
if (DECL_FIELD_OFFSET (t))
dump_child ("bpos", bit_position (t));
}
- else if (TREE_CODE (t) == VAR_DECL
- || TREE_CODE (t) == PARM_DECL)
+ else if (VAR_P (t) || TREE_CODE (t) == PARM_DECL)
{
dump_int (di, "used", TREE_USED (t));
if (DECL_REGISTER (t))
--- gcc/ubsan.c.jj 2016-10-05 21:03:53.295261583 +0200
+++ gcc/ubsan.c 2016-10-08 18:48:58.891573696 +0200
@@ -1369,7 +1369,7 @@ instrument_bool_enum_load (gimple_stmt_i
&unsignedp, &reversep, &volatilep);
tree utype = build_nonstandard_integer_type (modebitsize, 1);
- if ((TREE_CODE (base) == VAR_DECL && DECL_HARD_REGISTER (base))
+ if ((VAR_P (base) && DECL_HARD_REGISTER (base))
|| (bitpos % modebitsize) != 0
|| bitsize != modebitsize
|| GET_MODE_BITSIZE (TYPE_MODE (utype)) != modebitsize
--- gcc/tree-pretty-print.c.jj 2016-09-23 09:33:36.764328123 +0200
+++ gcc/tree-pretty-print.c 2016-10-08 18:43:36.386617969 +0200
@@ -3284,7 +3284,7 @@ print_declaration (pretty_printer *pp, t
dump_generic_node (pp, t, spc, flags, false);
}
- if (TREE_CODE (t) == VAR_DECL && DECL_HARD_REGISTER (t))
+ if (VAR_P (t) && DECL_HARD_REGISTER (t))
{
pp_string (pp, " __asm__ ");
pp_left_paren (pp);
@@ -3307,7 +3307,7 @@ print_declaration (pretty_printer *pp, t
}
}
- if (TREE_CODE (t) == VAR_DECL && DECL_HAS_VALUE_EXPR_P (t))
+ if (VAR_P (t) && DECL_HAS_VALUE_EXPR_P (t))
{
pp_string (pp, " [value-expr: ");
dump_generic_node (pp, DECL_VALUE_EXPR (t), spc, flags, false);
--- gcc/simplify-rtx.c.jj 2016-10-07 21:36:01.746423945 +0200
+++ gcc/simplify-rtx.c 2016-10-08 18:35:53.992416913 +0200
@@ -321,7 +321,7 @@ delegitimize_mem_from_attrs (rtx x)
if (decl
&& mode == GET_MODE (x)
- && TREE_CODE (decl) == VAR_DECL
+ && VAR_P (decl)
&& (TREE_STATIC (decl)
|| DECL_THREAD_LOCAL_P (decl))
&& DECL_RTL_SET_P (decl)
--- gcc/tree-ssa-uninit.c.jj 2016-06-20 23:40:25.054386915 +0200
+++ gcc/tree-ssa-uninit.c 2016-10-08 18:47:32.273659901 +0200
@@ -244,7 +244,7 @@ warn_uninitialized_vars (bool warn_possi
tree base = get_base_address (rhs);
/* Do not warn if it can be initialized outside this function. */
- if (TREE_CODE (base) != VAR_DECL
+ if (!VAR_P (base)
|| DECL_HARD_REGISTER (base)
|| is_global_var (base))
continue;
--- gcc/asan.c.jj 2016-08-29 12:17:37.175402120 +0200
+++ gcc/asan.c 2016-10-08 18:20:13.704228262 +0200
@@ -1351,7 +1351,7 @@ asan_protect_global (tree decl)
return false;
return true;
}
- if (TREE_CODE (decl) != VAR_DECL
+ if (!VAR_P (decl)
/* TLS vars aren't statically protectable. */
|| DECL_THREAD_LOCAL_P (decl)
/* Externs will be protected elsewhere. */
@@ -1810,7 +1810,7 @@ instrument_derefs (gimple_stmt_iterator
|| bitsize != size_in_bytes * BITS_PER_UNIT)
return;
- if (TREE_CODE (inner) == VAR_DECL
+ if (VAR_P (inner)
&& offset == NULL_TREE
&& bitpos >= 0
&& DECL_SIZE (inner)
--- gcc/tree-into-ssa.c.jj 2016-09-15 13:39:14.023019280 +0200
+++ gcc/tree-into-ssa.c 2016-10-08 18:42:53.818151786 +0200
@@ -1339,8 +1339,7 @@ rewrite_stmt (gimple_stmt_iterator *si)
{
/* If we rewrite a DECL into SSA form then drop its
clobber stmts and replace uses with a new default def. */
- gcc_checking_assert (TREE_CODE (var) == VAR_DECL
- && !gimple_vdef (stmt));
+ gcc_checking_assert (VAR_P (var) && !gimple_vdef (stmt));
gsi_replace (si, gimple_build_nop (), true);
register_new_def (get_or_create_ssa_default_def (cfun, var), var);
break;
@@ -1821,7 +1820,7 @@ maybe_register_def (def_operand_p def_p,
{
if (gimple_clobber_p (stmt) && is_gimple_reg (sym))
{
- gcc_checking_assert (TREE_CODE (sym) == VAR_DECL);
+ gcc_checking_assert (VAR_P (sym));
/* Replace clobber stmts with a default def. This new use of a
default definition may make it look like SSA_NAMEs have
conflicting lifetimes, so we need special code to let them
@@ -2393,7 +2392,7 @@ pass_build_ssa::execute (function *fun)
continue;
tree decl = SSA_NAME_VAR (name);
if (decl
- && TREE_CODE (decl) == VAR_DECL
+ && VAR_P (decl)
&& !VAR_DECL_IS_VIRTUAL_OPERAND (decl)
&& DECL_IGNORED_P (decl))
SET_SSA_NAME_VAR_OR_IDENTIFIER (name, DECL_NAME (decl));
--- gcc/var-tracking.c.jj 2016-09-16 22:19:42.595446029 +0200
+++ gcc/var-tracking.c 2016-10-08 18:50:51.509161451 +0200
@@ -1810,8 +1810,7 @@ vars_copy (variable_table_type *dst, var
static inline tree
var_debug_decl (tree decl)
{
- if (decl && TREE_CODE (decl) == VAR_DECL
- && DECL_HAS_DEBUG_EXPR_P (decl))
+ if (decl && VAR_P (decl) && DECL_HAS_DEBUG_EXPR_P (decl))
{
tree debugdecl = DECL_DEBUG_EXPR (decl);
if (DECL_P (debugdecl))
@@ -5145,7 +5144,7 @@ track_expr_p (tree expr, bool need_rtl)
return DECL_RTL_SET_P (expr);
/* If EXPR is not a parameter or a variable do not track it. */
- if (TREE_CODE (expr) != VAR_DECL && TREE_CODE (expr) != PARM_DECL)
+ if (!VAR_P (expr) && TREE_CODE (expr) != PARM_DECL)
return 0;
/* It also must have a name... */
@@ -5161,7 +5160,7 @@ track_expr_p (tree expr, bool need_rtl)
don't need to track this expression if the ultimate declaration is
ignored. */
realdecl = expr;
- if (TREE_CODE (realdecl) == VAR_DECL && DECL_HAS_DEBUG_EXPR_P (realdecl))
+ if (VAR_P (realdecl) && DECL_HAS_DEBUG_EXPR_P (realdecl))
{
realdecl = DECL_DEBUG_EXPR (realdecl);
if (!DECL_P (realdecl))
--- gcc/tree-ssa-loop-ivopts.c.jj 2016-09-26 12:06:43.086821138 +0200
+++ gcc/tree-ssa-loop-ivopts.c 2016-10-08 18:46:13.091652859 +0200
@@ -4383,7 +4383,7 @@ force_expr_to_var_cost (tree expr, bool
{
tree obj = TREE_OPERAND (expr, 0);
- if (TREE_CODE (obj) == VAR_DECL
+ if (VAR_P (obj)
|| TREE_CODE (obj) == PARM_DECL
|| TREE_CODE (obj) == RESULT_DECL)
return comp_cost (symbol_cost [speed], 0);
@@ -4530,7 +4530,7 @@ split_address_cost (struct ivopts_data *
if (toffset != 0
|| bitpos % BITS_PER_UNIT != 0
|| reversep
- || TREE_CODE (core) != VAR_DECL)
+ || !VAR_P (core))
{
*symbol_present = false;
*var_present = true;
--- gcc/ipa-split.c.jj 2016-09-27 09:46:13.030533104 +0200
+++ gcc/ipa-split.c 2016-10-08 18:31:22.358829015 +0200
@@ -160,7 +160,7 @@ test_nonssa_use (gimple *, tree t, tree,
return false;
if (TREE_CODE (t) == PARM_DECL
- || (TREE_CODE (t) == VAR_DECL
+ || (VAR_P (t)
&& auto_var_in_fn_p (t, current_function_decl))
|| TREE_CODE (t) == RESULT_DECL
/* Normal labels are part of CFG and will be handled gratefuly.
@@ -656,7 +656,7 @@ consider_split (struct split_point *curr
= split_part_set_ssa_name_p (retval, current, return_bb);
else if (TREE_CODE (retval) == PARM_DECL)
current->split_part_set_retval = false;
- else if (TREE_CODE (retval) == VAR_DECL
+ else if (VAR_P (retval)
|| TREE_CODE (retval) == RESULT_DECL)
current->split_part_set_retval
= bitmap_bit_p (non_ssa_vars, DECL_UID (retval));
@@ -848,11 +848,9 @@ mark_nonssa_use (gimple *, tree t, tree,
return true;
}
- if ((TREE_CODE (t) == VAR_DECL
- && auto_var_in_fn_p (t, current_function_decl))
+ if ((VAR_P (t) && auto_var_in_fn_p (t, current_function_decl))
|| TREE_CODE (t) == RESULT_DECL
- || (TREE_CODE (t) == LABEL_DECL
- && FORCED_LABEL (t)))
+ || (TREE_CODE (t) == LABEL_DECL && FORCED_LABEL (t)))
bitmap_set_bit ((bitmap)data, DECL_UID (t));
/* For DECL_BY_REFERENCE, the return value is actually a pointer. We want
--- gcc/tree-inline.c.jj 2016-09-22 13:16:48.069925119 +0200
+++ gcc/tree-inline.c 2016-10-08 18:42:34.559393295 +0200
@@ -163,7 +163,7 @@ insert_debug_decl_map (copy_body_data *i
return;
gcc_assert (TREE_CODE (key) == PARM_DECL);
- gcc_assert (TREE_CODE (value) == VAR_DECL);
+ gcc_assert (VAR_P (value));
if (!id->debug_map)
id->debug_map = new hash_map<tree, tree>;
@@ -228,7 +228,7 @@ remap_ssa_name (tree name, copy_body_dat
var = SSA_NAME_VAR (name);
if (!var
|| (!SSA_NAME_IS_DEFAULT_DEF (name)
- && TREE_CODE (var) == VAR_DECL
+ && VAR_P (var)
&& !VAR_DECL_IS_VIRTUAL_OPERAND (var)
&& DECL_ARTIFICIAL (var)
&& DECL_IGNORED_P (var)
@@ -264,7 +264,7 @@ remap_ssa_name (tree name, copy_body_dat
Replace the SSA name representing RESULT_DECL by variable during
inlining: this saves us from need to introduce PHI node in a case
return value is just partly initialized. */
- if ((TREE_CODE (new_tree) == VAR_DECL || TREE_CODE (new_tree) == PARM_DECL)
+ if ((VAR_P (new_tree) || TREE_CODE (new_tree) == PARM_DECL)
&& (!SSA_NAME_VAR (name)
|| TREE_CODE (SSA_NAME_VAR (name)) != RESULT_DECL
|| !id->transform_return_to_modify))
@@ -607,8 +607,7 @@ can_be_nonlocal (tree decl, copy_body_da
/* Local static vars must be non-local or we get multiple declaration
problems. */
- if (TREE_CODE (decl) == VAR_DECL
- && !auto_var_in_fn_p (decl, id->src_fn))
+ if (VAR_P (decl) && !auto_var_in_fn_p (decl, id->src_fn))
return true;
return false;
@@ -630,9 +629,7 @@ remap_decls (tree decls, vec<tree, va_gc
{
/* We need to add this variable to the local decls as otherwise
nothing else will do so. */
- if (TREE_CODE (old_var) == VAR_DECL
- && ! DECL_EXTERNAL (old_var)
- && cfun)
+ if (VAR_P (old_var) && ! DECL_EXTERNAL (old_var) && cfun)
add_local_decl (cfun, old_var);
if ((!optimize || debug_info_level > DINFO_LEVEL_TERSE)
&& !DECL_IGNORED_P (old_var)
@@ -664,8 +661,7 @@ remap_decls (tree decls, vec<tree, va_gc
new_decls = new_var;
/* Also copy value-expressions. */
- if (TREE_CODE (new_var) == VAR_DECL
- && DECL_HAS_VALUE_EXPR_P (new_var))
+ if (VAR_P (new_var) && DECL_HAS_VALUE_EXPR_P (new_var))
{
tree tem = DECL_VALUE_EXPR (new_var);
bool old_regimplify = id->regimplify;
@@ -2876,12 +2872,10 @@ copy_debug_stmt (gdebug *stmt, copy_body
if (TREE_CODE (t) == PARM_DECL && id->debug_map
&& (n = id->debug_map->get (t)))
{
- gcc_assert (TREE_CODE (*n) == VAR_DECL);
+ gcc_assert (VAR_P (*n));
t = *n;
}
- else if (TREE_CODE (t) == VAR_DECL
- && !is_global_var (t)
- && !id->decl_map->get (t))
+ else if (VAR_P (t) && !is_global_var (t) && !id->decl_map->get (t))
/* T is a non-localized variable. */;
else
walk_tree (&t, remap_gimple_op_r, &wi, NULL);
@@ -3277,8 +3271,7 @@ initialize_inlined_parameters (copy_body
for (p = parms, i = 0; p; p = DECL_CHAIN (p), i++)
{
tree *varp = id->decl_map->get (p);
- if (varp
- && TREE_CODE (*varp) == VAR_DECL)
+ if (varp && VAR_P (*varp))
{
tree def = (gimple_in_ssa_p (cfun) && is_gimple_reg (p)
? ssa_default_def (id->src_cfun, p) : NULL);
@@ -4297,7 +4290,7 @@ add_local_variables (struct function *ca
tree new_var = remap_decl (var, id);
/* Remap debug-expressions. */
- if (TREE_CODE (new_var) == VAR_DECL
+ if (VAR_P (new_var)
&& DECL_HAS_DEBUG_EXPR_P (var)
&& new_var != var)
{
@@ -4325,7 +4318,7 @@ reset_debug_binding (copy_body_data *id,
if (!remappedvarp)
return;
- if (TREE_CODE (*remappedvarp) != VAR_DECL)
+ if (!VAR_P (*remappedvarp))
return;
if (*remappedvarp == id->retvar || *remappedvarp == id->retbnd)
@@ -5202,8 +5195,7 @@ replace_locals_op (tree *tp, int *walk_s
SSA_NAME_DEF_STMT (*tp) = gsi_stmt (wi->gsi);
}
/* Only a local declaration (variable or label). */
- else if ((TREE_CODE (expr) == VAR_DECL
- && !TREE_STATIC (expr))
+ else if ((VAR_P (expr) && !TREE_STATIC (expr))
|| TREE_CODE (expr) == LABEL_DECL)
{
/* Lookup the declaration. */
--- gcc/dse.c.jj 2016-08-06 12:11:54.329463244 +0200
+++ gcc/dse.c 2016-10-08 18:23:51.465492873 +0200
@@ -911,7 +911,7 @@ can_escape (tree expr)
base = get_base_address (expr);
if (DECL_P (base)
&& !may_be_aliased (base)
- && !(TREE_CODE (base) == VAR_DECL
+ && !(VAR_P (base)
&& !DECL_EXTERNAL (base)
&& !TREE_STATIC (base)
&& local_variable_can_escape (base)))
--- gcc/ipa-devirt.c.jj 2016-09-21 08:54:17.084104510 +0200
+++ gcc/ipa-devirt.c 2016-10-08 18:30:36.531404672 +0200
@@ -877,9 +877,9 @@ compare_virtual_tables (varpool_node *pr
if (TREE_CODE (ref1->referred->decl)
!= TREE_CODE (ref2->referred->decl))
{
- if (TREE_CODE (ref1->referred->decl) == VAR_DECL)
+ if (VAR_P (ref1->referred->decl))
end1 = true;
- else if (TREE_CODE (ref2->referred->decl) == VAR_DECL)
+ else if (VAR_P (ref2->referred->decl))
end2 = true;
}
}
@@ -2342,7 +2342,7 @@ referenced_from_vtable_p (struct cgraph_
if ((ref->use == IPA_REF_ALIAS
&& referenced_from_vtable_p (dyn_cast<cgraph_node *> (ref->referring)))
|| (ref->use == IPA_REF_ADDR
- && TREE_CODE (ref->referring->decl) == VAR_DECL
+ && VAR_P (ref->referring->decl)
&& DECL_VIRTUAL_P (ref->referring->decl)))
{
found = true;
--- gcc/tree-diagnostic.c.jj 2016-07-14 20:28:22.333686539 +0200
+++ gcc/tree-diagnostic.c 2016-10-08 18:41:19.320336806 +0200
@@ -266,7 +266,7 @@ default_tree_printer (pretty_printer *pp
case 'D':
t = va_arg (*text->args_ptr, tree);
- if (TREE_CODE (t) == VAR_DECL && DECL_HAS_DEBUG_EXPR_P (t))
+ if (VAR_P (t) && DECL_HAS_DEBUG_EXPR_P (t))
t = DECL_DEBUG_EXPR (t);
break;
--- gcc/tree-streamer-in.c.jj 2016-08-06 12:11:57.483423517 +0200
+++ gcc/tree-streamer-in.c 2016-10-08 18:58:28.619408274 +0200
@@ -251,7 +251,7 @@ unpack_ts_decl_common_value_fields (stru
expr->decl_common.off_align = bp_unpack_value (bp, 8);
}
- if (TREE_CODE (expr) == VAR_DECL)
+ if (VAR_P (expr))
{
DECL_HAS_DEBUG_EXPR_P (expr) = (unsigned) bp_unpack_value (bp, 1);
DECL_NONLOCAL_FRAME (expr) = (unsigned) bp_unpack_value (bp, 1);
@@ -259,11 +259,10 @@ unpack_ts_decl_common_value_fields (stru
if (TREE_CODE (expr) == RESULT_DECL
|| TREE_CODE (expr) == PARM_DECL
- || TREE_CODE (expr) == VAR_DECL)
+ || VAR_P (expr))
{
DECL_BY_REFERENCE (expr) = (unsigned) bp_unpack_value (bp, 1);
- if (TREE_CODE (expr) == VAR_DECL
- || TREE_CODE (expr) == PARM_DECL)
+ if (VAR_P (expr) || TREE_CODE (expr) == PARM_DECL)
DECL_HAS_VALUE_EXPR_P (expr) = (unsigned) bp_unpack_value (bp, 1);
}
}
@@ -293,7 +292,7 @@ unpack_ts_decl_with_vis_value_fields (st
DECL_VISIBILITY (expr) = (enum symbol_visibility) bp_unpack_value (bp, 2);
DECL_VISIBILITY_SPECIFIED (expr) = (unsigned) bp_unpack_value (bp, 1);
- if (TREE_CODE (expr) == VAR_DECL)
+ if (VAR_P (expr))
{
DECL_HARD_REGISTER (expr) = (unsigned) bp_unpack_value (bp, 1);
DECL_IN_CONSTANT_POOL (expr) = (unsigned) bp_unpack_value (bp, 1);
@@ -712,12 +711,11 @@ lto_input_ts_decl_common_tree_pointers (
for early inlining so drop it on the floor instead of ICEing in
dwarf2out.c. */
- if ((TREE_CODE (expr) == VAR_DECL
- || TREE_CODE (expr) == PARM_DECL)
+ if ((VAR_P (expr) || TREE_CODE (expr) == PARM_DECL)
&& DECL_HAS_VALUE_EXPR_P (expr))
SET_DECL_VALUE_EXPR (expr, stream_read_tree (ib, data_in));
- if (TREE_CODE (expr) == VAR_DECL)
+ if (VAR_P (expr))
{
tree dexpr = stream_read_tree (ib, data_in);
if (dexpr)
--- gcc/builtins.c.jj 2016-10-05 17:01:33.430613067 +0200
+++ gcc/builtins.c 2016-10-08 18:21:17.626425309 +0200
@@ -691,7 +691,7 @@ builtin_save_expr (tree exp)
if (TREE_CODE (exp) == SSA_NAME
|| (TREE_ADDRESSABLE (exp) == 0
&& (TREE_CODE (exp) == PARM_DECL
- || (TREE_CODE (exp) == VAR_DECL && !TREE_STATIC (exp)))))
+ || (VAR_P (exp) && !TREE_STATIC (exp)))))
return exp;
return save_expr (exp);
@@ -7141,9 +7141,7 @@ fold_builtin_expect (location_t loc, tre
}
while (TREE_CODE (inner) == COMPONENT_REF
|| TREE_CODE (inner) == ARRAY_REF);
- if ((TREE_CODE (inner) == VAR_DECL
- || TREE_CODE (inner) == FUNCTION_DECL)
- && DECL_WEAK (inner))
+ if (VAR_OR_FUNCTION_DECL_P (inner) && DECL_WEAK (inner))
return NULL_TREE;
}
@@ -8813,7 +8811,7 @@ readonly_data_expr (tree exp)
understand). */
if (TREE_CODE (exp) == STRING_CST
|| TREE_CODE (exp) == CONSTRUCTOR
- || (TREE_CODE (exp) == VAR_DECL && TREE_STATIC (exp)))
+ || (VAR_P (exp) && TREE_STATIC (exp)))
return decl_readonly_section (exp, 0);
else
return false;
--- gcc/tree-ssa-structalias.c.jj 2016-10-07 11:23:55.391588561 +0200
+++ gcc/tree-ssa-structalias.c 2016-10-08 18:47:17.176849218 +0200
@@ -385,8 +385,7 @@ new_var_info (tree t, const char *name,
ret->is_global_var = (is_global_var (t)
/* We have to treat even local register variables
as escape points. */
- || (TREE_CODE (t) == VAR_DECL
- && DECL_HARD_REGISTER (t)));
+ || (VAR_P (t) && DECL_HARD_REGISTER (t)));
ret->solution = BITMAP_ALLOC (&pta_obstack);
ret->oldsolution = NULL;
ret->next = 0;
@@ -2929,8 +2928,7 @@ get_constraint_for_ssa_var (tree t, vec<
}
/* For global variables resort to the alias target. */
- if (TREE_CODE (t) == VAR_DECL
- && (TREE_STATIC (t) || DECL_EXTERNAL (t)))
+ if (VAR_P (t) && (TREE_STATIC (t) || DECL_EXTERNAL (t)))
{
varpool_node *node = varpool_node::get (t);
if (node && node->alias && node->analyzed)
@@ -6043,7 +6041,7 @@ create_variable_info_for (tree decl, con
insert_vi_for_tree (decl, vi);
- if (TREE_CODE (decl) != VAR_DECL)
+ if (!VAR_P (decl))
return id;
/* Create initial constraints for globals. */
@@ -6319,7 +6317,7 @@ set_uids_in_ptset (bitmap into, bitmap f
if (vi->is_restrict_var)
pt->vars_contains_restrict = true;
- if (TREE_CODE (vi->decl) == VAR_DECL
+ if (VAR_P (vi->decl)
|| TREE_CODE (vi->decl) == PARM_DECL
|| TREE_CODE (vi->decl) == RESULT_DECL)
{
@@ -7290,7 +7288,7 @@ visit_loadstore (gimple *, tree base, tr
/* For plain decl accesses see whether they are accesses to globals
and rewrite them to MEM_REFs with { clique, 0 }. */
- if (TREE_CODE (base) == VAR_DECL
+ if (VAR_P (base)
&& is_global_var (base)
/* ??? We can't rewrite a plain decl with the walk_stmt_load_store
ops callback. */
@@ -7299,7 +7297,7 @@ visit_loadstore (gimple *, tree base, tr
tree *basep = &ref;
while (handled_component_p (*basep))
basep = &TREE_OPERAND (*basep, 0);
- gcc_assert (TREE_CODE (*basep) == VAR_DECL);
+ gcc_assert (VAR_P (*basep));
tree ptr = build_fold_addr_expr (*basep);
tree zero = build_int_cst (TREE_TYPE (ptr), 0);
*basep = build2 (MEM_REF, TREE_TYPE (*basep), ptr, zero);
--- gcc/gimple-streamer-out.c.jj 2016-01-04 14:55:53.030470787 +0100
+++ gcc/gimple-streamer-out.c 2016-10-08 18:29:00.269613856 +0200
@@ -145,7 +145,7 @@ output_gimple_stmt (struct output_block
basep = &TREE_OPERAND (*basep, 0);
while (handled_component_p (*basep))
basep = &TREE_OPERAND (*basep, 0);
- if (TREE_CODE (*basep) == VAR_DECL
+ if (VAR_P (*basep)
&& !auto_var_in_fn_p (*basep, current_function_decl)
&& !DECL_REGISTER (*basep))
{
--- gcc/gimplify.c.jj 2016-10-07 21:36:01.745423957 +0200
+++ gcc/gimplify.c 2016-10-08 18:29:44.005064477 +0200
@@ -665,7 +665,7 @@ force_constant_size (tree var)
HOST_WIDE_INT max_size;
- gcc_assert (TREE_CODE (var) == VAR_DECL);
+ gcc_assert (VAR_P (var));
max_size = max_int_size_in_bytes (TREE_TYPE (var));
@@ -1108,7 +1108,7 @@ gimplify_bind_expr (tree *expr_p, gimple
/* Mark variables seen in this bind expr. */
for (t = BIND_EXPR_VARS (bind_expr); t ; t = DECL_CHAIN (t))
{
- if (TREE_CODE (t) == VAR_DECL)
+ if (VAR_P (t))
{
struct gimplify_omp_ctx *ctx = gimplify_omp_ctxp;
@@ -1138,7 +1138,7 @@ gimplify_bind_expr (tree *expr_p, gimple
if ((TREE_CODE (TREE_TYPE (t)) == COMPLEX_TYPE
|| TREE_CODE (TREE_TYPE (t)) == VECTOR_TYPE)
&& !TREE_THIS_VOLATILE (t)
- && (TREE_CODE (t) == VAR_DECL && !DECL_HARD_REGISTER (t))
+ && (VAR_P (t) && !DECL_HARD_REGISTER (t))
&& !needs_to_live_in_memory (t))
DECL_GIMPLE_REG_P (t) = 1;
}
@@ -1190,7 +1190,7 @@ gimplify_bind_expr (tree *expr_p, gimple
/* Add clobbers for all variables that go out of scope. */
for (t = BIND_EXPR_VARS (bind_expr); t ; t = DECL_CHAIN (t))
{
- if (TREE_CODE (t) == VAR_DECL
+ if (VAR_P (t)
&& !is_global_var (t)
&& DECL_CONTEXT (t) == current_function_decl
&& !DECL_HARD_REGISTER (t)
@@ -1450,7 +1450,7 @@ gimplify_decl_expr (tree *stmt_p, gimple
return GS_ERROR;
if ((TREE_CODE (decl) == TYPE_DECL
- || TREE_CODE (decl) == VAR_DECL)
+ || VAR_P (decl))
&& !TYPE_SIZES_GIMPLIFIED (TREE_TYPE (decl)))
{
gimplify_type_sizes (TREE_TYPE (decl), seq_p);
@@ -1469,7 +1469,7 @@ gimplify_decl_expr (tree *stmt_p, gimple
gimplify_type_sizes (TREE_TYPE (DECL_ORIGINAL_TYPE (decl)), seq_p);
}
- if (TREE_CODE (decl) == VAR_DECL && !DECL_EXTERNAL (decl))
+ if (VAR_P (decl) && !DECL_EXTERNAL (decl))
{
tree init = DECL_INITIAL (decl);
@@ -2378,7 +2378,7 @@ gimplify_var_or_parm_decl (tree *expr_p)
be really nice if the front end wouldn't leak these at all.
Currently the only known culprit is C++ destructors, as seen
in g++.old-deja/g++.jason/binding.C. */
- if (TREE_CODE (decl) == VAR_DECL
+ if (VAR_P (decl)
&& !DECL_SEEN_IN_BIND_EXPR_P (decl)
&& !TREE_STATIC (decl) && !DECL_EXTERNAL (decl)
&& decl_function_context (decl) == current_function_decl)
@@ -2398,7 +2398,7 @@ gimplify_var_or_parm_decl (tree *expr_p)
/* For referenced nonlocal VLAs add a decl for debugging purposes
to the current function. */
- if (TREE_CODE (decl) == VAR_DECL
+ if (VAR_P (decl)
&& TREE_CODE (DECL_SIZE_UNIT (decl)) != INTEGER_CST
&& nonlocal_vlas != NULL
&& TREE_CODE (value_expr) == INDIRECT_REF
@@ -2533,7 +2533,7 @@ gimplify_compound_lval (tree *expr_p, gi
;
/* Expand DECL_VALUE_EXPR now. In some cases that may expose
additional COMPONENT_REFs. */
- else if ((TREE_CODE (*p) == VAR_DECL || TREE_CODE (*p) == PARM_DECL)
+ else if ((VAR_P (*p) || TREE_CODE (*p) == PARM_DECL)
&& gimplify_var_or_parm_decl (p) == GS_OK)
goto restart;
else
@@ -4447,7 +4447,7 @@ gimplify_init_constructor (tree *expr_p,
if (valid_const_initializer
&& num_nonzero_elements > 1
&& TREE_READONLY (object)
- && TREE_CODE (object) == VAR_DECL
+ && VAR_P (object)
&& (flag_merge_constants >= 2 || !TREE_ADDRESSABLE (object)))
{
if (notify_temp_creation)
@@ -5200,8 +5200,7 @@ gimplify_modify_expr (tree *expr_p, gimp
if (ret == GS_ERROR)
return ret;
gcc_assert (!want_value
- && (TREE_CODE (*to_p) == VAR_DECL
- || TREE_CODE (*to_p) == MEM_REF));
+ && (VAR_P (*to_p) || TREE_CODE (*to_p) == MEM_REF));
gimplify_seq_add_stmt (pre_p, gimple_build_assign (*to_p, *from_p));
*expr_p = NULL;
return GS_ALL_DONE;
@@ -5349,7 +5348,7 @@ gimplify_modify_expr (tree *expr_p, gimp
temporaries (see for example is_gimple_reg_rhs) on the debug info, but
make sure not to create DECL_DEBUG_EXPR links across functions. */
if (!gimplify_ctxp->into_ssa
- && TREE_CODE (*from_p) == VAR_DECL
+ && VAR_P (*from_p)
&& DECL_IGNORED_P (*from_p)
&& DECL_P (*to_p)
&& !DECL_IGNORED_P (*to_p)
@@ -5935,7 +5934,7 @@ gimplify_asm_expr (tree *expr_p, gimple_
if (TREE_CODE (x) == MEM_REF
&& TREE_CODE (TREE_OPERAND (x, 0)) == ADDR_EXPR)
x = TREE_OPERAND (TREE_OPERAND (x, 0), 0);
- if ((TREE_CODE (x) == VAR_DECL
+ if ((VAR_P (x)
|| TREE_CODE (x) == PARM_DECL
|| TREE_CODE (x) == RESULT_DECL)
&& !TREE_ADDRESSABLE (x)
@@ -9055,7 +9054,7 @@ gimplify_oacc_declare (tree *expr_p, gim
if (TREE_CODE (decl) == MEM_REF)
continue;
- if (TREE_CODE (decl) == VAR_DECL
+ if (VAR_P (decl)
&& !is_global_var (decl)
&& DECL_CONTEXT (decl) == current_function_decl)
{
@@ -12045,10 +12044,10 @@ gimplify_type_sizes (tree type, gimple_s
&& INTEGRAL_TYPE_P (TYPE_DOMAIN (type)))
{
t = TYPE_MIN_VALUE (TYPE_DOMAIN (type));
- if (t && TREE_CODE (t) == VAR_DECL && DECL_ARTIFICIAL (t))
+ if (t && VAR_P (t) && DECL_ARTIFICIAL (t))
DECL_IGNORED_P (t) = 0;
t = TYPE_MAX_VALUE (TYPE_DOMAIN (type));
- if (t && TREE_CODE (t) == VAR_DECL && DECL_ARTIFICIAL (t))
+ if (t && VAR_P (t) && DECL_ARTIFICIAL (t))
DECL_IGNORED_P (t) = 0;
}
break;
--- gcc/cgraphbuild.c.jj 2016-01-04 14:55:52.053484379 +0100
+++ gcc/cgraphbuild.c 2016-10-08 18:22:51.194249965 +0200
@@ -77,7 +77,7 @@ record_reference (tree *tp, int *walk_su
ctx->varpool_node->create_reference (node, IPA_REF_ADDR);
}
- if (TREE_CODE (decl) == VAR_DECL)
+ if (VAR_P (decl))
{
varpool_node *vnode = varpool_node::get_create (decl);
ctx->varpool_node->create_reference (vnode, IPA_REF_ADDR);
@@ -114,7 +114,7 @@ record_type_list (cgraph_node *node, tre
if (TREE_CODE (type) == ADDR_EXPR)
{
type = TREE_OPERAND (type, 0);
- if (TREE_CODE (type) == VAR_DECL)
+ if (VAR_P (type))
{
varpool_node *vnode = varpool_node::get_create (type);
node->create_reference (vnode, IPA_REF_ADDR);
@@ -219,7 +219,7 @@ mark_address (gimple *stmt, tree addr, t
node->mark_address_taken ();
((symtab_node *)data)->create_reference (node, IPA_REF_ADDR, stmt);
}
- else if (addr && TREE_CODE (addr) == VAR_DECL
+ else if (addr && VAR_P (addr)
&& (TREE_STATIC (addr) || DECL_EXTERNAL (addr)))
{
varpool_node *vnode = varpool_node::get_create (addr);
@@ -244,8 +244,7 @@ mark_load (gimple *stmt, tree t, tree, v
node->mark_address_taken ();
((symtab_node *)data)->create_reference (node, IPA_REF_ADDR, stmt);
}
- else if (t && TREE_CODE (t) == VAR_DECL
- && (TREE_STATIC (t) || DECL_EXTERNAL (t)))
+ else if (t && VAR_P (t) && (TREE_STATIC (t) || DECL_EXTERNAL (t)))
{
varpool_node *vnode = varpool_node::get_create (t);
@@ -260,8 +259,7 @@ static bool
mark_store (gimple *stmt, tree t, tree, void *data)
{
t = get_base_address (t);
- if (t && TREE_CODE (t) == VAR_DECL
- && (TREE_STATIC (t) || DECL_EXTERNAL (t)))
+ if (t && VAR_P (t) && (TREE_STATIC (t) || DECL_EXTERNAL (t)))
{
varpool_node *vnode = varpool_node::get_create (t);
@@ -369,7 +367,7 @@ pass_build_cgraph_edges::execute (functi
/* Look for initializers of constant variables and private statics. */
FOR_EACH_LOCAL_DECL (fun, ix, decl)
- if (TREE_CODE (decl) == VAR_DECL
+ if (VAR_P (decl)
&& (TREE_STATIC (decl) && !DECL_EXTERNAL (decl))
&& !DECL_HAS_VALUE_EXPR_P (decl)
&& TREE_TYPE (decl) != error_mark_node)
--- gcc/tree-ssa-live.c.jj 2016-08-06 12:11:56.226439350 +0200
+++ gcc/tree-ssa-live.c 2016-10-08 18:46:04.268763499 +0200
@@ -329,7 +329,7 @@ mark_all_vars_used_1 (tree *tp, int *wal
/* Only need to mark VAR_DECLS; parameters and return results are not
eliminated as unused. */
- if (TREE_CODE (t) == VAR_DECL)
+ if (VAR_P (t))
{
/* When a global var becomes used for the first time also walk its
initializer (non global ones don't have any). */
@@ -425,7 +425,7 @@ remove_unused_scope_block_p (tree scope,
SET_DEST overlaps with others, and if the value expr changes
by virtual register instantiation, we may get end up with
different results. */
- else if (TREE_CODE (*t) == VAR_DECL && DECL_HAS_VALUE_EXPR_P (*t))
+ else if (VAR_P (*t) && DECL_HAS_VALUE_EXPR_P (*t))
unused = false;
/* Remove everything we don't generate debug info for. */
@@ -791,7 +791,7 @@ remove_unused_locals (void)
tree base = get_base_address (lhs);
/* Remove clobbers referencing unused vars, or clobbers
with MEM_REF lhs referencing uninitialized pointers. */
- if ((TREE_CODE (base) == VAR_DECL && !is_used_p (base))
+ if ((VAR_P (base) && !is_used_p (base))
|| (TREE_CODE (lhs) == MEM_REF
&& TREE_CODE (TREE_OPERAND (lhs, 0)) == SSA_NAME
&& SSA_NAME_IS_DEFAULT_DEF (TREE_OPERAND (lhs, 0))
@@ -825,7 +825,7 @@ remove_unused_locals (void)
for (srcidx = 0, dstidx = 0; srcidx < num; srcidx++)
{
var = (*cfun->local_decls)[srcidx];
- if (TREE_CODE (var) == VAR_DECL)
+ if (VAR_P (var))
{
if (!is_used_p (var))
{
@@ -842,9 +842,7 @@ remove_unused_locals (void)
continue;
}
}
- if (TREE_CODE (var) == VAR_DECL
- && DECL_HARD_REGISTER (var)
- && !is_global_var (var))
+ if (VAR_P (var) && DECL_HARD_REGISTER (var) && !is_global_var (var))
cfun->has_local_explicit_reg_vars = true;
if (srcidx != dstidx)
--- gcc/tree-ssa-alias.c.jj 2016-09-15 13:39:14.060018820 +0200
+++ gcc/tree-ssa-alias.c 2016-10-08 18:44:49.545700541 +0200
@@ -167,7 +167,7 @@ ptr_deref_may_alias_decl_p (tree ptr, tr
&& TREE_CODE (ptr) != ADDR_EXPR
&& TREE_CODE (ptr) != POINTER_PLUS_EXPR)
|| !POINTER_TYPE_P (TREE_TYPE (ptr))
- || (TREE_CODE (decl) != VAR_DECL
+ || (!VAR_P (decl)
&& TREE_CODE (decl) != PARM_DECL
&& TREE_CODE (decl) != RESULT_DECL))
return true;
@@ -338,7 +338,7 @@ ptrs_compare_unequal (tree ptr1, tree pt
tree tem = get_base_address (TREE_OPERAND (ptr1, 0));
if (! tem)
return false;
- if (TREE_CODE (tem) == VAR_DECL
+ if (VAR_P (tem)
|| TREE_CODE (tem) == PARM_DECL
|| TREE_CODE (tem) == RESULT_DECL)
obj1 = tem;
@@ -350,7 +350,7 @@ ptrs_compare_unequal (tree ptr1, tree pt
tree tem = get_base_address (TREE_OPERAND (ptr2, 0));
if (! tem)
return false;
- if (TREE_CODE (tem) == VAR_DECL
+ if (VAR_P (tem)
|| TREE_CODE (tem) == PARM_DECL
|| TREE_CODE (tem) == RESULT_DECL)
obj2 = tem;
@@ -1819,9 +1819,7 @@ ref_maybe_used_by_call_p_1 (gcall *call,
/* Check if base is a global static variable that is not read
by the function. */
- if (callee != NULL_TREE
- && TREE_CODE (base) == VAR_DECL
- && TREE_STATIC (base))
+ if (callee != NULL_TREE && VAR_P (base) && TREE_STATIC (base))
{
struct cgraph_node *node = cgraph_node::get (callee);
bitmap not_read;
@@ -2208,9 +2206,7 @@ call_may_clobber_ref_p_1 (gcall *call, a
/* Check if base is a global static variable that is not written
by the function. */
- if (callee != NULL_TREE
- && TREE_CODE (base) == VAR_DECL
- && TREE_STATIC (base))
+ if (callee != NULL_TREE && VAR_P (base) && TREE_STATIC (base))
{
struct cgraph_node *node = cgraph_node::get (callee);
bitmap not_written;
--- gcc/function.c.jj 2016-09-16 22:19:42.497447205 +0200
+++ gcc/function.c 2016-10-08 18:26:57.275158841 +0200
@@ -1826,8 +1826,7 @@ instantiate_expr (tree *tp, int *walk_su
if (TREE_CODE (t) == PARM_DECL && DECL_NAMELESS (t)
&& DECL_INCOMING_RTL (t))
instantiate_decl_rtl (DECL_INCOMING_RTL (t));
- if ((TREE_CODE (t) == VAR_DECL
- || TREE_CODE (t) == RESULT_DECL)
+ if ((VAR_P (t) || TREE_CODE (t) == RESULT_DECL)
&& DECL_HAS_VALUE_EXPR_P (t))
{
tree v = DECL_VALUE_EXPR (t);
@@ -1850,7 +1849,7 @@ instantiate_decls_1 (tree let)
{
if (DECL_RTL_SET_P (t))
instantiate_decl_rtl (DECL_RTL (t));
- if (TREE_CODE (t) == VAR_DECL && DECL_HAS_VALUE_EXPR_P (t))
+ if (VAR_P (t) && DECL_HAS_VALUE_EXPR_P (t))
{
tree v = DECL_VALUE_EXPR (t);
walk_tree (&v, instantiate_expr, NULL, NULL);
@@ -4374,7 +4373,7 @@ setjmp_vars_warning (bitmap setjmp_cross
for (decl = BLOCK_VARS (block); decl; decl = DECL_CHAIN (decl))
{
- if (TREE_CODE (decl) == VAR_DECL
+ if (VAR_P (decl)
&& DECL_RTL_SET_P (decl)
&& REG_P (DECL_RTL (decl))
&& regno_clobbered_at_setjmp (setjmp_crosses, REGNO (DECL_RTL (decl))))
@@ -6581,7 +6580,7 @@ match_asm_constraints_1 (rtx_insn *insn,
void
add_local_decl (struct function *fun, tree d)
{
- gcc_assert (TREE_CODE (d) == VAR_DECL);
+ gcc_assert (VAR_P (d));
vec_safe_push (fun->local_decls, d);
}
--- gcc/alias.c.jj 2016-09-16 22:19:42.504447121 +0200
+++ gcc/alias.c 2016-10-08 18:19:54.586468408 +0200
@@ -310,7 +310,7 @@ ao_ref_from_mem (ao_ref *ref, const_rtx
/* If this is a reference based on a partitioned decl replace the
base with a MEM_REF of the pointer representative we
created during stack slot partitioning. */
- if (TREE_CODE (base) == VAR_DECL
+ if (VAR_P (base)
&& ! is_global_var (base)
&& cfun->gimple_df->decls_to_pointers != NULL)
{
@@ -870,7 +870,7 @@ get_alias_set (tree t)
/* If we've already determined the alias set for a decl, just return
it. This is necessary for C++ anonymous unions, whose component
variables don't look like union members (boo!). */
- if (TREE_CODE (t) == VAR_DECL
+ if (VAR_P (t)
&& DECL_RTL_SET_P (t) && MEM_P (DECL_RTL (t)))
return MEM_ALIAS_SET (DECL_RTL (t));
@@ -2087,7 +2087,7 @@ compare_base_symbol_refs (const_rtx x_ba
return -1;
/* Anchors contains static VAR_DECLs and CONST_DECLs. We are safe
to ignore CONST_DECLs because they are readonly. */
- if (TREE_CODE (x_decl) != VAR_DECL
+ if (!VAR_P (x_decl)
|| (!TREE_STATIC (x_decl) && !TREE_PUBLIC (x_decl)))
return 0;
--- gcc/tree-stdarg.c.jj 2016-09-27 09:46:11.526552179 +0200
+++ gcc/tree-stdarg.c 2016-10-08 18:47:43.778515628 +0200
@@ -273,7 +273,7 @@ find_va_list_reference (tree *tp, int *w
if (bitmap_bit_p (va_list_vars, SSA_NAME_VERSION (var)))
return var;
}
- else if (TREE_CODE (var) == VAR_DECL)
+ else if (VAR_P (var))
{
if (bitmap_bit_p (va_list_vars, DECL_UID (var) + num_ssa_names))
return var;
@@ -358,7 +358,7 @@ va_list_counter_struct_op (struct stdarg
return false;
base = get_base_address (ap);
- if (TREE_CODE (base) != VAR_DECL
+ if (!VAR_P (base)
|| !bitmap_bit_p (si->va_list_vars, DECL_UID (base) + num_ssa_names))
return false;
@@ -377,7 +377,7 @@ va_list_counter_struct_op (struct stdarg
static bool
va_list_ptr_read (struct stdarg_info *si, tree ap, tree tem)
{
- if (TREE_CODE (ap) != VAR_DECL
+ if (!VAR_P (ap)
|| !bitmap_bit_p (si->va_list_vars, DECL_UID (ap) + num_ssa_names))
return false;
@@ -427,7 +427,7 @@ va_list_ptr_write (struct stdarg_info *s
{
unsigned HOST_WIDE_INT increment;
- if (TREE_CODE (ap) != VAR_DECL
+ if (!VAR_P (ap)
|| !bitmap_bit_p (si->va_list_vars, DECL_UID (ap) + num_ssa_names))
return false;
@@ -622,7 +622,7 @@ check_all_va_list_escapes (struct stdarg
SSA_NAME_VERSION (lhs)))
continue;
- if (TREE_CODE (lhs) == VAR_DECL
+ if (VAR_P (lhs)
&& bitmap_bit_p (si->va_list_vars,
DECL_UID (lhs) + num_ssa_names))
continue;
@@ -731,7 +731,7 @@ optimize_va_list_gpr_fpr_size (function
}
if (TYPE_MAIN_VARIANT (TREE_TYPE (ap))
!= TYPE_MAIN_VARIANT (targetm.fn_abi_va_list (fun->decl))
- || TREE_CODE (ap) != VAR_DECL)
+ || !VAR_P (ap))
{
va_list_escapes = true;
break;
--- gcc/tree-nrv.c.jj 2016-01-04 14:55:54.065456388 +0100
+++ gcc/tree-nrv.c 2016-10-08 18:43:30.044697498 +0200
@@ -202,7 +202,7 @@ pass_nrv::execute (function *fun)
/* The returned value must be a local automatic variable of the
same type and alignment as the function's result. */
- if (TREE_CODE (found) != VAR_DECL
+ if (!VAR_P (found)
|| TREE_THIS_VOLATILE (found)
|| !auto_var_in_fn_p (found, current_function_decl)
|| TREE_ADDRESSABLE (found)
--- gcc/tsan.c.jj 2016-09-27 09:46:11.978546446 +0200
+++ gcc/tsan.c 2016-10-08 18:48:52.417654881 +0200
@@ -128,9 +128,7 @@ instrument_expr (gimple_stmt_iterator gs
return false;
}
- if (TREE_READONLY (base)
- || (TREE_CODE (base) == VAR_DECL
- && DECL_HARD_REGISTER (base)))
+ if (TREE_READONLY (base) || (VAR_P (base) && DECL_HARD_REGISTER (base)))
return false;
stmt = gsi_stmt (gsi);
--- gcc/tree-ssa-dce.c.jj 2016-06-14 12:17:18.726307274 +0200
+++ gcc/tree-ssa-dce.c 2016-10-08 18:45:44.835007202 +0200
@@ -1093,7 +1093,7 @@ remove_dead_stmt (gimple_stmt_iterator *
&& is_gimple_val (gimple_assign_rhs1 (stmt)))
{
tree lhs = gimple_assign_lhs (stmt);
- if ((TREE_CODE (lhs) == VAR_DECL || TREE_CODE (lhs) == PARM_DECL)
+ if ((VAR_P (lhs) || TREE_CODE (lhs) == PARM_DECL)
&& !DECL_IGNORED_P (lhs)
&& is_gimple_reg_type (TREE_TYPE (lhs))
&& !is_global_var (lhs)
--- gcc/vtable-verify.c.jj 2016-01-04 14:55:52.277481263 +0100
+++ gcc/vtable-verify.c 2016-10-08 18:51:01.472036514 +0200
@@ -718,7 +718,7 @@ verify_bb_vtables (basic_block bb)
vtable_map_node->is_used = true;
vtbl_var_decl = vtable_map_node->vtbl_map_decl;
- if (TREE_CODE (vtbl_decl) == VAR_DECL)
+ if (VAR_P (vtbl_decl))
vtable_name = IDENTIFIER_POINTER (DECL_NAME (vtbl_decl));
/* Call different routines if we are interested in
--- gcc/tree-dfa.c.jj 2016-05-18 23:21:27.801004894 +0200
+++ gcc/tree-dfa.c 2016-10-08 18:41:12.607420988 +0200
@@ -302,7 +302,7 @@ ssa_default_def (struct function *fn, tr
{
struct tree_decl_minimal ind;
struct tree_ssa_name in;
- gcc_assert (TREE_CODE (var) == VAR_DECL
+ gcc_assert (VAR_P (var)
|| TREE_CODE (var) == PARM_DECL
|| TREE_CODE (var) == RESULT_DECL);
in.var = (tree)&ind;
@@ -319,7 +319,7 @@ set_ssa_default_def (struct function *fn
struct tree_decl_minimal ind;
struct tree_ssa_name in;
- gcc_assert (TREE_CODE (var) == VAR_DECL
+ gcc_assert (VAR_P (var)
|| TREE_CODE (var) == PARM_DECL
|| TREE_CODE (var) == RESULT_DECL);
in.var = (tree)&ind;
@@ -612,8 +612,7 @@ get_ref_base_and_extent (tree exp, HOST_
if (DECL_P (exp))
{
- if (flag_unconstrained_commons
- && TREE_CODE (exp) == VAR_DECL && DECL_COMMON (exp))
+ if (flag_unconstrained_commons && VAR_P (exp) && DECL_COMMON (exp))
{
tree sz_tree = TYPE_SIZE (TREE_TYPE (exp));
/* If size is unknown, or we have read to the end, assume there
--- gcc/toplev.c.jj 2016-09-22 14:05:50.731879437 +0200
+++ gcc/toplev.c 2016-10-08 18:37:11.191448390 +0200
@@ -350,7 +350,7 @@ wrapup_global_declaration_1 (tree decl)
&& DECL_DEFER_OUTPUT (decl) != 0)
DECL_DEFER_OUTPUT (decl) = 0;
- if (TREE_CODE (decl) == VAR_DECL && DECL_SIZE (decl) == 0)
+ if (VAR_P (decl) && DECL_SIZE (decl) == 0)
lang_hooks.finish_incomplete_decl (decl);
}
@@ -361,7 +361,7 @@ bool
wrapup_global_declaration_2 (tree decl)
{
if (TREE_ASM_WRITTEN (decl) || DECL_EXTERNAL (decl)
- || (TREE_CODE (decl) == VAR_DECL && DECL_HAS_VALUE_EXPR_P (decl)))
+ || (VAR_P (decl) && DECL_HAS_VALUE_EXPR_P (decl)))
return false;
/* Don't write out static consts, unless we still need them.
@@ -389,7 +389,7 @@ wrapup_global_declaration_2 (tree decl)
to force a constant to be written if and only if it is
defined in a main file, as opposed to an include file. */
- if (TREE_CODE (decl) == VAR_DECL && TREE_STATIC (decl))
+ if (VAR_P (decl) && TREE_STATIC (decl))
{
varpool_node *node;
bool needed = true;
--- gcc/tree-sra.c.jj 2016-09-23 09:33:36.755328239 +0200
+++ gcc/tree-sra.c 2016-10-08 18:43:46.145495591 +0200
@@ -687,7 +687,7 @@ sra_deinitialize (void)
static bool constant_decl_p (tree decl)
{
- return TREE_CODE (decl) == VAR_DECL && DECL_IN_CONSTANT_POOL (decl);
+ return VAR_P (decl) && DECL_IN_CONSTANT_POOL (decl);
}
/* Remove DECL from candidates for SRA and write REASON to the dump file if
@@ -1965,7 +1965,7 @@ find_var_candidates (void)
FOR_EACH_LOCAL_DECL (cfun, i, var)
{
- if (TREE_CODE (var) != VAR_DECL)
+ if (!VAR_P (var))
continue;
ret |= maybe_add_sra_candidate (var);
@@ -2653,8 +2653,7 @@ analyze_all_variable_accesses (void)
{
tree var = candidate (i);
- if (TREE_CODE (var) == VAR_DECL
- && scalarizable_type_p (TREE_TYPE (var)))
+ if (VAR_P (var) && scalarizable_type_p (TREE_TYPE (var)))
{
if (tree_to_uhwi (TYPE_SIZE (TREE_TYPE (var)))
<= max_scalarization_size)
--- gcc/tree-nested.c.jj 2016-06-13 20:45:05.779096092 +0200
+++ gcc/tree-nested.c 2016-10-08 18:43:21.191808515 +0200
@@ -856,7 +856,7 @@ get_nonlocal_debug_decl (struct nesting_
DECL_SEEN_IN_BIND_EXPR_P (new_decl) = 1;
if ((TREE_CODE (decl) == PARM_DECL
|| TREE_CODE (decl) == RESULT_DECL
- || TREE_CODE (decl) == VAR_DECL)
+ || VAR_P (decl))
&& DECL_BY_REFERENCE (decl))
DECL_BY_REFERENCE (new_decl) = 1;
@@ -1076,7 +1076,7 @@ convert_nonlocal_omp_clauses (tree *pcla
case OMP_CLAUSE_IS_DEVICE_PTR:
do_decl_clause:
decl = OMP_CLAUSE_DECL (clause);
- if (TREE_CODE (decl) == VAR_DECL
+ if (VAR_P (decl)
&& (TREE_STATIC (decl) || DECL_EXTERNAL (decl)))
break;
if (decl_function_context (decl) != info->context)
@@ -1175,7 +1175,7 @@ convert_nonlocal_omp_clauses (tree *pcla
}
/* Like do_decl_clause, but don't add any suppression. */
decl = OMP_CLAUSE_DECL (clause);
- if (TREE_CODE (decl) == VAR_DECL
+ if (VAR_P (decl)
&& (TREE_STATIC (decl) || DECL_EXTERNAL (decl)))
break;
if (decl_function_context (decl) != info->context)
@@ -1308,11 +1308,11 @@ note_nonlocal_vla_type (struct nesting_i
if (domain)
{
t = TYPE_MIN_VALUE (domain);
- if (t && (TREE_CODE (t) == VAR_DECL || TREE_CODE (t) == PARM_DECL)
+ if (t && (VAR_P (t) || TREE_CODE (t) == PARM_DECL)
&& decl_function_context (t) != info->context)
get_nonlocal_debug_decl (info, t);
t = TYPE_MAX_VALUE (domain);
- if (t && (TREE_CODE (t) == VAR_DECL || TREE_CODE (t) == PARM_DECL)
+ if (t && (VAR_P (t) || TREE_CODE (t) == PARM_DECL)
&& decl_function_context (t) != info->context)
get_nonlocal_debug_decl (info, t);
}
@@ -1328,7 +1328,7 @@ note_nonlocal_block_vlas (struct nesting
tree var;
for (var = BLOCK_VARS (block); var; var = DECL_CHAIN (var))
- if (TREE_CODE (var) == VAR_DECL
+ if (VAR_P (var)
&& variably_modified_type_p (TREE_TYPE (var), NULL)
&& DECL_HAS_VALUE_EXPR_P (var)
&& decl_function_context (var) != info->context)
@@ -1492,7 +1492,7 @@ convert_nonlocal_reference_stmt (gimple_
FOR_EACH_CONSTRUCTOR_VALUE (CONSTRUCTOR_ELTS (decls), i, decl)
{
- if (TREE_CODE (decl) == VAR_DECL
+ if (VAR_P (decl)
&& (TREE_STATIC (decl) || DECL_EXTERNAL (decl)))
continue;
if (decl_function_context (decl) != info->context)
@@ -1554,7 +1554,7 @@ get_local_debug_decl (struct nesting_inf
DECL_SEEN_IN_BIND_EXPR_P (new_decl) = 1;
if ((TREE_CODE (decl) == PARM_DECL
|| TREE_CODE (decl) == RESULT_DECL
- || TREE_CODE (decl) == VAR_DECL)
+ || VAR_P (decl))
&& DECL_BY_REFERENCE (decl))
DECL_BY_REFERENCE (new_decl) = 1;
@@ -1774,7 +1774,7 @@ convert_local_omp_clauses (tree *pclause
case OMP_CLAUSE_IS_DEVICE_PTR:
do_decl_clause:
decl = OMP_CLAUSE_DECL (clause);
- if (TREE_CODE (decl) == VAR_DECL
+ if (VAR_P (decl)
&& (TREE_STATIC (decl) || DECL_EXTERNAL (decl)))
break;
if (decl_function_context (decl) == info->context
@@ -1878,7 +1878,7 @@ convert_local_omp_clauses (tree *pclause
}
/* Like do_decl_clause, but don't add any suppression. */
decl = OMP_CLAUSE_DECL (clause);
- if (TREE_CODE (decl) == VAR_DECL
+ if (VAR_P (decl)
&& (TREE_STATIC (decl) || DECL_EXTERNAL (decl)))
break;
if (decl_function_context (decl) == info->context
@@ -2144,7 +2144,7 @@ convert_local_reference_stmt (gimple_stm
FOR_EACH_CONSTRUCTOR_VALUE (CONSTRUCTOR_ELTS (decls), i, decl)
{
- if (TREE_CODE (decl) == VAR_DECL
+ if (VAR_P (decl)
&& (TREE_STATIC (decl) || DECL_EXTERNAL (decl)))
continue;
if (decl_function_context (decl) == info->context
@@ -2685,7 +2685,7 @@ nesting_copy_decl (tree decl, copy_body_
return new_decl;
}
- if (TREE_CODE (decl) == VAR_DECL
+ if (VAR_P (decl)
|| TREE_CODE (decl) == PARM_DECL
|| TREE_CODE (decl) == RESULT_DECL)
return decl;
@@ -2728,7 +2728,7 @@ remap_vla_decls (tree block, struct nest
remap_vla_decls (subblock, root);
for (var = BLOCK_VARS (block); var; var = DECL_CHAIN (var))
- if (TREE_CODE (var) == VAR_DECL && DECL_HAS_VALUE_EXPR_P (var))
+ if (VAR_P (var) && DECL_HAS_VALUE_EXPR_P (var))
{
val = DECL_VALUE_EXPR (var);
type = TREE_TYPE (var);
@@ -2752,7 +2752,7 @@ remap_vla_decls (tree block, struct nest
id.root = root;
for (; var; var = DECL_CHAIN (var))
- if (TREE_CODE (var) == VAR_DECL && DECL_HAS_VALUE_EXPR_P (var))
+ if (VAR_P (var) && DECL_HAS_VALUE_EXPR_P (var))
{
struct nesting_info *i;
tree newt, context;
--- gcc/tree-vect-data-refs.c.jj 2016-09-21 17:11:53.086478363 +0200
+++ gcc/tree-vect-data-refs.c 2016-10-08 18:48:40.147808747 +0200
@@ -5977,7 +5977,7 @@ vect_record_grouped_load_vectors (gimple
bool
vect_can_force_dr_alignment_p (const_tree decl, unsigned int alignment)
{
- if (TREE_CODE (decl) != VAR_DECL)
+ if (!VAR_P (decl))
return false;
if (decl_in_symtab_p (decl)
--- gcc/stmt.c.jj 2016-08-29 12:17:43.329329194 +0200
+++ gcc/stmt.c 2016-10-08 18:36:10.283212277 +0200
@@ -458,7 +458,7 @@ decl_overlaps_hard_reg_set_p (tree *decl
tree decl = *declp;
const HARD_REG_SET *const regs = (const HARD_REG_SET *) data;
- if (TREE_CODE (decl) == VAR_DECL)
+ if (VAR_P (decl))
{
if (DECL_HARD_REGISTER (decl)
&& REG_P (DECL_RTL (decl))
--- gcc/dbxout.c.jj 2016-09-21 08:54:15.925119356 +0200
+++ gcc/dbxout.c 2016-10-08 18:23:38.897650743 +0200
@@ -1333,7 +1333,7 @@ dbxout_early_global_decl (tree decl ATTR
static void
dbxout_late_global_decl (tree decl)
{
- if (TREE_CODE (decl) == VAR_DECL && !DECL_EXTERNAL (decl))
+ if (VAR_P (decl) && !DECL_EXTERNAL (decl))
{
int saved_tree_used = TREE_USED (decl);
TREE_USED (decl) = 1;
@@ -1511,7 +1511,7 @@ dbxout_type_fields (tree type)
&& DECL_BIT_FIELD_TYPE (tem))
? DECL_BIT_FIELD_TYPE (tem) : TREE_TYPE (tem), 0);
- if (TREE_CODE (tem) == VAR_DECL)
+ if (VAR_P (tem))
{
if (TREE_STATIC (tem) && use_gnu_debug_info_extensions)
{
@@ -2610,7 +2610,7 @@ dbxout_symbol (tree decl, int local ATTR
if (flag_debug_only_used_symbols
&& (!TREE_USED (decl)
- && (TREE_CODE (decl) != VAR_DECL || !DECL_INITIAL (decl))))
+ && (!VAR_P (decl) || !DECL_INITIAL (decl))))
DBXOUT_DECR_NESTING_AND_RETURN (0);
/* If dbxout_init has not yet run, queue this symbol for later. */
@@ -2865,7 +2865,7 @@ dbxout_symbol (tree decl, int local ATTR
/* PARM_DECLs go in their own separate chain and are output by
dbxout_reg_parms and dbxout_parms, except for those that are
disguised VAR_DECLs like Out parameters in Ada. */
- gcc_assert (TREE_CODE (decl) == VAR_DECL);
+ gcc_assert (VAR_P (decl));
/* fall through */
@@ -3272,7 +3272,7 @@ dbxout_common_check (tree decl, int *val
??? DECL_THREAD_LOCAL_P check prevents problems with improper .stabs
for thread-local symbols. Can be handled via same mechanism as used
in dwarf2out.c. */
- if (TREE_CODE (decl) != VAR_DECL
+ if (!VAR_P (decl)
|| !TREE_STATIC (decl)
|| !DECL_HAS_VALUE_EXPR_P (decl)
|| DECL_THREAD_LOCAL_P (decl)
--- gcc/expr.c.jj 2016-10-07 21:36:00.616438300 +0200
+++ gcc/expr.c 2016-10-08 18:26:17.808654596 +0200
@@ -5186,7 +5186,7 @@ expand_assignment (tree to, tree from, b
if (TREE_CODE (from) == CALL_EXPR && ! aggregate_value_p (from, from)
&& COMPLETE_TYPE_P (TREE_TYPE (from))
&& TREE_CODE (TYPE_SIZE (TREE_TYPE (from))) == INTEGER_CST
- && ! (((TREE_CODE (to) == VAR_DECL
+ && ! (((VAR_P (to)
|| TREE_CODE (to) == PARM_DECL
|| TREE_CODE (to) == RESULT_DECL)
&& REG_P (DECL_RTL (to)))
@@ -8421,7 +8421,7 @@ expand_expr_real_2 (sepops ops, rtx targ
if (TREE_CODE (treeop0) == PLUS_EXPR
&& TREE_CODE (TREE_OPERAND (treeop0, 1)) == INTEGER_CST
- && TREE_CODE (treeop1) == VAR_DECL
+ && VAR_P (treeop1)
&& (DECL_RTL (treeop1) == frame_pointer_rtx
|| DECL_RTL (treeop1) == stack_pointer_rtx
|| DECL_RTL (treeop1) == arg_pointer_rtx))
@@ -10201,8 +10201,7 @@ expand_expr_real_1 (tree exp, rtx target
&& modifier != EXPAND_MEMORY
&& TREE_READONLY (array) && ! TREE_SIDE_EFFECTS (array)
&& TREE_CODE (index) == INTEGER_CST
- && (TREE_CODE (array) == VAR_DECL
- || TREE_CODE (array) == CONST_DECL)
+ && (VAR_P (array) || TREE_CODE (array) == CONST_DECL)
&& (init = ctor_for_folding (array)) != error_mark_node)
{
if (init == NULL_TREE)
@@ -11112,8 +11111,7 @@ string_constant (tree arg, tree *ptr_off
{
array = TREE_OPERAND (TREE_OPERAND (arg, 0), 0);
offset = TREE_OPERAND (TREE_OPERAND (arg, 0), 1);
- if (TREE_CODE (array) != STRING_CST
- && TREE_CODE (array) != VAR_DECL)
+ if (TREE_CODE (array) != STRING_CST && !VAR_P (array))
return 0;
/* Check if the array has a nonzero lower bound. */
@@ -11137,8 +11135,7 @@ string_constant (tree arg, tree *ptr_off
if (TREE_CODE (array) != ADDR_EXPR)
return 0;
array = TREE_OPERAND (array, 0);
- if (TREE_CODE (array) != STRING_CST
- && TREE_CODE (array) != VAR_DECL)
+ if (TREE_CODE (array) != STRING_CST && !VAR_P (array))
return 0;
}
else
@@ -11177,8 +11174,7 @@ string_constant (tree arg, tree *ptr_off
*ptr_offset = fold_convert (sizetype, offset);
return array;
}
- else if (TREE_CODE (array) == VAR_DECL
- || TREE_CODE (array) == CONST_DECL)
+ else if (VAR_P (array) || TREE_CODE (array) == CONST_DECL)
{
int length;
tree init = ctor_for_folding (array);
--- gcc/hsa.c.jj 2016-09-27 20:12:44.803147400 +0200
+++ gcc/hsa.c 2016-10-08 18:29:57.277897752 +0200
@@ -798,7 +798,7 @@ hsa_get_declaration_name (tree decl)
tree name_tree;
if (TREE_CODE (decl) == FUNCTION_DECL
- || (TREE_CODE (decl) == VAR_DECL && is_global_var (decl)))
+ || (VAR_P (decl) && is_global_var (decl)))
name_tree = DECL_ASSEMBLER_NAME (decl);
else
name_tree = DECL_NAME (decl);
--- gcc/passes.c.jj 2016-09-23 18:57:51.589500481 +0200
+++ gcc/passes.c 2016-10-08 18:35:33.802670525 +0200
@@ -211,7 +211,7 @@ rest_of_decl_compilation (tree decl,
if ((at_end
|| !DECL_DEFER_OUTPUT (decl)
|| DECL_INITIAL (decl))
- && (TREE_CODE (decl) != VAR_DECL || !DECL_HAS_VALUE_EXPR_P (decl))
+ && (!VAR_P (decl) || !DECL_HAS_VALUE_EXPR_P (decl))
&& !DECL_EXTERNAL (decl))
{
/* When reading LTO unit, we also read varpool, so do not
@@ -250,7 +250,7 @@ rest_of_decl_compilation (tree decl,
/* Let cgraph know about the existence of variables. */
if (in_lto_p && !at_end)
;
- else if (TREE_CODE (decl) == VAR_DECL && !DECL_EXTERNAL (decl)
+ else if (VAR_P (decl) && !DECL_EXTERNAL (decl)
&& TREE_STATIC (decl))
varpool_node::get_create (decl);
@@ -311,7 +311,7 @@ rest_of_decl_compilation (tree decl,
called from varpool node removal fails to handle it
properly. */
|| (finalize
- && TREE_CODE (decl) == VAR_DECL
+ && VAR_P (decl)
&& TREE_STATIC (decl) && !DECL_EXTERNAL (decl)))
/* Avoid confusing the debug information machinery when there are
errors. */
--- gcc/tree-ssanames.c.jj 2016-05-03 14:12:19.059019269 +0200
+++ gcc/tree-ssanames.c 2016-10-08 18:46:18.544584478 +0200
@@ -260,7 +260,7 @@ make_ssa_name_fn (struct function *fn, t
tree t;
use_operand_p imm;
- gcc_assert (TREE_CODE (var) == VAR_DECL
+ gcc_assert (VAR_P (var)
|| TREE_CODE (var) == PARM_DECL
|| TREE_CODE (var) == RESULT_DECL
|| (TYPE_P (var) && is_gimple_reg_type (var)));
--- gcc/tree-streamer-out.c.jj 2016-08-06 12:11:56.528435546 +0200
+++ gcc/tree-streamer-out.c 2016-10-08 18:48:28.404956004 +0200
@@ -214,7 +214,7 @@ pack_ts_decl_common_value_fields (struct
bp_pack_value (bp, expr->decl_common.off_align, 8);
}
- if (TREE_CODE (expr) == VAR_DECL)
+ if (VAR_P (expr))
{
bp_pack_value (bp, DECL_HAS_DEBUG_EXPR_P (expr), 1);
bp_pack_value (bp, DECL_NONLOCAL_FRAME (expr), 1);
@@ -222,11 +222,10 @@ pack_ts_decl_common_value_fields (struct
if (TREE_CODE (expr) == RESULT_DECL
|| TREE_CODE (expr) == PARM_DECL
- || TREE_CODE (expr) == VAR_DECL)
+ || VAR_P (expr))
{
bp_pack_value (bp, DECL_BY_REFERENCE (expr), 1);
- if (TREE_CODE (expr) == VAR_DECL
- || TREE_CODE (expr) == PARM_DECL)
+ if (VAR_P (expr) || TREE_CODE (expr) == PARM_DECL)
bp_pack_value (bp, DECL_HAS_VALUE_EXPR_P (expr), 1);
}
}
@@ -256,7 +255,7 @@ pack_ts_decl_with_vis_value_fields (stru
bp_pack_value (bp, DECL_VISIBILITY (expr), 2);
bp_pack_value (bp, DECL_VISIBILITY_SPECIFIED (expr), 1);
- if (TREE_CODE (expr) == VAR_DECL)
+ if (VAR_P (expr))
{
bp_pack_value (bp, DECL_HARD_REGISTER (expr), 1);
/* DECL_IN_TEXT_SECTION is set during final asm output only. */
@@ -589,12 +588,11 @@ write_ts_decl_common_tree_pointers (stru
for early inlining so drop it on the floor instead of ICEing in
dwarf2out.c. */
- if ((TREE_CODE (expr) == VAR_DECL
- || TREE_CODE (expr) == PARM_DECL)
+ if ((VAR_P (expr) || TREE_CODE (expr) == PARM_DECL)
&& DECL_HAS_VALUE_EXPR_P (expr))
stream_write_tree (ob, DECL_VALUE_EXPR (expr), ref_p);
- if (TREE_CODE (expr) == VAR_DECL)
+ if (VAR_P (expr))
stream_write_tree (ob, DECL_DEBUG_EXPR (expr), ref_p);
}
--- gcc/stor-layout.c.jj 2016-09-16 22:19:42.497447205 +0200
+++ gcc/stor-layout.c 2016-10-08 18:36:18.490109274 +0200
@@ -1137,7 +1137,7 @@ place_field (record_layout_info rli, tre
really like a structure field. If it is a FUNCTION_DECL, it's a
method. In both cases, all we do is lay out the decl, and we do
it *after* the record is laid out. */
- if (TREE_CODE (field) == VAR_DECL)
+ if (VAR_P (field))
{
vec_safe_push (rli->pending_statics, field);
return;
--- gcc/symtab.c.jj 2016-05-26 10:38:02.590816513 +0200
+++ gcc/symtab.c 2016-10-08 19:03:07.605890102 +0200
@@ -273,8 +273,7 @@ symbol_table::change_decl_assembler_name
/* We can have user ASM names on things, like global register variables, that
are not in the symbol table. */
- if ((TREE_CODE (decl) == VAR_DECL
- && (TREE_STATIC (decl) || DECL_EXTERNAL (decl)))
+ if ((VAR_P (decl) && (TREE_STATIC (decl) || DECL_EXTERNAL (decl)))
|| TREE_CODE (decl) == FUNCTION_DECL)
node = symtab_node::get (decl);
if (!DECL_ASSEMBLER_NAME_SET_P (decl))
@@ -602,8 +601,7 @@ symtab_node::maybe_create_reference (tre
if (TREE_CODE (val) != ADDR_EXPR)
return NULL;
val = get_base_var (val);
- if (val && (TREE_CODE (val) == FUNCTION_DECL
- || TREE_CODE (val) == VAR_DECL))
+ if (val && VAR_OR_FUNCTION_DECL_P (val))
{
symtab_node *referred = symtab_node::get (val);
gcc_checking_assert (referred);
@@ -967,7 +965,7 @@ symtab_node::verify_base (void)
}
else if (is_a <varpool_node *> (this))
{
- if (TREE_CODE (decl) != VAR_DECL)
+ if (!VAR_P (decl))
{
error ("variable symbol is not variable");
error_found = true;
@@ -1254,7 +1252,7 @@ symtab_node::make_decl_local (void)
alias->make_decl_local ();
}
- if (TREE_CODE (decl) == VAR_DECL)
+ if (VAR_P (decl))
{
DECL_COMMON (decl) = 0;
/* ADDRESSABLE flag is not defined for public symbols. */
@@ -1303,7 +1301,7 @@ symtab_node::copy_visibility_from (symta
alias->copy_visibility_from (n);
}
- if (TREE_CODE (decl) == VAR_DECL)
+ if (VAR_P (decl))
{
DECL_COMMON (decl) = DECL_COMMON (n->decl);
/* ADDRESSABLE flag is not defined for public symbols. */
@@ -2099,7 +2097,7 @@ symtab_node::can_increase_alignment_p (v
symtab_node *target = ultimate_alias_target ();
/* For now support only variables. */
- if (TREE_CODE (decl) != VAR_DECL)
+ if (!VAR_P (decl))
return false;
/* With -fno-toplevel-reorder we may have already output the constant. */
--- gcc/dwarf2out.c.jj 2016-10-05 17:01:34.828595050 +0200
+++ gcc/dwarf2out.c 2016-10-08 19:04:18.570995193 +0200
@@ -5359,8 +5359,7 @@ add_var_loc_to_decl (tree decl, rtx loc_
struct var_loc_node *loc = NULL;
HOST_WIDE_INT bitsize = -1, bitpos = -1;
- if (TREE_CODE (decl) == VAR_DECL
- && DECL_HAS_DEBUG_EXPR_P (decl))
+ if (VAR_P (decl) && DECL_HAS_DEBUG_EXPR_P (decl))
{
tree realdecl = DECL_DEBUG_EXPR (decl);
if (handled_component_p (realdecl)
@@ -12385,7 +12384,7 @@ tls_mem_loc_descriptor (rtx mem)
base = get_base_address (MEM_EXPR (mem));
if (base == NULL
- || TREE_CODE (base) != VAR_DECL
+ || !VAR_P (base)
|| !DECL_THREAD_LOCAL_P (base))
return NULL;
@@ -14632,7 +14631,7 @@ static bool
decl_by_reference_p (tree decl)
{
return ((TREE_CODE (decl) == PARM_DECL || TREE_CODE (decl) == RESULT_DECL
- || TREE_CODE (decl) == VAR_DECL)
+ || VAR_P (decl))
&& DECL_BY_REFERENCE (decl));
}
@@ -17261,10 +17260,9 @@ reference_to_unused (tree * tp, int * wa
/* ??? The C++ FE emits debug information for using decls, so
putting gcc_unreachable here falls over. See PR31899. For now
be conservative. */
- else if (!symtab->global_info_ready
- && (TREE_CODE (*tp) == VAR_DECL || TREE_CODE (*tp) == FUNCTION_DECL))
+ else if (!symtab->global_info_ready && VAR_OR_FUNCTION_DECL_P (*tp))
return *tp;
- else if (TREE_CODE (*tp) == VAR_DECL)
+ else if (VAR_P (*tp))
{
varpool_node *node = varpool_node::get (*tp);
if (!node || !node->definition)
@@ -17472,7 +17470,7 @@ rtl_for_decl_location (tree decl)
|| (MEM_P (rtl)
&& CONSTANT_P (XEXP (rtl, 0)))
|| (REG_P (rtl)
- && TREE_CODE (decl) == VAR_DECL
+ && VAR_P (decl)
&& TREE_STATIC (decl))))
{
rtl = targetm.delegitimize_address (rtl);
@@ -17554,7 +17552,7 @@ rtl_for_decl_location (tree decl)
plus_constant (addr_mode, XEXP (rtl, 0), offset));
}
}
- else if (TREE_CODE (decl) == VAR_DECL
+ else if (VAR_P (decl)
&& rtl
&& MEM_P (rtl)
&& GET_MODE (rtl) != TYPE_MODE (TREE_TYPE (decl))
@@ -17579,7 +17577,7 @@ rtl_for_decl_location (tree decl)
/* A variable with no DECL_RTL but a DECL_INITIAL is a compile-time constant,
and will have been substituted directly into all expressions that use it.
C does not have such a concept, but C++ and other languages do. */
- if (!rtl && TREE_CODE (decl) == VAR_DECL && DECL_INITIAL (decl))
+ if (!rtl && VAR_P (decl) && DECL_INITIAL (decl))
rtl = rtl_for_decl_init (DECL_INITIAL (decl), TREE_TYPE (decl));
if (rtl)
@@ -17595,7 +17593,7 @@ rtl_for_decl_location (tree decl)
in the current CU, resolve_addr will remove the expression referencing
it. */
if (rtl == NULL_RTX
- && TREE_CODE (decl) == VAR_DECL
+ && VAR_P (decl)
&& !DECL_EXTERNAL (decl)
&& TREE_STATIC (decl)
&& DECL_NAME (decl)
@@ -17629,7 +17627,7 @@ fortran_common (tree decl, HOST_WIDE_INT
it does not have a value (the offset into the common area), or if it
is thread local (as opposed to global) then it isn't common, and shouldn't
be handled as such. */
- if (TREE_CODE (decl) != VAR_DECL
+ if (!VAR_P (decl)
|| !TREE_STATIC (decl)
|| !DECL_HAS_VALUE_EXPR_P (decl)
|| !is_fortran ())
@@ -17643,7 +17641,7 @@ fortran_common (tree decl, HOST_WIDE_INT
&unsignedp, &reversep, &volatilep);
if (cvar == NULL_TREE
- || TREE_CODE (cvar) != VAR_DECL
+ || !VAR_P (cvar)
|| DECL_ARTIFICIAL (cvar)
|| !TREE_PUBLIC (cvar))
return NULL_TREE;
@@ -17695,7 +17693,7 @@ add_location_or_const_value_attribute (d
|| get_AT (die, DW_AT_const_value))
return true;
- gcc_assert (TREE_CODE (decl) == VAR_DECL || TREE_CODE (decl) == PARM_DECL
+ gcc_assert (VAR_P (decl) || TREE_CODE (decl) == PARM_DECL
|| TREE_CODE (decl) == RESULT_DECL);
/* Try to get some constant RTL for this decl, and use that as the value of
@@ -17958,10 +17956,8 @@ tree_add_const_value_attribute_for_decl
{
if (!decl
- || (TREE_CODE (decl) != VAR_DECL
- && TREE_CODE (decl) != CONST_DECL)
- || (TREE_CODE (decl) == VAR_DECL
- && !TREE_STATIC (decl)))
+ || (!VAR_P (decl) && TREE_CODE (decl) != CONST_DECL)
+ || (VAR_P (decl) && !TREE_STATIC (decl)))
return false;
if (TREE_READONLY (decl)
@@ -18303,7 +18299,7 @@ add_scalar_info (dw_die_ref die, enum dw
&& TREE_CODE (TREE_OPERAND (value, 1)) == FIELD_DECL)
decl = TREE_OPERAND (value, 1);
- else if (TREE_CODE (value) == VAR_DECL
+ else if (VAR_P (value)
|| TREE_CODE (value) == PARM_DECL
|| TREE_CODE (value) == RESULT_DECL)
decl = value;
@@ -18839,9 +18835,9 @@ static void
add_linkage_name (dw_die_ref die, tree decl)
{
if (debug_info_level > DINFO_LEVEL_NONE
- && (TREE_CODE (decl) == FUNCTION_DECL || TREE_CODE (decl) == VAR_DECL)
+ && VAR_OR_FUNCTION_DECL_P (decl)
&& TREE_PUBLIC (decl)
- && !(TREE_CODE (decl) == VAR_DECL && DECL_REGISTER (decl))
+ && !(VAR_P (decl) && DECL_REGISTER (decl))
&& die->die_tag != DW_TAG_member)
add_linkage_name_raw (die, decl);
}
@@ -20121,7 +20117,7 @@ set_block_abstract_flags (tree stmt, vec
for (i = 0; i < BLOCK_NUM_NONLOCALIZED_VARS (stmt); i++)
{
local_decl = BLOCK_NONLOCALIZED_VAR (stmt, i);
- if ((TREE_CODE (local_decl) == VAR_DECL && !TREE_STATIC (local_decl))
+ if ((VAR_P (local_decl) && !TREE_STATIC (local_decl))
|| TREE_CODE (local_decl) == PARM_DECL)
set_decl_abstract_flags (local_decl, abstract_vec);
}
@@ -21205,7 +21201,7 @@ decl_will_get_specification_p (dw_die_re
static inline bool
local_function_static (tree decl)
{
- gcc_assert (TREE_CODE (decl) == VAR_DECL);
+ gcc_assert (VAR_P (decl));
return TREE_STATIC (decl)
&& DECL_CONTEXT (decl)
&& TREE_CODE (DECL_CONTEXT (decl)) == FUNCTION_DECL;
@@ -21456,7 +21452,7 @@ gen_variable_die (tree decl, tree origin
/* Local static vars are shared between all clones/inlines,
so emit DW_AT_location on the abstract DIE if DECL_RTL is
already set. */
- || (TREE_CODE (decl_or_origin) == VAR_DECL
+ || (VAR_P (decl_or_origin)
&& TREE_STATIC (decl_or_origin)
&& DECL_RTL_SET_P (decl_or_origin)))
/* When abstract origin already has DW_AT_location attribute, no need
@@ -23889,8 +23885,7 @@ dwarf2out_late_global_decl (tree decl)
{
/* Fill-in any location information we were unable to determine
on the first pass. */
- if (TREE_CODE (decl) == VAR_DECL
- && !POINTER_BOUNDS_P (decl))
+ if (VAR_P (decl) && !POINTER_BOUNDS_P (decl))
{
dw_die_ref die = lookup_decl_die (decl);
@@ -26649,7 +26644,7 @@ optimize_one_addr_into_implicit_ptr (dw_
if (GET_CODE (rtl) == SYMBOL_REF && SYMBOL_REF_DECL (rtl))
{
decl = SYMBOL_REF_DECL (rtl);
- if (TREE_CODE (decl) == VAR_DECL && !DECL_EXTERNAL (decl))
+ if (VAR_P (decl) && !DECL_EXTERNAL (decl))
{
ref = lookup_decl_die (decl);
if (ref && (get_AT (ref, DW_AT_location)
@@ -26811,7 +26806,7 @@ resolve_addr_in_expr (dw_loc_descr_ref l
static void
optimize_location_into_implicit_ptr (dw_die_ref die, tree decl)
{
- if (TREE_CODE (decl) != VAR_DECL
+ if (!VAR_P (decl)
|| lookup_decl_die (decl) != die
|| DECL_EXTERNAL (decl)
|| !TREE_STATIC (decl)
--- gcc/gimple-low.c.jj 2016-10-07 11:23:55.369588842 +0200
+++ gcc/gimple-low.c 2016-10-08 18:28:32.529962306 +0200
@@ -885,7 +885,7 @@ record_vars_into (tree vars, tree fn)
/* BIND_EXPRs contains also function/type/constant declarations
we don't need to care about. */
- if (TREE_CODE (var) != VAR_DECL)
+ if (!VAR_P (var))
continue;
/* Nothing to do in this case. */
--- gcc/ipa-visibility.c.jj 2016-04-04 12:28:40.377477242 +0200
+++ gcc/ipa-visibility.c 2016-10-08 18:31:45.641536551 +0200
@@ -367,8 +367,7 @@ static tree
update_vtable_references (tree *tp, int *walk_subtrees,
void *data ATTRIBUTE_UNUSED)
{
- if (TREE_CODE (*tp) == VAR_DECL
- || TREE_CODE (*tp) == FUNCTION_DECL)
+ if (VAR_OR_FUNCTION_DECL_P (*tp))
{
if (can_replace_by_local_alias_in_vtable (symtab_node::get (*tp)))
*tp = symtab_node::get (*tp)->noninterposable_alias ()->decl;
--- gcc/tree-ssa-address.c.jj 2016-08-29 12:17:37.174402132 +0200
+++ gcc/tree-ssa-address.c 2016-10-08 18:44:12.609163732 +0200
@@ -400,9 +400,8 @@ create_mem_ref_raw (tree type, tree alia
static bool
fixed_address_object_p (tree obj)
{
- return (TREE_CODE (obj) == VAR_DECL
- && (TREE_STATIC (obj)
- || DECL_EXTERNAL (obj))
+ return (VAR_P (obj)
+ && (TREE_STATIC (obj) || DECL_EXTERNAL (obj))
&& ! DECL_DLLIMPORT_P (obj));
}
@@ -893,7 +892,7 @@ copy_ref_info (tree new_ref, tree old_re
else
mark_ptr_info_alignment_unknown (new_pi);
}
- else if (TREE_CODE (base) == VAR_DECL
+ else if (VAR_P (base)
|| TREE_CODE (base) == PARM_DECL
|| TREE_CODE (base) == RESULT_DECL)
{
--- gcc/lto-streamer-out.c.jj 2016-08-12 17:33:44.097480344 +0200
+++ gcc/lto-streamer-out.c 2016-10-08 18:33:46.831014240 +0200
@@ -131,7 +131,7 @@ tree_is_indexable (tree t)
/* IMPORTED_DECL is put into BLOCK and thus it never can be shared. */
else if (TREE_CODE (t) == IMPORTED_DECL)
return false;
- else if (((TREE_CODE (t) == VAR_DECL && !TREE_STATIC (t))
+ else if (((VAR_P (t) && !TREE_STATIC (t))
|| TREE_CODE (t) == TYPE_DECL
|| TREE_CODE (t) == CONST_DECL
|| TREE_CODE (t) == NAMELIST_DECL)
@@ -357,7 +357,7 @@ get_symbol_initial_value (lto_symtab_enc
/* Handle DECL_INITIAL for symbols. */
tree initial = DECL_INITIAL (expr);
- if (TREE_CODE (expr) == VAR_DECL
+ if (VAR_P (expr)
&& (TREE_STATIC (expr) || DECL_EXTERNAL (expr))
&& !DECL_IN_CONSTANT_POOL (expr)
&& initial)
@@ -766,11 +766,11 @@ DFS::DFS_write_tree_body (struct output_
leaks to this point. */
gcc_assert (DECL_ABSTRACT_ORIGIN (expr) != error_mark_node);
- if ((TREE_CODE (expr) == VAR_DECL
+ if ((VAR_P (expr)
|| TREE_CODE (expr) == PARM_DECL)
&& DECL_HAS_VALUE_EXPR_P (expr))
DFS_follow_tree_edge (DECL_VALUE_EXPR (expr));
- if (TREE_CODE (expr) == VAR_DECL)
+ if (VAR_P (expr))
DFS_follow_tree_edge (DECL_DEBUG_EXPR (expr));
}
@@ -2509,12 +2509,10 @@ write_symbol (struct streamer_tree_cache
if (!TREE_PUBLIC (t)
|| is_builtin_fn (t)
|| DECL_ABSTRACT_P (t)
- || (TREE_CODE (t) == VAR_DECL && DECL_HARD_REGISTER (t)))
+ || (VAR_P (t) && DECL_HARD_REGISTER (t)))
return;
- gcc_assert (TREE_CODE (t) != RESULT_DECL);
- gcc_assert (TREE_CODE (t) == VAR_DECL
- || TREE_CODE (t) == FUNCTION_DECL);
+ gcc_assert (VAR_OR_FUNCTION_DECL_P (t));
name = IDENTIFIER_POINTER (DECL_ASSEMBLER_NAME (t));
@@ -2545,8 +2543,7 @@ write_symbol (struct streamer_tree_cache
kind = GCCPK_DEF;
/* When something is defined, it should have node attached. */
- gcc_assert (alias || TREE_CODE (t) != VAR_DECL
- || varpool_node::get (t)->definition);
+ gcc_assert (alias || !VAR_P (t) || varpool_node::get (t)->definition);
gcc_assert (alias || TREE_CODE (t) != FUNCTION_DECL
|| (cgraph_node::get (t)
&& cgraph_node::get (t)->definition));
--- gcc/langhooks.c.jj 2016-09-26 12:06:46.155782167 +0200
+++ gcc/langhooks.c 2016-10-08 18:31:58.101380038 +0200
@@ -128,7 +128,7 @@ lhd_warn_unused_global_decl (const_tree
if (TREE_CODE (decl) == FUNCTION_DECL && DECL_DECLARED_INLINE_P (decl))
return false;
- if (TREE_CODE (decl) == VAR_DECL && TREE_READONLY (decl))
+ if (VAR_P (decl) && TREE_READONLY (decl))
return false;
if (DECL_IN_SYSTEM_HEADER (decl))
return false;
@@ -152,7 +152,7 @@ lhd_set_decl_assembler_name (tree decl)
VAR_DECLs for variables with static storage duration need a real
DECL_ASSEMBLER_NAME. */
gcc_assert (TREE_CODE (decl) == FUNCTION_DECL
- || (TREE_CODE (decl) == VAR_DECL
+ || (VAR_P (decl)
&& (TREE_STATIC (decl)
|| DECL_EXTERNAL (decl)
|| TREE_PUBLIC (decl))));
--- gcc/attribs.c.jj 2016-04-26 08:08:16.288683137 +0200
+++ gcc/attribs.c 2016-10-08 18:20:32.302994636 +0200
@@ -553,7 +553,7 @@ decl_attributes (tree *node, tree attrib
/* Layout the decl in case anything changed. */
if (spec->type_required && DECL_P (*node)
- && (TREE_CODE (*node) == VAR_DECL
+ && (VAR_P (*node)
|| TREE_CODE (*node) == PARM_DECL
|| TREE_CODE (*node) == RESULT_DECL))
relayout_decl (*node);
--- gcc/except.c.jj 2016-08-29 12:17:37.328400307 +0200
+++ gcc/except.c 2016-10-08 18:25:44.190076893 +0200
@@ -2898,7 +2898,7 @@ output_ttype (tree type, int tt_format,
if (TREE_CODE (type) == ADDR_EXPR)
{
type = TREE_OPERAND (type, 0);
- if (TREE_CODE (type) == VAR_DECL)
+ if (VAR_P (type))
is_public = TREE_PUBLIC (type);
}
else
--- gcc/varpool.c.jj 2016-07-16 10:41:06.082632326 +0200
+++ gcc/varpool.c 2016-10-08 18:50:39.304314502 +0200
@@ -142,7 +142,7 @@ varpool_node *
varpool_node::get_create (tree decl)
{
varpool_node *node = varpool_node::get (decl);
- gcc_checking_assert (TREE_CODE (decl) == VAR_DECL);
+ gcc_checking_assert (VAR_P (decl));
if (node)
return node;
@@ -395,8 +395,7 @@ ctor_for_folding (tree decl)
varpool_node *node, *real_node;
tree real_decl;
- if (TREE_CODE (decl) != VAR_DECL
- && TREE_CODE (decl) != CONST_DECL)
+ if (!VAR_P (decl) && TREE_CODE (decl) != CONST_DECL)
return error_mark_node;
/* Static constant bounds are created to be
@@ -420,7 +419,7 @@ ctor_for_folding (tree decl)
return error_mark_node;
}
- gcc_assert (TREE_CODE (decl) == VAR_DECL);
+ gcc_assert (VAR_P (decl));
real_node = node = varpool_node::get (decl);
if (node)
@@ -579,7 +578,7 @@ varpool_node::assemble_decl (void)
return false;
gcc_checking_assert (!TREE_ASM_WRITTEN (decl)
- && TREE_CODE (decl) == VAR_DECL
+ && VAR_P (decl)
&& !DECL_HAS_VALUE_EXPR_P (decl));
if (!in_other_partition
@@ -713,7 +712,7 @@ varpool_node::finalize_named_section_fla
&& !alias
&& !in_other_partition
&& !DECL_EXTERNAL (decl)
- && TREE_CODE (decl) == VAR_DECL
+ && VAR_P (decl)
&& !DECL_HAS_VALUE_EXPR_P (decl)
&& get_section ())
get_variable_section (decl, false);
@@ -768,8 +767,8 @@ varpool_node::create_alias (tree alias,
{
varpool_node *alias_node;
- gcc_assert (TREE_CODE (decl) == VAR_DECL);
- gcc_assert (TREE_CODE (alias) == VAR_DECL);
+ gcc_assert (VAR_P (decl));
+ gcc_assert (VAR_P (alias));
alias_node = varpool_node::get_create (alias);
alias_node->alias = true;
alias_node->definition = true;
--- gcc/fold-const.c.jj 2016-10-05 17:01:34.826595076 +0200
+++ gcc/fold-const.c 2016-10-08 18:26:31.534482180 +0200
@@ -7942,7 +7942,7 @@ fold_unary_loc (location_t loc, enum tre
if (TREE_CODE (op0) == ADDR_EXPR)
{
tree op00 = TREE_OPERAND (op0, 0);
- if ((TREE_CODE (op00) == VAR_DECL
+ if ((VAR_P (op00)
|| TREE_CODE (op00) == PARM_DECL
|| TREE_CODE (op00) == RESULT_DECL)
&& !TREE_READONLY (op00))
--- gcc/ipa-prop.c.jj 2016-09-27 09:46:13.108532114 +0200
+++ gcc/ipa-prop.c 2016-10-08 18:30:55.104171372 +0200
@@ -1747,7 +1747,7 @@ ipa_compute_jump_functions_for_edge (str
gcc_assert (!jfunc->bits.known);
if (is_gimple_ip_invariant (arg)
- || (TREE_CODE (arg) == VAR_DECL
+ || (VAR_P (arg)
&& is_global_var (arg)
&& TREE_READONLY (arg)))
ipa_set_jf_constant (jfunc, arg, cs);
@@ -2879,7 +2879,7 @@ ipa_find_agg_cst_from_init (tree scalar,
scalar = TREE_OPERAND (scalar, 0);
}
- if (TREE_CODE (scalar) != VAR_DECL
+ if (!VAR_P (scalar)
|| !is_global_var (scalar)
|| !TREE_READONLY (scalar)
|| !DECL_INITIAL (scalar)
--- gcc/omp-low.c.jj 2016-09-27 09:46:09.000000000 +0200
+++ gcc/omp-low.c 2016-10-08 18:34:24.649539186 +0200
@@ -7106,7 +7106,7 @@ expand_omp_regimplify_p (tree *tp, int *
tree t = *tp;
/* Any variable with DECL_VALUE_EXPR needs to be regimplified. */
- if (TREE_CODE (t) == VAR_DECL && DECL_HAS_VALUE_EXPR_P (t))
+ if (VAR_P (t) && DECL_HAS_VALUE_EXPR_P (t))
return t;
if (TREE_CODE (t) == ADDR_EXPR)
@@ -7287,9 +7287,7 @@ expand_omp_taskreg (struct omp_region *r
rather than in containing function's local_decls chain,
which would mean cgraph missed finalizing them. Do it now. */
for (t = BLOCK_VARS (block); t; t = DECL_CHAIN (t))
- if (TREE_CODE (t) == VAR_DECL
- && TREE_STATIC (t)
- && !DECL_EXTERNAL (t))
+ if (VAR_P (t) && TREE_STATIC (t) && !DECL_EXTERNAL (t))
varpool_node::finalize_decl (t);
DECL_SAVED_TREE (child_fn) = NULL;
/* We'll create a CFG for child_fn, so no gimple body is needed. */
@@ -13129,9 +13127,7 @@ expand_omp_target (struct omp_region *re
rather than in containing function's local_decls chain,
which would mean cgraph missed finalizing them. Do it now. */
for (t = BLOCK_VARS (block); t; t = DECL_CHAIN (t))
- if (TREE_CODE (t) == VAR_DECL
- && TREE_STATIC (t)
- && !DECL_EXTERNAL (t))
+ if (VAR_P (t) && TREE_STATIC (t) && !DECL_EXTERNAL (t))
varpool_node::finalize_decl (t);
DECL_SAVED_TREE (child_fn) = NULL;
/* We'll create a CFG for child_fn, so no gimple body is needed. */
@@ -16892,7 +16888,7 @@ lower_omp_regimplify_p (tree *tp, int *w
tree t = *tp;
/* Any variable with DECL_VALUE_EXPR needs to be regimplified. */
- if (TREE_CODE (t) == VAR_DECL && data == NULL && DECL_HAS_VALUE_EXPR_P (t))
+ if (VAR_P (t) && data == NULL && DECL_HAS_VALUE_EXPR_P (t))
return t;
if (task_shared_vars
@@ -17196,7 +17192,7 @@ grid_reg_assignment_to_local_var_p (gimp
if (!assign)
return false;
tree lhs = gimple_assign_lhs (assign);
- if (TREE_CODE (lhs) != VAR_DECL
+ if (!VAR_P (lhs)
|| !is_gimple_reg_type (TREE_TYPE (lhs))
|| is_global_var (lhs))
return false;
@@ -17634,7 +17630,7 @@ grid_remap_prebody_decls (tree *tp, int
else
*walk_subtrees = 1;
- if (TREE_CODE (t) == VAR_DECL)
+ if (VAR_P (t))
{
struct walk_stmt_info *wi = (struct walk_stmt_info *) data;
hash_map<tree, tree> *declmap = (hash_map<tree, tree> *) wi->info;
@@ -18449,7 +18445,7 @@ add_decls_addresses_to_decl_constructor
for (unsigned i = 0; i < len; i++)
{
tree it = (*v_decls)[i];
- bool is_var = TREE_CODE (it) == VAR_DECL;
+ bool is_var = VAR_P (it);
bool is_link_var
= is_var
#ifdef ACCEL_COMPILER
@@ -19920,7 +19916,7 @@ find_link_var_op (tree *tp, int *walk_su
{
tree t = *tp;
- if (TREE_CODE (t) == VAR_DECL && DECL_HAS_VALUE_EXPR_P (t)
+ if (VAR_P (t) && DECL_HAS_VALUE_EXPR_P (t)
&& lookup_attribute ("omp declare target link", DECL_ATTRIBUTES (t)))
{
*walk_subtrees = 0;
--- gcc/tree-chrec.c.jj 2016-09-02 18:17:28.999630816 +0200
+++ gcc/tree-chrec.c 2016-10-08 18:40:41.523810782 +0200
@@ -942,7 +942,7 @@ chrec_contains_symbols (const_tree chrec
return false;
if (TREE_CODE (chrec) == SSA_NAME
- || TREE_CODE (chrec) == VAR_DECL
+ || VAR_P (chrec)
|| TREE_CODE (chrec) == PARM_DECL
|| TREE_CODE (chrec) == FUNCTION_DECL
|| TREE_CODE (chrec) == LABEL_DECL
--- gcc/tree-cfg.c.jj 2016-09-27 09:46:13.111532076 +0200
+++ gcc/tree-cfg.c 2016-10-08 18:39:57.634361164 +0200
@@ -2786,7 +2786,7 @@ verify_address (tree t, tree base)
return t;
}
- if (!(TREE_CODE (base) == VAR_DECL
+ if (!(VAR_P (base)
|| TREE_CODE (base) == PARM_DECL
|| TREE_CODE (base) == RESULT_DECL))
return NULL_TREE;
@@ -2902,7 +2902,7 @@ verify_expr (tree *tp, int *walk_subtree
if ((tem = verify_address (t, x)))
return tem;
- if (!(TREE_CODE (x) == VAR_DECL
+ if (!(VAR_P (x)
|| TREE_CODE (x) == PARM_DECL
|| TREE_CODE (x) == RESULT_DECL))
return NULL;
@@ -4982,15 +4982,14 @@ verify_expr_location_1 (tree *tp, int *w
{
hash_set<tree> *blocks = (hash_set<tree> *) data;
- if (TREE_CODE (*tp) == VAR_DECL
- && DECL_HAS_DEBUG_EXPR_P (*tp))
+ if (VAR_P (*tp) && DECL_HAS_DEBUG_EXPR_P (*tp))
{
tree t = DECL_DEBUG_EXPR (*tp);
tree addr = walk_tree (&t, verify_expr_no_block, NULL, NULL);
if (addr)
return addr;
}
- if ((TREE_CODE (*tp) == VAR_DECL
+ if ((VAR_P (*tp)
|| TREE_CODE (*tp) == PARM_DECL
|| TREE_CODE (*tp) == RESULT_DECL)
&& DECL_HAS_VALUE_EXPR_P (*tp))
@@ -5989,13 +5988,11 @@ gimple_duplicate_bb (basic_block bb)
{
tree base = get_base_address (lhs);
if (base
- && (TREE_CODE (base) == VAR_DECL
- || TREE_CODE (base) == RESULT_DECL)
+ && (VAR_P (base) || TREE_CODE (base) == RESULT_DECL)
&& DECL_IGNORED_P (base)
&& !TREE_STATIC (base)
&& !DECL_EXTERNAL (base)
- && (TREE_CODE (base) != VAR_DECL
- || !DECL_HAS_VALUE_EXPR_P (base)))
+ && (!VAR_P (base) || !DECL_HAS_VALUE_EXPR_P (base)))
DECL_NONSHAREABLE (base) = 1;
}
@@ -6621,8 +6618,7 @@ move_stmt_op (tree *tp, int *walk_subtre
statements, and in alias lists of other variables. It would be
quite difficult to expunge it from all those places. ??? It might
suffice to do this for addressable variables. */
- if ((TREE_CODE (t) == VAR_DECL
- && !is_global_var (t))
+ if ((VAR_P (t) && !is_global_var (t))
|| TREE_CODE (t) == CONST_DECL)
replace_by_duplicate_decl (tp, p->vars_map, p->to_context);
}
@@ -7008,12 +7004,12 @@ replace_block_vars_by_duplicates (tree b
for (tp = &BLOCK_VARS (block); *tp; tp = &DECL_CHAIN (*tp))
{
t = *tp;
- if (TREE_CODE (t) != VAR_DECL && TREE_CODE (t) != CONST_DECL)
+ if (!VAR_P (t) && TREE_CODE (t) != CONST_DECL)
continue;
replace_by_duplicate_decl (&t, vars_map, to_context);
if (t != *tp)
{
- if (TREE_CODE (*tp) == VAR_DECL && DECL_HAS_VALUE_EXPR_P (*tp))
+ if (VAR_P (*tp) && DECL_HAS_VALUE_EXPR_P (*tp))
{
tree x = DECL_VALUE_EXPR (*tp);
struct replace_decls_d rd = { vars_map, to_context };
@@ -9035,7 +9031,7 @@ execute_fixup_cfg (void)
{
tree lhs = get_base_address (gimple_get_lhs (stmt));
- if (TREE_CODE (lhs) == VAR_DECL
+ if (VAR_P (lhs)
&& (TREE_STATIC (lhs) || DECL_EXTERNAL (lhs))
&& varpool_node::get (lhs)->writeonly)
{
@@ -9053,7 +9049,7 @@ execute_fixup_cfg (void)
{
tree lhs = get_base_address (gimple_get_lhs (stmt));
- if (TREE_CODE (lhs) == VAR_DECL
+ if (VAR_P (lhs)
&& (TREE_STATIC (lhs) || DECL_EXTERNAL (lhs))
&& varpool_node::get (lhs)->writeonly)
{
Jakub
^ permalink raw reply [flat|nested] 2+ messages in thread
* Re: [PATCH] Use VAR_P and/or VAR_OR_FUNCTION_DECL_P macros
2016-10-08 19:11 [PATCH] Use VAR_P and/or VAR_OR_FUNCTION_DECL_P macros Jakub Jelinek
@ 2016-10-09 6:31 ` Richard Biener
0 siblings, 0 replies; 2+ messages in thread
From: Richard Biener @ 2016-10-09 6:31 UTC (permalink / raw)
To: Jakub Jelinek; +Cc: gcc-patches
On October 8, 2016 9:11:22 PM GMT+02:00, Jakub Jelinek <jakub@redhat.com> wrote:
>Hi!
>
>This patch changes various TREE_CODE (xyz) == VAR_DECL into VAR_P
>(xyz),
>TREE_CODE (xyz) != VAR_DECL into !VAR_P (xyz) and
>TREE_CODE (xyz) == VAR_DECL || TREE_CODE (xyz) == FUNCTION_DECL
>into VAR_OR_FUNCTION_DECL_P (xyz).
>
>Bootstrapped/regtested on x86_64-linux and i686-linux, ok for trunk?
OK.
Richard.
>2016-10-08 Jakub Jelinek <jakub@redhat.com>
>
> * tree-ssa.c (target_for_debug_bind, verify_phi_args,
> ssa_undefined_value_p, maybe_optimize_var): Use VAR_P and/or
> VAR_OR_FUNCTION_DECL_P macros.
> * tree-chkp.c (chkp_register_var_initializer, chkp_make_static_bounds,
> chkp_get_bounds_for_decl_addr, chkp_parse_array_and_component_ref,
> chkp_find_bounds_1): Likewise.
> * ipa-polymorphic-call.c (decl_maybe_in_construction_p): Likewise.
> * hsa-gen.c (get_symbol_for_decl): Likewise.
> * cgraphunit.c (check_global_declaration, analyze_functions,
> handle_alias_pairs, thunk_adjust, cgraph_node::expand_thunk):
> Likewise.
> * gimple-fold.c (can_refer_decl_in_current_unit_p,
> canonicalize_constructor_val, gimple_get_virt_method_for_vtable):
> Likewise.
> * tree.c (set_decl_section_name, copy_node_stat,
> need_assembler_name_p, free_lang_data_in_decl, find_decls_types_r,
> merge_dllimport_decl_attributes, handle_dll_attribute,
> decl_init_priority_insert, auto_var_in_fn_p, array_at_struct_end_p,
> verify_type): Likewise.
> * gimple-ssa-isolate-paths.c (find_implicit_erroneous_behavior,
> find_explicit_erroneous_behavior): Likewise.
> * sdbout.c (sdbout_toplevel_data, sdbout_late_global_decl): Likewise.
> * ipa.c (process_references): Likewise.
> * tree-chkp-opt.c (chkp_get_check_result): Likewise.
> * varasm.c (get_block_for_decl, use_blocks_for_decl_p, make_decl_rtl,
> notice_global_symbol, assemble_variable, mark_decl_referenced,
> build_constant_desc, output_constant_def_contents, do_assemble_alias,
> make_decl_one_only, default_section_type_flags,
> categorize_decl_for_section, default_encode_section_info): Likewise.
> * trans-mem.c (requires_barrier): Likewise.
> * gimple-expr.c (mark_addressable): Likewise.
> * cfgexpand.c (add_scope_conflicts_1, expand_one_var,
> expand_used_vars_for_block, clear_tree_used, stack_protect_decl_p,
> expand_debug_expr): Likewise.
> * tree-dump.c (dequeue_and_dump): Likewise.
> * ubsan.c (instrument_bool_enum_load): Likewise.
> * tree-pretty-print.c (print_declaration): Likewise.
> * simplify-rtx.c (delegitimize_mem_from_attrs): Likewise.
> * tree-ssa-uninit.c (warn_uninitialized_vars): Likewise.
> * asan.c (asan_protect_global, instrument_derefs): Likewise.
> * tree-into-ssa.c (rewrite_stmt, maybe_register_def,
> pass_build_ssa::execute): Likewise.
> * var-tracking.c (var_debug_decl, track_expr_p): Likewise.
> * tree-ssa-loop-ivopts.c (force_expr_to_var_cost, split_address_cost):
> Likewise.
> * ipa-split.c (test_nonssa_use, consider_split, mark_nonssa_use):
> Likewise.
> * tree-inline.c (insert_debug_decl_map, remap_ssa_name,
> can_be_nonlocal, remap_decls, copy_debug_stmt,
> initialize_inlined_parameters, add_local_variables,
> reset_debug_binding, replace_locals_op): Likewise.
> * dse.c (can_escape): Likewise.
> * ipa-devirt.c (compare_virtual_tables, referenced_from_vtable_p):
> Likewise.
> * tree-diagnostic.c (default_tree_printer): Likewise.
> * tree-streamer-in.c (unpack_ts_decl_common_value_fields,
> unpack_ts_decl_with_vis_value_fields,
> lto_input_ts_decl_common_tree_pointers): Likewise.
> * builtins.c (builtin_save_expr, fold_builtin_expect,
> readonly_data_expr): Likewise.
> * tree-ssa-structalias.c (new_var_info, get_constraint_for_ssa_var,
> create_variable_info_for, set_uids_in_ptset, visit_loadstore):
> Likewise.
> * gimple-streamer-out.c (output_gimple_stmt): Likewise.
> * gimplify.c (force_constant_size, gimplify_bind_expr,
> gimplify_decl_expr, gimplify_var_or_parm_decl,
> gimplify_compound_lval, gimplify_init_constructor,
> gimplify_modify_expr, gimplify_asm_expr, gimplify_oacc_declare,
> gimplify_type_sizes): Likewise.
> * cgraphbuild.c (record_reference, record_type_list, mark_address,
> mark_load, mark_store, pass_build_cgraph_edges::execute): Likewise.
> * tree-ssa-live.c (mark_all_vars_used_1, remove_unused_scope_block_p,
> remove_unused_locals): Likewise.
> * tree-ssa-alias.c (ptr_deref_may_alias_decl_p, ptrs_compare_unequal,
> ref_maybe_used_by_call_p_1, call_may_clobber_ref_p_1): Likewise.
> * function.c (instantiate_expr, instantiate_decls_1,
> setjmp_vars_warning, add_local_decl): Likewise.
> * alias.c (ao_ref_from_mem, get_alias_set, compare_base_symbol_refs):
> Likewise.
> * tree-stdarg.c (find_va_list_reference, va_list_counter_struct_op,
> va_list_ptr_read, va_list_ptr_write, check_all_va_list_escapes,
> optimize_va_list_gpr_fpr_size): Likewise.
> * tree-nrv.c (pass_nrv::execute): Likewise.
> * tsan.c (instrument_expr): Likewise.
> * tree-ssa-dce.c (remove_dead_stmt): Likewise.
> * vtable-verify.c (verify_bb_vtables): Likewise.
> * tree-dfa.c (ssa_default_def, set_ssa_default_def,
> get_ref_base_and_extent): Likewise.
> * toplev.c (wrapup_global_declaration_1, wrapup_global_declaration_2):
> Likewise.
> * tree-sra.c (static bool constant_decl_p, find_var_candidates,
> analyze_all_variable_accesses): Likewise.
> * tree-nested.c (get_nonlocal_debug_decl,
> convert_nonlocal_omp_clauses, note_nonlocal_vla_type,
> note_nonlocal_block_vlas, convert_nonlocal_reference_stmt,
> get_local_debug_decl, convert_local_omp_clauses,
> convert_local_reference_stmt, nesting_copy_decl, remap_vla_decls):
> Likewise.
> * tree-vect-data-refs.c (vect_can_force_dr_alignment_p): Likewise.
> * stmt.c (decl_overlaps_hard_reg_set_p): Likewise.
> * dbxout.c (dbxout_late_global_decl, dbxout_type_fields,
> dbxout_symbol, dbxout_common_check): Likewise.
> * expr.c (expand_assignment, expand_expr_real_2, expand_expr_real_1,
> string_constant): Likewise.
> * hsa.c (hsa_get_declaration_name): Likewise.
> * passes.c (rest_of_decl_compilation): Likewise.
> * tree-ssanames.c (make_ssa_name_fn): Likewise.
> * tree-streamer-out.c (pack_ts_decl_common_value_fields,
> pack_ts_decl_with_vis_value_fields,
> write_ts_decl_common_tree_pointers): Likewise.
> * stor-layout.c (place_field): Likewise.
> * symtab.c (symtab_node::maybe_create_reference,
> symtab_node::verify_base, symtab_node::make_decl_local,
> symtab_node::copy_visibility_from,
> symtab_node::can_increase_alignment_p): Likewise.
> * dwarf2out.c (add_var_loc_to_decl, tls_mem_loc_descriptor,
> decl_by_reference_p, reference_to_unused, rtl_for_decl_location,
> fortran_common, add_location_or_const_value_attribute,
> add_scalar_info, add_linkage_name, set_block_abstract_flags,
> local_function_static, gen_variable_die, dwarf2out_late_global_decl,
> optimize_one_addr_into_implicit_ptr,
> optimize_location_into_implicit_ptr): Likewise.
> * gimple-low.c (record_vars_into): Likewise.
> * ipa-visibility.c (update_vtable_references): Likewise.
> * tree-ssa-address.c (fixed_address_object_p, copy_ref_info):
> Likewise.
> * lto-streamer-out.c (tree_is_indexable, get_symbol_initial_value,
> DFS::DFS_write_tree_body, write_symbol): Likewise.
> * langhooks.c (lhd_warn_unused_global_decl,
> lhd_set_decl_assembler_name): Likewise.
> * attribs.c (decl_attributes): Likewise.
> * except.c (output_ttype): Likewise.
> * varpool.c (varpool_node::get_create, ctor_for_folding,
> varpool_node::assemble_decl, varpool_node::create_alias): Likewise.
> * fold-const.c (fold_unary_loc): Likewise.
> * ipa-prop.c (ipa_compute_jump_functions_for_edge,
> ipa_find_agg_cst_from_init): Likewise.
> * omp-low.c (expand_omp_regimplify_p, expand_omp_taskreg,
> expand_omp_target, lower_omp_regimplify_p,
> grid_reg_assignment_to_local_var_p, grid_remap_prebody_decls,
> find_link_var_op): Likewise.
> * tree-chrec.c (chrec_contains_symbols): Likewise.
> * tree-cfg.c (verify_address, verify_expr, verify_expr_location_1,
> gimple_duplicate_bb, move_stmt_op, replace_block_vars_by_duplicates,
> execute_fixup_cfg): Likewise.
>
>--- gcc/tree-ssa.c.jj 2016-10-07 21:36:01.775423576 +0200
>+++ gcc/tree-ssa.c 2016-10-08 18:45:22.732284375 +0200
>@@ -246,8 +246,7 @@ target_for_debug_bind (tree var)
> return NULL_TREE;
> }
>
>- if ((TREE_CODE (var) != VAR_DECL
>- || VAR_DECL_IS_VIRTUAL_OPERAND (var))
>+ if ((!VAR_P (var) || VAR_DECL_IS_VIRTUAL_OPERAND (var))
> && TREE_CODE (var) != PARM_DECL)
> return NULL_TREE;
>
>@@ -974,7 +973,7 @@ verify_phi_args (gphi *phi, basic_block
> tree base = TREE_OPERAND (op, 0);
> while (handled_component_p (base))
> base = TREE_OPERAND (base, 0);
>- if ((TREE_CODE (base) == VAR_DECL
>+ if ((VAR_P (base)
> || TREE_CODE (base) == PARM_DECL
> || TREE_CODE (base) == RESULT_DECL)
> && !TREE_ADDRESSABLE (base))
>@@ -1246,7 +1245,7 @@ ssa_undefined_value_p (tree t, bool part
> else if (TREE_CODE (var) == RESULT_DECL && DECL_BY_REFERENCE (var))
> return false;
> /* Hard register variables get their initial value from the ether. */
>- else if (TREE_CODE (var) == VAR_DECL && DECL_HARD_REGISTER (var))
>+ else if (VAR_P (var) && DECL_HARD_REGISTER (var))
> return false;
>
> /* The value is undefined iff its definition statement is empty. */
>@@ -1538,7 +1537,7 @@ maybe_optimize_var (tree var, bitmap add
> && (TREE_CODE (TREE_TYPE (var)) == COMPLEX_TYPE
> || TREE_CODE (TREE_TYPE (var)) == VECTOR_TYPE)
> && !TREE_THIS_VOLATILE (var)
>- && (TREE_CODE (var) != VAR_DECL || !DECL_HARD_REGISTER (var)))
>+ && (!VAR_P (var) || !DECL_HARD_REGISTER (var)))
> {
> DECL_GIMPLE_REG_P (var) = 1;
> bitmap_set_bit (suitable_for_renaming, DECL_UID (var));
>--- gcc/tree-chkp.c.jj 2016-08-06 12:11:47.074554628 +0200
>+++ gcc/tree-chkp.c 2016-10-08 18:40:28.256977151 +0200
>@@ -1002,7 +1002,7 @@ chkp_register_var_initializer (tree var)
> || DECL_INITIAL (var) == error_mark_node)
> return false;
>
>- gcc_assert (TREE_CODE (var) == VAR_DECL);
>+ gcc_assert (VAR_P (var));
> gcc_assert (DECL_INITIAL (var));
>
> if (TREE_STATIC (var)
>@@ -2936,7 +2936,7 @@ chkp_make_static_bounds (tree obj)
> chkp_static_var_bounds map. It allows to
> avoid duplicating bound vars for decls
> sharing assembler name. */
>- if (TREE_CODE (obj) == VAR_DECL)
>+ if (VAR_P (obj))
> {
> tree name = DECL_ASSEMBLER_NAME (obj);
> slot = chkp_static_var_bounds->get (name);
>@@ -2952,7 +2952,7 @@ chkp_make_static_bounds (tree obj)
> }
>
> /* Build decl for bounds var. */
>- if (TREE_CODE (obj) == VAR_DECL)
>+ if (VAR_P (obj))
> {
> if (DECL_IGNORED_P (obj))
> {
>@@ -3014,7 +3014,7 @@ chkp_make_static_bounds (tree obj)
> if (!chkp_static_var_bounds)
> chkp_static_var_bounds = new hash_map<tree, tree>;
>
>- if (TREE_CODE (obj) == VAR_DECL)
>+ if (VAR_P (obj))
> {
> tree name = DECL_ASSEMBLER_NAME (obj);
> chkp_static_var_bounds->put (name, bnd_var);
>@@ -3117,7 +3117,7 @@ chkp_get_bounds_for_decl_addr (tree decl
> {
> tree bounds;
>
>- gcc_assert (TREE_CODE (decl) == VAR_DECL
>+ gcc_assert (VAR_P (decl)
> || TREE_CODE (decl) == PARM_DECL
> || TREE_CODE (decl) == RESULT_DECL);
>
>@@ -3144,7 +3144,7 @@ chkp_get_bounds_for_decl_addr (tree decl
> return chkp_get_zero_bounds ();
>
> if (flag_chkp_use_static_bounds
>- && TREE_CODE (decl) == VAR_DECL
>+ && VAR_P (decl)
> && (TREE_STATIC (decl)
> || DECL_EXTERNAL (decl)
> || TREE_PUBLIC (decl))
>@@ -3164,7 +3164,7 @@ chkp_get_bounds_for_decl_addr (tree decl
> || DECL_EXTERNAL (decl)
> || TREE_PUBLIC (decl))))
> {
>- gcc_assert (TREE_CODE (decl) == VAR_DECL);
>+ gcc_assert (VAR_P (decl));
> bounds = chkp_generate_extern_var_bounds (decl);
> }
> else
>@@ -3399,7 +3399,7 @@ chkp_parse_array_and_component_ref (tree
> }
> else
> {
>- gcc_assert (TREE_CODE (var) == VAR_DECL
>+ gcc_assert (VAR_P (var)
> || TREE_CODE (var) == PARM_DECL
> || TREE_CODE (var) == RESULT_DECL
> || TREE_CODE (var) == STRING_CST
>@@ -3562,7 +3562,7 @@ chkp_find_bounds_1 (tree ptr, tree ptr_s
> case MEM_REF:
> case VAR_DECL:
> if (BOUNDED_P (ptr_src))
>- if (TREE_CODE (ptr) == VAR_DECL && DECL_REGISTER (ptr))
>+ if (VAR_P (ptr) && DECL_REGISTER (ptr))
> bounds = chkp_get_zero_bounds ();
> else
> {
>@@ -3581,7 +3581,7 @@ chkp_find_bounds_1 (tree ptr, tree ptr_s
> || TREE_CODE (addr) == TARGET_MEM_REF)
> {
> if (BOUNDED_P (ptr_src))
>- if (TREE_CODE (ptr) == VAR_DECL && DECL_REGISTER (ptr))
>+ if (VAR_P (ptr) && DECL_REGISTER (ptr))
> bounds = chkp_get_zero_bounds ();
> else
> {
>--- gcc/ipa-polymorphic-call.c.jj 2016-08-10 00:21:07.097351508 +0200
>+++ gcc/ipa-polymorphic-call.c 2016-10-08 18:30:45.042297763 +0200
>@@ -575,7 +575,7 @@ decl_maybe_in_construction_p (tree base,
> return true;
> }
>
>- if (!base || (TREE_CODE (base) == VAR_DECL && is_global_var (base)))
>+ if (!base || (VAR_P (base) && is_global_var (base)))
> {
> if (TREE_CODE (TREE_TYPE (function)) != METHOD_TYPE
> || (!DECL_CXX_CONSTRUCTOR_P (function)
>--- gcc/hsa-gen.c.jj 2016-09-23 09:33:36.752328278 +0200
>+++ gcc/hsa-gen.c 2016-10-08 18:30:13.720691207 +0200
>@@ -883,12 +883,11 @@ get_symbol_for_decl (tree decl)
>
> gcc_assert (TREE_CODE (decl) == PARM_DECL
> || TREE_CODE (decl) == RESULT_DECL
>- || TREE_CODE (decl) == VAR_DECL);
>+ || VAR_P (decl));
>
> dummy.m_decl = decl;
>
>- bool is_in_global_vars
>- = TREE_CODE (decl) == VAR_DECL && is_global_var (decl);
>+ bool is_in_global_vars = VAR_P (decl) && is_global_var (decl);
>
> if (is_in_global_vars)
> slot = hsa_global_variable_symbols->find_slot (&dummy, INSERT);
>@@ -925,7 +924,7 @@ get_symbol_for_decl (tree decl)
> else
> {
> hsa_symbol *sym;
>- gcc_assert (TREE_CODE (decl) == VAR_DECL);
>+ gcc_assert (VAR_P (decl));
> BrigAlignment8_t align = hsa_object_alignment (decl);
>
> if (is_in_global_vars)
>@@ -952,7 +951,7 @@ get_symbol_for_decl (tree decl)
> align = MAX ((BrigAlignment8_t) BRIG_ALIGNMENT_8, align);
>
> /* PARM_DECL and RESULT_DECL should be already in m_local_symbols.
>*/
>- gcc_assert (TREE_CODE (decl) == VAR_DECL);
>+ gcc_assert (VAR_P (decl));
>
> sym = new hsa_symbol (BRIG_TYPE_NONE, BRIG_SEGMENT_PRIVATE,
> BRIG_LINKAGE_FUNCTION);
>--- gcc/cgraphunit.c.jj 2016-09-26 12:06:38.606878025 +0200
>+++ gcc/cgraphunit.c 2016-10-08 18:23:20.765878503 +0200
>@@ -662,7 +662,7 @@ symbol_table::process_same_body_aliases
> FOR_EACH_SYMBOL (node)
> if (node->cpp_implicit_alias && !node->analyzed)
> node->resolve_alias
>- (TREE_CODE (node->alias_target) == VAR_DECL
>+ (VAR_P (node->alias_target)
> ? (symtab_node *)varpool_node::get_create (node->alias_target)
> : (symtab_node *)cgraph_node::get_create (node->alias_target));
> cpp_implicit_aliases_done = true;
>@@ -950,7 +950,7 @@ check_global_declaration (symtab_node *s
> && (decl_file = DECL_SOURCE_FILE (decl)) != NULL
> && filename_cmp (main_input_filename,
> decl_file) == 0))))
>- && TREE_CODE (decl) == VAR_DECL))
>+ && VAR_P (decl)))
> && ! DECL_IN_SYSTEM_HEADER (decl)
> && ! snode->referred_to_p (/*include_self=*/false)
> /* This TREE_USED check is needed in addition to referred_to_p
>@@ -967,7 +967,7 @@ check_global_declaration (symtab_node *s
> /* A volatile variable might be used in some non-obvious way. */
> && (! VAR_P (decl) || ! TREE_THIS_VOLATILE (decl))
> /* Global register variables must be declared to reserve them. */
>- && ! (TREE_CODE (decl) == VAR_DECL && DECL_REGISTER (decl))
>+ && ! (VAR_P (decl) && DECL_REGISTER (decl))
> /* Global ctors and dtors are called by the runtime. */
> && (TREE_CODE (decl) != FUNCTION_DECL
> || (!DECL_STATIC_CONSTRUCTOR (decl)
>@@ -1194,7 +1194,7 @@ analyze_functions (bool first_time)
> at looking at optimized away DECLs, since
> late_global_decl will subsequently be called from the
> contents of the now pruned symbol table. */
>- if (TREE_CODE (node->decl) == VAR_DECL
>+ if (VAR_P (node->decl)
> && !decl_function_context (node->decl))
> {
> /* We are reclaiming totally unreachable code and variables
>@@ -1305,7 +1305,7 @@ handle_alias_pairs (void)
> cgraph_node::create_alias (p->decl, target_node->decl);
> alias_pairs->unordered_remove (i);
> }
>- else if (TREE_CODE (p->decl) == VAR_DECL
>+ else if (VAR_P (p->decl)
> && target_node && is_a <varpool_node *> (target_node))
> {
> varpool_node::create_alias (p->decl, target_node->decl);
>@@ -1559,7 +1559,7 @@ thunk_adjust (gimple_stmt_iterator * bsi
> {
> tree ptrtmp;
>
>- if (TREE_CODE (ptr) == VAR_DECL)
>+ if (VAR_P (ptr))
> ptrtmp = ptr;
> else
> {
>@@ -1738,7 +1738,7 @@ cgraph_node::expand_thunk (bool output_a
> {
> restmp = resdecl;
>
>- if (TREE_CODE (restmp) == VAR_DECL)
>+ if (VAR_P (restmp))
> add_local_decl (cfun, restmp);
> BLOCK_VARS (DECL_INITIAL (current_function_decl)) = restmp;
> }
>--- gcc/gimple-fold.c.jj 2016-10-05 17:01:34.831595012 +0200
>+++ gcc/gimple-fold.c 2016-10-08 18:28:22.955082580 +0200
>@@ -105,7 +105,7 @@ can_refer_decl_in_current_unit_p (tree d
>
> /* We are concerned only about static/external vars and functions. */
> if ((!TREE_STATIC (decl) && !DECL_EXTERNAL (decl))
>- || (TREE_CODE (decl) != VAR_DECL && TREE_CODE (decl) !=
>FUNCTION_DECL))
>+ || !VAR_OR_FUNCTION_DECL_P (decl))
> return true;
>
>/* Static objects can be referred only if they was not optimized out
>yet. */
>@@ -126,7 +126,7 @@ can_refer_decl_in_current_unit_p (tree d
> So we are concerned only when DECL comes from initializer of
> external var or var that has been optimized out. */
> if (!from_decl
>- || TREE_CODE (from_decl) != VAR_DECL
>+ || !VAR_P (from_decl)
> || (!DECL_EXTERNAL (from_decl)
> && (vnode = varpool_node::get (from_decl)) != NULL
> && vnode->definition)
>@@ -206,13 +206,12 @@ canonicalize_constructor_val (tree cval,
> if (!base)
> return NULL_TREE;
>
>- if ((TREE_CODE (base) == VAR_DECL
>- || TREE_CODE (base) == FUNCTION_DECL)
>+ if (VAR_OR_FUNCTION_DECL_P (base)
> && !can_refer_decl_in_current_unit_p (base, from_decl))
> return NULL_TREE;
> if (TREE_TYPE (base) == error_mark_node)
> return NULL_TREE;
>- if (TREE_CODE (base) == VAR_DECL)
>+ if (VAR_P (base))
> TREE_ADDRESSABLE (base) = 1;
> else if (TREE_CODE (base) == FUNCTION_DECL)
> {
>@@ -6057,8 +6056,7 @@ gimple_get_virt_method_for_vtable (HOST_
> *can_refer = true;
>
> /* First of all double check we have virtual table. */
>- if (TREE_CODE (v) != VAR_DECL
>- || !DECL_VIRTUAL_P (v))
>+ if (!VAR_P (v) || !DECL_VIRTUAL_P (v))
> {
> /* Pass down that we lost track of the target. */
> if (can_refer)
>--- gcc/tree.c.jj 2016-08-29 12:17:13.369684226 +0200
>+++ gcc/tree.c 2016-10-08 18:39:26.322753817 +0200
>@@ -716,7 +716,7 @@ set_decl_section_name (tree node, const
> if (!snode)
> return;
> }
>- else if (TREE_CODE (node) == VAR_DECL)
>+ else if (VAR_P (node))
> snode = varpool_node::get_create (node);
> else
> snode = cgraph_node::get_create (node);
>@@ -1156,19 +1156,19 @@ copy_node_stat (tree node MEM_STAT_DECL)
> if (DECL_PT_UID_SET_P (node))
> SET_DECL_PT_UID (t, DECL_PT_UID (node));
> }
>- if ((TREE_CODE (node) == PARM_DECL || TREE_CODE (node) ==
>VAR_DECL)
>+ if ((TREE_CODE (node) == PARM_DECL || VAR_P (node))
> && DECL_HAS_VALUE_EXPR_P (node))
> {
> SET_DECL_VALUE_EXPR (t, DECL_VALUE_EXPR (node));
> DECL_HAS_VALUE_EXPR_P (t) = 1;
> }
> /* DECL_DEBUG_EXPR is copied explicitely by callers. */
>- if (TREE_CODE (node) == VAR_DECL)
>+ if (VAR_P (node))
> {
> DECL_HAS_DEBUG_EXPR_P (t) = 0;
> t->decl_with_vis.symtab_node = NULL;
> }
>- if (TREE_CODE (node) == VAR_DECL && DECL_HAS_INIT_PRIORITY_P
>(node))
>+ if (VAR_P (node) && DECL_HAS_INIT_PRIORITY_P (node))
> {
> SET_DECL_INIT_PRIORITY (t, DECL_INIT_PRIORITY (node));
> DECL_HAS_INIT_PRIORITY_P (t) = 1;
>@@ -5330,8 +5330,7 @@ need_assembler_name_p (tree decl)
> && !variably_modified_type_p (TREE_TYPE (decl), NULL_TREE))
> return !DECL_ASSEMBLER_NAME_SET_P (decl);
> /* Only FUNCTION_DECLs and VAR_DECLs are considered. */
>- if (TREE_CODE (decl) != FUNCTION_DECL
>- && TREE_CODE (decl) != VAR_DECL)
>+ if (!VAR_OR_FUNCTION_DECL_P (decl))
> return false;
>
> /* If DECL already has its assembler name set, it does not need a
>@@ -5346,7 +5345,7 @@ need_assembler_name_p (tree decl)
>
> /* For VAR_DECLs, only static, public and external symbols need an
> assembler name. */
>- if (TREE_CODE (decl) == VAR_DECL
>+ if (VAR_P (decl)
> && !TREE_STATIC (decl)
> && !TREE_PUBLIC (decl)
> && !DECL_EXTERNAL (decl))
>@@ -5460,7 +5459,7 @@ free_lang_data_in_decl (tree decl)
> if (DECL_VINDEX (decl) && !tree_fits_shwi_p (DECL_VINDEX (decl)))
> DECL_VINDEX (decl) = NULL_TREE;
> }
>- else if (TREE_CODE (decl) == VAR_DECL)
>+ else if (VAR_P (decl))
> {
> if ((DECL_EXTERNAL (decl)
> && (!TREE_STATIC (decl) || !TREE_READONLY (decl)))
>@@ -5632,7 +5631,7 @@ find_decls_types_r (tree *tp, int *ws, v
> fld_worklist_push (DECL_FCONTEXT (t), fld);
> }
>
>- if ((TREE_CODE (t) == VAR_DECL || TREE_CODE (t) == PARM_DECL)
>+ if ((VAR_P (t) || TREE_CODE (t) == PARM_DECL)
> && DECL_HAS_VALUE_EXPR_P (t))
> fld_worklist_push (DECL_VALUE_EXPR (t), fld);
>
>@@ -6329,14 +6328,13 @@ merge_dllimport_decl_attributes (tree ol
> decl may already have had TREE_CONSTANT computed.
> We still remove the attribute so that assembler code refers
> to '&foo rather than '_imp__foo'. */
>- if (TREE_CODE (old) == VAR_DECL && TREE_ADDRESSABLE (old))
>+ if (VAR_P (old) && TREE_ADDRESSABLE (old))
> DECL_DLLIMPORT_P (new_tree) = 1;
> }
>
> /* Let an inline definition silently override the external reference,
> but otherwise warn about attribute inconsistency. */
>- else if (TREE_CODE (new_tree) == VAR_DECL
>- || !DECL_DECLARED_INLINE_P (new_tree))
>+ else if (VAR_P (new_tree) || !DECL_DECLARED_INLINE_P (new_tree))
> warning (OPT_Wattributes, "%q+D redeclared without dllimport
>attribute: "
> "previous dllimport ignored", new_tree);
> }
>@@ -6387,9 +6385,7 @@ handle_dll_attribute (tree * pnode, tree
> }
> }
>
>- if (TREE_CODE (node) != FUNCTION_DECL
>- && TREE_CODE (node) != VAR_DECL
>- && TREE_CODE (node) != TYPE_DECL)
>+ if (!VAR_OR_FUNCTION_DECL_P (node) && TREE_CODE (node) != TYPE_DECL)
> {
> *no_add_attrs = true;
> warning (OPT_Wattributes, "%qE attribute ignored",
>@@ -6432,7 +6428,7 @@ handle_dll_attribute (tree * pnode, tree
> *no_add_attrs = true;
> }
>
>- else if (TREE_CODE (node) == VAR_DECL)
>+ else if (VAR_P (node))
> {
> if (DECL_INITIAL (node))
> {
>@@ -6460,9 +6456,7 @@ handle_dll_attribute (tree * pnode, tree
> DECL_EXTERNAL (node) = 0;
>
> /* Report error if symbol is not accessible at global scope. */
>- if (!TREE_PUBLIC (node)
>- && (TREE_CODE (node) == VAR_DECL
>- || TREE_CODE (node) == FUNCTION_DECL))
>+ if (!TREE_PUBLIC (node) && VAR_OR_FUNCTION_DECL_P (node))
> {
> error ("external linkage required for symbol %q+D because of "
> "%qE attribute", node, name);
>@@ -6822,7 +6816,7 @@ decl_init_priority_insert (tree decl, pr
> if (!snode)
> return;
> }
>- else if (TREE_CODE (decl) == VAR_DECL)
>+ else if (VAR_P (decl))
> snode = varpool_node::get_create (decl);
> else
> snode = cgraph_node::get_create (decl);
>@@ -9196,7 +9190,7 @@ bool
> auto_var_in_fn_p (const_tree var, const_tree fn)
> {
> return (DECL_P (var) && DECL_CONTEXT (var) == fn
>- && ((((TREE_CODE (var) == VAR_DECL && ! DECL_EXTERNAL (var))
>+ && ((((VAR_P (var) && ! DECL_EXTERNAL (var))
> || TREE_CODE (var) == PARM_DECL)
> && ! TREE_STATIC (var))
> || TREE_CODE (var) == LABEL_DECL
>@@ -13139,7 +13133,7 @@ array_at_struct_end_p (tree ref)
> && (!size || (DECL_SIZE (ref) != NULL
> && operand_equal_p (DECL_SIZE (ref), size, 0)))
> && !(flag_unconstrained_commons
>- && TREE_CODE (ref) == VAR_DECL && DECL_COMMON (ref)))
>+ && VAR_P (ref) && DECL_COMMON (ref)))
> return false;
>
> return true;
>@@ -13971,7 +13965,7 @@ verify_type (const_tree t)
> ;
> else if (TREE_CODE (fld) == CONST_DECL)
> ;
>- else if (TREE_CODE (fld) == VAR_DECL)
>+ else if (VAR_P (fld))
> ;
> else if (TREE_CODE (fld) == TEMPLATE_DECL)
> ;
>--- gcc/gimple-ssa-isolate-paths.c.jj 2016-02-12 00:50:55.792885920
>+0100
>+++ gcc/gimple-ssa-isolate-paths.c 2016-10-08 18:28:49.427750046 +0200
>@@ -268,8 +268,7 @@ find_implicit_erroneous_behavior (void)
> if (TREE_CODE (op) == ADDR_EXPR)
> {
> tree valbase = get_base_address (TREE_OPERAND (op, 0));
>- if ((TREE_CODE (valbase) == VAR_DECL
>- && !is_global_var (valbase))
>+ if ((VAR_P (valbase) && !is_global_var (valbase))
> || TREE_CODE (valbase) == PARM_DECL)
> {
> FOR_EACH_IMM_USE_STMT (use_stmt, iter, lhs)
>@@ -426,8 +425,7 @@ find_explicit_erroneous_behavior (void)
> if (val && TREE_CODE (val) == ADDR_EXPR)
> {
> tree valbase = get_base_address (TREE_OPERAND (val, 0));
>- if ((TREE_CODE (valbase) == VAR_DECL
>- && !is_global_var (valbase))
>+ if ((VAR_P (valbase) && !is_global_var (valbase))
> || TREE_CODE (valbase) == PARM_DECL)
> {
> /* We only need it for this particular case. */
>--- gcc/sdbout.c.jj 2016-09-20 10:26:02.718767879 +0200
>+++ gcc/sdbout.c 2016-10-08 18:35:47.586497380 +0200
>@@ -906,7 +906,7 @@ sdbout_toplevel_data (tree decl)
> if (DECL_IGNORED_P (decl))
> return;
>
>- gcc_assert (TREE_CODE (decl) == VAR_DECL);
>+ gcc_assert (VAR_P (decl));
> gcc_assert (MEM_P (DECL_RTL (decl)));
> gcc_assert (DECL_INITIAL (decl));
>
>@@ -1434,9 +1434,7 @@ sdbout_early_global_decl (tree decl ATTR
> static void
> sdbout_late_global_decl (tree decl)
> {
>- if (TREE_CODE (decl) == VAR_DECL
>- && !DECL_EXTERNAL (decl)
>- && DECL_RTL_SET_P (decl))
>+ if (VAR_P (decl) && !DECL_EXTERNAL (decl) && DECL_RTL_SET_P (decl))
> {
> /* The COFF linker can move initialized global vars to the end.
> And that can screw up the symbol ordering. Defer those for
>--- gcc/ipa.c.jj 2016-09-21 08:54:17.084104510 +0200
>+++ gcc/ipa.c 2016-10-08 18:30:27.114522962 +0200
>@@ -128,7 +128,7 @@ process_references (symtab_node *snode,
> /* We use variable constructors during late compilation for
> constant folding. Keep references alive so partitioning
> knows about potential references. */
>- || (TREE_CODE (node->decl) == VAR_DECL
>+ || (VAR_P (node->decl)
> && flag_wpa
> && ctor_for_folding (node->decl)
> != error_mark_node))))
>--- gcc/tree-chkp-opt.c.jj 2016-09-23 18:57:51.590500469 +0200
>+++ gcc/tree-chkp-opt.c 2016-10-08 18:40:34.235902174 +0200
>@@ -610,7 +610,7 @@ chkp_get_check_result (struct check_info
> chkp_collect_value (DECL_INITIAL (bnd_var), bound_val);
> if (ci->type == CHECK_UPPER_BOUND)
> {
>- if (TREE_CODE (var) == VAR_DECL)
>+ if (VAR_P (var))
> {
> if (DECL_SIZE (var)
> && !chkp_variable_size_type (TREE_TYPE (var)))
>--- gcc/varasm.c.jj 2016-09-28 21:17:52.386301063 +0200
>+++ gcc/varasm.c 2016-10-08 18:50:24.605498828 +0200
>@@ -170,8 +170,7 @@ static GTY(()) section *unnamed_sections
>
> /* Return a nonzero value if DECL has a section attribute. */
> #define IN_NAMED_SECTION(DECL) \
>- ((TREE_CODE (DECL) == FUNCTION_DECL || TREE_CODE (DECL) == VAR_DECL)
>\
>- && DECL_SECTION_NAME (DECL) != NULL)
>+ (VAR_OR_FUNCTION_DECL_P (DECL) && DECL_SECTION_NAME (DECL) != NULL)
>
> struct section_hasher : ggc_ptr_hash<section>
> {
>@@ -1188,7 +1187,7 @@ get_block_for_decl (tree decl)
> {
> section *sect;
>
>- if (TREE_CODE (decl) == VAR_DECL)
>+ if (VAR_P (decl))
> {
> /* The object must be defined in this translation unit. */
> if (DECL_EXTERNAL (decl))
>@@ -1209,7 +1208,7 @@ get_block_for_decl (tree decl)
>
> /* Find out which section should contain DECL. We cannot put it into
> an object block if it requires a standalone definition. */
>- if (TREE_CODE (decl) == VAR_DECL)
>+ if (VAR_P (decl))
> align_variable (decl, 0);
> sect = get_variable_section (decl, true);
> if (SECTION_STYLE (sect) == SECTION_NOSWITCH)
>@@ -1238,7 +1237,7 @@ use_blocks_for_decl_p (tree decl)
> struct symtab_node *snode;
>
> /* Only data DECLs can be placed into object blocks. */
>- if (TREE_CODE (decl) != VAR_DECL && TREE_CODE (decl) != CONST_DECL)
>+ if (!VAR_P (decl) && TREE_CODE (decl) != CONST_DECL)
> return false;
>
> /* Detect decls created by dw2_force_const_mem. Such decls are
>@@ -1250,7 +1249,7 @@ use_blocks_for_decl_p (tree decl)
>
> /* If this decl is an alias, then we don't want to emit a
> definition. */
>- if (TREE_CODE (decl) == VAR_DECL
>+ if (VAR_P (decl)
> && (snode = symtab_node::get (decl)) != NULL
> && snode->alias)
> return false;
>@@ -1304,7 +1303,7 @@ make_decl_rtl (tree decl)
> && TREE_CODE (decl) != RESULT_DECL);
>
> /* A weak alias has TREE_PUBLIC set but not the other bits. */
>- gcc_assert (TREE_CODE (decl) != VAR_DECL
>+ gcc_assert (!VAR_P (decl)
> || TREE_STATIC (decl)
> || TREE_PUBLIC (decl)
> || DECL_EXTERNAL (decl)
>@@ -1348,7 +1347,7 @@ make_decl_rtl (tree decl)
>
> /* If this variable belongs to the global constant pool, retrieve the
> pre-computed RTL or recompute it in LTO mode. */
>- if (TREE_CODE (decl) == VAR_DECL && DECL_IN_CONSTANT_POOL (decl))
>+ if (VAR_P (decl) && DECL_IN_CONSTANT_POOL (decl))
> {
> SET_DECL_RTL (decl, output_constant_def (DECL_INITIAL (decl), 1));
> return;
>@@ -1457,7 +1456,7 @@ make_decl_rtl (tree decl)
> visibility pass is doing the same work. But notice_global_symbol
> is called early and it needs to make DECL_RTL to get the name.
>we take care of recomputing the DECL_RTL after visibility is changed.
>*/
>- if (TREE_CODE (decl) == VAR_DECL
>+ if (VAR_P (decl)
> && (TREE_STATIC (decl) || DECL_EXTERNAL (decl))
> && DECL_SECTION_NAME (decl) != NULL
> && DECL_INITIAL (decl) == NULL_TREE
>@@ -1465,7 +1464,7 @@ make_decl_rtl (tree decl)
> DECL_COMMON (decl) = 0;
>
> /* Variables can't be both common and weak. */
>- if (TREE_CODE (decl) == VAR_DECL && DECL_WEAK (decl))
>+ if (VAR_P (decl) && DECL_WEAK (decl))
> DECL_COMMON (decl) = 0;
>
> if (use_object_blocks_p () && use_blocks_for_decl_p (decl))
>@@ -1639,9 +1638,9 @@ notice_global_symbol (tree decl)
> || !TREE_PUBLIC (decl)
> || DECL_EXTERNAL (decl)
> || !DECL_NAME (decl)
>- || (TREE_CODE (decl) == VAR_DECL && DECL_HARD_REGISTER (decl))
>+ || (VAR_P (decl) && DECL_HARD_REGISTER (decl))
> || (TREE_CODE (decl) != FUNCTION_DECL
>- && (TREE_CODE (decl) != VAR_DECL
>+ && (!VAR_P (decl)
> || (DECL_COMMON (decl)
> && (DECL_INITIAL (decl) == 0
> || DECL_INITIAL (decl) == error_mark_node)))))
>@@ -2111,7 +2110,7 @@ assemble_variable (tree decl, int top_le
> bool asan_protected = false;
>
>/* This function is supposed to handle VARIABLES. Ensure we have one.
>*/
>- gcc_assert (TREE_CODE (decl) == VAR_DECL);
>+ gcc_assert (VAR_P (decl));
>
> /* Emulated TLS had better not get this far. */
> gcc_checking_assert (targetm.have_tls || !DECL_THREAD_LOCAL_P (decl));
>@@ -2487,7 +2486,7 @@ mark_decl_referenced (tree decl)
> && !node->definition)
> node->mark_force_output ();
> }
>- else if (TREE_CODE (decl) == VAR_DECL)
>+ else if (VAR_P (decl))
> {
> varpool_node *node = varpool_node::get_create (decl);
> /* C++ frontend use mark_decl_references to force COMDAT variables
>@@ -3272,8 +3271,7 @@ build_constant_desc (tree exp)
> if (use_object_blocks_p ())
> {
> int align = (TREE_CODE (decl) == CONST_DECL
>- || (TREE_CODE (decl) == VAR_DECL
>- && DECL_IN_CONSTANT_POOL (decl))
>+ || (VAR_P (decl) && DECL_IN_CONSTANT_POOL (decl))
> ? DECL_ALIGN (decl)
> : symtab_node::get (decl)->definition_alignment ());
> section *sect = get_constant_section (exp, align);
>@@ -3430,8 +3428,7 @@ output_constant_def_contents (rtx symbol
> else
> {
> int align = (TREE_CODE (dec
^ permalink raw reply [flat|nested] 2+ messages in thread
end of thread, other threads:[~2016-10-09 6:31 UTC | newest]
Thread overview: 2+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2016-10-08 19:11 [PATCH] Use VAR_P and/or VAR_OR_FUNCTION_DECL_P macros Jakub Jelinek
2016-10-09 6:31 ` Richard Biener
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for read-only IMAP folder(s) and NNTP newsgroup(s).