* also specify sret attribute at the caller side

git-svn-id: trunk@34302 -
This commit is contained in:
Jonas Maebe 2016-08-13 14:47:42 +00:00
parent 819f0c39fa
commit 7ebbb744e9
5 changed files with 18 additions and 3 deletions

View File

@ -184,7 +184,8 @@ interface
tllvmcallpara = record
def: tdef;
valueext: tllvmvalueextension;
byval: boolean;
byval,
sret: boolean;
case loc: tcgloc of
LOC_REFERENCE,
LOC_REGISTER,

View File

@ -246,6 +246,8 @@ implementation
result:=result+llvmvalueextension2str[para^.valueext];
if para^.byval then
result:=result+' byval';
if para^.sret then
result:=result+' sret';
case para^.loc of
LOC_REGISTER,
LOC_FPUREGISTER,

View File

@ -442,7 +442,16 @@ implementation
callpara^.def:=paraloc^.def;
{ if the paraloc doesn't contain the value itself, it's a byval
parameter }
callpara^.byval:=not paraloc^.llvmvalueloc;
if paraloc^.retvalloc then
begin
callpara^.sret:=true;
callpara^.byval:=false;
end
else
begin
callpara^.sret:=false;
callpara^.byval:=not paraloc^.llvmvalueloc;
end;
llvmextractvalueextinfo(paras[i]^.def, callpara^.def, callpara^.valueext);
if paraloc^.llvmloc.loc=LOC_CONSTANT then
begin

View File

@ -99,6 +99,8 @@ unit llvmpara;
paralocs }
while assigned(paraloc) do
begin
if vo_is_funcret in parasym.varoptions then
paraloc^.retvalloc:=true;
{ varargs parameters do not have a parasym.owner, but they're always
by value }
if (assigned(parasym.owner) and

View File

@ -49,7 +49,8 @@ unit parabase;
{ true if the llvmloc symbol is the value itself, rather than a
pointer to the value (~ named register) }
llvmvalueloc: boolean;
llvmvalueloc,
retvalloc: boolean;
llvmloc: record
case loc: TCGLoc of
{ nil if none corresponding to this particular paraloc }