« Return to Thread: : hitech compiler - deliberately generating poor code in free version?

Re: : hitech compiler - deliberately generating poor code in free version?

by Dario Greggio (in giro) :: Rate this Message:

Reply to Author | View in Thread

Isaac Marino Bavaresco ha scritto:

>>> Look how they do 'Var = 0;' :
>>>
>>> bcf    STATUS,C
>>> *movlw*   0
>>> btfsc   STATUS,C
>>> *movlw*   1
>>> movwf   Var
>>>    
>> Evaluate the right hand expression and put the result in something just big
>> enough (in this case the carry flag). Copy the result to the lvalue.

Hmmm, just a guess from my (limited) experience in writing compilers.

bcf    STATUS,C -> this is a generic "=0" for a bit-type operand

movlw   0
btfsc   STATUS,C
movlw   1
  movwf   Var
-> this is a generic "assign 1 or 0 to a 8bit variable.

Unless optimized further, the "1st step" of the C compiler will generate
this.




--
http://www.piclist.com PIC/SX FAQ & list archive
View/change your membership options at
http://mailman.mit.edu/mailman/listinfo/piclist

 « Return to Thread: : hitech compiler - deliberately generating poor code in free version?