Commit d3147f64 by Eric Christopher Committed by Eric Christopher

builtins.c (simplify_builtin_va_start): Remove.

2004-09-22  Eric Christopher  <echristo@redhat.com>

        * builtins.c (simplify_builtin_va_start): Remove.
        (simplify_builtin): Ditto.
        (fold_builtin_strchr): Ditto.
        (simplify_builtin_*): Rename remainders to fold_builtin_*.
        (expand_builtin): Fix up for above changes.
        (fold_builtin_1): Add new folders. Change for above.
        (expand_builtin_va_start): Call fold_builtin_next_arg.
        * gimplify.c (gimplify_call_expr): Fix calls to simplify_builtin.
        * tree.h: Remove prototype for simplify_builtin.

From-SVN: r87921
parent 1381bf1a
2004-09-22 Eric Christopher <echristo@redhat.com>
* builtins.c (simplify_builtin_va_start): Remove.
(simplify_builtin): Ditto.
(fold_builtin_strchr): Ditto.
(simplify_builtin_*): Rename remainders to fold_builtin_*.
(expand_builtin): Fix up for above changes.
(fold_builtin_1): Add new folders. Change for above.
(expand_builtin_va_start): Call fold_builtin_next_arg.
* gimplify.c (gimplify_call_expr): Fix calls to simplify_builtin.
* tree.h: Remove prototype for simplify_builtin.
2004-09-23 Jan Hubicka <jh@suse.cz> 2004-09-23 Jan Hubicka <jh@suse.cz>
PR debug/17389 PR debug/17389
...@@ -23,7 +35,7 @@ ...@@ -23,7 +35,7 @@
(AC_ICONV, AC_LCMESSAGES, GCC_PATH_PROG): Remove. (AC_ICONV, AC_LCMESSAGES, GCC_PATH_PROG): Remove.
* configure.ac: Add in check for iconv.h * configure.ac: Add in check for iconv.h
* configure: Regenerate. * configure: Regenerate.
2004-09-22 Kelley Cook <kcook@gcc.gnu.org> 2004-09-22 Kelley Cook <kcook@gcc.gnu.org>
* aclocal.m4: Update for rename of gettext-sister.m4. * aclocal.m4: Update for rename of gettext-sister.m4.
...@@ -69,7 +81,7 @@ ...@@ -69,7 +81,7 @@
* config/darwin.c (darwin_make_decl_one_only) * config/darwin.c (darwin_make_decl_one_only)
Allow coalesced symbol to appear in static archive's table of contents Allow coalesced symbol to appear in static archive's table of contents
2004-09-22 Kazu Hirata <kazu@cs.umass.edu> 2004-09-22 Kazu Hirata <kazu@cs.umass.edu>
PR tree-optimization/17512 PR tree-optimization/17512
...@@ -165,7 +177,7 @@ ...@@ -165,7 +177,7 @@
the initial lattice value. the initial lattice value.
(substitute_and_fold): Transfer equivalences discovered into (substitute_and_fold): Transfer equivalences discovered into
SSA_NAME_EQUIV. SSA_NAME_EQUIV.
* tree.h (SSA_NAME_EQUIV): Add comments. * tree.h (SSA_NAME_EQUIV): Add comments.
(SET_SSA_NAME_EQUIV): Similarly. (SET_SSA_NAME_EQUIV): Similarly.
...@@ -184,12 +196,12 @@ ...@@ -184,12 +196,12 @@
* tree.def (VEC_COND_EXPR): New tree node. * tree.def (VEC_COND_EXPR): New tree node.
* tree-ssa-operands.c (get_expr_operands): Handle VEC_COND_EXPR. * tree-ssa-operands.c (get_expr_operands): Handle VEC_COND_EXPR.
2004-09-21 Stan Shebs <shebs@apple.com> 2004-09-21 Stan Shebs <shebs@apple.com>
* config/rs6000/darwin-tramp.asm: Add __ppc64__ case. * config/rs6000/darwin-tramp.asm: Add __ppc64__ case.
* config/rs6000/darwin-world.asm: Likewise. * config/rs6000/darwin-world.asm: Likewise.
2004-09-21 Daniel Berlin <dberlin@dberlin.org> 2004-09-21 Daniel Berlin <dberlin@dberlin.org>
* tree-ssa.c (verify_def): Use print_generic_stmt, * tree-ssa.c (verify_def): Use print_generic_stmt,
......
...@@ -164,7 +164,7 @@ static tree fold_builtin_bitop (tree); ...@@ -164,7 +164,7 @@ static tree fold_builtin_bitop (tree);
static tree fold_builtin_memcpy (tree); static tree fold_builtin_memcpy (tree);
static tree fold_builtin_mempcpy (tree); static tree fold_builtin_mempcpy (tree);
static tree fold_builtin_memmove (tree); static tree fold_builtin_memmove (tree);
static tree fold_builtin_strchr (tree, bool); static tree fold_builtin_strchr (tree);
static tree fold_builtin_memcmp (tree); static tree fold_builtin_memcmp (tree);
static tree fold_builtin_strcmp (tree); static tree fold_builtin_strcmp (tree);
static tree fold_builtin_strncmp (tree); static tree fold_builtin_strncmp (tree);
...@@ -178,17 +178,15 @@ static tree fold_builtin_abs (tree, tree); ...@@ -178,17 +178,15 @@ static tree fold_builtin_abs (tree, tree);
static tree fold_builtin_unordered_cmp (tree, enum tree_code, enum tree_code); static tree fold_builtin_unordered_cmp (tree, enum tree_code, enum tree_code);
static tree fold_builtin_1 (tree, bool); static tree fold_builtin_1 (tree, bool);
static tree simplify_builtin_strpbrk (tree); static tree fold_builtin_strpbrk (tree);
static tree simplify_builtin_strstr (tree); static tree fold_builtin_strstr (tree);
static tree simplify_builtin_strchr (tree); static tree fold_builtin_strrchr (tree);
static tree simplify_builtin_strrchr (tree); static tree fold_builtin_strcat (tree);
static tree simplify_builtin_strcat (tree); static tree fold_builtin_strncat (tree);
static tree simplify_builtin_strncat (tree); static tree fold_builtin_strspn (tree);
static tree simplify_builtin_strspn (tree); static tree fold_builtin_strcspn (tree);
static tree simplify_builtin_strcspn (tree); static void fold_builtin_next_arg (tree);
static void simplify_builtin_next_arg (tree); static tree fold_builtin_sprintf (tree, int);
static void simplify_builtin_va_start (tree);
static tree simplify_builtin_sprintf (tree, int);
/* Return the alignment in bits of EXP, a pointer valued expression. /* Return the alignment in bits of EXP, a pointer valued expression.
...@@ -4286,6 +4284,8 @@ expand_builtin_va_start (tree arglist) ...@@ -4286,6 +4284,8 @@ expand_builtin_va_start (tree arglist)
if (TREE_CHAIN (chain)) if (TREE_CHAIN (chain))
error ("too many arguments to function %<va_start%>"); error ("too many arguments to function %<va_start%>");
fold_builtin_next_arg (chain);
nextarg = expand_builtin_next_arg (chain); nextarg = expand_builtin_next_arg (chain);
valist = stabilize_va_list (TREE_VALUE (arglist), 1); valist = stabilize_va_list (TREE_VALUE (arglist), 1);
...@@ -5728,7 +5728,7 @@ expand_builtin (tree exp, rtx target, rtx subtarget, enum machine_mode mode, ...@@ -5728,7 +5728,7 @@ expand_builtin (tree exp, rtx target, rtx subtarget, enum machine_mode mode,
/* Return the address of the first anonymous stack arg. */ /* Return the address of the first anonymous stack arg. */
case BUILT_IN_NEXT_ARG: case BUILT_IN_NEXT_ARG:
simplify_builtin_next_arg (arglist); fold_builtin_next_arg (arglist);
return expand_builtin_next_arg (arglist); return expand_builtin_next_arg (arglist);
case BUILT_IN_CLASSIFY_TYPE: case BUILT_IN_CLASSIFY_TYPE:
...@@ -7576,61 +7576,6 @@ fold_builtin_strncpy (tree exp, tree slen) ...@@ -7576,61 +7576,6 @@ fold_builtin_strncpy (tree exp, tree slen)
build_function_call_expr (fn, arglist)); build_function_call_expr (fn, arglist));
} }
/* Fold function call to builtin strchr and strrchr.
Return NULL_TREE if no simplification can be made. */
static tree
fold_builtin_strchr (tree exp, bool actually_strrchr)
{
tree arglist = TREE_OPERAND (exp, 1);
if (!validate_arglist (arglist, POINTER_TYPE, INTEGER_TYPE, VOID_TYPE))
return 0;
else
{
tree s1 = TREE_VALUE (arglist), s2 = TREE_VALUE (TREE_CHAIN (arglist));
const char *p1;
if (TREE_CODE (s2) != INTEGER_CST)
return 0;
p1 = c_getstr (s1);
if (p1 != NULL)
{
char c;
const char *r;
if (target_char_cast (s2, &c))
return 0;
r = actually_strrchr ? strrchr (p1, c) : strchr (p1, c);
if (r == NULL)
return build_int_cst (TREE_TYPE (s1), 0);
/* Return an offset into the constant string argument. */
return fold (build2 (PLUS_EXPR, TREE_TYPE (s1),
s1, build_int_cst (TREE_TYPE (s1), r - p1)));
}
if (actually_strrchr)
{
tree fn;
if (!integer_zerop (s2))
return 0;
fn = implicit_built_in_decls[BUILT_IN_STRCHR];
if (!fn)
return 0;
/* Transform strrchr(s1, '\0') to strchr(s1, '\0'). */
return build_function_call_expr (fn, arglist);
}
return 0;
}
}
/* Fold function call to builtin memcmp. Return /* Fold function call to builtin memcmp. Return
NULL_TREE if no simplification can be made. */ NULL_TREE if no simplification can be made. */
...@@ -8210,8 +8155,70 @@ fold_builtin_1 (tree exp, bool ignore) ...@@ -8210,8 +8155,70 @@ fold_builtin_1 (tree exp, bool ignore)
switch (DECL_FUNCTION_CODE (fndecl)) switch (DECL_FUNCTION_CODE (fndecl))
{ {
case BUILT_IN_FPUTS:
return fold_builtin_fputs (arglist, ignore, false, NULL_TREE);
case BUILT_IN_FPUTS_UNLOCKED:
return fold_builtin_fputs (arglist, ignore, true, NULL_TREE);
case BUILT_IN_STRSTR:
return fold_builtin_strstr (arglist);
case BUILT_IN_STRCAT:
return fold_builtin_strcat (arglist);
case BUILT_IN_STRNCAT:
return fold_builtin_strncat (arglist);
case BUILT_IN_STRSPN:
return fold_builtin_strspn (arglist);
case BUILT_IN_STRCSPN:
return fold_builtin_strcspn (arglist);
case BUILT_IN_STRCHR:
case BUILT_IN_INDEX:
return fold_builtin_strchr (arglist);
case BUILT_IN_STRRCHR:
case BUILT_IN_RINDEX:
return fold_builtin_strrchr (arglist);
case BUILT_IN_STRCPY:
return fold_builtin_strcpy (exp, NULL_TREE);
case BUILT_IN_STRNCPY:
return fold_builtin_strncpy (exp, NULL_TREE);
case BUILT_IN_STRCMP:
return fold_builtin_strcmp (arglist);
case BUILT_IN_STRNCMP:
return fold_builtin_strncmp (arglist);
case BUILT_IN_STRPBRK:
return fold_builtin_strpbrk (arglist);
case BUILT_IN_BCMP:
case BUILT_IN_MEMCMP:
return fold_builtin_memcmp (arglist);
case BUILT_IN_SPRINTF:
return fold_builtin_sprintf (arglist, ignore);
case BUILT_IN_CONSTANT_P: case BUILT_IN_CONSTANT_P:
return fold_builtin_constant_p (arglist); {
tree val;
val = fold_builtin_constant_p (arglist);
/* Gimplification will pull the CALL_EXPR for the builtin out of
an if condition. When not optimizing, we'll not CSE it back.
To avoid link error types of regressions, return false now. */
if (!val && !optimize)
val = integer_zero_node;
return val;
}
case BUILT_IN_EXPECT: case BUILT_IN_EXPECT:
return fold_builtin_expect (arglist); return fold_builtin_expect (arglist);
...@@ -8419,29 +8426,6 @@ fold_builtin_1 (tree exp, bool ignore) ...@@ -8419,29 +8426,6 @@ fold_builtin_1 (tree exp, bool ignore)
case BUILT_IN_MEMMOVE: case BUILT_IN_MEMMOVE:
return fold_builtin_memmove (exp); return fold_builtin_memmove (exp);
case BUILT_IN_STRCPY:
return fold_builtin_strcpy (exp, NULL_TREE);
case BUILT_IN_STRNCPY:
return fold_builtin_strncpy (exp, NULL_TREE);
case BUILT_IN_INDEX:
case BUILT_IN_STRCHR:
return fold_builtin_strchr (exp, false);
case BUILT_IN_RINDEX:
case BUILT_IN_STRRCHR:
return fold_builtin_strchr (exp, true);
case BUILT_IN_MEMCMP:
return fold_builtin_memcmp (arglist);
case BUILT_IN_STRCMP:
return fold_builtin_strcmp (arglist);
case BUILT_IN_STRNCMP:
return fold_builtin_strncmp (arglist);
case BUILT_IN_SIGNBIT: case BUILT_IN_SIGNBIT:
case BUILT_IN_SIGNBITF: case BUILT_IN_SIGNBITF:
case BUILT_IN_SIGNBITL: case BUILT_IN_SIGNBITL:
...@@ -8489,11 +8473,9 @@ fold_builtin_1 (tree exp, bool ignore) ...@@ -8489,11 +8473,9 @@ fold_builtin_1 (tree exp, bool ignore)
case BUILT_IN_ISUNORDERED: case BUILT_IN_ISUNORDERED:
return fold_builtin_unordered_cmp (exp, UNORDERED_EXPR, NOP_EXPR); return fold_builtin_unordered_cmp (exp, UNORDERED_EXPR, NOP_EXPR);
case BUILT_IN_FPUTS: /* We do the folding for va_start in the expander. */
return fold_builtin_fputs (arglist, ignore, false, NULL_TREE); case BUILT_IN_VA_START:
break;
case BUILT_IN_FPUTS_UNLOCKED:
return fold_builtin_fputs (arglist, ignore, true, NULL_TREE);
default: default:
break; break;
...@@ -8517,6 +8499,7 @@ fold_builtin (tree exp, bool ignore) ...@@ -8517,6 +8499,7 @@ fold_builtin (tree exp, bool ignore)
exp = build1 (NOP_EXPR, TREE_TYPE (exp), exp); exp = build1 (NOP_EXPR, TREE_TYPE (exp), exp);
TREE_NO_WARNING (exp) = 1; TREE_NO_WARNING (exp) = 1;
} }
return exp; return exp;
} }
...@@ -8620,101 +8603,6 @@ readonly_data_expr (tree exp) ...@@ -8620,101 +8603,6 @@ readonly_data_expr (tree exp)
return false; return false;
} }
/* Front-end to the simplify_builtin_XXX routines.
EXP is a call to a builtin function. If possible try to simplify
that into a constant, expression or call to a more efficient
builtin function.
If IGNORE is nonzero, then the result of this builtin function
call is ignored.
If simplification is possible, return the simplified tree, otherwise
return NULL_TREE. */
tree
simplify_builtin (tree exp, int ignore)
{
tree fndecl = TREE_OPERAND (TREE_OPERAND (exp, 0), 0);
tree arglist = TREE_OPERAND (exp, 1);
enum built_in_function fcode = DECL_FUNCTION_CODE (fndecl);
tree val;
switch (fcode)
{
case BUILT_IN_FPUTS:
val = fold_builtin_fputs (arglist, ignore, false, NULL_TREE);
break;
case BUILT_IN_FPUTS_UNLOCKED:
val = fold_builtin_fputs (arglist, ignore, true, NULL_TREE);
break;
case BUILT_IN_STRSTR:
val = simplify_builtin_strstr (arglist);
break;
case BUILT_IN_STRCAT:
val = simplify_builtin_strcat (arglist);
break;
case BUILT_IN_STRNCAT:
val = simplify_builtin_strncat (arglist);
break;
case BUILT_IN_STRSPN:
val = simplify_builtin_strspn (arglist);
break;
case BUILT_IN_STRCSPN:
val = simplify_builtin_strcspn (arglist);
break;
case BUILT_IN_STRCHR:
case BUILT_IN_INDEX:
val = simplify_builtin_strchr (arglist);
break;
case BUILT_IN_STRRCHR:
case BUILT_IN_RINDEX:
val = simplify_builtin_strrchr (arglist);
break;
case BUILT_IN_STRCPY:
val = fold_builtin_strcpy (exp, NULL_TREE);
break;
case BUILT_IN_STRNCPY:
val = fold_builtin_strncpy (exp, NULL_TREE);
break;
case BUILT_IN_STRCMP:
val = fold_builtin_strcmp (arglist);
break;
case BUILT_IN_STRNCMP:
val = fold_builtin_strncmp (arglist);
break;
case BUILT_IN_STRPBRK:
val = simplify_builtin_strpbrk (arglist);
break;
case BUILT_IN_BCMP:
case BUILT_IN_MEMCMP:
val = fold_builtin_memcmp (arglist);
break;
case BUILT_IN_VA_START:
simplify_builtin_va_start (arglist);
val = NULL_TREE;
break;
case BUILT_IN_SPRINTF:
val = simplify_builtin_sprintf (arglist, ignore);
break;
case BUILT_IN_CONSTANT_P:
val = fold_builtin_constant_p (arglist);
/* Gimplification will pull the CALL_EXPR for the builtin out of
an if condition. When not optimizing, we'll not CSE it back.
To avoid link error types of regressions, return false now. */
if (!val && !optimize)
val = integer_zero_node;
break;
default:
val = NULL_TREE;
break;
}
if (val)
val = fold_convert (TREE_TYPE (exp), val);
return val;
}
/* Simplify a call to the strstr builtin. /* Simplify a call to the strstr builtin.
Return 0 if no simplification was possible, otherwise return the Return 0 if no simplification was possible, otherwise return the
...@@ -8733,7 +8621,7 @@ simplify_builtin (tree exp, int ignore) ...@@ -8733,7 +8621,7 @@ simplify_builtin (tree exp, int ignore)
form of the builtin function call. */ form of the builtin function call. */
static tree static tree
simplify_builtin_strstr (tree arglist) fold_builtin_strstr (tree arglist)
{ {
if (!validate_arglist (arglist, POINTER_TYPE, POINTER_TYPE, VOID_TYPE)) if (!validate_arglist (arglist, POINTER_TYPE, POINTER_TYPE, VOID_TYPE))
return 0; return 0;
...@@ -8797,7 +8685,7 @@ simplify_builtin_strstr (tree arglist) ...@@ -8797,7 +8685,7 @@ simplify_builtin_strstr (tree arglist)
form of the builtin function call. */ form of the builtin function call. */
static tree static tree
simplify_builtin_strchr (tree arglist) fold_builtin_strchr (tree arglist)
{ {
if (!validate_arglist (arglist, POINTER_TYPE, INTEGER_TYPE, VOID_TYPE)) if (!validate_arglist (arglist, POINTER_TYPE, INTEGER_TYPE, VOID_TYPE))
return 0; return 0;
...@@ -8852,7 +8740,7 @@ simplify_builtin_strchr (tree arglist) ...@@ -8852,7 +8740,7 @@ simplify_builtin_strchr (tree arglist)
form of the builtin function call. */ form of the builtin function call. */
static tree static tree
simplify_builtin_strrchr (tree arglist) fold_builtin_strrchr (tree arglist)
{ {
if (!validate_arglist (arglist, POINTER_TYPE, INTEGER_TYPE, VOID_TYPE)) if (!validate_arglist (arglist, POINTER_TYPE, INTEGER_TYPE, VOID_TYPE))
return 0; return 0;
...@@ -8914,7 +8802,7 @@ simplify_builtin_strrchr (tree arglist) ...@@ -8914,7 +8802,7 @@ simplify_builtin_strrchr (tree arglist)
form of the builtin function call. */ form of the builtin function call. */
static tree static tree
simplify_builtin_strpbrk (tree arglist) fold_builtin_strpbrk (tree arglist)
{ {
if (!validate_arglist (arglist, POINTER_TYPE, POINTER_TYPE, VOID_TYPE)) if (!validate_arglist (arglist, POINTER_TYPE, POINTER_TYPE, VOID_TYPE))
return 0; return 0;
...@@ -8980,7 +8868,7 @@ simplify_builtin_strpbrk (tree arglist) ...@@ -8980,7 +8868,7 @@ simplify_builtin_strpbrk (tree arglist)
form of the builtin function call. */ form of the builtin function call. */
static tree static tree
simplify_builtin_strcat (tree arglist) fold_builtin_strcat (tree arglist)
{ {
if (!validate_arglist (arglist, POINTER_TYPE, POINTER_TYPE, VOID_TYPE)) if (!validate_arglist (arglist, POINTER_TYPE, POINTER_TYPE, VOID_TYPE))
return 0; return 0;
...@@ -9016,7 +8904,7 @@ simplify_builtin_strcat (tree arglist) ...@@ -9016,7 +8904,7 @@ simplify_builtin_strcat (tree arglist)
form of the builtin function call. */ form of the builtin function call. */
static tree static tree
simplify_builtin_strncat (tree arglist) fold_builtin_strncat (tree arglist)
{ {
if (!validate_arglist (arglist, if (!validate_arglist (arglist,
POINTER_TYPE, POINTER_TYPE, INTEGER_TYPE, VOID_TYPE)) POINTER_TYPE, POINTER_TYPE, INTEGER_TYPE, VOID_TYPE))
...@@ -9071,7 +8959,7 @@ simplify_builtin_strncat (tree arglist) ...@@ -9071,7 +8959,7 @@ simplify_builtin_strncat (tree arglist)
form of the builtin function call. */ form of the builtin function call. */
static tree static tree
simplify_builtin_strspn (tree arglist) fold_builtin_strspn (tree arglist)
{ {
if (!validate_arglist (arglist, POINTER_TYPE, POINTER_TYPE, VOID_TYPE)) if (!validate_arglist (arglist, POINTER_TYPE, POINTER_TYPE, VOID_TYPE))
return 0; return 0;
...@@ -9115,7 +9003,7 @@ simplify_builtin_strspn (tree arglist) ...@@ -9115,7 +9003,7 @@ simplify_builtin_strspn (tree arglist)
form of the builtin function call. */ form of the builtin function call. */
static tree static tree
simplify_builtin_strcspn (tree arglist) fold_builtin_strcspn (tree arglist)
{ {
if (!validate_arglist (arglist, POINTER_TYPE, POINTER_TYPE, VOID_TYPE)) if (!validate_arglist (arglist, POINTER_TYPE, POINTER_TYPE, VOID_TYPE))
return 0; return 0;
...@@ -9242,18 +9130,7 @@ fold_builtin_fputs (tree arglist, bool ignore, bool unlocked, tree len) ...@@ -9242,18 +9130,7 @@ fold_builtin_fputs (tree arglist, bool ignore, bool unlocked, tree len)
} }
static void static void
simplify_builtin_va_start (tree arglist) fold_builtin_next_arg (tree arglist)
{
tree chain = TREE_CHAIN (arglist);
if (TREE_CHAIN (chain))
error ("too many arguments to function %<va_start%>");
simplify_builtin_next_arg (chain);
}
static void
simplify_builtin_next_arg (tree arglist)
{ {
tree fntype = TREE_TYPE (current_function_decl); tree fntype = TREE_TYPE (current_function_decl);
...@@ -9293,7 +9170,7 @@ simplify_builtin_next_arg (tree arglist) ...@@ -9293,7 +9170,7 @@ simplify_builtin_next_arg (tree arglist)
the caller does not use the returned value of the function. */ the caller does not use the returned value of the function. */
static tree static tree
simplify_builtin_sprintf (tree arglist, int ignored) fold_builtin_sprintf (tree arglist, int ignored)
{ {
tree call, retval, dest, fmt; tree call, retval, dest, fmt;
const char *fmt_str = NULL; const char *fmt_str = NULL;
......
...@@ -772,7 +772,7 @@ voidify_wrapper_expr (tree wrapper, tree temp) ...@@ -772,7 +772,7 @@ voidify_wrapper_expr (tree wrapper, tree temp)
p = tsi_end_p (i) ? NULL : tsi_stmt_ptr (i); p = tsi_end_p (i) ? NULL : tsi_stmt_ptr (i);
} }
else else
{ {
for (; TREE_CODE (*p) == COMPOUND_EXPR; p = &TREE_OPERAND (*p, 1)) for (; TREE_CODE (*p) == COMPOUND_EXPR; p = &TREE_OPERAND (*p, 1))
{ {
TREE_SIDE_EFFECTS (*p) = 1; TREE_SIDE_EFFECTS (*p) = 1;
...@@ -925,7 +925,7 @@ gimplify_return_expr (tree stmt, tree *pre_p) ...@@ -925,7 +925,7 @@ gimplify_return_expr (tree stmt, tree *pre_p)
Recall that aggregate_value_p is FALSE for any aggregate type that is Recall that aggregate_value_p is FALSE for any aggregate type that is
returned in registers. If we're returning values in registers, then returned in registers. If we're returning values in registers, then
we don't want to extend the lifetime of the RESULT_DECL, particularly we don't want to extend the lifetime of the RESULT_DECL, particularly
across another call. In addition, for those aggregates for which across another call. In addition, for those aggregates for which
hard_function_value generates a PARALLEL, we'll abort during normal hard_function_value generates a PARALLEL, we'll abort during normal
expansion of structure assignments; there's special code in expand_return expansion of structure assignments; there's special code in expand_return
to handle this case that does not exist in expand_expr. */ to handle this case that does not exist in expand_expr. */
...@@ -1000,7 +1000,7 @@ gimplify_decl_expr (tree *stmt_p) ...@@ -1000,7 +1000,7 @@ gimplify_decl_expr (tree *stmt_p)
/* All occurrences of this decl in final gimplified code will be /* All occurrences of this decl in final gimplified code will be
replaced by indirection. Setting DECL_VALUE_EXPR does two replaced by indirection. Setting DECL_VALUE_EXPR does two
things: First, it lets the rest of the gimplifier know what things: First, it lets the rest of the gimplifier know what
replacement to use. Second, it lets the debug info know replacement to use. Second, it lets the debug info know
where to find the value. */ where to find the value. */
ptr_type = build_pointer_type (TREE_TYPE (decl)); ptr_type = build_pointer_type (TREE_TYPE (decl));
addr = create_tmp_var (ptr_type, get_name (decl)); addr = create_tmp_var (ptr_type, get_name (decl));
...@@ -1331,7 +1331,7 @@ canonicalize_component_ref (tree *expr_p) ...@@ -1331,7 +1331,7 @@ canonicalize_component_ref (tree *expr_p)
} }
/* If a NOP conversion is changing a pointer to array of foo to a pointer /* If a NOP conversion is changing a pointer to array of foo to a pointer
to foo, embed that change in the ADDR_EXPR by converting to foo, embed that change in the ADDR_EXPR by converting
T array[U]; T array[U];
(T *)&array (T *)&array
==> ==>
...@@ -1389,7 +1389,7 @@ canonicalize_addr_expr (tree *expr_p) ...@@ -1389,7 +1389,7 @@ canonicalize_addr_expr (tree *expr_p)
static enum gimplify_status static enum gimplify_status
gimplify_conversion (tree *expr_p) gimplify_conversion (tree *expr_p)
{ {
/* If we still have a conversion at the toplevel, then strip /* If we still have a conversion at the toplevel, then strip
away all but the outermost conversion. */ away all but the outermost conversion. */
if (TREE_CODE (*expr_p) == NOP_EXPR || TREE_CODE (*expr_p) == CONVERT_EXPR) if (TREE_CODE (*expr_p) == NOP_EXPR || TREE_CODE (*expr_p) == CONVERT_EXPR)
...@@ -1454,7 +1454,7 @@ gimplify_compound_lval (tree *expr_p, tree *pre_p, ...@@ -1454,7 +1454,7 @@ gimplify_compound_lval (tree *expr_p, tree *pre_p,
int i; int i;
/* Create a stack of the subexpressions so later we can walk them in /* Create a stack of the subexpressions so later we can walk them in
order from inner to outer. order from inner to outer.
This array is very memory consuming. Don't even think of making This array is very memory consuming. Don't even think of making
it VARRAY_TREE. */ it VARRAY_TREE. */
...@@ -1749,7 +1749,7 @@ gimplify_call_expr (tree *expr_p, tree *pre_p, bool want_value) ...@@ -1749,7 +1749,7 @@ gimplify_call_expr (tree *expr_p, tree *pre_p, bool want_value)
gcc_assert (TREE_CODE (*expr_p) == CALL_EXPR); gcc_assert (TREE_CODE (*expr_p) == CALL_EXPR);
/* For reliable diagnostics during inlining, it is necessary that /* For reliable diagnostics during inlining, it is necessary that
every call_expr be annotated with file and line. */ every call_expr be annotated with file and line. */
if (! EXPR_HAS_LOCATION (*expr_p)) if (! EXPR_HAS_LOCATION (*expr_p))
SET_EXPR_LOCATION (*expr_p, input_location); SET_EXPR_LOCATION (*expr_p, input_location);
...@@ -1769,7 +1769,7 @@ gimplify_call_expr (tree *expr_p, tree *pre_p, bool want_value) ...@@ -1769,7 +1769,7 @@ gimplify_call_expr (tree *expr_p, tree *pre_p, bool want_value)
decl = get_callee_fndecl (*expr_p); decl = get_callee_fndecl (*expr_p);
if (decl && DECL_BUILT_IN (decl)) if (decl && DECL_BUILT_IN (decl))
{ {
tree new = simplify_builtin (*expr_p, !want_value); tree new = fold_builtin (*expr_p, !want_value);
if (new && new != *expr_p) if (new && new != *expr_p)
{ {
...@@ -1810,7 +1810,7 @@ gimplify_call_expr (tree *expr_p, tree *pre_p, bool want_value) ...@@ -1810,7 +1810,7 @@ gimplify_call_expr (tree *expr_p, tree *pre_p, bool want_value)
/* Try this again in case gimplification exposed something. */ /* Try this again in case gimplification exposed something. */
if (ret != GS_ERROR && decl && DECL_BUILT_IN (decl)) if (ret != GS_ERROR && decl && DECL_BUILT_IN (decl))
{ {
tree new = simplify_builtin (*expr_p, !want_value); tree new = fold_builtin (*expr_p, !want_value);
if (new && new != *expr_p) if (new && new != *expr_p)
{ {
...@@ -2088,7 +2088,7 @@ gimple_boolify (tree expr) ...@@ -2088,7 +2088,7 @@ gimple_boolify (tree expr)
/* These expressions always produce boolean results. */ /* These expressions always produce boolean results. */
TREE_TYPE (expr) = boolean_type_node; TREE_TYPE (expr) = boolean_type_node;
return expr; return expr;
default: default:
/* Other expressions that get here must have boolean values, but /* Other expressions that get here must have boolean values, but
might need to be converted to the appropriate mode. */ might need to be converted to the appropriate mode. */
...@@ -2358,7 +2358,7 @@ gimplify_init_ctor_preeval (tree *expr_p, tree *pre_p, tree *post_p, ...@@ -2358,7 +2358,7 @@ gimplify_init_ctor_preeval (tree *expr_p, tree *pre_p, tree *post_p,
/* Gimplify the constructor element to something appropriate for the rhs /* Gimplify the constructor element to something appropriate for the rhs
of a MODIFY_EXPR. Given that we know the lhs is an aggregate, we know of a MODIFY_EXPR. Given that we know the lhs is an aggregate, we know
the gimplifier will consider this a store to memory. Doing this the gimplifier will consider this a store to memory. Doing this
gimplification now means that we won't have to deal with complicated gimplification now means that we won't have to deal with complicated
language-specific trees, nor trees like SAVE_EXPR that can induce language-specific trees, nor trees like SAVE_EXPR that can induce
exponential search behavior. */ exponential search behavior. */
...@@ -2568,7 +2568,7 @@ gimplify_init_constructor (tree *expr_p, tree *pre_p, ...@@ -2568,7 +2568,7 @@ gimplify_init_constructor (tree *expr_p, tree *pre_p,
} }
/* If there are "lots" of initialized elements, even discounting /* If there are "lots" of initialized elements, even discounting
those that are not address constants (and thus *must* be those that are not address constants (and thus *must* be
computed at runtime), then partition the constructor into computed at runtime), then partition the constructor into
constant and non-constant parts. Block copy the constant constant and non-constant parts. Block copy the constant
parts in, then generate code for the non-constant parts. */ parts in, then generate code for the non-constant parts. */
...@@ -2755,7 +2755,7 @@ gimplify_modify_expr_rhs (tree *expr_p, tree *from_p, tree *to_p, tree *pre_p, ...@@ -2755,7 +2755,7 @@ gimplify_modify_expr_rhs (tree *expr_p, tree *from_p, tree *to_p, tree *pre_p,
case COND_EXPR: case COND_EXPR:
/* If we're assigning to a non-register type, push the assignment /* If we're assigning to a non-register type, push the assignment
down into the branches. This is mandatory for ADDRESSABLE types, down into the branches. This is mandatory for ADDRESSABLE types,
since we cannot generate temporaries for such, but it saves a since we cannot generate temporaries for such, but it saves a
copy in other cases as well. */ copy in other cases as well. */
if (!is_gimple_reg_type (TREE_TYPE (*from_p))) if (!is_gimple_reg_type (TREE_TYPE (*from_p)))
{ {
...@@ -2924,10 +2924,10 @@ gimplify_boolean_expr (tree *expr_p) ...@@ -2924,10 +2924,10 @@ gimplify_boolean_expr (tree *expr_p)
PRE_P points to the list where the side effects for all the PRE_P points to the list where the side effects for all the
expressions in the sequence will be emitted. expressions in the sequence will be emitted.
WANT_VALUE is true when the result of the last COMPOUND_EXPR is used. */ WANT_VALUE is true when the result of the last COMPOUND_EXPR is used. */
/* ??? Should rearrange to share the pre-queue with all the indirect /* ??? Should rearrange to share the pre-queue with all the indirect
invocations of gimplify_expr. Would probably save on creations invocations of gimplify_expr. Would probably save on creations
of statement_list nodes. */ of statement_list nodes. */
static enum gimplify_status static enum gimplify_status
...@@ -3737,7 +3737,7 @@ gimplify_expr (tree *expr_p, tree *pre_p, tree *post_p, ...@@ -3737,7 +3737,7 @@ gimplify_expr (tree *expr_p, tree *pre_p, tree *post_p,
*expr_p = NULL_TREE; *expr_p = NULL_TREE;
} }
ret = GS_ALL_DONE; ret = GS_ALL_DONE;
break; break;
...@@ -3825,7 +3825,7 @@ gimplify_expr (tree *expr_p, tree *pre_p, tree *post_p, ...@@ -3825,7 +3825,7 @@ gimplify_expr (tree *expr_p, tree *pre_p, tree *post_p,
case WITH_SIZE_EXPR: case WITH_SIZE_EXPR:
{ {
enum gimplify_status r0, r1; enum gimplify_status r0, r1;
r0 = gimplify_expr (&TREE_OPERAND (*expr_p, 0), pre_p, r0 = gimplify_expr (&TREE_OPERAND (*expr_p, 0), pre_p,
post_p == &internal_post ? NULL : post_p, post_p == &internal_post ? NULL : post_p,
gimple_test_f, fallback); gimple_test_f, fallback);
r1 = gimplify_expr (&TREE_OPERAND (*expr_p, 1), pre_p, post_p, r1 = gimplify_expr (&TREE_OPERAND (*expr_p, 1), pre_p, post_p,
...@@ -3837,7 +3837,7 @@ gimplify_expr (tree *expr_p, tree *pre_p, tree *post_p, ...@@ -3837,7 +3837,7 @@ gimplify_expr (tree *expr_p, tree *pre_p, tree *post_p,
/* ??? If this is a local variable, and it has not been seen in any /* ??? If this is a local variable, and it has not been seen in any
outer BIND_EXPR, then it's probably the result of a duplicate outer BIND_EXPR, then it's probably the result of a duplicate
declaration, for which we've already issued an error. It would declaration, for which we've already issued an error. It would
be really nice if the front end wouldn't leak these at all. be really nice if the front end wouldn't leak these at all.
Currently the only known culprit is C++ destructors, as seen Currently the only known culprit is C++ destructors, as seen
in g++.old-deja/g++.jason/binding.C. */ in g++.old-deja/g++.jason/binding.C. */
tmp = *expr_p; tmp = *expr_p;
...@@ -3881,7 +3881,7 @@ gimplify_expr (tree *expr_p, tree *pre_p, tree *post_p, ...@@ -3881,7 +3881,7 @@ gimplify_expr (tree *expr_p, tree *pre_p, tree *post_p,
goto expr_2; goto expr_2;
ret = gimplify_variable_sized_compare (expr_p); ret = gimplify_variable_sized_compare (expr_p);
break; break;
/* If *EXPR_P does not need to be special-cased, handle it /* If *EXPR_P does not need to be special-cased, handle it
according to its class. */ according to its class. */
case tcc_unary: case tcc_unary:
...@@ -3893,21 +3893,21 @@ gimplify_expr (tree *expr_p, tree *pre_p, tree *post_p, ...@@ -3893,21 +3893,21 @@ gimplify_expr (tree *expr_p, tree *pre_p, tree *post_p,
expr_2: expr_2:
{ {
enum gimplify_status r0, r1; enum gimplify_status r0, r1;
r0 = gimplify_expr (&TREE_OPERAND (*expr_p, 0), pre_p, r0 = gimplify_expr (&TREE_OPERAND (*expr_p, 0), pre_p,
post_p, is_gimple_val, fb_rvalue); post_p, is_gimple_val, fb_rvalue);
r1 = gimplify_expr (&TREE_OPERAND (*expr_p, 1), pre_p, r1 = gimplify_expr (&TREE_OPERAND (*expr_p, 1), pre_p,
post_p, is_gimple_val, fb_rvalue); post_p, is_gimple_val, fb_rvalue);
ret = MIN (r0, r1); ret = MIN (r0, r1);
break; break;
} }
case tcc_declaration: case tcc_declaration:
case tcc_constant: case tcc_constant:
ret = GS_ALL_DONE; ret = GS_ALL_DONE;
goto dont_recalculate; goto dont_recalculate;
default: default:
gcc_assert (TREE_CODE (*expr_p) == TRUTH_AND_EXPR gcc_assert (TREE_CODE (*expr_p) == TRUTH_AND_EXPR
|| TREE_CODE (*expr_p) == TRUTH_OR_EXPR || TREE_CODE (*expr_p) == TRUTH_OR_EXPR
...@@ -3919,7 +3919,7 @@ gimplify_expr (tree *expr_p, tree *pre_p, tree *post_p, ...@@ -3919,7 +3919,7 @@ gimplify_expr (tree *expr_p, tree *pre_p, tree *post_p,
dont_recalculate: dont_recalculate:
break; break;
} }
/* If we replaced *expr_p, gimplify again. */ /* If we replaced *expr_p, gimplify again. */
if (ret == GS_OK && (*expr_p == NULL || *expr_p == save_expr)) if (ret == GS_OK && (*expr_p == NULL || *expr_p == save_expr))
ret = GS_ALL_DONE; ret = GS_ALL_DONE;
......
...@@ -3559,7 +3559,6 @@ extern enum built_in_function builtin_mathfn_code (tree); ...@@ -3559,7 +3559,6 @@ extern enum built_in_function builtin_mathfn_code (tree);
extern tree build_function_call_expr (tree, tree); extern tree build_function_call_expr (tree, tree);
extern tree mathfn_built_in (tree, enum built_in_function fn); extern tree mathfn_built_in (tree, enum built_in_function fn);
extern tree strip_float_extensions (tree); extern tree strip_float_extensions (tree);
extern tree simplify_builtin (tree, int);
extern tree c_strlen (tree, int); extern tree c_strlen (tree, int);
extern tree std_gimplify_va_arg_expr (tree, tree, tree *, tree *); extern tree std_gimplify_va_arg_expr (tree, tree, tree *, tree *);
extern tree build_va_arg_indirect_ref (tree); extern tree build_va_arg_indirect_ref (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