mirror of
https://gitlab.com/freepascal.org/fpc/source.git
synced 2025-08-26 12:09:07 +02:00
* keep the result type after a call as llvmretdef, because call nodes
afterwards use hlcg.gen_load_cgpara_loc() to convert it to the Pascal level tdef (and otherwise we try to do this twice). For non-Pascal level calls, the code generator will automatically convert the type if necessary when using the function result location, because its def is (now) set to llvmretdef git-svn-id: trunk@32475 -
This commit is contained in:
parent
f4a62c4c60
commit
99c97c331a
@ -1664,21 +1664,21 @@ implementation
|
|||||||
{ to ease the handling of aggregate types here, we just store
|
{ to ease the handling of aggregate types here, we just store
|
||||||
everything to memory rather than potentially dealing with aggregates
|
everything to memory rather than potentially dealing with aggregates
|
||||||
in "registers" }
|
in "registers" }
|
||||||
tg.gethltemp(list, hlretdef, hlretdef.size, tt_normal, rettemp);
|
tg.gethltemp(list, llvmretdef, llvmretdef.size, tt_normal, rettemp);
|
||||||
case def2regtyp(llvmretdef) of
|
case def2regtyp(llvmretdef) of
|
||||||
R_INTREGISTER,
|
R_INTREGISTER,
|
||||||
R_ADDRESSREGISTER:
|
R_ADDRESSREGISTER:
|
||||||
a_load_reg_ref(list,llvmretdef,hlretdef,resval,rettemp);
|
a_load_reg_ref(list,llvmretdef,llvmretdef,resval,rettemp);
|
||||||
R_FPUREGISTER:
|
R_FPUREGISTER:
|
||||||
a_loadfpu_reg_ref(list,llvmretdef,hlretdef,resval,rettemp);
|
a_loadfpu_reg_ref(list,llvmretdef,llvmretdef,resval,rettemp);
|
||||||
R_MMREGISTER:
|
R_MMREGISTER:
|
||||||
a_loadmm_reg_ref(list,llvmretdef,hlretdef,resval,rettemp,mms_movescalar);
|
a_loadmm_reg_ref(list,llvmretdef,llvmretdef,resval,rettemp,mms_movescalar);
|
||||||
end;
|
end;
|
||||||
{ the return parameter now contains a value whose type matches the one
|
{ the return parameter now contains a value whose type matches the one
|
||||||
that the high level code generator expects instead of the llvm shim
|
that the high level code generator expects instead of the llvm shim
|
||||||
}
|
}
|
||||||
retpara.def:=hlretdef;
|
retpara.def:=llvmretdef;
|
||||||
retpara.location^.def:=hlretdef;
|
retpara.location^.def:=llvmretdef;
|
||||||
{ for llvm-specific code: }
|
{ for llvm-specific code: }
|
||||||
retpara.location^.llvmvalueloc:=false;
|
retpara.location^.llvmvalueloc:=false;
|
||||||
retpara.location^.llvmloc.loc:=LOC_REGISTER;
|
retpara.location^.llvmloc.loc:=LOC_REGISTER;
|
||||||
@ -1690,22 +1690,9 @@ implementation
|
|||||||
end
|
end
|
||||||
else
|
else
|
||||||
begin
|
begin
|
||||||
if llvmretdef<>hlretdef then
|
retpara.def:=llvmretdef;
|
||||||
begin
|
retpara.Location^.def:=llvmretdef;
|
||||||
hreg:=getregisterfordef(list,hlretdef);
|
retpara.location^.llvmloc.reg:=resval;
|
||||||
case def2regtyp(llvmretdef) of
|
|
||||||
R_INTREGISTER,
|
|
||||||
R_ADDRESSREGISTER:
|
|
||||||
a_load_reg_reg(list,llvmretdef,hlretdef,resval,hreg);
|
|
||||||
R_FPUREGISTER:
|
|
||||||
a_loadfpu_reg_reg(list,llvmretdef,hlretdef,resval,hreg);
|
|
||||||
R_MMREGISTER:
|
|
||||||
a_loadmm_reg_reg(list,llvmretdef,hlretdef,resval,hreg,mms_movescalar);
|
|
||||||
end;
|
|
||||||
retpara.location^.llvmloc.reg:=hreg
|
|
||||||
end
|
|
||||||
else
|
|
||||||
retpara.location^.llvmloc.reg:=resval;
|
|
||||||
retpara.Location^.llvmloc.loc:=retpara.location^.loc;
|
retpara.Location^.llvmloc.loc:=retpara.location^.loc;
|
||||||
retpara.Location^.llvmvalueloc:=true;
|
retpara.Location^.llvmvalueloc:=true;
|
||||||
end;
|
end;
|
||||||
|
Loading…
Reference in New Issue
Block a user