Code of Gcc is getting cleaner.
Gcc is used with avr chips and more systems are going embeded.
I have code for basic to c that does Optimization in a different way.
It calls the function replaced the call with the resualts.
Ok it can only do this if the function returns predictable out comes.
Ie the same return from the same args in.
All Optimization up to this point don't to anything to optimize the
calls to dlls and static libs.
Ok one stupid example
In the lib
int sqr(int x) {
return x*x;
}
In application
int main() {
int x =5
printf("The square %i is %i\n",x,sqr(x));
}
Note nothing will optimize down.
And with once off function calling with permitted functions in theory.
Printf would be replace with sprintf to get its new output and require
minor filtering.
int main() {
printf("The square 5 is 25\n");
}
Their is another to somewhere near this end is to add a optimizer to the
linker something the binutils linker has never had ssa has been added
to gcc but nothing like this is in the ld of binutils. The SSA
optimizations on the machine code I don't think it can be done maybe on
the objs with attachment infomation to C files? Can it be done I guess
that would be harder than dynamic linking to constant functions.
There would have to be opt files or something equal to tell gcc what to
do and a new flag to say that the function can be optimized out.
__optimizeout(theopt.opt)__ int sqr( int x); This is different to
Inline. Number one if it cannot optimize out it calls the dll/so.
Keeping code size to a min and speed high. Maybe a different form of
Inline could be used. Yes I know this would be a slower build but
faster and smaller code can be worth it.
Peter Dolding