From: Theblond <the...@fr...> - 2010-08-25 16:54:01
|
Hello, for this reason, I try to avoid parameters in function calls. The think I do not understand, the allocation of temporary storage. Sometimes there is absolutely no need for the, but are allocated anyway. Theblond Sébastien Lorquet írta: > hello, > > I have a question about something I didn't find in the manual. > > With the pic16, we automatically have a stack. The resulting code is huge. > > char foo(char c, char d) { > return c+d; > } > > generates: > ; ; Starting pCode block > S_main__foo code > _foo: > ; .line 81; main.c char foo(char c, char d) { > MOVFF FSR2L, POSTDEC1 > MOVFF FSR1L, FSR2L > MOVFF r0x00, POSTDEC1 > MOVFF r0x01, POSTDEC1 > MOVLW 0x02 > MOVFF PLUSW2, r0x00 > MOVLW 0x03 > MOVFF PLUSW2, r0x01 > ; .line 82; main.c return c+d; > MOVF r0x01, W > ADDWF r0x00, F > MOVF r0x00, W > MOVFF PREINC1, r0x01 > MOVFF PREINC1, r0x00 > MOVFF PREINC1, FSR2L > RETURN > > This is a very big overhead. and every movff counts for 2 instructions. > > But on the contrary, the 8051 port maps its local variables and > parameters in normal ram, managing the overlaps. > > Why can't we use such a data model for the pic port? > > this would make a much more compact code. > > Regards > Sebastien > > > ------------------------------------------------------------------------ > > ------------------------------------------------------------------------------ > Sell apps to millions through the Intel(R) Atom(Tm) Developer Program > Be part of this innovative community and reach millions of netbook users > worldwide. Take advantage of special opportunities to increase revenue and > speed time-to-market. Join now, and jumpstart your future. > http://p.sf.net/sfu/intel-atom-d2d > > > ------------------------------------------------------------------------ > > _______________________________________________ > Sdcc-user mailing list > Sdc...@li... > https://lists.sourceforge.net/lists/listinfo/sdcc-user |