Tail recursion and promoted args

Jan Hubicka hubicka@atrey.karlin.mff.cuni.cz
Sat Mar 25 14:30:00 GMT 2000


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;


More information about the Gcc-patches mailing list