On 12/12/2020 07:56, Philipp Klaus Krause wrote:
--fverbose-asm can be helpful to find out, you might also want to check,
if the difference is due to application of a previous peephole
(--fverbose-asm will mention so, --no-peep can disable them). If the
operations are the same, but differences are in the operands,
--i-code-in-asm might help find out.
For the first case, when I compile with all those flags, I get the
following:
; ic: 6: iTemp2 [k7 lr5:6 so:0]{ ia0 a2p0 re0 rm1 nos0 ru0
dp0}{struct __00000001 near* fixed}[xl xh ] = &[_global_0x8e [k6 lr0:0
so:0]{ ia0 a2p0 re0 rm0 nos0 ru0 dp0}{struct __00000001 fixed} , 0x0
{const-unsigned-char literal}]
; genAddrOf
ldw x, #_global_0x8e+0
; ic: 7: iTemp3 [k9 lr6:7 so:0]{ ia0 a2p0 re0 rm0 nos0 ru0
dp0}{unsigned-_Boolbitfield {4,1} near* fixed}[xl xh ] =
(unsigned-_Boolbitfield {4,1} near* fixed)iTemp2 [k7 lr5:6 so:0]{ ia0
a2p0 re0 rm1 nos0 ru0 dp0}{struct __00000001 near* fixed}[xl xh ]
; genCast
; genAssign
; ic: 8: iTemp4 [k10 lr7:8 so:0]{ ia0 a2p0 re0 rm0 nos0 ru0
dp0}{unsigned-_Boolbitfield {4,1} fixed}[a ] = @[iTemp3 [k9 lr6:7 so:0]{
ia1 a2p0 re0 rm0 nos0 ru0 dp0}{unsigned-_Boolbitfield {4,1} near*
fixed}[xl xh ] + 0x0 {const-unsigned-char literal}]
; genPointerGet
ld a, (x)
swap a
and a, #0x01
; ic: 9: if iTemp4 [k10 lr7:8 so:0]{ ia0 a2p0 re0 rm0 nos0 ru0
dp0}{unsigned-_Boolbitfield {4,1} fixed}[a ] == 0 goto preHeaderLbl1($16)
; genIfx
tnz a
jrne 00139$
jp 00116$
00139$:
And for the second case, I get:
; ic: 100: iTemp44 [k54 lr80:81 so:0]{ ia0 a2p0 re0 rm1 nos0 ru0
dp0}{volatile-struct __00000000 near* fixed}[remat] = &[_blah [k29 lr0:0
so:0]{ ia0 a2p0 re0 rm0 nos0 ru0 dp0}{volatile-struct __00000000 fixed}
, 0x0 {const-unsigned-char literal}]
; skipping iCode since result will be rematerialized
; ic: 101: iTemp45 [k56 lr81:82 so:0]{ ia0 a2p0 re0 rm0 nos0 ru0
dp0}{unsigned-_Boolbitfield {4,1} near* fixed}[xl xh ] =
(unsigned-_Boolbitfield {4,1} near* fixed)iTemp44 [k54 lr80:81 so:0]{
ia0 a2p0 re0 rm1 nos0 ru0 dp0}{volatile-struct __00000000 near*
fixed}[remat]
; genCast
; genAssign
ldw x, #(_blah + 0)
; ic: 102: iTemp46 [k57 lr82:83 so:0]{ ia0 a2p0 re0 rm0 nos0 ru0
dp0}{unsigned-_Boolbitfield {4,1} fixed}[a ] = @[iTemp45 [k56 lr81:82
so:0]{ ia1 a2p0 re0 rm0 nos0 ru0 dp0}{unsigned-_Boolbitfield {4,1} near*
fixed}[xl xh ] + 0x0 {const-unsigned-char literal}]
; genPointerGet
ld a, (x)
swap a
and a, #0x01
; ic: 103: if iTemp46 [k57 lr82:83 so:0]{ ia0 a2p0 re0 rm0 nos0
ru0 dp0}{unsigned-_Boolbitfield {4,1} fixed}[a ] == 0 goto __iffalse_8($21)
; genIfx
tnz a
jrne 00303$
jp 00121$
00303$:
It seems the peephole optimiser is only removing the TNZ - everything
else stayed the same - so it wasn't that. The differences I can see is
that in the first case the generation of the LDW involves genAddrOf, but
the second case does not.
Regards,
Basil Hussain
_______________________________________________
Sdcc-user mailing list
Sdcc-user@lists.sourceforge.net
https://lists.sourceforge.net/lists/listinfo/sdcc-user