piclist 2002\09\26\181233a >
Thread: How efficient Asm vs PB etc.
face BY : Russell McMahon email (remove spam text)

And .... :-)

It is POSSIBLE in very special circumstance for a compiler to produce code
which is so efficient that, if an assembler programmer ever produced the
same code,  you should immediately fire them for writing it. eg a relative
jump that jumps into the middle of a multibyte instuction that uses PART of
that instruction as a different instruction. I have seen that done (code was
probably written in assembler). Such techniques are entirely acceptable for
a machine based system as the assumptions and circumstances which allow them
to be made are tracked at compile time. For a human assembler to produce the
same result would require a level of documentation which nobody would ever
write and nobody else would ever read or understand and the conditional
assembly required to support it would be "interesting".

From a hypothetical machine & highly contrived program


26 02            bne    *+2                    ; branch if not equal to zero
4c                 enable interupts (say)
b6 86 04       ld        fred                   ; load acc from location

Here IF 86 04 is an immediate load of 04 to accumulator, then IF the
original bne fails the accumulator will load from fred (at $8604) and
interupts will be enabled, while if the bne branches the accumulator will
contain 04 and and interupts will not be enabled.

Changing the location of fred will cause this code to fail.
A compiler, albeit a VERY clever one, could do this.
A person never should.


http://www.piclist.com hint: The PICList is archived three different
ways.  See http://www.piclist.com/#archives for details.

<007201c265a9$db003ee0$b52900ca@lucy> 7bit

See also: www.piclist.com/techref/microchip/languages.htm?key=asm
Reply You must be a member of the piclist mailing list (not only a www.piclist.com member) to post to the piclist. This form requires JavaScript and a browser/email client that can handle form mailto: posts.
Subject (change) How efficient Asm vs PB etc.

month overview.

new search...