|
From: M. F. F. <m_f...@ho...> - 2001-09-29 06:26:49
|
Hi all,
I hope my posting this time is usefull... and I need you to give me
tips/hints on how to compile C source code that use bit variables to get the
most size efficient machine code.
This is part of code I tried to compile using SDCC Winbin V221 and V222,
using same command line:
sdcc -I c:\sdcc\share\include -L c:\sdcc\share\lib\small --code-loc 0xC000
tester.c
#....
#define VSEL P3_2
#....
bit bVSEL,...;
void main ( void ) {
....
bVSEL = ~bVSEL;
VSEL = bVSEL;
status_bit();
....
}
... and look at the asm result:
===============
with V221..............
; tester.c 329
; Peephole 167 removed redundant bit moves (c not set to _bVSEL)
cpl _bVSEL
; tester.c 330
mov c,_bVSEL
mov _P3_2,c
; tester.c 331
lcall _status_bit
00101$:
C$tester.c$332$1$1 ==.
XG$toggle_vpp$0$0 ==.
ret
===============
with V222..............
; tester.c 329
clr a
mov c,_bVSEL
rlc a
cpl a
; Peephole 105 removed redundant mov
mov r2,a
clr c
jz 00103$
cpl c
00103$:
mov _bVSEL,c
; tester.c 330
mov c,_bVSEL
mov _P3_2,c
; tester.c 331
lcall _status_bit
00101$:
ret
And for those reasons, I am STILL going to use my old SDCC V221 Winbin... :(
though I really wanted to switch to newer version badly...
kind regards,
Fahmy
|