Prechádzať zdrojové kódy

* type left-over parts of parameters as arrays of "stack slot alignment" if
they're an exact multiple of the ialignment size on LLVM. This prevents
both overalignment (e.g. remainder of 8 individual bytes on ARM
would be aligned to 8 bytes instead of 4 if typed as int64) and
underalignment (e.g. 32 bytes remainder of a record that needs to be
aligned to 8 bytes would be aligned to 1 or 4 bytes if types as
array of resp. bytes or longints)

git-svn-id: trunk@41444 -

Jonas Maebe 6 rokov pred
rodič
commit
e829596750
1 zmenil súbory, kde vykonal 16 pridanie a 2 odobranie
  1. 16 2
      compiler/llvm/llvmdef.pas

+ 16 - 2
compiler/llvm/llvmdef.pas

@@ -118,7 +118,8 @@ implementation
     fmodule,
     symtable,symconst,symsym,
     llvmsym,hlcgobj,
-    defutil,blockutl,cgbase,paramgr;
+    defutil,blockutl,cgbase,paramgr,
+    cpubase;
 
 
 {******************************************************************
@@ -923,6 +924,7 @@ implementation
         retloc: pcgparalocation;
         usedef: tdef;
         valueext: tllvmvalueextension;
+        paraslots,
         i: longint;
         sizeleft: asizeint;
       begin
@@ -983,7 +985,19 @@ implementation
               end
             end
           else
-            retdeflist[i]:=retloc^.def;
+            begin
+              if retloc^.def.typ<>floatdef then
+                begin
+                  paraslots:=sizeleft div cgpara.Alignment;
+                  if (paraslots>1) and
+                     ((paraslots*cgpara.Alignment)=sizeleft) then
+                    retdeflist[i]:=carraydef.getreusable(cgsize_orddef(int_cgsize(cgpara.Alignment)),paraslots)
+                  else
+                    retdeflist[i]:=retloc^.def;
+                end
+              else
+                retdeflist[i]:=retloc^.def;
+            end;
           inc(i);
           retloc:=retloc^.next;
         until not assigned(retloc);