From 45a2c4774f993ad7a9ecac91add79b7e2ebef566 Mon Sep 17 00:00:00 2001 From: Richard Guenther Date: Fri, 29 Apr 2011 15:00:04 +0000 Subject: [PATCH] builtins.c (fold_builtin_classify_type): Use integer_type_node for the type of the result. 2011-04-29 Richard Guenther * builtins.c (fold_builtin_classify_type): Use integer_type_node for the type of the result. (fold_builtin_isascii): Likewise. (fold_builtin_toascii): Use integer_type_node where appropriate. (fold_builtin_logb): Likewise. (fold_builtin_frexp): Likewise. (fold_builtin_strstr): Likewise. (fold_builtin_strpbrk): Likewise. (fold_builtin_fputs): Likewise. (fold_builtin_sprintf): Likewise. (fold_builtin_snprintf): Likewise. (fold_builtin_printf): Likewise. (do_mpfr_remquo): Use a proper type for the assigned constant. (do_mpfr_lgamma_r): Likewise. * dwarf2out.c (resolve_one_addr): Use size_int. * except.c (init_eh): Likewise. (assign_filter_values): Use integer_type_node for filter values. (sjlj_emit_dispatch_table): Use integer_type_node for dispatch indices. * tree-cfg.c (move_stmt_eh_region_tree_nr): Use integer_type_node for EH region numbers. * tree-vrp.c (simplify_div_or_mod_using_ranges): Use integer_type_node for the shift amount. From-SVN: r173167 --- gcc/ChangeLog | 26 ++++++++++++++++++++++++++ gcc/builtins.c | 38 +++++++++++++++++++++----------------- gcc/dwarf2out.c | 2 +- gcc/except.c | 14 +++++++------- gcc/tree-cfg.c | 2 +- gcc/tree-vrp.c | 2 +- 6 files changed, 57 insertions(+), 27 deletions(-) diff --git a/gcc/ChangeLog b/gcc/ChangeLog index ce855a4b159..b1ee31f63a0 100644 --- a/gcc/ChangeLog +++ b/gcc/ChangeLog @@ -1,3 +1,29 @@ +2011-04-29 Richard Guenther + + * builtins.c (fold_builtin_classify_type): Use integer_type_node + for the type of the result. + (fold_builtin_isascii): Likewise. + (fold_builtin_toascii): Use integer_type_node where appropriate. + (fold_builtin_logb): Likewise. + (fold_builtin_frexp): Likewise. + (fold_builtin_strstr): Likewise. + (fold_builtin_strpbrk): Likewise. + (fold_builtin_fputs): Likewise. + (fold_builtin_sprintf): Likewise. + (fold_builtin_snprintf): Likewise. + (fold_builtin_printf): Likewise. + (do_mpfr_remquo): Use a proper type for the assigned constant. + (do_mpfr_lgamma_r): Likewise. + * dwarf2out.c (resolve_one_addr): Use size_int. + * except.c (init_eh): Likewise. + (assign_filter_values): Use integer_type_node for filter values. + (sjlj_emit_dispatch_table): Use integer_type_node for dispatch + indices. + * tree-cfg.c (move_stmt_eh_region_tree_nr): Use integer_type_node + for EH region numbers. + * tree-vrp.c (simplify_div_or_mod_using_ranges): Use integer_type_node + for the shift amount. + 2011-04-29 Richard Guenther * expr.h (expand_shift): Rename to ... diff --git a/gcc/builtins.c b/gcc/builtins.c index 668226daf7c..bd61f29a616 100644 --- a/gcc/builtins.c +++ b/gcc/builtins.c @@ -6773,9 +6773,9 @@ static tree fold_builtin_classify_type (tree arg) { if (arg == 0) - return build_int_cst (NULL_TREE, no_type_class); + return build_int_cst (integer_type_node, no_type_class); - return build_int_cst (NULL_TREE, type_to_class (TREE_TYPE (arg))); + return build_int_cst (integer_type_node, type_to_class (TREE_TYPE (arg))); } /* Fold a call to __builtin_strlen with argument ARG. */ @@ -9133,10 +9133,10 @@ fold_builtin_isascii (location_t loc, tree arg) { /* Transform isascii(c) -> ((c & ~0x7f) == 0). */ arg = fold_build2 (BIT_AND_EXPR, integer_type_node, arg, - build_int_cst (NULL_TREE, + build_int_cst (integer_type_node, ~ (unsigned HOST_WIDE_INT) 0x7f)); return fold_build2_loc (loc, EQ_EXPR, integer_type_node, - arg, integer_zero_node); + arg, integer_zero_node); } } @@ -9150,7 +9150,7 @@ fold_builtin_toascii (location_t loc, tree arg) /* Transform toascii(c) -> (c & 0x7f). */ return fold_build2_loc (loc, BIT_AND_EXPR, integer_type_node, arg, - build_int_cst (NULL_TREE, 0x7f)); + build_int_cst (integer_type_node, 0x7f)); } /* Fold a call to builtin isdigit with argument ARG. */ @@ -9341,7 +9341,7 @@ fold_builtin_logb (location_t loc, tree arg, tree rettype) exponent and subtract 1. */ if (REAL_MODE_FORMAT (TYPE_MODE (TREE_TYPE (arg)))->b == 2) return fold_convert_loc (loc, rettype, - build_int_cst (NULL_TREE, + build_int_cst (integer_type_node, REAL_EXP (value)-1)); break; } @@ -9429,7 +9429,7 @@ fold_builtin_frexp (location_t loc, tree arg0, tree arg1, tree rettype) REAL_VALUE_TYPE frac_rvt = *value; SET_REAL_EXP (&frac_rvt, 0); frac = build_real (rettype, frac_rvt); - exp = build_int_cst (NULL_TREE, REAL_EXP (value)); + exp = build_int_cst (integer_type_node, REAL_EXP (value)); } break; default: @@ -11214,7 +11214,8 @@ fold_builtin_strstr (location_t loc, tree s1, tree s2, tree type) /* New argument list transforming strstr(s1, s2) to strchr(s1, s2[0]). */ - return build_call_expr_loc (loc, fn, 2, s1, build_int_cst (NULL_TREE, p2[0])); + return build_call_expr_loc (loc, fn, 2, s1, + build_int_cst (integer_type_node, p2[0])); } } @@ -11400,7 +11401,8 @@ fold_builtin_strpbrk (location_t loc, tree s1, tree s2, tree type) /* New argument list transforming strpbrk(s1, s2) to strchr(s1, s2[0]). */ - return build_call_expr_loc (loc, fn, 2, s1, build_int_cst (NULL_TREE, p2[0])); + return build_call_expr_loc (loc, fn, 2, s1, + build_int_cst (integer_type_node, p2[0])); } } @@ -11683,7 +11685,8 @@ fold_builtin_fputs (location_t loc, tree arg0, tree arg1, { if (fn_fputc) return build_call_expr_loc (loc, fn_fputc, 2, - build_int_cst (NULL_TREE, p[0]), arg1); + build_int_cst + (integer_type_node, p[0]), arg1); else return NULL_TREE; } @@ -11855,7 +11858,7 @@ fold_builtin_sprintf (location_t loc, tree dest, tree fmt, 'format' is known to contain no % formats. */ call = build_call_expr_loc (loc, fn, 2, dest, fmt); if (!ignored) - retval = build_int_cst (NULL_TREE, strlen (fmt_str)); + retval = build_int_cst (integer_type_node, strlen (fmt_str)); } /* If the format is "%s", use strcpy if the result isn't used. */ @@ -11963,7 +11966,7 @@ fold_builtin_snprintf (location_t loc, tree dest, tree destsize, tree fmt, call = build_call_expr_loc (loc, fn, 2, dest, fmt); if (!ignored) - retval = build_int_cst (NULL_TREE, strlen (fmt_str)); + retval = build_int_cst (integer_type_node, strlen (fmt_str)); } /* If the format is "%s", use strcpy if the result isn't used. */ @@ -12947,7 +12950,7 @@ fold_builtin_printf (location_t loc, tree fndecl, tree fmt, /* Given printf("c"), (where c is any one character,) convert "c"[0] to an int and pass that to the replacement function. */ - newarg = build_int_cst (NULL_TREE, str[0]); + newarg = build_int_cst (integer_type_node, str[0]); if (fn_putchar) call = build_call_expr_loc (loc, fn_putchar, 1, newarg); } @@ -13549,9 +13552,10 @@ do_mpfr_remquo (tree arg0, tree arg1, tree arg_quo) if (TYPE_MAIN_VARIANT (TREE_TYPE (arg_quo)) == integer_type_node) { /* Set the value. */ - tree result_quo = fold_build2 (MODIFY_EXPR, - TREE_TYPE (arg_quo), arg_quo, - build_int_cst (NULL, integer_quo)); + tree result_quo + = fold_build2 (MODIFY_EXPR, TREE_TYPE (arg_quo), arg_quo, + build_int_cst (TREE_TYPE (arg_quo), + integer_quo)); TREE_SIDE_EFFECTS (result_quo) = 1; /* Combine the quo assignment with the rem. */ result = non_lvalue (fold_build2 (COMPOUND_EXPR, type, @@ -13616,7 +13620,7 @@ do_mpfr_lgamma_r (tree arg, tree arg_sg, tree type) /* Assign the signgam value into *arg_sg. */ result_sg = fold_build2 (MODIFY_EXPR, TREE_TYPE (arg_sg), arg_sg, - build_int_cst (NULL, sg)); + build_int_cst (TREE_TYPE (arg_sg), sg)); TREE_SIDE_EFFECTS (result_sg) = 1; /* Combine the signgam assignment with the lgamma result. */ result = non_lvalue (fold_build2 (COMPOUND_EXPR, type, diff --git a/gcc/dwarf2out.c b/gcc/dwarf2out.c index f3c4c0962a5..fb1dd9c7782 100644 --- a/gcc/dwarf2out.c +++ b/gcc/dwarf2out.c @@ -22966,7 +22966,7 @@ resolve_one_addr (rtx *addr, void *data ATTRIBUTE_UNUSED) { size_t len = strlen (XSTR (rtl, 0)) + 1; tree t = build_string (len, XSTR (rtl, 0)); - tree tlen = build_int_cst (NULL_TREE, len - 1); + tree tlen = size_int (len - 1); TREE_TYPE (t) = build_array_type (char_type_node, build_index_type (tlen)); rtl = lookup_constant_def (t); diff --git a/gcc/except.c b/gcc/except.c index 5c6359e4c85..b722fb74921 100644 --- a/gcc/except.c +++ b/gcc/except.c @@ -225,7 +225,7 @@ init_eh (void) integer_type_node); DECL_FIELD_CONTEXT (f_cs) = sjlj_fc_type_node; - tmp = build_index_type (build_int_cst (NULL_TREE, 4 - 1)); + tmp = build_index_type (size_int (4 - 1)); tmp = build_array_type (lang_hooks.types.type_for_mode (targetm.unwind_word_mode (), 1), tmp); @@ -245,17 +245,17 @@ init_eh (void) #ifdef DONT_USE_BUILTIN_SETJMP #ifdef JMP_BUF_SIZE - tmp = build_int_cst (NULL_TREE, JMP_BUF_SIZE - 1); + tmp = size_int (JMP_BUF_SIZE - 1); #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_cst (NULL_TREE, FIRST_PSEUDO_REGISTER + 2 - 1); + tmp = size_int (FIRST_PSEUDO_REGISTER + 2 - 1); #endif #else /* builtin_setjmp takes a pointer to 5 words. */ - tmp = build_int_cst (NULL_TREE, 5 * BITS_PER_WORD / POINTER_SIZE - 1); + tmp = size_int (5 * BITS_PER_WORD / POINTER_SIZE - 1); #endif tmp = build_index_type (tmp); tmp = build_array_type (ptr_type_node, tmp); @@ -857,7 +857,7 @@ assign_filter_values (void) for ( ; tp_node; tp_node = TREE_CHAIN (tp_node)) { int flt = add_ttypes_entry (ttypes, TREE_VALUE (tp_node)); - tree flt_node = build_int_cst (NULL_TREE, flt); + tree flt_node = build_int_cst (integer_type_node, flt); c->filter_list = tree_cons (NULL_TREE, flt_node, c->filter_list); @@ -868,7 +868,7 @@ assign_filter_values (void) /* Get a filter value for the NULL list also since it will need an action record anyway. */ int flt = add_ttypes_entry (ttypes, NULL); - tree flt_node = build_int_cst (NULL_TREE, flt); + tree flt_node = build_int_cst (integer_type_node, flt); c->filter_list = tree_cons (NULL_TREE, flt_node, NULL); @@ -1289,7 +1289,7 @@ sjlj_emit_dispatch_table (rtx dispatch_label, int num_dispatch) t_label = create_artificial_label (UNKNOWN_LOCATION); case_elt = build3 (CASE_LABEL_EXPR, void_type_node, - build_int_cst (NULL, disp_index), + build_int_cst (integer_type_node, disp_index), NULL, t_label); gimple_switch_set_label (switch_stmt, disp_index, case_elt); diff --git a/gcc/tree-cfg.c b/gcc/tree-cfg.c index 40f768886ee..c3deabd6aa7 100644 --- a/gcc/tree-cfg.c +++ b/gcc/tree-cfg.c @@ -5756,7 +5756,7 @@ move_stmt_eh_region_tree_nr (tree old_t_nr, struct move_stmt_d *p) old_nr = tree_low_cst (old_t_nr, 0); new_nr = move_stmt_eh_region_nr (old_nr, p); - return build_int_cst (NULL, new_nr); + return build_int_cst (integer_type_node, new_nr); } /* Like move_stmt_op, but for gimple statements. diff --git a/gcc/tree-vrp.c b/gcc/tree-vrp.c index 2d0af8725da..4c665711325 100644 --- a/gcc/tree-vrp.c +++ b/gcc/tree-vrp.c @@ -6909,7 +6909,7 @@ simplify_div_or_mod_using_ranges (gimple stmt) if (rhs_code == TRUNC_DIV_EXPR) { - t = build_int_cst (NULL_TREE, tree_log2 (op1)); + t = build_int_cst (integer_type_node, tree_log2 (op1)); gimple_assign_set_rhs_code (stmt, RSHIFT_EXPR); gimple_assign_set_rhs1 (stmt, op0); gimple_assign_set_rhs2 (stmt, t); -- 2.30.2