From: rsandifo Date: Sun, 10 Nov 2013 10:12:12 +0000 (+0000) Subject: Remove some wide_int constructor calls. Make more use of wi::. X-Git-Url: http://git.ipfire.org/?a=commitdiff_plain;h=6da74b219b7842cf33633f0bd037eef085d9388f;p=thirdparty%2Fgcc.git Remove some wide_int constructor calls. Make more use of wi::. git-svn-id: svn+ssh://gcc.gnu.org/svn/gcc/branches/wide-int@204628 138bc75d-0d04-0410-961f-82ee72b054a4 --- diff --git a/gcc/builtins.c b/gcc/builtins.c index fee90a0c950c..c05a3896b5bf 100644 --- a/gcc/builtins.c +++ b/gcc/builtins.c @@ -12512,7 +12512,6 @@ fold_builtin_object_size (tree ptr, tree ost) { unsigned HOST_WIDE_INT bytes; int object_size_type; - int precision = TYPE_PRECISION (TREE_TYPE (ptr)); if (!validate_arg (ptr, POINTER_TYPE) || !validate_arg (ost, INTEGER_TYPE)) @@ -12535,11 +12534,9 @@ fold_builtin_object_size (tree ptr, tree ost) if (TREE_CODE (ptr) == ADDR_EXPR) { - wide_int wbytes - = wi::uhwi (compute_builtin_object_size (ptr, object_size_type), - precision); - if (wi::fits_to_tree_p (wbytes, size_type_node)) - return wide_int_to_tree (size_type_node, wbytes); + bytes = compute_builtin_object_size (ptr, object_size_type); + if (wi::fits_to_tree_p (bytes, size_type_node)) + return build_int_cstu (size_type_node, bytes); } else if (TREE_CODE (ptr) == SSA_NAME) { @@ -12547,10 +12544,9 @@ fold_builtin_object_size (tree ptr, tree ost) later. Maybe subsequent passes will help determining it. */ bytes = compute_builtin_object_size (ptr, object_size_type); - wide_int wbytes = wi::uhwi (bytes, precision); if (bytes != (unsigned HOST_WIDE_INT) (object_size_type < 2 ? -1 : 0) - && wi::fits_to_tree_p (wbytes, size_type_node)) - return wide_int_to_tree (size_type_node, wbytes); + && wi::fits_to_tree_p (bytes, size_type_node)) + return build_int_cstu (size_type_node, bytes); } return NULL_TREE; diff --git a/gcc/c-family/c-common.c b/gcc/c-family/c-common.c index 10d83b30870f..d83d971c87ff 100644 --- a/gcc/c-family/c-common.c +++ b/gcc/c-family/c-common.c @@ -7979,11 +7979,10 @@ handle_alloc_size_attribute (tree *node, tree ARG_UNUSED (name), tree args, for (; args; args = TREE_CHAIN (args)) { tree position = TREE_VALUE (args); - wide_int p; if (TREE_CODE (position) != INTEGER_CST - || wi::ltu_p (p = wide_int (position), 1) - || wi::gtu_p (p, arg_count)) + || wi::ltu_p (position, 1) + || wi::gtu_p (position, arg_count)) { warning (OPT_Wattributes, "alloc_size parameter outside range"); diff --git a/gcc/cp/decl.c b/gcc/cp/decl.c index 27eda06cc7fb..2040f8df2ca6 100644 --- a/gcc/cp/decl.c +++ b/gcc/cp/decl.c @@ -4805,8 +4805,7 @@ check_array_designated_initializer (constructor_elt *ce, if (TREE_CODE (ce->index) == INTEGER_CST) { /* A C99 designator is OK if it matches the current index. */ - if (tree_fits_uhwi_p (ce->index) - && tree_to_uhwi (ce->index) == index) + if (wi::eq_p (ce->index, index)) return true; else sorry ("non-trivial designated initializers not supported"); diff --git a/gcc/dwarf2out.c b/gcc/dwarf2out.c index 9c42217519b3..acee2000eaf5 100644 --- a/gcc/dwarf2out.c +++ b/gcc/dwarf2out.c @@ -16345,7 +16345,7 @@ add_bound_info (dw_die_ref subrange_die, enum dwarf_attribute bound_attr, tree b || (cst_fits_uhwi_p (bound) && wi::ges_p (bound, 0))) add_AT_unsigned (subrange_die, bound_attr, tree_to_hwi (bound)); else - add_AT_wide (subrange_die, bound_attr, wide_int (bound)); + add_AT_wide (subrange_die, bound_attr, bound); } break; @@ -17501,7 +17501,7 @@ gen_enumeration_type_die (tree type, dw_die_ref context_die) else /* Enumeration constants may be wider than HOST_WIDE_INT. Handle that here. */ - add_AT_wide (enum_die, DW_AT_const_value, wide_int (value)); + add_AT_wide (enum_die, DW_AT_const_value, value); } add_gnat_descriptive_type_attribute (type_die, type, context_die); diff --git a/gcc/godump.c b/gcc/godump.c index 4a088f946587..668a0bab6818 100644 --- a/gcc/godump.c +++ b/gcc/godump.c @@ -990,7 +990,7 @@ go_output_typedef (struct godump_container *container, tree decl) ((unsigned HOST_WIDE_INT) tree_to_uhwi (TREE_VALUE (element)))); else - print_hex (wide_int (element), buf); + print_hex (element, buf); mhval->value = xstrdup (buf); *slot = mhval; diff --git a/gcc/simplify-rtx.c b/gcc/simplify-rtx.c index 8ab4454138cc..fb1a27eefc89 100644 --- a/gcc/simplify-rtx.c +++ b/gcc/simplify-rtx.c @@ -2223,7 +2223,7 @@ simplify_binary_operation_1 (enum rtx_code code, enum machine_mode mode, else if (GET_CODE (rhs) == MULT && CONST_INT_P (XEXP (rhs, 1))) { - negcoeff1 = -wide_int (std::make_pair (XEXP (rhs, 1), mode)); + negcoeff1 = wi::neg (std::make_pair (XEXP (rhs, 1), mode)); rhs = XEXP (rhs, 0); } else if (GET_CODE (rhs) == ASHIFT diff --git a/gcc/tree-dump.c b/gcc/tree-dump.c index 08245d1982f0..0926452a825d 100644 --- a/gcc/tree-dump.c +++ b/gcc/tree-dump.c @@ -564,7 +564,7 @@ dequeue_and_dump (dump_info_p di) case INTEGER_CST: fprintf (di->stream, "int: "); - print_decs (wide_int (t), di->stream); + print_decs (t, di->stream); break; case STRING_CST: diff --git a/gcc/tree-ssa-address.c b/gcc/tree-ssa-address.c index cf210ccd9338..a6b32b8b8d61 100644 --- a/gcc/tree-ssa-address.c +++ b/gcc/tree-ssa-address.c @@ -200,7 +200,7 @@ addr_for_mem_ref (struct mem_address *addr, addr_space_t as, struct mem_addr_template *templ; if (addr->step && !integer_onep (addr->step)) - st = immed_wide_int_const (wide_int (addr->step), pointer_mode); + st = immed_wide_int_const (addr->step, pointer_mode); else st = NULL_RTX; diff --git a/gcc/tree-ssa-ccp.c b/gcc/tree-ssa-ccp.c index 3c6a233ed6b6..247e83a5dcab 100644 --- a/gcc/tree-ssa-ccp.c +++ b/gcc/tree-ssa-ccp.c @@ -890,8 +890,7 @@ ccp_finalize (void) } else { - widest_int nonzero_bits = val->mask; - nonzero_bits = nonzero_bits | wi::to_widest (val->value); + widest_int nonzero_bits = val->mask | wi::to_widest (val->value); nonzero_bits &= get_nonzero_bits (name); set_nonzero_bits (name, nonzero_bits); } diff --git a/gcc/tree-ssa-forwprop.c b/gcc/tree-ssa-forwprop.c index 5721861331a6..48b096cb2777 100644 --- a/gcc/tree-ssa-forwprop.c +++ b/gcc/tree-ssa-forwprop.c @@ -2785,7 +2785,7 @@ associate_pointerplus (gimple_stmt_iterator *gsi) if (gimple_assign_rhs1 (def_stmt) != ptr) return false; - algn = wide_int_to_tree (TREE_TYPE (ptr), ~wide_int (algn)); + algn = wide_int_to_tree (TREE_TYPE (ptr), wi::bit_not (algn)); gimple_assign_set_rhs_with_ops (gsi, BIT_AND_EXPR, ptr, algn); fold_stmt_inplace (gsi); update_stmt (stmt); diff --git a/gcc/tree-vrp.c b/gcc/tree-vrp.c index 3454140f67c6..e66970b51039 100644 --- a/gcc/tree-vrp.c +++ b/gcc/tree-vrp.c @@ -2028,16 +2028,12 @@ ranges_from_anti_range (value_range_t *ar, { vr0->type = VR_RANGE; vr0->min = vrp_val_min (type); - vr0->max - = wide_int_to_tree (type, - wide_int (ar->min) - 1); + vr0->max = wide_int_to_tree (type, wi::sub (ar->min, 1)); } if (!vrp_val_is_max (ar->max)) { vr1->type = VR_RANGE; - vr1->min - = wide_int_to_tree (type, - wide_int (ar->max) + 1); + vr1->min = wide_int_to_tree (type, wi::add (ar->max, 1)); vr1->max = vrp_val_max (type); } if (vr0->type == VR_UNDEFINED) @@ -2411,9 +2407,9 @@ extract_range_from_binary_expr_1 (value_range_t *vr, if (!TYPE_OVERFLOW_WRAPS (expr_type)) { if (vrp_val_min (expr_type)) - type_min = wide_int (vrp_val_min (expr_type)); + type_min = vrp_val_min (expr_type); if (vrp_val_max (expr_type)) - type_max = wide_int (vrp_val_max (expr_type)); + type_max = vrp_val_max (expr_type); } /* Check for type overflow. */ @@ -4977,14 +4973,14 @@ register_edge_assert_for_2 (tree name, edge e, gimple_stmt_iterator bsi, wide_int minval = wi::min_value (prec, TYPE_SIGN (TREE_TYPE (val))); new_val = val2; - if (minval == wide_int (new_val)) + if (minval == new_val) new_val = NULL_TREE; } else { wide_int maxval = wi::max_value (prec, TYPE_SIGN (TREE_TYPE (val))); - mask |= wide_int (val2); + mask |= val2; if (mask == maxval) new_val = NULL_TREE; else