diff options
author | steven <steven@138bc75d-0d04-0410-961f-82ee72b054a4> | 2005-01-26 15:08:50 +0000 |
---|---|---|
committer | steven <steven@138bc75d-0d04-0410-961f-82ee72b054a4> | 2005-01-26 15:08:50 +0000 |
commit | 6070c03585d1fbef96c79f02ee97abdfc64bef1f (patch) | |
tree | 001ffb21efda9c3fb69f2a80771b3f74a68f663a | |
parent | 58a1adeaea65751aa32d498fcaa0e7cbcacf535e (diff) | |
download | ppe42-gcc-6070c03585d1fbef96c79f02ee97abdfc64bef1f.tar.gz ppe42-gcc-6070c03585d1fbef96c79f02ee97abdfc64bef1f.zip |
PR middle-end/19616
* tree.h (CALL_EXPR_TAILCALL): Add comment.
* calls.c (check_sibcall_argument_overlap_1): Revert the change
to this function from 2004-07-10.
* tree-tailcall.c (suitable_for_tail_opt_p): Do not consider the
the current function for tail call optimizations if the address
of one of it its arguments is taken.
git-svn-id: svn+ssh://gcc.gnu.org/svn/gcc/trunk@94265 138bc75d-0d04-0410-961f-82ee72b054a4
-rw-r--r-- | gcc/ChangeLog | 24 | ||||
-rw-r--r-- | gcc/calls.c | 2 | ||||
-rw-r--r-- | gcc/tree-tailcall.c | 10 | ||||
-rw-r--r-- | gcc/tree.h | 3 |
4 files changed, 31 insertions, 8 deletions
diff --git a/gcc/ChangeLog b/gcc/ChangeLog index 202edce6dc1..ef8f274bc90 100644 --- a/gcc/ChangeLog +++ b/gcc/ChangeLog @@ -1,3 +1,13 @@ +2005-01-26 Steven Bosscher <stevenb@suse.de> + + PR middle-end/19616 + * tree.h (CALL_EXPR_TAILCALL): Add comment. + * calls.c (check_sibcall_argument_overlap_1): Revert the change + to this function from 2004-07-10. + * tree-tailcall.c (suitable_for_tail_opt_p): Do not consider the + the current function for tail call optimizations if the address + of one of it its arguments is taken. + 2005-01-26 Kazu Hirata <kazu@cs.umass.edu> * cse.c (fold_rtx): Call equiv_constant only when necessary. @@ -24,7 +34,7 @@ -lsyssim. Wrap -lc -lsyssim in --start-group --end-group instead of doubling. (STARTFILE_SPEC): Add crti.o, before crtbegin.o. - <sim*>: Always use crt1.o, regardless of N in simN. + <sim*>: Always use crt1.o, regardless of N in simN. <!sim>: Drop support for -pg and -p variants; always use crt0.o. (ENDFILE_SPEC): Add crtn.o, after crtend.o. (CRT_CALL_STATIC_FUNCTION): Remove. @@ -103,10 +113,10 @@ 2005-01-25 Alexandre Oliva <aoliva@redhat.com> - * config/frv/frv.h (ASM_OUTPUT_DWARF_DTPREL): Define. - * config/frv/frv-protos.h (frv_output_dwarf_dtprel): Declare. - * config/frv/frv.c (TLS_BIAS): Define. - (frv_output_dwarf_dtprel): New. + * config/frv/frv.h (ASM_OUTPUT_DWARF_DTPREL): Define. + * config/frv/frv-protos.h (frv_output_dwarf_dtprel): Declare. + * config/frv/frv.c (TLS_BIAS): Define. + (frv_output_dwarf_dtprel): New. 2005-01-26 Jakub Jelinek <jakub@redhat.com> @@ -436,7 +446,7 @@ first label to see if it is a nonlocal label. 2005-01-22 David Edelsohn <edelsohn@gnu.org> - Andrew Pinski <pinskia@physics.uc.edu> + Andrew Pinski <pinskia@physics.uc.edu> PR target/19491 * config/rs6000/rs6000.c (rs6000_va_start): Saturate n_gpr at @@ -2185,7 +2195,7 @@ 2004-01-05 Uros Bizjak <uros@kss-loka.si> * doc/invoke.texi (Intel 386 and AMD x86-64 Options): - Replace i387 with 'i386 compiler' in -mfpmath=sse option. + Replace i387 with 'i386 compiler' in -mfpmath=sse option. 2005-01-04 Roger Sayle <roger@eyesopen.com> diff --git a/gcc/calls.c b/gcc/calls.c index 9e228ac0e3f..291f88cb835 100644 --- a/gcc/calls.c +++ b/gcc/calls.c @@ -1670,7 +1670,7 @@ check_sibcall_argument_overlap_1 (rtx x) && GET_CODE (XEXP (XEXP (x, 0), 1)) == CONST_INT) i = INTVAL (XEXP (XEXP (x, 0), 1)); else - return 1; + return 0; #ifdef ARGS_GROW_DOWNWARD i = -i - GET_MODE_SIZE (GET_MODE (x)); diff --git a/gcc/tree-tailcall.c b/gcc/tree-tailcall.c index 5c5e09cce05..a76314bc835 100644 --- a/gcc/tree-tailcall.c +++ b/gcc/tree-tailcall.c @@ -159,6 +159,8 @@ suitable_for_tail_opt_p (void) static bool suitable_for_tail_call_opt_p (void) { + tree param; + /* alloca (until we have stack slot life analysis) inhibits sibling call optimizations, but not tail recursion. */ if (current_function_calls_alloca) @@ -176,6 +178,14 @@ suitable_for_tail_call_opt_p (void) if (current_function_calls_setjmp) return false; + /* ??? It is OK if the argument of a function is taken in some cases, + but not in all cases. See PR15387 and PR19616. Revisit for 4.1. */ + for (param = DECL_ARGUMENTS (current_function_decl); + param; + param = TREE_CHAIN (param)) + if (TREE_ADDRESSABLE (param)) + return false; + return true; } diff --git a/gcc/tree.h b/gcc/tree.h index 4fdff0c76e1..884f2c43d45 100644 --- a/gcc/tree.h +++ b/gcc/tree.h @@ -824,6 +824,9 @@ extern void tree_operand_check_failed (int, enum tree_code, had its address taken. That matters for inline functions. */ #define TREE_ADDRESSABLE(NODE) ((NODE)->common.addressable_flag) +/* Set on a CALL_EXPR if the call is in a tail position, ie. just before the + exit of a function. Calls for which this is true are candidates for tail + call optimizations. */ #define CALL_EXPR_TAILCALL(NODE) (CALL_EXPR_CHECK(NODE)->common.addressable_flag) /* In a VAR_DECL, nonzero means allocate static storage. |