c-common.c, [...]: Replace tree_low_cst (..., 0) with tree_to_shwi throughout.

gcc/c-family/
	* c-common.c, c-format.c, c-omp.c, c-pretty-print.c: Replace
	tree_low_cst (..., 0) with tree_to_shwi throughout.

gcc/c/
	* c-parser.c: Replace tree_low_cst (..., 0) with tree_to_shwi
	throughout.

gcc/cp/
	* class.c, dump.c, error.c, init.c, method.c, parser.c, semantics.c:
	Replace tree_low_cst (..., 0) with tree_to_shwi throughout.

gcc/go/
	* gofrontend/expressions.cc: Replace tree_low_cst (..., 0) with
	tree_to_shwi throughout.

gcc/java/
	* class.c, expr.c: Replace tree_low_cst (..., 0) with tree_to_shwi
	throughout.

gcc/objc/
	* objc-next-runtime-abi-02.c: Replace tree_low_cst (..., 0) with
	tree_to_shwi throughout.

gcc/
	* 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.

From-SVN: r204959
This commit is contained in:
Richard Sandiford 2013-11-18 14:52:03 +00:00 committed by Richard Sandiford
parent 7c5efc1206
commit 9439e9a1a4
65 changed files with 196 additions and 152 deletions

View File

@ -1,3 +1,17 @@
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.

View File

@ -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

View File

@ -1,3 +1,8 @@
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

View File

@ -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));

View File

@ -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

View File

@ -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++)

View File

@ -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);

View File

@ -1,3 +1,8 @@
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

View File

@ -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);

View File

@ -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));

View File

@ -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);
}

View File

@ -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)

View File

@ -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);

View File

@ -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;
}

View File

@ -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,

View File

@ -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;
}

View File

@ -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;
}

View File

@ -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),

View File

@ -1,3 +1,8 @@
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

View File

@ -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));

View File

@ -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;

View File

@ -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. */

View File

@ -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. */

View File

@ -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

View File

@ -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);

View File

@ -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);

View File

@ -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);

View File

@ -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);
}

View File

@ -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];

View File

@ -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

View File

@ -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)))));
}

View File

@ -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)); \

View File

@ -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);

View File

@ -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

View File

@ -1,3 +1,8 @@
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

View File

@ -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());

View File

@ -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)

View File

@ -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));

View File

@ -1,3 +1,8 @@
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

View File

@ -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;
}
}

View File

@ -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),

View File

@ -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.

View File

@ -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;

View File

@ -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)
{

View File

@ -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. */

View File

@ -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);

View File

@ -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;

View File

@ -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));

View File

@ -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))

View File

@ -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

View File

@ -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);

View File

@ -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);
}

View File

@ -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);

View File

@ -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)

View File

@ -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;

View File

@ -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);

View File

@ -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:

View File

@ -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;

View File

@ -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;

View File

@ -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;
}

View File

@ -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)))
{

View File

@ -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. */

View File

@ -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.

View File

@ -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));

View File

@ -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);