2016-10-09 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.
+
PR tree-optimization/77901
* tree-ssa-reassoc.c (optimize_range_tests_var_bound): Only optimize
if ranges[i].exp is SSA_NAME when looking for >= and only when
/* 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)
{
/* 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));
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;
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. */
|| 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)
/* 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);
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);
}
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;
}
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;
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)))
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;
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)
&& !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))
;
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)
{
/* 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);
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;
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)
/* 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)
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)
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);
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);
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);
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);
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);
/* 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)
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;
&& (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
/* 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)
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
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);
{
tree ptrtmp;
- if (TREE_CODE (ptr) == VAR_DECL)
+ if (VAR_P (ptr))
ptrtmp = ptr;
else
{
{
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;
}
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;
&& 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)
{
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. */
/* 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 */
??? 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)
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)))
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)
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;
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));
}
/* ??? 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)
|| (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);
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))
/* 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)
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)
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 ())
&unsignedp, &reversep, &volatilep);
if (cvar == NULL_TREE
- || TREE_CODE (cvar) != VAR_DECL
+ || !VAR_P (cvar)
|| DECL_ARTIFICIAL (cvar)
|| !TREE_PUBLIC (cvar))
return NULL_TREE;
|| 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
{
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)
&& 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;
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);
}
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);
}
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;
/* 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
{
/* 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);
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)
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)
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
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)))
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))
&& 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)
{
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. */
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
*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);
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))
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);
{
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);
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))))
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);
}
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;
/* 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. */
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)
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)
{
*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)
/* 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. */
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)
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. */
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))
{
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));
/* 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;
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;
}
/* 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)
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);
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);
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)
/* 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
;
/* 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
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)
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;
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)
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)
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)
{
&& 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_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);
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)
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);
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);
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;
}
}
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;
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_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);
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)
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.
= 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));
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
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;
/* 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))))
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;
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))));
/* 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)
/* 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)
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));
}
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));
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));
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)
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. */
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. */
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
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;
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;
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
{
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;
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
/* 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);
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. */
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));
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
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)
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))
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;
/* 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))
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);
}
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;
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. */
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. */
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. */
&& 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);
}
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.
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;
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:
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;
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;
{
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))
{
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;
}
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);
}
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 };
{
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)
{
{
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)
{
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)))
|| 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)
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);
}
/* Build decl for bounds var. */
- if (TREE_CODE (obj) == VAR_DECL)
+ if (VAR_P (obj))
{
if (DECL_IGNORED_P (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);
{
tree bounds;
- gcc_assert (TREE_CODE (decl) == VAR_DECL
+ gcc_assert (VAR_P (decl)
|| TREE_CODE (decl) == PARM_DECL
|| TREE_CODE (decl) == RESULT_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))
|| 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
}
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
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
{
|| 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
{
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
{
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;
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;
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
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;
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))
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>;
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)
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))
/* 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;
{
/* 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)
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;
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);
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);
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)
{
if (!remappedvarp)
return;
- if (TREE_CODE (*remappedvarp) != VAR_DECL)
+ if (!VAR_P (*remappedvarp))
return;
if (*remappedvarp == id->retvar || *remappedvarp == id->retbnd)
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. */
{
/* 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;
{
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
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));
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;
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)
}
/* 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)
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);
}
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)
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)
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;
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
}
/* 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
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
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;
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);
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;
/* 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)
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);
}
}
- 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);
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
FOR_EACH_LOCAL_DECL (cfun, i, var)
{
- if (TREE_CODE (var) != VAR_DECL)
+ if (!VAR_P (var))
continue;
ret |= maybe_add_sra_candidate (var);
{
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)
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));
}
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)
{
&& 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;
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;
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;
/* 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;
/* 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;
&& 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)
/* 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). */
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. */
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))
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))
{
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)
{
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);
if (toffset != 0
|| bitpos % BITS_PER_UNIT != 0
|| reversep
- || TREE_CODE (core) != VAR_DECL)
+ || !VAR_P (core))
{
*symbol_present = false;
*var_present = true;
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;
}
/* 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)
insert_vi_for_tree (decl, vi);
- if (TREE_CODE (decl) != VAR_DECL)
+ if (!VAR_P (decl))
return id;
/* Create initial constraints for globals. */
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)
{
/* 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. */
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);
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;
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;
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))
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. */
&& (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));
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)));
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;
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;
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;
{
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;
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;
}
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;
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);
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);
}
}
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);
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)
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);
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);
}
}
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. */
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);
}
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)
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);
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;
&& !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
/* 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))
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)))
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);
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);
}
}
}
- 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",
*no_add_attrs = true;
}
- else if (TREE_CODE (node) == VAR_DECL)
+ else if (VAR_P (node))
{
if (DECL_INITIAL (node))
{
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);
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);
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
&& (!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;
;
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)
;
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);
&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
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))
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... */
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))
/* 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>
{
{
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))
/* 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)
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
/* 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;
&& 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)
/* 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;
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
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))
|| !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)))))
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));
&& !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
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);
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));
/* 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))
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);
#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;
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
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;
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. */
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;
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;
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
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)
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
&& !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);
{
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;
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