mirror of
https://gitlab.com/freepascal.org/fpc/source.git
synced 2025-04-07 15:47:53 +02:00
* don't force simple function results in memory
o results in simpler code, and more importantly is required for some code that expects a LOC_REGISTER after calling certain system unit helpers (e.g. in ncgutil.new_exception) git-svn-id: branches/hlcgllvm@28375 -
This commit is contained in:
parent
ac4c455991
commit
4acd43c643
@ -1429,24 +1429,33 @@ implementation
|
||||
return location }
|
||||
if not retpara.temporary then
|
||||
internalerror(2014020101);
|
||||
{ to ease the handling of aggregate types here, we just store
|
||||
everything to memory rather than potentially dealing with aggregates
|
||||
in "registers" }
|
||||
tg.gethltemp(list, hlretdef, hlretdef.size, tt_normal, rettemp);
|
||||
a_load_reg_ref(list, llvmretdef, hlretdef, resval, rettemp);
|
||||
{ the return parameter now contains a value whose type matches the one
|
||||
that the high level code generator expects instead of the llvm shim
|
||||
}
|
||||
retpara.def:=hlretdef;
|
||||
retpara.location^.def:=hlretdef;
|
||||
{ for llvm-specific code: }
|
||||
retpara.location^.llvmvalueloc:=false;
|
||||
retpara.location^.llvmloc.loc:=LOC_REGISTER;
|
||||
retpara.location^.llvmloc.reg:=rettemp.base;
|
||||
{ for the rest (normally not used, but cleaner to set it correclty) }
|
||||
retpara.location^.loc:=LOC_REFERENCE;
|
||||
retpara.location^.reference.index:=rettemp.base;
|
||||
retpara.location^.reference.offset:=0;
|
||||
if llvmaggregatetype(hlretdef) then
|
||||
begin
|
||||
{ to ease the handling of aggregate types here, we just store
|
||||
everything to memory rather than potentially dealing with aggregates
|
||||
in "registers" }
|
||||
tg.gethltemp(list, hlretdef, hlretdef.size, tt_normal, rettemp);
|
||||
a_load_reg_ref(list, llvmretdef, hlretdef, resval, rettemp);
|
||||
{ the return parameter now contains a value whose type matches the one
|
||||
that the high level code generator expects instead of the llvm shim
|
||||
}
|
||||
retpara.def:=hlretdef;
|
||||
retpara.location^.def:=hlretdef;
|
||||
{ for llvm-specific code: }
|
||||
retpara.location^.llvmvalueloc:=false;
|
||||
retpara.location^.llvmloc.loc:=LOC_REGISTER;
|
||||
retpara.location^.llvmloc.reg:=rettemp.base;
|
||||
{ for the rest (normally not used, but cleaner to set it correclty) }
|
||||
retpara.location^.loc:=LOC_REFERENCE;
|
||||
retpara.location^.reference.index:=rettemp.base;
|
||||
retpara.location^.reference.offset:=0;
|
||||
end
|
||||
else
|
||||
begin
|
||||
retpara.Location^.llvmloc.loc:=retpara.location^.loc;
|
||||
retpara.location^.llvmloc.reg:=resval;
|
||||
retpara.Location^.llvmvalueloc:=true;
|
||||
end;
|
||||
end
|
||||
else
|
||||
retpara.location^.llvmloc.loc:=LOC_VOID;
|
||||
|
Loading…
Reference in New Issue
Block a user