This discussion has been locked.
You can no longer post new replies to this discussion. If you have a question you can start a new discussion

Why does compiler produce different code for 46: Disp=DispData8; C:0x02DD 908082 MOV DPTR,#Disp(0x8082) C:0x02E0 7438 MOV A,#0x38 C:0x02E2 F0 MOVX @DPTR,A 47: wait(22); C:0x02E3 7F16

Compiler produces different code for same line

Parents
  • So you decided to ignore the instructions for posting source code?

    The second write to Disp should be the same as the first

    Not at all.

    As said, the compiler is probably smart enough to realise that the DPTR is already correctly set.

    In fact, the optimiser might well decide that the 2nd write is entirely pointless - DispData8 hasn't changed been changed - and emit emit no code at all for it.

     

Reply
  • So you decided to ignore the instructions for posting source code?

    The second write to Disp should be the same as the first

    Not at all.

    As said, the compiler is probably smart enough to realise that the DPTR is already correctly set.

    In fact, the optimiser might well decide that the 2nd write is entirely pointless - DispData8 hasn't changed been changed - and emit emit no code at all for it.

     

Children