mirror of
https://gcc.gnu.org/git/gcc.git
synced 2024-12-01 15:54:17 +08:00
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
This commit is contained in:
parent
75eefe3fe0
commit
995b590439
@ -1,3 +1,12 @@
|
||||
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>
|
||||
|
||||
* reload1.c (eliminate_regs_in_insn): Recognize frame pointer
|
||||
@ -5,7 +14,7 @@
|
||||
|
||||
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_REF_BB, DF_REF_BBNO): Use BLOCK_FOR_INSN.
|
||||
|
||||
|
@ -2062,7 +2062,7 @@ expand_builtin_strncpy (arglist, target, mode)
|
||||
return 0;
|
||||
|
||||
/* 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
|
||||
side-effects. */
|
||||
@ -2279,10 +2279,11 @@ expand_builtin_memcmp (exp, arglist, target, mode)
|
||||
/* If all arguments are constant, and the value of len is not greater
|
||||
than the lengths of arg1 and arg2, evaluate at compile-time. */
|
||||
if (host_integerp (len, 1) && p1 && p2
|
||||
&& compare_tree_int (len, strlen (p1)+1) <= 0
|
||||
&& compare_tree_int (len, strlen (p2)+1) <= 0)
|
||||
&& compare_tree_int (len, strlen (p1) + 1) <= 0
|
||||
&& compare_tree_int (len, strlen (p2) + 1) <= 0)
|
||||
{
|
||||
const int r = memcmp (p1, p2, tree_low_cst (len, 1));
|
||||
|
||||
return (r < 0 ? constm1_rtx : (r > 0 ? const1_rtx : const0_rtx));
|
||||
}
|
||||
|
||||
@ -2607,7 +2608,7 @@ expand_builtin_strncat (arglist, target, mode)
|
||||
|
||||
/* If the requested length is zero, or the src parameter string
|
||||
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'))
|
||||
{
|
||||
/* Evaluate and ignore the src and len parameters in case
|
||||
@ -2622,9 +2623,9 @@ expand_builtin_strncat (arglist, target, mode)
|
||||
if (TREE_CODE (len) == INTEGER_CST && p
|
||||
&& compare_tree_int (len, strlen (p)) >= 0)
|
||||
{
|
||||
tree newarglist =
|
||||
tree_cons (NULL_TREE, dst, build_tree_list (NULL_TREE, src)),
|
||||
fn = built_in_decls[BUILT_IN_STRCAT];
|
||||
tree newarglist
|
||||
= tree_cons (NULL_TREE, dst, build_tree_list (NULL_TREE, src));
|
||||
tree fn = built_in_decls[BUILT_IN_STRCAT];
|
||||
|
||||
/* If the replacement _DECL isn't initialized, don't do the
|
||||
transformation. */
|
||||
|
11
gcc/c-decl.c
11
gcc/c-decl.c
@ -5693,11 +5693,10 @@ finish_struct (t, fieldlist, attributes)
|
||||
field widths. */
|
||||
if (DECL_INITIAL (x))
|
||||
{
|
||||
int max_width;
|
||||
if (TYPE_MAIN_VARIANT (TREE_TYPE (x)) == c_bool_type_node)
|
||||
max_width = CHAR_TYPE_SIZE;
|
||||
else
|
||||
max_width = TYPE_PRECISION (TREE_TYPE (x));
|
||||
int max_width
|
||||
= (TYPE_MAIN_VARIANT (TREE_TYPE (x)) == c_bool_type_node
|
||||
? CHAR_TYPE_SIZE : TYPE_PRECISION (TREE_TYPE (x)));
|
||||
|
||||
if (tree_int_cst_sgn (DECL_INITIAL (x)) < 0)
|
||||
error_with_decl (x, "negative width in bit-field `%s'");
|
||||
else if (0 < compare_tree_int (DECL_INITIAL (x), max_width))
|
||||
@ -5708,7 +5707,7 @@ finish_struct (t, fieldlist, attributes)
|
||||
{
|
||||
/* The test above has assured us that TREE_INT_CST_HIGH is 0. */
|
||||
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
|
||||
&& (width < min_precision (TYPE_MIN_VALUE (TREE_TYPE (x)),
|
||||
|
@ -3633,7 +3633,7 @@ simple_cst_equal (t1, t2)
|
||||
int
|
||||
compare_tree_int (t, u)
|
||||
tree t;
|
||||
unsigned int u;
|
||||
unsigned HOST_WIDE_INT u;
|
||||
{
|
||||
if (tree_int_cst_sgn (t) < 0)
|
||||
return -1;
|
||||
|
@ -2888,7 +2888,8 @@ extern void preserve_data PARAMS ((void));
|
||||
extern int object_permanent_p PARAMS ((tree));
|
||||
extern int type_precision PARAMS ((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 chain_member PARAMS ((tree, tree));
|
||||
extern int chain_member_purpose PARAMS ((tree, tree));
|
||||
|
Loading…
Reference in New Issue
Block a user