From: Kim L. <lu...@di...> - 2005-11-23 21:30:31
|
On Wed, 2005-11-23 at 22:12 +0100, Bernhard Held wrote: > And for all the other questions: > use the source, luke! Thats nice to say, but it falls apart in practice. <getting on soapbox...> Here is what I don't like about open source: a) There is no documentation b) there isn't enough commentary in the code to figure it out, without being thoroughly familiar with it and if you were then you wouldn't need the comments in the first place. c) past developers don't want to be bothered to go back into their code to help new developers. So... if open source developers want open source apps to flourish, ie be maintained, extended, utilized, something has to change. Don't think I am picking on the sdcc community when I state this. gcc isn't any better and is probably worse. <off the soapbox> See the two examples below. Q1: From /mcs51, gen.c. Please explain this structure. static char *rb1regs[] = { "b1_0","b1_1","b1_2","b1_3","b1_4","b1_5","b1_6","b1_7", "b0", "b1", "b2", "b3", "b4", "b5", "b6", "b7" Notice there is no comment regarding these. For the record, I emailed someone in the mcs51 port and he couldn't explain them either. It looks like an array of registers, but it leaves some out as far as I can tell. Are these real physical registers or psuedo registers ? Q2: what is the significance of this table ? What does it do ? Where is it used and why ? I can see it is a list of opcodes, with probably read and write parameters. What is "j" about ? And why is this table needed in the first place ? I suspect it would be used in an optimization scheme where one could look and see if the destination register of one instruction could be used as the source register of another instruction. But... I am totally guessing and nothing in the code tells me that. See the problem ? static mcs51opcodedata mcs51opcodeDataTable[] = { {"acall","j", "", "", ""}, {"add", "", "w", "rw", "r"}, {"addc", "", "rw", "rw", "r"}, {"ajmp", "j", "", "", ""}, {"anl", "", "", "rw", "r"}, {"cjne", "j", "w", "r", "r"}, {"clr", "", "", "w", ""}, {"cpl", "", "", "rw", ""}, {"da", "", "rw", "rw", ""}, {"dec", "", "", "rw", ""}, {"div", "", "w", "rw", ""}, {"djnz", "j", "", "rw", ""}, {"inc", "", "", "rw", ""}, {"jb", "j", "", "r", ""}, {"jbc", "j", "", "rw", ""}, {"jc", "j", "", "", ""}, {"jmp", "j", "", "", ""}, {"jnb", "j", "", "r", ""}, {"jnc", "j", "", "", ""}, {"jnz", "j", "", "", ""}, {"jz", "j", "", "", ""}, {"lcall","j", "", "", ""}, {"ljmp", "j", "", "", ""}, {"mov", "", "", "w", "r"}, {"movc", "", "", "w", "r"}, {"movx", "", "", "w", "r"}, {"mul", "", "w", "rw", ""}, {"nop", "", "", "", ""}, {"orl", "", "", "rw", "r"}, {"pop", "", "", "w", ""}, {"push", "", "", "r", ""}, {"ret", "j", "", "", ""}, {"reti", "j", "", "", ""}, {"rl", "", "", "rw", ""}, {"rlc", "", "rw", "rw", ""}, {"rr", "", "", "rw", ""}, {"rrc", "", "rw", "rw", ""}, {"setb", "", "", "w", ""}, {"sjmp", "j", "", "", ""}, {"subb", "", "rw", "rw", "r"}, {"swap", "", "", "rw", ""}, {"xch", "", "", "rw", "rw"}, {"xchd", "", "", "rw", "rw"}, {"xrl", "", "", "rw", "r"}, }; -- Kim Lux, Diesel Research Inc. |