#31 Additional peephole rules for mcs51

Hubert Sack

I added some peephole rules for the mcs51 port.
In very short interrupt functions, if ending with an if /
then / else, 2 cycles can be saved (peepholes 262a/b).
Rules can be added for providing the case of more saved
The second set of peepholes (256g/h) removes some
rendundant "clr c".
At the moment i'm thinking about final optimizing after
the asm source is build.
If somebody wants to know, how I want to do that,
please tell me. If it will be finished I will send it as a RFE
together with the solution for the mcs51 port.


  • Hubert Sack

    Hubert Sack - 2004-12-10
    • priority: 5 --> 3
  • Frieder Ferlemann

    Logged In: YES

    Hi Hubert,
    your peepholes 262a/b save 2 cycles at the cost of adding 1
    or 3 byte code size. So far there are (to my knowledge) no
    peepholes which add to the code size to gain some speed.
    Depending on the specific application it might be
    controversial whether these peepholes are advantegous or not.
    Your application seems very time critical and built around
    the IRQ routine so you might make use of _asm _endasm ?

    The peephole "removing unrefenced label" is a subset of the

    replace {
    } by {
    ; removed unneeded label
    } if labelRefCount %2 0

    which I didn't dare to insert (it could trigger bugs like
    You'd need peephole 'conditionals' which increase/decrease
    labelRefCounts for rules like peephole 119. Nevertheless you
    could add a second condition to 256.g/h?

  • Hubert Sack

    Hubert Sack - 2005-07-15
    • status: open --> closed

Log in to post a comment.

Get latest updates about Open Source Projects, Conferences and News.

Sign up for the SourceForge newsletter:

No, thanks