Path: utzoo!attcan!uunet!husc6!bloom-beacon!mit-eddie!rutgers!ucsd!ucbvax!hplabs!hpda!hpcuhb!hpindda!vandys From: vandys@hpindda.HP.COM (Andy Valencia) Newsgroups: comp.os.minix Subject: Re: Re: GNU c and c++ under MINIX (long) Message-ID: <3580014@hpindda.HP.COM> Date: 16 Sep 88 20:43:03 GMT References: <2358@alliant.Alliant.COM> Organization: HP Information Networks, Cupertino, CA Lines: 32 / hpindda:comp.os.minix / rana@hpqtdla.HP.COM (Rana Raychoudhury) / 5:40 am Sep 15, 1988 / >Now, porting gcc to *minix* may not be a problem per se, but running gcc >on machines without certain features (above) will be. From the text above, >it would appear that porting gcc to Intel 80X8X architectures MAY be difficult. This sounds like the argument against pcc working on 8086s. No general registers, no auto increment/decrement, mov instruction doesn't set the flags, etc. I managed to tweak over the pcc in a couple of days. Wasn't too bad, either. Consider: AX, CX, DX - Perfectly good accumulators. I made them AREGs BX, SI, DI - Perfectly good pointers. BREGs. BP, SP, PC - Reserved. BP keeps the stack frame. DS, ES, CS, SS - Sorry, I did small model. SI and DI could be used as register variables, otherwise they were in the BREG pool. The Sethi-Ullman numbers guided the compiler in either case. It was interesting to watch the compiler adapt to various shortages of registers.... Because the pcc code templates could specify FORCC or not, I just made the obvious move template first, then had one which included FORCC next. The first one matched moves which only needed the effect; the second one matched moves whose result was desired. It was just like the first, but would generate an extra instruction to set the flags after the move. Without memory-memory moves, the data had to be in a register anyway, so it was pretty cheap. If any sites with V7 source would like to track my work, I'll be happy to supply diffs. It isn't easy to get a source license for a lowly PC, but it makes an amusing cross compiler! See the paper "A Tour through the Portable C Compiler" to get a better idea of how this stuff works. Andy