* changed edi allocation to use getexplicitregister32/ungetregister

(adapted tgeni386 a bit for this) and enabled it by default
  * fixed very big and stupid bug of mine in cg386mat that broke the
    include() code (and make cycle :( ) if you compiled without
    -dnewoptimizations
This commit is contained in:
Jonas Maebe 2000-01-09 12:34:59 +00:00
parent 86ff0db0b5
commit 23d69a5126
11 changed files with 548 additions and 473 deletions

View File

@ -1053,26 +1053,24 @@ implementation
popedx:=true;
end;
{ p^.left^.location can be R_EAX !!! }
{$ifdef AllocEDI}
exprasmlist^.concat(new(pairegalloc,alloc(R_EDI)));
{$endif AllocEDI}
{$ifndef noAllocEdi}
getexplicitregister32(R_EDI);
{$endif noAllocEdi}
emitloadord2reg(p^.left^.location,u32bitdef,R_EDI,true);
emitloadord2reg(p^.right^.location,u32bitdef,R_EAX,true);
{$ifdef AllocEDI}
{$ifndef noAllocEdi}
if R_EDX in unused then
exprasmlist^.concat(new(pairegalloc,alloc(R_EDX)));
{$endif AllocEDI}
{$endif noAllocEdi}
emit_reg(A_MUL,S_L,R_EDI);
{$ifdef AllocEDI}
exprasmlist^.concat(new(pairegalloc,dealloc(R_EDI)));
{$endif AllocEDI}
{$ifndef noAllocEdi}
ungetregister32(R_EDI);
if R_EDX in unused then
exprasmlist^.concat(new(pairegalloc,dealloc(R_EDX)));
{$endif noAllocEdi}
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}
@ -1166,31 +1164,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}
{$ifndef noAllocEdi}
getexplicitregister32(R_EDI);
{$endif noAllocEdi}
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}
{$ifndef noAllocEdi}
ungetregister32(R_EDI);
{$endif noAllocEdi}
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}
{$ifndef noAllocEdi}
getexplicitregister32(R_EDI);
{$endif noAllocEdi}
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}
{$ifndef noAllocEdi}
ungetregister32(R_EDI);
{$endif noAllocEdi}
ungetiftemp(p^.right^.location.reference);
del_reference(p^.right^.location.reference);
end;
@ -1234,16 +1232,16 @@ implementation
begin
if extra_not then
begin
{$ifdef AllocEDI}
exprasmlist^.concat(new(pairegalloc,alloc(R_EDI)));
{$endif AllocEDI}
{$ifndef noAllocEdi}
getexplicitregister32(R_EDI);
{$endif noAllocEdi}
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}
{$ifndef noAllocEdi}
ungetregister32(R_EDI);
{$endif noAllocEdi}
end
else
begin
@ -1255,17 +1253,17 @@ implementation
begin
if extra_not then
begin
{$ifdef AllocEDI}
exprasmlist^.concat(new(pairegalloc,alloc(R_EDI)));
{$endif AllocEDI}
{$ifndef noAllocEdi}
getexplicitregister32(R_EDI);
{$endif noAllocEdi}
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}
{$ifndef noAllocEdi}
ungetregister32(R_EDI);
{$endif noAllocEdi}
end
else
begin
@ -1659,37 +1657,37 @@ implementation
begin
if p^.right^.location.loc=LOC_CREGISTER then
begin
{$ifdef AllocEDI}
exprasmlist^.concat(new(pairegalloc,alloc(R_EDI)));
{$endif AllocEDI}
{$ifndef noAllocEdi}
getexplicitregister32(R_EDI);
{$endif noAllocEdi}
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}
{$ifndef noAllocEdi}
ungetregister32(R_EDI);
getexplicitregister32(R_EDI);
{$endif noAllocEdi}
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}
{$ifndef noAllocEdi}
ungetregister32(R_EDI);
{$endif noAllocEdi}
end
else
begin
{$ifdef AllocEDI}
exprasmlist^.concat(new(pairegalloc,alloc(R_EDI)));
{$endif AllocEDI}
{$ifndef noAllocEdi}
getexplicitregister32(R_EDI);
{$endif noAllocEdi}
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}
{$ifndef noAllocEdi}
ungetregister32(R_EDI);
getexplicitregister32(R_EDI);
{$endif noAllocEdi}
hr:=newreference(p^.right^.location.reference);
inc(hr^.offset,4);
emit_ref_reg(A_MOV,opsize,
@ -1698,9 +1696,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}
{$ifndef noAllocEdi}
ungetregister32(R_EDI);
{$endif noAllocEdi}
ungetiftemp(p^.right^.location.reference);
del_reference(p^.right^.location.reference);
end;
@ -1950,9 +1948,9 @@ implementation
begin
if not(R_EAX in unused) then
begin
{$ifdef AllocEDI}
exprasmlist^.concat(new(pairegalloc,alloc(R_EDI)));
{$endif AllocEDI}
{$ifndef noAllocEdi}
getexplicitregister32(R_EDI);
{$endif noAllocEdi}
emit_reg_reg(A_MOV,S_L,R_EAX,R_EDI);
end;
emit_reg(A_FNSTSW,S_NO,R_AX);
@ -1960,9 +1958,9 @@ implementation
if not(R_EAX in unused) then
begin
emit_reg_reg(A_MOV,S_L,R_EDI,R_EAX);
{$ifdef AllocEDI}
exprasmlist^.concat(new(pairegalloc,dealloc(R_EDI)));
{$endif AllocEDI}
{$ifndef noAllocEdi}
ungetregister32(R_EDI);
{$endif noAllocEdi}
end;
if p^.swaped then
begin
@ -2143,9 +2141,11 @@ 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}
{$ifndef noAllocEdi}
{ where does the result of this (R_EDI) get used?? No }
{ allocinfo for EDI added, because it doesn't seem to be }
{ used anyway }
{$endif noAllocEdi}
emit_reg_reg(op,S_NO,p^.location.register,R_EDI);
emit_reg_reg(A_MOVQ,S_NO,R_MM7,p^.location.register);
end
@ -2206,7 +2206,14 @@ implementation
end.
{
$Log$
Revision 1.85 2000-01-09 01:44:18 jonas
Revision 1.86 2000-01-09 12:34:59 jonas
* changed edi allocation to use getexplicitregister32/ungetregister
(adapted tgeni386 a bit for this) and enabled it by default
* fixed very big and stupid bug of mine in cg386mat that broke the
include() code (and make cycle :( ) if you compiled without
-dnewoptimizations
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 ;)

View File

@ -120,16 +120,16 @@ implementation
begin
if inlined then
begin
{$ifdef AllocEDI}
exprasmlist^.concat(new(pairegalloc,alloc(R_EDI)));
{$endif AllocEDI}
{$ifndef noAllocEdi}
getexplicitregister32(R_EDI);
{$endif noAllocEdi}
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}
{$ifndef noAllocEdi}
ungetregister32(R_EDI);
{$endif noAllocEdi}
end
else
emitpushreferenceaddr(p^.left^.location.reference);
@ -146,16 +146,16 @@ implementation
inc(pushedparasize,4);
if inlined then
begin
{$ifdef AllocEDI}
exprasmlist^.concat(new(pairegalloc,alloc(R_EDI)));
{$endif AllocEDI}
{$ifndef noAllocEdi}
getexplicitregister32(R_EDI);
{$endif noAllocEdi}
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}
{$ifndef noAllocEdi}
ungetregister32(R_EDI);
{$endif noAllocEdi}
end
else
emitpushreferenceaddr(p^.left^.location.reference);
@ -177,17 +177,16 @@ implementation
inc(pushedparasize,4);
if inlined then
begin
{$ifdef AllocEDI}
exprasmlist^.concat(new(pairegalloc,alloc(R_EDI)));
{$endif AllocEDI}
{$ifndef noAllocEdi}
getexplicitregister32(R_EDI);
{$endif noAllocEdi}
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}
emit_reg_ref(A_MOV,S_L,R_EDI,r);
{$ifndef noAllocEdi}
ungetregister32(R_EDI);
{$endif noAllocEdi}
end
else
emitpushreferenceaddr(p^.left^.location.reference);
@ -423,16 +422,16 @@ implementation
{$endif not OLD_C_STACK}
if inlined then
begin
{$ifdef AllocEDI}
exprasmlist^.concat(new(pairegalloc,alloc(R_EDI)));
{$endif AllocEDI}
{$ifndef noAllocEdi}
getexplicitregister32(R_EDI);
{$endif noAllocEdi}
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);
{$ifdef AllocEDI}
exprasmlist^.concat(new(pairegalloc,dealloc(R_EDI)));
{$endif AllocEDI}
{$ifndef noAllocEdi}
ungetregister32(R_EDI);
{$endif noAllocEdi}
end
else
emitpushreferenceaddr(funcretref);
@ -778,9 +777,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}
{$ifndef noAllocEdi}
getexplicitregister32(R_EDI);
{$endif noAllocEdi}
emit_ref_reg(A_MOV,S_L,r,R_EDI);
new(r);
reset_reference(r^);
@ -820,9 +819,9 @@ implementation
end;
{$endif TESTOBJEXT}
emit_ref(A_CALL,S_NO,r);
{$ifdef AllocEDI}
exprasmlist^.concat(new(pairegalloc,dealloc(R_EDI)));
{$endif AllocEDI}
{$ifndef noAllocEdi}
ungetregister32(R_EDI);
{$endif noAllocEdi}
end
else if not inlined then
emitcall(pprocdef(p^.procdefinition)^.mangledname)
@ -858,9 +857,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}
{$ifndef noAllocEdi}
getexplicitregister32(R_EDI);
{$endif noAllocEdi}
emit_ref_reg(A_MOV,S_L,
newreference(p^.right^.location.reference),R_EDI);
hregister:=R_EDI;
@ -882,11 +881,14 @@ implementation
emit_ref(A_CALL,S_NO,newreference(p^.right^.location.reference))
else
begin
{$ifdef AllocEDI}
if hregister = R_EDI then
exprasmlist^.concat(new(pairegalloc,alloc(R_EDI)))
else ungetregister32(hregister);
{$endif AllocEDI}
{$ifndef noAllocEdi}
ungetregister32(hregister);
{$else noAllocEdi}
{ the same code, the previous line is just to }
{ indicate EDI actually is deallocated if allocated }
{ above (JM) }
ungetregister32(hregister);
{$endif noAllocEdi}
emit_reg(A_CALL,S_NO,hregister);
end;
@ -918,13 +920,13 @@ implementation
{ better than an add on all processors }
if pushedparasize=4 then
begin
{$ifdef AllocEDI}
exprasmlist^.concat(new(pairegalloc,alloc(R_EDI)));
{$endif AllocEDI}
{$ifndef noAllocEdi}
getexplicitregister32(R_EDI);
{$endif noAllocEdi}
emit_reg(A_POP,S_L,R_EDI);
{$ifdef AllocEDI}
exprasmlist^.concat(new(pairegalloc,dealloc(R_EDI)));
{$endif AllocEDI}
{$ifndef noAllocEdi}
ungetregister32(R_EDI);
{$endif noAllocEdi}
end
{ the pentium has two pipes and pop reg is pairable }
{ but the registers must be different! }
@ -933,20 +935,20 @@ implementation
(aktoptprocessor=ClassP5) and
(procinfo^._class=nil) then
begin
{$ifdef AllocEDI}
exprasmlist^.concat(new(pairegalloc,alloc(R_EDI)));
{$endif AllocEDI}
{$ifndef noAllocEdi}
getexplicitregister32(R_EDI);
{$endif noAllocEdi}
emit_reg(A_POP,S_L,R_EDI);
{$ifdef AllocEDI}
exprasmlist^.concat(new(pairegalloc,dealloc(R_EDI)));
{$endif AllocEDI}
{$ifdef AllocEDI}
{$ifndef noAllocEdi}
ungetregister32(R_EDI);
{$endif noAllocEdi}
{$ifndef noAllocEdi}
exprasmlist^.concat(new(pairegalloc,alloc(R_ESI)));
{$endif AllocEDI}
{$endif noAllocEdi}
emit_reg(A_POP,S_L,R_ESI);
{$ifdef AllocEDI}
{$ifndef noAllocEdi}
exprasmlist^.concat(new(pairegalloc,alloc(R_ESI)));
{$endif AllocEDI}
{$endif noAllocEdi}
end
else if pushedparasize<>0 then
emit_const_reg(A_ADD,S_L,pushedparasize,R_ESP);
@ -1289,7 +1291,14 @@ implementation
end.
{
$Log$
Revision 1.115 2000-01-09 01:44:19 jonas
Revision 1.116 2000-01-09 12:35:00 jonas
* changed edi allocation to use getexplicitregister32/ungetregister
(adapted tgeni386 a bit for this) and enabled it by default
* fixed very big and stupid bug of mine in cg386mat that broke the
include() code (and make cycle :( ) if you compiled without
-dnewoptimizations
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 ;)

View File

@ -98,9 +98,9 @@ implementation
else
begin
{ not so elegant (goes better with extra register }
{$ifdef AllocEDI}
exprasmlist^.concat(new(pairegalloc,alloc(R_EDI)));
{$endif AllocEDI}
{$ifndef noAllocEdi}
getexplicitregister32(R_EDI);
{$endif noAllocEdi}
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);
@ -114,9 +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}
{$ifndef noAllocEdi}
ungetregister32(R_EDI);
{$endif noAllocEdi}
end;
end;
else
@ -701,10 +701,10 @@ implementation
if (pfrom^.location.loc=LOC_REGISTER) or
(pfrom^.location.loc=LOC_CREGISTER) then
begin
{$ifdef AllocEDI}
{$ifndef noAllocEdi}
if not (porddef(pfrom^.resulttype)^.typ in [u32bit,s32bit,u64bit,s64bit]) then
exprasmlist^.concat(new(pairegalloc,alloc(R_EDI)));
{$endif AllocEDI}
getexplicitregister32(R_EDI);
{$endif noAllocEdi}
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);
@ -723,9 +723,9 @@ implementation
else
begin
r:=newreference(pfrom^.location.reference);
{$ifdef AllocEDI}
exprasmlist^.concat(new(pairegalloc,alloc(R_EDI)));
{$endif AllocEDI}
{$ifndef noAllocEdi}
getexplicitregister32(R_EDI);
{$endif noAllocEdi}
case porddef(pfrom^.resulttype)^.typ of
s8bit:
emit_ref_reg(A_MOVSX,S_BL,r,R_EDI);
@ -751,10 +751,10 @@ implementation
end;
{ for 64 bit integers, the high dword is already pushed }
emit_reg(A_PUSH,S_L,hregister);
{$ifdef AllocEDI}
{$ifndef noAllocEdi}
if hregister = R_EDI then
exprasmlist^.concat(new(pairegalloc,dealloc(R_EDI)));
{$endif AllocEDI}
ungetregister32(R_EDI);
{$endif noAllocEdi}
r:=new_reference(R_ESP,0);
case porddef(pfrom^.resulttype)^.typ of
u32bit:
@ -774,16 +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}
{$ifndef noAllocEdi}
getexplicitregister32(R_EDI);
{$endif noAllocEdi}
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_TEST,S_L,$80000000,R_EDI);
{$ifdef AllocEDI}
exprasmlist^.concat(new(pairegalloc,dealloc(R_EDI)));
{$endif AllocEDI}
{$ifndef noAllocEdi}
ungetregister32(R_EDI);
{$endif noAllocEdi}
r:=new_reference(R_ESP,0);
emit_ref(A_FILD,S_IQ,r);
getdatalabel(l1);
@ -802,13 +802,13 @@ implementation
else
begin
emit_ref(A_FILD,S_IL,r);
{$ifdef AllocEDI}
exprasmlist^.concat(new(pairegalloc,alloc(R_EDI)));
{$endif AllocEDI}
{$ifndef noAllocEdi}
getexplicitregister32(R_EDI);
{$endif noAllocEdi}
emit_reg(A_POP,S_L,R_EDI);
{$ifdef AllocEDI}
exprasmlist^.concat(new(pairegalloc,dealloc(R_EDI)));
{$endif AllocEDI}
{$ifndef noAllocEdi}
ungetregister32(R_EDI);
{$endif noAllocEdi}
end;
end;
inc(fpuvaroffset);
@ -847,13 +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}
{$ifndef noAllocEdi}
getexplicitregister32(R_EDI);
{$endif noAllocEdi}
emit_reg(A_POP,S_L,R_EDI);
{$ifdef AllocEDI}
exprasmlist^.concat(new(pairegalloc,dealloc(R_EDI)));
{$endif AllocEDI}
{$ifndef noAllocEdi}
ungetregister32(R_EDI);
{$endif noAllocEdi}
clear_location(pto^.location);
pto^.location.loc:=LOC_REGISTER;
@ -1390,31 +1390,31 @@ implementation
r^.base:=p^.location.register
else
begin
{$ifdef AllocEDI}
exprasmlist^.concat(new(pairegalloc,alloc(R_EDI)));
{$endif AllocEDI}
{$ifndef noAllocEdi}
getexplicitregister32(R_EDI);
{$endif noAllocEdi}
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}
{$ifndef noAllocEdi}
ungetregister32(R_EDI);
{$endif noAllocEdi}
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}
{$ifndef noAllocEdi}
getexplicitregister32(R_EDI);
{$endif noAllocEdi}
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}
{$ifndef noAllocEdi}
ungetregister32(R_EDI);
{$endif noAllocEdi}
emitcall('FPC_CHECK_OBJECT_EXT');
emitlab(nillabel);
end;
@ -1533,7 +1533,14 @@ implementation
end.
{
$Log$
Revision 1.99 2000-01-09 01:44:19 jonas
Revision 1.100 2000-01-09 12:35:00 jonas
* changed edi allocation to use getexplicitregister32/ungetregister
(adapted tgeni386 a bit for this) and enabled it by default
* fixed very big and stupid bug of mine in cg386mat that broke the
include() code (and make cycle :( ) if you compiled without
-dnewoptimizations
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 ;)

View File

@ -191,9 +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}
{$ifndef noAllocEdi}
getexplicitregister32(R_EDI);
{$endif noAllocEdi}
emit_ref_reg(A_LEA,S_L,r,R_EDI)
end;
@ -236,9 +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}
{$ifndef noAllocEdi}
ungetregister32(R_EDI);
{$endif noAllocEdi}
end
else
begin
@ -264,9 +264,9 @@ implementation
CGMessage(cg_e_illegal_expression);
exit;
end;
{$ifdef AllocEDI}
exprasmlist^.concat(new(pairegalloc,alloc(R_EDI)));
{$endif AllocEDI}
{$ifndef noAllocEdi}
getexplicitregister32(R_EDI);
{$endif noAllocEdi}
emit_ref_reg(A_LEA,S_L,newreference(node^.left^.location.reference),R_EDI);
@ -281,9 +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}
{$ifndef noAllocEdi}
ungetregister32(R_EDI);
{$endif noAllocEdi}
if doread then
{ parameter by READ gives call by reference }
dummycoll.paratyp:=vs_var
@ -798,21 +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}
{$ifndef noAllocEdi}
getexplicitregister32(R_EDI);
{$endif noAllocEdi}
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}
{$ifndef noAllocEdi}
ungetregister32(R_EDI);
{$endif noAllocEdi}
Disposetree(code_para);
End;
{restore the address of the result}
{$ifdef AllocEDI}
exprasmlist^.concat(new(pairegalloc,alloc(R_EDI)));
{$endif AllocEDI}
{$ifndef noAllocEdi}
getexplicitregister32(R_EDI);
{$endif noAllocEdi}
emit_reg(A_POP,S_L,R_EDI);
{set up hr2 to a refernce with EDI as base register}
@ -845,9 +845,9 @@ implementation
end;
End;
End;
{$ifdef AllocEDI}
exprasmlist^.concat(new(pairegalloc,dealloc(R_EDI)));
{$endif AllocEDI}
{$ifndef noAllocEdi}
ungetregister32(R_EDI);
{$endif noAllocEdi}
If (cs_check_range in aktlocalswitches) and
(dest_para^.left^.resulttype^.deftype = orddef) and
(not(is_64bitint(dest_para^.left^.resulttype))) and
@ -1380,9 +1380,9 @@ implementation
hregister:=p^.left^.right^.left^.location.register
else
begin
{$ifdef AllocEDI}
exprasmlist^.concat(new(pairegalloc,alloc(R_EDI)));
{$endif AllocEDI}
{$ifndef noAllocEdi}
getexplicitregister32(R_EDI);
{$endif noAllocEdi}
hregister:=R_EDI;
opsize:=def2def_opsize(p^.left^.right^.left^.resulttype,u32bitdef);
if opsize in [S_B,S_W,S_L] then
@ -1398,10 +1398,10 @@ implementation
else
emit_reg_reg(asmop,S_L,hregister,
p^.left^.left^.location.register);
{$ifdef AllocEDI}
{$ifndef noAllocEdi}
if hregister = R_EDI then
exprasmlist^.concat(new(pairegalloc,dealloc(R_EDI)));
{$endif AllocEDI}
ungetregister32(R_EDI);
{$endif noAllocEdi}
end
else
begin
@ -1510,7 +1510,14 @@ implementation
end.
{
$Log$
Revision 1.88 2000-01-09 01:44:19 jonas
Revision 1.89 2000-01-09 12:35:00 jonas
* changed edi allocation to use getexplicitregister32/ungetregister
(adapted tgeni386 a bit for this) and enabled it by default
* fixed very big and stupid bug of mine in cg386mat that broke the
include() code (and make cycle :( ) if you compiled without
-dnewoptimizations
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 ;)

View File

@ -300,9 +300,9 @@ implementation
LOC_MEM,
LOC_REFERENCE:
begin
{$ifdef AllocEDI}
exprasmlist^.concat(new(pairegalloc,alloc(R_EDI)));
{$endif AllocEDI}
{$ifndef noAllocEdi}
getexplicitregister32(R_EDI);
{$endif noAllocEdi}
hregister:=R_EDI;
if pobjectdef(p^.left^.resulttype)^.is_class then
emit_ref_reg(A_MOV,S_L,
@ -346,15 +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}
{$ifndef noAllocEdi}
ungetregister32(R_EDI);
{$endif noAllocEdi}
end
else
begin
{$ifdef AllocEDI}
exprasmlist^.concat(new(pairegalloc,dealloc(R_EDI)));
{$endif AllocEDI}
{$ifndef noAllocEdi}
ungetregister32(R_EDI);
{$endif noAllocEdi}
s:=newasmsymbol(pprocsym(p^.symtableentry)^.definition^.mangledname);
emit_sym_ofs_ref(A_MOV,S_L,s,0,
newreference(p^.location.reference));
@ -1005,7 +1005,14 @@ implementation
end.
{
$Log$
Revision 1.95 2000-01-09 01:44:20 jonas
Revision 1.96 2000-01-09 12:35:01 jonas
* changed edi allocation to use getexplicitregister32/ungetregister
(adapted tgeni386 a bit for this) and enabled it by default
* fixed very big and stupid bug of mine in cg386mat that broke the
include() code (and make cycle :( ) if you compiled without
-dnewoptimizations
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 ;)

View File

@ -152,9 +152,9 @@ implementation
end
else
begin
{$ifdef AllocEDI}
exprasmlist^.concat(new(pairegalloc,alloc(R_EDI)));
{$endif AllocEDI}
{$ifndef noAllocEdi}
getexplicitregister32(R_EDI);
{$endif noAllocEdi}
hreg2 := R_EDI;
emit_reg_reg(A_MOV,S_L,hreg1,R_EDI);
{ if the left value is signed, R_EDI := $ffffffff,
@ -166,13 +166,13 @@ implementation
{ 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}
;
{$ifndef noAllocEdi}
{ also releas EDI }
ungetregister32(hreg2);
{$else noAllocEdi}
if (hreg2 = R_EDX) then
ungetregister32(hreg2);
{$endif noAllocEdi}
{ do the shift }
emit_const_reg(A_SAR,S_L,power,hreg1);
end
@ -188,6 +188,7 @@ implementation
else
emit_const_reg(A_ADD,S_L,p^.right^.value-1,hreg1);
emitlab(hl);
emit_const_reg(A_SAR,S_L,power,hreg1);
end
End
Else
@ -207,9 +208,9 @@ implementation
{ EDI is always free, it's }
{ only used for temporary }
{ purposes }
{$ifdef AllocEDI}
exprasmlist^.concat(new(pairegalloc,alloc(R_EDI)));
{$endif AllocEDI}
{$ifndef noAllocEdi}
getexplicitregister32(R_EDI);
{$endif noAllocEdi}
if (p^.right^.location.loc<>LOC_REGISTER) and
(p^.right^.location.loc<>LOC_CREGISTER) then
begin
@ -261,9 +262,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}
{$ifndef noAllocEdi}
ungetregister32(R_EDI);
{$endif noAllocEdi}
if p^.treetype=divn then
begin
{ if result register is busy then copy }
@ -889,9 +890,9 @@ implementation
secondpass(p^.left);
p^.location.loc:=LOC_MMXREGISTER;
{ prepare EDI }
{$ifdef AllocEDI}
exprasmlist^.concat(new(pairegalloc,alloc(R_EDI)));
{$endif AllocEDI}
{$ifndef noAllocEdi}
getexplicitregister32(R_EDI);
{$endif noAllocEdi}
emit_const_reg(A_MOV,S_L,$ffffffff,R_EDI);
{ load operand }
case p^.left^.location.loc of
@ -912,9 +913,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}
{$ifndef noAllocEdi}
ungetregister32(R_EDI);
{$endif noAllocEdi}
{ lower 32 bit }
emit_reg_reg(A_PXOR,S_D,R_MM7,p^.location.register);
{ shift mask }
@ -995,7 +996,14 @@ implementation
end.
{
$Log$
Revision 1.39 2000-01-09 01:44:20 jonas
Revision 1.40 2000-01-09 12:35:01 jonas
* changed edi allocation to use getexplicitregister32/ungetregister
(adapted tgeni386 a bit for this) and enabled it by default
* fixed very big and stupid bug of mine in cg386mat that broke the
include() code (and make cycle :( ) if you compiled without
-dnewoptimizations
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 ;)

View File

@ -826,10 +826,10 @@ implementation
p^.islocal:=true;
end
else
{ call can happend with a property }
{$ifdef AllocEDI}
exprasmlist^.concat(new(pairegalloc,alloc(R_EDI)));
{$endif AllocEDI}
{ call can have happend with a property }
{$ifndef noAllocEdi}
getexplicitregister32(R_EDI);
{$endif noAllocEdi}
if { (p^.left^.treetype=calln) and Don't think that
this is necessary (FK) }
(p^.left^.resulttype^.deftype=objectdef) and
@ -866,9 +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}
{$ifndef noAllocEdi}
ungetregister32(R_EDI);
{$endif noAllocEdi}
del_reference(p^.left^.location.reference);
end;
@ -891,7 +891,14 @@ implementation
end.
{
$Log$
Revision 1.67 2000-01-09 01:44:20 jonas
Revision 1.68 2000-01-09 12:35:02 jonas
* changed edi allocation to use getexplicitregister32/ungetregister
(adapted tgeni386 a bit for this) and enabled it by default
* fixed very big and stupid bug of mine in cg386mat that broke the
include() code (and make cycle :( ) if you compiled without
-dnewoptimizations
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 ;)

View File

@ -371,9 +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}
{$ifndef noAllocEdi}
getexplicitregister32(R_EDI);
{$endif noAllocEdi}
emit_ref_reg(A_MOVZX,S_BL,
newreference(p^.left^.location.reference),R_EDI);
hr:=R_EDI;
@ -403,11 +403,12 @@ implementation
newreference(p^.right^.location.reference));
end;
end;
{$ifdef AllocEDI}
if hr = R_EDI then
exprasmlist^.concat(new(pairegalloc,alloc(R_EDI)));
{$endif AllocEDI}
{$ifndef noAllocEdi}
{ simply to indicate EDI is deallocated here too (JM) }
ungetregister32(hr);
{$else noAllocEdi}
ungetregister32(hr);
{$endif noAllocEdi}
p^.location.loc:=LOC_FLAGS;
p^.location.resflags:=F_C;
end;
@ -905,7 +906,14 @@ implementation
end.
{
$Log$
Revision 1.46 2000-01-09 01:44:21 jonas
Revision 1.47 2000-01-09 12:35:02 jonas
* changed edi allocation to use getexplicitregister32/ungetregister
(adapted tgeni386 a bit for this) and enabled it by default
* fixed very big and stupid bug of mine in cg386mat that broke the
include() code (and make cycle :( ) if you compiled without
-dnewoptimizations
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 ;)

View File

@ -448,10 +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}
{$ifndef noAllocEdi}
if hreg in [R_DI,R_EDI] then
exprasmlist^.concat(new(pairegalloc,alloc(R_EDI)));
{$endif AllocEDI}
getexplicitregister32(R_EDI);
{$endif noAllocEdi}
emit_ref_reg(A_MOV,siz,
newreference(t.reference),hreg);
del_reference(t.reference);
@ -464,10 +464,10 @@ procedure mov_reg_to_dest(p : ptree; s : topsize; reg : tregister);
else
ungetregister(hreg);
end;
{$ifdef AllocEDI}
{$ifndef noAllocEdi}
if hreg in [R_DI,R_EDI] then
exprasmlist^.concat(new(pairegalloc,dealloc(R_EDI)));
{$endif AllocEDI}
ungetregister32(R_EDI);
{$endif noAllocEdi}
{ we can release the registers }
{ but only AFTER the MOV! Important for the optimizer!
(JM)}
@ -706,16 +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}
{$ifndef noAllocEdi}
getexplicitregister32(R_EDI);
{$endif noAllocEdi}
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}
{$ifndef noAllocEdi}
ungetregister32(R_EDI);
{$endif noAllocEdi}
end;
{ release the registers }
del_reference(t.reference);
@ -737,15 +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}
{$ifndef noAllocEdi}
getexplicitregister32(R_EDI);
{$endif noAllocEdi}
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}
{$ifndef noAllocEdi}
ungetregister32(R_EDI);
{$endif noAllocEdi}
end;
if freetemp then
ungetiftemp(t.reference);
@ -988,9 +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}
{$ifndef noAllocEdi}
getexplicitregister32(R_EDI);
{$endif noAllocEdi}
emit_ref_reg(A_LEA,S_L,newreference(p^.location.reference),
R_EDI);
{$ifdef TEMPS_NOT_PUSH}
@ -1000,9 +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}
{$ifndef noAllocEdi}
ungetregister32(R_EDI);
{$endif noAllocEdi}
pushed:=true;
end
else pushed:=false;
@ -1047,16 +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}
{$ifndef noAllocEdi}
getexplicitregister32(R_EDI);
{$endif noAllocEdi}
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}
{$ifndef noAllocEdi}
ungetregister32(R_EDI);
{$endif noAllocEdi}
p^.temp_offset:=href.offset;
pushed:=true;
end
@ -1075,14 +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}
{$ifndef noAllocEdi}
getexplicitregister32(R_EDI);
{$endif noAllocEdi}
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}
{$ifndef noAllocEdi}
ungetregister32(R_EDI);
{$endif noAllocEdi}
end
else
exprasmlist^.concat(new(paicpu,op_const(A_PUSH,S_L,l)));
@ -1099,14 +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}
{$ifndef noAllocEdi}
getexplicitregister32(R_EDI);
{$endif noAllocEdi}
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}
{$ifndef noAllocEdi}
ungetregister32(R_EDI);
{$endif noAllocEdi}
end
else exprasmlist^.concat(new(paicpu,op_ref(A_PUSH,S_L,newreference(ref))));
end;
@ -1141,14 +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}
{$ifndef noAllocEdi}
getexplicitregister32(R_EDI);
{$endif noAllocEdi}
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}
{$ifndef noAllocEdi}
ungetregister32(R_EDI);
{$endif noAllocEdi}
end;
end;
end;
@ -1453,25 +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}
{$ifndef noAllocEdi}
getexplicitregister32(R_EDI);
{$endif noAllocEdi}
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}
{$ifndef noAllocEdi}
ungetregister32(R_EDI);
getexplicitregister32(R_EDI);
{$endif noAllocEdi}
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}
{$ifndef noAllocEdi}
ungetregister32(R_EDI);
{$endif noAllocEdi}
end
else
begin
@ -1485,16 +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}
{$ifndef noAllocEdi}
getexplicitregister32(R_EDI);
{$endif noAllocEdi}
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}
{$ifndef noAllocEdi}
ungetregister32(R_EDI);
{$endif noAllocEdi}
end
else
emit_push_mem(tempreference);
@ -1514,16 +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}
{$ifndef noAllocEdi}
getexplicitregister32(R_EDI);
{$endif noAllocEdi}
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}
{$ifndef noAllocEdi}
ungetregister32(R_EDI);
{$endif noAllocEdi}
end
else
exprasmlist^.concat(new(paicpu,op_ref(A_PUSH,opsize,
@ -1542,16 +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}
{$ifndef noAllocEdi}
getexplicitregister32(R_EDI);
{$endif noAllocEdi}
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}
{$ifndef noAllocEdi}
ungetregister32(R_EDI);
{$endif noAllocEdi}
end
else
emit_push_mem(tempreference);
@ -1563,16 +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}
{$ifndef noAllocEdi}
getexplicitregister32(R_EDI);
{$endif noAllocEdi}
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}
{$ifndef noAllocEdi}
ungetregister32(R_EDI);
{$endif noAllocEdi}
end
else
emit_push_mem(tempreference);
@ -1580,16 +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}
{$ifndef noAllocEdi}
getexplicitregister32(R_EDI);
{$endif noAllocEdi}
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}
{$ifndef noAllocEdi}
ungetregister32(R_EDI);
{$endif noAllocEdi}
end
else
emit_push_mem(tempreference);
@ -1603,16 +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}
{$ifndef noAllocEdi}
getexplicitregister32(R_EDI);
{$endif noAllocEdi}
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}
{$ifndef noAllocEdi}
ungetregister32(R_EDI);
{$endif noAllocEdi}
end
else
emit_push_mem(tempreference);
@ -1620,16 +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}
{$ifndef noAllocEdi}
getexplicitregister32(R_EDI);
{$endif noAllocEdi}
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}
{$ifndef noAllocEdi}
ungetregister32(R_EDI);
{$endif noAllocEdi}
end
else
emit_push_mem(tempreference);
@ -1649,16 +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}
{$ifndef noAllocEdi}
getexplicitregister32(R_EDI);
{$endif noAllocEdi}
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}
{$ifndef noAllocEdi}
ungetregister32(R_EDI);
{$endif noAllocEdi}
end
else
exprasmlist^.concat(new(paicpu,op_ref(A_PUSH,opsize,
@ -1673,16 +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}
{$ifndef noAllocEdi}
getexplicitregister32(R_EDI);
{$endif noAllocEdi}
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}
{$ifndef noAllocEdi}
ungetregister32(R_EDI);
{$endif noAllocEdi}
end
else
emit_push_mem(tempreference);
@ -1775,11 +1775,13 @@ 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);
begin
{$ifndef noAllocEdi}
getexplicitregister32(R_EDI);
{$endif noAllocEdi}
emit_reg_reg(A_MOV,S_L,R_EAX,R_EDI);
end;
emit_flag2reg(p^.location.resflags,R_AL);
emit_reg_reg(A_MOVZX,S_BW,R_AL,R_AX);
if alignment=4 then
@ -1804,9 +1806,9 @@ procedure mov_reg_to_dest(p : ptree; s : topsize; reg : tregister);
if not(R_EAX in unused) then
begin
emit_reg_reg(A_MOV,S_L,R_EDI,R_EAX);
{$ifdef AllocEDI}
exprasmlist^.concat(new(pairegalloc,dealloc(R_EDI)));
{$endif AllocEDI}
{$ifndef noAllocEdi}
ungetregister32(R_EDI);
{$endif noAllocEdi}
end;
end;
{$ifdef SUPPORT_MMX}
@ -2108,27 +2110,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}
{$ifndef noAllocEdi}
getexplicitregister32(R_EDI);
{$endif noAllocEdi}
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}
{$ifndef noAllocEdi}
ungetregister32(R_EDI);
{$endif noAllocEdi}
{ 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}
{$ifndef noAllocEdi}
getexplicitregister32(R_EDI);
{$endif noAllocEdi}
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}
{$ifndef noAllocEdi}
ungetregister32(R_EDI);
{$endif noAllocEdi}
emitlab(poslabel);
end;
if popecx then
@ -2146,18 +2148,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}
{$ifndef noAllocEdi}
getexplicitregister32(R_EDI);
{$endif noAllocEdi}
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}
{$ifndef noAllocEdi}
getexplicitregister32(R_EDI);
{$endif noAllocEdi}
emit_ref_reg(op,opsize,newreference(p^.location.reference),R_EDI);
hreg:=R_EDI;
end;
@ -2179,10 +2181,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}
{$ifndef noAllocEdi}
if hreg = R_EDI then
exprasmlist^.concat(new(pairegalloc,dealloc(R_EDI)));
{$endif AllocEDI}
ungetregister32(R_EDI);
{$endif noAllocEdi}
end;
end;
@ -2219,9 +2221,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}
{$ifndef noAllocEdi}
getexplicitregister32(R_EDI);
{$endif noAllocEdi}
for i:=1 to helpsize do
begin
emit_ref_reg(A_MOV,S_L,newreference(source),R_EDI);
@ -2246,9 +2248,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}
{$ifndef noAllocEdi}
ungetregister32(R_EDI);
{$endif noAllocEdi}
if size>0 then
begin
{ and now look for an 8 bit register }
@ -2281,9 +2283,9 @@ procedure mov_reg_to_dest(p : ptree; s : topsize; reg : tregister);
if swap then
{ was earlier XCHG, of course nonsense }
begin
{$ifdef AllocEDI}
exprasmlist^.concat(new(pairegalloc,alloc(R_EDI)));
{$endif AllocEDI}
{$ifndef noAllocEdi}
getexplicitregister32(R_EDI);
{$endif noAllocEdi}
emit_reg_reg(A_MOV,S_L,reg32,R_EDI);
end;
emit_ref_reg(A_MOV,S_B,newreference(source),reg8);
@ -2295,25 +2297,25 @@ procedure mov_reg_to_dest(p : ptree; s : topsize; reg : tregister);
if swap then
begin
emit_reg_reg(A_MOV,S_L,R_EDI,reg32);
{$ifdef AllocEDI}
exprasmlist^.concat(new(pairegalloc,dealloc(R_EDI)));
{$endif AllocEDI}
{$ifndef noAllocEdi}
ungetregister32(R_EDI);
{$endif noAllocEdi}
end;
end;
end
else
begin
{$ifdef AllocEDI}
exprasmlist^.concat(new(pairegalloc,alloc(R_EDI)));
{$endif AllocEDI}
{$ifndef noAllocEdi}
getexplicitregister32(R_EDI);
{$endif noAllocEdi}
emit_ref_reg(A_LEA,S_L,newreference(dest),R_EDI);
{$ifdef regallocfix}
{is this ok?? (JM)}
del_reference(dest);
{$endif regallocfix}
{$ifdef AllocEDI}
{$ifndef noAllocEdi}
exprasmlist^.concat(new(pairegalloc,alloc(R_ESI)));
{$endif AllocEDI}
{$endif noAllocEdi}
if loadref then
emit_ref_reg(A_MOV,S_L,newreference(source),R_ESI)
else
@ -2354,15 +2356,12 @@ 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)));
{$ifndef noAllocEdi}
ungetregister32(R_EDI);
exprasmlist^.concat(new(pairegalloc,dealloc(R_ESI)));
{$endif AllocEDI}
{$endif noAllocEdi}
if ecxpushed then
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;
@ -2446,15 +2445,15 @@ procedure mov_reg_to_dest(p : ptree; s : topsize; reg : tregister);
begin
if assigned(procinfo^._class) then
begin
{$ifndef noAllocEdi}
exprasmlist^.concat(new(pairegalloc,alloc(R_ESI)));
{$endif noAllocEdi}
if lexlevel>normal_function_level then
begin
new(hp);
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
@ -2777,9 +2776,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}
{$ifndef noAllocEdi}
getexplicitregister32(R_EDI);
{$endif noAllocEdi}
exprasmlist^.concat(new(paicpu,
op_ref_reg(A_MOV,S_L,r,R_EDI)));
@ -2811,17 +2810,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}
{$ifndef noAllocEdi}
ungetregister32(R_EDI);
{$endif noAllocEdi}
{ 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}
{$ifndef noAllocEdi}
getexplicitregister32(R_EDI);
{$endif noAllocEdi}
exprasmlist^.concat(new(paicpu,
op_ref_reg(A_MOV,S_L,r,R_EDI)));
@ -2843,10 +2842,6 @@ 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,
@ -2896,11 +2891,9 @@ 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}
{$ifndef noAllocEdi}
ungetregister32(R_EDI);
{$endif noAllocEdi}
exprasmlist^.concat(new(paicpu,
op_reg(A_POP,S_L,R_ESI)));
exprasmlist^.concat(new(paicpu,
@ -3079,9 +3072,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}
{$ifndef noAllocEdi}
getexplicitregister32(R_EDI);
{$endif noAllocEdi}
exprasmlist^.insert(new(paicpu,op_const_reg(A_MOV,S_L,procinfo^._class^.vmt_offset,R_EDI)));
end;
end;
@ -3096,9 +3089,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}
{$ifndef noAllocEdi}
exprasmlist^.concat(new(pairegalloc,alloc(R_ESI)));
{$endif AllocEDI}
{$endif noAllocEdi}
exprasmlist^.insert(new(paicpu,op_ref_reg(A_MOV,S_L,hr,R_ESI)));
end;
{ should we save edi,esi,ebx like C ? }
@ -3183,9 +3176,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}
{$ifndef noAllocEdi}
getexplicitregister32(R_EDI);
{$endif noAllocEdi}
exprasmlist^.concat(new(paicpu,
op_const_reg(A_MOV,S_L,stackframe div winstackpagesize,R_EDI)));
emitlab(again);
@ -3196,9 +3189,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}
{$ifndef noAllocEdi}
ungetregister32(R_EDI);
{$endif noAllocEdi}
exprasmlist^.concat(new(paicpu,
op_const_reg(A_SUB,S_L,stackframe mod winstackpagesize,R_ESP)));
end
@ -3407,9 +3400,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}
{$ifndef noAllocEdi}
getexplicitregister32(R_EDI);
{$endif noAllocEdi}
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
@ -3417,9 +3410,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}
{$ifndef noAllocEdi}
ungetregister32(R_EDI);
{$endif noAllocEdi}
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));
@ -3495,14 +3488,14 @@ 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}
{$ifndef noAllocEdi}
getexplicitregister32(R_EDI);
{$endif noAllocEdi}
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}
{$ifndef noAllocEdi}
ungetregister32(R_EDI);
{$endif noAllocEdi}
end;
emitlab(okexitlabel);
@ -3667,7 +3660,14 @@ procedure mov_reg_to_dest(p : ptree; s : topsize; reg : tregister);
end.
{
$Log$
Revision 1.67 2000-01-09 01:44:21 jonas
Revision 1.68 2000-01-09 12:35:02 jonas
* changed edi allocation to use getexplicitregister32/ungetregister
(adapted tgeni386 a bit for this) and enabled it by default
* fixed very big and stupid bug of mine in cg386mat that broke the
include() code (and make cycle :( ) if you compiled without
-dnewoptimizations
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 ;)

View File

@ -815,20 +815,6 @@ Begin
End;
End
Else
{remove an instruction which never makes sense: we've got
"mov mem, %reg1; mov %reg1, %edi" and then EDI isn't used anymore!}
{ Begin
If (Paicpu(hp1)^.oper[1].reg = R_EDI) And
Not(GetNextInstruction(hp1, hp2) And
(Pai(hp2)^.typ = ait_instruction) And
(Paicpu(hp2)^.oper[1].typ = top_reg) And
(Paicpu(hp2)^.oper[1] = Pointer(R_ESI))) Then
Begin
AsmL^.Remove(hp1);
Dispose(hp1, Done);
Continue;
End
End}
Else
{Change "mov %reg1, %reg2; xxx %reg2, ???" to
"mov %reg1, %reg2; xxx %reg1, ???" to avoid a write/read
@ -1743,7 +1729,14 @@ End.
{
$Log$
Revision 1.76 2000-01-07 01:14:30 peter
Revision 1.77 2000-01-09 12:35:02 jonas
* changed edi allocation to use getexplicitregister32/ungetregister
(adapted tgeni386 a bit for this) and enabled it by default
* fixed very big and stupid bug of mine in cg386mat that broke the
include() code (and make cycle :( ) if you compiled without
-dnewoptimizations
Revision 1.76 2000/01/07 01:14:30 peter
* updated copyright to 2000
Revision 1.75 1999/12/30 17:56:44 peter

View File

@ -354,6 +354,13 @@ implementation
procedure ungetregister32(r : tregister);
begin
{$ifndef noAllocEdi}
if r = R_EDI then
begin
exprasmlist^.concat(new(pairegalloc,dealloc(r)));
exit;
end;
{$endif noAllocEdi}
if cs_regalloc in aktglobalswitches then
begin
{ takes much time }
@ -541,6 +548,14 @@ implementation
function getexplicitregister32(r : tregister) : tregister;
begin
{$ifndef noAllocEdi}
if r = R_EDI then
begin
exprasmlist^.concat(new(pairegalloc,alloc(r)));
getexplicitregister32 := r;
exit;
end;
{$endif noAllocEdi}
if r in unused then
begin
dec(usablereg32);
@ -615,7 +630,14 @@ begin
end.
{
$Log$
Revision 1.37 2000-01-07 01:14:47 peter
Revision 1.38 2000-01-09 12:35:02 jonas
* changed edi allocation to use getexplicitregister32/ungetregister
(adapted tgeni386 a bit for this) and enabled it by default
* fixed very big and stupid bug of mine in cg386mat that broke the
include() code (and make cycle :( ) if you compiled without
-dnewoptimizations
Revision 1.37 2000/01/07 01:14:47 peter
* updated copyright to 2000
Revision 1.36 1999/11/06 14:34:31 peter