mirror of
https://gitlab.com/freepascal.org/fpc/source.git
synced 2025-09-03 22:30:27 +02:00
* split en_exit_code into a part that may allocate a register and a part
that doesn't, so the former can be done before the register colouring has been performed
This commit is contained in:
parent
af784cfb1e
commit
177d57f22c
@ -69,7 +69,7 @@ interface
|
||||
|
||||
procedure gen_entry_code(list:TAAsmoutput;inlined:boolean);
|
||||
procedure gen_stackalloc_code(list:Taasmoutput);
|
||||
procedure gen_exit_code(list:Taasmoutput;inlined:boolean);
|
||||
procedure gen_exit_code(list : TAAsmoutput;inlined,usesacc,usesacchi,usesfpu:boolean);
|
||||
|
||||
(*
|
||||
procedure geninlineentrycode(list : TAAsmoutput;stackframe:longint);
|
||||
@ -274,16 +274,28 @@ implementation
|
||||
cg.a_paramaddr_ref(list,jmpbuf,paramanager.getintparaloc(list,2));
|
||||
{ push type of exceptionframe }
|
||||
cg.a_param_const(list,OS_S32,1,paramanager.getintparaloc(list,1));
|
||||
cg.a_call_name(list,'FPC_PUSHEXCEPTADDR');
|
||||
paramanager.freeintparaloc(list,3);
|
||||
paramanager.freeintparaloc(list,2);
|
||||
paramanager.freeintparaloc(list,1);
|
||||
{$ifdef newra}
|
||||
rg.allocexplicitregistersint(list,VOLATILE_INTREGISTERS);
|
||||
{$endif newra}
|
||||
cg.a_call_name(list,'FPC_PUSHEXCEPTADDR');
|
||||
{$ifdef newra}
|
||||
rg.deallocexplicitregistersint(list,VOLATILE_INTREGISTERS);
|
||||
{$endif newra}
|
||||
|
||||
r.enum:=R_INTREGISTER;
|
||||
r.number:=NR_FUNCTION_RESULT_REG;
|
||||
cg.a_param_reg(list,OS_ADDR,r,paramanager.getintparaloc(list,1));
|
||||
cg.a_call_name(list,'FPC_SETJMP');
|
||||
paramanager.freeintparaloc(list,1);
|
||||
{$ifdef newra}
|
||||
rg.allocexplicitregistersint(list,VOLATILE_INTREGISTERS);
|
||||
{$endif newra}
|
||||
cg.a_call_name(list,'FPC_SETJMP');
|
||||
{$ifdef newra}
|
||||
rg.deallocexplicitregistersint(list,VOLATILE_INTREGISTERS);
|
||||
{$endif newra}
|
||||
|
||||
cg.g_exception_reason_save(list, href);
|
||||
cg.a_cmp_const_reg_label(list,OS_S32,OC_NE,0,r,exceptlabel);
|
||||
@ -296,7 +308,13 @@ implementation
|
||||
var r:Tregister;
|
||||
|
||||
begin
|
||||
{$ifdef newra}
|
||||
rg.allocexplicitregistersint(list,VOLATILE_INTREGISTERS);
|
||||
{$endif newra}
|
||||
cg.a_call_name(list,'FPC_POPADDRSTACK');
|
||||
{$ifdef newra}
|
||||
rg.deallocexplicitregistersint(list,VOLATILE_INTREGISTERS);
|
||||
{$endif newra}
|
||||
|
||||
if not onlyfree then
|
||||
begin
|
||||
@ -1231,23 +1249,41 @@ implementation
|
||||
begin
|
||||
reference_reset_base(href,current_procinfo.framepointer,hp^.pos);
|
||||
cg.a_paramaddr_ref(list,href,paramanager.getintparaloc(list,1));
|
||||
cg.a_call_name(list,'FPC_ANSISTR_DECR_REF');
|
||||
paramanager.freeintparaloc(list,1);
|
||||
{$ifdef newra}
|
||||
rg.allocexplicitregistersint(list,VOLATILE_INTREGISTERS);
|
||||
{$endif newra}
|
||||
cg.a_call_name(list,'FPC_ANSISTR_DECR_REF');
|
||||
{$ifdef newra}
|
||||
rg.deallocexplicitregistersint(list,VOLATILE_INTREGISTERS);
|
||||
{$endif newra}
|
||||
end;
|
||||
tt_widestring,
|
||||
tt_freewidestring :
|
||||
begin
|
||||
reference_reset_base(href,current_procinfo.framepointer,hp^.pos);
|
||||
cg.a_paramaddr_ref(list,href,paramanager.getintparaloc(list,1));
|
||||
cg.a_call_name(list,'FPC_WIDESTR_DECR_REF');
|
||||
paramanager.freeintparaloc(list,1);
|
||||
{$ifdef newra}
|
||||
rg.allocexplicitregistersint(list,VOLATILE_INTREGISTERS);
|
||||
{$endif newra}
|
||||
cg.a_call_name(list,'FPC_WIDESTR_DECR_REF');
|
||||
{$ifdef newra}
|
||||
rg.deallocexplicitregistersint(list,VOLATILE_INTREGISTERS);
|
||||
{$endif newra}
|
||||
end;
|
||||
tt_interfacecom :
|
||||
begin
|
||||
reference_reset_base(href,current_procinfo.framepointer,hp^.pos);
|
||||
cg.a_paramaddr_ref(list,href,paramanager.getintparaloc(list,1));
|
||||
cg.a_call_name(list,'FPC_INTF_DECR_REF');
|
||||
paramanager.freeintparaloc(list,1);
|
||||
{$ifdef newra}
|
||||
rg.allocexplicitregistersint(list,VOLATILE_INTREGISTERS);
|
||||
{$endif newra}
|
||||
cg.a_call_name(list,'FPC_INTF_DECR_REF');
|
||||
{$ifdef newra}
|
||||
rg.deallocexplicitregistersint(list,VOLATILE_INTREGISTERS);
|
||||
{$endif newra}
|
||||
end;
|
||||
end;
|
||||
hp:=hp^.next;
|
||||
@ -1492,13 +1528,25 @@ implementation
|
||||
cg.a_paramaddr_ref(list,href,paramanager.getintparaloc(list,2));
|
||||
reference_reset_symbol(href,objectlibrary.newasmsymboldata('__image_base__'),0);
|
||||
cg.a_paramaddr_ref(list,href,paramanager.getintparaloc(list,1));
|
||||
cg.a_call_name(list,'_monstartup');
|
||||
paramanager.freeintparaloc(list,2);
|
||||
paramanager.freeintparaloc(list,1);
|
||||
{$ifdef newra}
|
||||
rg.allocexplicitregistersint(list,VOLATILE_INTREGISTERS);
|
||||
{$endif newra}
|
||||
cg.a_call_name(list,'_monstartup');
|
||||
{$ifdef newra}
|
||||
rg.deallocexplicitregistersint(list,VOLATILE_INTREGISTERS);
|
||||
{$endif newra}
|
||||
end;
|
||||
|
||||
{ initialize units }
|
||||
{$ifdef newra}
|
||||
rg.allocexplicitregistersint(list,VOLATILE_INTREGISTERS);
|
||||
{$endif newra}
|
||||
cg.a_call_name(list,'FPC_INITIALIZEUNITS');
|
||||
{$ifdef newra}
|
||||
rg.deallocexplicitregistersint(list,VOLATILE_INTREGISTERS);
|
||||
{$endif newra}
|
||||
end;
|
||||
|
||||
{$ifdef GDB}
|
||||
@ -1689,7 +1737,7 @@ implementation
|
||||
end;
|
||||
|
||||
|
||||
procedure gen_exit_code(list : TAAsmoutput;inlined:boolean);
|
||||
procedure gen_exit_code(list : TAAsmoutput;inlined,usesacc,usesacchi,usesfpu:boolean);
|
||||
|
||||
var
|
||||
{$ifdef GDB}
|
||||
@ -1697,18 +1745,9 @@ implementation
|
||||
mangled_length : longint;
|
||||
p : pchar;
|
||||
{$endif GDB}
|
||||
usesacc,
|
||||
usesacchi,
|
||||
usesfpu : boolean;
|
||||
rsp : Tregister;
|
||||
retsize : longint;
|
||||
begin
|
||||
{ handle return value, this is not done for assembler routines when
|
||||
they didn't reference the result variable }
|
||||
usesacc:=false;
|
||||
usesfpu:=false;
|
||||
usesacchi:=false;
|
||||
gen_load_return_value(list,usesacc,usesacchi,usesfpu);
|
||||
|
||||
{$ifdef GDB}
|
||||
if ((cs_debuginfo in aktmoduleswitches) and not inlined) then
|
||||
@ -1987,7 +2026,12 @@ implementation
|
||||
end.
|
||||
{
|
||||
$Log$
|
||||
Revision 1.130 2003-07-06 17:58:22 peter
|
||||
Revision 1.131 2003-07-23 11:04:15 jonas
|
||||
* split en_exit_code into a part that may allocate a register and a part
|
||||
that doesn't, so the former can be done before the register colouring
|
||||
has been performed
|
||||
|
||||
Revision 1.130 2003/07/06 17:58:22 peter
|
||||
* framepointer fixes for sparc
|
||||
* parent framepointer code more generic
|
||||
|
||||
|
@ -749,6 +749,9 @@ implementation
|
||||
procedure gen_implicit_initfinal(list:taasmoutput;flag:word;st:tsymtable);
|
||||
var
|
||||
pd : tprocdef;
|
||||
usesacc,
|
||||
usesfpu,
|
||||
usesacchi : boolean;
|
||||
begin
|
||||
{ update module flags }
|
||||
current_module.flags:=current_module.flags or flag;
|
||||
@ -772,7 +775,11 @@ implementation
|
||||
gen_entry_code(list,false);
|
||||
gen_initialize_code(list,false);
|
||||
gen_finalize_code(list,false);
|
||||
gen_exit_code(list,false);
|
||||
usesacc:=false;
|
||||
usesfpu:=false;
|
||||
usesacchi:=false;
|
||||
gen_load_return_value(list,usesacc,usesacchi,usesfpu);
|
||||
gen_exit_code(list,false,usesacc,usesacchi,usesfpu);
|
||||
list.convert_registers;
|
||||
release_main_proc(pd);
|
||||
end;
|
||||
@ -1446,7 +1453,12 @@ implementation
|
||||
end.
|
||||
{
|
||||
$Log$
|
||||
Revision 1.115 2003-07-06 17:58:22 peter
|
||||
Revision 1.116 2003-07-23 11:04:15 jonas
|
||||
* split en_exit_code into a part that may allocate a register and a part
|
||||
that doesn't, so the former can be done before the register colouring
|
||||
has been performed
|
||||
|
||||
Revision 1.115 2003/07/06 17:58:22 peter
|
||||
* framepointer fixes for sparc
|
||||
* parent framepointer code more generic
|
||||
|
||||
|
@ -571,6 +571,9 @@ implementation
|
||||
oldfilepos : tfileposinfo;
|
||||
templist,
|
||||
stackalloccode : Taasmoutput;
|
||||
usesacc,
|
||||
usesfpu,
|
||||
usesacchi : boolean;
|
||||
|
||||
begin
|
||||
{ the initialization procedure can be empty, then we
|
||||
@ -625,11 +628,18 @@ implementation
|
||||
aktproccode.insertlistafter(tasmnode(finalasmnode).currenttai,templist)
|
||||
else
|
||||
aktproccode.concatlist(templist);
|
||||
gen_exit_code(templist,false);
|
||||
aktproccode.concatlist(templist);
|
||||
|
||||
{ handle return value, this is not done for assembler routines when
|
||||
they didn't reference the result variable }
|
||||
usesacc:=false;
|
||||
usesfpu:=false;
|
||||
usesacchi:=false;
|
||||
gen_load_return_value(aktproccode,usesacc,usesacchi,usesfpu);
|
||||
|
||||
{$ifdef newra}
|
||||
{ rg.writegraph;}
|
||||
{$ifdef ra_debug2}
|
||||
rg.writegraph;
|
||||
{$endif}
|
||||
{$endif}
|
||||
if not(cs_no_regalloc in aktglobalswitches) then
|
||||
begin
|
||||
@ -657,7 +667,11 @@ implementation
|
||||
gen_stackalloc_code(stackalloccode);
|
||||
stackalloccode.convert_registers;
|
||||
aktproccode.insertlist(stackalloccode);
|
||||
stackalloccode.destroy;
|
||||
stackalloccode.free;
|
||||
|
||||
gen_exit_code(templist,false,usesacc,usesacchi,usesfpu);
|
||||
templist.convert_registers;
|
||||
aktproccode.concatlist(templist);
|
||||
|
||||
{ now all the registers used are known }
|
||||
{ Remove all imaginary registers from the used list.}
|
||||
@ -1252,7 +1266,12 @@ begin
|
||||
end.
|
||||
{
|
||||
$Log$
|
||||
Revision 1.132 2003-07-06 17:58:22 peter
|
||||
Revision 1.133 2003-07-23 11:04:15 jonas
|
||||
* split en_exit_code into a part that may allocate a register and a part
|
||||
that doesn't, so the former can be done before the register colouring
|
||||
has been performed
|
||||
|
||||
Revision 1.132 2003/07/06 17:58:22 peter
|
||||
* framepointer fixes for sparc
|
||||
* parent framepointer code more generic
|
||||
|
||||
|
Loading…
Reference in New Issue
Block a user