diff --git a/compiler/llvm/aasmllvm.pas b/compiler/llvm/aasmllvm.pas index 5734156ebc..a7bacced9c 100644 --- a/compiler/llvm/aasmllvm.pas +++ b/compiler/llvm/aasmllvm.pas @@ -204,7 +204,7 @@ interface pllvmcallpara = ^tllvmcallpara; tllvmcallpara = record def: tdef; - alignment: byte; + alignment: shortint; valueext: tllvmvalueextension; byval, sret: boolean; diff --git a/compiler/llvm/agllvm.pas b/compiler/llvm/agllvm.pas index 49c20bf34b..7e75d00f26 100644 --- a/compiler/llvm/agllvm.pas +++ b/compiler/llvm/agllvm.pas @@ -339,10 +339,13 @@ implementation owner.writer.AsmWrite(' byval'); if para^.sret then owner.writer.AsmWrite(' sret'); - if para^.alignment<>std_param_align then + { For byval, this means "alignment on the stack" and of the passed source data. + For other pointer parameters, this means "alignment of the passed source data" } + if (para^.alignment<>std_param_align) or + (para^.alignment<0) then begin owner.writer.AsmWrite(' align '); - owner.writer.AsmWrite(tostr(para^.alignment)); + owner.writer.AsmWrite(tostr(abs(para^.alignment))); end; case para^.typ of top_reg: diff --git a/compiler/llvm/hlcgllvm.pas b/compiler/llvm/hlcgllvm.pas index bb151e7db2..047425dd04 100644 --- a/compiler/llvm/hlcgllvm.pas +++ b/compiler/llvm/hlcgllvm.pas @@ -1197,8 +1197,8 @@ implementation if indivalign then begin paramanager.getintparaloc(list,pd,4,volatilepara); - destpara.Alignment:=dest.alignment; - sourcepara.Alignment:=source.alignment; + destpara.Alignment:=-dest.alignment; + sourcepara.Alignment:=-source.alignment; end else begin diff --git a/compiler/parabase.pas b/compiler/parabase.pas index 3fd6e1b2e1..f18ea06bfd 100644 --- a/compiler/parabase.pas +++ b/compiler/parabase.pas @@ -106,7 +106,7 @@ unit parabase; Location : PCGParalocation; IntSize : tcgint; { size of the total location in bytes } DefDeref : tderef; - Alignment : ShortInt; + Alignment : ShortInt; { in case of LLVM, a negative alignment mean: force write the alignment } Size : TCGSize; { Size of the parameter included in all locations } Temporary : boolean; { created on the fly, no permanent references exist to this somewhere that will cause it to be disposed } constructor init;