Цитата:
what OMinc wanted to say by it?
the compiler use a simple register allocation,
it treats each statment as a allocate and release unit.
add CheckReg at end of each statement to warning some release work not done well.
and reset all workable registers used by next statement.
It used for checking the work of releasing regsiters ,warning for the compiler writer only.
Цитата:
For what a register output has been done in this case?
b := SHORT(SHORT(SHORT(SymRInt)))
it convert a longint to a byte at a Reg Mode:
longint
y occupy EDX:EAX,AH,AL,we should release EDX:EAX,AH,AL at the end of statment,
it had released EDX by first part of DevCPC486.ConvMove
Код:
| Int64:
IF xform IN {Bool..Int32, Char16} THEN
(* make range checks !!! *)
FreeHi(y) <<< EDX releasesd
END
END
but the second part has a bug:
Код:
ELSE (* x.form # real, y.form # real *)
y.form := xform; <<< this has a side effects,
IF mode = Stk THEN
IF ((xform < Int32) OR (xform = Char16)) & (y.mode # Reg) THEN LoadW(y, hint, stop) END;
Push(y);
ELSIF mode # Undef THEN
IF xform = Int64 THEN
IF y.mode # Reg THEN LoadLong(y, hint, stop); END;
Free(y); y.form := Int32;
z := x; z.form := Int32; DevCPL486.GenMove(y, z);
IF z.mode = Reg THEN ASSERT(z.reg # y.index); z.reg := z.index
ELSE INC(z.offset, 4)
END;
y.reg := y.index; DevCPL486.GenMove(y, z);
ELSE
IF y.mode # Reg THEN LoadW(y, hint, stop) END;
Free(y);<<<<the y.form is Int8,it only free AL
DevCPL486.GenMove(y, x)
END
END
END
END
END ConvMove;
the code y.form := xform; it had a side effects:y.form==Int64 ==> Int8
it make the code Free(y) does only free AL,but AH no relesed,so EAX no released.
the fixup make sure release AH register before release AL to release EAX;
Цитата:
And another question: why remove this output?
I don't know what your mean
luowy