Am 02.10.19 um 02:38 schrieb whitequark: > Hi, > > While optimizing some queue-related code I found a few peephole > optimizations that I think are missing (in sdcc 3.9).> I do not > have much experience with sdcc's optimizer so it might be that > it is not included for a good reason.
That's very hard to tell without even knowing which target these rules
should be used for. I'll have to make a few guesses bout the
sinstrcution set.
> Here's my def file:
>
> replace {
> mov a,%1
> inc a
> mov %1,a
> } by {
> ; Peephole ??? replaced inc with direct
> inc %1
> }
>
This ones leaves adifferent value in a. So it needs to be qualified with
notUsed (%1) - which might or might not be supported by the backend you
use. Another option could be:
replace {
mov a,%1
inc a
mov %1,a
} by {
; Peephole ??? replaced inc with direct
inc %1
mov a,%1
} if notVolatile(%1)
here we need the notVolatile(%1) since we are addign an extra read.
> replace {
> mov a,%1
> dec a
> mov %1,a
> } by {
> ; Peephole ??? replaced dec with direct
> dec %1
> }
Similar to above.
>
> replace {
> cjne %1,%2,%3
> clr c
> } by {
> cjne %1,%2,%3
> ; Peephole ??? removed redundant clr c
> }
That three-operand cjne doesn't look familiar to me. I'd really need to
know which architecture you want to apply this to before giving any opinion.
Philipp
signature.asc
Description: OpenPGP digital signature
_______________________________________________ Sdcc-user mailing list [email protected] https://lists.sourceforge.net/lists/listinfo/sdcc-user
