??? 02/15/07 23:41 Read: times |
#133095 - Keil does this Responding to: ???'s previous message |
For the code:
unsigned char idata * data a; unsigned char idata * data b; void Func0() { *a++ = *b++; } void Func1() { *a = *b; ++a; ++b; }Keil produces: ; FUNCTION Func0 (BEGIN) R MOV R7,b R INC b XCH A,R0 MOV A,R7 XCH A,R0 MOV A,@R0 R MOV R6,a R INC a XCH A,R0 MOV A,R6 XCH A,R0 MOV @R0,A RET ; FUNCTION Func0 (END) ; FUNCTION Func1 (BEGIN) R MOV R0,b MOV A,@R0 R MOV R0,a MOV @R0,A R INC a R INC b RET ; FUNCTION Func1 (END)The problem is that Keil is determined to apply the post-increment prior to the dereference. There is no requirement to do this, and so I believe that the optimiser needs work in this area. The code of Func0 is improved (but not to the point of Func1) if I allow the use of absolute register addresses. |