Commit 995b5904 by Richard Kenner

builtins.c (expand_builtin_strncpy): Use integer_zerop instead of compare_tree_int.

	* builtins.c (expand_builtin_strncpy): Use integer_zerop instead
	of compare_tree_int.
	(expand_builtin_strncat): Likewise.
	* c-decl.c (finish_struct): Use tree_low_cst.
	* tree.h (compare_tree_int): Arg is unsigned HOST_WIDE_INT.
	* tree.c (compare_tree_int): Likewise.

From-SVN: r49222
parent 75eefe3f
Fri Jan 25 08:26:19 2002 Richard Kenner <kenner@vlsi1.ultra.nyu.edu>
* builtins.c (expand_builtin_strncpy): Use integer_zerop instead
of compare_tree_int.
(expand_builtin_strncat): Likewise.
* c-decl.c (finish_struct): Use tree_low_cst.
* tree.h (compare_tree_int): Arg is unsigned HOST_WIDE_INT.
* tree.c (compare_tree_int): Likewise.
2002-01-25 Ulrich Weigand <uweigand@de.ibm.com> 2002-01-25 Ulrich Weigand <uweigand@de.ibm.com>
* reload1.c (eliminate_regs_in_insn): Recognize frame pointer * reload1.c (eliminate_regs_in_insn): Recognize frame pointer
...@@ -5,7 +14,7 @@ ...@@ -5,7 +14,7 @@
Fri Jan 25 20:43:56 CET 2002 Jan Hubicka <jh@suse.cz> Fri Jan 25 20:43:56 CET 2002 Jan Hubicka <jh@suse.cz>
* df.c (df_ref_create, df_ref_record_1, df_ref_record): Kill BB argument. * df.c (df_ref_create, df_ref_record_1, df_ref_record): Kill BB arg.
* df.h (struct ref): Kill B. * df.h (struct ref): Kill B.
(DF_REF_BB, DF_REF_BBNO): Use BLOCK_FOR_INSN. (DF_REF_BB, DF_REF_BBNO): Use BLOCK_FOR_INSN.
......
...@@ -2062,7 +2062,7 @@ expand_builtin_strncpy (arglist, target, mode) ...@@ -2062,7 +2062,7 @@ expand_builtin_strncpy (arglist, target, mode)
return 0; return 0;
/* If the len parameter is zero, return the dst parameter. */ /* If the len parameter is zero, return the dst parameter. */
if (compare_tree_int (len, 0) == 0) if (integer_zerop (len))
{ {
/* Evaluate and ignore the src argument in case it has /* Evaluate and ignore the src argument in case it has
side-effects. */ side-effects. */
...@@ -2279,10 +2279,11 @@ expand_builtin_memcmp (exp, arglist, target, mode) ...@@ -2279,10 +2279,11 @@ expand_builtin_memcmp (exp, arglist, target, mode)
/* If all arguments are constant, and the value of len is not greater /* If all arguments are constant, and the value of len is not greater
than the lengths of arg1 and arg2, evaluate at compile-time. */ than the lengths of arg1 and arg2, evaluate at compile-time. */
if (host_integerp (len, 1) && p1 && p2 if (host_integerp (len, 1) && p1 && p2
&& compare_tree_int (len, strlen (p1)+1) <= 0 && compare_tree_int (len, strlen (p1) + 1) <= 0
&& compare_tree_int (len, strlen (p2)+1) <= 0) && compare_tree_int (len, strlen (p2) + 1) <= 0)
{ {
const int r = memcmp (p1, p2, tree_low_cst (len, 1)); const int r = memcmp (p1, p2, tree_low_cst (len, 1));
return (r < 0 ? constm1_rtx : (r > 0 ? const1_rtx : const0_rtx)); return (r < 0 ? constm1_rtx : (r > 0 ? const1_rtx : const0_rtx));
} }
...@@ -2607,7 +2608,7 @@ expand_builtin_strncat (arglist, target, mode) ...@@ -2607,7 +2608,7 @@ expand_builtin_strncat (arglist, target, mode)
/* If the requested length is zero, or the src parameter string /* If the requested length is zero, or the src parameter string
length is zero, return the dst parameter. */ length is zero, return the dst parameter. */
if ((TREE_CODE (len) == INTEGER_CST && compare_tree_int (len, 0) == 0) if ((TREE_CODE (len) == INTEGER_CST && integer_zerop (len))
|| (p && *p == '\0')) || (p && *p == '\0'))
{ {
/* Evaluate and ignore the src and len parameters in case /* Evaluate and ignore the src and len parameters in case
...@@ -2622,9 +2623,9 @@ expand_builtin_strncat (arglist, target, mode) ...@@ -2622,9 +2623,9 @@ expand_builtin_strncat (arglist, target, mode)
if (TREE_CODE (len) == INTEGER_CST && p if (TREE_CODE (len) == INTEGER_CST && p
&& compare_tree_int (len, strlen (p)) >= 0) && compare_tree_int (len, strlen (p)) >= 0)
{ {
tree newarglist = tree newarglist
tree_cons (NULL_TREE, dst, build_tree_list (NULL_TREE, src)), = tree_cons (NULL_TREE, dst, build_tree_list (NULL_TREE, src));
fn = built_in_decls[BUILT_IN_STRCAT]; tree fn = built_in_decls[BUILT_IN_STRCAT];
/* If the replacement _DECL isn't initialized, don't do the /* If the replacement _DECL isn't initialized, don't do the
transformation. */ transformation. */
......
...@@ -5693,11 +5693,10 @@ finish_struct (t, fieldlist, attributes) ...@@ -5693,11 +5693,10 @@ finish_struct (t, fieldlist, attributes)
field widths. */ field widths. */
if (DECL_INITIAL (x)) if (DECL_INITIAL (x))
{ {
int max_width; int max_width
if (TYPE_MAIN_VARIANT (TREE_TYPE (x)) == c_bool_type_node) = (TYPE_MAIN_VARIANT (TREE_TYPE (x)) == c_bool_type_node
max_width = CHAR_TYPE_SIZE; ? CHAR_TYPE_SIZE : TYPE_PRECISION (TREE_TYPE (x)));
else
max_width = TYPE_PRECISION (TREE_TYPE (x));
if (tree_int_cst_sgn (DECL_INITIAL (x)) < 0) if (tree_int_cst_sgn (DECL_INITIAL (x)) < 0)
error_with_decl (x, "negative width in bit-field `%s'"); error_with_decl (x, "negative width in bit-field `%s'");
else if (0 < compare_tree_int (DECL_INITIAL (x), max_width)) else if (0 < compare_tree_int (DECL_INITIAL (x), max_width))
...@@ -5708,7 +5707,7 @@ finish_struct (t, fieldlist, attributes) ...@@ -5708,7 +5707,7 @@ finish_struct (t, fieldlist, attributes)
{ {
/* The test above has assured us that TREE_INT_CST_HIGH is 0. */ /* The test above has assured us that TREE_INT_CST_HIGH is 0. */
unsigned HOST_WIDE_INT width unsigned HOST_WIDE_INT width
= TREE_INT_CST_LOW (DECL_INITIAL (x)); = tree_low_cst (DECL_INITIAL (x), 1);
if (TREE_CODE (TREE_TYPE (x)) == ENUMERAL_TYPE if (TREE_CODE (TREE_TYPE (x)) == ENUMERAL_TYPE
&& (width < min_precision (TYPE_MIN_VALUE (TREE_TYPE (x)), && (width < min_precision (TYPE_MIN_VALUE (TREE_TYPE (x)),
......
...@@ -3633,7 +3633,7 @@ simple_cst_equal (t1, t2) ...@@ -3633,7 +3633,7 @@ simple_cst_equal (t1, t2)
int int
compare_tree_int (t, u) compare_tree_int (t, u)
tree t; tree t;
unsigned int u; unsigned HOST_WIDE_INT u;
{ {
if (tree_int_cst_sgn (t) < 0) if (tree_int_cst_sgn (t) < 0)
return -1; return -1;
......
...@@ -2888,7 +2888,8 @@ extern void preserve_data PARAMS ((void)); ...@@ -2888,7 +2888,8 @@ extern void preserve_data PARAMS ((void));
extern int object_permanent_p PARAMS ((tree)); extern int object_permanent_p PARAMS ((tree));
extern int type_precision PARAMS ((tree)); extern int type_precision PARAMS ((tree));
extern int simple_cst_equal PARAMS ((tree, tree)); extern int simple_cst_equal PARAMS ((tree, tree));
extern int compare_tree_int PARAMS ((tree, unsigned int)); extern int compare_tree_int PARAMS ((tree,
unsigned HOST_WIDE_INT));
extern int type_list_equal PARAMS ((tree, tree)); extern int type_list_equal PARAMS ((tree, tree));
extern int chain_member PARAMS ((tree, tree)); extern int chain_member PARAMS ((tree, tree));
extern int chain_member_purpose PARAMS ((tree, tree)); extern int chain_member_purpose PARAMS ((tree, tree));
......
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