Browse Source

* keep track of the alignment requirements of parameters with LLVM, and emit
them when they are different from the default

git-svn-id: branches/debug_eh@41216 -

Jonas Maebe 6 years ago
parent
commit
af098474f4
4 changed files with 14 additions and 0 deletions
  1. 1 0
      compiler/llvm/aasmllvm.pas
  2. 5 0
      compiler/llvm/agllvm.pas
  3. 7 0
      compiler/llvm/hlcgllvm.pas
  4. 1 0
      compiler/llvm/nllvmbas.pas

+ 1 - 0
compiler/llvm/aasmllvm.pas

@@ -204,6 +204,7 @@ interface
     pllvmcallpara = ^tllvmcallpara;
     tllvmcallpara = record
       def: tdef;
+      alignment: byte;
       valueext: tllvmvalueextension;
       byval,
       sret: boolean;

+ 5 - 0
compiler/llvm/agllvm.pas

@@ -339,6 +339,11 @@ implementation
              owner.writer.AsmWrite(' byval');
            if para^.sret then
              owner.writer.AsmWrite(' sret');
+           if para^.alignment<>std_param_align then
+             begin
+               owner.writer.AsmWrite(' align ');
+               owner.writer.AsmWrite(tostr(para^.alignment));
+             end;
            case para^.typ of
              top_reg:
                begin

+ 7 - 0
compiler/llvm/hlcgllvm.pas

@@ -437,6 +437,7 @@ implementation
     href: treference;
     callpara: pllvmcallpara;
     paraloc: pcgparalocation;
+    firstparaloc: boolean;
   begin
     callparas:=tfplist.Create;
     for i:=0 to high(paras) do
@@ -445,10 +446,15 @@ implementation
         if paras[i]^.isempty then
           continue;
         paraloc:=paras[i]^.location;
+        firstparaloc:=true;
         while assigned(paraloc) do
           begin
             new(callpara);
             callpara^.def:=paraloc^.def;
+            if firstparaloc then
+              callpara^.alignment:=paras[i]^.Alignment
+            else
+              callpara^.alignment:=std_param_align;
             { if the paraloc doesn't contain the value itself, it's a byval
               parameter }
             if paraloc^.retvalloc then
@@ -515,6 +521,7 @@ implementation
               end;
             callparas.add(callpara);
             paraloc:=paraloc^.next;
+            firstparaloc:=false;
           end;
       end;
     { the Pascal level may expect a different returndef compared to the

+ 1 - 0
compiler/llvm/nllvmbas.pas

@@ -84,6 +84,7 @@ interface
         if not assigned(res^.Data) then
           begin
             new(callpara);
+            callpara^.alignment:=std_param_align;
             callpara^.def:=cpointerdef.getreusable(sym.vardef);
             if (sym.typ=paravarsym) and
                paramanager.push_addr_param(sym.varspez,sym.vardef,current_procinfo.procdef.proccalloption) then