mirror of
https://gitlab.com/freepascal.org/fpc/source.git
synced 2025-08-18 05:09:19 +02:00
* alloc register for function result
This commit is contained in:
parent
b489c2d65e
commit
43746bc54a
@ -822,7 +822,9 @@ implementation
|
|||||||
var
|
var
|
||||||
tempreference : treference;
|
tempreference : treference;
|
||||||
href : treference;
|
href : treference;
|
||||||
|
{$ifdef i386}
|
||||||
hreg : tregister;
|
hreg : tregister;
|
||||||
|
{$endif i386}
|
||||||
sizetopush,
|
sizetopush,
|
||||||
size : longint;
|
size : longint;
|
||||||
cgsize : tcgsize;
|
cgsize : tcgsize;
|
||||||
@ -1282,16 +1284,19 @@ implementation
|
|||||||
{ Constructors need to return self }
|
{ Constructors need to return self }
|
||||||
if (current_procinfo.procdef.proctypeoption=potype_constructor) then
|
if (current_procinfo.procdef.proctypeoption=potype_constructor) then
|
||||||
begin
|
begin
|
||||||
|
{$ifdef newra}
|
||||||
|
r:=rg.getexplicitregint(NR_FUNCTION_RETURN_REG);
|
||||||
|
{$else}
|
||||||
r.enum:=R_INTREGISTER;
|
r.enum:=R_INTREGISTER;
|
||||||
r.number:=NR_FUNCTION_RETURN_REG;
|
r.number:=NR_FUNCTION_RETURN_REG;
|
||||||
cg.a_reg_alloc(list,r);
|
cg.a_reg_alloc(list,r);
|
||||||
|
{$endif}
|
||||||
{ return the self pointer }
|
{ return the self pointer }
|
||||||
ressym:=tvarsym(current_procinfo.procdef.parast.search('self'));
|
ressym:=tvarsym(current_procinfo.procdef.parast.search('self'));
|
||||||
if not assigned(ressym) then
|
if not assigned(ressym) then
|
||||||
internalerror(200305058);
|
internalerror(200305058);
|
||||||
reference_reset_base(href,current_procinfo.framepointer,tvarsym(ressym).adjusted_address);
|
reference_reset_base(href,current_procinfo.framepointer,tvarsym(ressym).adjusted_address);
|
||||||
cg.a_load_ref_reg(list,OS_ADDR,OS_ADDR,href,r);
|
cg.a_load_ref_reg(list,OS_ADDR,OS_ADDR,href,r);
|
||||||
cg.a_reg_dealloc(list,r);
|
|
||||||
uses_acc:=true;
|
uses_acc:=true;
|
||||||
exit;
|
exit;
|
||||||
end;
|
end;
|
||||||
@ -1325,19 +1330,29 @@ implementation
|
|||||||
if resloc.size in [OS_64,OS_S64] then
|
if resloc.size in [OS_64,OS_S64] then
|
||||||
begin
|
begin
|
||||||
uses_acchi:=true;
|
uses_acchi:=true;
|
||||||
|
{$ifdef newra}
|
||||||
|
r:=rg.getexplicitregint(NR_FUNCTION_RETURN64_LOW_REG);
|
||||||
|
r2:=rg.getexplicitregint(NR_FUNCTION_RETURN64_HIGH_REG);
|
||||||
|
{$else}
|
||||||
r.enum:=R_INTREGISTER;
|
r.enum:=R_INTREGISTER;
|
||||||
r.number:=NR_FUNCTION_RETURN64_LOW_REG;
|
r.number:=NR_FUNCTION_RETURN64_LOW_REG;
|
||||||
cg.a_reg_alloc(list,r);
|
cg.a_reg_alloc(list,r);
|
||||||
r2.enum:=R_INTREGISTER;
|
r2.enum:=R_INTREGISTER;
|
||||||
r2.number:=NR_FUNCTION_RETURN64_HIGH_REG;
|
r2.number:=NR_FUNCTION_RETURN64_HIGH_REG;
|
||||||
cg.a_reg_alloc(list,r2);
|
cg.a_reg_alloc(list,r2);
|
||||||
|
{$endif}
|
||||||
cg64.a_load64_loc_reg(list,resloc,joinreg64(r,r2){$ifdef newra},false{$endif});
|
cg64.a_load64_loc_reg(list,resloc,joinreg64(r,r2){$ifdef newra},false{$endif});
|
||||||
end
|
end
|
||||||
else
|
else
|
||||||
{$endif cpu64bit}
|
{$endif cpu64bit}
|
||||||
begin
|
begin
|
||||||
|
{$ifdef newra}
|
||||||
|
hreg:=rg.getexplicitregint(NR_FUNCTION_RETURN_REG);
|
||||||
|
{$else}
|
||||||
hreg.enum:=R_INTREGISTER;
|
hreg.enum:=R_INTREGISTER;
|
||||||
hreg.number:=NR_FUNCTION_RETURN_REG;
|
hreg.number:=NR_FUNCTION_RETURN_REG;
|
||||||
|
cg.a_reg_alloc(list,hreg);
|
||||||
|
{$endif}
|
||||||
hreg:=rg.makeregsize(hreg,resloc.size);
|
hreg:=rg.makeregsize(hreg,resloc.size);
|
||||||
cg.a_load_loc_reg(list,resloc.size,resloc,hreg);
|
cg.a_load_loc_reg(list,resloc.size,resloc,hreg);
|
||||||
end;
|
end;
|
||||||
@ -1363,19 +1378,30 @@ implementation
|
|||||||
if resloc.size in [OS_64,OS_S64] then
|
if resloc.size in [OS_64,OS_S64] then
|
||||||
begin
|
begin
|
||||||
uses_acchi:=true;
|
uses_acchi:=true;
|
||||||
|
{$ifdef newra}
|
||||||
|
r:=rg.getexplicitregint(NR_FUNCTION_RETURN64_LOW_REG);
|
||||||
|
r2:=rg.getexplicitregint(NR_FUNCTION_RETURN64_HIGH_REG);
|
||||||
|
{$else}
|
||||||
r.enum:=R_INTREGISTER;
|
r.enum:=R_INTREGISTER;
|
||||||
r.number:=NR_FUNCTION_RETURN64_LOW_REG;
|
r.number:=NR_FUNCTION_RETURN64_LOW_REG;
|
||||||
cg.a_reg_alloc(list,r);
|
cg.a_reg_alloc(list,r);
|
||||||
r2.enum:=R_INTREGISTER;
|
r2.enum:=R_INTREGISTER;
|
||||||
r2.number:=NR_FUNCTION_RETURN64_HIGH_REG;
|
r2.number:=NR_FUNCTION_RETURN64_HIGH_REG;
|
||||||
cg.a_reg_alloc(list,r2);
|
cg.a_reg_alloc(list,r2);
|
||||||
|
{$endif}
|
||||||
cg64.a_load64_loc_reg(list,resloc,joinreg64(r,r2){$ifdef newra},false{$endif});
|
cg64.a_load64_loc_reg(list,resloc,joinreg64(r,r2){$ifdef newra},false{$endif});
|
||||||
end
|
end
|
||||||
else
|
else
|
||||||
{$endif cpu64bit}
|
{$endif cpu64bit}
|
||||||
begin
|
begin
|
||||||
|
{$ifdef newra}
|
||||||
|
hreg:=rg.getexplicitregint(NR_FUNCTION_RETURN_REG);
|
||||||
|
{$else}
|
||||||
hreg.enum:=R_INTREGISTER;
|
hreg.enum:=R_INTREGISTER;
|
||||||
hreg.number:=(RS_FUNCTION_RETURN_REG shl 8) or cgsize2subreg(resloc.size);
|
hreg.number:=NR_FUNCTION_RETURN_REG;
|
||||||
|
cg.a_reg_alloc(list,hreg);
|
||||||
|
{$endif}
|
||||||
|
hreg:=rg.makeregsize(hreg,resloc.size);
|
||||||
cg.a_load_loc_reg(list,resloc.size,resloc,hreg);
|
cg.a_load_loc_reg(list,resloc.size,resloc,hreg);
|
||||||
end;
|
end;
|
||||||
end
|
end
|
||||||
@ -1976,7 +2002,10 @@ implementation
|
|||||||
end.
|
end.
|
||||||
{
|
{
|
||||||
$Log$
|
$Log$
|
||||||
Revision 1.125 2003-06-13 21:19:30 peter
|
Revision 1.126 2003-06-17 16:32:44 peter
|
||||||
|
* alloc register for function result
|
||||||
|
|
||||||
|
Revision 1.125 2003/06/13 21:19:30 peter
|
||||||
* current_procdef removed, use current_procinfo.procdef instead
|
* current_procdef removed, use current_procinfo.procdef instead
|
||||||
|
|
||||||
Revision 1.124 2003/06/09 12:23:30 peter
|
Revision 1.124 2003/06/09 12:23:30 peter
|
||||||
|
Loading…
Reference in New Issue
Block a user