fixing these bugs:
Bug 1. [see partly-related bug #542397]
char z = RI;
return(2*TI - z);
Causes a fatal error in ralloc, line 1474,
"createRegMask cannot find
live range". The problem is that sdcc optimizes away
containing 'z', and when doing this, it updates
for RI. But RI is a global, so when the register
allocator tries to
assign registers to all live ranges, it fails.
Bug 2. Same code, except that 'TI' and 'RI' are sbit
instead of bit.
sbits are volatile, and therefore the compiler should
out the temporary variable. Changed the optimizer to
check for volatile
symbols in this case and not mess with them.
Bug 3. [SF bug #542397]
return(2*TI - RI);
Causes a fatal error in the assembler --- wrong
addressing mode is emitted.
Bug 4. [similar to long-closed SF buf #447547]
return('0' + 2*TI + RI);
If bug 3 is fixed, you find that the code generated for
incorrect: it does not know that fetching RI involves
accumulator, and tries to leave the intermediate result
accumulator while fetching RI. Changed the register
(packRegsForAccUse()) to be smarter about whether the
next iCode is
going to clobber the accumulator, and changed the code
addition and subtraction to be smarter about what order
their operands in.
It's probably necessary for someone to go through all
2-operand code emitters and check whether they're
susceptible to the
same accumulator-clobbering bug.
Log in to post a comment.