Disable sibcall optimization when -Os

Geoff Keating geoffk@geoffk.org
Sat Apr 12 02:14:00 GMT 2003


tm_gccmail@mail.kloo.net writes:

> On my testcases for the SH4, I see significant code expansion (~8%) when
> sibcall optimization is enabled due to:
> 
> 1) A bunch of register pushes (typically 8) generated (16 bytes or so)
> 
> 2) A BARRIER generated afterwards which forces 32-byte alignment
>    (average 16 bytes)
> 
> So every time it's invoked, it adds about 32 bytes to the code size.
> Therefore, I propose it be disabled when -Os is specified.

This sounds like a SH-specific issue; on powerpc, there's generally a
small (ok, 4 bytes) space saving.  The place to put such things is in
OPTIMIZATION_OPTIONS.

> 2003-04-11 Toshiyasu Morita <toshiyasu.morita@renesas.com>
> 
> 	* calls.c (expand_call): Disable sibcall optimization if
>         optimizing for size.
> 
> *** calls.c.bak	Fri Apr 11 19:01:45 2003
> --- calls.c	Fri Apr 11 19:15:30 2003
> *************** expand_call (exp, target, ignore)
> *** 2510,2515 ****
> --- 2510,2518 ----
>   #else
>         1
>   #endif
> +       /* Do not perform sibling call optimization when optimizing for size
> +          because the code size expansion can be significant.  */
> +       || optimize_size
>         || !try_tail_call
>         /* Doing sibling call optimization needs some work, since
>   	 structure_value_addr can be allocated on the stack.
> 
> 
> 

-- 
- Geoffrey Keating <geoffk@geoffk.org>



More information about the Gcc-patches mailing list