From: Scott Dattalo <scott@da...>  20001112 12:59:42

Before I ask my question, I'd like to say that I'm thoroughly impressed with SDCC. I've spent about 8 hours(+) going through the source and have found it to be easy to follow, and very well written.  I would like to port SDCC to the PIC. Specifically, I'll target the midrange (14bit core) devices. I've started with the mcs81 as a template. Gradually, I will remove the '51 stuff and replace it with the pic appropriate stuff. So far, I've gotten addition and subtraction working (these I knew would be easiest) and am now working through the boolean operators (first with `'). The approach I'll take is to work through all of the expression specific code and once I become intimately familiar with SDCC, work on the register allocation and function entry/exit code. (I know these last two will be very tough). The question: Is there any documentation for iCode? I've got SDCC generating pic code for: if(achar0  achar1) achar2 = 4; ; t.c 56 movf _achar0,w skpnz goto 00101$ movf _achar1,w skpz goto 00104$ 00101$: ; t.c 57 bsf _achar2,2 00104$: Which is pretty good. However, I'd like to get it to generate: ; t.56 movf _achar0,w iorwf _achar1,w skpnz ; t.57 bsf _achar2,2 The iCode SDCC generates (from t.dumpraw0) is: t.c(56:0:35:0:0) if _achar0 [k2 lr0:0 so:0]{ ia0 re0 rm0}{char } != 0 goto _iftrue_0($1)  Basic Block _eBBlock0 : loop Depth = 0 noPath = 0 , lastinLoop = 0 defines bitVector : local defines bitVector : pointers Set bitvector :  t.c(56:0:38:0:0) if _achar1 [k15 lr0:0 so:0]{ ia0 re0 rm0}{char } == 0 goto _return($4)  Basic Block _iftrue_0 : loop Depth = 0 noPath = 0 , lastinLoop = 0 defines bitVector : local defines bitVector : pointers Set bitvector :  t.c(56:0:40:0:0) _iftrue_0($1) : t.c(57:0:41:0:0) iTemp24 [k32 lr0:0 so:0]{ ia0 re0 rm0}{short } = _achar2 [k18 lr0:0 so:0]{ ia0 re0 rm0}{char }  0x4 {short } t.c(57:0:42:0:0) iTemp25 [k33 lr0:0 so:0]{ ia0 re0 rm0}{char } := iTemp24 [k32 lr0:0 so:0]{ ia0 re0 rm0}{short } t.c(57:0:43:0:0) _achar2 [k18 lr0:0 so:0]{ ia1 re0 rm0}{char } := iTemp25 [k33 lr0:0 so:0]{ ia0 re0 rm0}{char } What do ia0, re0, rm0, etc mean? I've found in SDCCicode.c where these get printed to the file, but it's still not too clear what it all means. I can figure out what each stands for (e.g. rm means rematerialization), but I don't know to interpret it. I'd like to parse the iCode to introduce further optimizations that are PIC specific. Or perhaps a better question is should I even worry about this? Scott 