* also specify the byval alignment at the callee side

git-svn-id: trunk@41448 -
This commit is contained in:
Jonas Maebe 2019-02-24 19:59:00 +00:00
parent bead1f8180
commit 08791712d7

View File

@ -668,9 +668,12 @@ implementation
procedure llvmaddencodedparaloctype(hp: tparavarsym; proccalloption: tproccalloption; withparaname, withattributes: boolean; var first: boolean; var encodedstr: TSymStr); procedure llvmaddencodedparaloctype(hp: tparavarsym; proccalloption: tproccalloption; withparaname, withattributes: boolean; var first: boolean; var encodedstr: TSymStr);
var var
para: PCGPara;
paraloc: PCGParaLocation; paraloc: PCGParaLocation;
side: tcallercallee;
signext: tllvmvalueextension; signext: tllvmvalueextension;
usedef: tdef; usedef: tdef;
firstloc: boolean;
begin begin
if (proccalloption in cdecl_pocalls) and if (proccalloption in cdecl_pocalls) and
is_array_of_const(hp.vardef) then is_array_of_const(hp.vardef) then
@ -682,20 +685,17 @@ implementation
encodedstr:=encodedstr+'...'; encodedstr:=encodedstr+'...';
exit exit
end; end;
if withparaname then if not withparaname then
begin side:=callerside
{ don't add parameters that don't take up registers or stack space;
clang doesn't either and some LLVM backends don't support them }
if hp.paraloc[calleeside].isempty then
exit;
paraloc:=hp.paraloc[calleeside].location
end
else else
begin side:=calleeside;
if hp.paraloc[callerside].isempty then { don't add parameters that don't take up registers or stack space;
exit; clang doesn't either and some LLVM backends don't support them }
paraloc:=hp.paraloc[callerside].location; if hp.paraloc[side].isempty then
end; exit;
para:=@hp.paraloc[side];
paraloc:=para^.location;
firstloc:=true;
repeat repeat
usedef:=paraloc^.def; usedef:=paraloc^.def;
llvmextractvalueextinfo(hp.vardef,usedef,signext); llvmextractvalueextinfo(hp.vardef,usedef,signext);
@ -732,7 +732,14 @@ implementation
llvmbyvalparaloc(paraloc) then llvmbyvalparaloc(paraloc) then
begin begin
if withattributes then if withattributes then
encodedstr:=encodedstr+'* byval' begin
encodedstr:=encodedstr+'* byval';
if firstloc and
(para^.alignment<>std_param_align) then
begin
encodedstr:=encodedstr+' align '+tostr(para^.alignment);
end;
end
else else
encodedstr:=encodedstr+'*'; encodedstr:=encodedstr+'*';
end end
@ -778,6 +785,7 @@ implementation
encodedstr:=encodedstr+' '+llvmasmsymname(paraloc^.llvmloc.sym); encodedstr:=encodedstr+' '+llvmasmsymname(paraloc^.llvmloc.sym);
end; end;
paraloc:=paraloc^.next; paraloc:=paraloc^.next;
firstloc:=false;
first:=false; first:=false;
until not assigned(paraloc); until not assigned(paraloc);
end; end;