+ (de)allocation info for EDI to fix reported bug on mailinglist.

Also some (de)allocation info for ESI added. Between -dallocEDI
    because at this time of the night bugs could easily slip in ;)
This commit is contained in:
Jonas Maebe 2000-01-09 01:44:18 +00:00
parent 7a2344bd3f
commit 86ff0db0b5
10 changed files with 690 additions and 37 deletions

View File

@ -1053,12 +1053,26 @@ implementation
popedx:=true;
end;
{ p^.left^.location can be R_EAX !!! }
{$ifdef AllocEDI}
exprasmlist^.concat(new(pairegalloc,alloc(R_EDI)));
{$endif AllocEDI}
emitloadord2reg(p^.left^.location,u32bitdef,R_EDI,true);
emitloadord2reg(p^.right^.location,u32bitdef,R_EAX,true);
{$ifdef AllocEDI}
if R_EDX in unused then
exprasmlist^.concat(new(pairegalloc,alloc(R_EDX)));
{$endif AllocEDI}
emit_reg(A_MUL,S_L,R_EDI);
{$ifdef AllocEDI}
exprasmlist^.concat(new(pairegalloc,dealloc(R_EDI)));
{$endif AllocEDI}
emit_reg_reg(A_MOV,S_L,R_EAX,p^.location.register);
if popedx then
emit_reg(A_POP,S_L,R_EDX);
{$ifdef AllocEDI}
if R_EDX in unused then
exprasmlist^.concat(new(pairegalloc,dealloc(R_EDX)));
{$endif AllocEDI}
if popeax then
emit_reg(A_POP,S_L,R_EAX);
{$IfNDef NoShlMul}
@ -1152,20 +1166,31 @@ implementation
begin
if extra_not then
emit_reg(A_NOT,opsize,p^.location.register);
{$ifdef AllocEDI}
exprasmlist^.concat(new(pairegalloc,alloc(R_EDI)));
{$endif AllocEDI}
emit_reg_reg(A_MOV,opsize,p^.right^.location.register,R_EDI);
emit_reg_reg(op,opsize,p^.location.register,R_EDI);
emit_reg_reg(A_MOV,opsize,R_EDI,p^.location.register);
{$ifdef AllocEDI}
exprasmlist^.concat(new(pairegalloc,dealloc(R_EDI)));
{$endif AllocEDI}
end
else
begin
if extra_not then
emit_reg(A_NOT,opsize,p^.location.register);
{$ifdef AllocEDI}
exprasmlist^.concat(new(pairegalloc,alloc(R_EDI)));
{$endif AllocEDI}
emit_ref_reg(A_MOV,opsize,
newreference(p^.right^.location.reference),R_EDI);
emit_reg_reg(op,opsize,p^.location.register,R_EDI);
emit_reg_reg(A_MOV,opsize,R_EDI,p^.location.register);
{$ifdef AllocEDI}
exprasmlist^.concat(new(pairegalloc,dealloc(R_EDI)));
{$endif AllocEDI}
ungetiftemp(p^.right^.location.reference);
del_reference(p^.right^.location.reference);
end;
@ -1209,10 +1234,16 @@ implementation
begin
if extra_not then
begin
{$ifdef AllocEDI}
exprasmlist^.concat(new(pairegalloc,alloc(R_EDI)));
{$endif AllocEDI}
emit_reg_reg(A_MOV,S_L,p^.right^.location.register,R_EDI);
emit_reg(A_NOT,S_L,R_EDI);
emit_reg_reg(A_AND,S_L,R_EDI,
p^.location.register);
{$ifdef AllocEDI}
exprasmlist^.concat(new(pairegalloc,dealloc(R_EDI)));
{$endif AllocEDI}
end
else
begin
@ -1224,11 +1255,17 @@ implementation
begin
if extra_not then
begin
{$ifdef AllocEDI}
exprasmlist^.concat(new(pairegalloc,alloc(R_EDI)));
{$endif AllocEDI}
emit_ref_reg(A_MOV,S_L,newreference(
p^.right^.location.reference),R_EDI);
emit_reg(A_NOT,S_L,R_EDI);
emit_reg_reg(A_AND,S_L,R_EDI,
p^.location.register);
{$ifdef AllocEDI}
exprasmlist^.concat(new(pairegalloc,dealloc(R_EDI)));
{$endif AllocEDI}
end
else
begin
@ -1622,20 +1659,37 @@ implementation
begin
if p^.right^.location.loc=LOC_CREGISTER then
begin
{$ifdef AllocEDI}
exprasmlist^.concat(new(pairegalloc,alloc(R_EDI)));
{$endif AllocEDI}
emit_reg_reg(A_MOV,opsize,p^.right^.location.register,R_EDI);
emit_reg_reg(op,opsize,p^.location.register,R_EDI);
emit_reg_reg(A_MOV,opsize,R_EDI,p^.location.register);
{$ifdef AllocEDI}
exprasmlist^.concat(new(pairegalloc,dealloc(R_EDI)));
exprasmlist^.concat(new(pairegalloc,alloc(R_EDI)));
{$endif AllocEDI}
emit_reg_reg(A_MOV,opsize,p^.right^.location.registerhigh,R_EDI);
{ the carry flag is still ok }
emit_reg_reg(op2,opsize,p^.location.registerhigh,R_EDI);
emit_reg_reg(A_MOV,opsize,R_EDI,p^.location.registerhigh);
{$ifdef AllocEDI}
exprasmlist^.concat(new(pairegalloc,dealloc(R_EDI)));
{$endif AllocEDI}
end
else
begin
{$ifdef AllocEDI}
exprasmlist^.concat(new(pairegalloc,alloc(R_EDI)));
{$endif AllocEDI}
emit_ref_reg(A_MOV,opsize,
newreference(p^.right^.location.reference),R_EDI);
emit_reg_reg(op,opsize,p^.location.registerlow,R_EDI);
emit_reg_reg(A_MOV,opsize,R_EDI,p^.location.registerlow);
{$ifdef AllocEDI}
exprasmlist^.concat(new(pairegalloc,dealloc(R_EDI)));
exprasmlist^.concat(new(pairegalloc,alloc(R_EDI)));
{$endif AllocEDI}
hr:=newreference(p^.right^.location.reference);
inc(hr^.offset,4);
emit_ref_reg(A_MOV,opsize,
@ -1644,6 +1698,9 @@ implementation
emit_reg_reg(op2,opsize,p^.location.registerhigh,R_EDI);
emit_reg_reg(A_MOV,opsize,R_EDI,
p^.location.registerhigh);
{$ifdef AllocEDI}
exprasmlist^.concat(new(pairegalloc,dealloc(R_EDI)));
{$endif AllocEDI}
ungetiftemp(p^.right^.location.reference);
del_reference(p^.right^.location.reference);
end;
@ -1892,11 +1949,21 @@ implementation
if cmpop then
begin
if not(R_EAX in unused) then
emit_reg_reg(A_MOV,S_L,R_EAX,R_EDI);
begin
{$ifdef AllocEDI}
exprasmlist^.concat(new(pairegalloc,alloc(R_EDI)));
{$endif AllocEDI}
emit_reg_reg(A_MOV,S_L,R_EAX,R_EDI);
end;
emit_reg(A_FNSTSW,S_NO,R_AX);
emit_none(A_SAHF,S_NO);
if not(R_EAX in unused) then
emit_reg_reg(A_MOV,S_L,R_EDI,R_EAX);
begin
emit_reg_reg(A_MOV,S_L,R_EDI,R_EAX);
{$ifdef AllocEDI}
exprasmlist^.concat(new(pairegalloc,dealloc(R_EDI)));
{$endif AllocEDI}
end;
if p^.swaped then
begin
case p^.treetype of
@ -2076,6 +2143,9 @@ implementation
if p^.right^.location.loc=LOC_CMMXREGISTER then
begin
emit_reg_reg(A_MOVQ,S_NO,p^.right^.location.register,R_MM7);
{$ifdef AllocEDI}
{ where does the result of this (R_EDI) get used?? }
{$endif AllocEDI}
emit_reg_reg(op,S_NO,p^.location.register,R_EDI);
emit_reg_reg(A_MOVQ,S_NO,R_MM7,p^.location.register);
end
@ -2136,7 +2206,12 @@ implementation
end.
{
$Log$
Revision 1.84 2000-01-07 01:14:20 peter
Revision 1.85 2000-01-09 01:44:18 jonas
+ (de)allocation info for EDI to fix reported bug on mailinglist.
Also some (de)allocation info for ESI added. Between -dallocEDI
because at this time of the night bugs could easily slip in ;)
Revision 1.84 2000/01/07 01:14:20 peter
* updated copyright to 2000
Revision 1.83 1999/12/11 18:53:31 jonas

View File

@ -120,10 +120,16 @@ implementation
begin
if inlined then
begin
{$ifdef AllocEDI}
exprasmlist^.concat(new(pairegalloc,alloc(R_EDI)));
{$endif AllocEDI}
emit_ref_reg(A_LEA,S_L,
newreference(p^.left^.location.reference),R_EDI);
r:=new_reference(procinfo^.framepointer,para_offset-pushedparasize);
emit_reg_ref(A_MOV,S_L,R_EDI,r);
{$ifdef AllocEDI}
exprasmlist^.concat(new(pairegalloc,dealloc(R_EDI)));
{$endif AllocEDI}
end
else
emitpushreferenceaddr(p^.left^.location.reference);
@ -140,10 +146,16 @@ implementation
inc(pushedparasize,4);
if inlined then
begin
{$ifdef AllocEDI}
exprasmlist^.concat(new(pairegalloc,alloc(R_EDI)));
{$endif AllocEDI}
emit_ref_reg(A_LEA,S_L,
newreference(p^.left^.location.reference),R_EDI);
r:=new_reference(procinfo^.framepointer,para_offset-pushedparasize);
emit_reg_ref(A_MOV,S_L,R_EDI,r);
{$ifdef AllocEDI}
exprasmlist^.concat(new(pairegalloc,dealloc(R_EDI)));
{$endif AllocEDI}
end
else
emitpushreferenceaddr(p^.left^.location.reference);
@ -165,11 +177,17 @@ implementation
inc(pushedparasize,4);
if inlined then
begin
{$ifdef AllocEDI}
exprasmlist^.concat(new(pairegalloc,alloc(R_EDI)));
{$endif AllocEDI}
emit_ref_reg(A_LEA,S_L,
newreference(p^.left^.location.reference),R_EDI);
r:=new_reference(procinfo^.framepointer,para_offset-pushedparasize);
emit_reg_ref(A_MOV,S_L,
R_EDI,r);
{$ifdef AllocEDI}
exprasmlist^.concat(new(pairegalloc,dealloc(R_EDI)));
{$endif AllocEDI}
end
else
emitpushreferenceaddr(p^.left^.location.reference);
@ -405,11 +423,16 @@ implementation
{$endif not OLD_C_STACK}
if inlined then
begin
{$ifdef AllocEDI}
exprasmlist^.concat(new(pairegalloc,alloc(R_EDI)));
{$endif AllocEDI}
emit_ref_reg(A_LEA,S_L,
newreference(funcretref),R_EDI);
r:=new_reference(procinfo^.framepointer,inlinecode^.retoffset);
emit_reg_ref(A_MOV,S_L,
R_EDI,r);
emit_reg_ref(A_MOV,S_L,R_EDI,r);
{$ifdef AllocEDI}
exprasmlist^.concat(new(pairegalloc,dealloc(R_EDI)));
{$endif AllocEDI}
end
else
emitpushreferenceaddr(funcretref);
@ -755,6 +778,9 @@ implementation
r^.base:=R_ESI;
{ this is one point where we need vmt_offset (PM) }
r^.offset:= pprocdef(p^.procdefinition)^._class^.vmt_offset;
{$ifdef AllocEDI}
exprasmlist^.concat(new(pairegalloc,alloc(R_EDI)));
{$endif AllocEDI}
emit_ref_reg(A_MOV,S_L,r,R_EDI);
new(r);
reset_reference(r^);
@ -794,6 +820,9 @@ implementation
end;
{$endif TESTOBJEXT}
emit_ref(A_CALL,S_NO,r);
{$ifdef AllocEDI}
exprasmlist^.concat(new(pairegalloc,dealloc(R_EDI)));
{$endif AllocEDI}
end
else if not inlined then
emitcall(pprocdef(p^.procdefinition)^.mangledname)
@ -829,6 +858,9 @@ implementation
(p^.right^.location.reference.index=R_ESI) then
begin
del_reference(p^.right^.location.reference);
{$ifdef AllocEDI}
exprasmlist^.concat(new(pairegalloc,alloc(R_EDI)));
{$endif AllocEDI}
emit_ref_reg(A_MOV,S_L,
newreference(p^.right^.location.reference),R_EDI);
hregister:=R_EDI;
@ -849,7 +881,14 @@ implementation
if hregister=R_NO then
emit_ref(A_CALL,S_NO,newreference(p^.right^.location.reference))
else
emit_reg(A_CALL,S_NO,hregister);
begin
{$ifdef AllocEDI}
if hregister = R_EDI then
exprasmlist^.concat(new(pairegalloc,alloc(R_EDI)))
else ungetregister32(hregister);
{$endif AllocEDI}
emit_reg(A_CALL,S_NO,hregister);
end;
del_reference(p^.right^.location.reference);
end
@ -878,7 +917,15 @@ implementation
pop_size:=0;
{ better than an add on all processors }
if pushedparasize=4 then
emit_reg(A_POP,S_L,R_EDI)
begin
{$ifdef AllocEDI}
exprasmlist^.concat(new(pairegalloc,alloc(R_EDI)));
{$endif AllocEDI}
emit_reg(A_POP,S_L,R_EDI);
{$ifdef AllocEDI}
exprasmlist^.concat(new(pairegalloc,dealloc(R_EDI)));
{$endif AllocEDI}
end
{ the pentium has two pipes and pop reg is pairable }
{ but the registers must be different! }
else if (pushedparasize=8) and
@ -886,8 +933,20 @@ implementation
(aktoptprocessor=ClassP5) and
(procinfo^._class=nil) then
begin
{$ifdef AllocEDI}
exprasmlist^.concat(new(pairegalloc,alloc(R_EDI)));
{$endif AllocEDI}
emit_reg(A_POP,S_L,R_EDI);
{$ifdef AllocEDI}
exprasmlist^.concat(new(pairegalloc,dealloc(R_EDI)));
{$endif AllocEDI}
{$ifdef AllocEDI}
exprasmlist^.concat(new(pairegalloc,alloc(R_ESI)));
{$endif AllocEDI}
emit_reg(A_POP,S_L,R_ESI);
{$ifdef AllocEDI}
exprasmlist^.concat(new(pairegalloc,alloc(R_ESI)));
{$endif AllocEDI}
end
else if pushedparasize<>0 then
emit_const_reg(A_ADD,S_L,pushedparasize,R_ESP);
@ -1230,7 +1289,12 @@ implementation
end.
{
$Log$
Revision 1.114 2000-01-07 01:14:20 peter
Revision 1.115 2000-01-09 01:44:19 jonas
+ (de)allocation info for EDI to fix reported bug on mailinglist.
Also some (de)allocation info for ESI added. Between -dallocEDI
because at this time of the night bugs could easily slip in ;)
Revision 1.114 2000/01/07 01:14:20 peter
* updated copyright to 2000
Revision 1.113 1999/12/22 01:01:46 peter

View File

@ -98,6 +98,9 @@ implementation
else
begin
{ not so elegant (goes better with extra register }
{$ifdef AllocEDI}
exprasmlist^.concat(new(pairegalloc,alloc(R_EDI)));
{$endif AllocEDI}
if (p^.right^.location.loc in [LOC_REGISTER,LOC_CREGISTER]) then
begin
emit_reg_reg(A_MOV,S_L,makereg32(p^.right^.location.register),R_EDI);
@ -111,6 +114,9 @@ implementation
emit_const_reg(A_SHL,S_L,8,R_EDI);
emit_const_reg(A_OR,S_L,1,R_EDI);
emit_reg_ref(A_MOV,S_W,R_DI,newreference(p^.left^.location.reference));
{$ifdef AllocEDI}
exprasmlist^.concat(new(pairegalloc,dealloc(R_EDI)));
{$endif AllocEDI}
end;
end;
else
@ -695,6 +701,10 @@ implementation
if (pfrom^.location.loc=LOC_REGISTER) or
(pfrom^.location.loc=LOC_CREGISTER) then
begin
{$ifdef AllocEDI}
if not (porddef(pfrom^.resulttype)^.typ in [u32bit,s32bit,u64bit,s64bit]) then
exprasmlist^.concat(new(pairegalloc,alloc(R_EDI)));
{$endif AllocEDI}
case porddef(pfrom^.resulttype)^.typ of
s8bit : emit_reg_reg(A_MOVSX,S_BL,pfrom^.location.register,R_EDI);
u8bit : emit_reg_reg(A_MOVZX,S_BL,pfrom^.location.register,R_EDI);
@ -713,6 +723,9 @@ implementation
else
begin
r:=newreference(pfrom^.location.reference);
{$ifdef AllocEDI}
exprasmlist^.concat(new(pairegalloc,alloc(R_EDI)));
{$endif AllocEDI}
case porddef(pfrom^.resulttype)^.typ of
s8bit:
emit_ref_reg(A_MOVSX,S_BL,r,R_EDI);
@ -738,6 +751,10 @@ implementation
end;
{ for 64 bit integers, the high dword is already pushed }
emit_reg(A_PUSH,S_L,hregister);
{$ifdef AllocEDI}
if hregister = R_EDI then
exprasmlist^.concat(new(pairegalloc,dealloc(R_EDI)));
{$endif AllocEDI}
r:=new_reference(R_ESP,0);
case porddef(pfrom^.resulttype)^.typ of
u32bit:
@ -757,10 +774,16 @@ implementation
{ if it is 1 then we add $80000000 000000000 }
{ as double }
inc(r^.offset,4);
{$ifdef AllocEDI}
exprasmlist^.concat(new(pairegalloc,alloc(R_EDI)));
{$endif AllocEDI}
emit_ref_reg(A_MOV,S_L,r,R_EDI);
r:=new_reference(R_ESP,4);
emit_const_ref(A_AND,S_L,$7fffffff,r);
emit_const_reg(A_AND,S_L,$80000000,R_EDI);
emit_const_reg(A_TEST,S_L,$80000000,R_EDI);
{$ifdef AllocEDI}
exprasmlist^.concat(new(pairegalloc,dealloc(R_EDI)));
{$endif AllocEDI}
r:=new_reference(R_ESP,0);
emit_ref(A_FILD,S_IQ,r);
getdatalabel(l1);
@ -779,7 +802,13 @@ implementation
else
begin
emit_ref(A_FILD,S_IL,r);
{$ifdef AllocEDI}
exprasmlist^.concat(new(pairegalloc,alloc(R_EDI)));
{$endif AllocEDI}
emit_reg(A_POP,S_L,R_EDI);
{$ifdef AllocEDI}
exprasmlist^.concat(new(pairegalloc,dealloc(R_EDI)));
{$endif AllocEDI}
end;
end;
inc(fpuvaroffset);
@ -818,7 +847,13 @@ implementation
rreg:=getregister32;
emit_reg(A_POP,S_L,rreg);
{ better than an add on all processors }
{$ifdef AllocEDI}
exprasmlist^.concat(new(pairegalloc,alloc(R_EDI)));
{$endif AllocEDI}
emit_reg(A_POP,S_L,R_EDI);
{$ifdef AllocEDI}
exprasmlist^.concat(new(pairegalloc,dealloc(R_EDI)));
{$endif AllocEDI}
clear_location(pto^.location);
pto^.location.loc:=LOC_REGISTER;
@ -1355,19 +1390,31 @@ implementation
r^.base:=p^.location.register
else
begin
{$ifdef AllocEDI}
exprasmlist^.concat(new(pairegalloc,alloc(R_EDI)));
{$endif AllocEDI}
emit_mov_loc_reg(p^.location,R_EDI);
r^.base:=R_EDI;
end;
{ NIL must be accepted !! }
emit_reg_reg(A_OR,S_L,r^.base,r^.base);
{$ifdef AllocEDI}
exprasmlist^.concat(new(pairegalloc,dealloc(R_EDI)));
{$endif AllocEDI}
getlabel(nillabel);
emitjmp(C_E,nillabel);
{ this is one point where we need vmt_offset (PM) }
r^.offset:= pobjectdef(ppointerdef(p^.resulttype)^.definition)^.vmt_offset;
{$ifdef AllocEDI}
exprasmlist^.concat(new(pairegalloc,alloc(R_EDI)));
{$endif AllocEDI}
emit_ref_reg(A_MOV,S_L,r,R_EDI);
emit_sym(A_PUSH,S_L,
newasmsymbol(pobjectdef(ppointerdef(p^.resulttype)^.definition)^.vmt_mangledname));
emit_reg(A_PUSH,S_L,R_EDI);
{$ifdef AllocEDI}
exprasmlist^.concat(new(pairegalloc,dealloc(R_EDI)));
{$endif AllocEDI}
emitcall('FPC_CHECK_OBJECT_EXT');
emitlab(nillabel);
end;
@ -1486,7 +1533,12 @@ implementation
end.
{
$Log$
Revision 1.98 2000-01-07 01:14:20 peter
Revision 1.99 2000-01-09 01:44:19 jonas
+ (de)allocation info for EDI to fix reported bug on mailinglist.
Also some (de)allocation info for ESI added. Between -dallocEDI
because at this time of the night bugs could easily slip in ;)
Revision 1.98 2000/01/07 01:14:20 peter
* updated copyright to 2000
Revision 1.97 1999/12/22 01:01:46 peter

View File

@ -191,6 +191,9 @@ implementation
reset_reference(r^);
r^.symbol:=newasmsymbol(
'U_'+upper(target_info.system_unit)+io[doread]);
{$ifdef AllocEDI}
exprasmlist^.concat(new(pairegalloc,alloc(R_EDI)));
{$endif AllocEDI}
emit_ref_reg(A_LEA,S_L,r,R_EDI)
end;
@ -233,6 +236,9 @@ implementation
loadstream;
{ save @aktfile in temporary variable }
emit_reg_ref(A_MOV,S_L,R_EDI,newreference(aktfile));
{$ifdef AllocEDI}
exprasmlist^.concat(new(pairegalloc,dealloc(R_EDI)));
{$endif AllocEDI}
end
else
begin
@ -258,6 +264,9 @@ implementation
CGMessage(cg_e_illegal_expression);
exit;
end;
{$ifdef AllocEDI}
exprasmlist^.concat(new(pairegalloc,alloc(R_EDI)));
{$endif AllocEDI}
emit_ref_reg(A_LEA,S_L,newreference(node^.left^.location.reference),R_EDI);
@ -272,6 +281,9 @@ implementation
{ save @aktfile in temporary variable }
emit_reg_ref(A_MOV,S_L,R_EDI,newreference(aktfile));
{$ifdef AllocEDI}
exprasmlist^.concat(new(pairegalloc,dealloc(R_EDI)));
{$endif AllocEDI}
if doread then
{ parameter by READ gives call by reference }
dummycoll.paratyp:=vs_var
@ -298,7 +310,7 @@ implementation
if hp^.is_colon_para then
CGMessage(parser_e_illegal_colon_qualifier);
{ when float is written then we need bestreal to be pushed
convert here else we loose the old flaot type }
convert here else we loose the old float type }
if (not doread) and
(ft<>ft_typed) and
(hp^.left^.resulttype^.deftype=floatdef) then
@ -786,12 +798,21 @@ implementation
{load the address of the code parameter}
secondpass(code_para^.left);
{move the code to its destination}
{$ifdef AllocEDI}
exprasmlist^.concat(new(pairegalloc,alloc(R_EDI)));
{$endif AllocEDI}
emit_ref_reg(A_MOV,S_L,NewReference(hr),R_EDI);
emit_mov_reg_loc(R_DI,code_para^.left^.location);
{$ifdef AllocEDI}
exprasmlist^.concat(new(pairegalloc,dealloc(R_EDI)));
{$endif AllocEDI}
Disposetree(code_para);
End;
{restore the address of the result}
{$ifdef AllocEDI}
exprasmlist^.concat(new(pairegalloc,alloc(R_EDI)));
{$endif AllocEDI}
emit_reg(A_POP,S_L,R_EDI);
{set up hr2 to a refernce with EDI as base register}
@ -824,6 +845,9 @@ implementation
end;
End;
End;
{$ifdef AllocEDI}
exprasmlist^.concat(new(pairegalloc,dealloc(R_EDI)));
{$endif AllocEDI}
If (cs_check_range in aktlocalswitches) and
(dest_para^.left^.resulttype^.deftype = orddef) and
(not(is_64bitint(dest_para^.left^.resulttype))) and
@ -1356,6 +1380,9 @@ implementation
hregister:=p^.left^.right^.left^.location.register
else
begin
{$ifdef AllocEDI}
exprasmlist^.concat(new(pairegalloc,alloc(R_EDI)));
{$endif AllocEDI}
hregister:=R_EDI;
opsize:=def2def_opsize(p^.left^.right^.left^.resulttype,u32bitdef);
if opsize in [S_B,S_W,S_L] then
@ -1371,6 +1398,10 @@ implementation
else
emit_reg_reg(asmop,S_L,hregister,
p^.left^.left^.location.register);
{$ifdef AllocEDI}
if hregister = R_EDI then
exprasmlist^.concat(new(pairegalloc,dealloc(R_EDI)));
{$endif AllocEDI}
end
else
begin
@ -1479,7 +1510,12 @@ implementation
end.
{
$Log$
Revision 1.87 2000-01-07 01:14:20 peter
Revision 1.88 2000-01-09 01:44:19 jonas
+ (de)allocation info for EDI to fix reported bug on mailinglist.
Also some (de)allocation info for ESI added. Between -dallocEDI
because at this time of the night bugs could easily slip in ;)
Revision 1.87 2000/01/07 01:14:20 peter
* updated copyright to 2000
Revision 1.86 1999/12/22 01:01:46 peter

View File

@ -300,6 +300,9 @@ implementation
LOC_MEM,
LOC_REFERENCE:
begin
{$ifdef AllocEDI}
exprasmlist^.concat(new(pairegalloc,alloc(R_EDI)));
{$endif AllocEDI}
hregister:=R_EDI;
if pobjectdef(p^.left^.resulttype)^.is_class then
emit_ref_reg(A_MOV,S_L,
@ -343,9 +346,15 @@ implementation
{ ... and store it }
emit_reg_ref(A_MOV,S_L,
R_EDI,newreference(p^.location.reference));
{$ifdef AllocEDI}
exprasmlist^.concat(new(pairegalloc,dealloc(R_EDI)));
{$endif AllocEDI}
end
else
begin
{$ifdef AllocEDI}
exprasmlist^.concat(new(pairegalloc,dealloc(R_EDI)));
{$endif AllocEDI}
s:=newasmsymbol(pprocsym(p^.symtableentry)^.definition^.mangledname);
emit_sym_ofs_ref(A_MOV,S_L,s,0,
newreference(p^.location.reference));
@ -996,7 +1005,12 @@ implementation
end.
{
$Log$
Revision 1.94 2000-01-07 01:14:21 peter
Revision 1.95 2000-01-09 01:44:20 jonas
+ (de)allocation info for EDI to fix reported bug on mailinglist.
Also some (de)allocation info for ESI added. Between -dallocEDI
because at this time of the night bugs could easily slip in ;)
Revision 1.94 2000/01/07 01:14:21 peter
* updated copyright to 2000
Revision 1.93 1999/12/30 15:04:31 peter

View File

@ -52,7 +52,7 @@ implementation
procedure secondmoddiv(var p : ptree);
var
hreg1 : tregister;
hreg1, hreg2 : tregister;
shrdiv, andmod, pushed,popeax,popedx : boolean;
power : longint;
@ -137,15 +137,58 @@ implementation
"Cardinal($ffffffff) div 16" overflows! (JM)}
If is_signed(p^.left^.resulttype) Then
Begin
emit_reg_reg(A_OR,S_L,hreg1,hreg1);
getlabel(hl);
emitjmp(C_NS,hl);
if power=1 then
emit_reg(A_INC,S_L,hreg1)
{$ifdef newOptimizations}
If (aktOptProcessor <> class386) and
not(CS_LittleSize in aktglobalswitches) then
{ use a sequence without jumps, saw this in
comp.compilers (JM) }
begin
{ no jumps, but more operations }
if (hreg1 = R_EAX) and
(R_EDX in unused) then
begin
hreg2 := getexplicitregister32(R_EDX);
emit_none(A_CDQ,S_NO);
end
else
begin
{$ifdef AllocEDI}
exprasmlist^.concat(new(pairegalloc,alloc(R_EDI)));
{$endif AllocEDI}
hreg2 := R_EDI;
emit_reg_reg(A_MOV,S_L,hreg1,R_EDI);
{ if the left value is signed, R_EDI := $ffffffff,
otherwise 0 }
emit_const_reg(A_SAR,S_L,31,R_EDI);
{ if signed, R_EDI := right value-1, otherwise 0 }
end;
emit_const_reg(A_AND,S_L,p^.right^.value-1,hreg2);
{ add to the left value }
emit_reg_reg(A_ADD,S_L,hreg2,hreg1);
{ release EDX if we used it }
if (hreg2 = R_EDX) then
ungetregister32(hreg2)
{$ifdef AllocEDI}
else
exprasmlist^.concat(new(pairegalloc,dealloc(R_EDI)))
{$endif AllocEDI}
;
{ do the shift }
emit_const_reg(A_SAR,S_L,power,hreg1);
end
else
emit_const_reg(A_ADD,S_L,p^.right^.value-1,hreg1);
emitlab(hl);
emit_const_reg(A_SAR,S_L,power,hreg1);
{$endif newOptimizations}
begin
{ a jump, but less operations }
emit_reg_reg(A_TEST,S_L,hreg1,hreg1);
getlabel(hl);
emitjmp(C_NS,hl);
if power=1 then
emit_reg(A_INC,S_L,hreg1)
else
emit_const_reg(A_ADD,S_L,p^.right^.value-1,hreg1);
emitlab(hl);
end
End
Else
emit_const_reg(A_SHR,S_L,power,hreg1);
@ -164,6 +207,9 @@ implementation
{ EDI is always free, it's }
{ only used for temporary }
{ purposes }
{$ifdef AllocEDI}
exprasmlist^.concat(new(pairegalloc,alloc(R_EDI)));
{$endif AllocEDI}
if (p^.right^.location.loc<>LOC_REGISTER) and
(p^.right^.location.loc<>LOC_CREGISTER) then
begin
@ -215,6 +261,9 @@ implementation
emit_reg(A_DIV,S_L,R_EDI)
else
emit_reg(A_IDIV,S_L,R_EDI);
{$ifdef AllocEDI}
exprasmlist^.concat(new(pairegalloc,dealloc(R_EDI)));
{$endif AllocEDI}
if p^.treetype=divn then
begin
{ if result register is busy then copy }
@ -840,6 +889,9 @@ implementation
secondpass(p^.left);
p^.location.loc:=LOC_MMXREGISTER;
{ prepare EDI }
{$ifdef AllocEDI}
exprasmlist^.concat(new(pairegalloc,alloc(R_EDI)));
{$endif AllocEDI}
emit_const_reg(A_MOV,S_L,$ffffffff,R_EDI);
{ load operand }
case p^.left^.location.loc of
@ -860,6 +912,9 @@ implementation
end;
{ load mask }
emit_reg_reg(A_MOVD,S_NO,R_EDI,R_MM7);
{$ifdef AllocEDI}
exprasmlist^.concat(new(pairegalloc,dealloc(R_EDI)));
{$endif AllocEDI}
{ lower 32 bit }
emit_reg_reg(A_PXOR,S_D,R_MM7,p^.location.register);
{ shift mask }
@ -940,7 +995,12 @@ implementation
end.
{
$Log$
Revision 1.38 2000-01-07 01:14:21 peter
Revision 1.39 2000-01-09 01:44:20 jonas
+ (de)allocation info for EDI to fix reported bug on mailinglist.
Also some (de)allocation info for ESI added. Between -dallocEDI
because at this time of the night bugs could easily slip in ;)
Revision 1.38 2000/01/07 01:14:21 peter
* updated copyright to 2000
Revision 1.37 2000/01/07 00:12:10 peter

View File

@ -827,6 +827,9 @@ implementation
end
else
{ call can happend with a property }
{$ifdef AllocEDI}
exprasmlist^.concat(new(pairegalloc,alloc(R_EDI)));
{$endif AllocEDI}
if { (p^.left^.treetype=calln) and Don't think that
this is necessary (FK) }
(p^.left^.resulttype^.deftype=objectdef) and
@ -863,6 +866,9 @@ implementation
{ move to temp reference }
emit_reg_ref(A_MOV,S_L,
R_EDI,newreference(p^.withreference^));
{$ifdef AllocEDI}
exprasmlist^.concat(new(pairegalloc,dealloc(R_EDI)));
{$endif AllocEDI}
del_reference(p^.left^.location.reference);
end;
@ -885,7 +891,12 @@ implementation
end.
{
$Log$
Revision 1.66 2000-01-07 01:14:21 peter
Revision 1.67 2000-01-09 01:44:20 jonas
+ (de)allocation info for EDI to fix reported bug on mailinglist.
Also some (de)allocation info for ESI added. Between -dallocEDI
because at this time of the night bugs could easily slip in ;)
Revision 1.66 2000/01/07 01:14:21 peter
* updated copyright to 2000
Revision 1.65 2000/01/04 15:15:50 florian

View File

@ -371,6 +371,9 @@ implementation
{ the set element isn't never samller than a byte }
{ and because it's a small set we need only 5 bits }
{ but 8 bits are easier to load }
{$ifdef AllocEDI}
exprasmlist^.concat(new(pairegalloc,alloc(R_EDI)));
{$endif AllocEDI}
emit_ref_reg(A_MOVZX,S_BL,
newreference(p^.left^.location.reference),R_EDI);
hr:=R_EDI;
@ -400,6 +403,10 @@ implementation
newreference(p^.right^.location.reference));
end;
end;
{$ifdef AllocEDI}
if hr = R_EDI then
exprasmlist^.concat(new(pairegalloc,alloc(R_EDI)));
{$endif AllocEDI}
ungetregister32(hr);
p^.location.loc:=LOC_FLAGS;
p^.location.resflags:=F_C;
@ -898,7 +905,12 @@ implementation
end.
{
$Log$
Revision 1.45 2000-01-07 01:14:21 peter
Revision 1.46 2000-01-09 01:44:21 jonas
+ (de)allocation info for EDI to fix reported bug on mailinglist.
Also some (de)allocation info for ESI added. Between -dallocEDI
because at this time of the night bugs could easily slip in ;)
Revision 1.45 2000/01/07 01:14:21 peter
* updated copyright to 2000
Revision 1.44 1999/12/01 22:45:54 peter

View File

@ -448,6 +448,10 @@ procedure mov_reg_to_dest(p : ptree; s : topsize; reg : tregister);
S_W : hreg:=R_DI;
S_L : hreg:=R_EDI;
end;
{$ifdef AllocEDI}
if hreg in [R_DI,R_EDI] then
exprasmlist^.concat(new(pairegalloc,alloc(R_EDI)));
{$endif AllocEDI}
emit_ref_reg(A_MOV,siz,
newreference(t.reference),hreg);
del_reference(t.reference);
@ -460,6 +464,10 @@ procedure mov_reg_to_dest(p : ptree; s : topsize; reg : tregister);
else
ungetregister(hreg);
end;
{$ifdef AllocEDI}
if hreg in [R_DI,R_EDI] then
exprasmlist^.concat(new(pairegalloc,dealloc(R_EDI)));
{$endif AllocEDI}
{ we can release the registers }
{ but only AFTER the MOV! Important for the optimizer!
(JM)}
@ -698,10 +706,16 @@ procedure mov_reg_to_dest(p : ptree; s : topsize; reg : tregister);
internalerror(331)
else
begin
{$ifdef AllocEDI}
exprasmlist^.concat(new(pairegalloc,alloc(R_EDI)));
{$endif AllocEDI}
emit_ref_reg(A_LEA,S_L,
newreference(t.reference),R_EDI);
exprasmlist^.concat(new(paicpu,op_reg_ref(A_MOV,S_L,
R_EDI,newreference(ref))));
{$ifdef AllocEDI}
exprasmlist^.concat(new(pairegalloc,dealloc(R_EDI)));
{$endif AllocEDI}
end;
{ release the registers }
del_reference(t.reference);
@ -723,9 +737,15 @@ procedure mov_reg_to_dest(p : ptree; s : topsize; reg : tregister);
internalerror(331)
else
begin
{$ifdef AllocEDI}
exprasmlist^.concat(new(pairegalloc,alloc(R_EDI)));
{$endif AllocEDI}
emit_ref_reg(A_LEA,S_L,
newreference(t.reference),R_EDI);
exprasmlist^.concat(new(paicpu,op_reg(A_PUSH,S_L,R_EDI)));
{$ifdef AllocEDI}
exprasmlist^.concat(new(pairegalloc,dealloc(R_EDI)));
{$endif AllocEDI}
end;
if freetemp then
ungetiftemp(t.reference);
@ -968,6 +988,9 @@ procedure mov_reg_to_dest(p : ptree; s : topsize; reg : tregister);
) then
begin
del_reference(p^.location.reference);
{$ifdef AllocEDI}
exprasmlist^.concat(new(pairegalloc,alloc(R_EDI)));
{$endif AllocEDI}
emit_ref_reg(A_LEA,S_L,newreference(p^.location.reference),
R_EDI);
{$ifdef TEMPS_NOT_PUSH}
@ -977,6 +1000,9 @@ procedure mov_reg_to_dest(p : ptree; s : topsize; reg : tregister);
{$else TEMPS_NOT_PUSH}
exprasmlist^.concat(new(paicpu,op_reg(A_PUSH,S_L,R_EDI)));
{$endif TEMPS_NOT_PUSH}
{$ifdef AllocEDI}
exprasmlist^.concat(new(pairegalloc,dealloc(R_EDI)));
{$endif AllocEDI}
pushed:=true;
end
else pushed:=false;
@ -1021,10 +1047,16 @@ procedure mov_reg_to_dest(p : ptree; s : topsize; reg : tregister);
) then
begin
del_reference(p^.location.reference);
{$ifdef AllocEDI}
exprasmlist^.concat(new(pairegalloc,alloc(R_EDI)));
{$endif AllocEDI}
emit_ref_reg(A_LEA,S_L,newreference(p^.location.reference),
R_EDI);
gettempofsizereference(href,4);
exprasmlist^.concat(new(paicpu,op_reg_ref(A_MOV,S_L,R_EDI,href)));
{$ifdef AllocEDI}
exprasmlist^.concat(new(pairegalloc,dealloc(R_EDI)));
{$endif AllocEDI}
p^.temp_offset:=href.offset;
pushed:=true;
end
@ -1043,8 +1075,14 @@ procedure mov_reg_to_dest(p : ptree; s : topsize; reg : tregister);
not(cs_littlesize in aktglobalswitches)
Then
begin
{$ifdef AllocEDI}
exprasmlist^.concat(new(pairegalloc,alloc(R_EDI)));
{$endif AllocEDI}
emit_reg_reg(A_XOR,S_L,R_EDI,R_EDI);
exprasmlist^.concat(new(paicpu,op_reg(A_PUSH,S_L,R_EDI)));
{$ifdef AllocEDI}
exprasmlist^.concat(new(pairegalloc,dealloc(R_EDI)));
{$endif AllocEDI}
end
else
exprasmlist^.concat(new(paicpu,op_const(A_PUSH,S_L,l)));
@ -1061,8 +1099,14 @@ procedure mov_reg_to_dest(p : ptree; s : topsize; reg : tregister);
not(cs_littlesize in aktglobalswitches)
then
begin
{$ifdef AllocEDI}
exprasmlist^.concat(new(pairegalloc,alloc(R_EDI)));
{$endif AllocEDI}
emit_ref_reg(A_MOV,S_L,newreference(ref),R_EDI);
exprasmlist^.concat(new(paicpu,op_reg(A_PUSH,S_L,R_EDI)));
{$ifdef AllocEDI}
exprasmlist^.concat(new(pairegalloc,dealloc(R_EDI)));
{$endif AllocEDI}
end
else exprasmlist^.concat(new(paicpu,op_ref(A_PUSH,S_L,newreference(ref))));
end;
@ -1097,8 +1141,14 @@ procedure mov_reg_to_dest(p : ptree; s : topsize; reg : tregister);
exprasmlist^.concat(new(paicpu,op_reg(A_PUSH,S_L,ref.base)))
else
begin
{$ifdef AllocEDI}
exprasmlist^.concat(new(pairegalloc,alloc(R_EDI)));
{$endif AllocEDI}
emit_ref_reg(A_LEA,S_L,newreference(ref),R_EDI);
exprasmlist^.concat(new(paicpu,op_reg(A_PUSH,S_L,R_EDI)));
{$ifdef AllocEDI}
exprasmlist^.concat(new(pairegalloc,dealloc(R_EDI)));
{$endif AllocEDI}
end;
end;
end;
@ -1403,15 +1453,25 @@ procedure mov_reg_to_dest(p : ptree; s : topsize; reg : tregister);
inc(pushedparasize,8);
if inlined then
begin
{$ifdef AllocEDI}
exprasmlist^.concat(new(pairegalloc,alloc(R_EDI)));
{$endif AllocEDI}
emit_ref_reg(A_MOV,S_L,
newreference(tempreference),R_EDI);
r:=new_reference(procinfo^.framepointer,para_offset-pushedparasize);
exprasmlist^.concat(new(paicpu,op_reg_ref(A_MOV,S_L,R_EDI,r)));
{$ifdef AllocEDI}
exprasmlist^.concat(new(pairegalloc,dealloc(R_EDI)));
exprasmlist^.concat(new(pairegalloc,alloc(R_EDI)));
{$endif AllocEDI}
inc(tempreference.offset,4);
emit_ref_reg(A_MOV,S_L,
newreference(tempreference),R_EDI);
r:=new_reference(procinfo^.framepointer,para_offset-pushedparasize+4);
exprasmlist^.concat(new(paicpu,op_reg_ref(A_MOV,S_L,R_EDI,r)));
{$ifdef AllocEDI}
exprasmlist^.concat(new(pairegalloc,dealloc(R_EDI)));
{$endif AllocEDI}
end
else
begin
@ -1425,10 +1485,16 @@ procedure mov_reg_to_dest(p : ptree; s : topsize; reg : tregister);
inc(pushedparasize,4);
if inlined then
begin
{$ifdef AllocEDI}
exprasmlist^.concat(new(pairegalloc,alloc(R_EDI)));
{$endif AllocEDI}
emit_ref_reg(A_MOV,S_L,
newreference(tempreference),R_EDI);
r:=new_reference(procinfo^.framepointer,para_offset-pushedparasize);
exprasmlist^.concat(new(paicpu,op_reg_ref(A_MOV,S_L,R_EDI,r)));
{$ifdef AllocEDI}
exprasmlist^.concat(new(pairegalloc,dealloc(R_EDI)));
{$endif AllocEDI}
end
else
emit_push_mem(tempreference);
@ -1448,10 +1514,16 @@ procedure mov_reg_to_dest(p : ptree; s : topsize; reg : tregister);
end;
if inlined then
begin
{$ifdef AllocEDI}
exprasmlist^.concat(new(pairegalloc,alloc(R_EDI)));
{$endif AllocEDI}
emit_ref_reg(A_MOV,opsize,
newreference(tempreference),hreg);
r:=new_reference(procinfo^.framepointer,para_offset-pushedparasize);
exprasmlist^.concat(new(paicpu,op_reg_ref(A_MOV,opsize,hreg,r)));
{$ifdef AllocEDI}
exprasmlist^.concat(new(pairegalloc,dealloc(R_EDI)));
{$endif AllocEDI}
end
else
exprasmlist^.concat(new(paicpu,op_ref(A_PUSH,opsize,
@ -1470,10 +1542,16 @@ procedure mov_reg_to_dest(p : ptree; s : topsize; reg : tregister);
inc(pushedparasize,4);
if inlined then
begin
{$ifdef AllocEDI}
exprasmlist^.concat(new(pairegalloc,alloc(R_EDI)));
{$endif AllocEDI}
emit_ref_reg(A_MOV,S_L,
newreference(tempreference),R_EDI);
r:=new_reference(procinfo^.framepointer,para_offset-pushedparasize);
exprasmlist^.concat(new(paicpu,op_reg_ref(A_MOV,S_L,R_EDI,r)));
{$ifdef AllocEDI}
exprasmlist^.concat(new(pairegalloc,dealloc(R_EDI)));
{$endif AllocEDI}
end
else
emit_push_mem(tempreference);
@ -1485,10 +1563,16 @@ procedure mov_reg_to_dest(p : ptree; s : topsize; reg : tregister);
inc(tempreference.offset,4);
if inlined then
begin
{$ifdef AllocEDI}
exprasmlist^.concat(new(pairegalloc,alloc(R_EDI)));
{$endif AllocEDI}
emit_ref_reg(A_MOV,S_L,
newreference(tempreference),R_EDI);
r:=new_reference(procinfo^.framepointer,para_offset-pushedparasize);
exprasmlist^.concat(new(paicpu,op_reg_ref(A_MOV,S_L,R_EDI,r)));
{$ifdef AllocEDI}
exprasmlist^.concat(new(pairegalloc,dealloc(R_EDI)));
{$endif AllocEDI}
end
else
emit_push_mem(tempreference);
@ -1496,10 +1580,16 @@ procedure mov_reg_to_dest(p : ptree; s : topsize; reg : tregister);
dec(tempreference.offset,4);
if inlined then
begin
{$ifdef AllocEDI}
exprasmlist^.concat(new(pairegalloc,alloc(R_EDI)));
{$endif AllocEDI}
emit_ref_reg(A_MOV,S_L,
newreference(tempreference),R_EDI);
r:=new_reference(procinfo^.framepointer,para_offset-pushedparasize);
exprasmlist^.concat(new(paicpu,op_reg_ref(A_MOV,S_L,R_EDI,r)));
{$ifdef AllocEDI}
exprasmlist^.concat(new(pairegalloc,dealloc(R_EDI)));
{$endif AllocEDI}
end
else
emit_push_mem(tempreference);
@ -1513,10 +1603,16 @@ procedure mov_reg_to_dest(p : ptree; s : topsize; reg : tregister);
inc(tempreference.offset,6);
if inlined then
begin
{$ifdef AllocEDI}
exprasmlist^.concat(new(pairegalloc,alloc(R_EDI)));
{$endif AllocEDI}
emit_ref_reg(A_MOV,S_L,
newreference(tempreference),R_EDI);
r:=new_reference(procinfo^.framepointer,para_offset-pushedparasize);
exprasmlist^.concat(new(paicpu,op_reg_ref(A_MOV,S_L,R_EDI,r)));
{$ifdef AllocEDI}
exprasmlist^.concat(new(pairegalloc,dealloc(R_EDI)));
{$endif AllocEDI}
end
else
emit_push_mem(tempreference);
@ -1524,10 +1620,16 @@ procedure mov_reg_to_dest(p : ptree; s : topsize; reg : tregister);
inc(pushedparasize,4);
if inlined then
begin
{$ifdef AllocEDI}
exprasmlist^.concat(new(pairegalloc,alloc(R_EDI)));
{$endif AllocEDI}
emit_ref_reg(A_MOV,S_L,
newreference(tempreference),R_EDI);
r:=new_reference(procinfo^.framepointer,para_offset-pushedparasize);
exprasmlist^.concat(new(paicpu,op_reg_ref(A_MOV,S_L,R_EDI,r)));
{$ifdef AllocEDI}
exprasmlist^.concat(new(pairegalloc,dealloc(R_EDI)));
{$endif AllocEDI}
end
else
emit_push_mem(tempreference);
@ -1547,10 +1649,16 @@ procedure mov_reg_to_dest(p : ptree; s : topsize; reg : tregister);
end;
if inlined then
begin
{$ifdef AllocEDI}
exprasmlist^.concat(new(pairegalloc,alloc(R_EDI)));
{$endif AllocEDI}
emit_ref_reg(A_MOV,opsize,
newreference(tempreference),hreg);
r:=new_reference(procinfo^.framepointer,para_offset-pushedparasize);
exprasmlist^.concat(new(paicpu,op_reg_ref(A_MOV,opsize,hreg,r)));
{$ifdef AllocEDI}
exprasmlist^.concat(new(pairegalloc,dealloc(R_EDI)));
{$endif AllocEDI}
end
else
exprasmlist^.concat(new(paicpu,op_ref(A_PUSH,opsize,
@ -1565,10 +1673,16 @@ procedure mov_reg_to_dest(p : ptree; s : topsize; reg : tregister);
inc(pushedparasize,4);
if inlined then
begin
{$ifdef AllocEDI}
exprasmlist^.concat(new(pairegalloc,alloc(R_EDI)));
{$endif AllocEDI}
emit_ref_reg(A_MOV,S_L,
newreference(tempreference),R_EDI);
r:=new_reference(procinfo^.framepointer,para_offset-pushedparasize);
exprasmlist^.concat(new(paicpu,op_reg_ref(A_MOV,S_L,R_EDI,r)));
{$ifdef AllocEDI}
exprasmlist^.concat(new(pairegalloc,dealloc(R_EDI)));
{$endif AllocEDI}
end
else
emit_push_mem(tempreference);
@ -1661,6 +1775,9 @@ procedure mov_reg_to_dest(p : ptree; s : topsize; reg : tregister);
end;
LOC_FLAGS:
begin
{$ifdef AllocEDI}
exprasmlist^.concat(new(pairegalloc,alloc(R_EDI)));
{$endif AllocEDI}
if not(R_EAX in unused) then
emit_reg_reg(A_MOV,S_L,R_EAX,R_EDI);
emit_flag2reg(p^.location.resflags,R_AL);
@ -1685,7 +1802,12 @@ procedure mov_reg_to_dest(p : ptree; s : topsize; reg : tregister);
else
exprasmlist^.concat(new(paicpu,op_reg(A_PUSH,opsize,hreg)));
if not(R_EAX in unused) then
emit_reg_reg(A_MOV,S_L,R_EDI,R_EAX);
begin
emit_reg_reg(A_MOV,S_L,R_EDI,R_EAX);
{$ifdef AllocEDI}
exprasmlist^.concat(new(pairegalloc,dealloc(R_EDI)));
{$endif AllocEDI}
end;
end;
{$ifdef SUPPORT_MMX}
LOC_MMXREGISTER,
@ -1986,15 +2108,27 @@ procedure mov_reg_to_dest(p : ptree; s : topsize; reg : tregister);
emitjmp(C_L,neglabel);
end;
{ insert bound instruction only }
{$ifdef AllocEDI}
exprasmlist^.concat(new(pairegalloc,alloc(R_EDI)));
{$endif AllocEDI}
exprasmlist^.concat(new(paicpu,op_sym_ofs_reg(A_MOV,S_L,newasmsymbol(rstr),0,R_EDI)));
emitcall('FPC_BOUNDCHECK');
{$ifdef AllocEDI}
exprasmlist^.concat(new(pairegalloc,dealloc(R_EDI)));
{$endif AllocEDI}
{ u32bit needs 2 checks }
if doublebound then
begin
emitjmp(C_None,poslabel);
emitlab(neglabel);
{$ifdef AllocEDI}
exprasmlist^.concat(new(pairegalloc,alloc(R_EDI)));
{$endif AllocEDI}
exprasmlist^.concat(new(paicpu,op_sym_ofs_reg(A_MOV,S_L,newasmsymbol(rstr),8,R_EDI)));
emitcall('FPC_BOUNDCHECK');
{$ifdef AllocEDI}
exprasmlist^.concat(new(pairegalloc,dealloc(R_EDI)));
{$endif AllocEDI}
emitlab(poslabel);
end;
if popecx then
@ -2012,12 +2146,18 @@ procedure mov_reg_to_dest(p : ptree; s : topsize; reg : tregister);
hreg:=p^.location.register
else
begin
{$ifdef AllocEDI}
exprasmlist^.concat(new(pairegalloc,alloc(R_EDI)));
{$endif AllocEDI}
emit_reg_reg(op,opsize,p^.location.register,R_EDI);
hreg:=R_EDI;
end;
end
else
begin
{$ifdef AllocEDI}
exprasmlist^.concat(new(pairegalloc,alloc(R_EDI)));
{$endif AllocEDI}
emit_ref_reg(op,opsize,newreference(p^.location.reference),R_EDI);
hreg:=R_EDI;
end;
@ -2025,7 +2165,7 @@ procedure mov_reg_to_dest(p : ptree; s : topsize; reg : tregister);
begin
getlabel(neglabel);
getlabel(poslabel);
emit_reg_reg(A_OR,S_L,hreg,hreg);
emit_reg_reg(A_TEST,S_L,hreg,hreg);
emitjmp(C_L,neglabel);
end;
{ insert bound instruction only }
@ -2039,6 +2179,10 @@ procedure mov_reg_to_dest(p : ptree; s : topsize; reg : tregister);
exprasmlist^.concat(new(paicpu,op_reg_ref(A_BOUND,S_L,hreg,newreference(href))));
emitlab(poslabel);
end;
{$ifdef AllocEDI}
if hreg = R_EDI then
exprasmlist^.concat(new(pairegalloc,dealloc(R_EDI)));
{$endif AllocEDI}
end;
end;
@ -2075,6 +2219,9 @@ procedure mov_reg_to_dest(p : ptree; s : topsize; reg : tregister);
(not(cs_littlesize in aktglobalswitches ) and (size<=12))) then
begin
helpsize:=size shr 2;
{$ifdef AllocEDI}
exprasmlist^.concat(new(pairegalloc,alloc(R_EDI)));
{$endif AllocEDI}
for i:=1 to helpsize do
begin
emit_ref_reg(A_MOV,S_L,newreference(source),R_EDI);
@ -2099,6 +2246,9 @@ procedure mov_reg_to_dest(p : ptree; s : topsize; reg : tregister);
inc(dest.offset,2);
dec(size,2);
end;
{$ifdef AllocEDI}
exprasmlist^.concat(new(pairegalloc,dealloc(R_EDI)));
{$endif AllocEDI}
if size>0 then
begin
{ and now look for an 8 bit register }
@ -2130,7 +2280,12 @@ procedure mov_reg_to_dest(p : ptree; s : topsize; reg : tregister);
end;
if swap then
{ was earlier XCHG, of course nonsense }
emit_reg_reg(A_MOV,S_L,reg32,R_EDI);
begin
{$ifdef AllocEDI}
exprasmlist^.concat(new(pairegalloc,alloc(R_EDI)));
{$endif AllocEDI}
emit_reg_reg(A_MOV,S_L,reg32,R_EDI);
end;
emit_ref_reg(A_MOV,S_B,newreference(source),reg8);
{$ifdef regallocfix}
If delsource then
@ -2138,16 +2293,27 @@ procedure mov_reg_to_dest(p : ptree; s : topsize; reg : tregister);
{$endif regallocfix}
exprasmlist^.concat(new(paicpu,op_reg_ref(A_MOV,S_B,reg8,newreference(dest))));
if swap then
emit_reg_reg(A_MOV,S_L,R_EDI,reg32);
begin
emit_reg_reg(A_MOV,S_L,R_EDI,reg32);
{$ifdef AllocEDI}
exprasmlist^.concat(new(pairegalloc,dealloc(R_EDI)));
{$endif AllocEDI}
end;
end;
end
else
begin
{$ifdef AllocEDI}
exprasmlist^.concat(new(pairegalloc,alloc(R_EDI)));
{$endif AllocEDI}
emit_ref_reg(A_LEA,S_L,newreference(dest),R_EDI);
{$ifdef regallocfix}
{is this ok?? (JM)}
del_reference(dest);
{$endif regallocfix}
{$ifdef AllocEDI}
exprasmlist^.concat(new(pairegalloc,alloc(R_ESI)));
{$endif AllocEDI}
if loadref then
emit_ref_reg(A_MOV,S_L,newreference(source),R_ESI)
else
@ -2188,8 +2354,17 @@ procedure mov_reg_to_dest(p : ptree; s : topsize; reg : tregister);
if size=1 then
exprasmlist^.concat(new(paicpu,op_none(A_MOVSB,S_NO)));
end;
{$ifdef AllocEDI}
exprasmlist^.concat(new(pairegalloc,dealloc(R_EDI)));
exprasmlist^.concat(new(pairegalloc,dealloc(R_ESI)));
{$endif AllocEDI}
if ecxpushed then
exprasmlist^.concat(new(paicpu,op_reg(A_POP,S_L,R_ECX)));
begin
{$ifdef AllocEDI}
exprasmlist^.concat(new(pairegalloc,alloc(R_ECX)));
{$endif AllocEDI}
exprasmlist^.concat(new(paicpu,op_reg(A_POP,S_L,R_ECX)));
end;
{ loading SELF-reference again }
maybe_loadesi;
@ -2277,6 +2452,9 @@ procedure mov_reg_to_dest(p : ptree; s : topsize; reg : tregister);
reset_reference(hp^);
hp^.offset:=procinfo^.framepointer_offset;
hp^.base:=procinfo^.framepointer;
{$ifdef AllocEDI}
exprasmlist^.concat(new(pairegalloc,alloc(R_ESI)));
{$endif AllocEDI}
emit_ref_reg(A_MOV,S_L,hp,R_ESI);
p:=procinfo^.parent;
for i:=3 to lexlevel-1 do
@ -2599,6 +2777,9 @@ procedure mov_reg_to_dest(p : ptree; s : topsize; reg : tregister);
reset_reference(r^);
r^.base:=procinfo^.framepointer;
r^.offset:=pvarsym(p)^.address+4+procinfo^.call_offset;
{$ifdef AllocEDI}
exprasmlist^.concat(new(pairegalloc,alloc(R_EDI)));
{$endif AllocEDI}
exprasmlist^.concat(new(paicpu,
op_ref_reg(A_MOV,S_L,r,R_EDI)));
@ -2630,11 +2811,17 @@ procedure mov_reg_to_dest(p : ptree; s : topsize; reg : tregister);
emitlab(ok);
exprasmlist^.concat(new(paicpu,
op_reg_reg(A_SUB,S_L,R_EDI,R_ESP)));
{$ifdef AllocEDI}
exprasmlist^.concat(new(pairegalloc,dealloc(R_EDI)));
{$endif AllocEDI}
{ now reload EDI }
new(r);
reset_reference(r^);
r^.base:=procinfo^.framepointer;
r^.offset:=pvarsym(p)^.address+4+procinfo^.call_offset;
{$ifdef AllocEDI}
exprasmlist^.concat(new(pairegalloc,alloc(R_EDI)));
{$endif AllocEDI}
exprasmlist^.concat(new(paicpu,
op_ref_reg(A_MOV,S_L,r,R_EDI)));
@ -2656,6 +2843,10 @@ procedure mov_reg_to_dest(p : ptree; s : topsize; reg : tregister);
end;
{ don't destroy the registers! }
{$ifdef AllocEDI}
exprasmlist^.concat(new(pairegalloc,alloc(R_ECX)));
exprasmlist^.concat(new(pairegalloc,alloc(R_ESI)));
{$endif AllocEDI}
exprasmlist^.concat(new(paicpu,
op_reg(A_PUSH,S_L,R_ECX)));
exprasmlist^.concat(new(paicpu,
@ -2705,6 +2896,11 @@ procedure mov_reg_to_dest(p : ptree; s : topsize; reg : tregister);
S_W : exprasmlist^.concat(new(paicpu,op_none(A_MOVSW,S_NO)));
S_L : exprasmlist^.concat(new(paicpu,op_none(A_MOVSD,S_NO)));
end;
{$ifdef AllocEDI}
exprasmlist^.concat(new(pairegalloc,dealloc(R_EDI)));
exprasmlist^.concat(new(pairegalloc,dealloc(R_ESI)));
exprasmlist^.concat(new(pairegalloc,dealloc(R_ECX)));
{$endif AllocEDI}
exprasmlist^.concat(new(paicpu,
op_reg(A_POP,S_L,R_ESI)));
exprasmlist^.concat(new(paicpu,
@ -2883,6 +3079,9 @@ procedure mov_reg_to_dest(p : ptree; s : topsize; reg : tregister);
begin
exprasmlist^.insert(new(paicpu,op_cond_sym(A_Jcc,C_Z,S_NO,faillabel)));
emitinsertcall('FPC_HELP_CONSTRUCTOR');
{$ifdef AllocEDI}
exprasmlist^.concat(new(pairegalloc,alloc(R_EDI)));
{$endif AllocEDI}
exprasmlist^.insert(new(paicpu,op_const_reg(A_MOV,S_L,procinfo^._class^.vmt_offset,R_EDI)));
end;
end;
@ -2897,6 +3096,9 @@ procedure mov_reg_to_dest(p : ptree; s : topsize; reg : tregister);
reset_reference(hr^);
hr^.offset:=procinfo^.selfpointer_offset;
hr^.base:=procinfo^.framepointer;
{$ifdef AllocEDI}
exprasmlist^.concat(new(pairegalloc,alloc(R_ESI)));
{$endif AllocEDI}
exprasmlist^.insert(new(paicpu,op_ref_reg(A_MOV,S_L,hr,R_ESI)));
end;
{ should we save edi,esi,ebx like C ? }
@ -2981,6 +3183,9 @@ procedure mov_reg_to_dest(p : ptree; s : topsize; reg : tregister);
else
begin
getlabel(again);
{$ifdef AllocEDI}
exprasmlist^.concat(new(pairegalloc,alloc(R_EDI)));
{$endif AllocEDI}
exprasmlist^.concat(new(paicpu,
op_const_reg(A_MOV,S_L,stackframe div winstackpagesize,R_EDI)));
emitlab(again);
@ -2991,6 +3196,9 @@ procedure mov_reg_to_dest(p : ptree; s : topsize; reg : tregister);
exprasmlist^.concat(new(paicpu,
op_reg(A_DEC,S_L,R_EDI)));
emitjmp(C_NZ,again);
{$ifdef AllocEDI}
exprasmlist^.concat(new(pairegalloc,dealloc(R_EDI)));
{$endif AllocEDI}
exprasmlist^.concat(new(paicpu,
op_const_reg(A_SUB,S_L,stackframe mod winstackpagesize,R_ESP)));
end
@ -3199,6 +3407,9 @@ procedure mov_reg_to_dest(p : ptree; s : topsize; reg : tregister);
else
begin
emitinsertcall('FPC_HELP_DESTRUCTOR');
{$ifdef AllocEDI}
exprasmlist^.concat(new(pairegalloc,alloc(R_EDI)));
{$endif AllocEDI}
exprasmlist^.insert(new(paicpu,op_const_reg(A_MOV,S_L,procinfo^._class^.vmt_offset,R_EDI)));
{ must the object be finalized ? }
if procinfo^._class^.needs_inittable then
@ -3206,6 +3417,9 @@ procedure mov_reg_to_dest(p : ptree; s : topsize; reg : tregister);
getlabel(nofinal);
exprasmlist^.insert(new(pai_label,init(nofinal)));
emitinsertcall('FPC_FINALIZE');
{$ifdef AllocEDI}
exprasmlist^.concat(new(pairegalloc,dealloc(R_EDI)));
{$endif AllocEDI}
exprasmlist^.insert(new(paicpu,op_reg(A_PUSH,S_L,R_ESI)));
exprasmlist^.insert(new(paicpu,op_sym(A_PUSH,S_L,procinfo^._class^.get_inittable_label)));
ai:=new(paicpu,op_sym(A_Jcc,S_NO,nofinal));
@ -3281,13 +3495,19 @@ procedure mov_reg_to_dest(p : ptree; s : topsize; reg : tregister);
else
begin
emit_ref_reg(A_MOV,S_L,new_reference(procinfo^.framepointer,12),R_ESI);
{$ifdef AllocEDI}
exprasmlist^.concat(new(pairegalloc,alloc(R_EDI)));
{$endif AllocEDI}
emit_const_reg(A_MOV,S_L,procinfo^._class^.vmt_offset,R_EDI);
emitcall('FPC_HELP_FAIL');
{$ifdef AllocEDI}
exprasmlist^.concat(new(pairegalloc,dealloc(R_EDI)));
{$endif AllocEDI}
end;
emitlab(okexitlabel);
emit_reg_reg(A_MOV,S_L,R_ESI,R_EAX);
emit_reg_reg(A_OR,S_L,R_EAX,R_EAX);
emit_reg_reg(A_TEST,S_L,R_ESI,R_ESI);
end;
{ stabs uses the label also ! }
@ -3447,7 +3667,12 @@ procedure mov_reg_to_dest(p : ptree; s : topsize; reg : tregister);
end.
{
$Log$
Revision 1.66 2000-01-07 01:14:22 peter
Revision 1.67 2000-01-09 01:44:21 jonas
+ (de)allocation info for EDI to fix reported bug on mailinglist.
Also some (de)allocation info for ESI added. Between -dallocEDI
because at this time of the night bugs could easily slip in ;)
Revision 1.66 2000/01/07 01:14:22 peter
* updated copyright to 2000
Revision 1.65 1999/12/22 01:01:47 peter

View File

@ -133,16 +133,43 @@ type
{contents of the FPU registers}
TRegFPUContent = Array[R_ST..R_ST7] Of TContent;
{$ifdef tempOpts}
{ linked list which allows searching/deleting based on value, no extra frills}
PSearchLinkedListItem = ^TSearchLinkedListItem;
TSearchLinkedListItem = object(TLinkedList_Item)
constructor init;
function equals(p: PSearchLinkedListItem): boolean; virtual;
end;
PSearchDoubleIntItem = ^TSearchDoubleInttem;
TSearchDoubleIntItem = object(TLinkedList_Item)
constructor init(_int1,_int2: longint);
function equals(p: PSearchLinkedListItem): boolean; virtual;
private
int1, int2: longint;
end;
PSearchLinkedList = ^TSearchLinkedList;
TSearchLinkedList = object(TLinkedList)
function searchByValue(p: PSearchLinkedListItem): boolean;
procedure removeByValue(p: PSearchLinkedListItem);
end;
{$endif tempOpts}
{information record with the contents of every register. Every Pai object
gets one of these assigned: a pointer to it is stored in the OptInfo field}
TPaiProp = Record
Regs: TRegContent;
{ FPURegs: TRegFPUContent;} {currently not yet used}
{allocated Registers}
{ allocated Registers }
UsedRegs: TRegSet;
{status of the direction flag}
{ status of the direction flag }
DirFlag: TFlagContents;
{can this instruction be removed?}
{$ifdef tempOpts}
{ currently used temps }
tempAllocs: PSearchLinkedList;
{$endif tempOpts}
{ can this instruction be removed? }
CanBeRemoved: Boolean;
End;
@ -201,6 +228,76 @@ Var
that modified the register}
NrOfInstrSinceLastMod: TInstrSinceLastMod;
{$ifdef tempOpts}
constructor TSearchLinkedListItem.init;
begin
end;
function TSearchLinkedListItem.equals(p: PSearchLinkedListItem): boolean;
begin
equals := false;
end;
constructor TSearchDoubleIntItem.init(_int1,_int2: longint);
begin
int1 := _int1;
int2 := _int2;
end;
function TSearchDoubleIntItem.equals(p: PSearchLinkedListItem): boolean;
begin
equals := (TSearchDoubleIntItem(p).int1 = int1) and
(TSearchDoubleIntItem(p).int2 = int2);
end;
function TSearchLinkedList.searchByValue(p: PSearchLinkedListItem): boolean;
var temp: PSearchLinkedListItem;
begin
temp := first;
while (temp <> last^.next) and
not(temp^.equals(p)) do
temp := temp^.next;
searchByValue := temp <> last^.next;
end;
procedure TSearchLinkedList.removeByValue(p: PSearchLinkedListItem);
begin
temp := first;
while (temp <> last^.next) and
not(temp^.equals(p)) do
temp := temp^.next;
if temp <> last^.next then
begin
remove(temp);
dispose(temp,done);
end;
end;
Procedure updateTempAllocs(Var UsedRegs: TRegSet; p: Pai);
{updates UsedRegs with the RegAlloc Information coming after P}
Begin
Repeat
While Assigned(p) And
((p^.typ in (SkipInstr - [ait_RegAlloc])) or
((p^.typ = ait_label) And
Not(Pai_Label(p)^.l^.is_used))) Do
p := Pai(p^.next);
While Assigned(p) And
(p^.typ=ait_RegAlloc) Do
Begin
if pairegalloc(p)^.allocation then
UsedRegs := UsedRegs + [PaiRegAlloc(p)^.Reg]
else
UsedRegs := UsedRegs - [PaiRegAlloc(p)^.Reg];
p := pai(p^.next);
End;
Until Not(Assigned(p)) Or
(Not(p^.typ in SkipInstr) And
Not((p^.typ = ait_label) And
Not(Pai_Label(p)^.l^.is_used)));
End;
{$endif tempOpts}
{************************ Create the Label table ************************}
@ -304,6 +401,8 @@ Begin
If Pai_Label(p)^.l^.is_used Then
LabelTable^[Pai_Label(p)^.l^.labelnr-LowLabel].PaiObj := p;
ait_regAlloc:
{ ESI and EDI are (de)allocated manually, don't mess with them }
if not(paiRegAlloc(p)^.Reg in [R_EDI,R_ESI]) then
begin
if PairegAlloc(p)^.Allocation then
Begin
@ -1918,7 +2017,12 @@ End.
{
$Log$
Revision 1.76 2000-01-07 01:14:23 peter
Revision 1.77 2000-01-09 01:44:21 jonas
+ (de)allocation info for EDI to fix reported bug on mailinglist.
Also some (de)allocation info for ESI added. Between -dallocEDI
because at this time of the night bugs could easily slip in ;)
Revision 1.76 2000/01/07 01:14:23 peter
* updated copyright to 2000
Revision 1.75 1999/12/05 16:48:43 jonas