It will be really nice to have notUsed peephole function for 8051
Specially for this kind of cases:
199 ; sdcc-divulong.c:50: while (--count);
000068 E5*08 [12] 200 mov a,__divulong_count_65536_2
00006A 14 [12] 201 dec a
00006B FF [12] 202 mov r7,a
00006C 8F*08 [24] 203 mov __divulong_count_65536_2,r7
00006E 70 A6 [24] 204 jnz 00105$
Looks like perfect DJNZ candidate.
Fixed in SDCC [r11631].
It was not a peephole problem nor mcs51 only.
I do not get comment. It is 51 only related and it is peephole related.
What kind of comment were you expecting?
SDCC used to generate (during code generation, not peephole optimization) the DJNZ for this loop variable before 3.5.0. Yesterday I fixed this regression and now once again it is generated. The problem was not mcs51 related, but happened during Common SubExpression optimization (CSE) for all targets. Thus it is also not fixed with a peephole rule. See [r11631].
I do not understand how you can state that it is 51 only and that it is peephole related.
What am I missing?
It seems to me that the feature request was for notUsed() for the mcs51 peephole optimizer.
The djnz apparently was just meant as one example for something that could have been done with notUsed().
@spth Exactly.
May this feature reques be reopened?
My apologies for misunderstanding your request.