Commit 45a2c477 by Richard Guenther Committed by Richard Biener

builtins.c (fold_builtin_classify_type): Use integer_type_node for the type of the result.

2011-04-29  Richard Guenther  <rguenther@suse.de>

	* 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
parent a3f02fe4
2011-04-29 Richard Guenther <rguenther@suse.de> 2011-04-29 Richard Guenther <rguenther@suse.de>
* 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 <rguenther@suse.de>
* expr.h (expand_shift): Rename to ... * expr.h (expand_shift): Rename to ...
(expand_variable_shift): ... this. (expand_variable_shift): ... this.
(expand_shift): Take a constant shift amount. (expand_shift): Take a constant shift amount.
......
...@@ -6773,9 +6773,9 @@ static tree ...@@ -6773,9 +6773,9 @@ static tree
fold_builtin_classify_type (tree arg) fold_builtin_classify_type (tree arg)
{ {
if (arg == 0) 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. */ /* Fold a call to __builtin_strlen with argument ARG. */
...@@ -9133,10 +9133,10 @@ fold_builtin_isascii (location_t loc, tree arg) ...@@ -9133,10 +9133,10 @@ fold_builtin_isascii (location_t loc, tree arg)
{ {
/* Transform isascii(c) -> ((c & ~0x7f) == 0). */ /* Transform isascii(c) -> ((c & ~0x7f) == 0). */
arg = fold_build2 (BIT_AND_EXPR, integer_type_node, arg, 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)); ~ (unsigned HOST_WIDE_INT) 0x7f));
return fold_build2_loc (loc, EQ_EXPR, integer_type_node, 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) ...@@ -9150,7 +9150,7 @@ fold_builtin_toascii (location_t loc, tree arg)
/* Transform toascii(c) -> (c & 0x7f). */ /* Transform toascii(c) -> (c & 0x7f). */
return fold_build2_loc (loc, BIT_AND_EXPR, integer_type_node, arg, 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. */ /* Fold a call to builtin isdigit with argument ARG. */
...@@ -9341,7 +9341,7 @@ fold_builtin_logb (location_t loc, tree arg, tree rettype) ...@@ -9341,7 +9341,7 @@ fold_builtin_logb (location_t loc, tree arg, tree rettype)
exponent and subtract 1. */ exponent and subtract 1. */
if (REAL_MODE_FORMAT (TYPE_MODE (TREE_TYPE (arg)))->b == 2) if (REAL_MODE_FORMAT (TYPE_MODE (TREE_TYPE (arg)))->b == 2)
return fold_convert_loc (loc, rettype, return fold_convert_loc (loc, rettype,
build_int_cst (NULL_TREE, build_int_cst (integer_type_node,
REAL_EXP (value)-1)); REAL_EXP (value)-1));
break; break;
} }
...@@ -9429,7 +9429,7 @@ fold_builtin_frexp (location_t loc, tree arg0, tree arg1, tree rettype) ...@@ -9429,7 +9429,7 @@ fold_builtin_frexp (location_t loc, tree arg0, tree arg1, tree rettype)
REAL_VALUE_TYPE frac_rvt = *value; REAL_VALUE_TYPE frac_rvt = *value;
SET_REAL_EXP (&frac_rvt, 0); SET_REAL_EXP (&frac_rvt, 0);
frac = build_real (rettype, frac_rvt); 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; break;
default: default:
...@@ -11214,7 +11214,8 @@ fold_builtin_strstr (location_t loc, tree s1, tree s2, tree type) ...@@ -11214,7 +11214,8 @@ fold_builtin_strstr (location_t loc, tree s1, tree s2, tree type)
/* New argument list transforming strstr(s1, s2) to /* New argument list transforming strstr(s1, s2) to
strchr(s1, s2[0]). */ 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) ...@@ -11400,7 +11401,8 @@ fold_builtin_strpbrk (location_t loc, tree s1, tree s2, tree type)
/* New argument list transforming strpbrk(s1, s2) to /* New argument list transforming strpbrk(s1, s2) to
strchr(s1, s2[0]). */ 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, ...@@ -11683,7 +11685,8 @@ fold_builtin_fputs (location_t loc, tree arg0, tree arg1,
{ {
if (fn_fputc) if (fn_fputc)
return build_call_expr_loc (loc, fn_fputc, 2, 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 else
return NULL_TREE; return NULL_TREE;
} }
...@@ -11855,7 +11858,7 @@ fold_builtin_sprintf (location_t loc, tree dest, tree fmt, ...@@ -11855,7 +11858,7 @@ fold_builtin_sprintf (location_t loc, tree dest, tree fmt,
'format' is known to contain no % formats. */ 'format' is known to contain no % formats. */
call = build_call_expr_loc (loc, fn, 2, dest, fmt); call = build_call_expr_loc (loc, fn, 2, dest, fmt);
if (!ignored) 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. */ /* 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, ...@@ -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); call = build_call_expr_loc (loc, fn, 2, dest, fmt);
if (!ignored) 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. */ /* 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, ...@@ -12947,7 +12950,7 @@ fold_builtin_printf (location_t loc, tree fndecl, tree fmt,
/* Given printf("c"), (where c is any one character,) /* Given printf("c"), (where c is any one character,)
convert "c"[0] to an int and pass that to the replacement convert "c"[0] to an int and pass that to the replacement
function. */ function. */
newarg = build_int_cst (NULL_TREE, str[0]); newarg = build_int_cst (integer_type_node, str[0]);
if (fn_putchar) if (fn_putchar)
call = build_call_expr_loc (loc, fn_putchar, 1, newarg); call = build_call_expr_loc (loc, fn_putchar, 1, newarg);
} }
...@@ -13549,9 +13552,10 @@ do_mpfr_remquo (tree arg0, tree arg1, tree arg_quo) ...@@ -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) if (TYPE_MAIN_VARIANT (TREE_TYPE (arg_quo)) == integer_type_node)
{ {
/* Set the value. */ /* Set the value. */
tree result_quo = fold_build2 (MODIFY_EXPR, tree result_quo
TREE_TYPE (arg_quo), arg_quo, = fold_build2 (MODIFY_EXPR, TREE_TYPE (arg_quo), arg_quo,
build_int_cst (NULL, integer_quo)); build_int_cst (TREE_TYPE (arg_quo),
integer_quo));
TREE_SIDE_EFFECTS (result_quo) = 1; TREE_SIDE_EFFECTS (result_quo) = 1;
/* Combine the quo assignment with the rem. */ /* Combine the quo assignment with the rem. */
result = non_lvalue (fold_build2 (COMPOUND_EXPR, type, result = non_lvalue (fold_build2 (COMPOUND_EXPR, type,
...@@ -13616,7 +13620,7 @@ do_mpfr_lgamma_r (tree arg, tree arg_sg, tree type) ...@@ -13616,7 +13620,7 @@ do_mpfr_lgamma_r (tree arg, tree arg_sg, tree type)
/* Assign the signgam value into *arg_sg. */ /* Assign the signgam value into *arg_sg. */
result_sg = fold_build2 (MODIFY_EXPR, result_sg = fold_build2 (MODIFY_EXPR,
TREE_TYPE (arg_sg), arg_sg, 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; TREE_SIDE_EFFECTS (result_sg) = 1;
/* Combine the signgam assignment with the lgamma result. */ /* Combine the signgam assignment with the lgamma result. */
result = non_lvalue (fold_build2 (COMPOUND_EXPR, type, result = non_lvalue (fold_build2 (COMPOUND_EXPR, type,
......
...@@ -22966,7 +22966,7 @@ resolve_one_addr (rtx *addr, void *data ATTRIBUTE_UNUSED) ...@@ -22966,7 +22966,7 @@ resolve_one_addr (rtx *addr, void *data ATTRIBUTE_UNUSED)
{ {
size_t len = strlen (XSTR (rtl, 0)) + 1; size_t len = strlen (XSTR (rtl, 0)) + 1;
tree t = build_string (len, XSTR (rtl, 0)); 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) TREE_TYPE (t)
= build_array_type (char_type_node, build_index_type (tlen)); = build_array_type (char_type_node, build_index_type (tlen));
rtl = lookup_constant_def (t); rtl = lookup_constant_def (t);
......
...@@ -225,7 +225,7 @@ init_eh (void) ...@@ -225,7 +225,7 @@ init_eh (void)
integer_type_node); integer_type_node);
DECL_FIELD_CONTEXT (f_cs) = sjlj_fc_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 tmp = build_array_type (lang_hooks.types.type_for_mode
(targetm.unwind_word_mode (), 1), (targetm.unwind_word_mode (), 1),
tmp); tmp);
...@@ -245,17 +245,17 @@ init_eh (void) ...@@ -245,17 +245,17 @@ init_eh (void)
#ifdef DONT_USE_BUILTIN_SETJMP #ifdef DONT_USE_BUILTIN_SETJMP
#ifdef JMP_BUF_SIZE #ifdef JMP_BUF_SIZE
tmp = build_int_cst (NULL_TREE, JMP_BUF_SIZE - 1); tmp = size_int (JMP_BUF_SIZE - 1);
#else #else
/* Should be large enough for most systems, if it is not, /* Should be large enough for most systems, if it is not,
JMP_BUF_SIZE should be defined with the proper value. It will JMP_BUF_SIZE should be defined with the proper value. It will
also tend to be larger than necessary for most systems, a more also tend to be larger than necessary for most systems, a more
optimal port will define JMP_BUF_SIZE. */ 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 #endif
#else #else
/* builtin_setjmp takes a pointer to 5 words. */ /* 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 #endif
tmp = build_index_type (tmp); tmp = build_index_type (tmp);
tmp = build_array_type (ptr_type_node, tmp); tmp = build_array_type (ptr_type_node, tmp);
...@@ -857,7 +857,7 @@ assign_filter_values (void) ...@@ -857,7 +857,7 @@ assign_filter_values (void)
for ( ; tp_node; tp_node = TREE_CHAIN (tp_node)) for ( ; tp_node; tp_node = TREE_CHAIN (tp_node))
{ {
int flt = add_ttypes_entry (ttypes, TREE_VALUE (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 c->filter_list
= tree_cons (NULL_TREE, flt_node, c->filter_list); = tree_cons (NULL_TREE, flt_node, c->filter_list);
...@@ -868,7 +868,7 @@ assign_filter_values (void) ...@@ -868,7 +868,7 @@ assign_filter_values (void)
/* Get a filter value for the NULL list also since it /* Get a filter value for the NULL list also since it
will need an action record anyway. */ will need an action record anyway. */
int flt = add_ttypes_entry (ttypes, NULL); 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 c->filter_list
= tree_cons (NULL_TREE, flt_node, NULL); = tree_cons (NULL_TREE, flt_node, NULL);
...@@ -1289,7 +1289,7 @@ sjlj_emit_dispatch_table (rtx dispatch_label, int num_dispatch) ...@@ -1289,7 +1289,7 @@ sjlj_emit_dispatch_table (rtx dispatch_label, int num_dispatch)
t_label = create_artificial_label (UNKNOWN_LOCATION); t_label = create_artificial_label (UNKNOWN_LOCATION);
case_elt = build3 (CASE_LABEL_EXPR, void_type_node, 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); NULL, t_label);
gimple_switch_set_label (switch_stmt, disp_index, case_elt); gimple_switch_set_label (switch_stmt, disp_index, case_elt);
......
...@@ -5756,7 +5756,7 @@ move_stmt_eh_region_tree_nr (tree old_t_nr, struct move_stmt_d *p) ...@@ -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); old_nr = tree_low_cst (old_t_nr, 0);
new_nr = move_stmt_eh_region_nr (old_nr, p); 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. /* Like move_stmt_op, but for gimple statements.
......
...@@ -6909,7 +6909,7 @@ simplify_div_or_mod_using_ranges (gimple stmt) ...@@ -6909,7 +6909,7 @@ simplify_div_or_mod_using_ranges (gimple stmt)
if (rhs_code == TRUNC_DIV_EXPR) 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_rhs_code (stmt, RSHIFT_EXPR);
gimple_assign_set_rhs1 (stmt, op0); gimple_assign_set_rhs1 (stmt, op0);
gimple_assign_set_rhs2 (stmt, t); gimple_assign_set_rhs2 (stmt, t);
......
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment