On 16.02.2015 23:20, Alan Cox wrote: >> Interestingly the code (bar4) that four times expands the whole >> 'get position' calculation is smaller (585 < 622) than the more >> conventionally coded subroutine (bar5) based version. >> >> And, maybe not surprisingly, it is about four times faster. >> (The execution times are of course estimate based on code >> size and the execution path assumption). >> >> Without testing conventional wisdom would have led me to >> believe that the macro version would be much bigger than >> the subroutine based one. > > I'm not actually surprised and I've seen similar in Z80 code generation. > SDCC isn't bright enough to do massive inlining of functions which means > it's also not bright enough to then realise that i is a constant in each > case. Very few compilers except gcc will figure that one out unaided.
Actually (with some exceptions in std lib functions), sdcc doesn't do anything fancy about inlining at all: we inline exactly the functions declared inline. Philipp
signature.asc
Description: OpenPGP digital signature
------------------------------------------------------------------------------ Download BIRT iHub F-Type - The Free Enterprise-Grade BIRT Server from Actuate! Instantly Supercharge Your Business Reports and Dashboards with Interactivity, Sharing, Native Excel Exports, App Integration & more Get technology previously reserved for billion-dollar corporations, FREE http://pubads.g.doubleclick.net/gampad/clk?id=190641631&iu=/4140/ostg.clktrk
_______________________________________________ Sdcc-user mailing list Sdcc-user@lists.sourceforge.net https://lists.sourceforge.net/lists/listinfo/sdcc-user