mirror of
https://gitlab.com/freepascal.org/fpc/source.git
synced 2025-09-02 21:30:19 +02:00
* FUNCTION_RESULT64_LOW/HIGH_REG added for int64 results
This commit is contained in:
parent
0e11419a26
commit
1e7ecac976
@ -157,15 +157,21 @@
|
||||
{ Results are returned in this register (32-bit values) }
|
||||
NR_FUNCTION_RETURN_REG = NR_EAX;
|
||||
RS_FUNCTION_RETURN_REG = RS_EAX;
|
||||
{ Low part of 64bit return value }
|
||||
NR_FUNCTION_RETURN64_LOW_REG = NR_EAX;
|
||||
RS_FUNCTION_RETURN64_LOW_REG = RS_EAX;
|
||||
{ High part of 64bit return value }
|
||||
NR_FUNCTION_RETURNHIGH_REG = NR_EDX;
|
||||
RS_FUNCTION_RETURNHIGH_REG = RS_EDX;
|
||||
NR_FUNCTION_RETURN64_HIGH_REG = NR_EDX;
|
||||
RS_FUNCTION_RETURN64_HIGH_REG = RS_EDX;
|
||||
{ The value returned from a function is available in this register }
|
||||
NR_FUNCTION_RESULT_REG = NR_FUNCTION_RETURN_REG;
|
||||
RS_FUNCTION_RESULT_REG = RS_FUNCTION_RETURN_REG;
|
||||
{ The high part of 64bit value returned from a function is available in this register }
|
||||
NR_FUNCTION_RESULTHIGH_REG = NR_FUNCTION_RETURNHIGH_REG;
|
||||
RS_FUNCTION_RESULTHIGH_REG = RS_FUNCTION_RETURNHIGH_REG;
|
||||
{ The lowh part of 64bit value returned from a function }
|
||||
NR_FUNCTION_RESULT64_LOW_REG = NR_FUNCTION_RETURN64_LOW_REG;
|
||||
RS_FUNCTION_RESULT64_LOW_REG = RS_FUNCTION_RETURN64_LOW_REG;
|
||||
{ The high part of 64bit value returned from a function }
|
||||
NR_FUNCTION_RESULT64_HIGH_REG = NR_FUNCTION_RETURN64_HIGH_REG;
|
||||
RS_FUNCTION_RESULT64_HIGH_REG = RS_FUNCTION_RETURN64_HIGH_REG;
|
||||
|
||||
{ WARNING: don't change to R_ST0!! See comments above implementation of }
|
||||
{ a_loadfpu* methods in rgcpu (JM) }
|
||||
@ -196,7 +202,10 @@
|
||||
|
||||
{
|
||||
$Log$
|
||||
Revision 1.4 2003-05-30 23:57:08 peter
|
||||
Revision 1.5 2003-05-31 15:05:28 peter
|
||||
* FUNCTION_RESULT64_LOW/HIGH_REG added for int64 results
|
||||
|
||||
Revision 1.4 2003/05/30 23:57:08 peter
|
||||
* more sparc cleanup
|
||||
* accumulator removed, splitted in function_return_reg (called) and
|
||||
function_result_reg (caller)
|
||||
|
@ -470,23 +470,23 @@ implementation
|
||||
{ Move the function result to free registers, preferably the
|
||||
FUNCTION_RESULT_REG/FUNCTION_RESULTHIGH_REG, so no move is necessary.}
|
||||
r.enum:=R_INTREGISTER;
|
||||
r.number:=NR_FUNCTION_RESULT_REG;
|
||||
r.number:=NR_FUNCTION_RESULT64_LOW_REG;
|
||||
hregister.enum:=R_INTREGISTER;
|
||||
hregister.number:=NR_FUNCTION_RESULTHIGH_REG;
|
||||
hregister.number:=NR_FUNCTION_RESULT64_HIGH_REG;
|
||||
{$ifdef newra}
|
||||
rg.getexplicitregisterint(exprasmlist,NR_FUNCTION_RESULT_REG);
|
||||
rg.getexplicitregisterint(exprasmlist,NR_FUNCTION_RESULTHIGH_REG);
|
||||
rg.getexplicitregisterint(exprasmlist,NR_FUNCTION_RESULT64_LOW_REG);
|
||||
rg.getexplicitregisterint(exprasmlist,NR_FUNCTION_RESULT64_HIGH_REG);
|
||||
rg.ungetregisterint(exprasmlist,r);
|
||||
rg.ungetregisterint(exprasmlist,hregister);
|
||||
location.registerlow:=rg.getregisterint(exprasmlist,OS_INT);
|
||||
location.registerhigh:=rg.getregisterint(exprasmlist,OS_INT);
|
||||
{$else newra}
|
||||
if RS_FUNCTION_RESULT_REG in rg.unusedregsint then
|
||||
location.registerlow:=rg.getexplicitregisterint(exprasmlist,NR_FUNCTION_RESULT_REG)
|
||||
if RS_FUNCTION_RESULT64_LOW_REG in rg.unusedregsint then
|
||||
location.registerlow:=rg.getexplicitregisterint(exprasmlist,NR_FUNCTION_RESULT64_LOW_REG)
|
||||
else
|
||||
cg.a_reg_alloc(exprasmlist,r);
|
||||
if RS_FUNCTION_RESULTHIGH_REG in rg.unusedregsint then
|
||||
location.registerhigh:=rg.getexplicitregisterint(exprasmlist,NR_FUNCTION_RESULTHIGH_REG)
|
||||
if RS_FUNCTION_RESULT64_HIGH_REG in rg.unusedregsint then
|
||||
location.registerhigh:=rg.getexplicitregisterint(exprasmlist,NR_FUNCTION_RESULT64_HIGH_REG)
|
||||
else
|
||||
cg.a_reg_alloc(exprasmlist,hregister);
|
||||
{ do this after both low,high are allocated, else it is possible that
|
||||
@ -641,11 +641,15 @@ implementation
|
||||
if (not is_void(resulttype.def)) and
|
||||
(not paramanager.ret_in_param(resulttype.def,procdefinition.proccalloption)) then
|
||||
begin
|
||||
include(regs_to_push_int,RS_FUNCTION_RESULT_REG);
|
||||
{$ifndef cpu64bit}
|
||||
if resulttype.def.size>sizeof(aword) then
|
||||
include(regs_to_push_int,RS_FUNCTION_RESULTHIGH_REG);
|
||||
begin
|
||||
include(regs_to_push_int,RS_FUNCTION_RESULT64_LOW_REG);
|
||||
include(regs_to_push_int,RS_FUNCTION_RESULT64_HIGH_REG);
|
||||
end
|
||||
else
|
||||
{$endif cpu64bit}
|
||||
include(regs_to_push_int,RS_FUNCTION_RESULT_REG);
|
||||
end;
|
||||
rg.saveusedintregisters(exprasmlist,pushedint,regs_to_push_int);
|
||||
rg.saveusedotherregisters(exprasmlist,pushedother,regs_to_push_other);
|
||||
@ -1032,9 +1036,14 @@ implementation
|
||||
begin
|
||||
include(regs_to_push_int,RS_FUNCTION_RESULT_REG);
|
||||
{$ifndef cpu64bit}
|
||||
if resulttype.def.size>sizeof(aword) then
|
||||
include(regs_to_push_int,RS_FUNCTION_RESULTHIGH_REG);
|
||||
if resulttype.def.size>sizeof(aword) then
|
||||
begin
|
||||
include(regs_to_push_int,RS_FUNCTION_RESULT64_LOW_REG);
|
||||
include(regs_to_push_int,RS_FUNCTION_RESULT64_HIGH_REG);
|
||||
end
|
||||
else
|
||||
{$endif cpu64bit}
|
||||
include(regs_to_push_int,RS_FUNCTION_RESULT_REG);
|
||||
end;
|
||||
rg.saveusedintregisters(exprasmlist,pushedint,regs_to_push_int);
|
||||
rg.saveusedotherregisters(exprasmlist,pushedother,regs_to_push_other);
|
||||
@ -1233,7 +1242,10 @@ begin
|
||||
end.
|
||||
{
|
||||
$Log$
|
||||
Revision 1.79 2003-05-31 00:59:44 peter
|
||||
Revision 1.80 2003-05-31 15:05:28 peter
|
||||
* FUNCTION_RESULT64_LOW/HIGH_REG added for int64 results
|
||||
|
||||
Revision 1.79 2003/05/31 00:59:44 peter
|
||||
* typo in FUNCTION_RESULT_REG
|
||||
|
||||
Revision 1.78 2003/05/30 23:57:08 peter
|
||||
|
@ -1260,15 +1260,15 @@ implementation
|
||||
enumdef :
|
||||
begin
|
||||
uses_acc:=true;
|
||||
r.enum:=R_INTREGISTER;
|
||||
r.number:=NR_FUNCTION_RETURN_REG;
|
||||
cg.a_reg_alloc(list,r);
|
||||
{$ifndef cpu64bit}
|
||||
if cgsize in [OS_64,OS_S64] then
|
||||
begin
|
||||
uses_acchi:=true;
|
||||
r.enum:=R_INTREGISTER;
|
||||
r.number:=NR_FUNCTION_RETURN64_LOW_REG;
|
||||
cg.a_reg_alloc(list,r);
|
||||
r2.enum:=R_INTREGISTER;
|
||||
r2.number:=NR_FUNCTION_RETURNHIGH_REG;
|
||||
r2.number:=NR_FUNCTION_RETURN64_HIGH_REG;
|
||||
cg.a_reg_alloc(list,r2);
|
||||
cg64.a_load64_ref_reg(list,href,joinreg64(r,r2));
|
||||
end
|
||||
@ -1296,16 +1296,16 @@ implementation
|
||||
if not paramanager.ret_in_param(current_procdef.rettype.def,current_procdef.proccalloption) then
|
||||
begin
|
||||
uses_acc:=true;
|
||||
r.enum:=R_INTREGISTER;
|
||||
r.number:=NR_FUNCTION_RETURN_REG;
|
||||
cg.a_reg_alloc(list,r);
|
||||
{$ifndef cpu64bit}
|
||||
{ Win32 can return records in EAX:EDX }
|
||||
if cgsize in [OS_64,OS_S64] then
|
||||
begin
|
||||
uses_acchi:=true;
|
||||
r.enum:=R_INTREGISTER;
|
||||
r.number:=NR_FUNCTION_RETURN64_LOW_REG;
|
||||
cg.a_reg_alloc(list,r);
|
||||
r2.enum:=R_INTREGISTER;
|
||||
r2.number:=NR_FUNCTION_RETURNHIGH_REG;
|
||||
r2.number:=NR_FUNCTION_RETURN64_HIGH_REG;
|
||||
cg.a_reg_alloc(list,r2);
|
||||
cg64.a_load64_ref_reg(list,href,joinreg64(r,r2));
|
||||
end
|
||||
@ -1313,7 +1313,7 @@ implementation
|
||||
{$endif cpu64bit}
|
||||
begin
|
||||
hreg.enum:=R_INTREGISTER;
|
||||
hreg.number:=RS_FUNCTION_RETURN_REG shl 8 or cgsize2subreg(cgsize);
|
||||
hreg.number:=(RS_FUNCTION_RETURN_REG shl 8) or cgsize2subreg(cgsize);
|
||||
cg.a_load_ref_reg(list,cgsize,href,hreg);
|
||||
end;
|
||||
end
|
||||
@ -1359,7 +1359,7 @@ implementation
|
||||
if not(hp.paraloc.size in [OS_S64,OS_64]) then
|
||||
cg.a_load_reg_reg(list,hp.paraloc.size,hp.paraloc.size,hp.paraloc.register,tvarsym(hp.parasym).reg)
|
||||
else
|
||||
internalerror(2003053011);
|
||||
internalerror(2003053011);
|
||||
// cg64.a_load64_reg_reg(list,hp.paraloc.register64,tvarsym(hp.parasym).reg);
|
||||
LOC_CFPUREGISTER,
|
||||
LOC_FPUREGISTER:
|
||||
@ -1921,7 +1921,10 @@ implementation
|
||||
end.
|
||||
{
|
||||
$Log$
|
||||
Revision 1.113 2003-05-31 00:48:15 jonas
|
||||
Revision 1.114 2003-05-31 15:05:28 peter
|
||||
* FUNCTION_RESULT64_LOW/HIGH_REG added for int64 results
|
||||
|
||||
Revision 1.113 2003/05/31 00:48:15 jonas
|
||||
* fixed my previous commit
|
||||
|
||||
Revision 1.112 2003/05/30 23:57:08 peter
|
||||
|
@ -267,10 +267,10 @@ unit paramgr;
|
||||
{$ifndef cpu64bit}
|
||||
if result.size in [OS_64,OS_S64] then
|
||||
begin
|
||||
result.register64.reghi.enum:=R_INTREGISTER;
|
||||
result.register64.reghi.number:=NR_FUNCTION_RETURNHIGH_REG;
|
||||
result.register64.reglo.enum:=R_INTREGISTER;
|
||||
result.register64.reglo.number:=NR_FUNCTION_RETURN_REG;
|
||||
result.register64.reglo.number:=NR_FUNCTION_RETURN64_LOW_REG;
|
||||
result.register64.reghi.enum:=R_INTREGISTER;
|
||||
result.register64.reghi.number:=NR_FUNCTION_RETURN64_HIGH_REG;
|
||||
end
|
||||
else
|
||||
{$endif cpu64bit}
|
||||
@ -399,7 +399,10 @@ end.
|
||||
|
||||
{
|
||||
$Log$
|
||||
Revision 1.39 2003-05-30 23:57:08 peter
|
||||
Revision 1.40 2003-05-31 15:05:28 peter
|
||||
* FUNCTION_RESULT64_LOW/HIGH_REG added for int64 results
|
||||
|
||||
Revision 1.39 2003/05/30 23:57:08 peter
|
||||
* more sparc cleanup
|
||||
* accumulator removed, splitted in function_return_reg (called) and
|
||||
function_result_reg (caller)
|
||||
|
@ -653,15 +653,21 @@ uses
|
||||
{ Results are returned in this register (32-bit values) }
|
||||
NR_FUNCTION_RETURN_REG = NR_R3;
|
||||
RS_FUNCTION_RETURN_REG = RS_R3;
|
||||
{ Low part of 64bit return value }
|
||||
NR_FUNCTION_RETURN64_LOW_REG = NR_R4;
|
||||
RS_FUNCTION_RETURN64_LOW_REG = RS_R4;
|
||||
{ High part of 64bit return value }
|
||||
NR_FUNCTION_RETURNHIGH_REG = NR_R4;
|
||||
RS_FUNCTION_RETURNHIGH_REG = RS_R4;
|
||||
NR_FUNCTION_RETURN64_HIGH_REG = NR_R3;
|
||||
RS_FUNCTION_RETURN64_HIGH_REG = RS_R3;
|
||||
{ The value returned from a function is available in this register }
|
||||
NR_FUNCTION_RESULT_REG = NR_FUNCTION_RETURN_REG;
|
||||
RS_FUNCTION_RESULT_REG = RS_FUNCTION_RETURN_REG;
|
||||
{ The high part of 64bit value returned from a function is available in this register }
|
||||
NR_FUNCTION_RESULTHIGH_REG = NR_FUNCTION_RETURNHIGH_REG;
|
||||
RS_FUNCTION_RESULTHIGH_REG = RS_FUNCTION_RETURNHIGH_REG;
|
||||
{ The lowh part of 64bit value returned from a function }
|
||||
NR_FUNCTION_RESULT64_LOW_REG = NR_FUNCTION_RETURN64_LOW_REG;
|
||||
RS_FUNCTION_RESULT64_LOW_REG = RS_FUNCTION_RETURN64_LOW_REG;
|
||||
{ The high part of 64bit value returned from a function }
|
||||
NR_FUNCTION_RESULT64_HIGH_REG = NR_FUNCTION_RETURN64_HIGH_REG;
|
||||
RS_FUNCTION_RESULT64_HIGH_REG = RS_FUNCTION_RETURN64_HIGH_REG;
|
||||
|
||||
{ WARNING: don't change to R_ST0!! See comments above implementation of }
|
||||
{ a_loadfpu* methods in rgcpu (JM) }
|
||||
@ -846,7 +852,10 @@ implementation
|
||||
end.
|
||||
{
|
||||
$Log$
|
||||
Revision 1.54 2003-05-30 23:57:08 peter
|
||||
Revision 1.55 2003-05-31 15:05:28 peter
|
||||
* FUNCTION_RESULT64_LOW/HIGH_REG added for int64 results
|
||||
|
||||
Revision 1.54 2003/05/30 23:57:08 peter
|
||||
* more sparc cleanup
|
||||
* accumulator removed, splitted in function_return_reg (called) and
|
||||
function_result_reg (caller)
|
||||
|
@ -907,18 +907,24 @@ type
|
||||
{ the return_result_reg, is used inside the called function to store its return
|
||||
value when that is a scalar value otherwise a pointer to the address of the
|
||||
result is placed inside it }
|
||||
{ Results are returned in this register (32-bit values) }
|
||||
NR_FUNCTION_RETURN_REG = NR_I0;
|
||||
RS_FUNCTION_RETURN_REG = RS_I0;
|
||||
{ The high part of 64bit value returned by this function }
|
||||
NR_FUNCTION_RETURNHIGH_REG = NR_I1;
|
||||
RS_FUNCTION_RETURNHIGH_REG = RS_I1;
|
||||
{ the FUNCTION_RESULT_REG contains the function result after a call to a scalar
|
||||
function othewise it contains a pointer to the returned result}
|
||||
{ Low part of 64bit return value }
|
||||
NR_FUNCTION_RETURN64LOW_REG = NR_I1;
|
||||
RS_FUNCTION_RETURN64LOW_REG = RS_I1;
|
||||
{ High part of 64bit return value }
|
||||
NR_FUNCTION_RETURN64HIGH_REG = NR_I0;
|
||||
RS_FUNCTION_RETURN64HIGH_REG = RS_I0;
|
||||
{ The value returned from a function is available in this register }
|
||||
NR_FUNCTION_RESULT_REG = NR_O0;
|
||||
RS_FUNCTION_RESULT_REG = RS_O0;
|
||||
{ The high part of 64bit value returned from a function is available in this register }
|
||||
NR_FUNCTION_RESULTHIGH_REG = NR_O1;
|
||||
RS_FUNCTION_RESULTHIGH_REG = RS_O1;
|
||||
{ The lowh part of 64bit value returned from a function }
|
||||
NR_FUNCTION_RESULT64_LOW_REG = NR_O1;
|
||||
RS_FUNCTION_RESULT64_LOW_REG = RS_O1;
|
||||
{ The high part of 64bit value returned from a function }
|
||||
NR_FUNCTION_RESULT64_HIGH_REG = NR_O0;
|
||||
RS_FUNCTION_RESULT64_HIGH_REG = RS_O0;
|
||||
|
||||
FPU_RESULT_REG = R_F0;
|
||||
mmresultreg = R_NO;
|
||||
@ -1005,7 +1011,10 @@ implementation
|
||||
end.
|
||||
{
|
||||
$Log$
|
||||
Revision 1.36 2003-05-31 01:00:51 peter
|
||||
Revision 1.37 2003-05-31 15:05:28 peter
|
||||
* FUNCTION_RESULT64_LOW/HIGH_REG added for int64 results
|
||||
|
||||
Revision 1.36 2003/05/31 01:00:51 peter
|
||||
* register fixes
|
||||
|
||||
Revision 1.35 2003/05/30 23:57:08 peter
|
||||
|
@ -171,18 +171,12 @@ const
|
||||
further information look at GCC source : PIC_OFFSET_TABLE_REGNUM
|
||||
}
|
||||
NR_PIC_OFFSET_REG = NR_EBX;
|
||||
{ Results are returned in this register (32-bit values) }
|
||||
{ Results are returned in this register (both 32 and 64 bits }
|
||||
NR_FUNCTION_RETURN_REG = NR_RAX;
|
||||
RS_FUNCTION_RETURN_REG = RS_RAX;
|
||||
{ High part of 64bit return value }
|
||||
NR_FUNCTION_RETURNHIGH_REG = NR_NONE;
|
||||
RS_FUNCTION_RETURNHIGH_REG = RS_NONE;
|
||||
{ The value returned from a function is available in this register }
|
||||
NR_FUNCTION_RESULT_REG = NR_FUNCTION_RETURN_REG;
|
||||
RS_FUNCTION_RESULT_REG = RS_FUNCTION_RETURN_REG;
|
||||
{ The high part of 64bit value returned from a function is available in this register }
|
||||
NR_FUNCTION_RESULTHIGH_REG = NR_FUNCTION_RETURNHIGH_REG;
|
||||
RS_FUNCTION_RESULTHIGH_REG = RS_FUNCTION_RETURNHIGH_REG;
|
||||
|
||||
fpu_result_reg = R_ST;
|
||||
mmresultreg = R_MM0;
|
||||
@ -211,7 +205,10 @@ const
|
||||
|
||||
{
|
||||
$Log$
|
||||
Revision 1.4 2003-05-30 23:57:08 peter
|
||||
Revision 1.5 2003-05-31 15:05:28 peter
|
||||
* FUNCTION_RESULT64_LOW/HIGH_REG added for int64 results
|
||||
|
||||
Revision 1.4 2003/05/30 23:57:08 peter
|
||||
* more sparc cleanup
|
||||
* accumulator removed, splitted in function_return_reg (called) and
|
||||
function_result_reg (caller)
|
||||
|
Loading…
Reference in New Issue
Block a user