Disable sibcall optimization when -Os
Sat Apr 12 02:14:00 GMT 2003
> 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
> 2003-04-11 Toshiyasu Morita <firstname.lastname@example.org>
> * 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 ----
> + /* 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 <email@example.com>
More information about the Gcc-patches