LTO is optimizing over whole code.
I know what LTO does. It wasn't included in gcc3.
I have not test LTO on 4.5 if that work.maybe need a special linker.
According to
documentation you don't.
but what work since GCC 3 is the inline of a lib func so for short funcs you need no calls and so need not pass the registers on stack or register.
I do tests with the ixemul libc.a some time ago.
the sourcercode in libc.a is this
__attribute__((always_inline)) inline double hypot(double x,double y)
{
return sqrt(x*x+y*y);
}
this is the main source and create a ixemul prog (because only link with -ldebug)
#include
main(int argv,int argc)
{
double value;
value=hypot(argc,argv);
kprintf("%f\n",value);
}
I compile with -O1.
when i load the compiled exe in asm debugger it look as this.You see there is no call do and all is inline.
_main
+0000(10E33D22): LINK A5,#-$48
+0004(10E33D26): MOVEM.L D2-D3/A6,-(A7)
+0008(10E33D2A): BSR.L ___main ;10E340
+000E(10E33D30): FMOVE.L $C(A5),FP0
+0014(10E33D36): FMOVE.L 8(A5),FP1
+001A(10E33D3C): FMUL.X FP0,FP0
+001E(10E33D40): FMUL.X FP1,FP1
+0022(10E33D44): FADD.X FP1,FP0
+0026(10E33D48): FSQRT.X FP0
+002A(10E33D4C): FMOVE.D FP0,-(A7)
+002E(10E33D50): PEA _moncontrol+4(PC) ;10E33C84
+0032(10E33D54): BSR.L _kprintf ;10E33F74
How does that work exactly? If you have a function call to external function (and you don't use LTO), how can it replace the jump to the subroutine with other code?
If you mean you have to introduce all the inline functions in the headers then this is absolutely nothing new over gcc 2.x.