diff options
65 files changed, 196 insertions, 152 deletions
diff --git a/gcc/ChangeLog b/gcc/ChangeLog index 276c1cbe66b..3ee623c70fe 100644 --- a/gcc/ChangeLog +++ b/gcc/ChangeLog @@ -1,5 +1,19 @@ 2013-11-18 Richard Sandiford <rdsandiford@googlemail.com> + * builtins.c, cilk-common.c, config/aarch64/aarch64.c, + config/alpha/alpha.c, config/arm/arm.c, config/c6x/predicates.md, + config/i386/i386.c, config/ia64/predicates.md, config/s390/s390.c, + coverage.c, dbxout.c, dwarf2out.c, except.c, explow.c, expr.c, expr.h, + fold-const.c, gimple-fold.c, godump.c, ipa-prop.c, omp-low.c, + predict.c, rtlanal.c, sdbout.c, stmt.c, stor-layout.c, targhooks.c, + tree-cfg.c, tree-data-ref.c, tree-inline.c, tree-ssa-forwprop.c, + tree-ssa-loop-prefetch.c, tree-ssa-phiopt.c, tree-ssa-sccvn.c, + tree-ssa-strlen.c, tree-stdarg.c, tree-vect-data-refs.c, + tree-vect-patterns.c, tree.c, tree.h, var-tracking.c, varasm.c: + Replace tree_low_cst (..., 0) with tree_to_shwi throughout. + +2013-11-18 Richard Sandiford <rdsandiford@googlemail.com> + * tree.h (tree_to_shwi, tree_to_uhwi): Declare, with inline expansions. * tree.c (tree_to_shwi, tree_to_uhwi): New functions. diff --git a/gcc/builtins.c b/gcc/builtins.c index 32812002502..a50cfc6ddff 100644 --- a/gcc/builtins.c +++ b/gcc/builtins.c @@ -620,7 +620,7 @@ c_strlen (tree src, int only_value) else if (! tree_fits_shwi_p (offset_node)) offset = -1; else - offset = tree_low_cst (offset_node, 0); + offset = tree_to_shwi (offset_node); /* If the offset is known to be out of bounds, warn, and call strlen at runtime. */ @@ -5288,7 +5288,7 @@ expand_builtin_atomic_compare_exchange (enum machine_mode mode, tree exp, weak = CALL_EXPR_ARG (exp, 3); is_weak = false; - if (tree_fits_shwi_p (weak) && tree_low_cst (weak, 0) != 0) + if (tree_fits_shwi_p (weak) && tree_to_shwi (weak) != 0) is_weak = true; oldval = expect; @@ -9855,7 +9855,7 @@ fold_builtin_load_exponent (location_t loc, tree arg0, tree arg1, - REAL_MODE_FORMAT (TYPE_MODE (type))->emin); /* Get the user-requested adjustment. */ - const HOST_WIDE_INT req_exp_adj = tree_low_cst (arg1, 0); + const HOST_WIDE_INT req_exp_adj = tree_to_shwi (arg1); /* The requested adjustment must be inside this range. This is a preliminary cap to avoid things like overflow, we @@ -12366,7 +12366,7 @@ expand_builtin_object_size (tree exp) return const0_rtx; } - object_size_type = tree_low_cst (ost, 0); + object_size_type = tree_to_shwi (ost); return object_size_type < 2 ? constm1_rtx : const0_rtx; } @@ -12660,7 +12660,7 @@ fold_builtin_object_size (tree ptr, tree ost) || compare_tree_int (ost, 3) > 0) return NULL_TREE; - object_size_type = tree_low_cst (ost, 0); + object_size_type = tree_to_shwi (ost); /* __builtin_object_size doesn't evaluate side-effects in its arguments; if there are any side-effects, it returns (size_t) -1 for types 0 and 1 @@ -13844,7 +13844,7 @@ do_mpfr_bessel_n (tree arg1, tree arg2, tree type, && tree_fits_shwi_p (arg1) && TREE_CODE (arg2) == REAL_CST && !TREE_OVERFLOW (arg2)) { - const HOST_WIDE_INT n = tree_low_cst (arg1, 0); + const HOST_WIDE_INT n = tree_to_shwi (arg1); const REAL_VALUE_TYPE *const ra = &TREE_REAL_CST (arg2); if (n == (long)n diff --git a/gcc/c-family/ChangeLog b/gcc/c-family/ChangeLog index 2f7d02f52b9..6a5c401461b 100644 --- a/gcc/c-family/ChangeLog +++ b/gcc/c-family/ChangeLog @@ -1,5 +1,10 @@ 2013-11-18 Richard Sandiford <rdsandiford@googlemail.com> + * c-common.c, c-format.c, c-omp.c, c-pretty-print.c: Replace + tree_low_cst (..., 0) with tree_to_shwi throughout. + +2013-11-18 Richard Sandiford <rdsandiford@googlemail.com> + * c-ada-spec.c, c-common.c, c-pretty-print.c: Replace host_integerp (..., 1) with tree_fits_uhwi_p throughout. diff --git a/gcc/c-family/c-common.c b/gcc/c-family/c-common.c index 3ffefec9a2a..b3995bef7b5 100644 --- a/gcc/c-family/c-common.c +++ b/gcc/c-family/c-common.c @@ -7003,7 +7003,7 @@ get_priority (tree args, bool is_destructor) || !INTEGRAL_TYPE_P (TREE_TYPE (arg))) goto invalid; - pri = tree_low_cst (arg, /*pos=*/0); + pri = tree_to_shwi (arg); if (pri < 0 || pri > MAX_INIT_PRIORITY) goto invalid; @@ -11254,13 +11254,13 @@ warn_for_sign_compare (location_t location, { primop = op1; unsignedp = unsignedp1; - constant = tree_low_cst (op0, 0); + constant = tree_to_shwi (op0); } else { primop = op0; unsignedp = unsignedp0; - constant = tree_low_cst (op1, 0); + constant = tree_to_shwi (op1); } bits = TYPE_PRECISION (TREE_TYPE (primop)); diff --git a/gcc/c-family/c-format.c b/gcc/c-family/c-format.c index d0c07e41354..b3e1e399353 100644 --- a/gcc/c-family/c-format.c +++ b/gcc/c-family/c-format.c @@ -1460,7 +1460,7 @@ check_format_arg (void *ctx, tree format_tree, return; } if (!tree_fits_shwi_p (arg1) - || (offset = tree_low_cst (arg1, 0)) < 0) + || (offset = tree_to_shwi (arg1)) < 0) { res->number_non_literal++; return; @@ -1507,7 +1507,7 @@ check_format_arg (void *ctx, tree format_tree, } if (TREE_CODE (format_tree) == ARRAY_REF && tree_fits_shwi_p (TREE_OPERAND (format_tree, 1)) - && (offset += tree_low_cst (TREE_OPERAND (format_tree, 1), 0)) >= 0) + && (offset += tree_to_shwi (TREE_OPERAND (format_tree, 1))) >= 0) format_tree = TREE_OPERAND (format_tree, 0); if (TREE_CODE (format_tree) == VAR_DECL && TREE_CODE (TREE_TYPE (format_tree)) == ARRAY_TYPE diff --git a/gcc/c-family/c-omp.c b/gcc/c-family/c-omp.c index 921b40628c3..3ccf8f91521 100644 --- a/gcc/c-family/c-omp.c +++ b/gcc/c-family/c-omp.c @@ -921,8 +921,8 @@ c_omp_declare_simd_clause_cmp (const void *p, const void *q) && OMP_CLAUSE_CODE (a) != OMP_CLAUSE_INBRANCH && OMP_CLAUSE_CODE (a) != OMP_CLAUSE_NOTINBRANCH) { - int c = tree_low_cst (OMP_CLAUSE_DECL (a), 0); - int d = tree_low_cst (OMP_CLAUSE_DECL (b), 0); + int c = tree_to_shwi (OMP_CLAUSE_DECL (a)); + int d = tree_to_shwi (OMP_CLAUSE_DECL (b)); if (c < d) return 1; if (c > d) @@ -987,7 +987,7 @@ c_omp_declare_simd_clauses_to_decls (tree fndecl, tree clauses) && OMP_CLAUSE_CODE (c) != OMP_CLAUSE_INBRANCH && OMP_CLAUSE_CODE (c) != OMP_CLAUSE_NOTINBRANCH) { - int idx = tree_low_cst (OMP_CLAUSE_DECL (c), 0), i; + int idx = tree_to_shwi (OMP_CLAUSE_DECL (c)), i; tree arg; for (arg = DECL_ARGUMENTS (fndecl), i = 0; arg; arg = TREE_CHAIN (arg), i++) diff --git a/gcc/c-family/c-pretty-print.c b/gcc/c-family/c-pretty-print.c index 5f538c559f9..7898f13172c 100644 --- a/gcc/c-family/c-pretty-print.c +++ b/gcc/c-family/c-pretty-print.c @@ -587,7 +587,7 @@ c_pretty_printer::direct_abstract_declarator (tree t) tree type = TREE_TYPE (maxval); if (tree_fits_shwi_p (maxval)) - pp_wide_integer (this, tree_low_cst (maxval, 0) + 1); + pp_wide_integer (this, tree_to_shwi (maxval) + 1); else expression (fold_build2 (PLUS_EXPR, type, maxval, build_int_cst (type, 1))); @@ -1599,8 +1599,8 @@ c_pretty_printer::postfix_expression (tree e) if (type && tree_int_cst_equal (TYPE_SIZE (type), TREE_OPERAND (e, 1))) { - HOST_WIDE_INT bitpos = tree_low_cst (TREE_OPERAND (e, 2), 0); - HOST_WIDE_INT size = tree_low_cst (TYPE_SIZE (type), 0); + HOST_WIDE_INT bitpos = tree_to_shwi (TREE_OPERAND (e, 2)); + HOST_WIDE_INT size = tree_to_shwi (TYPE_SIZE (type)); if ((bitpos % size) == 0) { pp_c_left_paren (this); diff --git a/gcc/c/ChangeLog b/gcc/c/ChangeLog index b2035dfb474..dd01c639f7f 100644 --- a/gcc/c/ChangeLog +++ b/gcc/c/ChangeLog @@ -1,5 +1,10 @@ 2013-11-18 Richard Sandiford <rdsandiford@googlemail.com> + * c-parser.c: Replace tree_low_cst (..., 0) with tree_to_shwi + throughout. + +2013-11-18 Richard Sandiford <rdsandiford@googlemail.com> + * c-parser.c: Replace host_integerp (..., 0) with tree_fits_shwi_p throughout. diff --git a/gcc/c/c-parser.c b/gcc/c/c-parser.c index 58b2ffc0a52..74eb13a3f7e 100644 --- a/gcc/c/c-parser.c +++ b/gcc/c/c-parser.c @@ -9737,7 +9737,7 @@ c_parser_omp_clause_collapse (c_parser *parser, tree list) num = c_fully_fold (num, false, NULL); if (!INTEGRAL_TYPE_P (TREE_TYPE (num)) || !tree_fits_shwi_p (num) - || (n = tree_low_cst (num, 0)) <= 0 + || (n = tree_to_shwi (num)) <= 0 || (int) n != n) { error_at (loc, @@ -11463,7 +11463,7 @@ c_parser_omp_for_loop (location_t loc, c_parser *parser, enum tree_code code, for (cl = clauses; cl; cl = OMP_CLAUSE_CHAIN (cl)) if (OMP_CLAUSE_CODE (cl) == OMP_CLAUSE_COLLAPSE) - collapse = tree_low_cst (OMP_CLAUSE_COLLAPSE_EXPR (cl), 0); + collapse = tree_to_shwi (OMP_CLAUSE_COLLAPSE_EXPR (cl)); gcc_assert (collapse >= 1); diff --git a/gcc/cilk-common.c b/gcc/cilk-common.c index 8e070a3a32d..98b85988764 100644 --- a/gcc/cilk-common.c +++ b/gcc/cilk-common.c @@ -340,8 +340,8 @@ expand_builtin_cilk_detach (tree exp) WORKER.TAIL <- TMP */ HOST_WIDE_INT worker_tail_offset = - tree_low_cst (DECL_FIELD_OFFSET (cilk_trees[CILK_TI_WORKER_TAIL]), 0) + - tree_low_cst (DECL_FIELD_BIT_OFFSET (cilk_trees[CILK_TI_WORKER_TAIL]), 0) / + tree_to_shwi (DECL_FIELD_OFFSET (cilk_trees[CILK_TI_WORKER_TAIL])) + + tree_to_shwi (DECL_FIELD_BIT_OFFSET (cilk_trees[CILK_TI_WORKER_TAIL])) / BITS_PER_UNIT; rtx tmem0 = gen_rtx_MEM (Pmode, plus_constant (Pmode, wreg, worker_tail_offset)); diff --git a/gcc/config/aarch64/aarch64.c b/gcc/config/aarch64/aarch64.c index 290ed6c851a..6116986e825 100644 --- a/gcc/config/aarch64/aarch64.c +++ b/gcc/config/aarch64/aarch64.c @@ -6863,7 +6863,7 @@ aarch64_simd_attr_length_move (rtx insn) static HOST_WIDE_INT aarch64_simd_vector_alignment (const_tree type) { - HOST_WIDE_INT align = tree_low_cst (TYPE_SIZE (type), 0); + HOST_WIDE_INT align = tree_to_shwi (TYPE_SIZE (type)); return MIN (align, 128); } diff --git a/gcc/config/alpha/alpha.c b/gcc/config/alpha/alpha.c index 855be32d103..e710b0c3717 100644 --- a/gcc/config/alpha/alpha.c +++ b/gcc/config/alpha/alpha.c @@ -5989,7 +5989,7 @@ alpha_stdarg_optimize_hook (struct stdarg_info *si, const_gimple stmt) if (!tree_fits_shwi_p (gimple_assign_rhs2 (arg2_stmt))) goto escapes; - sub = tree_low_cst (gimple_assign_rhs2 (arg2_stmt), 0); + sub = tree_to_shwi (gimple_assign_rhs2 (arg2_stmt)); if (code2 == MINUS_EXPR) sub = -sub; if (sub < -48 || sub > -32) diff --git a/gcc/config/arm/arm.c b/gcc/config/arm/arm.c index 4d8a39f2e07..6e9faedd8f0 100644 --- a/gcc/config/arm/arm.c +++ b/gcc/config/arm/arm.c @@ -28807,7 +28807,7 @@ arm_builtin_vectorized_function (tree fndecl, tree type_out, tree type_in) static HOST_WIDE_INT arm_vector_alignment (const_tree type) { - HOST_WIDE_INT align = tree_low_cst (TYPE_SIZE (type), 0); + HOST_WIDE_INT align = tree_to_shwi (TYPE_SIZE (type)); if (TARGET_AAPCS_BASED) align = MIN (align, 64); diff --git a/gcc/config/c6x/predicates.md b/gcc/config/c6x/predicates.md index 94d9389de53..fbcbdd02457 100644 --- a/gcc/config/c6x/predicates.md +++ b/gcc/config/c6x/predicates.md @@ -212,7 +212,7 @@ t = TYPE_SIZE_UNIT (TREE_TYPE (t)); if (t && tree_fits_shwi_p (t)) { - size = tree_low_cst (t, 0); + size = tree_to_shwi (t); if (size < 0) size = 0; } diff --git a/gcc/config/i386/i386.c b/gcc/config/i386/i386.c index 96cf77025fa..4937b35b693 100644 --- a/gcc/config/i386/i386.c +++ b/gcc/config/i386/i386.c @@ -6270,7 +6270,7 @@ classify_argument (enum machine_mode mode, const_tree type, for (i = (int_bit_position (field) + (bit_offset % 64)) / 8 / 8; i < ((int_bit_position (field) + (bit_offset % 64)) - + tree_low_cst (DECL_SIZE (field), 0) + + tree_to_shwi (DECL_SIZE (field)) + 63) / 8 / 8; i++) classes[i] = merge_classes (X86_64_INTEGER_CLASS, diff --git a/gcc/config/ia64/predicates.md b/gcc/config/ia64/predicates.md index 476e06df796..31530be906d 100644 --- a/gcc/config/ia64/predicates.md +++ b/gcc/config/ia64/predicates.md @@ -74,7 +74,7 @@ t = TYPE_SIZE_UNIT (TREE_TYPE (t)); if (t && tree_fits_shwi_p (t)) { - size = tree_low_cst (t, 0); + size = tree_to_shwi (t); if (size < 0) size = 0; } diff --git a/gcc/config/s390/s390.c b/gcc/config/s390/s390.c index 58fab9e5ca9..39453038fe7 100644 --- a/gcc/config/s390/s390.c +++ b/gcc/config/s390/s390.c @@ -10195,7 +10195,7 @@ s390_encode_section_info (tree decl, rtx rtl, int first) || !DECL_ALIGN (decl) || !tree_fits_shwi_p (DECL_SIZE (decl)) || (DECL_ALIGN (decl) <= 64 - && DECL_ALIGN (decl) != tree_low_cst (DECL_SIZE (decl), 0))) + && DECL_ALIGN (decl) != tree_to_shwi (DECL_SIZE (decl)))) SYMBOL_REF_FLAGS (XEXP (rtl, 0)) |= SYMBOL_FLAG_NOT_NATURALLY_ALIGNED; } diff --git a/gcc/coverage.c b/gcc/coverage.c index 9b0fc8b3d14..43f9c0cb6f1 100644 --- a/gcc/coverage.c +++ b/gcc/coverage.c @@ -830,7 +830,7 @@ build_fn_info (const struct coverage_data *data, tree type, tree key) if (var) count - = tree_low_cst (TYPE_MAX_VALUE (TYPE_DOMAIN (TREE_TYPE (var))), 0) + = tree_to_shwi (TYPE_MAX_VALUE (TYPE_DOMAIN (TREE_TYPE (var)))) + 1; CONSTRUCTOR_APPEND_ELT (ctr, TYPE_FIELDS (ctr_type), diff --git a/gcc/cp/ChangeLog b/gcc/cp/ChangeLog index e7a2014a9f9..c15f42ce10e 100644 --- a/gcc/cp/ChangeLog +++ b/gcc/cp/ChangeLog @@ -1,5 +1,10 @@ 2013-11-18 Richard Sandiford <rdsandiford@googlemail.com> + * class.c, dump.c, error.c, init.c, method.c, parser.c, semantics.c: + Replace tree_low_cst (..., 0) with tree_to_shwi throughout. + +2013-11-18 Richard Sandiford <rdsandiford@googlemail.com> + * decl.c: Replace host_integerp (..., 1) with tree_fits_uhwi_p throughout. diff --git a/gcc/cp/class.c b/gcc/cp/class.c index 1df16d4ef8c..4fc65da2e3b 100644 --- a/gcc/cp/class.c +++ b/gcc/cp/class.c @@ -8041,7 +8041,7 @@ dump_class_hierarchy_r (FILE *stream, igo = TREE_CHAIN (binfo); fprintf (stream, HOST_WIDE_INT_PRINT_DEC, - tree_low_cst (BINFO_OFFSET (binfo), 0)); + tree_to_shwi (BINFO_OFFSET (binfo))); if (is_empty_class (BINFO_TYPE (binfo))) fprintf (stream, " empty"); else if (CLASSTYPE_NEARLY_EMPTY_P (BINFO_TYPE (binfo))) @@ -8117,10 +8117,10 @@ dump_class_hierarchy_1 (FILE *stream, int flags, tree t) { fprintf (stream, "Class %s\n", type_as_string (t, TFF_PLAIN_IDENTIFIER)); fprintf (stream, " size=%lu align=%lu\n", - (unsigned long)(tree_low_cst (TYPE_SIZE (t), 0) / BITS_PER_UNIT), + (unsigned long)(tree_to_shwi (TYPE_SIZE (t)) / BITS_PER_UNIT), (unsigned long)(TYPE_ALIGN (t) / BITS_PER_UNIT)); fprintf (stream, " base size=%lu base align=%lu\n", - (unsigned long)(tree_low_cst (TYPE_SIZE (CLASSTYPE_AS_BASE (t)), 0) + (unsigned long)(tree_to_shwi (TYPE_SIZE (CLASSTYPE_AS_BASE (t))) / BITS_PER_UNIT), (unsigned long)(TYPE_ALIGN (CLASSTYPE_AS_BASE (t)) / BITS_PER_UNIT)); @@ -8157,7 +8157,7 @@ dump_array (FILE * stream, tree decl) HOST_WIDE_INT elt; tree size = TYPE_MAX_VALUE (TYPE_DOMAIN (TREE_TYPE (decl))); - elt = (tree_low_cst (TYPE_SIZE (TREE_TYPE (TREE_TYPE (decl))), 0) + elt = (tree_to_shwi (TYPE_SIZE (TREE_TYPE (TREE_TYPE (decl)))) / BITS_PER_UNIT); fprintf (stream, "%s:", decl_as_string (decl, TFF_PLAIN_IDENTIFIER)); fprintf (stream, " %s entries", @@ -8246,10 +8246,10 @@ dump_thunk (FILE *stream, int indent, tree thunk) /*NOP*/; else if (DECL_THIS_THUNK_P (thunk)) fprintf (stream, " vcall=" HOST_WIDE_INT_PRINT_DEC, - tree_low_cst (virtual_adjust, 0)); + tree_to_shwi (virtual_adjust)); else fprintf (stream, " vbase=" HOST_WIDE_INT_PRINT_DEC "(%s)", - tree_low_cst (BINFO_VPTR_FIELD (virtual_adjust), 0), + tree_to_shwi (BINFO_VPTR_FIELD (virtual_adjust)), type_as_string (BINFO_TYPE (virtual_adjust), TFF_SCOPE)); if (THUNK_ALIAS (thunk)) fprintf (stream, " alias to %p", (void *)THUNK_ALIAS (thunk)); diff --git a/gcc/cp/dump.c b/gcc/cp/dump.c index 4aa3935a7d2..cc888339af9 100644 --- a/gcc/cp/dump.c +++ b/gcc/cp/dump.c @@ -346,7 +346,7 @@ cp_dump_tree (void* dump_info, tree t) } dump_int (di, "fixd", THUNK_FIXED_OFFSET (t)); if (virt) - dump_int (di, "virt", tree_low_cst (virt, 0)); + dump_int (di, "virt", tree_to_shwi (virt)); dump_child ("fn", DECL_INITIAL (t)); } break; diff --git a/gcc/cp/error.c b/gcc/cp/error.c index 7f8607710c8..d5b42e7d013 100644 --- a/gcc/cp/error.c +++ b/gcc/cp/error.c @@ -852,7 +852,7 @@ dump_type_suffix (cxx_pretty_printer *pp, tree t, int flags) if (integer_all_onesp (max)) pp_character (pp, '0'); else if (tree_fits_shwi_p (max)) - pp_wide_integer (pp, tree_low_cst (max, 0) + 1); + pp_wide_integer (pp, tree_to_shwi (max) + 1); else { STRIP_NOPS (max); @@ -2294,7 +2294,7 @@ dump_expr (cxx_pretty_printer *pp, tree t, int flags) t = TYPE_METHOD_BASETYPE (t); virtuals = BINFO_VIRTUALS (TYPE_BINFO (TYPE_MAIN_VARIANT (t))); - n = tree_low_cst (idx, 0); + n = tree_to_shwi (idx); /* Map vtable index back one, to allow for the null pointer to member. */ diff --git a/gcc/cp/init.c b/gcc/cp/init.c index c37423c4c5d..7eac6f52d09 100644 --- a/gcc/cp/init.c +++ b/gcc/cp/init.c @@ -3664,7 +3664,7 @@ build_vec_init (tree base, tree maxindex, tree init, || ((type_build_ctor_call (type) || init || explicit_value_init_p) && ! (tree_fits_shwi_p (maxindex) && (num_initialized_elts - == tree_low_cst (maxindex, 0) + 1)))) + == tree_to_shwi (maxindex) + 1)))) { /* If the ITERATOR is equal to -1, then we don't have to loop; we've already initialized all the elements. */ diff --git a/gcc/cp/method.c b/gcc/cp/method.c index 272ef42217f..d15d0a4d6f6 100644 --- a/gcc/cp/method.c +++ b/gcc/cp/method.c @@ -95,7 +95,7 @@ make_thunk (tree function, bool this_adjusting, convert (ssizetype, TYPE_SIZE_UNIT (vtable_entry_type))); - d = tree_low_cst (fixed_offset, 0); + d = tree_to_shwi (fixed_offset); /* See if we already have the thunk in question. For this_adjusting thunks VIRTUAL_OFFSET will be an INTEGER_CST, for covariant thunks it @@ -323,7 +323,7 @@ use_thunk (tree thunk_fndecl, bool emit_p) { if (!this_adjusting) virtual_offset = BINFO_VPTR_FIELD (virtual_offset); - virtual_value = tree_low_cst (virtual_offset, /*pos=*/0); + virtual_value = tree_to_shwi (virtual_offset); gcc_assert (virtual_value); } else diff --git a/gcc/cp/parser.c b/gcc/cp/parser.c index 72fbd024393..d37924851ed 100644 --- a/gcc/cp/parser.c +++ b/gcc/cp/parser.c @@ -26963,7 +26963,7 @@ cp_parser_omp_clause_collapse (cp_parser *parser, tree list, location_t location num = fold_non_dependent_expr (num); if (!INTEGRAL_TYPE_P (TREE_TYPE (num)) || !tree_fits_shwi_p (num) - || (n = tree_low_cst (num, 0)) <= 0 + || (n = tree_to_shwi (num)) <= 0 || (int) n != n) { error_at (loc, "collapse argument needs positive constant integer expression"); @@ -28929,7 +28929,7 @@ cp_parser_omp_for_loop (cp_parser *parser, enum tree_code code, tree clauses, for (cl = clauses; cl; cl = OMP_CLAUSE_CHAIN (cl)) if (OMP_CLAUSE_CODE (cl) == OMP_CLAUSE_COLLAPSE) - collapse = tree_low_cst (OMP_CLAUSE_COLLAPSE_EXPR (cl), 0); + collapse = tree_to_shwi (OMP_CLAUSE_COLLAPSE_EXPR (cl)); gcc_assert (collapse >= 1); diff --git a/gcc/cp/semantics.c b/gcc/cp/semantics.c index 781d37386c3..dce2b3749fc 100644 --- a/gcc/cp/semantics.c +++ b/gcc/cp/semantics.c @@ -8611,7 +8611,7 @@ cxx_eval_array_reference (const constexpr_call *call, tree t, *non_constant_p = true; return t; } - i = tree_low_cst (index, 0); + i = tree_to_shwi (index); if (TREE_CODE (ary) == CONSTRUCTOR) return (*CONSTRUCTOR_ELTS (ary))[i].value; else if (elem_nchars == 1) @@ -8726,8 +8726,8 @@ cxx_eval_bit_field_ref (const constexpr_call *call, tree t, TREE_OPERAND (t, 1), TREE_OPERAND (t, 2)); start = TREE_OPERAND (t, 2); - istart = tree_low_cst (start, 0); - isize = tree_low_cst (TREE_OPERAND (t, 1), 0); + istart = tree_to_shwi (start); + isize = tree_to_shwi (TREE_OPERAND (t, 1)); utype = TREE_TYPE (t); if (!TYPE_UNSIGNED (utype)) utype = build_nonstandard_integer_type (TYPE_PRECISION (utype), 1); @@ -8742,8 +8742,8 @@ cxx_eval_bit_field_ref (const constexpr_call *call, tree t, && tree_fits_shwi_p (bitpos) && tree_fits_shwi_p (DECL_SIZE (field))) { - HOST_WIDE_INT bit = tree_low_cst (bitpos, 0); - HOST_WIDE_INT sz = tree_low_cst (DECL_SIZE (field), 0); + HOST_WIDE_INT bit = tree_to_shwi (bitpos); + HOST_WIDE_INT sz = tree_to_shwi (DECL_SIZE (field)); HOST_WIDE_INT shift; if (bit >= istart && bit + sz <= istart + isize) { @@ -8900,7 +8900,7 @@ cxx_eval_vec_init_1 (const constexpr_call *call, tree atype, tree init, bool *non_constant_p, bool *overflow_p) { tree elttype = TREE_TYPE (atype); - int max = tree_low_cst (array_type_nelts (atype), 0); + int max = tree_to_shwi (array_type_nelts (atype)); vec<constructor_elt, va_gc> *n; vec_alloc (n, max + 1); bool pre_init = false; @@ -9119,9 +9119,9 @@ cxx_fold_indirect_ref (location_t loc, tree type, tree op0, bool *empty_base) && (same_type_ignoring_top_level_qualifiers_p (type, TREE_TYPE (op00type)))) { - HOST_WIDE_INT offset = tree_low_cst (op01, 0); + HOST_WIDE_INT offset = tree_to_shwi (op01); tree part_width = TYPE_SIZE (type); - unsigned HOST_WIDE_INT part_widthi = tree_low_cst (part_width, 0)/BITS_PER_UNIT; + unsigned HOST_WIDE_INT part_widthi = tree_to_shwi (part_width)/BITS_PER_UNIT; unsigned HOST_WIDE_INT indexi = offset * BITS_PER_UNIT; tree index = bitsize_int (indexi); diff --git a/gcc/dbxout.c b/gcc/dbxout.c index ddeb87bf506..b56a4689463 100644 --- a/gcc/dbxout.c +++ b/gcc/dbxout.c @@ -1612,7 +1612,7 @@ dbxout_type_method_1 (tree decl) if (DECL_VINDEX (decl) && tree_fits_shwi_p (DECL_VINDEX (decl))) { - stabstr_D (tree_low_cst (DECL_VINDEX (decl), 0)); + stabstr_D (tree_to_shwi (DECL_VINDEX (decl))); stabstr_C (';'); dbxout_type (DECL_CONTEXT (decl), 0); stabstr_C (';'); @@ -1723,7 +1723,7 @@ dbxout_range_type (tree type, tree low, tree high) if (print_int_cst_bounds_in_octal_p (type, low, high)) stabstr_O (low); else - stabstr_D (tree_low_cst (low, 0)); + stabstr_D (tree_to_shwi (low)); } else stabstr_C ('0'); @@ -1734,7 +1734,7 @@ dbxout_range_type (tree type, tree low, tree high) if (print_int_cst_bounds_in_octal_p (type, low, high)) stabstr_O (high); else - stabstr_D (tree_low_cst (high, 0)); + stabstr_D (tree_to_shwi (high)); stabstr_C (';'); } else @@ -2210,10 +2210,10 @@ dbxout_type (tree type, int full) offset within the vtable where we must look to find the necessary adjustment. */ stabstr_D - (tree_low_cst (BINFO_VPTR_FIELD (child), 0) + (tree_to_shwi (BINFO_VPTR_FIELD (child)) * BITS_PER_UNIT); else - stabstr_D (tree_low_cst (BINFO_OFFSET (child), 0) + stabstr_D (tree_to_shwi (BINFO_OFFSET (child)) * BITS_PER_UNIT); stabstr_C (','); dbxout_type (BINFO_TYPE (child), 0); @@ -2228,11 +2228,11 @@ dbxout_type (tree type, int full) stabstr_C (':'); dbxout_type (BINFO_TYPE (child), full); stabstr_C (','); - stabstr_D (tree_low_cst (BINFO_OFFSET (child), 0) + stabstr_D (tree_to_shwi (BINFO_OFFSET (child)) * BITS_PER_UNIT); stabstr_C (','); stabstr_D - (tree_low_cst (TYPE_SIZE (BINFO_TYPE (child)), 0) + (tree_to_shwi (TYPE_SIZE (BINFO_TYPE (child))) * BITS_PER_UNIT); stabstr_C (';'); } @@ -2518,7 +2518,7 @@ dbxout_expand_expr (tree expr) { if (!tree_fits_shwi_p (offset)) return NULL; - x = adjust_address_nv (x, mode, tree_low_cst (offset, 0)); + x = adjust_address_nv (x, mode, tree_to_shwi (offset)); } if (bitpos != 0) x = adjust_address_nv (x, mode, bitpos / BITS_PER_UNIT); diff --git a/gcc/dwarf2out.c b/gcc/dwarf2out.c index 73b44ada3ef..f313b2ded1a 100644 --- a/gcc/dwarf2out.c +++ b/gcc/dwarf2out.c @@ -14253,10 +14253,10 @@ loc_list_from_tree (tree loc, int want_address) && tree_fits_shwi_p (loc) && (ret = address_of_int_loc_descriptor (int_size_in_bytes (TREE_TYPE (loc)), - tree_low_cst (loc, 0)))) + tree_to_shwi (loc)))) have_address = 1; else if (tree_fits_shwi_p (loc)) - ret = int_loc_descriptor (tree_low_cst (loc, 0)); + ret = int_loc_descriptor (tree_to_shwi (loc)); else { expansion_failed (loc, NULL_RTX, @@ -14351,7 +14351,7 @@ loc_list_from_tree (tree loc, int want_address) if (list_ret == 0) return 0; - loc_list_plus_const (list_ret, tree_low_cst (TREE_OPERAND (loc, 1), 0)); + loc_list_plus_const (list_ret, tree_to_shwi (TREE_OPERAND (loc, 1))); break; } @@ -14855,7 +14855,7 @@ add_data_member_location_attribute (dw_die_ref die, tree decl) add_loc_descr (&loc_descr, tmp); /* Calculate the address of the offset. */ - offset = tree_low_cst (BINFO_VPTR_FIELD (decl), 0); + offset = tree_to_shwi (BINFO_VPTR_FIELD (decl)); gcc_assert (offset < 0); tmp = int_loc_descriptor (-offset); @@ -14872,7 +14872,7 @@ add_data_member_location_attribute (dw_die_ref die, tree decl) add_loc_descr (&loc_descr, tmp); } else - offset = tree_low_cst (BINFO_OFFSET (decl), 0); + offset = tree_to_shwi (BINFO_OFFSET (decl)); } else offset = field_byte_offset (decl); @@ -15528,7 +15528,7 @@ fortran_common (tree decl, HOST_WIDE_INT *value) { if (!tree_fits_shwi_p (offset)) return NULL_TREE; - *value = tree_low_cst (offset, 0); + *value = tree_to_shwi (offset); } if (bitpos != 0) *value += bitpos / BITS_PER_UNIT; @@ -15701,7 +15701,7 @@ native_encode_initializer (tree init, unsigned char *array, int size) if (fieldsize <= 0) return false; - min_index = tree_low_cst (TYPE_MIN_VALUE (TYPE_DOMAIN (type)), 0); + min_index = tree_to_shwi (TYPE_MIN_VALUE (TYPE_DOMAIN (type))); memset (array, '\0', size); FOR_EACH_VEC_SAFE_ELT (CONSTRUCTOR_ELTS (init), cnt, ce) { @@ -15709,10 +15709,10 @@ native_encode_initializer (tree init, unsigned char *array, int size) tree index = ce->index; int pos = curpos; if (index && TREE_CODE (index) == RANGE_EXPR) - pos = (tree_low_cst (TREE_OPERAND (index, 0), 0) - min_index) + pos = (tree_to_shwi (TREE_OPERAND (index, 0)) - min_index) * fieldsize; else if (index) - pos = (tree_low_cst (index, 0) - min_index) * fieldsize; + pos = (tree_to_shwi (index) - min_index) * fieldsize; if (val) { @@ -15723,8 +15723,8 @@ native_encode_initializer (tree init, unsigned char *array, int size) curpos = pos + fieldsize; if (index && TREE_CODE (index) == RANGE_EXPR) { - int count = tree_low_cst (TREE_OPERAND (index, 1), 0) - - tree_low_cst (TREE_OPERAND (index, 0), 0); + int count = tree_to_shwi (TREE_OPERAND (index, 1)) + - tree_to_shwi (TREE_OPERAND (index, 0)); while (count-- > 0) { if (val) @@ -15770,7 +15770,7 @@ native_encode_initializer (tree init, unsigned char *array, int size) else if (DECL_SIZE_UNIT (field) == NULL_TREE || !tree_fits_shwi_p (DECL_SIZE_UNIT (field))) return false; - fieldsize = tree_low_cst (DECL_SIZE_UNIT (field), 0); + fieldsize = tree_to_shwi (DECL_SIZE_UNIT (field)); pos = int_byte_position (field); gcc_assert (pos + fieldsize <= size); if (val @@ -16162,7 +16162,7 @@ add_bound_info (dw_die_ref subrange_die, enum dwarf_attribute bound_attr, tree b if (bound_attr == DW_AT_lower_bound && tree_fits_shwi_p (bound) && (dflt = lower_bound_default ()) != -1 - && tree_low_cst (bound, 0) == dflt) + && tree_to_shwi (bound) == dflt) ; /* Otherwise represent the bound as an unsigned value with the @@ -16410,7 +16410,7 @@ add_bit_offset_attribute (dw_die_ref die, tree decl) if (! BYTES_BIG_ENDIAN) { - highest_order_field_bit_offset += tree_low_cst (DECL_SIZE (decl), 0); + highest_order_field_bit_offset += tree_to_shwi (DECL_SIZE (decl)); highest_order_object_bit_offset += simple_type_size_in_bits (type); } @@ -16508,7 +16508,7 @@ add_pure_or_virtual_attribute (dw_die_ref die, tree func_decl) if (tree_fits_shwi_p (DECL_VINDEX (func_decl))) add_AT_loc (die, DW_AT_vtable_elem_location, new_loc_descr (DW_OP_constu, - tree_low_cst (DECL_VINDEX (func_decl), 0), + tree_to_shwi (DECL_VINDEX (func_decl)), 0)); /* GNU extension: Record what type this method came from originally. */ @@ -17056,7 +17056,7 @@ descr_info_loc (tree val, tree base_decl) return loc_descriptor_from_tree (val, 0); case INTEGER_CST: if (tree_fits_shwi_p (val)) - return int_loc_descriptor (tree_low_cst (val, 0)); + return int_loc_descriptor (tree_to_shwi (val)); break; case INDIRECT_REF: size = int_size_in_bytes (TREE_TYPE (val)); @@ -17079,7 +17079,7 @@ descr_info_loc (tree val, tree base_decl) loc = descr_info_loc (TREE_OPERAND (val, 0), base_decl); if (!loc) break; - loc_descr_plus_const (&loc, tree_low_cst (TREE_OPERAND (val, 1), 0)); + loc_descr_plus_const (&loc, tree_to_shwi (TREE_OPERAND (val, 1))); } else { @@ -17121,7 +17121,7 @@ add_descr_info_field (dw_die_ref die, enum dwarf_attribute attr, if (tree_fits_shwi_p (val)) { - add_AT_unsigned (die, attr, tree_low_cst (val, 0)); + add_AT_unsigned (die, attr, tree_to_shwi (val)); return; } @@ -17174,7 +17174,7 @@ gen_descr_array_type_die (tree type, struct array_descr_info *info, if (tree_fits_shwi_p (info->dimen[dim].lower_bound) && (dflt = lower_bound_default ()) != -1 - && tree_low_cst (info->dimen[dim].lower_bound, 0) == dflt) + && tree_to_shwi (info->dimen[dim].lower_bound) == dflt) ; else add_descr_info_field (subrange_die, DW_AT_lower_bound, @@ -23114,7 +23114,7 @@ optimize_location_into_implicit_ptr (dw_die_ref die, tree decl) if (TREE_CODE (init) == POINTER_PLUS_EXPR && tree_fits_shwi_p (TREE_OPERAND (init, 1))) { - offset = tree_low_cst (TREE_OPERAND (init, 1), 0); + offset = tree_to_shwi (TREE_OPERAND (init, 1)); init = TREE_OPERAND (init, 0); STRIP_NOPS (init); } diff --git a/gcc/except.c b/gcc/except.c index 63d4024b793..a4481d60e6a 100644 --- a/gcc/except.c +++ b/gcc/except.c @@ -2051,7 +2051,7 @@ expand_builtin_eh_common (tree region_nr_t) eh_region region; gcc_assert (tree_fits_shwi_p (region_nr_t)); - region_nr = tree_low_cst (region_nr_t, 0); + region_nr = tree_to_shwi (region_nr_t); region = (*cfun->eh->region_array)[region_nr]; diff --git a/gcc/explow.c b/gcc/explow.c index a9457690c5a..3a78a651360 100644 --- a/gcc/explow.c +++ b/gcc/explow.c @@ -285,7 +285,7 @@ int_expr_size (tree exp) if (size == 0 || !tree_fits_shwi_p (size)) return -1; - return tree_low_cst (size, 0); + return tree_to_shwi (size); } /* Return a copy of X in which all memory references diff --git a/gcc/expr.c b/gcc/expr.c index da5c05ea051..422030b4a0f 100644 --- a/gcc/expr.c +++ b/gcc/expr.c @@ -5925,7 +5925,7 @@ store_constructor (tree exp, rtx target, int cleared, HOST_WIDE_INT size) offset = 0; } else - bitpos = tree_low_cst (DECL_FIELD_BIT_OFFSET (field), 0); + bitpos = tree_to_shwi (DECL_FIELD_BIT_OFFSET (field)); if (offset) { @@ -6014,8 +6014,8 @@ store_constructor (tree exp, rtx target, int cleared, HOST_WIDE_INT size) /* If we have constant bounds for the range of the type, get them. */ if (const_bounds_p) { - minelt = tree_low_cst (TYPE_MIN_VALUE (domain), 0); - maxelt = tree_low_cst (TYPE_MAX_VALUE (domain), 0); + minelt = tree_to_shwi (TYPE_MIN_VALUE (domain)); + maxelt = tree_to_shwi (TYPE_MAX_VALUE (domain)); } /* If the constructor has fewer elements than the array, clear @@ -6120,8 +6120,8 @@ store_constructor (tree exp, rtx target, int cleared, HOST_WIDE_INT size) if (const_bounds_p && tree_fits_shwi_p (lo_index) && tree_fits_shwi_p (hi_index) - && (lo = tree_low_cst (lo_index, 0), - hi = tree_low_cst (hi_index, 0), + && (lo = tree_to_shwi (lo_index), + hi = tree_to_shwi (hi_index), count = hi - lo + 1, (!MEM_P (target) || count <= 2 @@ -6132,7 +6132,7 @@ store_constructor (tree exp, rtx target, int cleared, HOST_WIDE_INT size) lo -= minelt; hi -= minelt; for (; lo <= hi; lo++) { - bitpos = lo * tree_low_cst (TYPE_SIZE (elttype), 0); + bitpos = lo * tree_to_shwi (TYPE_SIZE (elttype)); if (MEM_P (target) && !MEM_KEEP_ALIAS_SET_P (target) @@ -6235,7 +6235,7 @@ store_constructor (tree exp, rtx target, int cleared, HOST_WIDE_INT size) else { if (index != 0) - bitpos = ((tree_low_cst (index, 0) - minelt) + bitpos = ((tree_to_shwi (index) - minelt) * tree_low_cst (TYPE_SIZE (elttype), 1)); else bitpos = (i * tree_low_cst (TYPE_SIZE (elttype), 1)); @@ -8551,7 +8551,7 @@ expand_expr_real_2 (sepops ops, rtx target, enum machine_mode tmode, op0 = copy_to_mode_reg (mode, op0); return REDUCE_BIT_FIELD (gen_rtx_MULT (mode, op0, - gen_int_mode (tree_low_cst (exp1, 0), + gen_int_mode (tree_to_shwi (exp1), TYPE_MODE (TREE_TYPE (exp1))))); } diff --git a/gcc/expr.h b/gcc/expr.h index a0221f7e894..fd7a1d48dec 100644 --- a/gcc/expr.h +++ b/gcc/expr.h @@ -95,7 +95,7 @@ struct locate_and_pad_arg_data do { \ tree inc = (INC); \ if (tree_fits_shwi_p (inc)) \ - (TO).constant += tree_low_cst (inc, 0); \ + (TO).constant += tree_to_shwi (inc); \ else if ((TO).var == 0) \ (TO).var = fold_convert (ssizetype, inc); \ else \ @@ -107,7 +107,7 @@ do { \ do { \ tree dec = (DEC); \ if (tree_fits_shwi_p (dec)) \ - (TO).constant -= tree_low_cst (dec, 0); \ + (TO).constant -= tree_to_shwi (dec); \ else if ((TO).var == 0) \ (TO).var = size_binop (MINUS_EXPR, ssize_int (0), \ fold_convert (ssizetype, dec)); \ diff --git a/gcc/fold-const.c b/gcc/fold-const.c index e51b2f99b99..46c66d36948 100644 --- a/gcc/fold-const.c +++ b/gcc/fold-const.c @@ -3421,7 +3421,7 @@ make_bit_field_ref (location_t loc, tree inner, tree type, if ((INTEGRAL_TYPE_P (TREE_TYPE (inner)) || POINTER_TYPE_P (TREE_TYPE (inner))) && tree_fits_shwi_p (size) - && tree_low_cst (size, 0) == bitsize) + && tree_to_shwi (size) == bitsize) return fold_convert_loc (loc, type, inner); } @@ -7490,7 +7490,7 @@ native_encode_string (const_tree expr, unsigned char *ptr, int len) || GET_MODE_BITSIZE (TYPE_MODE (TREE_TYPE (type))) != BITS_PER_UNIT || !tree_fits_shwi_p (TYPE_SIZE_UNIT (type))) return 0; - total_bytes = tree_low_cst (TYPE_SIZE_UNIT (type), 0); + total_bytes = tree_to_shwi (TYPE_SIZE_UNIT (type)); if (total_bytes > len) return 0; if (TREE_STRING_LENGTH (expr) < total_bytes) @@ -16706,9 +16706,9 @@ fold_indirect_ref_1 (location_t loc, tree type, tree op0) if (TREE_CODE (op00type) == VECTOR_TYPE && type == TREE_TYPE (op00type)) { - HOST_WIDE_INT offset = tree_low_cst (op01, 0); + HOST_WIDE_INT offset = tree_to_shwi (op01); tree part_width = TYPE_SIZE (type); - unsigned HOST_WIDE_INT part_widthi = tree_low_cst (part_width, 0)/BITS_PER_UNIT; + unsigned HOST_WIDE_INT part_widthi = tree_to_shwi (part_width)/BITS_PER_UNIT; unsigned HOST_WIDE_INT indexi = offset * BITS_PER_UNIT; tree index = bitsize_int (indexi); diff --git a/gcc/gimple-fold.c b/gcc/gimple-fold.c index c842dec5d1e..a28be3333ac 100644 --- a/gcc/gimple-fold.c +++ b/gcc/gimple-fold.c @@ -3406,7 +3406,7 @@ gimple_fold_indirect_ref (tree t) unsigned HOST_WIDE_INT offset = tree_low_cst (off, 1); tree part_width = TYPE_SIZE (type); unsigned HOST_WIDE_INT part_widthi - = tree_low_cst (part_width, 0) / BITS_PER_UNIT; + = tree_to_shwi (part_width) / BITS_PER_UNIT; unsigned HOST_WIDE_INT indexi = offset * BITS_PER_UNIT; tree index = bitsize_int (indexi); if (offset / part_widthi diff --git a/gcc/go/ChangeLog b/gcc/go/ChangeLog index 63460043067..6f6b53e58a0 100644 --- a/gcc/go/ChangeLog +++ b/gcc/go/ChangeLog @@ -1,5 +1,10 @@ 2013-11-18 Richard Sandiford <rdsandiford@googlemail.com> + * gofrontend/expressions.cc: Replace tree_low_cst (..., 0) with + tree_to_shwi throughout. + +2013-11-18 Richard Sandiford <rdsandiford@googlemail.com> + * gofrontend/expressions.cc: Replace host_integerp (..., 0) with tree_fits_shwi_p throughout. diff --git a/gcc/go/gofrontend/expressions.cc b/gcc/go/gofrontend/expressions.cc index ca1bb98f9ff..823c5e1a4c8 100644 --- a/gcc/go/gofrontend/expressions.cc +++ b/gcc/go/gofrontend/expressions.cc @@ -3345,7 +3345,7 @@ Type_conversion_expression::do_get_tree(Translate_context* context) expr_tree = fold_convert(int_type_tree, expr_tree); if (tree_fits_shwi_p (expr_tree)) { - HOST_WIDE_INT intval = tree_low_cst(expr_tree, 0); + HOST_WIDE_INT intval = tree_to_shwi (expr_tree); std::string s; Lex::append_char(intval, true, &s, this->location()); Expression* se = Expression::make_string(s, this->location()); diff --git a/gcc/godump.c b/gcc/godump.c index 9699559c151..4f2d82a4e1d 100644 --- a/gcc/godump.c +++ b/gcc/godump.c @@ -733,7 +733,7 @@ go_format_type (struct godump_container *container, tree type, char buf[100]; snprintf (buf, sizeof buf, HOST_WIDE_INT_PRINT_DEC "+1", - tree_low_cst (TYPE_MAX_VALUE (TYPE_DOMAIN (type)), 0)); + tree_to_shwi (TYPE_MAX_VALUE (TYPE_DOMAIN (type)))); obstack_grow (ob, buf, strlen (buf)); } obstack_1grow (ob, ']'); @@ -983,7 +983,7 @@ go_output_typedef (struct godump_container *container, tree decl) if (tree_fits_shwi_p (TREE_VALUE (element))) snprintf (buf, sizeof buf, HOST_WIDE_INT_PRINT_DEC, - tree_low_cst (TREE_VALUE (element), 0)); + tree_to_shwi (TREE_VALUE (element))); else if (tree_fits_uhwi_p (TREE_VALUE (element))) snprintf (buf, sizeof buf, HOST_WIDE_INT_PRINT_UNSIGNED, ((unsigned HOST_WIDE_INT) diff --git a/gcc/ipa-prop.c b/gcc/ipa-prop.c index 5857f1a3f0f..f065370c881 100644 --- a/gcc/ipa-prop.c +++ b/gcc/ipa-prop.c @@ -4610,7 +4610,7 @@ ipcp_transform_function (struct cgraph_node *node) break; if (!v || v->by_ref != by_ref - || tree_low_cst (TYPE_SIZE (TREE_TYPE (v->value)), 0) != size) + || tree_to_shwi (TYPE_SIZE (TREE_TYPE (v->value))) != size) continue; gcc_checking_assert (is_gimple_ip_invariant (v->value)); diff --git a/gcc/java/ChangeLog b/gcc/java/ChangeLog index 01d50f2c111..3ffa76da8c2 100644 --- a/gcc/java/ChangeLog +++ b/gcc/java/ChangeLog @@ -1,5 +1,10 @@ 2013-11-18 Richard Sandiford <rdsandiford@googlemail.com> + * class.c, expr.c: Replace tree_low_cst (..., 0) with tree_to_shwi + throughout. + +2013-11-18 Richard Sandiford <rdsandiford@googlemail.com> + * class.c, expr.c: Replace host_integerp (..., 0) with tree_fits_shwi_p throughout. diff --git a/gcc/java/class.c b/gcc/java/class.c index 5eb245e5376..251873e0811 100644 --- a/gcc/java/class.c +++ b/gcc/java/class.c @@ -1576,14 +1576,14 @@ get_dispatch_vector (tree type) HOST_WIDE_INT i; tree method; tree super = CLASSTYPE_SUPER (type); - HOST_WIDE_INT nvirtuals = tree_low_cst (TYPE_NVIRTUALS (type), 0); + HOST_WIDE_INT nvirtuals = tree_to_shwi (TYPE_NVIRTUALS (type)); vtable = make_tree_vec (nvirtuals); TYPE_VTABLE (type) = vtable; if (super != NULL_TREE) { tree super_vtable = get_dispatch_vector (super); - for (i = tree_low_cst (TYPE_NVIRTUALS (super), 0); --i >= 0; ) + for (i = tree_to_shwi (TYPE_NVIRTUALS (super)); --i >= 0; ) TREE_VEC_ELT (vtable, i) = TREE_VEC_ELT (super_vtable, i); } @@ -1593,7 +1593,7 @@ get_dispatch_vector (tree type) tree method_index = get_method_index (method); if (method_index != NULL_TREE && tree_fits_shwi_p (method_index)) - TREE_VEC_ELT (vtable, tree_low_cst (method_index, 0)) = method; + TREE_VEC_ELT (vtable, tree_to_shwi (method_index)) = method; } } diff --git a/gcc/java/expr.c b/gcc/java/expr.c index 0720065717c..6dc00c6fc5d 100644 --- a/gcc/java/expr.c +++ b/gcc/java/expr.c @@ -1050,7 +1050,7 @@ build_newarray (int atype_value, tree length) tree type = build_java_array_type (prim_type, tree_fits_shwi_p (length) == INTEGER_CST - ? tree_low_cst (length, 0) : -1); + ? tree_to_shwi (length) : -1); /* Pass a reference to the primitive type class and save the runtime some work. */ @@ -1070,7 +1070,7 @@ build_anewarray (tree class_type, tree length) tree type = build_java_array_type (class_type, tree_fits_shwi_p (length) - ? tree_low_cst (length, 0) : -1); + ? tree_to_shwi (length) : -1); return build_call_nary (promote_type (type), build_address_of (soft_anewarray_node), diff --git a/gcc/objc/ChangeLog b/gcc/objc/ChangeLog index 8777efba152..42a4600f519 100644 --- a/gcc/objc/ChangeLog +++ b/gcc/objc/ChangeLog @@ -1,3 +1,8 @@ +2013-11-18 Richard Sandiford <rdsandiford@googlemail.com> + + * objc-next-runtime-abi-02.c: Replace tree_low_cst (..., 0) with + tree_to_shwi throughout. + 2013-11-14 Andrew MacLeod <amacleod@redhat.com> * objc-act.c: Include only gimplify.h and gimple.h as needed. diff --git a/gcc/objc/objc-next-runtime-abi-02.c b/gcc/objc/objc-next-runtime-abi-02.c index 09600068ca6..885047705d4 100644 --- a/gcc/objc/objc-next-runtime-abi-02.c +++ b/gcc/objc/objc-next-runtime-abi-02.c @@ -3267,7 +3267,7 @@ generate_v2_class_structs (struct imp_entry *impent) if (field && TREE_CODE (field) == FIELD_DECL) instanceSize = int_byte_position (field) * BITS_PER_UNIT - + tree_low_cst (DECL_SIZE (field), 0); + + tree_to_shwi (DECL_SIZE (field)); else instanceSize = 0; instanceSize /= BITS_PER_UNIT; diff --git a/gcc/omp-low.c b/gcc/omp-low.c index 9bb5b0b13bd..e18f9ff772d 100644 --- a/gcc/omp-low.c +++ b/gcc/omp-low.c @@ -2291,7 +2291,7 @@ check_omp_nesting_restrictions (gimple stmt, omp_context *ctx) return false; } switch (tree_fits_shwi_p (gimple_call_arg (stmt, 0)) - ? tree_low_cst (gimple_call_arg (stmt, 0), 0) + ? tree_to_shwi (gimple_call_arg (stmt, 0)) : 0) { case 1: @@ -2954,7 +2954,7 @@ lower_rec_simd_input_clauses (tree new_var, omp_context *ctx, int &max_vf, OMP_CLAUSE_SAFELEN); if (c && compare_tree_int (OMP_CLAUSE_SAFELEN_EXPR (c), max_vf) == -1) - max_vf = tree_low_cst (OMP_CLAUSE_SAFELEN_EXPR (c), 0); + max_vf = tree_to_shwi (OMP_CLAUSE_SAFELEN_EXPR (c)); } if (max_vf > 1) { diff --git a/gcc/predict.c b/gcc/predict.c index 251faa87292..95d3774d697 100644 --- a/gcc/predict.c +++ b/gcc/predict.c @@ -1054,14 +1054,14 @@ strips_small_constant (tree t1, tree t2) else if (TREE_CODE (t1) == SSA_NAME) ret = t1; else if (tree_fits_shwi_p (t1)) - value = tree_low_cst (t1, 0); + value = tree_to_shwi (t1); else return NULL; if (!t2) return ret; else if (tree_fits_shwi_p (t2)) - value = tree_low_cst (t2, 0); + value = tree_to_shwi (t2); else if (TREE_CODE (t2) == SSA_NAME) { if (ret) @@ -1674,7 +1674,7 @@ predict_loops (void) if (loop_bound_var) predict_iv_comparison (loop, bb, loop_bound_var, loop_iv_base, loop_bound_code, - tree_low_cst (loop_bound_step, 0)); + tree_to_shwi (loop_bound_step)); } /* Free basic blocks from get_loop_body. */ diff --git a/gcc/rtlanal.c b/gcc/rtlanal.c index 4f1e4ee5826..0cd0c7e1a74 100644 --- a/gcc/rtlanal.c +++ b/gcc/rtlanal.c @@ -280,7 +280,7 @@ rtx_addr_can_trap_p_1 (const_rtx x, HOST_WIDE_INT offset, HOST_WIDE_INT size, decl_size = -1; else if (DECL_P (decl) && DECL_SIZE_UNIT (decl)) decl_size = (tree_fits_shwi_p (DECL_SIZE_UNIT (decl)) - ? tree_low_cst (DECL_SIZE_UNIT (decl), 0) + ? tree_to_shwi (DECL_SIZE_UNIT (decl)) : -1); else if (TREE_CODE (decl) == STRING_CST) decl_size = TREE_STRING_LENGTH (decl); diff --git a/gcc/sdbout.c b/gcc/sdbout.c index 26ed6aa974e..6706789331f 100644 --- a/gcc/sdbout.c +++ b/gcc/sdbout.c @@ -537,8 +537,8 @@ plain_type_1 (tree type, int level) && TYPE_MAX_VALUE (TYPE_DOMAIN (type)) != 0 && tree_fits_shwi_p (TYPE_MAX_VALUE (TYPE_DOMAIN (type))) && tree_fits_shwi_p (TYPE_MIN_VALUE (TYPE_DOMAIN (type))) - ? (tree_low_cst (TYPE_MAX_VALUE (TYPE_DOMAIN (type)), 0) - - tree_low_cst (TYPE_MIN_VALUE (TYPE_DOMAIN (type)), 0) + 1) + ? (tree_to_shwi (TYPE_MAX_VALUE (TYPE_DOMAIN (type))) + - tree_to_shwi (TYPE_MIN_VALUE (TYPE_DOMAIN (type))) + 1) : 0); return PUSH_DERIVED_LEVEL (DT_ARY, m); @@ -1134,7 +1134,7 @@ sdbout_one_type (tree type) continue; PUT_SDB_DEF (IDENTIFIER_POINTER (child_type_name)); - PUT_SDB_INT_VAL (tree_low_cst (BINFO_OFFSET (child), 0)); + PUT_SDB_INT_VAL (tree_to_shwi (BINFO_OFFSET (child))); PUT_SDB_SCL (member_scl); sdbout_type (BINFO_TYPE (child)); PUT_SDB_ENDEF; @@ -1155,7 +1155,7 @@ sdbout_one_type (tree type) if (tree_fits_shwi_p (value)) { PUT_SDB_DEF (IDENTIFIER_POINTER (TREE_PURPOSE (tem))); - PUT_SDB_INT_VAL (tree_low_cst (value, 0)); + PUT_SDB_INT_VAL (tree_to_shwi (value)); PUT_SDB_SCL (C_MOE); PUT_SDB_TYPE (T_MOE); PUT_SDB_ENDEF; diff --git a/gcc/stmt.c b/gcc/stmt.c index ef4791b446d..04d9586697b 100644 --- a/gcc/stmt.c +++ b/gcc/stmt.c @@ -776,8 +776,8 @@ dump_case_nodes (FILE *f, struct case_node *root, dump_case_nodes (f, root->left, indent_step, indent_level); - low = tree_low_cst (root->low, 0); - high = tree_low_cst (root->high, 0); + low = tree_to_shwi (root->low); + high = tree_to_shwi (root->high); fputs (";; ", f); if (high == low) @@ -1019,7 +1019,7 @@ emit_case_dispatch_table (tree index_expr, tree index_type, /* Get table of labels to jump to, in order of case index. */ - ncases = tree_low_cst (range, 0) + 1; + ncases = tree_to_shwi (range) + 1; labelvec = XALLOCAVEC (rtx, ncases); memset (labelvec, 0, ncases * sizeof (rtx)); diff --git a/gcc/stor-layout.c b/gcc/stor-layout.c index 44a5f2bf8e1..48c6c783a14 100644 --- a/gcc/stor-layout.c +++ b/gcc/stor-layout.c @@ -1201,8 +1201,8 @@ place_field (record_layout_info rli, tree field) unsigned int type_align = TYPE_ALIGN (type); tree dsize = DECL_SIZE (field); HOST_WIDE_INT field_size = tree_low_cst (dsize, 1); - HOST_WIDE_INT offset = tree_low_cst (rli->offset, 0); - HOST_WIDE_INT bit_offset = tree_low_cst (rli->bitpos, 0); + HOST_WIDE_INT offset = tree_to_shwi (rli->offset); + HOST_WIDE_INT bit_offset = tree_to_shwi (rli->bitpos); #ifdef ADJUST_FIELD_ALIGN if (! TYPE_USER_ALIGN (type)) @@ -1245,8 +1245,8 @@ place_field (record_layout_info rli, tree field) unsigned int type_align = TYPE_ALIGN (type); tree dsize = DECL_SIZE (field); HOST_WIDE_INT field_size = tree_low_cst (dsize, 1); - HOST_WIDE_INT offset = tree_low_cst (rli->offset, 0); - HOST_WIDE_INT bit_offset = tree_low_cst (rli->bitpos, 0); + HOST_WIDE_INT offset = tree_to_shwi (rli->offset); + HOST_WIDE_INT bit_offset = tree_to_shwi (rli->bitpos); #ifdef ADJUST_FIELD_ALIGN if (! TYPE_USER_ALIGN (type)) diff --git a/gcc/targhooks.c b/gcc/targhooks.c index 55ab7d07b67..cddc439546f 100644 --- a/gcc/targhooks.c +++ b/gcc/targhooks.c @@ -994,7 +994,7 @@ tree default_mangle_decl_assembler_name (tree decl ATTRIBUTE_UNUSED, HOST_WIDE_INT default_vector_alignment (const_tree type) { - return tree_low_cst (TYPE_SIZE (type), 0); + return tree_to_shwi (TYPE_SIZE (type)); } bool diff --git a/gcc/tree-cfg.c b/gcc/tree-cfg.c index e8a06ccea67..dbcf20ca2b8 100644 --- a/gcc/tree-cfg.c +++ b/gcc/tree-cfg.c @@ -282,7 +282,7 @@ replace_loop_annotate () if (!gimple_call_internal_p (stmt) || gimple_call_internal_fn (stmt) != IFN_ANNOTATE) continue; - if ((annot_expr_kind) tree_low_cst (gimple_call_arg (stmt, 1), 0) + if ((annot_expr_kind) tree_to_shwi (gimple_call_arg (stmt, 1)) != annot_expr_ivdep_kind) continue; stmt = gimple_build_assign (gimple_call_lhs (stmt), @@ -307,7 +307,7 @@ replace_loop_annotate () if (!gimple_call_internal_p (stmt) || gimple_call_internal_fn (stmt) != IFN_ANNOTATE) continue; - if ((annot_expr_kind) tree_low_cst (gimple_call_arg (stmt, 1), 0) + if ((annot_expr_kind) tree_to_shwi (gimple_call_arg (stmt, 1)) != annot_expr_ivdep_kind) continue; warning_at (gimple_location (stmt), 0, "ignoring %<GCC ivdep%> " @@ -6273,7 +6273,7 @@ move_stmt_eh_region_tree_nr (tree old_t_nr, struct move_stmt_d *p) { int old_nr, new_nr; - old_nr = tree_low_cst (old_t_nr, 0); + old_nr = tree_to_shwi (old_t_nr); new_nr = move_stmt_eh_region_nr (old_nr, p); return build_int_cst (integer_type_node, new_nr); diff --git a/gcc/tree-data-ref.c b/gcc/tree-data-ref.c index c0ee654561c..dde08bb47eb 100644 --- a/gcc/tree-data-ref.c +++ b/gcc/tree-data-ref.c @@ -2840,14 +2840,14 @@ gcd_of_steps_may_divide_p (const_tree chrec, const_tree cst) if (!tree_fits_shwi_p (cst)) return true; - val = tree_low_cst (cst, 0); + val = tree_to_shwi (cst); while (TREE_CODE (chrec) == POLYNOMIAL_CHREC) { step = CHREC_RIGHT (chrec); if (!tree_fits_shwi_p (step)) return true; - cd = gcd (cd, tree_low_cst (step, 0)); + cd = gcd (cd, tree_to_shwi (step)); chrec = CHREC_LEFT (chrec); } diff --git a/gcc/tree-inline.c b/gcc/tree-inline.c index 918a25c1c3b..caecbf27ee7 100644 --- a/gcc/tree-inline.c +++ b/gcc/tree-inline.c @@ -1221,7 +1221,7 @@ remap_eh_region_tree_nr (tree old_t_nr, copy_body_data *id) { int old_nr, new_nr; - old_nr = tree_low_cst (old_t_nr, 0); + old_nr = tree_to_shwi (old_t_nr); new_nr = remap_eh_region_nr (old_nr, id); return build_int_cst (integer_type_node, new_nr); diff --git a/gcc/tree-ssa-forwprop.c b/gcc/tree-ssa-forwprop.c index e8b4f73ee62..af84ad86cd0 100644 --- a/gcc/tree-ssa-forwprop.c +++ b/gcc/tree-ssa-forwprop.c @@ -1631,9 +1631,9 @@ simplify_builtin_call (gimple_stmt_iterator *gsi_p, tree callee2) TREE_STRING_POINTER (str1) + tree_low_cst (off1, 1), tree_low_cst (len1, 1)); else - src_buf[0] = tree_low_cst (src1, 0); + src_buf[0] = tree_to_shwi (src1); memset (src_buf + tree_low_cst (diff, 1), - tree_low_cst (val2, 0), tree_low_cst (len2, 1)); + tree_to_shwi (val2), tree_low_cst (len2, 1)); src_buf[src_len] = '\0'; /* Neither builtin_strncpy_read_str nor builtin_memcpy_read_str handle embedded '\0's. */ @@ -2355,7 +2355,7 @@ simplify_rotate (gimple_stmt_iterator *gsi) with optional casts. */ if (cdef_code[i] == MINUS_EXPR && tree_fits_shwi_p (cdef_arg1[i]) - && tree_low_cst (cdef_arg1[i], 0) == TYPE_PRECISION (rtype) + && tree_to_shwi (cdef_arg1[i]) == TYPE_PRECISION (rtype) && TREE_CODE (cdef_arg2[i]) == SSA_NAME) { tree tem; @@ -2387,7 +2387,7 @@ simplify_rotate (gimple_stmt_iterator *gsi) One shift count is Y and the other (-Y) & (B - 1). */ else if (cdef_code[i] == BIT_AND_EXPR && tree_fits_shwi_p (cdef_arg2[i]) - && tree_low_cst (cdef_arg2[i], 0) + && tree_to_shwi (cdef_arg2[i]) == TYPE_PRECISION (rtype) - 1 && TREE_CODE (cdef_arg1[i]) == SSA_NAME && gimple_assign_rhs_code (stmt) == BIT_IOR_EXPR) diff --git a/gcc/tree-ssa-loop-prefetch.c b/gcc/tree-ssa-loop-prefetch.c index 426f4bcb4e7..94e17e53437 100644 --- a/gcc/tree-ssa-loop-prefetch.c +++ b/gcc/tree-ssa-loop-prefetch.c @@ -1459,7 +1459,7 @@ add_subscript_strides (tree access_fn, unsigned stride, continue; if (tree_fits_shwi_p (step)) - astep = tree_low_cst (step, 0); + astep = tree_to_shwi (step); else astep = L1_CACHE_LINE_SIZE; diff --git a/gcc/tree-ssa-phiopt.c b/gcc/tree-ssa-phiopt.c index 666a9155e26..dd0ebc170ea 100644 --- a/gcc/tree-ssa-phiopt.c +++ b/gcc/tree-ssa-phiopt.c @@ -1375,7 +1375,7 @@ add_or_mark_expr (basic_block bb, tree exp, map.phase = 0; map.bb = 0; map.store = store; - map.offset = tree_low_cst (TREE_OPERAND (exp, 1), 0); + map.offset = tree_to_shwi (TREE_OPERAND (exp, 1)); map.size = size; slot = seen_ssa_names.find_slot (&map, INSERT); diff --git a/gcc/tree-ssa-sccvn.c b/gcc/tree-ssa-sccvn.c index a49a282a69f..8742e267ddb 100644 --- a/gcc/tree-ssa-sccvn.c +++ b/gcc/tree-ssa-sccvn.c @@ -995,7 +995,7 @@ ao_ref_init_from_vn_reference (ao_ref *ref, /* And now the usual component-reference style ops. */ case BIT_FIELD_REF: - offset += tree_low_cst (op->op1, 0); + offset += tree_to_shwi (op->op1); break; case COMPONENT_REF: diff --git a/gcc/tree-ssa-strlen.c b/gcc/tree-ssa-strlen.c index bacc59fd0e7..842db122d77 100644 --- a/gcc/tree-ssa-strlen.c +++ b/gcc/tree-ssa-strlen.c @@ -218,7 +218,7 @@ get_stridx (tree exp) && (o == NULL_TREE || tree_fits_shwi_p (o)) && TREE_STRING_LENGTH (s) > 0) { - HOST_WIDE_INT offset = o ? tree_low_cst (o, 0) : 0; + HOST_WIDE_INT offset = o ? tree_to_shwi (o) : 0; const char *p = TREE_STRING_POINTER (s); int max = TREE_STRING_LENGTH (s) - 1; diff --git a/gcc/tree-stdarg.c b/gcc/tree-stdarg.c index e39734730c4..66655d818f2 100644 --- a/gcc/tree-stdarg.c +++ b/gcc/tree-stdarg.c @@ -596,7 +596,7 @@ check_all_va_list_escapes (struct stdarg_info *si) tree access_size = TYPE_SIZE_UNIT (TREE_TYPE (rhs)); gpr_size = si->offsets[SSA_NAME_VERSION (use)] - + tree_low_cst (TREE_OPERAND (rhs, 1), 0) + + tree_to_shwi (TREE_OPERAND (rhs, 1)) + tree_low_cst (access_size, 1); if (gpr_size >= VA_LIST_MAX_GPR_SIZE) cfun->va_list_gpr_size = VA_LIST_MAX_GPR_SIZE; diff --git a/gcc/tree-vect-data-refs.c b/gcc/tree-vect-data-refs.c index c4246079a25..83d1f4546bd 100644 --- a/gcc/tree-vect-data-refs.c +++ b/gcc/tree-vect-data-refs.c @@ -3071,7 +3071,7 @@ vect_check_gather (gimple stmt, loop_vec_info loop_vinfo, tree *basep, case MULT_EXPR: if (scale == 1 && tree_fits_shwi_p (op1)) { - scale = tree_low_cst (op1, 0); + scale = tree_to_shwi (op1); off = op0; continue; } diff --git a/gcc/tree-vect-patterns.c b/gcc/tree-vect-patterns.c index a0d366ad211..17411cd5ff7 100644 --- a/gcc/tree-vect-patterns.c +++ b/gcc/tree-vect-patterns.c @@ -784,7 +784,7 @@ vect_recog_pow_pattern (vec<gimple> *stmts, tree *type_in, /* Catch squaring. */ if ((tree_fits_shwi_p (exp) - && tree_low_cst (exp, 0) == 2) + && tree_to_shwi (exp) == 2) || (TREE_CODE (exp) == REAL_CST && REAL_VALUES_EQUAL (TREE_REAL_CST (exp), dconst2))) { diff --git a/gcc/tree.c b/gcc/tree.c index 124e5312e31..4fc92e848a9 100644 --- a/gcc/tree.c +++ b/gcc/tree.c @@ -2709,7 +2709,7 @@ bit_position (const_tree field) HOST_WIDE_INT int_bit_position (const_tree field) { - return tree_low_cst (bit_position (field), 0); + return tree_to_shwi (bit_position (field)); } /* Return the byte position of FIELD, in bytes from the start of the record. @@ -2729,7 +2729,7 @@ byte_position (const_tree field) HOST_WIDE_INT int_byte_position (const_tree field) { - return tree_low_cst (byte_position (field), 0); + return tree_to_shwi (byte_position (field)); } /* Return the strictest alignment, in bits, that T is known to have. */ diff --git a/gcc/tree.h b/gcc/tree.h index ae30deafbba..e61f6d403f7 100644 --- a/gcc/tree.h +++ b/gcc/tree.h @@ -604,7 +604,7 @@ extern void omp_clause_range_check_failed (const_tree, const char *, int, #define SET_PREDICT_EXPR_OUTCOME(NODE, OUTCOME) \ (PREDICT_EXPR_CHECK (NODE)->base.addressable_flag = (int) OUTCOME) #define PREDICT_EXPR_PREDICTOR(NODE) \ - ((enum br_predictor)tree_low_cst (TREE_OPERAND (PREDICT_EXPR_CHECK (NODE), 0), 0)) + ((enum br_predictor)tree_to_shwi (TREE_OPERAND (PREDICT_EXPR_CHECK (NODE), 0))) /* In a VAR_DECL, nonzero means allocate static storage. In a FUNCTION_DECL, nonzero if function has been defined. diff --git a/gcc/var-tracking.c b/gcc/var-tracking.c index e07cbe6b55a..edffd8b024c 100644 --- a/gcc/var-tracking.c +++ b/gcc/var-tracking.c @@ -6292,7 +6292,7 @@ prepare_call_arguments (basic_block bb, rtx insn) initial = DECL_INITIAL (SYMBOL_REF_DECL (l->loc)); if (tree_fits_shwi_p (initial)) { - item = GEN_INT (tree_low_cst (initial, 0)); + item = GEN_INT (tree_to_shwi (initial)); item = gen_rtx_CONCAT (indmode, mem, item); call_arguments = gen_rtx_EXPR_LIST (VOIDmode, item, @@ -6371,7 +6371,7 @@ prepare_call_arguments (basic_block bb, rtx insn) = TYPE_MODE (TREE_TYPE (OBJ_TYPE_REF_EXPR (obj_type_ref))); rtx clobbered = gen_rtx_MEM (mode, this_arg); HOST_WIDE_INT token - = tree_low_cst (OBJ_TYPE_REF_TOKEN (obj_type_ref), 0); + = tree_to_shwi (OBJ_TYPE_REF_TOKEN (obj_type_ref)); if (token) clobbered = plus_constant (mode, clobbered, token * GET_MODE_SIZE (mode)); diff --git a/gcc/varasm.c b/gcc/varasm.c index d7930631f88..fc519f34d95 100644 --- a/gcc/varasm.c +++ b/gcc/varasm.c @@ -2718,7 +2718,7 @@ decode_addr_const (tree exp, struct addr_const *value) || TREE_CODE (target) == ARRAY_RANGE_REF) { offset += (tree_low_cst (TYPE_SIZE_UNIT (TREE_TYPE (target)), 1) - * tree_low_cst (TREE_OPERAND (target, 1), 0)); + * tree_to_shwi (TREE_OPERAND (target, 1))); target = TREE_OPERAND (target, 0); } else if (TREE_CODE (target) == MEM_REF @@ -4664,7 +4664,7 @@ output_constant (tree exp, unsigned HOST_WIDE_INT size, unsigned int align) if (TREE_CODE (exp) == FDESC_EXPR) { #ifdef ASM_OUTPUT_FDESC - HOST_WIDE_INT part = tree_low_cst (TREE_OPERAND (exp, 1), 0); + HOST_WIDE_INT part = tree_to_shwi (TREE_OPERAND (exp, 1)); tree decl = TREE_OPERAND (exp, 0); ASM_OUTPUT_FDESC (asm_out_file, decl, part); #else @@ -4833,9 +4833,9 @@ output_constructor_array_range (oc_local_state *local) = int_size_in_bytes (TREE_TYPE (local->type)); HOST_WIDE_INT lo_index - = tree_low_cst (TREE_OPERAND (local->index, 0), 0); + = tree_to_shwi (TREE_OPERAND (local->index, 0)); HOST_WIDE_INT hi_index - = tree_low_cst (TREE_OPERAND (local->index, 1), 0); + = tree_to_shwi (TREE_OPERAND (local->index, 1)); HOST_WIDE_INT index; unsigned int align2 @@ -4958,8 +4958,8 @@ output_constructor_bitfield (oc_local_state *local, unsigned int bit_offset) HOST_WIDE_INT relative_index = (!local->field ? (local->index - ? (tree_low_cst (local->index, 0) - - tree_low_cst (local->min_index, 0)) + ? (tree_to_shwi (local->index) + - tree_to_shwi (local->min_index)) : local->last_relative_index + 1) : 0); |