Sławomir Kawa schreef op 2020-06-16 00:45:
pon., 15 cze 2020 o 11:05 Maarten Brock <sourceforge.br...@dse.nl>
napisał(a):

This sounds like an excellent job for the peephole optimizer.
Are there restrictions on the operand that should be checked?

Maarten


I have created following peephole rule for my if statement:

replace {
    mov a, __pa
    and a, #0x10
    cneqsn a, #0x00
    goto %1
} by {
    ; peephole PA4 check optimization.
    t1sn __pa, #4
    goto %1
}

I didn't use a pattern variable as __pa because i want to have more
control, at least for now. The problem for me is that in C bit position is specified as bitmash ( byte & 0x10) while tXsn takes bit number (#4) and I don't know how to create a rule that converts bit number as bitmask to bit number. I could create 8 rules foreach tXsn with different bit numbers :/

I would just create 8 rules for now.

Maarten


_______________________________________________
Sdcc-user mailing list
Sdcc-user@lists.sourceforge.net
https://lists.sourceforge.net/lists/listinfo/sdcc-user

Reply via email to