Michael Rigby-Jones escreveu: > = >> -----Original Message----- >> From: piclist-bounces@mit.edu [mailto:piclist-bounces@mit.edu] On >> = > Behalf > = >> Of Isaac Marino Bavaresco >> Sent: 26 May 2009 18:34 >> To: Microcontroller discussion list - Public. >> Subject: RE: [PIC] Source boost V HiTech compilers for C use >> >> >> Look how they do 'Var =3D 0;' : >> >> bcf STATUS,C >> movlw 0 >> btfsc STATUS,C >> movlw 1 >> movwf Var >> >> 'Var =3D 1;' >> >> clrf Var >> bsf STATUS,C >> rlf Var,f >> >> 'Var =3D 2;' >> >> clrw >> iorlw 2 >> movwf Temp >> movf Temp,w >> movwf Var >> >> And so on... >> = > > > I still don't think it's deliberate, most likely caused by the way the > new compilers work, with generation of intermediate P code as mentioned > by someone else. > = What can be less optimized than v =3D n -> movlw n/movwf v? Optimizations may be: v =3D 0 -> clrf v; v =3D 1 -> clrf v/incf v,f, etc... > FWIW the older compilers also produced some nonsense code for simple > expressions prior to optimisation, e.g. from one of my old projects > using PICC 8.05: > > > 148: if( TMR1IE && TMR1IF ) { > 0011 1683 BSF 0x3, 0x5 > 0012 1303 BCF 0x3, 0x6 > 0013 1C0C BTFSS 0xc, 0 > 0014 281B GOTO 0x1b > 0015 2816 GOTO 0x16 > 0016 1283 BCF 0x3, 0x5 > 0017 1C0C BTFSS 0xc, 0 > 0018 281B GOTO 0x1b > 0019 281A GOTO 0x1a > 001A 281D GOTO 0x1d > 001B 281C GOTO 0x1c > 001C 289C GOTO 0x9c > = Gotos are expected around code inside a if/else construct. When there is no else and the optimization is off, then you may expect gotos to gotos, worse if there are ifs inside ifs or elses. What code is inside the if? This is a completely different type of optimization. Just analyze the code for 'v =3D 0', in no conceivable way even a crap compiler may output this code. > Regards > > Mike > = Regards, Isaac __________________________________________________ Fa=E7a liga=E7=F5es para outros computadores com o novo Yahoo! Messenger = http://br.beta.messenger.yahoo.com/ = -- = http://www.piclist.com PIC/SX FAQ & list archive View/change your membership options at http://mailman.mit.edu/mailman/listinfo/piclist