This is the mail archive of the
gcc-patches@gcc.gnu.org
mailing list for the GCC project.
Tail recursion and promoted args
- To: egcs-patches at egcs dot cygnus dot com, rth at cygnus dot com
- Subject: Tail recursion and promoted args
- From: Jan Hubicka <hubicka at atrey dot karlin dot mff dot cuni dot cz>
- Date: Sat, 25 Mar 2000 23:30:44 +0100
Hi
On i386 (and probably all other targets that promote args) function with
promoted calls is never optimized as tail recursive.
It fails test in tail_recursion_args. While I understand what the test
is trying to avoid (it is looking for c programs calling function with
something completely incompatible), I am not quite sure how to correctly
relax the test. This is my attempt. Maybe we can disable in completely,
the tail_recursion_args calls convert_move to ensure that arguments
are "unpromoted" again.
Honza
Sat Mar 25 23:19:44 CET 2000 Jan Hubicka <jh@suse.cz>
* stmt.c (tail_recursion_args): Be less curefull about matching
types.
*** stmt.c.old Sat Mar 25 14:08:35 2000
--- stmt.c Sat Mar 25 22:25:57 2000
*************** tail_recursion_args (actuals, formals)
*** 3149,3156 ****
for (a = actuals, f = formals, i = 0; a && f; a = TREE_CHAIN (a), f = TREE_CHAIN (f), i++)
{
! if (TYPE_MAIN_VARIANT (TREE_TYPE (TREE_VALUE (a)))
! != TYPE_MAIN_VARIANT (TREE_TYPE (f)))
return 0;
if (GET_CODE (DECL_RTL (f)) != REG || DECL_MODE (f) == BLKmode)
return 0;
--- 3149,3156 ----
for (a = actuals, f = formals, i = 0; a && f; a = TREE_CHAIN (a), f = TREE_CHAIN (f), i++)
{
! if (TREE_CODE (TYPE_MAIN_VARIANT (TREE_TYPE (TREE_VALUE (a))))
! != TREE_CODE (TYPE_MAIN_VARIANT (TREE_TYPE (f))))
return 0;
if (GET_CODE (DECL_RTL (f)) != REG || DECL_MODE (f) == BLKmode)
return 0;