Hi list,
Currently putchar is defined as
#define putchar(__c) fputc(__c, stdout)
which causes C code like this:
putchar(' ')
To generate assembler like this:
lds r22,__iob+2
lds r23,(__iob+2)+1
ldi r24,lo8(32)
ldi r25,hi8(32)
call fputc
This is 8 bytes (lds == 4 bytes) for loading the stream pointer.
If we change this to a "real" putchar call we would save 8 bytes per
putchar call. the putchar call would then load the correct stream:
int putchar(int c)
{
return fputc(stdout, c);
}
The cycle penalty would be the extra call and return.
IMHO losing 7,8 or 10 cycles per call for a gain of 8 bytes per call
seems very acceptable to me. Especially if it concerns functions like
putchar and friends.
Other opinions? Otherwise I will file a bug report.
Wouter
_______________________________________________
AVR-libc-dev mailing list
[email protected]
http://lists.nongnu.org/mailman/listinfo/avr-libc-dev