.: * 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): <TYPES_COMPATIBLE_P> 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.
ada:
* 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.
cp:
* 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.
fortran:
* 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.
java:
* 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.
From-SVN: r86022
+2004-08-15 Nathan Sidwell <nathan@codesourcery.com>
+
+ * 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): <TYPES_COMPATIBLE_P> 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 <bje@au.ibm.com>
* vec.h: Comment improvements.
+2004-08-15 Nathan Sidwell <nathan@codesourcery.com>
+
+ * 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 <hainque@act-europe.fr>
* decl.c (gnat_to_gnu_entity) <E_Variable>: When building an allocator
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;
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);
= 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);
}
}
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:
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);
/* 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);
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));
}
\f
/* Return a CONSTRUCTOR of TYPE whose list is LIST. */
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. */
/* 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);
/* 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);
{
/* 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;
}
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;
/* 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;
}
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. */
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. */
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);
}
{
HOST_WIDE_INT hi, width, result;
unsigned HOST_WIDE_INT lo;
- tree type, t;
+ tree type;
type = TREE_TYPE (arg);
width = TYPE_PRECISION (type);
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;
/* 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;
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)));
}
}
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;
/* 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);
}
/* 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);
}
{
/* 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;
}
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. */
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;
}
}
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;
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;
{
/* 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));
}
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 ();
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) \
{
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))
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;
}
{
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);
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;
}
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'.
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;
}
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 ')'
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,
/* 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,
{
/* 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;
}
{
/* 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;
}
/* 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,
<< (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);
}
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);
}
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);
}
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);
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);
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);
{
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));
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;
}
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);
(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);
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);
/* 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);
}
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);
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);
}
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);
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);
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);
? 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);
}
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);
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);
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
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
{
/* [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);
}
/* [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);
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;
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);
}
/* [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);
}
/* 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);
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);
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);
/* 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);
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);
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;
}
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);
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;
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;
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);
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);
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);
}
/* 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);
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);
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);
}
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),
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),
{
if (integer_zerop (expr))
{
- expr = build_int_2 (0, 0);
- TREE_TYPE (expr) = type;
+ expr = build_int_cst (type, 0, 0);
return expr;
}
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]
/* "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))));
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 */
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);
}
/* 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);
{
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);
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));
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,
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);
{
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));
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 */
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))
+2004-08-15 Nathan Sidwell <nathan@codesourcery.com>
+
+ * 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 <mark@codesourcery.com>
PR c++/16273
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);
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. */
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)
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,
/* 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
{
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;
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;
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;
}
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;
{
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)
{
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;
}
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,
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));
}
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);
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;
}
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)
{
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);
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);
}
{
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;
}
}
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);
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);
/* 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);
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);
}
if (!boff)
return offset;
- offset = build_int_2 (boff, -1);
- TREE_TYPE (offset) = ssizetype;
+ offset = build_int_cst (ssizetype, boff, -1);
return offset;
}
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];
}
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);
#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);
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);
/* 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);
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,
/* 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);
}
{
/* 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);
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);
}
\f
{
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)
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);
}
\f
/* Add INC into TARGET. */
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);
{
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;
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;
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);
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;
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;
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));
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
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),
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);
}
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)
{
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);
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)
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
{
|| 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]);
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);
}
}
}
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,
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,
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
{
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]
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);
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,
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),
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),
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);
}
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);
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,
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;
/* 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);
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. */
{
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;
}
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);
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;
}
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);
}
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);
}
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);
}
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;
&& 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)
{
/* 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
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));
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,
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);
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);
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
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)'.
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)))
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));
}
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;
}
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);
}
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);
}
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);
}
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);
}
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));
}
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));
|| 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));
== 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;
}
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),
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;
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));
}
+2004-08-15 Nathan Sidwell <nathan@codesourcery.com>
+
+ * 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 <paul@codesourcery.com>
* trans-decl.c (gfc_build_function_decl): Remove dead code.
* symbol.c (gfc_add_common): Disable checks to work around other more
fundamental inadequacies.
-2004-05-22 Tobias Schlüter <tobias.schlueter@physik.uni-muenchen.de>
+2004-05-22 Tobias Schlüter <tobias.schlueter@physik.uni-muenchen.de>
* trans-decl.c (gfc_get_extern_function_decl): Set DECL_IS_PURE
only for functions.
* decl.c (variable_decl): Always apply default initializer.
-2004-05-08 Tobias Schlüter <tobias.schlueter@physik.uni-muenchen.de>
+2004-05-08 Tobias Schlüter <tobias.schlueter@physik.uni-muenchen.de>
PR fortran/15206
* trans-intrinsic.c (gfc_conv_intrinsic_rrspacing): Fixed to
Remove "set DEVELOPMENT".
(Compiling GFORTRAN): Remove.
-2004-05-09 Tobias Schlüter <tobias.schlueter@physik.uni-muenchen.de>
+2004-05-09 Tobias Schlüter <tobias.schlueter@physik.uni-muenchen.de>
* array.c (match_subscript, match_array_ref): Add comments
explaining argument 'init'.
* primary.c (match_digits, match_integer_constant): Add comment
explaining signflag.
-2004-05-01 Tobias Schlüter <tobias.schlueter@physik.uni-muenchen.de>
+2004-05-01 Tobias Schlüter <tobias.schlueter@physik.uni-muenchen.de>
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 <tobias.schlueter@physik.uni-muenchen.de>
+2004-05-01 Tobias Schlüter <tobias.schlueter@physik.uni-muenchen.de>
PR fortran/13940
* match.c (match_data_constant): Handle case where
gfc_find_symbol sets sym to NULL
-2004-04-28 Tobias Schlüter <tobias.schlueter@physik.uni-muenchen.de>
+2004-04-28 Tobias Schlüter <tobias.schlueter@physik.uni-muenchen.de>
* Make-lang.in (f95-lang.o, trans-intrinsic.o): Add missing
dependency on mathbuiltins.def
* gfortranspec.c: Do not include multilib.h.
-2004-04-24 Tobias Schlüter <tobias.schlueter@physik.uni-muenchen.de>
+2004-04-24 Tobias Schlüter <tobias.schlueter@physik.uni-muenchen.de>
* trans-intrinsic.c: Fix comment, this is not trans-expr.c. Add
2004 to copyright years.
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);
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);
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,
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");
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);
}
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));
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:
{
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)
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);
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:
/* 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));
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);
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));
}
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)
{
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;
{
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);
}
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;
}
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;
}
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;
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);
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 */
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));
}
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);
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);
}
+2004-08-15 Nathan Sidwell <nathan@codesourcery.com>
+
+ * 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 <mckinlay@redhat.com>
* java-gimplify.c (java_gimplify_new_array_init): Use create_tmp_var.
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;
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
{
| 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;
}
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);
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,
}
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),
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
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
(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);
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);
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);
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. */
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);
}
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);
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);
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);
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;
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);
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];
}
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);
}
}
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);
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);
/* 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);
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));
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
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,
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);
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));
}
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;
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);
}
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;
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,
{
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 ());
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);
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);
}
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),
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);
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),
/* 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
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);
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);
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:
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;
}
#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
}
/* 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);
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;
}
/* 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)
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);
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;
}
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;
}
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);
}
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);
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);
}
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);
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));
(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);
}
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);
}
/* 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,
/* 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, ...}, ... } */
/* 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), ... } */
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));
}
/* 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);
= 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),
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));
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
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);
}
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);
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;
/* 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");
/* 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");
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);
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)),
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. */
/* 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);
}
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);
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);
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);
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,
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,
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,
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);
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 ();
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);
/* 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
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);
/* 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);
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
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));
}
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! */
{
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;
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;
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;
}
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);
}
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;
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))
{
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.
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;
}
/* "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))));
}
&& 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));
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);
}
\f
else
abort ();
- ret = build_int_2 (low, high);
- TREE_TYPE (ret) = type;
+ ret = build_int_cst (type, low, high);
return ret;
}
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);
}
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;
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);
}
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)
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++;
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++;
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);
}
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;
}
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;
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;
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,
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))));
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);
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));
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;
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");
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? */
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
{
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);
|| 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
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),
(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,
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++)
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
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. */
}
\f
-/* 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;
}
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);
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
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);
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);
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);
+2004-08-14 Nathan Sidwell <nathan@codesourcery.com>
+
+ * treetree.c (tree_code_get_integer_value): Use build_int_cst.
+
2004-07-31 James A. Morrison <phython@gcc.gnu.org>
* Make-lang.in (TREE_BE_LIBS): Remove.
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)