This is the mail archive of the gcc-patches@gcc.gnu.org mailing list for the GCC project.


Index Nav: [Date Index] [Subject Index] [Author Index] [Thread Index]
Message Nav: [Date Prev] [Date Next] [Thread Prev] [Thread Next]

Re: Fix for Thumb compiling va-arg-11.c


> : Using this method there would still be a small number of functions where 
> : we would unnecessarily push lr in the prologue, but they would be very 
> : rare.  I doubt that we would really find many cases where we were 
> : pessimistic.
> 
> Well the test case va-arg-11.c triggers this result.

Yes, but this isn't a very useful function as it stands.  How many *real* 
leaf functions are going to take 5 or more argument (or be variadic) and 
then not do something sufficiently complex to require at least one stacked 
register?

> 
> : Determining that afp was live before reload should be fairly straight 
> : forward (and probably quicker than testing the size of the function) -- 
> : something in INITIAL_ELIMINATION_OFFSET like
> : 
> : 	afp_was_live |= regs_ever_live[afp_regnum]
> : 
> : should do the trick (we could clear this at the end of each function).  
> : The OR is important since once we have eliminated afp into a real register 
> : it won't be marked live any more (I think).
> : 
> : The final part, of course, is that we always push lr in the prologue if 
> : afp_was_live is true and the code potentially contains a far_jump.
> 
> So here is a reworked version of the patch following the suggestions
> that you made.  I have tested it and it does fix the bug, and it does
> not introduce any new failures, although I think that we may end up
> with the redundant save and restore of LR more often than you think.
> 
> Shall I apply this version ?

Aesthetically, I think I'd prefer it if the arg-pointer liveness 
calculations weren't part of thumb_far_jump_used_p (they are orthogonal to 
whether or not a far jump is actually used); but other than that, this is 
OK.

R.

> 
> Cheers
> 	Nick
> 
> 2000-03-22  Nick Clifton  <nickc@cygnus.com>
> 
> 	* config/arm/arm.h (THUMB_INITIAL_ELIMINATION_OFFSET): Pass 0
> 	to thumb_far_jump_used_p.
> 
> 	* config/arm/arm-protos.h (thumb_far_jump_used_p): Take a
> 	single integer parameter.
> 
> 	* config/arm/arm.c (struct machine_function): Add two new
> 	fields, 'far_jump_used' and 'arg_pointer_live'.
> 	(thumb_far_jump_used_p): Once the decision has been made that
> 	far jumps might be used, always return true.
> 	If being called from the initial elimination offset macro then
> 	do not bother to perform the test if the arg pointer is not
> 	being used.
> 	(thumb_unexpand_epilogue): Pass 1 to thumb_far_jump_used_p().
> 	(output_thumb_prologue): Pass 1 to thumb_far_jump_used_p().
> 


Index Nav: [Date Index] [Subject Index] [Author Index] [Thread Index]
Message Nav: [Date Prev] [Date Next] [Thread Prev] [Thread Next]