diff --git a/gcc/ChangeLog b/gcc/ChangeLog index 8c66c9dba46..9f86e71688d 100644 --- a/gcc/ChangeLog +++ b/gcc/ChangeLog @@ -1,3 +1,105 @@ +2004-08-15 Nathan Sidwell + + * tree.h (build_int_cst): New. + (build_int_2): Remove. + * tree.c (build_int_2): Remove. + (build_int_cst): New. + (make_vector_type, build_common_tree_nodes, + build_common_tree_nodes_2): Use build_int_cst. + * builtins.c (expand_builtin_prefetch, expand_builtin_strstr, + expand_builtin_strpbrk, expand_builtin_fputs, + build_string_literal, expand_builtin_printf, + expand_builtin_sprintf, fold_builtin_lround, fold_builtin_bitop, + fold_builtin_bitop, fold_builtin_isascii, fold_builtin_toascii, + fold_builtin_isdigit, simplify_builtin_strstr, + simplify_builtin_strpbrk, fold_builtin_fputs, + simplify_builtin_sprintf): Use build_int_cst. + * c-common.c (start_fname_decls, fix_string_type, + c_common_nodes_and_builtins, c_init_attributes, + shorten_compare): Likewise. + * c-decl.c (complete_array_type, + check_bitfield_type_and_width): Likewise. + * c-lex.c (interpret_integer, lex_charconst): Likewise. + * c-parse.in (primary): Likewise. + * c-pretty-print.c (pp_c_integer_constant): Likewise. + * c-typeck.c (really_start_incremental_init, push_init_level, + set_nonincremental_init_from_string): Likewise. + * calls.c (load_register_parameters): Likewise. + * convert.c (convert_to_pointer): Likewise. + * coverage.c (coverage_counter_alloc, tree_coverage_counter_ref, + build_fn_info_type, build_ctr_info_value, build_gcov_info): + Likewise. + * except.c (init_eh, assign_filter_values, assign_filter_values): + Likewise. + * expmed.c (store_fixed_bit_field, extract_bit_field, + extract_fixed_bit_field, extract_split_bit_field, expand_shift, + expand_mult_const, expand_mult_highpart_adjust, extract_high_half, + expand_sdiv_pow2, expand_divmod, make_tree): Likewise. + * expr.c (convert_move, emit_group_load, emit_group_store, + expand_assignment, store_constructor, store_field, + expand_expr_real_1, reduce_to_bit_field_precision): Likewise. + * fold-const.c (force_fit_type, int_const_binop, fold_convert_const, + invert_truthvalue, optimize_bit_field_compare, + decode_field_reference, all_ones_mask_p, constant_boolean_node, + fold_div_compare, fold, fold_read_from_constant_string, + fold_negate_const, fold_abs_const, fold_not_const): Likewise. + * function.c (assign_parm_setup_block): Likewise. + * stmt.c (shift_return_value, expand_end_case_type, + estimate_case_costs): Likewise. + * stor-layout.c (layout_type, initialize_sizetypes, + set_min_and_max_values_for_integral_type): Likewise. + * tree-chrec.c (chrec_fold_multiply_poly_poly, + reset_evolution_in_loop): Likewise. + * tree-chrec.h (build_polynomial_chrec): Likewise. + * tree-complex.c (build_replicated_const): Likewise. + * tree-eh.c (honor_protect_cleanup_actions, + lower_try_finally_onedest, lower_try_finally_copy, + lower_try_finally_switch): Likewise. + * tree-mudflap.c (mf_build_string, mx_register_decls, + mudflap_register_call, mudflap_enqueue_constant): Likewise. + * tree-nested.c (get_trampoline_type, get_nl_goto_field): Likewise. + * tree-pretty-print.c (dump_generic_node): Likewise. + * tree-ssa-ccp.c (widen_bitfield, maybe_fold_offset_to_array_ref): + Likewise. + * tree-ssa-dom.c (simplify_rhs_and_lookup_avail_expr): Likewise. + * tree-ssa-loop-niter.c (number_of_iterations_cond, + loop_niter_by_eval, upper_bound_in_type, lower_bound_in_type): + Likewise. + + * config/alpha/alpha.c (alpha_initialize_trampoline, + alpha_va_start, alpha_gimplify_va_arg_1): Use build_int_cst. + * config/arm/arm.c (arm_get_cookie_size): Likewise. + * config/c4x/c4x.c (c4x_gimplify_va_arg_expr): Likewise. + * config/i386/i386.c (ix86_va_start, ix86_gimplify_va_arg): Likewise. + * config/i860/i860.c (i860_va_start): Likewise. + * config/ia64/ia64.c (ia64_gimplify_va_arg): Likewise. + * config/mips/mips.c (mips_build_builtin_va_list, mips_va_start, + mips_gimplify_va_arg_expr): Likewise. + * config/pa/pa.c (hppa_gimplify_va_arg_expr): Likewise. + * config/rs6000/rs6000.c (rs6000_va_start, rs6000_gimplify_va_arg, + add_compiler_branch_island): Likewise. + * config/s390/s390.c (s390_va_start): Likewise. + * config/sh/sh.c (sh_va_start): Likewise. + * config/stormy16/stormy16.c (xstormy16_expand_builtin_va_start): + Likewise. + * config/xtensa/xtensa.c (xtensa_va_start, + xtensa_gimplify_va_arg_expr): Likewise. + + * objc/objc-act.c (build_objc_string_object, + build_objc_symtab_template, init_def_list, init_objc_symtab, + init_module_descriptor, generate_static_references, + build_selector_translation_table, get_proto_encoding, + build_typed_selector_reference, build_selector_reference, + build_next_objc_exception_stuff, + build_method_prototype_list_template, generate_descriptor_table, + generate_protocols, build_protocol_initializer, + build_ivar_list_template, build_method_list_template, + build_ivar_list_initializer, generate_ivars_list, + generate_dispatch_table, generate_protocol_list, + build_category_initializer, build_shared_structure_initializer, + generate_shared_structures, handle_impent, + generate_objc_image_info): Use build_int_cst. + 2004-08-15 Ben Elliston * vec.h: Comment improvements. diff --git a/gcc/ada/ChangeLog b/gcc/ada/ChangeLog index 2819c7b0052..63168471400 100644 --- a/gcc/ada/ChangeLog +++ b/gcc/ada/ChangeLog @@ -1,3 +1,10 @@ +2004-08-15 Nathan Sidwell + + * cuintp.c (UI_To_gnu): Use build_int_cst.. + * trans.c (Exception_Handler_to_gnu_sjlj, gnat_to_gnu): Likewise. + * utils.c (init_gigi_decls): Likewise. + * utils2.c (build_call_raise): Likewise. + 2004-08-13 Olivier Hainque * decl.c (gnat_to_gnu_entity) : When building an allocator diff --git a/gcc/ada/cuintp.c b/gcc/ada/cuintp.c index 3b8495c7e77..c0338afb5d9 100644 --- a/gcc/ada/cuintp.c +++ b/gcc/ada/cuintp.c @@ -62,8 +62,10 @@ UI_To_gnu (Uint Input, tree type) tree gnu_ret; if (Input <= Uint_Direct_Last) - gnu_ret = convert (type, build_int_2 (Input - Uint_Direct_Bias, - Input < Uint_Direct_Bias ? -1 : 0)); + gnu_ret = convert (type, build_int_cst (NULL_TREE, + Input - Uint_Direct_Bias, + Input < Uint_Direct_Bias + ? -1 : 0)); else { Int Idx = Uints_Ptr[Input].Loc; @@ -74,26 +76,26 @@ UI_To_gnu (Uint Input, tree type) tree comp_type = (TYPE_PRECISION (type) >= TYPE_PRECISION (integer_type_node) ? type : integer_type_node); - tree gnu_base = convert (comp_type, build_int_2 (Base, 0)); + tree gnu_base = build_int_cst (comp_type, Base, 0); if (Length <= 0) abort (); - gnu_ret = convert (comp_type, build_int_2 (First, First < 0 ? -1 : 0)); + gnu_ret = build_int_cst (comp_type, First, First < 0 ? -1 : 0); if (First < 0) for (Idx++, Length--; Length; Idx++, Length--) gnu_ret = fold (build (MINUS_EXPR, comp_type, fold (build (MULT_EXPR, comp_type, gnu_ret, gnu_base)), - convert (comp_type, - build_int_2 (Udigits_Ptr[Idx], 0)))); + build_int_cst (comp_type, + Udigits_Ptr[Idx], 0))); else for (Idx++, Length--; Length; Idx++, Length--) gnu_ret = fold (build (PLUS_EXPR, comp_type, fold (build (MULT_EXPR, comp_type, gnu_ret, gnu_base)), - convert (comp_type, - build_int_2 (Udigits_Ptr[Idx], 0)))); + build_int_cst (comp_type, + Udigits_Ptr[Idx], 0))); } gnu_ret = convert (type, gnu_ret); diff --git a/gcc/ada/trans.c b/gcc/ada/trans.c index 91b051882c6..e00400223f5 100644 --- a/gcc/ada/trans.c +++ b/gcc/ada/trans.c @@ -2217,8 +2217,8 @@ Exception_Handler_to_gnu_sjlj (Node_Id gnat_node) = build_binary_op (TRUTH_ORIF_EXPR, integer_type_node, build_binary_op (EQ_EXPR, integer_type_node, gnu_comp, - convert (TREE_TYPE (gnu_comp), - build_int_2 ('V', 0))), + build_int_cst (TREE_TYPE (gnu_comp), + 'V', 0)), this_choice); } } @@ -2504,8 +2504,8 @@ gnat_to_gnu (Node_Id gnat_node) if (Present (Entity (gnat_node))) gnu_result = DECL_INITIAL (get_gnu_tree (Entity (gnat_node))); else - gnu_result = convert (gnu_result_type, - build_int_2 (Char_Literal_Value (gnat_node), 0)); + gnu_result = build_int_cst (gnu_result_type, + Char_Literal_Value (gnat_node), 0); break; case N_Real_Literal: @@ -2617,12 +2617,10 @@ gnat_to_gnu (Node_Id gnat_node) for (i = 0; i < length; i++) { gnu_list - = tree_cons (gnu_idx, - convert (TREE_TYPE (gnu_result_type), - build_int_2 - (Get_String_Char (gnat_string, i + 1), - 0)), - gnu_list); + = tree_cons (gnu_idx, build_int_cst + (TREE_TYPE (gnu_result_type), + Get_String_Char (gnat_string, i + 1), 0), + gnu_list); gnu_idx = int_const_binop (PLUS_EXPR, gnu_idx, integer_one_node, 0); diff --git a/gcc/ada/utils.c b/gcc/ada/utils.c index 4f2362981c5..ff57b9adee2 100644 --- a/gcc/ada/utils.c +++ b/gcc/ada/utils.c @@ -580,7 +580,7 @@ init_gigi_decls (tree long_long_float_type, tree exception_type) /* Make the types and functions used for exception processing. */ jmpbuf_type = build_array_type (gnat_type_for_mode (Pmode, 0), - build_index_type (build_int_2 (5, 0))); + build_index_type (build_int_cst (NULL_TREE, 5, 0))); create_type_decl (get_identifier ("JMPBUF_T"), jmpbuf_type, NULL, false, true, Empty); jmpbuf_ptr_type = build_pointer_type (jmpbuf_type); diff --git a/gcc/ada/utils2.c b/gcc/ada/utils2.c index 6d8ba355944..726c9f2ac84 100644 --- a/gcc/ada/utils2.c +++ b/gcc/ada/utils2.c @@ -1444,13 +1444,13 @@ build_call_raise (int msg) TREE_TYPE (filename) = build_array_type (char_type_node, - build_index_type (build_int_2 (len, 0))); + build_index_type (build_int_cst (NULL_TREE, len, 0))); return build_call_2_expr (fndecl, build1 (ADDR_EXPR, build_pointer_type (char_type_node), filename), - build_int_2 (input_line, 0)); + build_int_cst (NULL_TREE, input_line, 0)); } /* Return a CONSTRUCTOR of TYPE whose list is LIST. */ diff --git a/gcc/builtins.c b/gcc/builtins.c index fb852ff0b55..65028cf51d9 100644 --- a/gcc/builtins.c +++ b/gcc/builtins.c @@ -903,12 +903,12 @@ expand_builtin_prefetch (tree arglist) if (TREE_CHAIN (TREE_CHAIN (arglist))) arg2 = TREE_VALUE (TREE_CHAIN (TREE_CHAIN (arglist))); else - arg2 = build_int_2 (3, 0); + arg2 = build_int_cst (NULL_TREE, 3, 0); } else { arg1 = integer_zero_node; - arg2 = build_int_2 (3, 0); + arg2 = build_int_cst (NULL_TREE, 3, 0); } /* Argument 0 is an address. */ @@ -2490,8 +2490,8 @@ expand_builtin_strstr (tree arglist, rtx target, enum machine_mode mode) /* New argument list transforming strstr(s1, s2) to strchr(s1, s2[0]). */ - arglist = - build_tree_list (NULL_TREE, build_int_2 (p2[0], 0)); + arglist = build_tree_list (NULL_TREE, + build_int_cst (NULL_TREE, p2[0], 0)); arglist = tree_cons (NULL_TREE, s1, arglist); return expand_expr (build_function_call_expr (fn, arglist), target, mode, EXPAND_NORMAL); @@ -2647,8 +2647,8 @@ expand_builtin_strpbrk (tree arglist, rtx target, enum machine_mode mode) /* New argument list transforming strpbrk(s1, s2) to strchr(s1, s2[0]). */ - arglist = - build_tree_list (NULL_TREE, build_int_2 (p2[0], 0)); + arglist = build_tree_list (NULL_TREE, + build_int_cst (NULL_TREE, p2[0], 0)); arglist = tree_cons (NULL_TREE, s1, arglist); return expand_expr (build_function_call_expr (fn, arglist), target, mode, EXPAND_NORMAL); @@ -4676,10 +4676,11 @@ expand_builtin_fputs (tree arglist, rtx target, bool unlocked) { /* New argument list transforming fputs(string, stream) to fputc(string[0], stream). */ - arglist = - build_tree_list (NULL_TREE, TREE_VALUE (TREE_CHAIN (arglist))); - arglist = - tree_cons (NULL_TREE, build_int_2 (p[0], 0), arglist); + arglist = build_tree_list (NULL_TREE, + TREE_VALUE (TREE_CHAIN (arglist))); + arglist = tree_cons (NULL_TREE, + build_int_cst (NULL_TREE, p[0], 0), + arglist); fn = fn_fputc; break; } @@ -4936,7 +4937,7 @@ build_string_literal (int len, const char *str) t = build_string (len, str); elem = build_type_variant (char_type_node, 1, 0); - index = build_index_type (build_int_2 (len - 1, 0)); + index = build_index_type (build_int_cst (NULL_TREE, len - 1, 0)); type = build_array_type (elem, index); TREE_TYPE (t) = type; TREE_CONSTANT (t) = 1; @@ -5022,7 +5023,7 @@ expand_builtin_printf (tree arglist, rtx target, enum machine_mode mode, /* Given printf("c"), (where c is any one character,) convert "c"[0] to an int and pass that to the replacement function. */ - arg = build_int_2 (fmt_str[0], 0); + arg = build_int_cst (NULL_TREE, fmt_str[0], 0); arglist = build_tree_list (NULL_TREE, arg); fn = fn_putchar; } @@ -5193,8 +5194,7 @@ expand_builtin_sprintf (tree arglist, rtx target, enum machine_mode mode) const0_rtx, VOIDmode, EXPAND_NORMAL); if (target == const0_rtx) return const0_rtx; - exp = build_int_2 (strlen (fmt_str), 0); - exp = fold_convert (integer_type_node, exp); + exp = build_int_cst (NULL_TREE, strlen (fmt_str), 0); return expand_expr (exp, target, mode, EXPAND_NORMAL); } /* If the format is "%s", use strcpy if the result isn't used. */ @@ -6271,9 +6271,10 @@ static tree fold_builtin_classify_type (tree arglist) { if (arglist == 0) - return build_int_2 (no_type_class, 0); + return build_int_cst (NULL_TREE, no_type_class, 0); - return build_int_2 (type_to_class (TREE_TYPE (TREE_VALUE (arglist))), 0); + return build_int_cst (NULL_TREE, + type_to_class (TREE_TYPE (TREE_VALUE (arglist))), 0); } /* Fold a call to __builtin_inf or __builtin_huge_val. */ @@ -6706,7 +6707,7 @@ fold_builtin_lround (tree exp) real_round (&r, TYPE_MODE (ftype), &x); REAL_VALUE_TO_INT (&lo, &hi, r); - result = build_int_2 (lo, hi); + result = build_int_cst (NULL_TREE, lo, hi); if (int_fits_type_p (result, itype)) return fold_convert (itype, result); } @@ -6735,7 +6736,7 @@ fold_builtin_bitop (tree exp) { HOST_WIDE_INT hi, width, result; unsigned HOST_WIDE_INT lo; - tree type, t; + tree type; type = TREE_TYPE (arg); width = TYPE_PRECISION (type); @@ -6815,9 +6816,7 @@ fold_builtin_bitop (tree exp) abort(); } - t = build_int_2 (result, 0); - TREE_TYPE (t) = TREE_TYPE (exp); - return t; + return build_int_cst (TREE_TYPE (exp), result, 0); } return NULL_TREE; @@ -7572,11 +7571,12 @@ fold_builtin_isascii (tree arglist) /* Transform isascii(c) -> ((c & ~0x7f) == 0). */ tree arg = TREE_VALUE (arglist); + arg = build2 (BIT_AND_EXPR, integer_type_node, arg, + build_int_cst (NULL_TREE, + ~ (unsigned HOST_WIDE_INT) 0x7f, + ~ (HOST_WIDE_INT) 0)); arg = fold (build2 (EQ_EXPR, integer_type_node, - build2 (BIT_AND_EXPR, integer_type_node, arg, - build_int_2 (~ (unsigned HOST_WIDE_INT) 0x7f, - ~ (HOST_WIDE_INT) 0)), - integer_zero_node)); + arg, integer_zero_node)); if (in_gimple_form && !TREE_CONSTANT (arg)) return NULL_TREE; @@ -7598,7 +7598,7 @@ fold_builtin_toascii (tree arglist) tree arg = TREE_VALUE (arglist); return fold (build2 (BIT_AND_EXPR, integer_type_node, arg, - build_int_2 (0x7f, 0))); + build_int_cst (NULL_TREE, 0x7f, 0))); } } @@ -7616,10 +7616,9 @@ fold_builtin_isdigit (tree arglist) tree arg = TREE_VALUE (arglist); arg = fold_convert (unsigned_type_node, arg); arg = build2 (MINUS_EXPR, unsigned_type_node, arg, - fold_convert (unsigned_type_node, - build_int_2 (TARGET_DIGIT0, 0))); + build_int_cst (unsigned_type_node, TARGET_DIGIT0, 0)); arg = build2 (LE_EXPR, integer_type_node, arg, - fold_convert (unsigned_type_node, build_int_2 (9, 0))); + build_int_cst (unsigned_type_node, 9, 0)); arg = fold (arg); if (in_gimple_form && !TREE_CONSTANT (arg)) return NULL_TREE; @@ -8696,7 +8695,8 @@ simplify_builtin_strstr (tree arglist) /* New argument list transforming strstr(s1, s2) to strchr(s1, s2[0]). */ - arglist = build_tree_list (NULL_TREE, build_int_2 (p2[0], 0)); + arglist = build_tree_list (NULL_TREE, + build_int_cst (NULL_TREE, p2[0], 0)); arglist = tree_cons (NULL_TREE, s1, arglist); return build_function_call_expr (fn, arglist); } @@ -8881,8 +8881,8 @@ simplify_builtin_strpbrk (tree arglist) /* New argument list transforming strpbrk(s1, s2) to strchr(s1, s2[0]). */ - arglist = - build_tree_list (NULL_TREE, build_int_2 (p2[0], 0)); + arglist = build_tree_list (NULL_TREE, + build_int_cst (NULL_TREE, p2[0], 0)); arglist = tree_cons (NULL_TREE, s1, arglist); return build_function_call_expr (fn, arglist); } @@ -9130,9 +9130,11 @@ fold_builtin_fputs (tree arglist, bool ignore, bool unlocked, tree len) { /* New argument list transforming fputs(string, stream) to fputc(string[0], stream). */ - arglist = - build_tree_list (NULL_TREE, TREE_VALUE (TREE_CHAIN (arglist))); - arglist = tree_cons (NULL_TREE, build_int_2 (p[0], 0), arglist); + arglist = build_tree_list (NULL_TREE, + TREE_VALUE (TREE_CHAIN (arglist))); + arglist = tree_cons (NULL_TREE, + build_int_cst (NULL_TREE, p[0], 0), + arglist); fn = fn_fputc; break; } @@ -9256,7 +9258,7 @@ simplify_builtin_sprintf (tree arglist, int ignored) arglist = tree_cons (NULL_TREE, dest, arglist); call = build_function_call_expr (fn, arglist); if (!ignored) - retval = build_int_2 (strlen (fmt_str), 0); + retval = build_int_cst (NULL_TREE, strlen (fmt_str), 0); } /* If the format is "%s", use strcpy if the result isn't used. */ diff --git a/gcc/c-common.c b/gcc/c-common.c index b4c914b4650..f66341d883a 100644 --- a/gcc/c-common.c +++ b/gcc/c-common.c @@ -660,7 +660,7 @@ start_fname_decls (void) if (decl) { - saved = tree_cons (decl, build_int_2 (ix, 0), saved); + saved = tree_cons (decl, build_int_cst (NULL_TREE, ix, 0), saved); *fname_vars[ix].decl = NULL_TREE; } } @@ -835,7 +835,8 @@ fix_string_type (tree value) const int nchars_max = flag_isoc99 ? 4095 : 509; int length = TREE_STRING_LENGTH (value); int nchars; - + tree e_type, i_type; + /* Compute the number of elements, for the array type. */ nchars = wide_flag ? length / wchar_bytes : length; @@ -843,23 +844,15 @@ fix_string_type (tree value) pedwarn ("string length `%d' is greater than the length `%d' ISO C%d compilers are required to support", nchars - 1, nchars_max, flag_isoc99 ? 99 : 89); + e_type = wide_flag ? wchar_type_node : char_type_node; /* Create the array type for the string constant. -Wwrite-strings says make the string constant an array of const char so that copying it to a non-const pointer will get a warning. For C++, this is the standard behavior. */ if (flag_const_strings) - { - tree elements - = build_type_variant (wide_flag ? wchar_type_node : char_type_node, - 1, 0); - TREE_TYPE (value) - = build_array_type (elements, - build_index_type (build_int_2 (nchars - 1, 0))); - } - else - TREE_TYPE (value) - = build_array_type (wide_flag ? wchar_type_node : char_type_node, - build_index_type (build_int_2 (nchars - 1, 0))); + e_type = build_type_variant (e_type, 1, 0); + i_type = build_index_type (build_int_cst (NULL_TREE, nchars - 1, 0)); + TREE_TYPE (value) = build_array_type (e_type, i_type); TREE_CONSTANT (value) = 1; TREE_INVARIANT (value) = 1; @@ -1999,10 +1992,10 @@ shorten_compare (tree *op0_ptr, tree *op1_ptr, tree *restype_ptr, { /* Convert primop1 to target type, but do not introduce additional overflow. We know primop1 is an int_cst. */ - tree tmp = build_int_2 (TREE_INT_CST_LOW (primop1), - TREE_INT_CST_HIGH (primop1)); + tree tmp = build_int_cst (*restype_ptr, + TREE_INT_CST_LOW (primop1), + TREE_INT_CST_HIGH (primop1)); - TREE_TYPE (tmp) = *restype_ptr; primop1 = force_fit_type (tmp, 0, TREE_OVERFLOW (primop1), TREE_CONSTANT_OVERFLOW (primop1)); } @@ -3008,7 +3001,9 @@ c_common_nodes_and_builtins (void) record_builtin_type (RID_VOID, NULL, void_type_node); - void_zero_node = build_int_2 (0, 0); + void_zero_node = make_node (INTEGER_CST); + TREE_INT_CST_LOW (void_zero_node) = 0; + TREE_INT_CST_HIGH (void_zero_node) = 0; TREE_TYPE (void_zero_node) = void_type_node; void_list_node = build_void_list_node (); @@ -3900,10 +3895,11 @@ static void c_init_attributes (void) { /* Fill in the built_in_attributes array. */ -#define DEF_ATTR_NULL_TREE(ENUM) \ +#define DEF_ATTR_NULL_TREE(ENUM) \ built_in_attributes[(int) ENUM] = NULL_TREE; -#define DEF_ATTR_INT(ENUM, VALUE) \ - built_in_attributes[(int) ENUM] = build_int_2 (VALUE, VALUE < 0 ? -1 : 0); +#define DEF_ATTR_INT(ENUM, VALUE) \ + built_in_attributes[(int) ENUM] = build_int_cst \ + (NULL_TREE, VALUE, VALUE < 0 ? -1 : 0); #define DEF_ATTR_IDENT(ENUM, STRING) \ built_in_attributes[(int) ENUM] = get_identifier (STRING); #define DEF_ATTR_TREE_LIST(ENUM, PURPOSE, VALUE, CHAIN) \ diff --git a/gcc/c-decl.c b/gcc/c-decl.c index 696fec88f2c..c7ba8d20268 100644 --- a/gcc/c-decl.c +++ b/gcc/c-decl.c @@ -3269,13 +3269,14 @@ complete_array_type (tree type, tree initial_value, int do_default) { int eltsize = int_size_in_bytes (TREE_TYPE (TREE_TYPE (initial_value))); - maxindex = build_int_2 ((TREE_STRING_LENGTH (initial_value) - / eltsize) - 1, 0); + maxindex = build_int_cst (NULL_TREE, + (TREE_STRING_LENGTH (initial_value) + / eltsize) - 1, 0); } else if (TREE_CODE (initial_value) == CONSTRUCTOR) { tree elts = CONSTRUCTOR_ELTS (initial_value); - maxindex = build_int_2 (-1, -1); + maxindex = build_int_cst (NULL_TREE, -1, -1); for (; elts; elts = TREE_CHAIN (elts)) { if (TREE_PURPOSE (elts)) @@ -3292,14 +3293,14 @@ complete_array_type (tree type, tree initial_value, int do_default) value = 1; /* Prevent further error messages. */ - maxindex = build_int_2 (0, 0); + maxindex = build_int_cst (NULL_TREE, 0, 0); } } if (!maxindex) { if (do_default) - maxindex = build_int_2 (0, 0); + maxindex = build_int_cst (NULL_TREE, 0, 0); value = 2; } @@ -3410,7 +3411,7 @@ check_bitfield_type_and_width (tree *type, tree *width, const char *orig_name) { error ("width of `%s' exceeds its type", name); w = max_width; - *width = build_int_2 (w, 0); + *width = build_int_cst (NULL_TREE, w, 0); } else w = tree_low_cst (*width, 1); diff --git a/gcc/c-lex.c b/gcc/c-lex.c index ee0ae3e8df3..7fc47ba8db3 100644 --- a/gcc/c-lex.c +++ b/gcc/c-lex.c @@ -588,13 +588,11 @@ interpret_integer (const cpp_token *token, unsigned int flags) pedwarn ("integer constant is too large for \"%s\" type", (flags & CPP_N_UNSIGNED) ? "unsigned long" : "long"); - value = build_int_2 (integer.low, integer.high); - TREE_TYPE (value) = type; + value = build_int_cst (type, integer.low, integer.high); /* Convert imaginary to a complex type. */ if (flags & CPP_N_IMAGINARY) - value = build_complex (NULL_TREE, - convert (type, integer_zero_node), value); + value = build_complex (NULL_TREE, build_int_cst (type, 0, 0), value); return value; } @@ -795,13 +793,6 @@ lex_charconst (const cpp_token *token) result = cpp_interpret_charconst (parse_in, token, &chars_seen, &unsignedp); - /* Cast to cppchar_signed_t to get correct sign-extension of RESULT - before possibly widening to HOST_WIDE_INT for build_int_2. */ - if (unsignedp || (cppchar_signed_t) result >= 0) - value = build_int_2 (result, 0); - else - value = build_int_2 ((cppchar_signed_t) result, -1); - if (token->type == CPP_WCHAR) type = wchar_type_node; /* In C, a character constant has type 'int'. @@ -811,6 +802,12 @@ lex_charconst (const cpp_token *token) else type = char_type_node; - TREE_TYPE (value) = type; + /* Cast to cppchar_signed_t to get correct sign-extension of RESULT + before possibly widening to HOST_WIDE_INT for build_int_cst. */ + if (unsignedp || (cppchar_signed_t) result >= 0) + value = build_int_cst (type, result, 0); + else + value = build_int_cst (type, (cppchar_signed_t) result, -1); + return value; } diff --git a/gcc/c-parse.in b/gcc/c-parse.in index 13178890173..f1597302627 100644 --- a/gcc/c-parse.in +++ b/gcc/c-parse.in @@ -704,7 +704,8 @@ primary: e2 = TYPE_MAIN_VARIANT (groktypename ($5)); $$.value = comptypes (e1, e2) - ? build_int_2 (1, 0) : build_int_2 (0, 0); + ? build_int_cst (NULL_TREE, 1, 0) + : build_int_cst (NULL_TREE, 0, 0); $$.original_code = ERROR_MARK; } | TYPES_COMPATIBLE_P '(' error ')' diff --git a/gcc/c-pretty-print.c b/gcc/c-pretty-print.c index 3ddef7a2385..dbb56ed4503 100644 --- a/gcc/c-pretty-print.c +++ b/gcc/c-pretty-print.c @@ -786,8 +786,9 @@ pp_c_integer_constant (c_pretty_printer *pp, tree i) if (tree_int_cst_sgn (i) < 0) { pp_c_char (pp, '-'); - i = build_int_2 (-TREE_INT_CST_LOW (i), - ~TREE_INT_CST_HIGH (i) + !TREE_INT_CST_LOW (i)); + i = build_int_cst (NULL_TREE, + -TREE_INT_CST_LOW (i), + ~TREE_INT_CST_HIGH (i) + !TREE_INT_CST_LOW (i)); } sprintf (pp_buffer (pp)->digit_buffer, HOST_WIDE_INT_PRINT_DOUBLE_HEX, diff --git a/gcc/c-typeck.c b/gcc/c-typeck.c index b8a15a00780..2c89c73b449 100644 --- a/gcc/c-typeck.c +++ b/gcc/c-typeck.c @@ -4472,14 +4472,14 @@ really_start_incremental_init (tree type) /* Detect non-empty initializations of zero-length arrays. */ if (constructor_max_index == NULL_TREE && TYPE_SIZE (constructor_type)) - constructor_max_index = build_int_2 (-1, -1); + constructor_max_index = build_int_cst (NULL_TREE, -1, -1); /* constructor_max_index needs to be an INTEGER_CST. Attempts to initialize VLAs will cause a proper error; avoid tree checking errors as well by setting a safe value. */ if (constructor_max_index && TREE_CODE (constructor_max_index) != INTEGER_CST) - constructor_max_index = build_int_2 (-1, -1); + constructor_max_index = build_int_cst (NULL_TREE, -1, -1); constructor_index = convert (bitsizetype, @@ -4494,7 +4494,8 @@ really_start_incremental_init (tree type) { /* Vectors are like simple fixed-size arrays. */ constructor_max_index = - build_int_2 (TYPE_VECTOR_SUBPARTS (constructor_type) - 1, 0); + build_int_cst (NULL_TREE, + TYPE_VECTOR_SUBPARTS (constructor_type) - 1, 0); constructor_index = convert (bitsizetype, bitsize_zero_node); constructor_unfilled_index = constructor_index; } @@ -4649,7 +4650,8 @@ push_init_level (int implicit) { /* Vectors are like simple fixed-size arrays. */ constructor_max_index = - build_int_2 (TYPE_VECTOR_SUBPARTS (constructor_type) - 1, 0); + build_int_cst (NULL_TREE, + TYPE_VECTOR_SUBPARTS (constructor_type) - 1, 0); constructor_index = convert (bitsizetype, integer_zero_node); constructor_unfilled_index = constructor_index; } @@ -4663,14 +4665,14 @@ push_init_level (int implicit) /* Detect non-empty initializations of zero-length arrays. */ if (constructor_max_index == NULL_TREE && TYPE_SIZE (constructor_type)) - constructor_max_index = build_int_2 (-1, -1); + constructor_max_index = build_int_cst (NULL_TREE, -1, -1); /* constructor_max_index needs to be an INTEGER_CST. Attempts to initialize VLAs will cause a proper error; avoid tree checking errors as well by setting a safe value. */ if (constructor_max_index && TREE_CODE (constructor_max_index) != INTEGER_CST) - constructor_max_index = build_int_2 (-1, -1); + constructor_max_index = build_int_cst (NULL_TREE, -1, -1); constructor_index = convert (bitsizetype, @@ -5394,8 +5396,7 @@ set_nonincremental_init_from_string (tree str) << (bitpos - HOST_BITS_PER_WIDE_INT); } - value = build_int_2 (val[1], val[0]); - TREE_TYPE (value) = type; + value = build_int_cst (type, val[1], val[0]); add_pending_init (purpose, value); } diff --git a/gcc/calls.c b/gcc/calls.c index e4c3d9f3037..8b28c46f649 100644 --- a/gcc/calls.c +++ b/gcc/calls.c @@ -1505,7 +1505,9 @@ load_register_parameters (struct arg_data *args, int num_actuals, seem worth generating rtl to say that. */ reg = gen_rtx_REG (word_mode, REGNO (reg)); x = expand_shift (LSHIFT_EXPR, word_mode, reg, - build_int_2 (shift, 0), reg, 1); + build_int_cst (NULL_TREE, FIXMEFORMAT + shift, 0), + reg, 1); if (x != reg) emit_move_insn (reg, x); } @@ -1542,7 +1544,8 @@ load_register_parameters (struct arg_data *args, int num_actuals, emit_move_insn (x, tem); x = expand_shift (dir, word_mode, x, - build_int_2 (shift, 0), ri, 1); + build_int_cst (NULL_TREE, shift, 0), + ri, 1); if (x != ri) emit_move_insn (ri, x); } diff --git a/gcc/config/alpha/alpha.c b/gcc/config/alpha/alpha.c index 9238ab61d75..87d2cf52e08 100644 --- a/gcc/config/alpha/alpha.c +++ b/gcc/config/alpha/alpha.c @@ -4929,7 +4929,7 @@ alpha_initialize_trampoline (rtx tramp, rtx fnaddr, rtx cxt, temp = expand_binop (DImode, sub_optab, fnaddr, temp, temp, 1, OPTAB_WIDEN); temp = expand_shift (RSHIFT_EXPR, Pmode, temp, - build_int_2 (2, 0), NULL_RTX, 1); + build_int_cst (NULL_TREE, 2, 0), NULL_RTX, 1); temp = expand_and (SImode, gen_lowpart (SImode, temp), GEN_INT (0x3fff), 0); @@ -5382,12 +5382,13 @@ alpha_va_start (tree valist, rtx nextarg ATTRIBUTE_UNUSED) valist, offset_field, NULL_TREE); t = make_tree (ptr_type_node, virtual_incoming_args_rtx); - t = build (PLUS_EXPR, ptr_type_node, t, build_int_2 (offset, 0)); + t = build (PLUS_EXPR, ptr_type_node, t, + build_int_cst (NULL_TREE, offset, 0)); t = build (MODIFY_EXPR, TREE_TYPE (base_field), base_field, t); TREE_SIDE_EFFECTS (t) = 1; expand_expr (t, const0_rtx, VOIDmode, EXPAND_NORMAL); - t = build_int_2 (NUM_ARGS * UNITS_PER_WORD, 0); + t = build_int_cst (NULL_TREE, NUM_ARGS * UNITS_PER_WORD, 0); t = build (MODIFY_EXPR, TREE_TYPE (offset_field), offset_field, t); TREE_SIDE_EFFECTS (t) = 1; expand_expr (t, const0_rtx, VOIDmode, EXPAND_NORMAL); @@ -5403,7 +5404,7 @@ alpha_gimplify_va_arg_1 (tree type, tree base, tree offset, tree *pre_p) reserved for the registers. */ if (targetm.calls.must_pass_in_stack (TYPE_MODE (type), type)) { - t = fold_convert (TREE_TYPE (offset), build_int_2 (6*8, 0)); + t = build_int_cst (TREE_TYPE (offset), 6*8, 0); t = build (MODIFY_EXPR, TREE_TYPE (offset), offset, build (MAX_EXPR, TREE_TYPE (offset), offset, t)); gimplify_and_add (t, pre_p); @@ -5432,7 +5433,7 @@ alpha_gimplify_va_arg_1 (tree type, tree base, tree offset, tree *pre_p) { tree fpaddend, cond, fourtyeight; - fourtyeight = fold_convert (TREE_TYPE (addend), build_int_2 (6*8, 0)); + fourtyeight = build_int_cst (TREE_TYPE (addend), 6*8, 0); fpaddend = fold (build (MINUS_EXPR, TREE_TYPE (addend), addend, fourtyeight)); cond = fold (build (LT_EXPR, boolean_type_node, addend, fourtyeight)); diff --git a/gcc/config/arm/arm.c b/gcc/config/arm/arm.c index c12ea5285dd..c4d9ffd1b7f 100644 --- a/gcc/config/arm/arm.c +++ b/gcc/config/arm/arm.c @@ -14691,8 +14691,7 @@ arm_get_cookie_size (tree type) if (!TARGET_AAPCS_BASED) return default_cxx_get_cookie_size (type); - size = build_int_2 (8, 0); - TREE_TYPE (size) = sizetype; + size = build_int_cst (sizetype, 8, 0); return size; } diff --git a/gcc/config/c4x/c4x.c b/gcc/config/c4x/c4x.c index 6adf0bd98d9..ead3631f472 100644 --- a/gcc/config/c4x/c4x.c +++ b/gcc/config/c4x/c4x.c @@ -738,7 +738,7 @@ c4x_gimplify_va_arg_expr (tree valist, tree type, type = build_pointer_type (type); t = build (PREDECREMENT_EXPR, TREE_TYPE (valist), valist, - build_int_2 (int_size_in_bytes (type), 0)); + build_int_cst (NULL_TREE, int_size_in_bytes (type), 0)); t = fold_convert (build_pointer_type (type), t); t = build_fold_indirect_ref (t); diff --git a/gcc/config/i386/i386.c b/gcc/config/i386/i386.c index 703aa5af519..0328df50d3d 100644 --- a/gcc/config/i386/i386.c +++ b/gcc/config/i386/i386.c @@ -3231,12 +3231,12 @@ ix86_va_start (tree valist, rtx nextarg) (int) words, (int) n_gpr, (int) n_fpr); t = build (MODIFY_EXPR, TREE_TYPE (gpr), gpr, - build_int_2 (n_gpr * 8, 0)); + build_int_cst (NULL_TREE, n_gpr * 8, 0)); TREE_SIDE_EFFECTS (t) = 1; expand_expr (t, const0_rtx, VOIDmode, EXPAND_NORMAL); t = build (MODIFY_EXPR, TREE_TYPE (fpr), fpr, - build_int_2 (n_fpr * 16 + 8*REGPARM_MAX, 0)); + build_int_cst (NULL_TREE, n_fpr * 16 + 8*REGPARM_MAX, 0)); TREE_SIDE_EFFECTS (t) = 1; expand_expr (t, const0_rtx, VOIDmode, EXPAND_NORMAL); @@ -3244,7 +3244,7 @@ ix86_va_start (tree valist, rtx nextarg) t = make_tree (TREE_TYPE (ovf), virtual_incoming_args_rtx); if (words != 0) t = build (PLUS_EXPR, TREE_TYPE (ovf), t, - build_int_2 (words * UNITS_PER_WORD, 0)); + build_int_cst (NULL_TREE, words * UNITS_PER_WORD, 0)); t = build (MODIFY_EXPR, TREE_TYPE (ovf), ovf, t); TREE_SIDE_EFFECTS (t) = 1; expand_expr (t, const0_rtx, VOIDmode, EXPAND_NORMAL); @@ -3363,8 +3363,8 @@ ix86_gimplify_va_arg (tree valist, tree type, tree *pre_p, tree *post_p) /* First ensure that we fit completely in registers. */ if (needed_intregs) { - t = build_int_2 ((REGPARM_MAX - needed_intregs + 1) * 8, 0); - TREE_TYPE (t) = TREE_TYPE (gpr); + t = build_int_cst (TREE_TYPE (gpr), + (REGPARM_MAX - needed_intregs + 1) * 8, 0); t = build2 (GE_EXPR, boolean_type_node, gpr, t); t2 = build1 (GOTO_EXPR, void_type_node, lab_false); t = build (COND_EXPR, void_type_node, t, t2, NULL_TREE); @@ -3372,9 +3372,9 @@ ix86_gimplify_va_arg (tree valist, tree type, tree *pre_p, tree *post_p) } if (needed_sseregs) { - t = build_int_2 ((SSE_REGPARM_MAX - needed_sseregs + 1) * 16 - + REGPARM_MAX * 8, 0); - TREE_TYPE (t) = TREE_TYPE (fpr); + t = build_int_cst (TREE_TYPE (fpr), + (SSE_REGPARM_MAX - needed_sseregs + 1) * 16 + + REGPARM_MAX * 8, 0); t = build2 (GE_EXPR, boolean_type_node, fpr, t); t2 = build1 (GOTO_EXPR, void_type_node, lab_false); t = build (COND_EXPR, void_type_node, t, t2, NULL_TREE); @@ -3445,15 +3445,14 @@ ix86_gimplify_va_arg (tree valist, tree type, tree *pre_p, tree *post_p) if (needed_intregs) { t = build2 (PLUS_EXPR, TREE_TYPE (gpr), gpr, - build_int_2 (needed_intregs * 8, 0)); + build_int_cst (NULL_TREE, needed_intregs * 8, 0)); t = build2 (MODIFY_EXPR, TREE_TYPE (gpr), gpr, t); gimplify_and_add (t, pre_p); } if (needed_sseregs) { - t = - build2 (PLUS_EXPR, TREE_TYPE (fpr), fpr, - build_int_2 (needed_sseregs * 16, 0)); + t = build2 (PLUS_EXPR, TREE_TYPE (fpr), fpr, + build_int_cst (NULL_TREE, needed_sseregs * 16, 0)); t = build2 (MODIFY_EXPR, TREE_TYPE (fpr), fpr, t); gimplify_and_add (t, pre_p); } @@ -3473,8 +3472,10 @@ ix86_gimplify_va_arg (tree valist, tree type, tree *pre_p, tree *post_p) else { HOST_WIDE_INT align = FUNCTION_ARG_BOUNDARY (VOIDmode, type) / 8; - t = build (PLUS_EXPR, TREE_TYPE (ovf), ovf, build_int_2 (align - 1, 0)); - t = build (BIT_AND_EXPR, TREE_TYPE (t), t, build_int_2 (-align, -1)); + t = build (PLUS_EXPR, TREE_TYPE (ovf), ovf, + build_int_cst (NULL_TREE, align - 1, 0)); + t = build (BIT_AND_EXPR, TREE_TYPE (t), t, + build_int_cst (NULL_TREE, -align, -1)); } gimplify_expr (&t, pre_p, NULL, is_gimple_val, fb_rvalue); @@ -3482,7 +3483,7 @@ ix86_gimplify_va_arg (tree valist, tree type, tree *pre_p, tree *post_p) gimplify_and_add (t2, pre_p); t = build2 (PLUS_EXPR, TREE_TYPE (t), t, - build_int_2 (rsize * UNITS_PER_WORD, 0)); + build_int_cst (NULL_TREE, rsize * UNITS_PER_WORD, 0)); t = build2 (MODIFY_EXPR, TREE_TYPE (ovf), ovf, t); gimplify_and_add (t, pre_p); diff --git a/gcc/config/i860/i860.c b/gcc/config/i860/i860.c index d4976680997..0723bac8ca9 100644 --- a/gcc/config/i860/i860.c +++ b/gcc/config/i860/i860.c @@ -1888,19 +1888,21 @@ i860_va_start (tree valist, rtx nextarg ATTRIBUTE_UNUSED) t = make_tree (TREE_TYPE (mem), virtual_incoming_args_rtx); off = INTVAL (current_function_arg_offset_rtx); off = off < 0 ? 0 : off; - t = build (PLUS_EXPR, TREE_TYPE (mem), t, build_int_2 (off, 0)); + t = build (PLUS_EXPR, TREE_TYPE (mem), t, build_int_cst (NULL_TREE, off, 0)); t = build (MODIFY_EXPR, TREE_TYPE (mem), mem, t); TREE_SIDE_EFFECTS (t) = 1; expand_expr (t, const0_rtx, VOIDmode, EXPAND_NORMAL); /* Initialize the `ireg_used' field. */ - t = build_int_2 (current_function_args_info.ints / UNITS_PER_WORD, 0); + t = build_int_cst (NULL_TREE, + current_function_args_info.ints / UNITS_PER_WORD, 0); t = build (MODIFY_EXPR, TREE_TYPE (gpr), gpr, t); TREE_SIDE_EFFECTS (t) = 1; expand_expr (t, const0_rtx, VOIDmode, EXPAND_NORMAL); /* Initialize the `freg_used' field. */ - t = build_int_2 (current_function_args_info.floats / UNITS_PER_WORD, 0); + t = build_int_cst (NULL_TREE, + current_function_args_info.floats / UNITS_PER_WORD, 0); t = build (MODIFY_EXPR, TREE_TYPE (fpr), fpr, t); TREE_SIDE_EFFECTS (t) = 1; expand_expr (t, const0_rtx, VOIDmode, EXPAND_NORMAL); diff --git a/gcc/config/ia64/ia64.c b/gcc/config/ia64/ia64.c index 0f7e689f245..f4b45d3c9a5 100644 --- a/gcc/config/ia64/ia64.c +++ b/gcc/config/ia64/ia64.c @@ -3407,9 +3407,9 @@ ia64_gimplify_va_arg (tree valist, tree type, tree *pre_p, tree *post_p) ? int_size_in_bytes (type) > 8 : TYPE_ALIGN (type) > 8 * BITS_PER_UNIT) { tree t = build (PLUS_EXPR, TREE_TYPE (valist), valist, - build_int_2 (2 * UNITS_PER_WORD - 1, 0)); + build_int_cst (NULL_TREE, 2 * UNITS_PER_WORD - 1, 0)); t = build (BIT_AND_EXPR, TREE_TYPE (t), t, - build_int_2 (-2 * UNITS_PER_WORD, -1)); + build_int_cst (NULL_TREE, -2 * UNITS_PER_WORD, -1)); t = build (MODIFY_EXPR, TREE_TYPE (valist), valist, t); gimplify_and_add (t, pre_p); } diff --git a/gcc/config/mips/mips.c b/gcc/config/mips/mips.c index 3ded7410176..066df115fea 100644 --- a/gcc/config/mips/mips.c +++ b/gcc/config/mips/mips.c @@ -3351,7 +3351,7 @@ mips_build_builtin_va_list (void) unsigned_char_type_node); /* Explicitly pad to the size of a pointer, so that -Wpadded won't warn on every user file. */ - index = build_int_2 (GET_MODE_SIZE (ptr_mode) - 2 - 1, 0); + index = build_int_cst (NULL_TREE, GET_MODE_SIZE (ptr_mode) - 2 - 1, 0); array = build_array_type (unsigned_char_type_node, build_index_type (index)); f_res = build_decl (FIELD_DECL, get_identifier ("__reserved"), array); @@ -3435,7 +3435,8 @@ mips_va_start (tree valist, rtx nextarg) t = make_tree (TREE_TYPE (ovfl), virtual_incoming_args_rtx); if (cum->stack_words > 0) t = build (PLUS_EXPR, TREE_TYPE (ovfl), t, - build_int_2 (cum->stack_words * UNITS_PER_WORD, 0)); + build_int_cst (NULL_TREE, + cum->stack_words * UNITS_PER_WORD, 0)); t = build (MODIFY_EXPR, TREE_TYPE (ovfl), ovfl, t); expand_expr (t, const0_rtx, VOIDmode, EXPAND_NORMAL); @@ -3452,14 +3453,14 @@ mips_va_start (tree valist, rtx nextarg) fpr_offset &= ~(UNITS_PER_FPVALUE - 1); if (fpr_offset) t = build (PLUS_EXPR, TREE_TYPE (ftop), t, - build_int_2 (-fpr_offset, -1)); + build_int_cst (NULL_TREE, -fpr_offset, -1)); t = build (MODIFY_EXPR, TREE_TYPE (ftop), ftop, t); expand_expr (t, const0_rtx, VOIDmode, EXPAND_NORMAL); /* Emit code to initialize GOFF, the offset from GTOP of the next GPR argument. */ t = build (MODIFY_EXPR, TREE_TYPE (goff), goff, - build_int_2 (gpr_save_area_size, 0)); + build_int_cst (NULL_TREE, gpr_save_area_size, 0)); expand_expr (t, const0_rtx, VOIDmode, EXPAND_NORMAL); /* Likewise emit code to initialize FOFF, the offset from FTOP @@ -3467,7 +3468,7 @@ mips_va_start (tree valist, rtx nextarg) fpr_save_area_size = (MAX_ARGS_IN_REGISTERS - cum->num_fprs) * UNITS_PER_FPREG; t = build (MODIFY_EXPR, TREE_TYPE (foff), foff, - build_int_2 (fpr_save_area_size, 0)); + build_int_cst (NULL_TREE, fpr_save_area_size, 0)); expand_expr (t, const0_rtx, VOIDmode, EXPAND_NORMAL); } else @@ -3591,7 +3592,7 @@ mips_gimplify_va_arg_expr (tree valist, tree type, tree *pre_p, tree *post_p) { /* [1] Emit code for: off &= -rsize. */ t = build (BIT_AND_EXPR, TREE_TYPE (off), off, - build_int_2 (-rsize, -1)); + build_int_cst (NULL_TREE, -rsize, -1)); t = build (MODIFY_EXPR, TREE_TYPE (off), off, t); gimplify_and_add (t, pre_p); } @@ -3605,7 +3606,7 @@ mips_gimplify_va_arg_expr (tree valist, tree type, tree *pre_p, tree *post_p) /* [5] Emit code for: off -= rsize. We do this as a form of post-increment not available to C. Also widen for the coming pointer arithmetic. */ - t = fold_convert (TREE_TYPE (off), build_int_2 (rsize, 0)); + t = fold_convert (TREE_TYPE (off), build_int_cst (NULL_TREE, rsize, 0)); t = build (POSTDECREMENT_EXPR, TREE_TYPE (off), off, t); t = fold_convert (sizetype, t); t = fold_convert (TREE_TYPE (top), t); @@ -3615,7 +3616,8 @@ mips_gimplify_va_arg_expr (tree valist, tree type, tree *pre_p, tree *post_p) t = build (MINUS_EXPR, TREE_TYPE (top), top, t); if (BYTES_BIG_ENDIAN && rsize > size) { - u = fold_convert (TREE_TYPE (t), build_int_2 (rsize - size, 0)); + u = fold_convert (TREE_TYPE (t), build_int_cst (NULL_TREE, + rsize - size, 0)); t = build (PLUS_EXPR, TREE_TYPE (t), t, u); } COND_EXPR_THEN (addr) = t; @@ -3623,9 +3625,11 @@ mips_gimplify_va_arg_expr (tree valist, tree type, tree *pre_p, tree *post_p) if (osize > UNITS_PER_WORD) { /* [9] Emit: ovfl += ((intptr_t) ovfl + osize - 1) & -osize. */ - u = fold_convert (TREE_TYPE (ovfl), build_int_2 (osize - 1, 0)); + u = fold_convert (TREE_TYPE (ovfl), + build_int_cst (NULL_TREE, osize - 1, 0)); t = build (PLUS_EXPR, TREE_TYPE (ovfl), ovfl, u); - u = fold_convert (TREE_TYPE (ovfl), build_int_2 (-osize, -1)); + u = fold_convert (TREE_TYPE (ovfl), + build_int_cst (NULL_TREE, -osize, -1)); t = build (BIT_AND_EXPR, TREE_TYPE (ovfl), t, u); align = build (MODIFY_EXPR, TREE_TYPE (ovfl), ovfl, t); } @@ -3635,11 +3639,13 @@ mips_gimplify_va_arg_expr (tree valist, tree type, tree *pre_p, tree *post_p) /* [10, 11]. Emit code to store ovfl in addr_rtx, then post-increment ovfl by osize. On big-endian machines, the argument has OSIZE - SIZE bytes of leading padding. */ - u = fold_convert (TREE_TYPE (ovfl), build_int_2 (osize, 0)); + u = fold_convert (TREE_TYPE (ovfl), + build_int_cst (NULL_TREE, osize, 0)); t = build (POSTINCREMENT_EXPR, TREE_TYPE (ovfl), ovfl, u); if (BYTES_BIG_ENDIAN && osize > size) { - u = fold_convert (TREE_TYPE (t), build_int_2 (osize - size, 0)); + u = fold_convert (TREE_TYPE (t), + build_int_cst (NULL_TREE, osize - size, 0)); t = build (PLUS_EXPR, TREE_TYPE (t), t, u); } diff --git a/gcc/config/pa/pa.c b/gcc/config/pa/pa.c index e89be830b70..314c5f8b757 100644 --- a/gcc/config/pa/pa.c +++ b/gcc/config/pa/pa.c @@ -6119,8 +6119,7 @@ hppa_gimplify_va_arg_expr (tree valist, tree type, tree *pre_p, tree *post_p) /* Copied from va-pa.h, but we probably don't need to align to word size, since we generate and preserve that invariant. */ - u = build_int_2 ((size > 4 ? -8 : -4), -1); - u = fold_convert (valist_type, u); + u = build_int_cst (valist_type, (size > 4 ? -8 : -4), -1); t = build (BIT_AND_EXPR, valist_type, t, u); t = build (MODIFY_EXPR, valist_type, valist, t); diff --git a/gcc/config/rs6000/rs6000.c b/gcc/config/rs6000/rs6000.c index 56008c0b2e7..3331af07083 100644 --- a/gcc/config/rs6000/rs6000.c +++ b/gcc/config/rs6000/rs6000.c @@ -5428,11 +5428,13 @@ rs6000_va_start (tree valist, rtx nextarg) HOST_WIDE_INT_PRINT_DEC", n_fpr = "HOST_WIDE_INT_PRINT_DEC"\n", words, n_gpr, n_fpr); - t = build (MODIFY_EXPR, TREE_TYPE (gpr), gpr, build_int_2 (n_gpr, 0)); + t = build (MODIFY_EXPR, TREE_TYPE (gpr), gpr, + build_int_cst (NULL_TREE, n_gpr, 0)); TREE_SIDE_EFFECTS (t) = 1; expand_expr (t, const0_rtx, VOIDmode, EXPAND_NORMAL); - t = build (MODIFY_EXPR, TREE_TYPE (fpr), fpr, build_int_2 (n_fpr, 0)); + t = build (MODIFY_EXPR, TREE_TYPE (fpr), fpr, + build_int_cst (NULL_TREE, n_fpr, 0)); TREE_SIDE_EFFECTS (t) = 1; expand_expr (t, const0_rtx, VOIDmode, EXPAND_NORMAL); @@ -5440,7 +5442,7 @@ rs6000_va_start (tree valist, rtx nextarg) t = make_tree (TREE_TYPE (ovf), virtual_incoming_args_rtx); if (words != 0) t = build (PLUS_EXPR, TREE_TYPE (ovf), t, - build_int_2 (words * UNITS_PER_WORD, 0)); + build_int_cst (NULL_TREE, words * UNITS_PER_WORD, 0)); t = build (MODIFY_EXPR, TREE_TYPE (ovf), ovf, t); TREE_SIDE_EFFECTS (t) = 1; expand_expr (t, const0_rtx, VOIDmode, EXPAND_NORMAL); @@ -5448,7 +5450,7 @@ rs6000_va_start (tree valist, rtx nextarg) /* Find the register save area. */ t = make_tree (TREE_TYPE (sav), virtual_stack_vars_rtx); t = build (PLUS_EXPR, TREE_TYPE (sav), t, - build_int_2 (-RS6000_VARARGS_SIZE, -1)); + build_int_cst (NULL_TREE, -RS6000_VARARGS_SIZE, -1)); t = build (MODIFY_EXPR, TREE_TYPE (sav), sav, t); TREE_SIDE_EFFECTS (t) = 1; expand_expr (t, const0_rtx, VOIDmode, EXPAND_NORMAL); @@ -5605,7 +5607,8 @@ rs6000_gimplify_va_arg (tree valist, tree type, tree *pre_p, tree *post_p) if (align != 1) { t = build2 (PLUS_EXPR, TREE_TYPE (t), t, size_int (align - 1)); - t = build2 (BIT_AND_EXPR, TREE_TYPE (t), t, build_int_2 (-align, -1)); + t = build2 (BIT_AND_EXPR, TREE_TYPE (t), t, + build_int_cst (NULL_TREE, -align, -1)); } gimplify_expr (&t, pre_p, NULL, is_gimple_val, fb_rvalue); @@ -15975,7 +15978,7 @@ static void add_compiler_branch_island (tree label_name, tree function_name, int line_number) { tree branch_island = build_tree_list (function_name, label_name); - TREE_TYPE (branch_island) = build_int_2 (line_number, 0); + TREE_TYPE (branch_island) = build_int_cst (NULL_TREE, line_number, 0); TREE_CHAIN (branch_island) = branch_island_list; branch_island_list = branch_island; } diff --git a/gcc/config/s390/s390.c b/gcc/config/s390/s390.c index be3aeae59b4..627940ca656 100644 --- a/gcc/config/s390/s390.c +++ b/gcc/config/s390/s390.c @@ -6928,11 +6928,13 @@ s390_va_start (tree valist, rtx nextarg ATTRIBUTE_UNUSED) n_gpr = current_function_args_info.gprs; n_fpr = current_function_args_info.fprs; - t = build (MODIFY_EXPR, TREE_TYPE (gpr), gpr, build_int_2 (n_gpr, 0)); + t = build (MODIFY_EXPR, TREE_TYPE (gpr), gpr, + build_int_cst (NULL_TREE, n_gpr, 0)); TREE_SIDE_EFFECTS (t) = 1; expand_expr (t, const0_rtx, VOIDmode, EXPAND_NORMAL); - t = build (MODIFY_EXPR, TREE_TYPE (fpr), fpr, build_int_2 (n_fpr, 0)); + t = build (MODIFY_EXPR, TREE_TYPE (fpr), fpr, + build_int_cst (NULL_TREE, n_fpr, 0)); TREE_SIDE_EFFECTS (t) = 1; expand_expr (t, const0_rtx, VOIDmode, EXPAND_NORMAL); @@ -6945,7 +6947,7 @@ s390_va_start (tree valist, rtx nextarg ATTRIBUTE_UNUSED) fprintf (stderr, "va_start: n_gpr = %d, n_fpr = %d off %d\n", (int)n_gpr, (int)n_fpr, off); - t = build (PLUS_EXPR, TREE_TYPE (ovf), t, build_int_2 (off, 0)); + t = build (PLUS_EXPR, TREE_TYPE (ovf), t, build_int_cst (NULL_TREE, off, 0)); t = build (MODIFY_EXPR, TREE_TYPE (ovf), ovf, t); TREE_SIDE_EFFECTS (t) = 1; @@ -6955,11 +6957,12 @@ s390_va_start (tree valist, rtx nextarg ATTRIBUTE_UNUSED) t = make_tree (TREE_TYPE (sav), return_address_pointer_rtx); if (TARGET_KERNEL_BACKCHAIN) t = build (PLUS_EXPR, TREE_TYPE (sav), t, - build_int_2 (-(RETURN_REGNUM - 2) * UNITS_PER_WORD - - (TARGET_64BIT ? 4 : 2) * 8, -1)); + build_int_cst (NULL_TREE, + -(RETURN_REGNUM - 2) * UNITS_PER_WORD + - (TARGET_64BIT ? 4 : 2) * 8, -1)); else t = build (PLUS_EXPR, TREE_TYPE (sav), t, - build_int_2 (-RETURN_REGNUM * UNITS_PER_WORD, -1)); + build_int_cst (NULL_TREE, -RETURN_REGNUM * UNITS_PER_WORD, -1)); t = build (MODIFY_EXPR, TREE_TYPE (sav), sav, t); TREE_SIDE_EFFECTS (t) = 1; diff --git a/gcc/config/sh/sh.c b/gcc/config/sh/sh.c index 7eef57ab238..4a59f5c64e7 100644 --- a/gcc/config/sh/sh.c +++ b/gcc/config/sh/sh.c @@ -6339,7 +6339,7 @@ sh_va_start (tree valist, rtx nextarg) else nfp = 0; u = fold (build (PLUS_EXPR, ptr_type_node, u, - build_int_2 (UNITS_PER_WORD * nfp, 0))); + build_int_cst (NULL_TREE, UNITS_PER_WORD * nfp, 0))); t = build (MODIFY_EXPR, ptr_type_node, next_fp_limit, u); TREE_SIDE_EFFECTS (t) = 1; expand_expr (t, const0_rtx, VOIDmode, EXPAND_NORMAL); @@ -6354,7 +6354,7 @@ sh_va_start (tree valist, rtx nextarg) else nint = 0; u = fold (build (PLUS_EXPR, ptr_type_node, u, - build_int_2 (UNITS_PER_WORD * nint, 0))); + build_int_cst (NULL_TREE, UNITS_PER_WORD * nint, 0))); t = build (MODIFY_EXPR, ptr_type_node, next_o_limit, u); TREE_SIDE_EFFECTS (t) = 1; expand_expr (t, const0_rtx, VOIDmode, EXPAND_NORMAL); diff --git a/gcc/config/stormy16/stormy16.c b/gcc/config/stormy16/stormy16.c index a5ee896ee56..7297fa6636c 100644 --- a/gcc/config/stormy16/stormy16.c +++ b/gcc/config/stormy16/stormy16.c @@ -1292,13 +1292,14 @@ xstormy16_expand_builtin_va_start (tree valist, rtx nextarg ATTRIBUTE_UNUSED) t = make_tree (TREE_TYPE (base), virtual_incoming_args_rtx); t = build (PLUS_EXPR, TREE_TYPE (base), t, - build_int_2 (INCOMING_FRAME_SP_OFFSET, 0)); + build_int_cst (NULL_TREE, INCOMING_FRAME_SP_OFFSET, 0)); t = build (MODIFY_EXPR, TREE_TYPE (base), base, t); TREE_SIDE_EFFECTS (t) = 1; expand_expr (t, const0_rtx, VOIDmode, EXPAND_NORMAL); t = build (MODIFY_EXPR, TREE_TYPE (count), count, - build_int_2 (current_function_args_info * UNITS_PER_WORD, 0)); + build_int_cst (NULL_TREE, + current_function_args_info * UNITS_PER_WORD, 0)); TREE_SIDE_EFFECTS (t) = 1; expand_expr (t, const0_rtx, VOIDmode, EXPAND_NORMAL); } diff --git a/gcc/config/xtensa/xtensa.c b/gcc/config/xtensa/xtensa.c index 66b04cfd29c..e91e943f57d 100644 --- a/gcc/config/xtensa/xtensa.c +++ b/gcc/config/xtensa/xtensa.c @@ -2448,7 +2448,8 @@ xtensa_va_start (tree valist, rtx nextarg ATTRIBUTE_UNUSED) /* Set the __va_stk member to ($arg_ptr - 32). */ u = make_tree (ptr_type_node, virtual_incoming_args_rtx); - u = fold (build (PLUS_EXPR, ptr_type_node, u, build_int_2 (-32, -1))); + u = fold (build (PLUS_EXPR, ptr_type_node, u, + build_int_cst (NULL_TREE, -32, -1))); t = build (MODIFY_EXPR, ptr_type_node, stk, u); TREE_SIDE_EFFECTS (t) = 1; expand_expr (t, const0_rtx, VOIDmode, EXPAND_NORMAL); @@ -2458,7 +2459,7 @@ xtensa_va_start (tree valist, rtx nextarg ATTRIBUTE_UNUSED) alignment offset for __va_stk. */ if (arg_words >= MAX_ARGS_IN_REGISTERS) arg_words += 2; - u = build_int_2 (arg_words * UNITS_PER_WORD, 0); + u = build_int_cst (NULL_TREE, arg_words * UNITS_PER_WORD, 0); t = build (MODIFY_EXPR, integer_type_node, ndx, u); TREE_SIDE_EFFECTS (t) = 1; expand_expr (t, const0_rtx, VOIDmode, EXPAND_NORMAL); @@ -2525,9 +2526,9 @@ xtensa_gimplify_va_arg_expr (tree valist, tree type, tree *pre_p, int align = TYPE_ALIGN (type) / BITS_PER_UNIT; t = build (PLUS_EXPR, integer_type_node, orig_ndx, - build_int_2 (align - 1, 0)); + build_int_cst (NULL_TREE, align - 1, 0)); t = build (BIT_AND_EXPR, integer_type_node, t, - build_int_2 (-align, -1)); + build_int_cst (NULL_TREE, -align, -1)); t = build (MODIFY_EXPR, integer_type_node, orig_ndx, t); gimplify_and_add (t, pre_p); } @@ -2557,7 +2558,7 @@ xtensa_gimplify_va_arg_expr (tree valist, tree type, tree *pre_p, lab_false = create_artificial_label (); lab_over = create_artificial_label (); - t = build_int_2 (MAX_ARGS_IN_REGISTERS * UNITS_PER_WORD, 0); + t = build_int_cst (NULL_TREE, MAX_ARGS_IN_REGISTERS * UNITS_PER_WORD, 0); t = build (GT_EXPR, boolean_type_node, ndx, t); t = build (COND_EXPR, void_type_node, t, build (GOTO_EXPR, void_type_node, lab_false), @@ -2587,7 +2588,7 @@ xtensa_gimplify_va_arg_expr (tree valist, tree type, tree *pre_p, lab_false2 = create_artificial_label (); - t = build_int_2 (MAX_ARGS_IN_REGISTERS * UNITS_PER_WORD, 0); + t = build_int_cst (NULL_TREE, MAX_ARGS_IN_REGISTERS * UNITS_PER_WORD, 0); t = build (GT_EXPR, boolean_type_node, orig_ndx, t); t = build (COND_EXPR, void_type_node, t, build (GOTO_EXPR, void_type_node, lab_false2), diff --git a/gcc/convert.c b/gcc/convert.c index 6ff1a541131..9517c50bf3a 100644 --- a/gcc/convert.c +++ b/gcc/convert.c @@ -43,8 +43,7 @@ convert_to_pointer (tree type, tree expr) { if (integer_zerop (expr)) { - expr = build_int_2 (0, 0); - TREE_TYPE (expr) = type; + expr = build_int_cst (type, 0, 0); return expr; } diff --git a/gcc/coverage.c b/gcc/coverage.c index 4b4c6362834..9f6e13b5c56 100644 --- a/gcc/coverage.c +++ b/gcc/coverage.c @@ -378,7 +378,7 @@ coverage_counter_alloc (unsigned counter, unsigned num) will make any clever transformation on it. */ char buf[20]; tree domain_tree - = build_index_type (build_int_2 (1000, 0)); /* replaced later */ + = build_index_type (build_int_cst (NULL_TREE, 1000, 0)); /* replaced later */ tree gcov_type_array_type = build_array_type (GCOV_TYPE_NODE, domain_tree); tree_ctr_tables[counter] @@ -434,7 +434,8 @@ tree_coverage_counter_ref (unsigned counter, unsigned no) /* "no" here is an array index, scaled to bytes later. */ return build4 (ARRAY_REF, GCOV_TYPE_NODE, tree_ctr_tables[counter], - fold_convert (domain_type, build_int_2 (no, 0)), + fold_convert (domain_type, + build_int_cst (NULL_TREE, no, 0)), TYPE_MIN_VALUE (domain_type), size_binop (EXACT_DIV_EXPR, TYPE_SIZE_UNIT (GCOV_TYPE_NODE), size_int (TYPE_ALIGN_UNIT (GCOV_TYPE_NODE)))); @@ -609,7 +610,8 @@ build_fn_info_type (unsigned int counters) TREE_CHAIN (field) = fields; fields = field; - array_type = build_index_type (build_int_2 (counters - 1, 0)); + array_type = build_int_cst (NULL_TREE, counters - 1, 0); + array_type = build_index_type (array_type); array_type = build_array_type (unsigned_type_node, array_type); /* counters */ @@ -635,25 +637,21 @@ build_fn_info_value (const struct function_list *function, tree type) tree array_value = NULL_TREE; /* ident */ - value = tree_cons (fields, - convert (unsigned_intSI_type_node, - build_int_2 (function->ident, 0)), - value); + value = tree_cons (fields, build_int_cst (unsigned_intSI_type_node, + function->ident, 0), value); fields = TREE_CHAIN (fields); /* checksum */ - value = tree_cons (fields, - convert (unsigned_intSI_type_node, - build_int_2 (function->checksum, 0)), - value); + value = tree_cons (fields, build_int_cst (unsigned_intSI_type_node, + function->checksum, 0), value); fields = TREE_CHAIN (fields); /* counters */ for (ix = 0; ix != GCOV_COUNTERS; ix++) if (prg_ctr_mask & (1 << ix)) { - tree counters = convert (unsigned_type_node, - build_int_2 (function->n_ctrs[ix], 0)); + tree counters = build_int_cst (unsigned_type_node, + function->n_ctrs[ix], 0); array_value = tree_cons (NULL_TREE, counters, array_value); } @@ -714,8 +712,8 @@ build_ctr_info_value (unsigned int counter, tree type) /* counters */ value = tree_cons (fields, - convert (unsigned_intSI_type_node, - build_int_2 (prg_n_ctrs[counter], 0)), + build_int_cst (unsigned_intSI_type_node, + prg_n_ctrs[counter], 0), value); fields = TREE_CHAIN (fields); @@ -723,7 +721,9 @@ build_ctr_info_value (unsigned int counter, tree type) { tree array_type; - array_type = build_index_type (build_int_2 (prg_n_ctrs[counter] - 1, 0)); + array_type = build_int_cst (unsigned_type_node, + prg_n_ctrs[counter] - 1, 0); + array_type = build_index_type (array_type); array_type = build_array_type (TREE_TYPE (TREE_TYPE (fields)), array_type); @@ -789,9 +789,8 @@ build_gcov_info (void) field = build_decl (FIELD_DECL, NULL_TREE, unsigned_intSI_type_node); TREE_CHAIN (field) = fields; fields = field; - value = tree_cons (field, convert (unsigned_intSI_type_node, - build_int_2 (GCOV_VERSION, 0)), - value); + value = tree_cons (field, build_int_cst (unsigned_intSI_type_node, + GCOV_VERSION, 0), value); /* next -- NULL */ field = build_decl (FIELD_DECL, NULL_TREE, build_pointer_type (const_type)); @@ -803,9 +802,8 @@ build_gcov_info (void) field = build_decl (FIELD_DECL, NULL_TREE, unsigned_intSI_type_node); TREE_CHAIN (field) = fields; fields = field; - value = tree_cons (field, convert (unsigned_intSI_type_node, - build_int_2 (local_tick, 0)), - value); + value = tree_cons (field, build_int_cst (unsigned_intSI_type_node, + local_tick, 0), value); /* Filename */ string_type = build_pointer_type (build_qualified_type (char_type_node, @@ -821,9 +819,9 @@ build_gcov_info (void) filename_string = build_string (filename_len + 1, filename); if (filename != da_file_name) free (filename); - TREE_TYPE (filename_string) = - build_array_type (char_type_node, - build_index_type (build_int_2 (filename_len, 0))); + TREE_TYPE (filename_string) = build_array_type + (char_type_node, build_index_type + (build_int_cst (NULL_TREE, filename_len, 0))); value = tree_cons (field, build1 (ADDR_EXPR, string_type, filename_string), value); @@ -839,7 +837,8 @@ build_gcov_info (void) { tree array_type; - array_type = build_index_type (build_int_2 (n_fns - 1, 0)); + array_type = build_index_type (build_int_cst (NULL_TREE, + n_fns - 1, 0)); array_type = build_array_type (fn_info_type, array_type); fn_info_value = build_constructor (array_type, nreverse (fn_info_value)); @@ -853,7 +852,7 @@ build_gcov_info (void) TREE_CHAIN (field) = fields; fields = field; value = tree_cons (field, - convert (unsigned_type_node, build_int_2 (n_fns, 0)), + build_int_cst (unsigned_type_node, n_fns, 0), value); /* fn_info table */ @@ -867,13 +866,13 @@ build_gcov_info (void) TREE_CHAIN (field) = fields; fields = field; value = tree_cons (field, - convert (unsigned_type_node, - build_int_2 (prg_ctr_mask, 0)), + build_int_cst (unsigned_type_node, prg_ctr_mask, 0), value); /* counters */ ctr_info_type = build_ctr_info_type (); - ctr_info_ary_type = build_index_type (build_int_2 (n_ctr_types, 0)); + ctr_info_ary_type = build_index_type (build_int_cst (NULL_TREE, + n_ctr_types, 0)); ctr_info_ary_type = build_array_type (ctr_info_type, ctr_info_ary_type); for (ix = 0; ix != GCOV_COUNTERS; ix++) if (prg_ctr_mask & (1 << ix)) diff --git a/gcc/cp/ChangeLog b/gcc/cp/ChangeLog index 4e3f8d70043..b5b773983a1 100644 --- a/gcc/cp/ChangeLog +++ b/gcc/cp/ChangeLog @@ -1,3 +1,24 @@ +2004-08-15 Nathan Sidwell + + * call.c (convert_class_to_reference, + build_user_type_conversion_1, convert_like_real, + build_java_interface_fn_ref, build_special_member_call): Use + build_int_cst. + * class.c (build_vtbl_initializer): Likewise. + * cp-gimplify.c (cp_gimplify_expr): Likewise. + * cvt.c (cp_convert_to_pointer): Likewise. + * decl.c (cxx_init_decl_processing, complete_array_type): Likewise. + * decl2.c (start_static_initialization_or_destruction, + generate_ctor_or_dtor_function): Likewise. + * except.c (build_throw): Likewise. + * lex.c (cxx_init): Likewise. + * mangle.c (write_integer_cst): Likewise. + * rtti.c (build_headof, get_tinfo_decl_dynamic, + build_dynamic_cast_1, ptr_initializer, ptm_initializer, + get_pseudo_ti_init): Likewise. + * search.c (get_dynamic_cast_base_type): Likewise. + * tree.c (build_shared_int_cst): Likewise. + 2004-08-12 Mark Mitchell PR c++/16273 diff --git a/gcc/cp/call.c b/gcc/cp/call.c index 23d65addbdd..ca6b0d886ce 100644 --- a/gcc/cp/call.c +++ b/gcc/cp/call.c @@ -919,8 +919,7 @@ convert_class_to_reference (tree t, tree s, tree expr) error messages, which we should not issue now because we are just trying to find a conversion operator. Therefore, we use NULL, cast to the appropriate type. */ - arglist = build_int_2 (0, 0); - TREE_TYPE (arglist) = build_pointer_type (s); + arglist = build_int_cst (build_pointer_type (s), 0, 0); arglist = build_tree_list (NULL_TREE, arglist); reference_type = build_reference_type (t); @@ -2520,8 +2519,7 @@ build_user_type_conversion_1 (tree totype, tree expr, int flags) ctors = BASELINK_FUNCTIONS (ctors); - t = build_int_2 (0, 0); - TREE_TYPE (t) = build_pointer_type (totype); + t = build_int_cst (build_pointer_type (totype), 0, 0); args = build_tree_list (NULL_TREE, expr); /* We should never try to call the abstract or base constructor from here. */ @@ -4182,8 +4180,8 @@ convert_like_real (conversion *convs, tree expr, tree fn, int argnum, if (DECL_CONSTRUCTOR_P (convfn)) { - tree t = build_int_2 (0, 0); - TREE_TYPE (t) = build_pointer_type (DECL_CONTEXT (convfn)); + tree t = build_int_cst (build_pointer_type (DECL_CONTEXT (convfn)), + 0, 0); args = build_tree_list (NULL_TREE, expr); if (DECL_HAS_IN_CHARGE_PARM_P (convfn) @@ -4961,7 +4959,7 @@ build_java_interface_fn_ref (tree fn, tree instance) break; i++; } - idx = build_int_2 (i, 0); + idx = build_int_cst (NULL_TREE, i, 0); lookup_args = tree_cons (NULL_TREE, klass_ref, tree_cons (NULL_TREE, iface_ref, @@ -5037,8 +5035,7 @@ build_special_member_call (tree instance, tree name, tree args, /* Handle the special case where INSTANCE is NULL_TREE. */ if (name == complete_ctor_identifier && !instance) { - instance = build_int_2 (0, 0); - TREE_TYPE (instance) = build_pointer_type (class_type); + instance = build_int_cst (build_pointer_type (class_type), 0, 0); instance = build1 (INDIRECT_REF, class_type, instance); } else diff --git a/gcc/cp/class.c b/gcc/cp/class.c index 4b7765bf883..418659e19f6 100644 --- a/gcc/cp/class.c +++ b/gcc/cp/class.c @@ -7404,7 +7404,7 @@ build_vtbl_initializer (tree binfo, { tree fdesc = build (FDESC_EXPR, vfunc_ptr_type_node, TREE_OPERAND (init, 0), - build_int_2 (i, 0)); + build_int_cst (NULL_TREE, i, 0)); TREE_CONSTANT (fdesc) = 1; TREE_INVARIANT (fdesc) = 1; diff --git a/gcc/cp/cp-gimplify.c b/gcc/cp/cp-gimplify.c index 5b96e39dbef..5568a952b5b 100644 --- a/gcc/cp/cp-gimplify.c +++ b/gcc/cp/cp-gimplify.c @@ -210,12 +210,8 @@ cp_gimplify_expr (tree *expr_p, tree *pre_p, tree *post_p) break; case EMPTY_CLASS_EXPR: - { - /* Yes, an INTEGER_CST with RECORD_TYPE. */ - tree i = build_int_2 (0, 0); - TREE_TYPE (i) = TREE_TYPE (*expr_p); - *expr_p = i; - } + /* We create an INTEGER_CST with RECORD_TYPE and value zero. */ + *expr_p = build_int_cst (TREE_TYPE (*expr_p), 0, 0); ret = GS_OK; break; diff --git a/gcc/cp/cvt.c b/gcc/cp/cvt.c index 56057af26dd..70aba6ead78 100644 --- a/gcc/cp/cvt.c +++ b/gcc/cp/cvt.c @@ -261,15 +261,15 @@ cp_convert_to_pointer (tree type, tree expr, bool force) return build_ptrmemfunc (TYPE_PTRMEMFUNC_FN_TYPE (type), expr, 0); if (TYPE_PTRMEM_P (type)) - /* A NULL pointer-to-member is represented by -1, not by - zero. */ - expr = build_int_2 (-1, -1); + { + /* A NULL pointer-to-member is represented by -1, not by + zero. */ + expr = build_int_cst (type, -1, -1); + /* Fix up the representation of -1 if appropriate. */ + expr = force_fit_type (expr, 0, false, false); + } else - expr = build_int_2 (0, 0); - TREE_TYPE (expr) = type; - - /* Fix up the representation of -1 if appropriate. */ - expr = force_fit_type (expr, 0, false, false); + expr = build_int_cst (type, 0, 0); return expr; } diff --git a/gcc/cp/decl.c b/gcc/cp/decl.c index 1d5b78c12a0..2be55d6ee97 100644 --- a/gcc/cp/decl.c +++ b/gcc/cp/decl.c @@ -2963,10 +2963,8 @@ cxx_init_decl_processing (void) java_char_type_node = record_builtin_java_type ("__java_char", -16); java_boolean_type_node = record_builtin_java_type ("__java_boolean", -1); - integer_two_node = build_int_2 (2, 0); - TREE_TYPE (integer_two_node) = integer_type_node; - integer_three_node = build_int_2 (3, 0); - TREE_TYPE (integer_three_node) = integer_type_node; + integer_two_node = build_int_cst (NULL_TREE, 2, 0); + integer_three_node = build_int_cst (NULL_TREE, 3, 0); record_builtin_type (RID_BOOL, "bool", boolean_type_node); truthvalue_type_node = boolean_type_node; @@ -5254,8 +5252,9 @@ complete_array_type (tree type, tree initial_value, int do_default) { int eltsize = int_size_in_bytes (TREE_TYPE (TREE_TYPE (initial_value))); - maxindex = build_int_2 ((TREE_STRING_LENGTH (initial_value) - / eltsize) - 1, 0); + maxindex = build_int_cst (NULL_TREE, + (TREE_STRING_LENGTH (initial_value) + / eltsize) - 1, 0); } else if (TREE_CODE (initial_value) == CONSTRUCTOR) { @@ -5279,14 +5278,14 @@ complete_array_type (tree type, tree initial_value, int do_default) initial_value = NULL_TREE; /* Prevent further error messages. */ - maxindex = build_int_2 (0, 0); + maxindex = build_int_cst (NULL_TREE, 0, 0); } } if (!maxindex) { if (do_default) - maxindex = build_int_2 (0, 0); + maxindex = build_int_cst (NULL_TREE, 0, 0); value = 2; } diff --git a/gcc/cp/decl2.c b/gcc/cp/decl2.c index ae4ccc871e9..ab83b982210 100644 --- a/gcc/cp/decl2.c +++ b/gcc/cp/decl2.c @@ -2351,7 +2351,7 @@ start_static_initialization_or_destruction (tree decl, int initp) guard_if_stmt = begin_if_stmt (); cond = cp_build_binary_op (EQ_EXPR, priority_decl, - build_int_2 (priority, 0)); + build_int_cst (NULL_TREE, priority, 0)); init_cond = initp ? integer_one_node : integer_zero_node; init_cond = cp_build_binary_op (EQ_EXPR, initialize_p_decl, @@ -2601,9 +2601,11 @@ generate_ctor_or_dtor_function (bool constructor_p, int priority, if (! body) body = start_objects (function_key, priority); - arguments = tree_cons (NULL_TREE, build_int_2 (priority, 0), + arguments = tree_cons (NULL_TREE, + build_int_cst (NULL_TREE, priority, 0), NULL_TREE); - arguments = tree_cons (NULL_TREE, build_int_2 (constructor_p, 0), + arguments = tree_cons (NULL_TREE, + build_int_cst (NULL_TREE, constructor_p, 0), arguments); finish_expr_stmt (build_function_call (fndecl, arguments)); } diff --git a/gcc/cp/except.c b/gcc/cp/except.c index b78cecd5d86..fd8b054edd5 100644 --- a/gcc/cp/except.c +++ b/gcc/cp/except.c @@ -721,11 +721,8 @@ build_throw (tree exp) cleanup = build1 (ADDR_EXPR, cleanup_type, cleanup); } else - { - cleanup = build_int_2 (0, 0); - TREE_TYPE (cleanup) = cleanup_type; - } - + cleanup = build_int_cst (cleanup_type, 0, 0); + tmp = tree_cons (NULL_TREE, cleanup, NULL_TREE); tmp = tree_cons (NULL_TREE, throw_type, tmp); tmp = tree_cons (NULL_TREE, ptr, tmp); diff --git a/gcc/cp/lex.c b/gcc/cp/lex.c index 00adb7239c5..c44e7c0863b 100644 --- a/gcc/cp/lex.c +++ b/gcc/cp/lex.c @@ -355,8 +355,7 @@ cxx_init (void) cxx_init_decl_processing (); /* Create the built-in __null node. */ - null_node = build_int_2 (0, 0); - TREE_TYPE (null_node) = c_common_type_for_size (POINTER_SIZE, 0); + null_node = build_int_cst (c_common_type_for_size (POINTER_SIZE, 0), 0, 0); ridpointers[RID_NULL] = null_node; interface_unknown = 1; diff --git a/gcc/cp/mangle.c b/gcc/cp/mangle.c index 211c218321d..4235e35d5ff 100644 --- a/gcc/cp/mangle.c +++ b/gcc/cp/mangle.c @@ -1183,9 +1183,9 @@ write_integer_cst (const tree cst) } type = c_common_signed_or_unsigned_type (1, TREE_TYPE (cst)); - base = build_int_2 (chunk, 0); - n = build_int_2 (TREE_INT_CST_LOW (cst), TREE_INT_CST_HIGH (cst)); - TREE_TYPE (n) = TREE_TYPE (base) = type; + base = build_int_cst (type, chunk, 0); + n = build_int_cst (type, + TREE_INT_CST_LOW (cst), TREE_INT_CST_HIGH (cst)); if (sign < 0) { diff --git a/gcc/cp/rtti.c b/gcc/cp/rtti.c index a59af79460b..38ac41878f1 100644 --- a/gcc/cp/rtti.c +++ b/gcc/cp/rtti.c @@ -150,7 +150,8 @@ build_headof (tree exp) exp = save_expr (exp); /* The offset-to-top field is at index -2 from the vptr. */ - index = build_int_2 (-2 * TARGET_VTABLE_DATA_ENTRY_DISTANCE, -1); + index = build_int_cst (NULL_TREE, + -2 * TARGET_VTABLE_DATA_ENTRY_DISTANCE, -1); offset = build_vtbl_ref (build_indirect_ref (exp, NULL), index); @@ -225,7 +226,8 @@ get_tinfo_decl_dynamic (tree exp) tree index; /* The RTTI information is at index -1. */ - index = build_int_2 (-1 * TARGET_VTABLE_DATA_ENTRY_DISTANCE, -1); + index = build_int_cst (NULL_TREE, + -1 * TARGET_VTABLE_DATA_ENTRY_DISTANCE, -1); t = build_vtbl_ref (exp, index); t = convert (type_info_ptr_type, t); } @@ -588,8 +590,7 @@ build_dynamic_cast_1 (tree type, tree expr) { warning ("dynamic_cast of `%#D' to `%#T' can never succeed", op, type); - retval = build_int_2 (0, 0); - TREE_TYPE (retval) = type; + retval = build_int_cst (type, 0, 0); return retval; } } @@ -878,7 +879,7 @@ ptr_initializer (tree desc, tree target) if (incomplete) flags |= 8; - init = tree_cons (NULL_TREE, build_int_2 (flags, 0), init); + init = tree_cons (NULL_TREE, build_int_cst (NULL_TREE, flags, 0), init); init = tree_cons (NULL_TREE, get_tinfo_ptr (TYPE_MAIN_VARIANT (to)), init); @@ -908,7 +909,7 @@ ptm_initializer (tree desc, tree target) flags |= 0x8; if (!COMPLETE_TYPE_P (klass)) flags |= 0x10; - init = tree_cons (NULL_TREE, build_int_2 (flags, 0), init); + init = tree_cons (NULL_TREE, build_int_cst (NULL_TREE, flags, 0), init); init = tree_cons (NULL_TREE, get_tinfo_ptr (TYPE_MAIN_VARIANT (to)), init); @@ -1089,9 +1090,10 @@ get_pseudo_ti_init (tree type, tree var_desc) /* Combine offset and flags into one field. */ offset = cp_build_binary_op (LSHIFT_EXPR, offset, - build_int_2 (8, 0)); + build_int_cst (NULL_TREE, 8, 0)); offset = cp_build_binary_op (BIT_IOR_EXPR, offset, - build_int_2 (flags, 0)); + build_int_cst (NULL_TREE, + flags, 0)); base_init = tree_cons (NULL_TREE, offset, base_init); base_init = tree_cons (NULL_TREE, tinfo, base_init); base_init = build_constructor (NULL_TREE, base_init); @@ -1101,10 +1103,12 @@ get_pseudo_ti_init (tree type, tree var_desc) base_inits = tree_cons (NULL_TREE, base_inits, NULL_TREE); /* Prepend the number of bases. */ base_inits = tree_cons (NULL_TREE, - build_int_2 (nbases, 0), base_inits); + build_int_cst (NULL_TREE, nbases, 0), + base_inits); /* Prepend the hint flags. */ base_inits = tree_cons (NULL_TREE, - build_int_2 (hint, 0), base_inits); + build_int_cst (NULL_TREE, hint, 0), + base_inits); return class_initializer (var_desc, type, base_inits); } diff --git a/gcc/cp/search.c b/gcc/cp/search.c index a1270acdbfa..459c1742705 100644 --- a/gcc/cp/search.c +++ b/gcc/cp/search.c @@ -346,8 +346,7 @@ get_dynamic_cast_base_type (tree subtype, tree target) if (!boff) return offset; - offset = build_int_2 (boff, -1); - TREE_TYPE (offset) = ssizetype; + offset = build_int_cst (ssizetype, boff, -1); return offset; } diff --git a/gcc/cp/tree.c b/gcc/cp/tree.c index 6a626e9470d..39f655779fd 100644 --- a/gcc/cp/tree.c +++ b/gcc/cp/tree.c @@ -1377,10 +1377,10 @@ tree build_shared_int_cst (int i) { if (i >= 256) - return build_int_2 (i, 0); + return build_int_cst (NULL_TREE, i, 0); if (!shared_int_cache[i]) - shared_int_cache[i] = build_int_2 (i, 0); + shared_int_cache[i] = build_int_cst (NULL_TREE, i, 0); return shared_int_cache[i]; } diff --git a/gcc/except.c b/gcc/except.c index 8ac3836d898..d45f1b2dcda 100644 --- a/gcc/except.c +++ b/gcc/except.c @@ -376,7 +376,7 @@ init_eh (void) integer_type_node); DECL_FIELD_CONTEXT (f_cs) = sjlj_fc_type_node; - tmp = build_index_type (build_int_2 (4 - 1, 0)); + tmp = build_index_type (build_int_cst (NULL_TREE, 4 - 1, 0)); tmp = build_array_type (lang_hooks.types.type_for_mode (word_mode, 1), tmp); f_data = build_decl (FIELD_DECL, get_identifier ("__data"), tmp); @@ -392,17 +392,19 @@ init_eh (void) #ifdef DONT_USE_BUILTIN_SETJMP #ifdef JMP_BUF_SIZE - tmp = build_int_2 (JMP_BUF_SIZE - 1, 0); + tmp = build_int_cst (NULL_TREE, JMP_BUF_SIZE - 1, 0); #else /* Should be large enough for most systems, if it is not, JMP_BUF_SIZE should be defined with the proper value. It will also tend to be larger than necessary for most systems, a more optimal port will define JMP_BUF_SIZE. */ - tmp = build_int_2 (FIRST_PSEUDO_REGISTER + 2 - 1, 0); + tmp = build_int_cst (NULL_TREE, + FIRST_PSEUDO_REGISTER + 2 - 1, 0); #endif #else /* builtin_setjmp takes a pointer to 5 words. */ - tmp = build_int_2 (5 * BITS_PER_WORD / POINTER_SIZE - 1, 0); + tmp = build_int_cst (NULL_TREE, + 5 * BITS_PER_WORD / POINTER_SIZE - 1, 0); #endif tmp = build_index_type (tmp); tmp = build_array_type (ptr_type_node, tmp); @@ -1414,7 +1416,7 @@ assign_filter_values (void) for (;tp_node; tp_node = TREE_CHAIN (tp_node)) { int flt = add_ttypes_entry (ttypes, TREE_VALUE (tp_node)); - tree flt_node = build_int_2 (flt, 0); + tree flt_node = build_int_cst (NULL_TREE, flt, 0); r->u.catch.filter_list = tree_cons (NULL_TREE, flt_node, r->u.catch.filter_list); @@ -1425,7 +1427,7 @@ assign_filter_values (void) /* Get a filter value for the NULL list also since it will need an action record anyway. */ int flt = add_ttypes_entry (ttypes, NULL); - tree flt_node = build_int_2 (flt, 0); + tree flt_node = build_int_cst (NULL_TREE, flt, 0); r->u.catch.filter_list = tree_cons (NULL_TREE, flt_node, r->u.catch.filter_list); diff --git a/gcc/expmed.c b/gcc/expmed.c index 7ee5964853b..75427e10a6e 100644 --- a/gcc/expmed.c +++ b/gcc/expmed.c @@ -899,7 +899,8 @@ store_fixed_bit_field (rtx op0, unsigned HOST_WIDE_INT offset, NULL_RTX, 1, OPTAB_LIB_WIDEN); if (bitpos > 0) value = expand_shift (LSHIFT_EXPR, mode, value, - build_int_2 (bitpos, 0), NULL_RTX, 1); + build_int_cst (NULL_TREE, + bitpos, 0), NULL_RTX, 1); } /* Now clear the chosen bits in OP0, @@ -1327,10 +1328,14 @@ extract_bit_field (rtx str_rtx, unsigned HOST_WIDE_INT bitsize, /* Signed bit field: sign-extend with two arithmetic shifts. */ target = expand_shift (LSHIFT_EXPR, mode, target, - build_int_2 (GET_MODE_BITSIZE (mode) - bitsize, 0), + build_int_cst (NULL_TREE, + GET_MODE_BITSIZE (mode) - bitsize, + 0), NULL_RTX, 0); return expand_shift (RSHIFT_EXPR, mode, target, - build_int_2 (GET_MODE_BITSIZE (mode) - bitsize, 0), + build_int_cst (NULL_TREE, + GET_MODE_BITSIZE (mode) - bitsize, + 0), NULL_RTX, 0); } @@ -1735,7 +1740,7 @@ extract_fixed_bit_field (enum machine_mode tmode, rtx op0, { /* If the field does not already start at the lsb, shift it so it does. */ - tree amount = build_int_2 (bitpos, 0); + tree amount = build_int_cst (NULL_TREE, bitpos, 0); /* Maybe propagate the target for the shift. */ /* But not if we will return it--could confuse integrate.c. */ rtx subtarget = (target != 0 && REG_P (target) ? target : 0); @@ -1775,14 +1780,16 @@ extract_fixed_bit_field (enum machine_mode tmode, rtx op0, if (GET_MODE_BITSIZE (mode) != (bitsize + bitpos)) { tree amount - = build_int_2 (GET_MODE_BITSIZE (mode) - (bitsize + bitpos), 0); + = build_int_cst (NULL_TREE, + GET_MODE_BITSIZE (mode) - (bitsize + bitpos), 0); /* Maybe propagate the target for the shift. */ rtx subtarget = (target != 0 && REG_P (target) ? target : 0); op0 = expand_shift (LSHIFT_EXPR, mode, op0, amount, subtarget, 1); } return expand_shift (RSHIFT_EXPR, mode, op0, - build_int_2 (GET_MODE_BITSIZE (mode) - bitsize, 0), + build_int_cst (NULL_TREE, + GET_MODE_BITSIZE (mode) - bitsize, 0), target, 0); } @@ -1930,13 +1937,15 @@ extract_split_bit_field (rtx op0, unsigned HOST_WIDE_INT bitsize, { if (bitsize != bitsdone) part = expand_shift (LSHIFT_EXPR, word_mode, part, - build_int_2 (bitsize - bitsdone, 0), 0, 1); + build_int_cst (NULL_TREE, + bitsize - bitsdone, 0), 0, 1); } else { if (bitsdone != thissize) part = expand_shift (LSHIFT_EXPR, word_mode, part, - build_int_2 (bitsdone - thissize, 0), 0, 1); + build_int_cst (NULL_TREE, + bitsdone - thissize, 0), 0, 1); } if (first) @@ -1955,10 +1964,12 @@ extract_split_bit_field (rtx op0, unsigned HOST_WIDE_INT bitsize, return result; /* Signed bit field: sign-extend with two arithmetic shifts. */ result = expand_shift (LSHIFT_EXPR, word_mode, result, - build_int_2 (BITS_PER_WORD - bitsize, 0), + build_int_cst (NULL_TREE, + BITS_PER_WORD - bitsize, 0), NULL_RTX, 0); return expand_shift (RSHIFT_EXPR, word_mode, result, - build_int_2 (BITS_PER_WORD - bitsize, 0), NULL_RTX, 0); + build_int_cst (NULL_TREE, + BITS_PER_WORD - bitsize, 0), NULL_RTX, 0); } /* Add INC into TARGET. */ @@ -2075,10 +2086,9 @@ expand_shift (enum tree_code code, enum machine_mode mode, rtx shifted, tree type = TREE_TYPE (amount); tree new_amount = make_tree (type, op1); tree other_amount - = fold (build2 (MINUS_EXPR, type, - convert (type, - build_int_2 (GET_MODE_BITSIZE (mode), - 0)), + = fold (build2 (MINUS_EXPR, type, convert + (type, build_int_cst + (NULL_TREE, GET_MODE_BITSIZE (mode), 0)), amount)); shifted = force_reg (mode, shifted); @@ -2549,13 +2559,15 @@ expand_mult_const (enum machine_mode mode, rtx op0, HOST_WIDE_INT val, { case alg_shift: accum = expand_shift (LSHIFT_EXPR, mode, accum, - build_int_2 (log, 0), NULL_RTX, 0); + build_int_cst (NULL_TREE, log, 0), + NULL_RTX, 0); val_so_far <<= log; break; case alg_add_t_m2: tem = expand_shift (LSHIFT_EXPR, mode, op0, - build_int_2 (log, 0), NULL_RTX, 0); + build_int_cst (NULL_TREE, log, 0), + NULL_RTX, 0); accum = force_operand (gen_rtx_PLUS (mode, accum, tem), add_target ? add_target : accum_target); val_so_far += (HOST_WIDE_INT) 1 << log; @@ -2563,7 +2575,8 @@ expand_mult_const (enum machine_mode mode, rtx op0, HOST_WIDE_INT val, case alg_sub_t_m2: tem = expand_shift (LSHIFT_EXPR, mode, op0, - build_int_2 (log, 0), NULL_RTX, 0); + build_int_cst (NULL_TREE, log, 0), + NULL_RTX, 0); accum = force_operand (gen_rtx_MINUS (mode, accum, tem), add_target ? add_target : accum_target); val_so_far -= (HOST_WIDE_INT) 1 << log; @@ -2571,7 +2584,8 @@ expand_mult_const (enum machine_mode mode, rtx op0, HOST_WIDE_INT val, case alg_add_t2_m: accum = expand_shift (LSHIFT_EXPR, mode, accum, - build_int_2 (log, 0), shift_subtarget, + build_int_cst (NULL_TREE, log, 0), + shift_subtarget, 0); accum = force_operand (gen_rtx_PLUS (mode, accum, op0), add_target ? add_target : accum_target); @@ -2580,7 +2594,8 @@ expand_mult_const (enum machine_mode mode, rtx op0, HOST_WIDE_INT val, case alg_sub_t2_m: accum = expand_shift (LSHIFT_EXPR, mode, accum, - build_int_2 (log, 0), shift_subtarget, 0); + build_int_cst (NULL_TREE, log, 0), + shift_subtarget, 0); accum = force_operand (gen_rtx_MINUS (mode, accum, op0), add_target ? add_target : accum_target); val_so_far = (val_so_far << log) - 1; @@ -2588,7 +2603,8 @@ expand_mult_const (enum machine_mode mode, rtx op0, HOST_WIDE_INT val, case alg_add_factor: tem = expand_shift (LSHIFT_EXPR, mode, accum, - build_int_2 (log, 0), NULL_RTX, 0); + build_int_cst (NULL_TREE, log, 0), + NULL_RTX, 0); accum = force_operand (gen_rtx_PLUS (mode, accum, tem), add_target ? add_target : accum_target); val_so_far += val_so_far << log; @@ -2596,7 +2612,8 @@ expand_mult_const (enum machine_mode mode, rtx op0, HOST_WIDE_INT val, case alg_sub_factor: tem = expand_shift (LSHIFT_EXPR, mode, accum, - build_int_2 (log, 0), NULL_RTX, 0); + build_int_cst (NULL_TREE, log, 0), + NULL_RTX, 0); accum = force_operand (gen_rtx_MINUS (mode, tem, accum), (add_target ? add_target : preserve ? 0 : tem)); @@ -2891,7 +2908,8 @@ expand_mult_highpart_adjust (enum machine_mode mode, rtx adj_operand, rtx op0, enum rtx_code adj_code = unsignedp ? PLUS : MINUS; tem = expand_shift (RSHIFT_EXPR, mode, op0, - build_int_2 (GET_MODE_BITSIZE (mode) - 1, 0), + build_int_cst (NULL_TREE, + GET_MODE_BITSIZE (mode) - 1, 0), NULL_RTX, 0); tem = expand_and (mode, tem, op1, NULL_RTX); adj_operand @@ -2899,7 +2917,8 @@ expand_mult_highpart_adjust (enum machine_mode mode, rtx adj_operand, rtx op0, adj_operand); tem = expand_shift (RSHIFT_EXPR, mode, op1, - build_int_2 (GET_MODE_BITSIZE (mode) - 1, 0), + build_int_cst (NULL_TREE, + GET_MODE_BITSIZE (mode) - 1, 0), NULL_RTX, 0); tem = expand_and (mode, tem, op0, NULL_RTX); target = force_operand (gen_rtx_fmt_ee (adj_code, mode, adj_operand, tem), @@ -2920,7 +2939,8 @@ extract_high_half (enum machine_mode mode, rtx op) wider_mode = GET_MODE_WIDER_MODE (mode); op = expand_shift (RSHIFT_EXPR, wider_mode, op, - build_int_2 (GET_MODE_BITSIZE (mode), 0), 0, 1); + build_int_cst (NULL_TREE, + GET_MODE_BITSIZE (mode), 0), 0, 1); return convert_modes (mode, wider_mode, op, 0); } @@ -3183,7 +3203,7 @@ expand_sdiv_pow2 (enum machine_mode mode, rtx op0, HOST_WIDE_INT d) int logd; logd = floor_log2 (d); - shift = build_int_2 (logd, 0); + shift = build_int_cst (NULL_TREE, logd, 0); if (d == 2 && BRANCH_COST >= 1) { @@ -3230,7 +3250,8 @@ expand_sdiv_pow2 (enum machine_mode mode, rtx op0, HOST_WIDE_INT d) NULL_RTX, 0, OPTAB_LIB_WIDEN); else temp = expand_shift (RSHIFT_EXPR, mode, temp, - build_int_2 (ushift, 0), NULL_RTX, 1); + build_int_cst (NULL_TREE, ushift, 0), + NULL_RTX, 1); temp = expand_binop (mode, add_optab, temp, op0, NULL_RTX, 0, OPTAB_LIB_WIDEN); return expand_shift (RSHIFT_EXPR, mode, temp, shift, NULL_RTX, 0); @@ -3506,7 +3527,8 @@ expand_divmod (int rem_flag, enum tree_code code, enum machine_mode mode, return gen_lowpart (mode, remainder); } quotient = expand_shift (RSHIFT_EXPR, compute_mode, op0, - build_int_2 (pre_shift, 0), + build_int_cst (NULL_TREE, + pre_shift, 0), tquotient, 1); } else if (size <= HOST_BITS_PER_WIDE_INT) @@ -3562,15 +3584,18 @@ expand_divmod (int rem_flag, enum tree_code code, enum machine_mode mode, t2 = force_operand (gen_rtx_MINUS (compute_mode, op0, t1), NULL_RTX); - t3 = expand_shift (RSHIFT_EXPR, compute_mode, t2, - build_int_2 (1, 0), NULL_RTX,1); + t3 = expand_shift + (RSHIFT_EXPR, compute_mode, t2, + build_int_cst (NULL_TREE, 1, 0), + NULL_RTX,1); t4 = force_operand (gen_rtx_PLUS (compute_mode, t1, t3), NULL_RTX); - quotient - = expand_shift (RSHIFT_EXPR, compute_mode, t4, - build_int_2 (post_shift - 1, 0), - tquotient, 1); + quotient = expand_shift + (RSHIFT_EXPR, compute_mode, t4, + build_int_cst (NULL_TREE, + post_shift - 1, 0), + tquotient, 1); } else { @@ -3580,9 +3605,10 @@ expand_divmod (int rem_flag, enum tree_code code, enum machine_mode mode, || post_shift >= BITS_PER_WORD) goto fail1; - t1 = expand_shift (RSHIFT_EXPR, compute_mode, op0, - build_int_2 (pre_shift, 0), - NULL_RTX, 1); + t1 = expand_shift + (RSHIFT_EXPR, compute_mode, op0, + build_int_cst (NULL_TREE, pre_shift, 0), + NULL_RTX, 1); extra_cost = (shift_cost[compute_mode][pre_shift] + shift_cost[compute_mode][post_shift]); @@ -3591,10 +3617,11 @@ expand_divmod (int rem_flag, enum tree_code code, enum machine_mode mode, max_cost - extra_cost); if (t2 == 0) goto fail1; - quotient - = expand_shift (RSHIFT_EXPR, compute_mode, t2, - build_int_2 (post_shift, 0), - tquotient, 1); + quotient = expand_shift + (RSHIFT_EXPR, compute_mode, t2, + build_int_cst (NULL_TREE, + post_shift, 0), + tquotient, 1); } } } @@ -3700,10 +3727,14 @@ expand_divmod (int rem_flag, enum tree_code code, enum machine_mode mode, max_cost - extra_cost); if (t1 == 0) goto fail1; - t2 = expand_shift (RSHIFT_EXPR, compute_mode, t1, - build_int_2 (post_shift, 0), NULL_RTX, 0); - t3 = expand_shift (RSHIFT_EXPR, compute_mode, op0, - build_int_2 (size - 1, 0), NULL_RTX, 0); + t2 = expand_shift + (RSHIFT_EXPR, compute_mode, t1, + build_int_cst (NULL_TREE, post_shift, 0), + NULL_RTX, 0); + t3 = expand_shift + (RSHIFT_EXPR, compute_mode, op0, + build_int_cst (NULL_TREE, size - 1, 0), + NULL_RTX, 0); if (d < 0) quotient = force_operand (gen_rtx_MINUS (compute_mode, @@ -3735,12 +3766,14 @@ expand_divmod (int rem_flag, enum tree_code code, enum machine_mode mode, t2 = force_operand (gen_rtx_PLUS (compute_mode, t1, op0), NULL_RTX); - t3 = expand_shift (RSHIFT_EXPR, compute_mode, t2, - build_int_2 (post_shift, 0), - NULL_RTX, 0); - t4 = expand_shift (RSHIFT_EXPR, compute_mode, op0, - build_int_2 (size - 1, 0), - NULL_RTX, 0); + t3 = expand_shift + (RSHIFT_EXPR, compute_mode, t2, + build_int_cst (NULL_TREE, post_shift, 0), + NULL_RTX, 0); + t4 = expand_shift + (RSHIFT_EXPR, compute_mode, op0, + build_int_cst (NULL_TREE, size - 1, 0), + NULL_RTX, 0); if (d < 0) quotient = force_operand (gen_rtx_MINUS (compute_mode, @@ -3794,9 +3827,10 @@ expand_divmod (int rem_flag, enum tree_code code, enum machine_mode mode, if (remainder) return gen_lowpart (mode, remainder); } - quotient = expand_shift (RSHIFT_EXPR, compute_mode, op0, - build_int_2 (pre_shift, 0), - tquotient, 0); + quotient = expand_shift + (RSHIFT_EXPR, compute_mode, op0, + build_int_cst (NULL_TREE, pre_shift, 0), + tquotient, 0); } else { @@ -3810,9 +3844,10 @@ expand_divmod (int rem_flag, enum tree_code code, enum machine_mode mode, if (post_shift < BITS_PER_WORD && size - 1 < BITS_PER_WORD) { - t1 = expand_shift (RSHIFT_EXPR, compute_mode, op0, - build_int_2 (size - 1, 0), - NULL_RTX, 0); + t1 = expand_shift + (RSHIFT_EXPR, compute_mode, op0, + build_int_cst (NULL_TREE, size - 1, 0), + NULL_RTX, 0); t2 = expand_binop (compute_mode, xor_optab, op0, t1, NULL_RTX, 0, OPTAB_WIDEN); extra_cost = (shift_cost[compute_mode][post_shift] @@ -3823,9 +3858,10 @@ expand_divmod (int rem_flag, enum tree_code code, enum machine_mode mode, max_cost - extra_cost); if (t3 != 0) { - t4 = expand_shift (RSHIFT_EXPR, compute_mode, t3, - build_int_2 (post_shift, 0), - NULL_RTX, 1); + t4 = expand_shift + (RSHIFT_EXPR, compute_mode, t3, + build_int_cst (NULL_TREE, post_shift, 0), + NULL_RTX, 1); quotient = expand_binop (compute_mode, xor_optab, t4, t1, tquotient, 0, OPTAB_WIDEN); @@ -3840,8 +3876,10 @@ expand_divmod (int rem_flag, enum tree_code code, enum machine_mode mode, op0, constm1_rtx), NULL_RTX); t2 = expand_binop (compute_mode, ior_optab, op0, t1, NULL_RTX, 0, OPTAB_WIDEN); - nsign = expand_shift (RSHIFT_EXPR, compute_mode, t2, - build_int_2 (size - 1, 0), NULL_RTX, 0); + nsign = expand_shift + (RSHIFT_EXPR, compute_mode, t2, + build_int_cst (NULL_TREE, size - 1, 0), + NULL_RTX, 0); t3 = force_operand (gen_rtx_MINUS (compute_mode, t1, nsign), NULL_RTX); t4 = expand_divmod (0, TRUNC_DIV_EXPR, compute_mode, t3, op1, @@ -3955,7 +3993,8 @@ expand_divmod (int rem_flag, enum tree_code code, enum machine_mode mode, rtx t1, t2, t3; unsigned HOST_WIDE_INT d = INTVAL (op1); t1 = expand_shift (RSHIFT_EXPR, compute_mode, op0, - build_int_2 (floor_log2 (d), 0), + build_int_cst (NULL_TREE, + floor_log2 (d), 0), tquotient, 1); t2 = expand_binop (compute_mode, and_optab, op0, GEN_INT (d - 1), @@ -4053,7 +4092,8 @@ expand_divmod (int rem_flag, enum tree_code code, enum machine_mode mode, rtx t1, t2, t3; unsigned HOST_WIDE_INT d = INTVAL (op1); t1 = expand_shift (RSHIFT_EXPR, compute_mode, op0, - build_int_2 (floor_log2 (d), 0), + build_int_cst (NULL_TREE, + floor_log2 (d), 0), tquotient, 0); t2 = expand_binop (compute_mode, and_optab, op0, GEN_INT (d - 1), @@ -4175,7 +4215,8 @@ expand_divmod (int rem_flag, enum tree_code code, enum machine_mode mode, pre_shift = floor_log2 (d & -d); ml = invert_mod2n (d >> pre_shift, size); t1 = expand_shift (RSHIFT_EXPR, compute_mode, op0, - build_int_2 (pre_shift, 0), NULL_RTX, unsignedp); + build_int_cst (NULL_TREE, pre_shift, 0), + NULL_RTX, unsignedp); quotient = expand_mult (compute_mode, t1, gen_int_mode (ml, compute_mode), NULL_RTX, 1); @@ -4209,7 +4250,8 @@ expand_divmod (int rem_flag, enum tree_code code, enum machine_mode mode, } tem = plus_constant (op1, -1); tem = expand_shift (RSHIFT_EXPR, compute_mode, tem, - build_int_2 (1, 0), NULL_RTX, 1); + build_int_cst (NULL_TREE, 1, 0), + NULL_RTX, 1); do_cmp_and_jump (remainder, tem, LEU, compute_mode, label); expand_inc (quotient, const1_rtx); expand_dec (remainder, op1); @@ -4234,12 +4276,14 @@ expand_divmod (int rem_flag, enum tree_code code, enum machine_mode mode, abs_rem = expand_abs (compute_mode, remainder, NULL_RTX, 1, 0); abs_op1 = expand_abs (compute_mode, op1, NULL_RTX, 1, 0); tem = expand_shift (LSHIFT_EXPR, compute_mode, abs_rem, - build_int_2 (1, 0), NULL_RTX, 1); + build_int_cst (NULL_TREE, 1, 0), + NULL_RTX, 1); do_cmp_and_jump (tem, abs_op1, LTU, compute_mode, label); tem = expand_binop (compute_mode, xor_optab, op0, op1, NULL_RTX, 0, OPTAB_WIDEN); mask = expand_shift (RSHIFT_EXPR, compute_mode, tem, - build_int_2 (size - 1, 0), NULL_RTX, 0); + build_int_cst (NULL_TREE, size - 1, 0), + NULL_RTX, 0); tem = expand_binop (compute_mode, xor_optab, mask, const1_rtx, NULL_RTX, 0, OPTAB_WIDEN); tem = expand_binop (compute_mode, sub_optab, tem, mask, @@ -4382,20 +4426,23 @@ make_tree (tree type, rtx x) switch (GET_CODE (x)) { case CONST_INT: - t = build_int_2 (INTVAL (x), - (TYPE_UNSIGNED (type) - && (GET_MODE_BITSIZE (TYPE_MODE (type)) - < HOST_BITS_PER_WIDE_INT)) - || INTVAL (x) >= 0 ? 0 : -1); - TREE_TYPE (t) = type; - return t; + { + HOST_WIDE_INT hi = 0; + if (INTVAL (x) < 0 + && !(TYPE_UNSIGNED (type) + && (GET_MODE_BITSIZE (TYPE_MODE (type)) + < HOST_BITS_PER_WIDE_INT))) + hi = -1; + + t = build_int_cst (type, INTVAL (x), hi); + + return t; + } + case CONST_DOUBLE: if (GET_MODE (x) == VOIDmode) - { - t = build_int_2 (CONST_DOUBLE_LOW (x), CONST_DOUBLE_HIGH (x)); - TREE_TYPE (t) = type; - } + t = build_int_cst (type, CONST_DOUBLE_LOW (x), CONST_DOUBLE_HIGH (x)); else { REAL_VALUE_TYPE d; diff --git a/gcc/expr.c b/gcc/expr.c index 7d216aeb318..e6052633d34 100644 --- a/gcc/expr.c +++ b/gcc/expr.c @@ -646,8 +646,9 @@ convert_move (rtx to, rtx from, int unsignedp) /* No suitable intermediate mode. Generate what we need with shifts. */ - shift_amount = build_int_2 (GET_MODE_BITSIZE (to_mode) - - GET_MODE_BITSIZE (from_mode), 0); + shift_amount = build_int_cst (NULL_TREE, + GET_MODE_BITSIZE (to_mode) + - GET_MODE_BITSIZE (from_mode), 0); from = gen_lowpart (to_mode, force_reg (from_mode, from)); tmp = expand_shift (LSHIFT_EXPR, to_mode, from, shift_amount, to, unsignedp); @@ -1712,7 +1713,8 @@ emit_group_load (rtx dst, rtx orig_src, tree type ATTRIBUTE_UNUSED, int ssize) if (shift) tmps[i] = expand_shift (LSHIFT_EXPR, mode, tmps[i], - build_int_2 (shift, 0), tmps[i], 0); + build_int_cst (NULL_TREE, + shift, 0), tmps[i], 0); } /* Copy the extracted pieces into the proper (probable) hard regs. */ @@ -1823,7 +1825,8 @@ emit_group_store (rtx orig_dst, rtx src, tree type ATTRIBUTE_UNUSED, int ssize) { int shift = (bytelen - (ssize - bytepos)) * BITS_PER_UNIT; tmps[i] = expand_shift (RSHIFT_EXPR, mode, tmps[i], - build_int_2 (shift, 0), tmps[i], 0); + build_int_cst (NULL_TREE, + shift, 0), tmps[i], 0); } bytelen = ssize - bytepos; } @@ -3670,8 +3673,8 @@ expand_assignment (tree to, tree from, int want_value) NULL_RTX); binop = xor_optab; } - value = expand_shift (LSHIFT_EXPR, GET_MODE (str_rtx), - value, build_int_2 (bitpos1, 0), + value = expand_shift (LSHIFT_EXPR, GET_MODE (str_rtx), value, + build_int_cst (NULL_TREE,bitpos1, 0), NULL_RTX, 1); result = expand_binop (GET_MODE (str_rtx), binop, str_rtx, value, str_rtx, 1, OPTAB_WIDEN); @@ -4582,7 +4585,8 @@ store_constructor (tree exp, rtx target, int cleared, HOST_WIDE_INT size) if (BYTES_BIG_ENDIAN) value = fold (build2 (LSHIFT_EXPR, type, value, - build_int_2 (BITS_PER_WORD - bitsize, 0))); + build_int_cst (NULL_TREE, + BITS_PER_WORD - bitsize, 0))); bitsize = BITS_PER_WORD; mode = word_mode; } @@ -5317,7 +5321,8 @@ store_field (rtx target, HOST_WIDE_INT bitsize, HOST_WIDE_INT bitpos, gen_int_mode (width_mask, tmode), NULL_RTX); - count = build_int_2 (GET_MODE_BITSIZE (tmode) - bitsize, 0); + count = build_int_cst (NULL_TREE, + GET_MODE_BITSIZE (tmode) - bitsize, 0); temp = expand_shift (LSHIFT_EXPR, tmode, temp, count, 0, 0); return expand_shift (RSHIFT_EXPR, tmode, temp, count, 0, 0); } @@ -6813,8 +6818,9 @@ expand_expr_real_1 (tree exp, rtx target, enum machine_mode tmode, else { tree count - = build_int_2 (GET_MODE_BITSIZE (imode) - bitsize, - 0); + = build_int_cst (NULL_TREE, + GET_MODE_BITSIZE (imode) - bitsize, + 0); op0 = expand_shift (LSHIFT_EXPR, imode, op0, count, target, 0); @@ -8279,7 +8285,8 @@ reduce_to_bit_field_precision (rtx exp, rtx target, tree type) } else { - tree count = build_int_2 (GET_MODE_BITSIZE (GET_MODE (exp)) - prec, 0); + tree count = build_int_cst (NULL_TREE, + GET_MODE_BITSIZE (GET_MODE (exp)) - prec, 0); exp = expand_shift (LSHIFT_EXPR, GET_MODE (exp), exp, count, target, 0); return expand_shift (RSHIFT_EXPR, GET_MODE (exp), exp, count, target, 0); } diff --git a/gcc/fold-const.c b/gcc/fold-const.c index f7e90be6eaa..c404613f842 100644 --- a/gcc/fold-const.c +++ b/gcc/fold-const.c @@ -201,7 +201,8 @@ decode (HOST_WIDE_INT *words, unsigned HOST_WIDE_INT *low, We return either the original T, or a copy. */ tree -force_fit_type (tree t, int overflowable, bool overflowed, bool overflowed_const) +force_fit_type (tree t, int overflowable, + bool overflowed, bool overflowed_const) { unsigned HOST_WIDE_INT low; HOST_WIDE_INT high; @@ -1417,10 +1418,7 @@ int_const_binop (enum tree_code code, tree arg1, tree arg2, int notrunc) && overflow == 0 && ! TREE_OVERFLOW (arg1) && ! TREE_OVERFLOW (arg2)) return size_int_type (low, type); else - { - t = build_int_2 (low, hi); - TREE_TYPE (t) = TREE_TYPE (arg1); - } + t = build_int_cst (TREE_TYPE (arg1), low, hi); if (notrunc) { @@ -1786,9 +1784,8 @@ fold_convert_const (enum tree_code code, tree type, tree arg1) /* Given an integer constant, make new constant with new type, appropriately sign-extended or truncated. */ - t = build_int_2 (TREE_INT_CST_LOW (arg1), - TREE_INT_CST_HIGH (arg1)); - TREE_TYPE (t) = type; + t = build_int_cst (type, TREE_INT_CST_LOW (arg1), + TREE_INT_CST_HIGH (arg1)); t = force_fit_type (t, /* Don't set the overflow when @@ -1879,8 +1876,7 @@ fold_convert_const (enum tree_code code, tree type, tree arg1) if (! overflow) REAL_VALUE_TO_INT (&low, &high, r); - t = build_int_2 (low, high); - TREE_TYPE (t) = type; + t = build_int_cst (type, low, high); t = force_fit_type (t, -1, overflow | TREE_OVERFLOW (arg1), TREE_CONSTANT_OVERFLOW (arg1)); @@ -2954,7 +2950,8 @@ invert_truthvalue (tree arg) switch (code) { case INTEGER_CST: - return fold_convert (type, build_int_2 (integer_zerop (arg), 0)); + return fold_convert (type, + build_int_cst (NULL_TREE, integer_zerop (arg), 0)); case TRUTH_AND_EXPR: return build2 (TRUTH_OR_EXPR, type, @@ -3189,8 +3186,7 @@ optimize_bit_field_compare (enum tree_code code, tree compare_type, lbitpos = nbitsize - lbitsize - lbitpos; /* Make the mask to be used against the extracted field. */ - mask = build_int_2 (~0, ~0); - TREE_TYPE (mask) = unsigned_type; + mask = build_int_cst (unsigned_type, ~0, ~0); mask = force_fit_type (mask, 0, false, false); mask = fold_convert (unsigned_type, mask); mask = const_binop (LSHIFT_EXPR, mask, size_int (nbitsize - lbitsize), 0); @@ -3346,8 +3342,7 @@ decode_field_reference (tree exp, HOST_WIDE_INT *pbitsize, unsigned_type = lang_hooks.types.type_for_size (*pbitsize, 1); precision = TYPE_PRECISION (unsigned_type); - mask = build_int_2 (~0, ~0); - TREE_TYPE (mask) = unsigned_type; + mask = build_int_cst (unsigned_type, ~0, ~0); mask = force_fit_type (mask, 0, false, false); mask = const_binop (LSHIFT_EXPR, mask, size_int (precision - *pbitsize), 0); @@ -3373,8 +3368,7 @@ all_ones_mask_p (tree mask, int size) unsigned int precision = TYPE_PRECISION (type); tree tmask; - tmask = build_int_2 (~0, ~0); - TREE_TYPE (tmask) = lang_hooks.types.signed_type (type); + tmask = build_int_cst (lang_hooks.types.signed_type (type), ~0, ~0); tmask = force_fit_type (tmask, 0, false, false); return @@ -5362,12 +5356,7 @@ constant_boolean_node (int value, tree type) return lang_hooks.truthvalue_conversion (value ? integer_one_node : integer_zero_node); else - { - tree t = build_int_2 (value, 0); - - TREE_TYPE (t) = type; - return t; - } + return build_int_cst (type, value, 0); } /* Transform `a + (b ? x : y)' into `b ? (a + x) : (a + y)'. @@ -5700,8 +5689,7 @@ fold_div_compare (enum tree_code code, tree type, tree arg0, tree arg1) TREE_INT_CST_HIGH (arg01), TREE_INT_CST_LOW (arg1), TREE_INT_CST_HIGH (arg1), &lpart, &hpart); - prod = build_int_2 (lpart, hpart); - TREE_TYPE (prod) = TREE_TYPE (arg00); + prod = build_int_cst (TREE_TYPE (arg00), lpart, hpart); prod = force_fit_type (prod, -1, overflow, false); if (TYPE_UNSIGNED (TREE_TYPE (arg0))) @@ -5715,8 +5703,7 @@ fold_div_compare (enum tree_code code, tree type, tree arg0, tree arg1) TREE_INT_CST_LOW (tmp), TREE_INT_CST_HIGH (tmp), &lpart, &hpart); - hi = build_int_2 (lpart, hpart); - TREE_TYPE (hi) = TREE_TYPE (arg00); + hi = build_int_cst (TREE_TYPE (arg00), lpart, hpart); hi = force_fit_type (hi, -1, overflow | TREE_OVERFLOW (prod), TREE_CONSTANT_OVERFLOW (prod)); } @@ -6623,7 +6610,8 @@ fold (tree expr) if (exact_log2 (int11) > 0 && int01 % int11 == 0) { alt0 = fold (build2 (MULT_EXPR, type, arg00, - build_int_2 (int01 / int11, 0))); + build_int_cst (NULL_TREE, + int01 / int11, 0))); alt1 = arg10; same = arg11; } @@ -7257,8 +7245,7 @@ fold (tree expr) if (TREE_CODE (arg0) == BIT_NOT_EXPR && operand_equal_p (TREE_OPERAND (arg0, 0), arg1, 0)) { - t1 = build_int_2 (-1, -1); - TREE_TYPE (t1) = type; + t1 = build_int_cst (type, -1, -1); t1 = force_fit_type (t1, 0, false, false); return omit_one_operand (type, t1, arg1); } @@ -7267,8 +7254,7 @@ fold (tree expr) if (TREE_CODE (arg1) == BIT_NOT_EXPR && operand_equal_p (arg0, TREE_OPERAND (arg1, 0), 0)) { - t1 = build_int_2 (-1, -1); - TREE_TYPE (t1) = type; + t1 = build_int_cst (type, -1, -1); t1 = force_fit_type (t1, 0, false, false); return omit_one_operand (type, t1, arg0); } @@ -7308,8 +7294,7 @@ fold (tree expr) if (TREE_CODE (arg0) == BIT_NOT_EXPR && operand_equal_p (TREE_OPERAND (arg0, 0), arg1, 0)) { - t1 = build_int_2 (-1, -1); - TREE_TYPE (t1) = type; + t1 = build_int_cst (type, -1, -1); t1 = force_fit_type (t1, 0, false, false); return omit_one_operand (type, t1, arg1); } @@ -7318,8 +7303,7 @@ fold (tree expr) if (TREE_CODE (arg1) == BIT_NOT_EXPR && operand_equal_p (arg0, TREE_OPERAND (arg1, 0), 0)) { - t1 = build_int_2 (-1, -1); - TREE_TYPE (t1) = type; + t1 = build_int_cst (type, -1, -1); t1 = force_fit_type (t1, 0, false, false); return omit_one_operand (type, t1, arg0); } @@ -7639,8 +7623,7 @@ fold (tree expr) low = ((unsigned HOST_WIDE_INT) 1 << l) - 1; } - mask = build_int_2 (low, high); - TREE_TYPE (mask) = type; + mask = build_int_cst (type, low, high); return fold (build2 (BIT_AND_EXPR, type, fold_convert (type, arg0), mask)); } @@ -7698,7 +7681,8 @@ fold (tree expr) RROTATE_EXPR by a new constant. */ if (code == LROTATE_EXPR && TREE_CODE (arg1) == INTEGER_CST) { - tree tem = build_int_2 (GET_MODE_BITSIZE (TYPE_MODE (type)), 0); + tree tem = build_int_cst (NULL_TREE, + GET_MODE_BITSIZE (TYPE_MODE (type)), 0); tem = fold_convert (TREE_TYPE (arg1), tem); tem = const_binop (MINUS_EXPR, tem, arg1, 0); return fold (build2 (RROTATE_EXPR, type, arg0, tem)); @@ -8115,8 +8099,9 @@ fold (tree expr) || integer_onep (folded_compare)) return omit_one_operand (type, folded_compare, varop); - shift = build_int_2 (TYPE_PRECISION (TREE_TYPE (varop)) - size, - 0); + shift = build_int_cst (NULL_TREE, + TYPE_PRECISION (TREE_TYPE (varop)) - size, + 0); shift = fold_convert (TREE_TYPE (varop), shift); newconst = fold (build2 (LSHIFT_EXPR, TREE_TYPE (varop), newconst, shift)); @@ -10336,8 +10321,9 @@ fold_read_from_constant_string (tree exp) == MODE_INT) && (GET_MODE_SIZE (TYPE_MODE (TREE_TYPE (TREE_TYPE (string)))) == 1)) return fold_convert (TREE_TYPE (exp), - build_int_2 ((TREE_STRING_POINTER (string) - [TREE_INT_CST_LOW (index)]), 0)); + build_int_cst (NULL_TREE, + (TREE_STRING_POINTER (string) + [TREE_INT_CST_LOW (index)]), 0)); } return NULL; } @@ -10359,8 +10345,7 @@ fold_negate_const (tree arg0, tree type) int overflow = neg_double (TREE_INT_CST_LOW (arg0), TREE_INT_CST_HIGH (arg0), &low, &high); - t = build_int_2 (low, high); - TREE_TYPE (t) = type; + t = build_int_cst (type, low, high); t = force_fit_type (t, 1, (overflow | TREE_OVERFLOW (arg0)) && !TYPE_UNSIGNED (type), @@ -10404,8 +10389,7 @@ fold_abs_const (tree arg0, tree type) int overflow = neg_double (TREE_INT_CST_LOW (arg0), TREE_INT_CST_HIGH (arg0), &low, &high); - t = build_int_2 (low, high); - TREE_TYPE (t) = type; + t = build_int_cst (type, low, high); t = force_fit_type (t, -1, overflow | TREE_OVERFLOW (arg0), TREE_CONSTANT_OVERFLOW (arg0)); return t; @@ -10436,9 +10420,9 @@ fold_not_const (tree arg0, tree type) if (TREE_CODE (arg0) == INTEGER_CST) { - t = build_int_2 (~ TREE_INT_CST_LOW (arg0), - ~ TREE_INT_CST_HIGH (arg0)); - TREE_TYPE (t) = type; + t = build_int_cst (type, + ~ TREE_INT_CST_LOW (arg0), + ~ TREE_INT_CST_HIGH (arg0)); t = force_fit_type (t, 0, TREE_OVERFLOW (arg0), TREE_CONSTANT_OVERFLOW (arg0)); } diff --git a/gcc/fortran/ChangeLog b/gcc/fortran/ChangeLog index 9bea25a35dd..460263611f3 100644 --- a/gcc/fortran/ChangeLog +++ b/gcc/fortran/ChangeLog @@ -1,3 +1,20 @@ +2004-08-15 Nathan Sidwell + + * trans-array.c (gfc_trans_array_constructor_value): Use + build_int_cst. + * trans-const.c (gfc_build_string_const, + gfc_init_constants, gfc_conv_mpz_to_tree, + gfc_conv_constant_to_tree): Likewise. + * trans-decl.c (gfc_get_symbol_decl): Likewise. + * trans-intrinsic.c (gfc_conv_intrinsic_ibits, + gfc_conv_intrinsic_len, prepare_arg_info): Likewise. + * trans-io.c (add_case, set_error_locus, build_dt, + transfer_expr): Likewise. + * trans-stmt.c (gfc_trans_label_assign, gfc_trans_pause, + gfc_trans_stop, gfc_trans_character_select): Likewise. + * trans-types.c (gfc_init_types, gfc_get_dtype): Likewise. + * trans.c (gfc_trans_runtime_check): Likewise. + 2004-08-14 Paul Brook * trans-decl.c (gfc_build_function_decl): Remove dead code. @@ -957,7 +974,7 @@ * symbol.c (gfc_add_common): Disable checks to work around other more fundamental inadequacies. -2004-05-22 Tobias Schlüter +2004-05-22 Tobias Schlüter * trans-decl.c (gfc_get_extern_function_decl): Set DECL_IS_PURE only for functions. @@ -1165,7 +1182,7 @@ * decl.c (variable_decl): Always apply default initializer. -2004-05-08 Tobias Schlüter +2004-05-08 Tobias Schlüter PR fortran/15206 * trans-intrinsic.c (gfc_conv_intrinsic_rrspacing): Fixed to @@ -1239,7 +1256,7 @@ Remove "set DEVELOPMENT". (Compiling GFORTRAN): Remove. -2004-05-09 Tobias Schlüter +2004-05-09 Tobias Schlüter * array.c (match_subscript, match_array_ref): Add comments explaining argument 'init'. @@ -1249,20 +1266,20 @@ * primary.c (match_digits, match_integer_constant): Add comment explaining signflag. -2004-05-01 Tobias Schlüter +2004-05-01 Tobias Schlüter PR fortran/13940 * primary.c: Include system.h and flags.h, needed for pedantic. (match_boz_constant): Allow "x" for hexadecimal constants, warn if pedantic is set. -2004-05-01 Tobias Schlüter +2004-05-01 Tobias Schlüter PR fortran/13940 * match.c (match_data_constant): Handle case where gfc_find_symbol sets sym to NULL -2004-04-28 Tobias Schlüter +2004-04-28 Tobias Schlüter * Make-lang.in (f95-lang.o, trans-intrinsic.o): Add missing dependency on mathbuiltins.def @@ -1276,7 +1293,7 @@ * gfortranspec.c: Do not include multilib.h. -2004-04-24 Tobias Schlüter +2004-04-24 Tobias Schlüter * trans-intrinsic.c: Fix comment, this is not trans-expr.c. Add 2004 to copyright years. diff --git a/gcc/fortran/trans-array.c b/gcc/fortran/trans-array.c index 46bf211660d..a6dea46b9c0 100644 --- a/gcc/fortran/trans-array.c +++ b/gcc/fortran/trans-array.c @@ -796,7 +796,7 @@ gfc_trans_array_constructor_value (stmtblock_t * pblock, tree type, p = p->next; } - bound = build_int_2 (n - 1, 0); + bound = build_int_cst (NULL_TREE, n - 1, 0); /* Create an array type to hold them. */ tmptype = build_range_type (gfc_array_index_type, gfc_index_zero_node, bound); @@ -821,7 +821,7 @@ gfc_trans_array_constructor_value (stmtblock_t * pblock, tree type, init = gfc_build_addr_expr (NULL, init); size = TREE_INT_CST_LOW (TYPE_SIZE_UNIT (type)); - bound = build_int_2 (n * size, 0); + bound = build_int_cst (NULL_TREE, n * size, 0); tmp = gfc_chainon_list (NULL_TREE, tmp); tmp = gfc_chainon_list (tmp, init); tmp = gfc_chainon_list (tmp, bound); diff --git a/gcc/fortran/trans-const.c b/gcc/fortran/trans-const.c index 3202a599c39..68b8d59ffd9 100644 --- a/gcc/fortran/trans-const.c +++ b/gcc/fortran/trans-const.c @@ -81,7 +81,7 @@ gfc_build_string_const (int length, const char *s) tree len; str = build_string (length, s); - len = build_int_2 (length, 0); + len = build_int_cst (NULL_TREE, length, 0); TREE_TYPE (str) = build_array_type (gfc_character1_type_node, build_range_type (gfc_strlen_type_node, @@ -145,10 +145,7 @@ gfc_init_constants (void) int n; for (n = 0; n <= GFC_MAX_DIMENSIONS; n++) - { - gfc_rank_cst[n] = build_int_2 (n, 0); - TREE_TYPE (gfc_rank_cst[n]) = gfc_array_index_type; - } + gfc_rank_cst[n] = build_int_cst (gfc_array_index_type, n, 0); gfc_strconst_bounds = gfc_build_string_const (21, "Array bound mismatch"); @@ -182,8 +179,8 @@ gfc_conv_mpz_to_tree (mpz_t i, int kind) if (mpz_fits_slong_p (i)) { val = mpz_get_si (i); - res = build_int_2 (val, (val < 0) ? (HOST_WIDE_INT)-1 : 0); - TREE_TYPE (res) = gfc_get_int_type (kind); + res = build_int_cst (gfc_get_int_type (kind), + val, (val < 0) ? (HOST_WIDE_INT)-1 : 0); return (res); } @@ -220,8 +217,7 @@ gfc_conv_mpz_to_tree (mpz_t i, int kind) high = (high << 4) + (low >> (BITS_PER_HOST_WIDE_INT - 4)); low = (low << 4) + n; } - res = build_int_2 (low, high); - TREE_TYPE (res) = gfc_get_int_type (kind); + res = build_int_cst (gfc_get_int_type (kind), low, high); if (negate) res = fold (build1 (NEGATE_EXPR, TREE_TYPE (res), res)); @@ -324,7 +320,7 @@ gfc_conv_constant_to_tree (gfc_expr * expr) return gfc_conv_mpfr_to_tree (expr->value.real, expr->ts.kind); case BT_LOGICAL: - return build_int_2 (expr->value.logical, 0); + return build_int_cst (NULL_TREE, expr->value.logical, 0); case BT_COMPLEX: { diff --git a/gcc/fortran/trans-decl.c b/gcc/fortran/trans-decl.c index e2707b4a98b..ef802ecee7f 100644 --- a/gcc/fortran/trans-decl.c +++ b/gcc/fortran/trans-decl.c @@ -798,7 +798,7 @@ gfc_get_symbol_decl (gfc_symbol * sym) ASSIGN_ADDR can not be used. Equal -1 means that ASSIGN_ADDR is the target label's address. Other value is the length of format string and ASSIGN_ADDR is the address of format string. */ - DECL_INITIAL (length) = build_int_2 (-2, -1); + DECL_INITIAL (length) = build_int_cst (NULL_TREE, -2, -1); } if (sym->ts.type == BT_CHARACTER) diff --git a/gcc/fortran/trans-intrinsic.c b/gcc/fortran/trans-intrinsic.c index f83e1e177b5..c580cd4a42b 100644 --- a/gcc/fortran/trans-intrinsic.c +++ b/gcc/fortran/trans-intrinsic.c @@ -1760,7 +1760,7 @@ gfc_conv_intrinsic_ibits (gfc_se * se, gfc_expr * expr) arg2 = TREE_VALUE (arg2); type = TREE_TYPE (arg); - mask = build_int_2 (-1, ~(unsigned HOST_WIDE_INT) 0); + mask = build_int_cst (NULL_TREE, -1, ~(unsigned HOST_WIDE_INT) 0); mask = build (LSHIFT_EXPR, type, mask, arg3); mask = build1 (BIT_NOT_EXPR, type, mask); @@ -1884,7 +1884,7 @@ gfc_conv_intrinsic_len (gfc_se * se, gfc_expr * expr) switch (arg->expr_type) { case EXPR_CONSTANT: - len = build_int_2 (arg->value.character.length, 0); + len = build_int_cst (NULL_TREE, arg->value.character.length, 0); break; default: @@ -2329,9 +2329,9 @@ void prepare_arg_info (gfc_se * se, gfc_expr * expr, /* Caculate the numbers of bits of exponent, fraction and word */ n = gfc_validate_kind (a1->ts.type, a1->ts.kind); - tmp = build_int_2 (gfc_real_kinds[n].digits - 1, 0); + tmp = build_int_cst (NULL_TREE, gfc_real_kinds[n].digits - 1, 0); rcs->fdigits = convert (masktype, tmp); - wbits = build_int_2 (TYPE_PRECISION (rcs->type) - 1, 0); + wbits = build_int_cst (NULL_TREE, TYPE_PRECISION (rcs->type) - 1, 0); wbits = convert (masktype, wbits); rcs->edigits = fold (build (MINUS_EXPR, masktype, wbits, tmp)); diff --git a/gcc/fortran/trans-io.c b/gcc/fortran/trans-io.c index b01b8f61e80..8df23edabca 100644 --- a/gcc/fortran/trans-io.c +++ b/gcc/fortran/trans-io.c @@ -450,7 +450,7 @@ add_case (int label_value, gfc_st_label * label, stmtblock_t * body) if (label == NULL) return; /* No label, no case */ - value = build_int_2 (label_value, 0); + value = build_int_cst (NULL_TREE, label_value, 0); /* Make a backend label for this case. */ tmp = build_decl (LABEL_DECL, NULL_TREE, NULL_TREE); @@ -523,7 +523,7 @@ set_error_locus (stmtblock_t * block, locus * where) gfc_add_modify_expr (block, locus_file, tmp); line = where->lb->linenum; - gfc_add_modify_expr (block, locus_line, build_int_2 (line, 0)); + gfc_add_modify_expr (block, locus_line, build_int_cst (NULL_TREE, line, 0)); } @@ -943,7 +943,7 @@ build_dt (tree * function, gfc_code * code) args = gfc_chainon_list (NULL_TREE, se.expr); args = gfc_chainon_list (args, se2.expr); args = gfc_chainon_list (args, se2.string_length); - arg2 = build_int_2 (ts_kind, 0); + arg2 = build_int_cst (NULL_TREE, ts_kind, 0); args = gfc_chainon_list (args,arg2); switch (ts_type) { @@ -1096,22 +1096,22 @@ transfer_expr (gfc_se * se, gfc_typespec * ts, tree addr_expr) switch (ts->type) { case BT_INTEGER: - arg2 = build_int_2 (kind, 0); + arg2 = build_int_cst (NULL_TREE, kind, 0); function = iocall_x_integer; break; case BT_REAL: - arg2 = build_int_2 (kind, 0); + arg2 = build_int_cst (NULL_TREE, kind, 0); function = iocall_x_real; break; case BT_COMPLEX: - arg2 = build_int_2 (kind, 0); + arg2 = build_int_cst (NULL_TREE, kind, 0); function = iocall_x_complex; break; case BT_LOGICAL: - arg2 = build_int_2 (kind, 0); + arg2 = build_int_cst (NULL_TREE, kind, 0); function = iocall_x_logical; break; diff --git a/gcc/fortran/trans-stmt.c b/gcc/fortran/trans-stmt.c index 794e2fc9017..261bf77d1d4 100644 --- a/gcc/fortran/trans-stmt.c +++ b/gcc/fortran/trans-stmt.c @@ -113,7 +113,7 @@ gfc_trans_label_assign (gfc_code * code) { label_str = code->label->format->value.character.string; label_len = code->label->format->value.character.length; - len_tree = build_int_2 (label_len, 0); + len_tree = build_int_cst (NULL_TREE, label_len, 0); label_tree = gfc_build_string_const (label_len + 1, label_str); label_tree = gfc_build_addr_expr (pchar_type_node, label_tree); } @@ -279,8 +279,7 @@ gfc_trans_pause (gfc_code * code) if (code->expr == NULL) { - tmp = build_int_2 (code->ext.stop_code, 0); - TREE_TYPE (tmp) = gfc_int4_type_node; + tmp = build_int_cst (gfc_int4_type_node, code->ext.stop_code, 0); args = gfc_chainon_list (NULL_TREE, tmp); fndecl = gfor_fndecl_pause_numeric; } @@ -319,8 +318,7 @@ gfc_trans_stop (gfc_code * code) if (code->expr == NULL) { - tmp = build_int_2 (code->ext.stop_code, 0); - TREE_TYPE (tmp) = gfc_int4_type_node; + tmp = build_int_cst (gfc_int4_type_node, code->ext.stop_code, 0); args = gfc_chainon_list (NULL_TREE, tmp); fndecl = gfor_fndecl_stop_numeric; } @@ -1093,8 +1091,8 @@ gfc_trans_character_select (gfc_code *code) init = tree_cons (NULL_TREE, tmp, init); } - type = build_array_type (select_struct, - build_index_type (build_int_2(n - 1, 0))); + type = build_array_type (select_struct, build_index_type + (build_int_cst (NULL_TREE, n - 1, 0))); init = build1 (CONSTRUCTOR, type, nreverse(init)); TREE_CONSTANT (init) = 1; @@ -1112,7 +1110,7 @@ gfc_trans_character_select (gfc_code *code) init = gfc_build_addr_expr (pvoid_type_node, init); args = gfc_chainon_list (NULL_TREE, init); - tmp = build_int_2 (n, 0); + tmp = build_int_cst (NULL_TREE, n, 0); args = gfc_chainon_list (args, tmp); tmp = gfc_build_addr_expr (pvoid_type_node, end_label); diff --git a/gcc/fortran/trans-types.c b/gcc/fortran/trans-types.c index f661976f036..b01298deb93 100644 --- a/gcc/fortran/trans-types.c +++ b/gcc/fortran/trans-types.c @@ -168,16 +168,13 @@ gfc_init_types (void) hi = 0; lo = (~(unsigned HOST_WIDE_INT) 0) >> (sizeof (HOST_WIDE_INT) * 8 - n); } - gfc_max_array_element_size = build_int_2 (lo, hi); - TREE_TYPE (gfc_max_array_element_size) = long_unsigned_type_node; + gfc_max_array_element_size = build_int_cst (long_unsigned_type_node, lo, hi); size_type_node = gfc_array_index_type; boolean_type_node = gfc_get_logical_type (gfc_default_logical_kind ()); - boolean_true_node = build_int_2 (1, 0); - TREE_TYPE (boolean_true_node) = boolean_type_node; - boolean_false_node = build_int_2 (0, 0); - TREE_TYPE (boolean_false_node) = boolean_type_node; + boolean_true_node = build_int_cst (boolean_type_node, 1, 0); + boolean_false_node = build_int_cst (boolean_type_node, 0, 0); } /* Get a type node for an integer kind */ @@ -600,13 +597,11 @@ gfc_get_dtype (tree type, int rank) i += TREE_INT_CST_LOW (size) << GFC_DTYPE_SIZE_SHIFT; } - dtype = build_int_2 (i, 0); - TREE_TYPE (dtype) = gfc_array_index_type; + dtype = build_int_cst (gfc_array_index_type, i, 0); if (size && !INTEGER_CST_P (size)) { - tmp = build_int_2 (GFC_DTYPE_SIZE_SHIFT, 0); - TREE_TYPE (tmp) = gfc_array_index_type; + tmp = build_int_cst (gfc_array_index_type, GFC_DTYPE_SIZE_SHIFT, 0); tmp = fold (build (LSHIFT_EXPR, gfc_array_index_type, size, tmp)); dtype = fold (build (PLUS_EXPR, gfc_array_index_type, tmp, dtype)); } diff --git a/gcc/fortran/trans.c b/gcc/fortran/trans.c index 00215f6a2a4..052da5525a4 100644 --- a/gcc/fortran/trans.c +++ b/gcc/fortran/trans.c @@ -365,7 +365,7 @@ gfc_trans_runtime_check (tree cond, tree msg, stmtblock_t * pblock) tmp = gfc_build_addr_expr (pchar_type_node, gfc_strconst_current_filename); args = gfc_chainon_list (args, tmp); - tmp = build_int_2 (input_line, 0); + tmp = build_int_cst (NULL_TREE, input_line, 0); args = gfc_chainon_list (args, tmp); tmp = gfc_build_function_call (gfor_fndecl_runtime_error, args); diff --git a/gcc/function.c b/gcc/function.c index e59f002cb5c..de40361410f 100644 --- a/gcc/function.c +++ b/gcc/function.c @@ -2618,7 +2618,8 @@ assign_parm_setup_block (tree parm, struct assign_parm_data_one *data) rtx reg = gen_rtx_REG (word_mode, REGNO (data->entry_parm)); x = expand_shift (LSHIFT_EXPR, word_mode, reg, - build_int_2 (by, 0), NULL_RTX, 1); + build_int_cst (NULL_TREE, by, 0), + NULL_RTX, 1); tem = change_address (mem, word_mode, 0); emit_move_insn (tem, x); } diff --git a/gcc/java/ChangeLog b/gcc/java/ChangeLog index a1e5a0506f6..493a5f3c2f7 100644 --- a/gcc/java/ChangeLog +++ b/gcc/java/ChangeLog @@ -1,3 +1,25 @@ +2004-08-15 Nathan Sidwell + + * boehm.c (get_boehm_type_descriptor): Use build_int_cst. + * class.c (build_utf8_ref, build_static_field_ref, + make_field_value, make_method_value, get_dispatch_table, + make_class_data, emit_symbol_table, emit_catch_table): Likewise. + * constants.c (get_tag_node, build_ref_from_constant_pool, + build_constants_constructor): Likewise. + * decl.c (java_init_decl_processing): Likewise. + * expr.c (build_java_array_length_access, build_newarray, + expand_java_multianewarray, expand_java_pushc, expand_iinc, + build_java_binop, build_field_ref, expand_java_add_case, + expand_java_call, build_known_method_ref, build_invokevirtual, + build_invokeinterface, build_jni_stub): Likewise. + * java-gimplify.c (java_gimplify_new_array_init): Likewise. + * jcf-parse.c (get_constant): Likewise. + * lex.c (do_java_lex): Likewise. + * parse.y (patch_binop, patch_unaryop, patch_cast, + build_null_of_type, patch_newarray): Likewise. + * resource.c (compile_resource_data): Likewise. + * typeck.c (build_prim_array_type): Likewise. + 2004-08-10 Bryce McKinlay * java-gimplify.c (java_gimplify_new_array_init): Use create_tmp_var. diff --git a/gcc/java/boehm.c b/gcc/java/boehm.c index 00dc4904d5a..ae2fbfa3428 100644 --- a/gcc/java/boehm.c +++ b/gcc/java/boehm.c @@ -146,12 +146,13 @@ get_boehm_type_descriptor (tree type) HOST_WIDE_INT last_view_index = -1; int pointer_after_end = 0; unsigned HOST_WIDE_INT low = 0, high = 0; - tree field, value; + tree field, value, value_type; /* If the GC wasn't requested, just use a null pointer. */ if (! flag_use_boehm_gc) return null_pointer_node; + value_type = java_type_for_mode (ptr_mode, 1); /* If we have a type of unknown size, use a proc. */ if (int_size_in_bytes (type) == -1) goto procedure_object_descriptor; @@ -205,13 +206,13 @@ get_boehm_type_descriptor (tree type) last_set_index >>= 1; ++count; } - value = build_int_2 (low, high); + value = build_int_cst (value_type, low, high); } else if (! pointer_after_end) { /* Bottom two bits for bitmap mark type are 01. */ set_bit (&low, &high, 0); - value = build_int_2 (low, high); + value = build_int_cst (value_type, low, high); } else { @@ -222,9 +223,8 @@ get_boehm_type_descriptor (tree type) | DS_PROC) Here DS_PROC == 2. */ procedure_object_descriptor: - value = build_int_2 (2, 0); + value = build_int_cst (value_type, 2, 0); } - TREE_TYPE (value) = java_type_for_mode (ptr_mode, 1); return value; } diff --git a/gcc/java/class.c b/gcc/java/class.c index 7f4c01c1971..b8b4c903583 100644 --- a/gcc/java/class.c +++ b/gcc/java/class.c @@ -880,8 +880,8 @@ build_utf8_ref (tree name) FINISH_RECORD (ctype); START_RECORD_CONSTRUCTOR (cinit, ctype); name_hash = hashUtf8String (name_ptr, name_len) & 0xFFFF; - PUSH_FIELD_VALUE (cinit, "hash", build_int_2 (name_hash, 0)); - PUSH_FIELD_VALUE (cinit, "length", build_int_2 (name_len, 0)); + PUSH_FIELD_VALUE (cinit, "hash", build_int_cst (NULL_TREE, name_hash, 0)); + PUSH_FIELD_VALUE (cinit, "length", build_int_cst (NULL_TREE, name_len, 0)); string = build_string (name_len, name_ptr); TREE_TYPE (string) = str_type; PUSH_FIELD_VALUE (cinit, "data", string); @@ -1081,8 +1081,8 @@ build_static_field_ref (tree fdecl) if (flag_indirect_dispatch) { tree table_index - = build_int_2 (get_symbol_table_index - (fdecl, &TYPE_ATABLE_METHODS (output_class)), 0); + = build_int_cst (NULL_TREE, get_symbol_table_index + (fdecl, &TYPE_ATABLE_METHODS (output_class)), 0); tree field_address = build4 (ARRAY_REF, build_pointer_type (TREE_TYPE (fdecl)), TYPE_ATABLE_DECL (output_class), table_index, @@ -1114,7 +1114,7 @@ build_static_field_ref (tree fdecl) } field_index *= int_size_in_bytes (field_type_node); ref = fold (build2 (PLUS_EXPR, field_ptr_type_node, - ref, build_int_2 (field_index, 0))); + ref, build_int_cst (NULL_TREE, field_index, 0))); ref = build1 (INDIRECT_REF, field_type_node, ref); ref = build3 (COMPONENT_REF, field_info_union_node, ref, lookup_field (&field_type_node, info_ident), @@ -1224,7 +1224,7 @@ make_field_value (tree fdecl) if (! resolved) flags |= 0x8000 /* FIELD_UNRESOLVED_FLAG */; - PUSH_FIELD_VALUE (finit, "accflags", build_int_2 (flags, 0)); + PUSH_FIELD_VALUE (finit, "accflags", build_int_cst (NULL_TREE, flags, 0)); PUSH_FIELD_VALUE (finit, "bsize", TYPE_SIZE_UNIT (TREE_TYPE (fdecl))); PUSH_FIELD_VALUE @@ -1256,7 +1256,8 @@ make_method_value (tree mdecl) class_decl = DECL_CONTEXT (mdecl); /* For interfaces, the index field contains the dispatch index. */ if (CLASS_INTERFACE (TYPE_NAME (class_decl))) - index = build_int_2 (get_interface_method_index (mdecl, class_decl), 0); + index = build_int_cst (NULL_TREE, + get_interface_method_index (mdecl, class_decl), 0); else if (!flag_indirect_dispatch && get_method_index (mdecl) != NULL_TREE) index = get_method_index (mdecl); else @@ -1278,7 +1279,7 @@ make_method_value (tree mdecl) (IDENTIFIER_POINTER(signature), IDENTIFIER_LENGTH(signature))))); } - PUSH_FIELD_VALUE (minit, "accflags", build_int_2 (accflags, 0)); + PUSH_FIELD_VALUE (minit, "accflags", build_int_cst (NULL_TREE, accflags, 0)); PUSH_FIELD_VALUE (minit, "index", index); PUSH_FIELD_VALUE (minit, "ncode", code); @@ -1391,7 +1392,7 @@ get_dispatch_table (tree type, tree this_class_addr) for (j = 0; j < TARGET_VTABLE_USES_DESCRIPTORS; ++j) { tree fdesc = build2 (FDESC_EXPR, nativecode_ptr_type_node, - method, build_int_2 (j, 0)); + method, build_int_cst (NULL_TREE, j, 0)); TREE_CONSTANT (fdesc) = 1; TREE_INVARIANT (fdesc) = 1; list = tree_cons (NULL_TREE, fdesc, list); @@ -1504,7 +1505,9 @@ make_class_data (tree type) tree type_decl = TYPE_NAME (type); /** Offset from start of virtual function table declaration to where objects actually point at, following new g++ ABI. */ - tree dtable_start_offset = build_int_2 (2 * POINTER_SIZE / BITS_PER_UNIT, 0); + tree dtable_start_offset = build_int_cst (NULL_TREE, + 2 * POINTER_SIZE / BITS_PER_UNIT, + 0); this_class_addr = build_class_ref (type); decl = TREE_OPERAND (this_class_addr, 0); @@ -1618,8 +1621,7 @@ make_class_data (tree type) else { int super_index = alloc_class_constant (super); - super = build_int_2 (super_index, 0); - TREE_TYPE (super) = ptr_type_node; + super = build_int_cst (ptr_type_node, super_index, 0); } /* Build and emit the array of implemented interfaces. */ @@ -1648,8 +1650,7 @@ make_class_data (tree type) else { int int_index = alloc_class_constant (iclass); - index = build_int_2 (int_index, 0); - TREE_TYPE (index) = ptr_type_node; + index = build_int_cst (ptr_type_node, int_index, 0); } init = tree_cons (NULL_TREE, index, init); } @@ -1694,14 +1695,16 @@ make_class_data (tree type) PUSH_FIELD_VALUE (cons, "next", null_pointer_node); PUSH_FIELD_VALUE (cons, "name", build_utf8_ref (DECL_NAME (type_decl))); PUSH_FIELD_VALUE (cons, "accflags", - build_int_2 (get_access_flags_from_decl (type_decl), 0)); + build_int_cst (NULL_TREE, + get_access_flags_from_decl (type_decl), 0)); PUSH_FIELD_VALUE (cons, "superclass", CLASS_INTERFACE (type_decl) ? null_pointer_node : super); PUSH_FIELD_VALUE (cons, "constants", constant_pool_constructor); PUSH_FIELD_VALUE (cons, "methods", build1 (ADDR_EXPR, method_ptr_type_node, methods_decl)); - PUSH_FIELD_VALUE (cons, "method_count", build_int_2 (method_count, 0)); + PUSH_FIELD_VALUE (cons, "method_count", + build_int_cst (NULL_TREE, method_count, 0)); if (flag_indirect_dispatch) PUSH_FIELD_VALUE (cons, "vtable_method_count", integer_minus_one_node); @@ -1712,9 +1715,10 @@ make_class_data (tree type) fields_decl == NULL_TREE ? null_pointer_node : build1 (ADDR_EXPR, field_ptr_type_node, fields_decl)); PUSH_FIELD_VALUE (cons, "size_in_bytes", size_in_bytes (type)); - PUSH_FIELD_VALUE (cons, "field_count", build_int_2 (field_count, 0)); + PUSH_FIELD_VALUE (cons, "field_count", + build_int_cst (NULL_TREE, field_count, 0)); PUSH_FIELD_VALUE (cons, "static_field_count", - build_int_2 (static_field_count, 0)); + build_int_cst (NULL_TREE, static_field_count, 0)); if (flag_indirect_dispatch) PUSH_FIELD_VALUE (cons, "vtable", null_pointer_node); @@ -1760,7 +1764,8 @@ make_class_data (tree type) build1 (ADDR_EXPR, ptr_type_node, TYPE_CTABLE_DECL (type))); PUSH_FIELD_VALUE (cons, "interfaces", interfaces); PUSH_FIELD_VALUE (cons, "loader", null_pointer_node); - PUSH_FIELD_VALUE (cons, "interface_count", build_int_2 (interface_len, 0)); + PUSH_FIELD_VALUE (cons, "interface_count", + build_int_cst (NULL_TREE, interface_len, 0)); PUSH_FIELD_VALUE (cons, "state", integer_zero_node); PUSH_FIELD_VALUE (cons, "thread", null_pointer_node); @@ -2394,7 +2399,7 @@ emit_symbol_table (tree name, tree the_table, tree decl_list, uninitialized static array of INDEX + 1 elements. The extra entry is used by the runtime to track whether the table has been initialized. */ - table_size = build_index_type (build_int_2 (index, 0)); + table_size = build_index_type (build_int_cst (NULL_TREE, index, 0)); the_array_type = build_array_type (the_array_element_type, table_size); the_table = build_decl (VAR_DECL, name, the_array_type); TREE_STATIC (the_table) = 1; @@ -2433,9 +2438,9 @@ emit_catch_table (tree this_class) tree_cons (NULL, make_catch_class_record (null_pointer_node, null_pointer_node), TYPE_CATCH_CLASSES (this_class)); - table_size = - build_index_type (build_int_2 - (list_length (TYPE_CATCH_CLASSES (this_class)), 0)); + table_size = build_index_type + (build_int_cst (NULL_TREE, + list_length (TYPE_CATCH_CLASSES (this_class)), 0)); array_type = build_array_type (TREE_TYPE (TREE_TYPE (TYPE_CTABLE_DECL (this_class))), table_size); diff --git a/gcc/java/constants.c b/gcc/java/constants.c index cffd5d9cc72..d6a35136ad7 100644 --- a/gcc/java/constants.c +++ b/gcc/java/constants.c @@ -321,10 +321,10 @@ static GTY(()) tree tag_nodes[13]; static tree get_tag_node (int tag) { - /* A Cache for build_int_2 (CONSTANT_XXX, 0). */ + /* A Cache for build_int_cst (CONSTANT_XXX, 0). */ if (tag_nodes[tag] == NULL_TREE) - tag_nodes[tag] = build_int_2 (tag, 0); + tag_nodes[tag] = build_int_cst (NULL_TREE, tag, 0); return tag_nodes[tag]; } @@ -424,7 +424,7 @@ tree build_ref_from_constant_pool (int index) { tree d = build_constant_data_ref (); - tree i = build_int_2 (index, 0); + tree i = build_int_cst (NULL_TREE, index, 0); return build4 (ARRAY_REF, TREE_TYPE (TREE_TYPE (d)), d, i, NULL_TREE, NULL_TREE); } @@ -452,11 +452,9 @@ build_constants_constructor (void) } if (outgoing_cpool->count > 0) { - tree index_type; tree data_decl, tags_decl, tags_type; - tree max_index = build_int_2 (outgoing_cpool->count - 1, 0); - TREE_TYPE (max_index) = sizetype; - index_type = build_index_type (max_index); + tree max_index = build_int_cst (sizetype, outgoing_cpool->count - 1, 0); + tree index_type = build_index_type (max_index); /* Add dummy 0'th element of constant pool. */ tags_list = tree_cons (NULL_TREE, get_tag_node (0), tags_list); @@ -486,7 +484,8 @@ build_constants_constructor (void) tags_value = null_pointer_node; } START_RECORD_CONSTRUCTOR (cons, constants_type_node); - PUSH_FIELD_VALUE (cons, "size", build_int_2 (outgoing_cpool->count, 0)); + PUSH_FIELD_VALUE (cons, "size", + build_int_cst (NULL_TREE, outgoing_cpool->count, 0)); PUSH_FIELD_VALUE (cons, "tags", tags_value); PUSH_FIELD_VALUE (cons, "data", data_value); FINISH_RECORD_CONSTRUCTOR (cons); diff --git a/gcc/java/decl.c b/gcc/java/decl.c index 73653b29d8a..d6bce487f05 100644 --- a/gcc/java/decl.c +++ b/gcc/java/decl.c @@ -585,25 +585,24 @@ java_init_decl_processing (void) /* Define these next since types below may used them. */ integer_type_node = java_type_for_size (INT_TYPE_SIZE, 0); - integer_zero_node = build_int_2 (0, 0); - integer_one_node = build_int_2 (1, 0); - integer_two_node = build_int_2 (2, 0); - integer_four_node = build_int_2 (4, 0); - integer_minus_one_node = build_int_2 (-1, -1); + integer_zero_node = build_int_cst (NULL_TREE, 0, 0); + integer_one_node = build_int_cst (NULL_TREE, 1, 0); + integer_two_node = build_int_cst (NULL_TREE, 2, 0); + integer_four_node = build_int_cst (NULL_TREE, 4, 0); + integer_minus_one_node = build_int_cst (NULL_TREE, -1, -1); /* A few values used for range checking in the lexer. */ - decimal_int_max = build_int_2 (0x80000000, 0); - TREE_TYPE (decimal_int_max) = unsigned_int_type_node; + decimal_int_max = build_int_cst (unsigned_int_type_node, 0x80000000, 0); #if HOST_BITS_PER_WIDE_INT == 64 - decimal_long_max = build_int_2 (0x8000000000000000LL, 0); + decimal_long_max = build_int_cst (unsigned_long_type_node, + 0x8000000000000000LL, 0); #else #if HOST_BITS_PER_WIDE_INT == 32 - decimal_long_max = build_int_2 (0, 0x80000000); + decimal_long_max = build_int_cst (unsigned_long_type_node, 0, 0x80000000); #else #error "unsupported size" #endif #endif - TREE_TYPE (decimal_long_max) = unsigned_long_type_node; size_zero_node = size_int (0); size_one_node = size_int (1); @@ -611,8 +610,7 @@ java_init_decl_processing (void) bitsize_one_node = bitsize_int (1); bitsize_unit_node = bitsize_int (BITS_PER_UNIT); - long_zero_node = build_int_2 (0, 0); - TREE_TYPE (long_zero_node) = long_type_node; + long_zero_node = build_int_cst (long_type_node, 0, 0); void_type_node = make_node (VOID_TYPE); pushdecl (build_decl (TYPE_DECL, get_identifier ("void"), void_type_node)); @@ -622,8 +620,7 @@ java_init_decl_processing (void) layout_type (t); /* Uses size_zero_node */ return_address_type_node = build_pointer_type (t); - null_pointer_node = build_int_2 (0, 0); - TREE_TYPE (null_pointer_node) = ptr_type_node; + null_pointer_node = build_int_cst (ptr_type_node, 0, 0); #if 0 /* Make a type to be the domain of a few array types diff --git a/gcc/java/expr.c b/gcc/java/expr.c index 1479b6e60b9..9472794dfee 100644 --- a/gcc/java/expr.c +++ b/gcc/java/expr.c @@ -698,7 +698,7 @@ build_java_array_length_access (tree node) length = java_array_type_length (type); if (length >= 0) - return build_int_2 (length, 0); + return build_int_cst (NULL_TREE, length, 0); node = build3 (COMPONENT_REF, int_type_node, build_java_indirect_ref (array_type, node, @@ -910,7 +910,7 @@ build_newarray (int atype_value, tree length) and save the runtime some work. However, the bytecode generator expects to find the type_code int here. */ if (flag_emit_class_files) - type_arg = build_int_2 (atype_value, 0); + type_arg = build_int_cst (NULL_TREE, atype_value, 0); else type_arg = build_class_ref (prim_type); @@ -971,7 +971,8 @@ expand_java_multianewarray (tree class_type, int ndim) build_address_of (soft_multianewarray_node), tree_cons (NULL_TREE, build_class_ref (class_type), tree_cons (NULL_TREE, - build_int_2 (ndim, 0), args)), + build_int_cst (NULL_TREE, ndim, 0), + args)), NULL_TREE)); } @@ -1081,10 +1082,7 @@ expand_java_pushc (int ival, tree type) if (type == ptr_type_node && ival == 0) value = null_pointer_node; else if (type == int_type_node || type == long_type_node) - { - value = build_int_2 (ival, ival < 0 ? -1 : 0); - TREE_TYPE (value) = type; - } + value = build_int_cst (type, ival, ival < 0 ? -1 : 0); else if (type == float_type_node || type == double_type_node) { REAL_VALUE_TYPE x; @@ -1289,7 +1287,7 @@ expand_iinc (unsigned int local_var_index, int ival, int pc) flush_quick_stack (); local_var = find_local_variable (local_var_index, int_type_node, pc); - constant_value = build_int_2 (ival, ival < 0 ? -1 : 0); + constant_value = build_int_cst (NULL_TREE, ival, ival < 0 ? -1 : 0); res = fold (build2 (PLUS_EXPR, int_type_node, local_var, constant_value)); java_add_stmt (build2 (MODIFY_EXPR, TREE_TYPE (local_var), local_var, res)); update_aliases (local_var, local_var_index, pc); @@ -1359,7 +1357,8 @@ build_java_binop (enum tree_code op, tree type, tree arg1, tree arg2) } case LSHIFT_EXPR: case RSHIFT_EXPR: - mask = build_int_2 (TYPE_PRECISION (TREE_TYPE (arg1)) - 1, 0); + mask = build_int_cst (NULL_TREE, + TYPE_PRECISION (TREE_TYPE (arg1)) - 1, 0); arg2 = fold (build2 (BIT_AND_EXPR, int_type_node, arg2, mask)); break; @@ -1539,9 +1538,9 @@ build_field_ref (tree self_value, tree self_class, tree name) we can make a direct reference. */ { tree otable_index - = build_int_2 (get_symbol_table_index - (field_decl, &TYPE_OTABLE_METHODS (output_class)), - 0); + = build_int_cst (NULL_TREE, get_symbol_table_index + (field_decl, &TYPE_OTABLE_METHODS (output_class)), + 0); tree field_offset = build4 (ARRAY_REF, integer_type_node, TYPE_OTABLE_DECL (output_class), otable_index, @@ -1689,8 +1688,7 @@ expand_java_add_case (tree switch_expr, int match, int target_pc) { tree value, x; - value = build_int_2 (match, match < 0 ? -1 : 0); - TREE_TYPE (value) = TREE_TYPE (switch_expr); + value = build_int_cst (TREE_TYPE (switch_expr), match, match < 0 ? -1 : 0); x = build3 (CASE_LABEL_EXPR, void_type_node, value, NULL_TREE, create_artificial_label ()); @@ -1705,7 +1703,8 @@ static void expand_java_call (int target_pc, int return_address) { tree target_label = lookup_label (target_pc); - tree value = build_int_2 (return_address, return_address < 0 ? -1 : 0); + tree value = build_int_cst (NULL_TREE, + return_address, return_address < 0 ? -1 : 0); push_value (value); flush_quick_stack (); expand_goto (target_label); @@ -1836,8 +1835,8 @@ build_known_method_ref (tree method, tree method_type ATTRIBUTE_UNUSED, else { tree table_index - = build_int_2 (get_symbol_table_index - (method, &TYPE_ATABLE_METHODS (output_class)), 0); + = build_int_cst (NULL_TREE, get_symbol_table_index + (method, &TYPE_ATABLE_METHODS (output_class)), 0); func = build4 (ARRAY_REF, method_ptr_type_node, TYPE_ATABLE_DECL (output_class), table_index, NULL_TREE, NULL_TREE); @@ -1881,7 +1880,7 @@ build_known_method_ref (tree method, tree method_type ATTRIBUTE_UNUSED, } method_index *= int_size_in_bytes (method_type_node); ref = fold (build2 (PLUS_EXPR, method_ptr_type_node, - ref, build_int_2 (method_index, 0))); + ref, build_int_cst (NULL_TREE, method_index, 0))); ref = build1 (INDIRECT_REF, method_type_node, ref); func = build3 (COMPONENT_REF, nativecode_ptr_type_node, ref, lookup_field (&method_type_node, ncode_ident), @@ -1961,8 +1960,8 @@ build_invokevirtual (tree dtable, tree method) if (flag_indirect_dispatch) { otable_index - = build_int_2 (get_symbol_table_index - (method, &TYPE_OTABLE_METHODS (output_class)), 0); + = build_int_cst (NULL_TREE, get_symbol_table_index + (method, &TYPE_OTABLE_METHODS (output_class)), 0); method_index = build4 (ARRAY_REF, integer_type_node, TYPE_OTABLE_DECL (output_class), otable_index, NULL_TREE, NULL_TREE); @@ -2021,14 +2020,15 @@ build_invokeinterface (tree dtable, tree method) if (flag_indirect_dispatch) { otable_index - = build_int_2 (get_symbol_table_index - (method, &TYPE_OTABLE_METHODS (output_class)), 0); + = build_int_cst (NULL_TREE, get_symbol_table_index + (method, &TYPE_OTABLE_METHODS (output_class)), 0); idx = build4 (ARRAY_REF, integer_type_node, TYPE_OTABLE_DECL (output_class), otable_index, NULL_TREE, NULL_TREE); } else - idx = build_int_2 (get_interface_method_index (method, interface), 0); + idx = build_int_cst (NULL_TREE, + get_interface_method_index (method, interface), 0); lookup_arg = tree_cons (NULL_TREE, dtable, tree_cons (NULL_TREE, build_class_ref (interface), @@ -2282,7 +2282,7 @@ build_jni_stub (tree method) /* We call _Jv_LookupJNIMethod to find the actual underlying function pointer. _Jv_LookupJNIMethod will throw the appropriate exception if this function is not found at runtime. */ - tem = build_tree_list (NULL_TREE, build_int_2 (args_size, 0)); + tem = build_tree_list (NULL_TREE, build_int_cst (NULL_TREE, args_size, 0)); method_sig = build_java_signature (TREE_TYPE (method)); lookup_arg = tree_cons (NULL_TREE, build_utf8_ref (unmangle_classname diff --git a/gcc/java/java-gimplify.c b/gcc/java/java-gimplify.c index 2d3be9995a3..094555938d9 100644 --- a/gcc/java/java-gimplify.c +++ b/gcc/java/java-gimplify.c @@ -242,7 +242,7 @@ java_gimplify_new_array_init (tree exp) tree data_field = lookup_field (&array_type, get_identifier ("data")); tree element_type = TYPE_ARRAY_ELEMENT (array_type); HOST_WIDE_INT ilength = java_array_type_length (array_type); - tree length = build_int_2 (ilength, 0); + tree length = build_int_cst (NULL_TREE, ilength, 0); tree init = TREE_OPERAND (exp, 0); tree values = CONSTRUCTOR_ELTS (init); @@ -263,7 +263,7 @@ java_gimplify_new_array_init (tree exp) data_field, NULL_TREE); tree assignment = build2 (MODIFY_EXPR, element_type, build4 (ARRAY_REF, element_type, lhs, - build_int_2 (index++, 0), + build_int_cst (NULL_TREE, index++, 0), NULL_TREE, NULL_TREE), TREE_VALUE (values)); body = build2 (COMPOUND_EXPR, element_type, body, assignment); diff --git a/gcc/java/jcf-parse.c b/gcc/java/jcf-parse.c index 272ce96c779..d62b1b8f325 100644 --- a/gcc/java/jcf-parse.c +++ b/gcc/java/jcf-parse.c @@ -266,8 +266,7 @@ get_constant (JCF *jcf, int index) case CONSTANT_Integer: { jint num = JPOOL_INT(jcf, index); - value = build_int_2 (num, num < 0 ? -1 : 0); - TREE_TYPE (value) = int_type_node; + value = build_int_cst (int_type_node, num, num < 0 ? -1 : 0); break; } case CONSTANT_Long: @@ -279,8 +278,7 @@ get_constant (JCF *jcf, int index) lshift_double (num, 0, 32, 64, &lo, &hi, 0); num = JPOOL_UINT (jcf, index+1); add_double (lo, hi, num, 0, &lo, &hi); - value = build_int_2 (lo, hi); - TREE_TYPE (value) = long_type_node; + value = build_int_cst (long_type_node, lo, hi); value = force_fit_type (value, 0, false, false); break; } diff --git a/gcc/java/lex.c b/gcc/java/lex.c index 95fbd5763c4..5467d60b9d6 100644 --- a/gcc/java/lex.c +++ b/gcc/java/lex.c @@ -1276,11 +1276,10 @@ do_java_lex (YYSTYPE *java_lval) #ifndef JC1_LITE /* Range checking. */ - value = build_int_2 (low, high); /* Temporarily set type to unsigned. */ - TREE_TYPE (value) = (long_suffix - ? unsigned_long_type_node - : unsigned_int_type_node); + value = build_int_cst (long_suffix + ? unsigned_long_type_node + : unsigned_int_type_node, low, high); SET_LVAL_NODE (value); /* For base 10 numbers, only values up to the highest value @@ -1301,7 +1300,8 @@ do_java_lex (YYSTYPE *java_lval) } /* Sign extend the value. */ - TREE_TYPE (value) = long_suffix ? long_type_node : int_type_node; + value = build_int_cst (long_suffix ? long_type_node : int_type_node, + low, high); value = force_fit_type (value, 0, false, false); SET_LVAL_NODE (value); @@ -1335,13 +1335,7 @@ do_java_lex (YYSTYPE *java_lval) char_lit = 0; /* We silently convert it to zero. */ JAVA_LEX_CHAR_LIT (char_lit); -#ifndef JC1_LITE - { - tree value = build_int_2 (char_lit, 0); - TREE_TYPE (value) = char_type_node; - SET_LVAL_NODE (value); - } -#endif + SET_LVAL_NODE (build_int_cst (char_type_node, char_lit, 0)); return CHAR_LIT_TK; } diff --git a/gcc/java/parse.y b/gcc/java/parse.y index 3b08ad27f1e..8e0d3197840 100644 --- a/gcc/java/parse.y +++ b/gcc/java/parse.y @@ -13322,10 +13322,10 @@ patch_binop (tree node, tree wfl_op1, tree wfl_op2) /* Shift int only up to 0x1f and long up to 0x3f */ if (prom_type == int_type_node) op2 = fold (build2 (BIT_AND_EXPR, int_type_node, op2, - build_int_2 (0x1f, 0))); + build_int_cst (NULL_TREE, 0x1f, 0))); else op2 = fold (build2 (BIT_AND_EXPR, int_type_node, op2, - build_int_2 (0x3f, 0))); + build_int_cst (NULL_TREE, 0x3f, 0))); /* The >>> operator is a >> operating on unsigned quantities */ if (code == URSHIFT_EXPR && ! flag_emit_class_files) @@ -14020,12 +14020,12 @@ patch_unaryop (tree node, tree wfl_op) both operands, if really necessary */ if (JINTEGRAL_TYPE_P (op_type)) { - value = build_int_2 (1, 0); - TREE_TYPE (value) = TREE_TYPE (node) = op_type; + value = build_int_cst (op_type, 1, 0); + TREE_TYPE (node) = op_type; } else { - value = build_int_2 (1, 0); + value = build_int_cst (NULL_TREE, 1, 0); TREE_TYPE (node) = binary_numeric_promotion (op_type, TREE_TYPE (value), &op, &value); @@ -14251,8 +14251,7 @@ patch_cast (tree node, tree wfl_op) static tree build_null_of_type (tree type) { - tree node = build_int_2 (0, 0); - TREE_TYPE (node) = promote_type (type); + tree node = build_int_cst (promote_type (type), 0, 0); return node; } @@ -14333,7 +14332,8 @@ static tree build_newarray_node (tree type, tree dims, int extra_dims) { tree node = build3 (NEW_ARRAY_EXPR, NULL_TREE, type, - nreverse (dims), build_int_2 (extra_dims, 0)); + nreverse (dims), + build_int_cst (NULL_TREE, extra_dims, 0)); return node; } @@ -14432,7 +14432,8 @@ patch_newarray (tree node) tree_cons (NULL_TREE, build_class_ref (TREE_TYPE (array_type)), tree_cons (NULL_TREE, - build_int_2 (ndims, 0), dims )), + build_int_cst (NULL_TREE, + ndims, 0), dims )), NULL_TREE); } diff --git a/gcc/java/resource.c b/gcc/java/resource.c index 6257d3743e1..362aab49624 100644 --- a/gcc/java/resource.c +++ b/gcc/java/resource.c @@ -69,9 +69,9 @@ compile_resource_data (const char *name, const char *buffer, int length) FINISH_RECORD (rtype); START_RECORD_CONSTRUCTOR (rinit, rtype); PUSH_FIELD_VALUE (rinit, "name_length", - build_int_2 (strlen (name), 0)); + build_int_cst (NULL_TREE, strlen (name), 0)); PUSH_FIELD_VALUE (rinit, "resource_length", - build_int_2 (length, 0)); + build_int_cst (NULL_TREE, length, 0)); data = build_string (strlen(name) + length, buffer); TREE_TYPE (data) = data_type; PUSH_FIELD_VALUE (rinit, "data", data); diff --git a/gcc/java/typeck.c b/gcc/java/typeck.c index 289048ed1fa..830b95c5c62 100644 --- a/gcc/java/typeck.c +++ b/gcc/java/typeck.c @@ -357,8 +357,8 @@ build_prim_array_type (tree element_type, HOST_WIDE_INT length) if (length != -1) { - tree max_index = build_int_2 (length - 1, (0 == length ? -1 : 0)); - TREE_TYPE (max_index) = sizetype; + tree max_index = build_int_cst (sizetype, + length - 1, (0 == length ? -1 : 0)); index = build_index_type (max_index); } return build_array_type (element_type, index); diff --git a/gcc/objc/objc-act.c b/gcc/objc/objc-act.c index a99ee522321..b718714c996 100644 --- a/gcc/objc/objc-act.c +++ b/gcc/objc/objc-act.c @@ -1432,7 +1432,7 @@ build_objc_string_object (tree string) } else { - initlist = build_tree_list (fields, build_int_2 (0, 0)); + initlist = build_tree_list (fields, build_int_cst (NULL_TREE, 0, 0)); } fields = TREE_CHAIN (fields); @@ -1443,7 +1443,7 @@ build_objc_string_object (tree string) fields = TREE_CHAIN (fields); - initlist = tree_cons (fields, build_int_2 (length, 0), initlist); + initlist = tree_cons (fields, build_int_cst (NULL_TREE, length, 0), initlist); constructor = objc_build_constructor (constant_string_type, nreverse (initlist)); @@ -1596,7 +1596,7 @@ build_objc_symtab_template (void) (FIELD_DECL, build_array_type (ptr_type_node, - build_index_type (build_int_2 (index, 0))), + build_index_type (build_int_cst (NULL_TREE, index, 0))), "defs"); chainon (field_decl_chain, field_decl); } @@ -1641,7 +1641,7 @@ init_def_list (tree type) if (static_instances_decl) expr = build_unary_op (ADDR_EXPR, static_instances_decl, 0); else - expr = build_int_2 (0, 0); + expr = build_int_cst (NULL_TREE, 0, 0); initlist = tree_cons (NULL_TREE, expr, initlist); } @@ -1658,12 +1658,12 @@ init_objc_symtab (tree type) /* sel_ref_cnt = { ..., 5, ... } */ - initlist = build_tree_list (NULL_TREE, build_int_2 (0, 0)); + initlist = build_tree_list (NULL_TREE, build_int_cst (NULL_TREE, 0, 0)); /* refs = { ..., _OBJC_SELECTOR_TABLE, ... } */ if (flag_next_runtime || ! sel_ref_chain) - initlist = tree_cons (NULL_TREE, build_int_2 (0, 0), initlist); + initlist = tree_cons (NULL_TREE, build_int_cst (NULL_TREE, 0, 0), initlist); else initlist = tree_cons (NULL_TREE, build_unary_op (ADDR_EXPR, @@ -1672,11 +1672,11 @@ init_objc_symtab (tree type) /* cls_def_cnt = { ..., 5, ... } */ - initlist = tree_cons (NULL_TREE, build_int_2 (imp_count, 0), initlist); + initlist = tree_cons (NULL_TREE, build_int_cst (NULL_TREE, imp_count, 0), initlist); /* cat_def_cnt = { ..., 5, ... } */ - initlist = tree_cons (NULL_TREE, build_int_2 (cat_count, 0), initlist); + initlist = tree_cons (NULL_TREE, build_int_cst (NULL_TREE, cat_count, 0), initlist); /* cls_def = { ..., { &Foo, &Bar, ...}, ... } */ @@ -1777,7 +1777,7 @@ init_module_descriptor (tree type) /* version = { 1, ... } */ - expr = build_int_2 (OBJC_VERSION, 0); + expr = build_int_cst (NULL_TREE, OBJC_VERSION, 0); initlist = build_tree_list (NULL_TREE, expr); /* size = { ..., sizeof (struct objc_module), ... } */ @@ -1795,7 +1795,7 @@ init_module_descriptor (tree type) if (UOBJC_SYMBOLS_decl) expr = build_unary_op (ADDR_EXPR, UOBJC_SYMBOLS_decl, 0); else - expr = build_int_2 (0, 0); + expr = build_int_cst (NULL_TREE, 0, 0); initlist = tree_cons (NULL_TREE, expr, initlist); return objc_build_constructor (type, nreverse (initlist)); @@ -2002,7 +2002,7 @@ generate_static_references (void) } /* Output {..., NULL}. */ - initlist = tree_cons (NULL_TREE, build_int_2 (0, 0), initlist); + initlist = tree_cons (NULL_TREE, build_int_cst (NULL_TREE, 0, 0), initlist); expr = objc_build_constructor (TREE_TYPE (decl), nreverse (initlist)); finish_decl (decl, expr, NULL_TREE); @@ -2010,7 +2010,7 @@ generate_static_references (void) = tree_cons (NULL_TREE, build_unary_op (ADDR_EXPR, decl, 1), decls); } - decls = tree_cons (NULL_TREE, build_int_2 (0, 0), decls); + decls = tree_cons (NULL_TREE, build_int_cst (NULL_TREE, 0, 0), decls); ident = get_identifier ("_OBJC_STATIC_INSTANCES"); expr_decl = build_nt (ARRAY_REF, ident, NULL_TREE, NULL_TREE, NULL_TREE); decl_spec = tree_cons (NULL_TREE, build_pointer_type (void_type_node), @@ -2205,7 +2205,7 @@ build_selector_translation_table (void) DECL_EXTERNAL (UOBJC_SELECTOR_TABLE_decl) = 0; TREE_STATIC (UOBJC_SELECTOR_TABLE_decl) = 1; /* NULL terminate the list and fix the decl for output. */ - initlist = tree_cons (NULL_TREE, build_int_2 (0, 0), initlist); + initlist = tree_cons (NULL_TREE, build_int_cst (NULL_TREE, 0, 0), initlist); DECL_INITIAL (UOBJC_SELECTOR_TABLE_decl) = objc_ellipsis_node; initlist = objc_build_constructor (TREE_TYPE (UOBJC_SELECTOR_TABLE_decl), nreverse (initlist)); @@ -2231,7 +2231,7 @@ get_proto_encoding (tree proto) return add_objc_string (encoding, meth_var_types); } else - return build_int_2 (0, 0); + return build_int_cst (NULL_TREE, 0, 0); } /* sel_ref_chain is a list whose "value" fields will be instances of @@ -2258,7 +2258,7 @@ build_typed_selector_reference (tree ident, tree prototype) return_at_index: expr = build_unary_op (ADDR_EXPR, build_array_ref (UOBJC_SELECTOR_TABLE_decl, - build_int_2 (index, 0)), + build_int_cst (NULL_TREE, index, 0)), 1); return build_c_cast (objc_selector_type, expr); } @@ -2276,7 +2276,7 @@ build_selector_reference (tree ident) return (flag_next_runtime ? TREE_PURPOSE (*chain) : build_array_ref (UOBJC_SELECTOR_TABLE_decl, - build_int_2 (index, 0))); + build_int_cst (NULL_TREE, index, 0))); index++; chain = &TREE_CHAIN (*chain); @@ -2289,7 +2289,7 @@ build_selector_reference (tree ident) return (flag_next_runtime ? expr : build_array_ref (UOBJC_SELECTOR_TABLE_decl, - build_int_2 (index, 0))); + build_int_cst (NULL_TREE, index, 0))); } static GTY(()) int class_reference_idx; @@ -3277,7 +3277,7 @@ build_next_objc_exception_stuff (void) /* int buf[_JBLEN]; */ - index = build_index_type (build_int_2 (_JBLEN - 1, 0)); + index = build_index_type (build_int_cst (NULL_TREE, _JBLEN - 1, 0)); field_decl = create_builtin_decl (FIELD_DECL, build_array_type (integer_type_node, index), "buf"); @@ -3285,7 +3285,7 @@ build_next_objc_exception_stuff (void) /* void *pointers[4]; */ - index = build_index_type (build_int_2 (4 - 1, 0)); + index = build_index_type (build_int_cst (NULL_TREE, 4 - 1, 0)); field_decl = create_builtin_decl (FIELD_DECL, build_array_type (ptr_type_node, index), "pointers"); @@ -3523,7 +3523,7 @@ build_method_prototype_list_template (tree list_type, int size) decl_specs = build_tree_list (NULL_TREE, list_type); field_decl = build_nt (ARRAY_REF, get_identifier ("method_list"), - build_int_2 (size, 0), NULL_TREE, NULL_TREE); + build_int_cst (NULL_TREE, size, 0), NULL_TREE, NULL_TREE); field_decl = grokfield (field_decl, decl_specs, NULL_TREE); chainon (field_decl_chain, field_decl); @@ -3669,7 +3669,7 @@ generate_descriptor_table (tree type, const char *name, int size, tree list, decl_specs, 1, NULL_TREE); DECL_CONTEXT (decl) = NULL_TREE; - initlist = build_tree_list (NULL_TREE, build_int_2 (size, 0)); + initlist = build_tree_list (NULL_TREE, build_int_cst (NULL_TREE, size, 0)); initlist = tree_cons (NULL_TREE, list, initlist); finish_decl (decl, objc_build_constructor (type, nreverse (initlist)), @@ -3879,7 +3879,7 @@ generate_protocols (void) TREE_TYPE (refs_expr) = cast_type2; } else - refs_expr = build_int_2 (0, 0); + refs_expr = build_int_cst (NULL_TREE, 0, 0); /* UOBJC_INSTANCE_METHODS_decl/UOBJC_CLASS_METHODS_decl are set by generate_method_descriptors, which is called above. */ @@ -3912,14 +3912,14 @@ build_protocol_initializer (tree type, tree protocol_name, /* Filling the "isa" in with one allows the runtime system to detect that the version change...should remove before final release. */ - expr = build_int_2 (PROTOCOL_VERSION, 0); + expr = build_int_cst (NULL_TREE, PROTOCOL_VERSION, 0); TREE_TYPE (expr) = cast_type; initlist = tree_cons (NULL_TREE, expr, initlist); initlist = tree_cons (NULL_TREE, protocol_name, initlist); initlist = tree_cons (NULL_TREE, protocol_list, initlist); if (!instance_methods) - initlist = tree_cons (NULL_TREE, build_int_2 (0, 0), initlist); + initlist = tree_cons (NULL_TREE, build_int_cst (NULL_TREE, 0, 0), initlist); else { expr = build_unary_op (ADDR_EXPR, instance_methods, 0); @@ -3927,7 +3927,7 @@ build_protocol_initializer (tree type, tree protocol_name, } if (!class_methods) - initlist = tree_cons (NULL_TREE, build_int_2 (0, 0), initlist); + initlist = tree_cons (NULL_TREE, build_int_cst (NULL_TREE, 0, 0), initlist); else { expr = build_unary_op (ADDR_EXPR, class_methods, 0); @@ -4420,7 +4420,7 @@ build_ivar_list_template (tree list_type, int size) decl_specs = build_tree_list (NULL_TREE, list_type); field_decl = build_nt (ARRAY_REF, get_identifier ("ivar_list"), - build_int_2 (size, 0), NULL_TREE, NULL_TREE); + build_int_cst (NULL_TREE, size, 0), NULL_TREE, NULL_TREE); field_decl = grokfield (field_decl, decl_specs, NULL_TREE); chainon (field_decl_chain, field_decl); @@ -4468,7 +4468,7 @@ build_method_list_template (tree list_type, int size) decl_specs = build_tree_list (NULL_TREE, list_type); field_decl = build_nt (ARRAY_REF, get_identifier ("method_list"), - build_int_2 (size, 0), NULL_TREE, NULL_TREE); + build_int_cst (NULL_TREE, size, 0), NULL_TREE, NULL_TREE); field_decl = grokfield (field_decl, decl_specs, NULL_TREE); chainon (field_decl_chain, field_decl); @@ -4495,7 +4495,7 @@ build_ivar_list_initializer (tree type, tree field_decl) ivar); else /* Unnamed bit-field ivar (yuck). */ - ivar = tree_cons (NULL_TREE, build_int_2 (0, 0), ivar); + ivar = tree_cons (NULL_TREE, build_int_cst (NULL_TREE, 0, 0), ivar); /* Set type. */ encode_field_decl (field_decl, @@ -4538,7 +4538,7 @@ generate_ivars_list (tree type, const char *name, int size, tree list) decl = start_decl (synth_id_with_class_suffix (name, objc_implementation_context), decl_specs, 1, NULL_TREE); - initlist = build_tree_list (NULL_TREE, build_int_2 (size, 0)); + initlist = build_tree_list (NULL_TREE, build_int_cst (NULL_TREE, size, 0)); initlist = tree_cons (NULL_TREE, list, initlist); finish_decl (decl, @@ -4713,8 +4713,8 @@ generate_dispatch_table (tree type, const char *name, int size, tree list) decl = start_decl (synth_id_with_class_suffix (name, objc_implementation_context), decl_specs, 1, NULL_TREE); - initlist = build_tree_list (NULL_TREE, build_int_2 (0, 0)); - initlist = tree_cons (NULL_TREE, build_int_2 (size, 0), initlist); + initlist = build_tree_list (NULL_TREE, build_int_cst (NULL_TREE, 0, 0)); + initlist = tree_cons (NULL_TREE, build_int_cst (NULL_TREE, size, 0), initlist); initlist = tree_cons (NULL_TREE, list, initlist); finish_decl (decl, @@ -4846,9 +4846,9 @@ generate_protocol_list (tree i_or_p) size++; /* Build initializer. */ - initlist = tree_cons (NULL_TREE, build_int_2 (0, 0), NULL_TREE); + initlist = tree_cons (NULL_TREE, build_int_cst (NULL_TREE, 0, 0), NULL_TREE); - e = build_int_2 (size, 0); + e = build_int_cst (NULL_TREE, size, 0); TREE_TYPE (e) = cast_type; initlist = tree_cons (NULL_TREE, e, initlist); @@ -4875,18 +4875,18 @@ generate_protocol_list (tree i_or_p) expr_decl = build_nt (ARRAY_REF, synth_id_with_class_suffix ("_OBJC_PROTOCOL_REFS", i_or_p), - build_int_2 (size + 2, 0), NULL_TREE, NULL_TREE); + build_int_cst (NULL_TREE, size + 2, 0), NULL_TREE, NULL_TREE); else if (TREE_CODE (i_or_p) == CLASS_INTERFACE_TYPE) expr_decl = build_nt (ARRAY_REF, synth_id_with_class_suffix ("_OBJC_CLASS_PROTOCOLS", i_or_p), - build_int_2 (size + 2, 0), NULL_TREE, NULL_TREE); + build_int_cst (NULL_TREE, size + 2, 0), NULL_TREE, NULL_TREE); else if (TREE_CODE (i_or_p) == CATEGORY_INTERFACE_TYPE) expr_decl = build_nt (ARRAY_REF, synth_id_with_class_suffix ("_OBJC_CATEGORY_PROTOCOLS", i_or_p), - build_int_2 (size + 2, 0), NULL_TREE, NULL_TREE); + build_int_cst (NULL_TREE, size + 2, 0), NULL_TREE, NULL_TREE); else abort (); @@ -4913,14 +4913,14 @@ build_category_initializer (tree type, tree cat_name, tree class_name, initlist = tree_cons (NULL_TREE, class_name, initlist); if (!instance_methods) - initlist = tree_cons (NULL_TREE, build_int_2 (0, 0), initlist); + initlist = tree_cons (NULL_TREE, build_int_cst (NULL_TREE, 0, 0), initlist); else { expr = build_unary_op (ADDR_EXPR, instance_methods, 0); initlist = tree_cons (NULL_TREE, expr, initlist); } if (!class_methods) - initlist = tree_cons (NULL_TREE, build_int_2 (0, 0), initlist); + initlist = tree_cons (NULL_TREE, build_int_cst (NULL_TREE, 0, 0), initlist); else { expr = build_unary_op (ADDR_EXPR, class_methods, 0); @@ -4929,7 +4929,7 @@ build_category_initializer (tree type, tree cat_name, tree class_name, /* protocol_list = */ if (!protocol_list) - initlist = tree_cons (NULL_TREE, build_int_2 (0, 0), initlist); + initlist = tree_cons (NULL_TREE, build_int_cst (NULL_TREE, 0, 0), initlist); else { tree cast_type2 = groktypename @@ -4988,17 +4988,17 @@ build_shared_structure_initializer (tree type, tree isa, tree super, initlist = tree_cons (NULL_TREE, default_conversion (name), initlist); /* version = */ - initlist = tree_cons (NULL_TREE, build_int_2 (0, 0), initlist); + initlist = tree_cons (NULL_TREE, build_int_cst (NULL_TREE, 0, 0), initlist); /* info = */ - initlist = tree_cons (NULL_TREE, build_int_2 (status, 0), initlist); + initlist = tree_cons (NULL_TREE, build_int_cst (NULL_TREE, status, 0), initlist); /* instance_size = */ initlist = tree_cons (NULL_TREE, size, initlist); /* objc_ivar_list = */ if (!ivar_list) - initlist = tree_cons (NULL_TREE, build_int_2 (0, 0), initlist); + initlist = tree_cons (NULL_TREE, build_int_cst (NULL_TREE, 0, 0), initlist); else { expr = build_unary_op (ADDR_EXPR, ivar_list, 0); @@ -5007,7 +5007,7 @@ build_shared_structure_initializer (tree type, tree isa, tree super, /* objc_method_list = */ if (!dispatch_table) - initlist = tree_cons (NULL_TREE, build_int_2 (0, 0), initlist); + initlist = tree_cons (NULL_TREE, build_int_cst (NULL_TREE, 0, 0), initlist); else { expr = build_unary_op (ADDR_EXPR, dispatch_table, 0); @@ -5016,22 +5016,22 @@ build_shared_structure_initializer (tree type, tree isa, tree super, if (flag_next_runtime) /* method_cache = */ - initlist = tree_cons (NULL_TREE, build_int_2 (0, 0), initlist); + initlist = tree_cons (NULL_TREE, build_int_cst (NULL_TREE, 0, 0), initlist); else { /* dtable = */ - initlist = tree_cons (NULL_TREE, build_int_2 (0, 0), initlist); + initlist = tree_cons (NULL_TREE, build_int_cst (NULL_TREE, 0, 0), initlist); /* subclass_list = */ - initlist = tree_cons (NULL_TREE, build_int_2 (0, 0), initlist); + initlist = tree_cons (NULL_TREE, build_int_cst (NULL_TREE, 0, 0), initlist); /* sibling_class = */ - initlist = tree_cons (NULL_TREE, build_int_2 (0, 0), initlist); + initlist = tree_cons (NULL_TREE, build_int_cst (NULL_TREE, 0, 0), initlist); } /* protocol_list = */ if (! protocol_list) - initlist = tree_cons (NULL_TREE, build_int_2 (0, 0), initlist); + initlist = tree_cons (NULL_TREE, build_int_cst (NULL_TREE, 0, 0), initlist); else { tree cast_type2 @@ -5050,10 +5050,10 @@ build_shared_structure_initializer (tree type, tree isa, tree super, if (flag_next_runtime) /* sel_id = NULL */ - initlist = tree_cons (NULL_TREE, build_int_2 (0, 0), initlist); + initlist = tree_cons (NULL_TREE, build_int_cst (NULL_TREE, 0, 0), initlist); /* gc_object_type = NULL */ - initlist = tree_cons (NULL_TREE, build_int_2 (0, 0), initlist); + initlist = tree_cons (NULL_TREE, build_int_cst (NULL_TREE, 0, 0), initlist); return objc_build_constructor (type, nreverse (initlist)); } @@ -5162,7 +5162,7 @@ generate_shared_structures (void) super_expr = build_c_cast (cast_type, super_expr); /* cast! */ } else - super_expr = build_int_2 (0, 0); + super_expr = build_int_cst (NULL_TREE, 0, 0); root_expr = add_objc_string (my_root_id, class_names); root_expr = build_c_cast (cast_type, root_expr); /* cast! */ @@ -9019,7 +9019,7 @@ handle_impent (struct imp_entry *impent) { tree decl, init; - init = build_int_2 (0, 0); + init = build_int_cst (NULL_TREE, 0, 0); TREE_TYPE (init) = c_common_type_for_size (BITS_PER_WORD, 1); decl = build_decl (VAR_DECL, get_identifier (string), TREE_TYPE (init)); TREE_PUBLIC (decl) = 1; @@ -9050,13 +9050,13 @@ generate_objc_image_info (void) tree_cons (NULL_TREE, build_array_type (integer_type_node, - build_index_type (build_int_2 (1, 0))), + build_index_type (build_int_cst (NULL_TREE, 1, 0))), sc_spec), 1, NULL_TREE); - initlist = build_tree_list (NULL_TREE, build_int_2 (0, 0)); - initlist = tree_cons (NULL_TREE, build_int_2 (1, 0), initlist); + initlist = build_tree_list (NULL_TREE, build_int_cst (NULL_TREE, 0, 0)); + initlist = tree_cons (NULL_TREE, build_int_cst (NULL_TREE, 1, 0), initlist); initlist = build_constructor (TREE_TYPE (decl), nreverse (initlist)); TREE_USED (decl) = DECL_IGNORED_P (decl) = DECL_ARTIFICIAL (decl) = 1; diff --git a/gcc/stmt.c b/gcc/stmt.c index 9425cffc89e..b939a9e5775 100644 --- a/gcc/stmt.c +++ b/gcc/stmt.c @@ -1556,7 +1556,7 @@ shift_return_value (rtx val) if (shift > 0) val = expand_shift (LSHIFT_EXPR, GET_MODE (target), gen_lowpart (GET_MODE (target), val), - build_int_2 (shift, 0), target, 1); + build_int_cst (NULL_TREE, shift, 0), target, 1); } return val; } @@ -2566,7 +2566,7 @@ expand_case (tree exp) if (TREE_CODE (index_expr) != INTEGER_CST) { index_expr - = build_int_2 (INTVAL (index), + = build_int_cst (NULL_TREE, INTVAL (index), unsignedp || INTVAL (index) >= 0 ? 0 : -1); index_expr = convert (index_type, index_expr); } @@ -2738,7 +2738,8 @@ static int estimate_case_costs (case_node_ptr node) { tree min_ascii = integer_minus_one_node; - tree max_ascii = convert (TREE_TYPE (node->high), build_int_2 (127, 0)); + tree max_ascii = convert (TREE_TYPE (node->high), + build_int_cst (NULL_TREE, 127, 0)); case_node_ptr n; int i; diff --git a/gcc/stor-layout.c b/gcc/stor-layout.c index 661cb8b3173..eca60877c8a 100644 --- a/gcc/stor-layout.c +++ b/gcc/stor-layout.c @@ -1537,7 +1537,7 @@ layout_type (tree type) case VECTOR_TYPE: { int nunits = TYPE_VECTOR_SUBPARTS (type); - tree nunits_tree = build_int_2 (nunits, 0); + tree nunits_tree = build_int_cst (NULL_TREE, nunits, 0); tree innertype = TREE_TYPE (type); if (nunits & (nunits - 1)) @@ -1859,29 +1859,24 @@ initialize_sizetypes (void) { tree t = make_node (INTEGER_TYPE); - /* Set this so we do something reasonable for the build_int_2 calls - below. */ - integer_type_node = t; - TYPE_MODE (t) = SImode; TYPE_ALIGN (t) = GET_MODE_ALIGNMENT (SImode); TYPE_USER_ALIGN (t) = 0; - TYPE_SIZE (t) = build_int_2 (GET_MODE_BITSIZE (SImode), 0); - TYPE_SIZE_UNIT (t) = build_int_2 (GET_MODE_SIZE (SImode), 0); + TYPE_SIZE (t) = build_int_cst (t, GET_MODE_BITSIZE (SImode), 0); + TYPE_SIZE_UNIT (t) = build_int_cst (t, GET_MODE_SIZE (SImode), 0); TYPE_UNSIGNED (t) = 1; TYPE_PRECISION (t) = GET_MODE_BITSIZE (SImode); - TYPE_MIN_VALUE (t) = build_int_2 (0, 0); + TYPE_MIN_VALUE (t) = build_int_cst (t, 0, 0); TYPE_IS_SIZETYPE (t) = 1; /* 1000 avoids problems with possible overflow and is certainly larger than any size value we'd want to be storing. */ - TYPE_MAX_VALUE (t) = build_int_2 (1000, 0); + TYPE_MAX_VALUE (t) = build_int_cst (t, 1000, 0); /* These two must be different nodes because of the caching done in size_int_wide. */ sizetype = t; bitsizetype = copy_node (t); - integer_type_node = 0; } /* Set sizetype to TYPE, and initialize *sizetype accordingly. @@ -1980,36 +1975,36 @@ set_min_and_max_values_for_integral_type (tree type, if (is_unsigned) { - min_value = build_int_2 (0, 0); + min_value = build_int_cst (type, 0, 0); max_value - = build_int_2 (precision - HOST_BITS_PER_WIDE_INT >= 0 - ? -1 : ((HOST_WIDE_INT) 1 << precision) - 1, - precision - HOST_BITS_PER_WIDE_INT > 0 - ? ((unsigned HOST_WIDE_INT) ~0 - >> (HOST_BITS_PER_WIDE_INT - - (precision - HOST_BITS_PER_WIDE_INT))) - : 0); + = build_int_cst (type, precision - HOST_BITS_PER_WIDE_INT >= 0 + ? -1 : ((HOST_WIDE_INT) 1 << precision) - 1, + precision - HOST_BITS_PER_WIDE_INT > 0 + ? ((unsigned HOST_WIDE_INT) ~0 + >> (HOST_BITS_PER_WIDE_INT + - (precision - HOST_BITS_PER_WIDE_INT))) + : 0); } else { min_value - = build_int_2 ((precision - HOST_BITS_PER_WIDE_INT > 0 - ? 0 : (HOST_WIDE_INT) (-1) << (precision - 1)), - (((HOST_WIDE_INT) (-1) - << (precision - HOST_BITS_PER_WIDE_INT - 1 > 0 - ? precision - HOST_BITS_PER_WIDE_INT - 1 - : 0)))); + = build_int_cst (type, + (precision - HOST_BITS_PER_WIDE_INT > 0 + ? 0 : (HOST_WIDE_INT) (-1) << (precision - 1)), + (((HOST_WIDE_INT) (-1) + << (precision - HOST_BITS_PER_WIDE_INT - 1 > 0 + ? precision - HOST_BITS_PER_WIDE_INT - 1 + : 0)))); max_value - = build_int_2 ((precision - HOST_BITS_PER_WIDE_INT > 0 - ? -1 : ((HOST_WIDE_INT) 1 << (precision - 1)) - 1), - (precision - HOST_BITS_PER_WIDE_INT - 1 > 0 - ? (((HOST_WIDE_INT) 1 - << (precision - HOST_BITS_PER_WIDE_INT - 1))) - 1 - : 0)); + = build_int_cst (type, + (precision - HOST_BITS_PER_WIDE_INT > 0 + ? -1 : ((HOST_WIDE_INT) 1 << (precision - 1)) - 1), + (precision - HOST_BITS_PER_WIDE_INT - 1 > 0 + ? (((HOST_WIDE_INT) 1 + << (precision - HOST_BITS_PER_WIDE_INT - 1))) - 1 + : 0)); } - TREE_TYPE (min_value) = type; - TREE_TYPE (max_value) = type; TYPE_MIN_VALUE (type) = min_value; TYPE_MAX_VALUE (type) = max_value; } diff --git a/gcc/tree-chrec.c b/gcc/tree-chrec.c index 0e34048be50..957f55daf67 100644 --- a/gcc/tree-chrec.c +++ b/gcc/tree-chrec.c @@ -218,7 +218,7 @@ chrec_fold_multiply_poly_poly (tree type, /* "2*b*d". */ chrec_fold_multiply - (type, build_int_2 (2, 0), + (type, build_int_cst (NULL_TREE, 2, 0), chrec_fold_multiply (type, CHREC_RIGHT (poly0), CHREC_RIGHT (poly1)))); } @@ -645,7 +645,7 @@ reset_evolution_in_loop (unsigned loop_num, && CHREC_VARIABLE (chrec) > loop_num) return build (TREE_CODE (chrec), - build_int_2 (CHREC_VARIABLE (chrec), 0), + build_int_cst (NULL_TREE, CHREC_VARIABLE (chrec), 0), reset_evolution_in_loop (loop_num, CHREC_LEFT (chrec), new_evol), reset_evolution_in_loop (loop_num, CHREC_RIGHT (chrec), new_evol)); diff --git a/gcc/tree-chrec.h b/gcc/tree-chrec.h index 8e355f0ac35..d2027b229be 100644 --- a/gcc/tree-chrec.h +++ b/gcc/tree-chrec.h @@ -105,7 +105,7 @@ build_polynomial_chrec (unsigned loop_num, return chrec_dont_know; return build (POLYNOMIAL_CHREC, TREE_TYPE (left), - build_int_2 (loop_num, 0), left, right); + build_int_cst (NULL_TREE, loop_num, 0), left, right); } diff --git a/gcc/tree-complex.c b/gcc/tree-complex.c index 54ea8197df1..5c14e41ce51 100644 --- a/gcc/tree-complex.c +++ b/gcc/tree-complex.c @@ -506,8 +506,7 @@ build_replicated_const (tree type, tree inner_type, HOST_WIDE_INT value) else abort (); - ret = build_int_2 (low, high); - TREE_TYPE (ret) = type; + ret = build_int_cst (type, low, high); return ret; } diff --git a/gcc/tree-eh.c b/gcc/tree-eh.c index 42834e46c17..a231f29b0a2 100644 --- a/gcc/tree-eh.c +++ b/gcc/tree-eh.c @@ -832,7 +832,8 @@ honor_protect_cleanup_actions (struct leh_state *outer_state, tsi_link_after (&i, x, TSI_CONTINUE_LINKING); x = build1 (RESX_EXPR, void_type_node, - build_int_2 (get_eh_region_number (tf->region), 0)); + build_int_cst (NULL_TREE, + get_eh_region_number (tf->region), 0)); tsi_link_after (&i, x, TSI_CONTINUE_LINKING); } @@ -938,7 +939,8 @@ lower_try_finally_onedest (struct leh_state *state, struct leh_tf_state *tf) append_to_statement_list (finally, tf->top_p); x = build1 (RESX_EXPR, void_type_node, - build_int_2 (get_eh_region_number (tf->region), 0)); + build_int_cst (NULL_TREE, + get_eh_region_number (tf->region), 0)); append_to_statement_list (x, tf->top_p); return; @@ -1026,7 +1028,8 @@ lower_try_finally_copy (struct leh_state *state, struct leh_tf_state *tf) append_to_statement_list (x, &new_stmt); x = build1 (RESX_EXPR, void_type_node, - build_int_2 (get_eh_region_number (tf->region), 0)); + build_int_cst (NULL_TREE, + get_eh_region_number (tf->region), 0)); append_to_statement_list (x, &new_stmt); } @@ -1134,7 +1137,7 @@ lower_try_finally_switch (struct leh_state *state, struct leh_tf_state *tf) if (tf->may_fallthru) { x = build (MODIFY_EXPR, void_type_node, finally_tmp, - build_int_2 (fallthru_index, 0)); + build_int_cst (NULL_TREE, fallthru_index, 0)); append_to_statement_list (x, tf->top_p); if (tf->may_throw) @@ -1145,7 +1148,7 @@ lower_try_finally_switch (struct leh_state *state, struct leh_tf_state *tf) last_case = build (CASE_LABEL_EXPR, void_type_node, - build_int_2 (fallthru_index, 0), NULL, + build_int_cst (NULL_TREE, fallthru_index, 0), NULL, create_artificial_label ()); TREE_VEC_ELT (case_label_vec, last_case_index) = last_case; last_case_index++; @@ -1164,11 +1167,11 @@ lower_try_finally_switch (struct leh_state *state, struct leh_tf_state *tf) append_to_statement_list (x, tf->top_p); x = build (MODIFY_EXPR, void_type_node, finally_tmp, - build_int_2 (eh_index, 0)); + build_int_cst (NULL_TREE, eh_index, 0)); append_to_statement_list (x, tf->top_p); last_case = build (CASE_LABEL_EXPR, void_type_node, - build_int_2 (eh_index, 0), NULL, + build_int_cst (NULL_TREE, eh_index, 0), NULL, create_artificial_label ()); TREE_VEC_ELT (case_label_vec, last_case_index) = last_case; last_case_index++; @@ -1176,7 +1179,8 @@ lower_try_finally_switch (struct leh_state *state, struct leh_tf_state *tf) x = build (LABEL_EXPR, void_type_node, CASE_LABEL (last_case)); append_to_statement_list (x, &switch_body); x = build1 (RESX_EXPR, void_type_node, - build_int_2 (get_eh_region_number (tf->region), 0)); + build_int_cst (NULL_TREE, + get_eh_region_number (tf->region), 0)); append_to_statement_list (x, &switch_body); } @@ -1198,14 +1202,14 @@ lower_try_finally_switch (struct leh_state *state, struct leh_tf_state *tf) if (q->index < 0) { mod = build (MODIFY_EXPR, void_type_node, finally_tmp, - build_int_2 (return_index, 0)); + build_int_cst (NULL_TREE, return_index, 0)); do_return_redirection (q, finally_label, mod, &return_val); switch_id = return_index; } else { mod = build (MODIFY_EXPR, void_type_node, finally_tmp, - build_int_2 (q->index, 0)); + build_int_cst (NULL_TREE, q->index, 0)); do_goto_redirection (q, finally_label, mod); switch_id = q->index; } @@ -1214,7 +1218,7 @@ lower_try_finally_switch (struct leh_state *state, struct leh_tf_state *tf) if (!TREE_VEC_ELT (case_label_vec, case_index)) { last_case = build (CASE_LABEL_EXPR, void_type_node, - build_int_2 (switch_id, 0), NULL, + build_int_cst (NULL_TREE, switch_id, 0), NULL, create_artificial_label ()); TREE_VEC_ELT (case_label_vec, case_index) = last_case; diff --git a/gcc/tree-mudflap.c b/gcc/tree-mudflap.c index 4f8e1742f2d..a10b5d78b23 100644 --- a/gcc/tree-mudflap.c +++ b/gcc/tree-mudflap.c @@ -76,9 +76,8 @@ mf_build_string (const char *string) size_t len = strlen (string); tree result = mf_mark (build_string (len + 1, string)); - TREE_TYPE (result) - = build_array_type (char_type_node, - build_index_type (build_int_2 (len, 0))); + TREE_TYPE (result) = build_array_type + (char_type_node, build_index_type (build_int_cst (NULL_TREE, len, 0))); TREE_CONSTANT (result) = 1; TREE_INVARIANT (result) = 1; TREE_READONLY (result) = 1; @@ -917,8 +916,9 @@ mx_register_decls (tree decl, tree *stmt_list) decl))), tree_cons (NULL_TREE, size, - tree_cons (NULL_TREE, - build_int_2 (3, 0), /* __MF_TYPE_STACK */ + tree_cons (NULL_TREE, + /* __MF_TYPE_STACK */ + build_int_cst (NULL_TREE, 3, 0), NULL_TREE))); /* __mf_unregister (...) */ unregister_fncall = build_function_call_expr (mf_unregister_fndecl, @@ -935,7 +935,8 @@ mx_register_decls (tree decl, tree *stmt_list) tree_cons (NULL_TREE, size, tree_cons (NULL_TREE, - build_int_2 (3, 0), /* __MF_TYPE_STACK */ + /* __MF_TYPE_STACK */ + build_int_cst (NULL_TREE, 3, 0), tree_cons (NULL_TREE, variable_name, NULL_TREE)))); @@ -1078,7 +1079,7 @@ mudflap_register_call (tree obj, tree object_size, tree varname) args = tree_cons (NULL_TREE, varname, NULL_TREE); - arg = build_int_2 (4, 0); /* __MF_TYPE_STATIC */ + arg = build_int_cst (NULL_TREE, 4, 0); /* __MF_TYPE_STATIC */ args = tree_cons (NULL_TREE, arg, args); arg = convert (size_type_node, object_size); @@ -1160,7 +1161,7 @@ mudflap_enqueue_constant (tree obj) return; if (TREE_CODE (obj) == STRING_CST) - object_size = build_int_2 (TREE_STRING_LENGTH (obj), 0); + object_size = build_int_cst (NULL_TREE, TREE_STRING_LENGTH (obj), 0); else object_size = size_in_bytes (TREE_TYPE (obj)); diff --git a/gcc/tree-nested.c b/gcc/tree-nested.c index 7ae506e8558..00dbee988cd 100644 --- a/gcc/tree-nested.c +++ b/gcc/tree-nested.c @@ -405,7 +405,7 @@ get_trampoline_type (void) align = STACK_BOUNDARY; } - t = build_index_type (build_int_2 (size - 1, 0)); + t = build_index_type (build_int_cst (NULL_TREE, size - 1, 0)); t = build_array_type (char_type_node, t); t = build_decl (FIELD_DECL, get_identifier ("__data"), t); DECL_ALIGN (t) = align; @@ -488,7 +488,8 @@ get_nl_goto_field (struct nesting_info *info) size = size / GET_MODE_SIZE (Pmode); size = size + 1; - type = build_array_type (type, build_index_type (build_int_2 (size, 0))); + type = build_array_type + (type, build_index_type (build_int_cst (NULL_TREE, size, 0))); field = make_node (FIELD_DECL); DECL_NAME (field) = get_identifier ("__nl_goto_buf"); diff --git a/gcc/tree-pretty-print.c b/gcc/tree-pretty-print.c index a211a8235ca..064c2b00d12 100644 --- a/gcc/tree-pretty-print.c +++ b/gcc/tree-pretty-print.c @@ -473,9 +473,10 @@ dump_generic_node (pretty_printer *buffer, tree node, int spc, int flags, if (tree_int_cst_sgn (val) < 0) { pp_character (buffer, '-'); - val = build_int_2 (-TREE_INT_CST_LOW (val), - ~TREE_INT_CST_HIGH (val) - + !TREE_INT_CST_LOW (val)); + val = build_int_cst (NULL_TREE, + -TREE_INT_CST_LOW (val), + ~TREE_INT_CST_HIGH (val) + + !TREE_INT_CST_LOW (val)); } /* Would "%x%0*x" or "%x%*0x" get zero-padding on all systems? */ diff --git a/gcc/tree-ssa-ccp.c b/gcc/tree-ssa-ccp.c index e2d3bbf180a..9149aa64c2f 100644 --- a/gcc/tree-ssa-ccp.c +++ b/gcc/tree-ssa-ccp.c @@ -1149,7 +1149,8 @@ widen_bitfield (tree val, tree field, tree var) mask |= ((HOST_WIDE_INT) 1) << i; wide_val = build (BIT_AND_EXPR, TREE_TYPE (var), val, - fold_convert (TREE_TYPE (var), build_int_2 (mask, 0))); + fold_convert (TREE_TYPE (var), + build_int_cst (NULL_TREE, mask, 0))); } else { @@ -1160,7 +1161,8 @@ widen_bitfield (tree val, tree field, tree var) mask |= ((HOST_WIDE_INT) 1) << (var_size - i - 1); wide_val = build (BIT_IOR_EXPR, TREE_TYPE (var), val, - fold_convert (TREE_TYPE (var), build_int_2 (mask, 0))); + fold_convert (TREE_TYPE (var), + build_int_cst (NULL_TREE, mask, 0))); } return fold (wide_val); @@ -1691,7 +1693,7 @@ maybe_fold_offset_to_array_ref (tree base, tree offset, tree orig_type) || lrem || hrem) return NULL_TREE; - idx = build_int_2 (lquo, hquo); + idx = build_int_cst (NULL_TREE, lquo, hquo); } /* Assume the low bound is zero. If there is a domain type, get the diff --git a/gcc/tree-ssa-dom.c b/gcc/tree-ssa-dom.c index d0eb6753da7..5fd53630432 100644 --- a/gcc/tree-ssa-dom.c +++ b/gcc/tree-ssa-dom.c @@ -1795,7 +1795,7 @@ simplify_rhs_and_lookup_avail_expr (struct dom_walk_data *walk_data, if (rhs_code == TRUNC_DIV_EXPR) t = build (RSHIFT_EXPR, TREE_TYPE (op0), op0, - build_int_2 (tree_log2 (op1), 0)); + build_int_cst (NULL_TREE, tree_log2 (op1), 0)); else t = build (BIT_AND_EXPR, TREE_TYPE (op0), op0, local_fold (build (MINUS_EXPR, TREE_TYPE (op1), diff --git a/gcc/tree-ssa-loop-niter.c b/gcc/tree-ssa-loop-niter.c index 67663e42f9f..03244b08f1e 100644 --- a/gcc/tree-ssa-loop-niter.c +++ b/gcc/tree-ssa-loop-niter.c @@ -351,7 +351,7 @@ number_of_iterations_cond (tree type, tree base0, tree step0, (inverse(s/d) * (c/d)) mod (size of mode/d). */ s = step0; d = integer_one_node; - bound = convert (niter_type, build_int_2 (~0, ~0)); + bound = convert (niter_type, build_int_cst (NULL_TREE, ~0, ~0)); while (1) { tmp = EXEC_BINARY (BIT_AND_EXPR, niter_type, s, @@ -877,7 +877,7 @@ loop_niter_by_eval (struct loop *loop, edge exit) fprintf (dump_file, "Proved that loop %d iterates %d times using brute force.\n", loop->num, i); - return build_int_2 (i, 0); + return build_int_cst (NULL_TREE, i, 0); } for (j = 0; j < 2; j++) @@ -1091,7 +1091,7 @@ upper_bound_in_type (tree outer, tree inner) return convert (outer, convert (inner, - build_int_2 (lo, hi))); + build_int_cst (NULL_TREE, lo, hi))); } /* Returns the smallest value obtainable by casting something in INNER type to @@ -1118,7 +1118,7 @@ lower_bound_in_type (tree outer, tree inner) return convert (outer, convert (inner, - build_int_2 (lo, hi))); + build_int_cst (NULL_TREE, lo, hi))); } /* Returns true if statement S1 dominates statement S2. */ diff --git a/gcc/tree.c b/gcc/tree.c index a6b17da494b..1582d7b595f 100644 --- a/gcc/tree.c +++ b/gcc/tree.c @@ -420,18 +420,22 @@ copy_list (tree list) } -/* Return a newly constructed INTEGER_CST node whose constant value - is specified by the two ints LOW and HI. - The TREE_TYPE is set to `int'. */ +/* Create an INT_CST node of TYPE and value HI:LOW. If TYPE is NULL, + integer_type_node is used. */ tree -build_int_2 (unsigned HOST_WIDE_INT low, HOST_WIDE_INT hi) +build_int_cst (tree type, unsigned HOST_WIDE_INT low, HOST_WIDE_INT hi) { - tree t = make_node (INTEGER_CST); + tree t; + + if (!type) + type = integer_type_node; + + t = make_node (INTEGER_CST); TREE_INT_CST_LOW (t) = low; TREE_INT_CST_HIGH (t) = hi; - TREE_TYPE (t) = integer_type_node; + TREE_TYPE (t) = type; return t; } @@ -5256,7 +5260,7 @@ make_vector_type (tree innertype, int nunits, enum machine_mode mode) layout_type (t); { - tree index = build_int_2 (nunits - 1, 0); + tree index = build_int_cst (NULL_TREE, nunits - 1, 0); tree array = build_array_type (innertype, build_index_type (index)); tree rt = make_node (RECORD_TYPE); @@ -5333,8 +5337,7 @@ build_common_tree_nodes (int signed_char) boolean_type_node before calling build_common_tree_nodes_2. */ boolean_type_node = make_unsigned_type (BOOL_TYPE_SIZE); TREE_SET_CODE (boolean_type_node, BOOLEAN_TYPE); - TYPE_MAX_VALUE (boolean_type_node) = build_int_2 (1, 0); - TREE_TYPE (TYPE_MAX_VALUE (boolean_type_node)) = boolean_type_node; + TYPE_MAX_VALUE (boolean_type_node) = build_int_cst (boolean_type_node, 1, 0); TYPE_PRECISION (boolean_type_node) = 1; /* Fill in the rest of the sized types. Reuse existing type nodes @@ -5363,9 +5366,9 @@ void build_common_tree_nodes_2 (int short_double) { /* Define these next since types below may used them. */ - integer_zero_node = build_int_2 (0, 0); - integer_one_node = build_int_2 (1, 0); - integer_minus_one_node = build_int_2 (-1, -1); + integer_zero_node = build_int_cst (NULL_TREE, 0, 0); + integer_one_node = build_int_cst (NULL_TREE, 1, 0); + integer_minus_one_node = build_int_cst (NULL_TREE, -1, -1); size_zero_node = size_int (0); size_one_node = size_int (1); @@ -5384,8 +5387,8 @@ build_common_tree_nodes_2 (int short_double) TYPE_ALIGN (void_type_node) = BITS_PER_UNIT; TYPE_USER_ALIGN (void_type_node) = 0; - null_pointer_node = build_int_2 (0, 0); - TREE_TYPE (null_pointer_node) = build_pointer_type (void_type_node); + null_pointer_node = build_int_cst (build_pointer_type (void_type_node), + 0, 0); layout_type (TREE_TYPE (null_pointer_node)); ptr_type_node = build_pointer_type (void_type_node); diff --git a/gcc/tree.h b/gcc/tree.h index e596f90d212..1df73ca87cd 100644 --- a/gcc/tree.h +++ b/gcc/tree.h @@ -2716,7 +2716,7 @@ extern tree build4_stat (enum tree_code, tree, tree, tree, tree, tree MEM_STAT_DECL); #define build4(c,t1,t2,t3,t4,t5) build4_stat (c,t1,t2,t3,t4,t5 MEM_STAT_INFO) -extern tree build_int_2 (unsigned HOST_WIDE_INT, HOST_WIDE_INT); +extern tree build_int_cst (tree, unsigned HOST_WIDE_INT, HOST_WIDE_INT); extern tree build_vector (tree, tree); extern tree build_constructor (tree, tree); extern tree build_real_from_int_cst (tree, tree); diff --git a/gcc/treelang/ChangeLog b/gcc/treelang/ChangeLog index 73d367fe2e7..950a33524e8 100644 --- a/gcc/treelang/ChangeLog +++ b/gcc/treelang/ChangeLog @@ -1,3 +1,7 @@ +2004-08-14 Nathan Sidwell + + * treetree.c (tree_code_get_integer_value): Use build_int_cst. + 2004-07-31 James A. Morrison * Make-lang.in (TREE_BE_LIBS): Remove. diff --git a/gcc/treelang/treetree.c b/gcc/treelang/treetree.c index 9e5bca244e6..a2bdc0070a8 100644 --- a/gcc/treelang/treetree.c +++ b/gcc/treelang/treetree.c @@ -680,7 +680,7 @@ tree_code_get_integer_value (unsigned char* chars, unsigned int length) for (ix = start; ix < length; ix++) val = val * 10 + chars[ix] - (unsigned char)'0'; val = val*negative; - return build_int_2 (val & 0xffffffff, (val >> 32) & 0xffffffff); + return build_int_cst (NULL_TREE, val & 0xffffffff, (val >> 32) & 0xffffffff); } /* Return the tree for an expresssion, type EXP_TYPE (see treetree.h)