peephole optimizer rules

Help
2004-12-27
2013-03-12
  • Maarten Brock

    Maarten Brock - 2004-12-27

    The question below was posted as a bug, which it is obviously not.

    The format of a rule file is like this :-

    replace
    {
    mov dpl,%1
    mov dph,(%1 + 1)
    }
    by
    {
    ; peephole custom rule, use DPTR as a single
    register.
    mov dptr,#%1
    }

    This tells the optimizer to change all the inefficient
    mov's to the single mov. It also places the comment in the file so you know why it is there. There are various other options you can put in the file, which are all fully covered in the manual. Be warned You can easily wreck things by using custom rules which cause bugs in your
    program. The compiler doesn't check you have done
    something stupid. so...

    Then how i decrement data pointer in my program?
    The below one is also not available-
    DEC DPTR

    Then how i should manage this ,pleas help me.

    with warm regards

    -sun

     
    • Maarten Brock

      Maarten Brock - 2004-12-27

      And the answer is:

      There is no opcode in the 8051 machine language to decrement the DPTR. The only option is to do it byte by byte. For example:

      dec DPL
      mov A,#0xFF
      cjne A,DPL,00001$
      dec DPH
      00001$:

      Good luck,
      Maarten

       

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

Sign up for the SourceForge newsletter:





No, thanks