* several rg.allocexplicitregistersint/rg.deallocexplicitregistersint

pairs round calls to helpers
This commit is contained in:
Jonas Maebe 2003-07-23 11:01:14 +00:00
parent 356ee447ba
commit 355f84758e
5 changed files with 234 additions and 27 deletions

View File

@ -1394,10 +1394,16 @@ unit cgobj;
if delsource then
reference_release(list,source);
a_param_const(list,OS_INT,len,paramanager.getintparaloc(list,1));
a_call_name(list,'FPC_SHORTSTR_ASSIGN');
paramanager.freeintparaloc(list,3);
paramanager.freeintparaloc(list,2);
paramanager.freeintparaloc(list,1);
{$ifdef newra}
rg.allocexplicitregistersint(list,VOLATILE_INTREGISTERS);
{$endif newra}
a_call_name(list,'FPC_SHORTSTR_ASSIGN');
{$ifdef newra}
rg.deallocexplicitregistersint(list,VOLATILE_INTREGISTERS);
{$endif newra}
end;
@ -1423,7 +1429,14 @@ unit cgobj;
begin
{ these functions get the pointer by value }
a_param_ref(list,OS_ADDR,ref,paramanager.getintparaloc(list,1));
paramanager.freeintparaloc(list,1);
{$ifdef newra}
rg.allocexplicitregistersint(list,VOLATILE_INTREGISTERS);
{$endif newra}
a_call_name(list,incrfunc);
{$ifdef newra}
rg.deallocexplicitregistersint(list,VOLATILE_INTREGISTERS);
{$endif newra}
end
else
begin
@ -1433,10 +1446,16 @@ unit cgobj;
a_param_ref(list,OS_ADDR,ref,paramanager.getintparaloc(list,1))
else
a_paramaddr_ref(list,ref,paramanager.getintparaloc(list,1));
a_call_name(list,'FPC_ADDREF');
paramanager.freeintparaloc(list,1);
paramanager.freeintparaloc(list,2);
{$ifdef newra}
rg.allocexplicitregistersint(list,VOLATILE_INTREGISTERS);
{$endif newra}
a_call_name(list,'FPC_ADDREF');
{$ifdef newra}
rg.deallocexplicitregistersint(list,VOLATILE_INTREGISTERS);
{$endif newra}
end;
paramanager.freeintparaloc(list,1);
end;
@ -1472,7 +1491,14 @@ unit cgobj;
a_param_ref(list,OS_ADDR,ref,paramanager.getintparaloc(list,1))
else
a_paramaddr_ref(list,ref,paramanager.getintparaloc(list,1));
paramanager.freeintparaloc(list,1);
{$ifdef newra}
rg.allocexplicitregistersint(list,VOLATILE_INTREGISTERS);
{$endif newra}
a_call_name(list,decrfunc);
{$ifdef newra}
rg.deallocexplicitregistersint(list,VOLATILE_INTREGISTERS);
{$endif newra}
if needrtti then
paramanager.freeintparaloc(list,2);
end
@ -1484,10 +1510,16 @@ unit cgobj;
a_param_ref(list,OS_ADDR,ref,paramanager.getintparaloc(list,1))
else
a_paramaddr_ref(list,ref,paramanager.getintparaloc(list,1));
a_call_name(list,'FPC_DECREF');
paramanager.freeintparaloc(list,1);
paramanager.freeintparaloc(list,2);
{$ifdef newra}
rg.allocexplicitregistersint(list,VOLATILE_INTREGISTERS);
{$endif newra}
a_call_name(list,'FPC_DECREF');
{$ifdef newra}
rg.deallocexplicitregistersint(list,VOLATILE_INTREGISTERS);
{$endif newra}
end;
paramanager.freeintparaloc(list,1);
end;
@ -1507,9 +1539,15 @@ unit cgobj;
a_param_ref(list,OS_ADDR,ref,paramanager.getintparaloc(list,1))
else
a_paramaddr_ref(list,ref,paramanager.getintparaloc(list,1));
a_call_name(list,'FPC_INITIALIZE');
paramanager.freeintparaloc(list,1);
paramanager.freeintparaloc(list,2);
{$ifdef newra}
rg.allocexplicitregistersint(list,VOLATILE_INTREGISTERS);
{$endif newra}
a_call_name(list,'FPC_INITIALIZE');
{$ifdef newra}
rg.deallocexplicitregistersint(list,VOLATILE_INTREGISTERS);
{$endif newra}
end;
end;
@ -1530,9 +1568,15 @@ unit cgobj;
a_param_ref(list,OS_ADDR,ref,paramanager.getintparaloc(list,1))
else
a_paramaddr_ref(list,ref,paramanager.getintparaloc(list,1));
a_call_name(list,'FPC_FINALIZE');
paramanager.freeintparaloc(list,1);
paramanager.freeintparaloc(list,2);
{$ifdef newra}
rg.allocexplicitregistersint(list,VOLATILE_INTREGISTERS);
{$endif newra}
a_call_name(list,'FPC_FINALIZE');
{$ifdef newra}
rg.deallocexplicitregistersint(list,VOLATILE_INTREGISTERS);
{$endif newra}
end;
end;
@ -1710,16 +1754,28 @@ unit cgobj;
reference_reset_symbol(hrefvmt,objectlibrary.newasmsymboldata(objdef.vmt_mangledname),0);
a_paramaddr_ref(list,hrefvmt,paramanager.getintparaloc(list,2));
a_param_reg(list,OS_ADDR,reg,paramanager.getintparaloc(list,1));
a_call_name(list,'FPC_CHECK_OBJECT_EXT');
paramanager.freeintparaloc(list,2);
paramanager.freeintparaloc(list,1);
{$ifdef newra}
rg.allocexplicitregistersint(list,VOLATILE_INTREGISTERS);
{$endif newra}
a_call_name(list,'FPC_CHECK_OBJECT_EXT');
{$ifdef newra}
rg.deallocexplicitregistersint(list,VOLATILE_INTREGISTERS);
{$endif newra}
end
else
if (cs_check_range in aktlocalswitches) then
begin
a_param_reg(list,OS_ADDR,reg,paramanager.getintparaloc(list,1));
a_call_name(list,'FPC_CHECK_OBJECT');
paramanager.freeintparaloc(list,1);
{$ifdef newra}
rg.allocexplicitregistersint(list,VOLATILE_INTREGISTERS);
{$endif newra}
a_call_name(list,'FPC_CHECK_OBJECT');
{$ifdef newra}
rg.deallocexplicitregistersint(list,VOLATILE_INTREGISTERS);
{$endif newra}
end;
end;
@ -1795,7 +1851,11 @@ finalization
end.
{
$Log$
Revision 1.114 2003-07-06 17:58:22 peter
Revision 1.115 2003-07-23 11:01:14 jonas
* several rg.allocexplicitregistersint/rg.deallocexplicitregistersint
pairs round calls to helpers
Revision 1.114 2003/07/06 17:58:22 peter
* framepointer fixes for sparc
* parent framepointer code more generic

View File

@ -1092,8 +1092,14 @@ implementation
begin
reference_reset_symbol(href,iolabel,0);
cg.a_paramaddr_ref(exprasmlist,href,paramanager.getintparaloc(exprasmlist,1));
cg.a_call_name(exprasmlist,'FPC_IOCHECK');
paramanager.freeintparaloc(exprasmlist,1);
{$ifdef newra}
rg.allocexplicitregistersint(exprasmlist,VOLATILE_INTREGISTERS);
{$endif newra}
cg.a_call_name(exprasmlist,'FPC_IOCHECK');
{$ifdef newra}
rg.deallocexplicitregistersint(exprasmlist,VOLATILE_INTREGISTERS);
{$endif newra}
end;
{ restore registers }
@ -1446,8 +1452,14 @@ implementation
begin
reference_reset_symbol(href,iolabel,0);
cg.a_paramaddr_ref(exprasmlist,href,paramanager.getintparaloc(exprasmlist,1));
cg.a_call_name(exprasmlist,'FPC_IOCHECK');
paramanager.freeintparaloc(exprasmlist,1);
{$ifdef newra}
rg.allocexplicitregistersint(exprasmlist,VOLATILE_INTREGISTERS);
{$endif newra}
cg.a_call_name(exprasmlist,'FPC_IOCHECK');
{$ifdef newra}
rg.deallocexplicitregistersint(exprasmlist,VOLATILE_INTREGISTERS);
{$endif newra}
end;
{ restore registers }
@ -1531,7 +1543,11 @@ begin
end.
{
$Log$
Revision 1.102 2003-07-21 13:51:50 jonas
Revision 1.103 2003-07-23 11:01:14 jonas
* several rg.allocexplicitregistersint/rg.deallocexplicitregistersint
pairs round calls to helpers
Revision 1.102 2003/07/21 13:51:50 jonas
* fixed 64bit int results with -dnewra (you can't free both registers and
then allocate two new ones, because then the registers could be reversed
afterwards -> you get something like "movl %eax, %edx; movl %edx,%eax")

View File

@ -860,15 +860,27 @@ implementation
exit;
{$endif not callparatemp}
cg.a_param_loc(exprasmlist,left.location,paramanager.getintparaloc(exprasmlist,1));
cg.a_call_name(exprasmlist,'FPC_RAISEEXCEPTION');
paramanager.freeintparaloc(exprasmlist,3);
paramanager.freeintparaloc(exprasmlist,2);
paramanager.freeintparaloc(exprasmlist,1);
{$ifdef newra}
rg.allocexplicitregistersint(exprasmlist,VOLATILE_INTREGISTERS);
{$endif newra}
cg.a_call_name(exprasmlist,'FPC_RAISEEXCEPTION');
{$ifdef newra}
rg.deallocexplicitregistersint(exprasmlist,VOLATILE_INTREGISTERS);
{$endif newra}
end
else
begin
{$ifdef newra}
rg.allocexplicitregistersint(exprasmlist,VOLATILE_INTREGISTERS);
{$endif newra}
cg.a_call_name(exprasmlist,'FPC_POPADDRSTACK');
cg.a_call_name(exprasmlist,'FPC_RERAISE');
{$ifdef newra}
rg.deallocexplicitregistersint(exprasmlist,VOLATILE_INTREGISTERS);
{$endif newra}
end;
end;
@ -909,12 +921,24 @@ implementation
var r:Tregister;
begin
{$ifdef newra}
rg.allocexplicitregistersint(exprasmlist,VOLATILE_INTREGISTERS);
{$endif newra}
cg.a_call_name(exprasmlist,'FPC_POPOBJECTSTACK');
{$ifdef newra}
rg.deallocexplicitregistersint(exprasmlist,VOLATILE_INTREGISTERS);
{$endif newra}
r.enum:=R_INTREGISTER;
r.number:=NR_FUNCTION_RESULT_REG;
cg.a_param_reg(exprasmlist,OS_ADDR,r,paramanager.getintparaloc(exprasmlist,1));
cg.a_call_name(exprasmlist,'FPC_DESTROYEXCEPTION');
paramanager.freeintparaloc(exprasmlist,1);
{$ifdef newra}
rg.allocexplicitregistersint(exprasmlist,VOLATILE_INTREGISTERS);
{$endif newra}
cg.a_call_name(exprasmlist,'FPC_DESTROYEXCEPTION');
{$ifdef newra}
rg.deallocexplicitregistersint(exprasmlist,VOLATILE_INTREGISTERS);
{$endif newra}
end;
@ -1019,8 +1043,14 @@ implementation
'default handler' flag (=-1)
}
cg.a_param_const(exprasmlist,OS_ADDR,aword(-1),paramanager.getintparaloc(exprasmlist,1));
cg.a_call_name(exprasmlist,'FPC_CATCHES');
paramanager.freeintparaloc(exprasmlist,1);
{$ifdef newra}
rg.allocexplicitregistersint(exprasmlist,VOLATILE_INTREGISTERS);
{$endif newra}
cg.a_call_name(exprasmlist,'FPC_CATCHES');
{$ifdef newra}
rg.deallocexplicitregistersint(exprasmlist,VOLATILE_INTREGISTERS);
{$endif newra}
{ the destruction of the exception object must be also }
{ guarded by an exception frame }
@ -1038,13 +1068,25 @@ implementation
try_free_exception(exprasmlist,tempbuf,tempaddr,href,0,doobjectdestroy,false);
{$ifdef newra}
rg.allocexplicitregistersint(exprasmlist,VOLATILE_INTREGISTERS);
{$endif newra}
cg.a_call_name(exprasmlist,'FPC_POPSECONDOBJECTSTACK');
{$ifdef newra}
rg.deallocexplicitregistersint(exprasmlist,VOLATILE_INTREGISTERS);
{$endif newra}
r.enum:=R_INTREGISTER;
r.number:=NR_FUNCTION_RESULT_REG;
cg.a_param_reg(exprasmlist, OS_ADDR, r, paramanager.getintparaloc(exprasmlist,1));
cg.a_call_name(exprasmlist,'FPC_DESTROYEXCEPTION');
paramanager.freeintparaloc(exprasmlist,1);
{$ifdef newra}
rg.allocexplicitregistersint(exprasmlist,VOLATILE_INTREGISTERS);
{$endif newra}
cg.a_call_name(exprasmlist,'FPC_DESTROYEXCEPTION');
{$ifdef newra}
rg.deallocexplicitregistersint(exprasmlist,VOLATILE_INTREGISTERS);
{$endif newra}
{ we don't need to restore esi here because reraise never }
{ returns }
cg.a_call_name(exprasmlist,'FPC_RERAISE');
@ -1065,7 +1107,13 @@ implementation
cg.a_label(exprasmlist,exitexceptlabel);
{ we must also destroy the address frame which guards }
{ exception object }
{$ifdef newra}
rg.allocexplicitregistersint(exprasmlist,VOLATILE_INTREGISTERS);
{$endif newra}
cg.a_call_name(exprasmlist,'FPC_POPADDRSTACK');
{$ifdef newra}
rg.deallocexplicitregistersint(exprasmlist,VOLATILE_INTREGISTERS);
{$endif newra}
cg.g_exception_reason_load(exprasmlist,href);
cleanupobjectstack;
cg.a_jmp_always(exprasmlist,oldaktexitlabel);
@ -1076,7 +1124,13 @@ implementation
cg.a_label(exprasmlist,breakexceptlabel);
{ we must also destroy the address frame which guards }
{ exception object }
{$ifdef newra}
rg.allocexplicitregistersint(exprasmlist,VOLATILE_INTREGISTERS);
{$endif newra}
cg.a_call_name(exprasmlist,'FPC_POPADDRSTACK');
{$ifdef newra}
rg.deallocexplicitregistersint(exprasmlist,VOLATILE_INTREGISTERS);
{$endif newra}
cg.g_exception_reason_load(exprasmlist,href);
cleanupobjectstack;
cg.a_jmp_always(exprasmlist,oldaktbreaklabel);
@ -1087,7 +1141,13 @@ implementation
cg.a_label(exprasmlist,continueexceptlabel);
{ we must also destroy the address frame which guards }
{ exception object }
{$ifdef newra}
rg.allocexplicitregistersint(exprasmlist,VOLATILE_INTREGISTERS);
{$endif newra}
cg.a_call_name(exprasmlist,'FPC_POPADDRSTACK');
{$ifdef newra}
rg.deallocexplicitregistersint(exprasmlist,VOLATILE_INTREGISTERS);
{$endif newra}
cg.g_exception_reason_load(exprasmlist,href);
cleanupobjectstack;
cg.a_jmp_always(exprasmlist,oldaktcontinuelabel);
@ -1097,7 +1157,13 @@ implementation
begin
{ do some magic for exit in the try block }
cg.a_label(exprasmlist,exittrylabel);
{$ifdef newra}
rg.allocexplicitregistersint(exprasmlist,VOLATILE_INTREGISTERS);
{$endif newra}
cg.a_call_name(exprasmlist,'FPC_POPADDRSTACK');
{$ifdef newra}
rg.deallocexplicitregistersint(exprasmlist,VOLATILE_INTREGISTERS);
{$endif newra}
cg.g_exception_reason_load(exprasmlist,href);
cg.a_jmp_always(exprasmlist,oldaktexitlabel);
end;
@ -1105,7 +1171,13 @@ implementation
if fc_break in tryflowcontrol then
begin
cg.a_label(exprasmlist,breaktrylabel);
{$ifdef newra}
rg.allocexplicitregistersint(exprasmlist,VOLATILE_INTREGISTERS);
{$endif newra}
cg.a_call_name(exprasmlist,'FPC_POPADDRSTACK');
{$ifdef newra}
rg.deallocexplicitregistersint(exprasmlist,VOLATILE_INTREGISTERS);
{$endif newra}
cg.g_exception_reason_load(exprasmlist,href);
cg.a_jmp_always(exprasmlist,oldaktbreaklabel);
end;
@ -1113,7 +1185,13 @@ implementation
if fc_continue in tryflowcontrol then
begin
cg.a_label(exprasmlist,continuetrylabel);
{$ifdef newra}
rg.allocexplicitregistersint(exprasmlist,VOLATILE_INTREGISTERS);
{$endif newra}
cg.a_call_name(exprasmlist,'FPC_POPADDRSTACK');
{$ifdef newra}
rg.deallocexplicitregistersint(exprasmlist,VOLATILE_INTREGISTERS);
{$endif newra}
cg.g_exception_reason_load(exprasmlist,href);
cg.a_jmp_always(exprasmlist,oldaktcontinuelabel);
end;
@ -1165,8 +1243,14 @@ implementation
{ send the vmt parameter }
reference_reset_symbol(href2,objectlibrary.newasmsymboldata(excepttype.vmt_mangledname),0);
cg.a_paramaddr_ref(exprasmlist,href2,paramanager.getintparaloc(exprasmlist,1));
cg.a_call_name(exprasmlist,'FPC_CATCHES');
paramanager.freeintparaloc(exprasmlist,1);
{$ifdef newra}
rg.allocexplicitregistersint(exprasmlist,VOLATILE_INTREGISTERS);
{$endif newra}
cg.a_call_name(exprasmlist,'FPC_CATCHES');
{$ifdef newra}
rg.deallocexplicitregistersint(exprasmlist,VOLATILE_INTREGISTERS);
{$endif newra}
{ is it this catch? No. go to next onlabel }
r.enum:=R_INTREGISTER;
@ -1209,10 +1293,22 @@ implementation
try_free_exception(exprasmlist,tempbuf,tempaddr,href,0,doobjectdestroy,false);
{$ifdef newra}
rg.allocexplicitregistersint(exprasmlist,VOLATILE_INTREGISTERS);
{$endif newra}
cg.a_call_name(exprasmlist,'FPC_POPSECONDOBJECTSTACK');
{$ifdef newra}
rg.deallocexplicitregistersint(exprasmlist,VOLATILE_INTREGISTERS);
{$endif newra}
cg.a_param_reg(exprasmlist, OS_ADDR, r, paramanager.getintparaloc(exprasmlist,1));
cg.a_call_name(exprasmlist,'FPC_DESTROYEXCEPTION');
paramanager.freeintparaloc(exprasmlist,1);
{$ifdef newra}
rg.allocexplicitregistersint(exprasmlist,VOLATILE_INTREGISTERS);
{$endif newra}
cg.a_call_name(exprasmlist,'FPC_DESTROYEXCEPTION');
{$ifdef newra}
rg.deallocexplicitregistersint(exprasmlist,VOLATILE_INTREGISTERS);
{$endif newra}
{ we don't need to restore esi here because reraise never }
{ returns }
cg.a_call_name(exprasmlist,'FPC_RERAISE');
@ -1443,7 +1539,11 @@ begin
end.
{
$Log$
Revision 1.72 2003-06-13 21:19:30 peter
Revision 1.73 2003-07-23 11:01:14 jonas
* several rg.allocexplicitregistersint/rg.deallocexplicitregistersint
pairs round calls to helpers
Revision 1.72 2003/06/13 21:19:30 peter
* current_procdef removed, use current_procinfo.procdef instead
Revision 1.71 2003/06/09 14:38:52 jonas

View File

@ -207,11 +207,17 @@ implementation
secondpass(tcallparanode(tcallparanode(left).right).left);
cg.a_paramaddr_ref(exprasmlist,tcallparanode(tcallparanode(left).right).left.location.reference,paramanager.getintparaloc(exprasmlist,1));
{ call }
cg.a_call_name(exprasmlist,'FPC_ASSERT');
paramanager.freeintparaloc(exprasmlist,4);
paramanager.freeintparaloc(exprasmlist,3);
paramanager.freeintparaloc(exprasmlist,2);
paramanager.freeintparaloc(exprasmlist,1);
{$ifdef newra}
rg.allocexplicitregistersint(exprasmlist,VOLATILE_INTREGISTERS);
{$endif newra}
cg.a_call_name(exprasmlist,'FPC_ASSERT');
{$ifdef newra}
rg.deallocexplicitregistersint(exprasmlist,VOLATILE_INTREGISTERS);
{$endif newra}
cg.a_label(exprasmlist,truelabel);
truelabel:=otlabel;
falselabel:=oflabel;
@ -686,7 +692,11 @@ end.
{
$Log$
Revision 1.38 2003-07-05 20:07:24 jonas
Revision 1.39 2003-07-23 11:01:14 jonas
* several rg.allocexplicitregistersint/rg.deallocexplicitregistersint
pairs round calls to helpers
Revision 1.38 2003/07/05 20:07:24 jonas
* fixed range check errors
Revision 1.37 2003/06/13 21:19:30 peter

View File

@ -259,8 +259,14 @@ implementation
(not tpointerdef(left.resulttype.def).is_far) then
begin
cg.a_param_reg(exprasmlist, OS_ADDR,location.reference.base,paramanager.getintparaloc(exprasmlist,1));
cg.a_call_name(exprasmlist,'FPC_CHECKPOINTER');
paramanager.freeintparaloc(exprasmlist,1);
{$ifdef newra}
rg.allocexplicitregistersint(exprasmlist,VOLATILE_INTREGISTERS);
{$endif newra}
cg.a_call_name(exprasmlist,'FPC_CHECKPOINTER');
{$ifdef newra}
rg.deallocexplicitregistersint(exprasmlist,VOLATILE_INTREGISTERS);
{$endif newra}
end;
end;
@ -307,8 +313,14 @@ implementation
not(cs_compilesystem in aktmoduleswitches) then
begin
cg.a_param_reg(exprasmlist, OS_ADDR,location.reference.base,paramanager.getintparaloc(exprasmlist,1));
cg.a_call_name(exprasmlist,'FPC_CHECKPOINTER');
paramanager.freeintparaloc(exprasmlist,1);
{$ifdef newra}
rg.allocexplicitregistersint(exprasmlist,VOLATILE_INTREGISTERS);
{$endif newra}
cg.a_call_name(exprasmlist,'FPC_CHECKPOINTER');
{$ifdef newra}
rg.deallocexplicitregistersint(exprasmlist,VOLATILE_INTREGISTERS);
{$endif newra}
end;
end
else if is_interfacecom(left.resulttype.def) then
@ -321,8 +333,14 @@ implementation
not(cs_compilesystem in aktmoduleswitches) then
begin
cg.a_param_reg(exprasmlist, OS_ADDR,location.reference.base,paramanager.getintparaloc(exprasmlist,1));
cg.a_call_name(exprasmlist,'FPC_CHECKPOINTER');
paramanager.freeintparaloc(exprasmlist,1);
{$ifdef newra}
rg.allocexplicitregistersint(exprasmlist,VOLATILE_INTREGISTERS);
{$endif newra}
cg.a_call_name(exprasmlist,'FPC_CHECKPOINTER');
{$ifdef newra}
rg.allocexplicitregistersint(exprasmlist,VOLATILE_INTREGISTERS);
{$endif newra}
end;
end
@ -522,7 +540,6 @@ implementation
cg.a_param_loc(exprasmlist,left.location,paramanager.getintparaloc(exprasmlist,1));
{$ifdef newra}
rg.allocexplicitregistersint(exprasmlist,VOLATILE_INTREGISTERS);
{$else}
rg.saveintregvars(exprasmlist,VOLATILE_INTREGISTERS);
{$endif}
@ -881,7 +898,11 @@ begin
end.
{
$Log$
Revision 1.66 2003-07-06 21:50:33 jonas
Revision 1.67 2003-07-23 11:01:14 jonas
* several rg.allocexplicitregistersint/rg.deallocexplicitregistersint
pairs round calls to helpers
Revision 1.66 2003/07/06 21:50:33 jonas
* fixed ppc compilation problems and changed VOLATILE_REGISTERS for x86
so that it doesn't include ebp and esp anymore