Richi has asked the we break the wide-int patch so that the individual port and front end maintainers can review their parts without have to go through the entire patch. This patch covers the ada front-end.
Ok?
ada: * gcc-interface/cuintp.c (UI_From_gnu): Use wide-int interfaces. * gcc-interface/decl.c (gnat_to_gnu_entity): Use TYPE_SIGN. (annotate_value): Use wide-int interfaces. * gcc-interface/utils.c (get_nonnull_operand): Use tree_fits_uhwi_p. diff --git a/gcc/ada/gcc-interface/cuintp.c b/gcc/ada/gcc-interface/cuintp.c index bbe62c1..7ef68b6 100644 --- a/gcc/ada/gcc-interface/cuintp.c +++ b/gcc/ada/gcc-interface/cuintp.c @@ -167,7 +167,7 @@ UI_From_gnu (tree Input) in a signed 64-bit integer. */ if (tree_fits_shwi_p (Input)) return UI_From_Int (tree_to_shwi (Input)); - else if (TREE_INT_CST_HIGH (Input) < 0 && TYPE_UNSIGNED (gnu_type)) + else if (wi::lts_p (Input, 0) && TYPE_UNSIGNED (gnu_type)) return No_Uint; #endif diff --git a/gcc/ada/gcc-interface/decl.c b/gcc/ada/gcc-interface/decl.c index ee76a9d..61b2239 100644 --- a/gcc/ada/gcc-interface/decl.c +++ b/gcc/ada/gcc-interface/decl.c @@ -1664,7 +1664,7 @@ gnat_to_gnu_entity (Entity_Id gnat_entity, tree gnu_expr, int definition) TYPE_PRECISION (gnu_type) = esize; TYPE_UNSIGNED (gnu_type) = is_unsigned; set_min_and_max_values_for_integral_type (gnu_type, esize, - is_unsigned); + TYPE_SIGN (gnu_type)); process_attributes (&gnu_type, &attr_list, true, gnat_entity); layout_type (gnu_type); @@ -7493,11 +7493,9 @@ annotate_value (tree gnu_size) if (TREE_CODE (TREE_OPERAND (gnu_size, 1)) == INTEGER_CST) { tree op1 = TREE_OPERAND (gnu_size, 1); - double_int signed_op1 - = tree_to_double_int (op1).sext (TYPE_PRECISION (sizetype)); - if (signed_op1.is_negative ()) + if (wi::neg_p (op1)) { - op1 = double_int_to_tree (sizetype, -signed_op1); + op1 = wide_int_to_tree (sizetype, wi::neg (op1)); pre_op1 = annotate_value (build1 (NEGATE_EXPR, sizetype, op1)); } } diff --git a/gcc/ada/gcc-interface/utils.c b/gcc/ada/gcc-interface/utils.c index 36e5b2d..ea80a32 100644 --- a/gcc/ada/gcc-interface/utils.c +++ b/gcc/ada/gcc-interface/utils.c @@ -6065,8 +6065,7 @@ static bool get_nonnull_operand (tree arg_num_expr, unsigned HOST_WIDE_INT *valp) { /* Verify the arg number is a constant. */ - if (TREE_CODE (arg_num_expr) != INTEGER_CST - || TREE_INT_CST_HIGH (arg_num_expr) != 0) + if (!tree_fits_uhwi_p (arg_num_expr)) return false; *valp = TREE_INT_CST_LOW (arg_num_expr);