#173 Patch on the PIC16's branch

open
None
5
2012-05-05
2012-02-27
Borut Ražem
No

Molnár Károly sent me the following mail 2012-02-27. The patch file is attached.

---8<----

Respected Borut Razem!

My english is very small, so the translate.google.com to translate the text.
The spot on which to send the PIC16 line, some optimizations and small fixes.

sdcc/src/pic16/device.c:

There are only two small adjustments.

-----------------------------------------------------------------------

sdcc/src/pic16/genarith.c:

Increasing multi-byte variable. In some cases, shorter or faster code. The WREG
register to distinguish and avoid unnecessary operations. Monitors the contents
of WREG and not loaded again the same value. The multiplication of two members
of one may be the WREG and the result could be here. The result "may" also
register the PRODL. Since it is already so prevent unnecessary duplication:
MOVFF PRODL, PRODL

-----------------------------------------------------------------------

sdcc/src/pic16/gen.c:

In large part the use of optimized WREG register. The code avoids the
unnecessary constant refilling. Any such action is meaningless: MOVF WREG, W

Prevents the PCL and the INTCON register MOVFF into the instruction data to be
loaded:

MOVFF xxx_reg, PCL

instead of:

MOVF xxx_reg, W
MOVWF PCL

The stack is also used by change:

MOVLW 0xFF
MOVWF POSTDEC1

instead of:

SETF POSTDEC1

or:

MOVLW 0x00
MOVWF POSTDEC1

instead of:

CLRF POSTDEC1

The stack fragment repeated release. Therefore, put through a process and it is
optimized. The interrupt handling of registers to save a little different. It
also stands for the code and speed up the goal. So far this was:

MOVFF WREG, POSTDEC1
MOVFF STATUS, POSTDEC1
MOVFF BSR, POSTDEC1

It now looks like this:

MOVFF STATUS, POSTDEC1
MOVFF BSR, POSTDEC1
MOVWF POSTDEC1

Restore:

MOVFF PREINC1, BSR
MOVFF PREINC1, STATUS
MOVFF PREINC1, WREG

Instead:

MOVF PREINC1, W
MOVFF PREINC1, BSR
MOVFF PREINC1, STATUS

Shorter than the code.
The comparison is optimization. The AND, OR and XOR operations are also
optimization. The shift operations which can be used MOVFF instructions. Some
constant shift operation performed optimized. The jump table start code does
not use a temporary register.

-----------------------------------------------------------------------

sdcc/src/pic16/glue.c:

If a global variable is not static and will be included in the published list.
Small changes in the formatting of text.

emitStatistics() function:

The isize udsize and the calculation of the value of the sign was a mistake.

-----------------------------------------------------------------------

sdcc/src/pic16/pcode.c:

Three minor improvements. (The first of these is essential.)

-----------------------------------------------------------------------

I hope that made ​​sense to work.

Best regards: Molnár Károly

Discussion

  • Raphael Neider
    Raphael Neider
    2012-05-05

    • assigned_to: nobody --> tecodev