summaryrefslogtreecommitdiff
path: root/compiler
diff options
context:
space:
mode:
authorjonas <jonas@3ad0048d-3df7-0310-abae-a5850022a9f2>2019-02-24 19:59:00 +0000
committerjonas <jonas@3ad0048d-3df7-0310-abae-a5850022a9f2>2019-02-24 19:59:00 +0000
commit840953d88490e1f9cda054b480d96bd87d86a5c1 (patch)
tree38d51e2ceb8426138baf0d5edf4c3f0a6239cba5 /compiler
parent2ba71b77e452d5a3582e4470103928732fb24473 (diff)
downloadfpc-840953d88490e1f9cda054b480d96bd87d86a5c1.tar.gz
* also specify the byval alignment at the callee side
git-svn-id: https://svn.freepascal.org/svn/fpc/trunk@41448 3ad0048d-3df7-0310-abae-a5850022a9f2
Diffstat (limited to 'compiler')
-rw-r--r--compiler/llvm/llvmdef.pas36
1 files changed, 22 insertions, 14 deletions
diff --git a/compiler/llvm/llvmdef.pas b/compiler/llvm/llvmdef.pas
index 735b608802..673b83fc20 100644
--- a/compiler/llvm/llvmdef.pas
+++ b/compiler/llvm/llvmdef.pas
@@ -668,9 +668,12 @@ implementation
procedure llvmaddencodedparaloctype(hp: tparavarsym; proccalloption: tproccalloption; withparaname, withattributes: boolean; var first: boolean; var encodedstr: TSymStr);
var
+ para: PCGPara;
paraloc: PCGParaLocation;
+ side: tcallercallee;
signext: tllvmvalueextension;
usedef: tdef;
+ firstloc: boolean;
begin
if (proccalloption in cdecl_pocalls) and
is_array_of_const(hp.vardef) then
@@ -682,20 +685,17 @@ implementation
encodedstr:=encodedstr+'...';
exit
end;
- if withparaname then
- begin
- { 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
+ if not withparaname then
+ side:=callerside
else
- begin
- if hp.paraloc[callerside].isempty then
- exit;
- paraloc:=hp.paraloc[callerside].location;
- end;
+ side:=calleeside;
+ { 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[side].isempty then
+ exit;
+ para:=@hp.paraloc[side];
+ paraloc:=para^.location;
+ firstloc:=true;
repeat
usedef:=paraloc^.def;
llvmextractvalueextinfo(hp.vardef,usedef,signext);
@@ -732,7 +732,14 @@ implementation
llvmbyvalparaloc(paraloc) then
begin
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
encodedstr:=encodedstr+'*';
end
@@ -778,6 +785,7 @@ implementation
encodedstr:=encodedstr+' '+llvmasmsymname(paraloc^.llvmloc.sym);
end;
paraloc:=paraloc^.next;
+ firstloc:=false;
first:=false;
until not assigned(paraloc);
end;