2
0
Эх сурвалжийг харах

* also specify sret attribute at the caller side

git-svn-id: trunk@34302 -
Jonas Maebe 9 жил өмнө
parent
commit
7ebbb744e9

+ 2 - 1
compiler/llvm/aasmllvm.pas

@@ -184,7 +184,8 @@ interface
     tllvmcallpara = record
       def: tdef;
       valueext: tllvmvalueextension;
-      byval: boolean;
+      byval,
+      sret: boolean;
       case loc: tcgloc of
         LOC_REFERENCE,
         LOC_REGISTER,

+ 2 - 0
compiler/llvm/agllvm.pas

@@ -246,6 +246,8 @@ implementation
              result:=result+llvmvalueextension2str[para^.valueext];
            if para^.byval then
              result:=result+' byval';
+           if para^.sret then
+             result:=result+' sret';
            case para^.loc of
              LOC_REGISTER,
              LOC_FPUREGISTER,

+ 10 - 1
compiler/llvm/hlcgllvm.pas

@@ -442,7 +442,16 @@ implementation
             callpara^.def:=paraloc^.def;
             { if the paraloc doesn't contain the value itself, it's a byval
               parameter }
-            callpara^.byval:=not paraloc^.llvmvalueloc;
+            if paraloc^.retvalloc then
+              begin
+                callpara^.sret:=true;
+                callpara^.byval:=false;
+              end
+            else
+              begin
+                callpara^.sret:=false;
+                callpara^.byval:=not paraloc^.llvmvalueloc;
+              end;
             llvmextractvalueextinfo(paras[i]^.def, callpara^.def, callpara^.valueext);
             if paraloc^.llvmloc.loc=LOC_CONSTANT then
               begin

+ 2 - 0
compiler/llvm/llvmpara.pas

@@ -99,6 +99,8 @@ unit llvmpara;
         paralocs }
       while assigned(paraloc) do
         begin
+          if vo_is_funcret in parasym.varoptions then
+            paraloc^.retvalloc:=true;
           { varargs parameters do not have a parasym.owner, but they're always
             by value }
           if (assigned(parasym.owner) and

+ 2 - 1
compiler/parabase.pas

@@ -49,7 +49,8 @@ unit parabase;
 
          { true if the llvmloc symbol is the value itself, rather than a
            pointer to the value (~ named register) }
-         llvmvalueloc: boolean;
+         llvmvalueloc,
+         retvalloc: boolean;
          llvmloc: record
            case loc: TCGLoc of
              { nil if none corresponding to this particular paraloc }