Przeglądaj źródła

* enable the code that determines the complexity of arguments to inline
routines to see through free type conversions (such as type conversions
inserted for absolute variables, like the 'result' variable)

git-svn-id: trunk@31490 -

Jonas Maebe 10 lat temu
rodzic
commit
0031e12bf3
1 zmienionych plików z 12 dodań i 5 usunięć
  1. 12 5
      compiler/ncal.pas

+ 12 - 5
compiler/ncal.pas

@@ -4431,7 +4431,8 @@ implementation
       var
       var
         para: tcallparanode;
         para: tcallparanode;
         tempnode: ttempcreatenode;
         tempnode: ttempcreatenode;
-        n: tnode;
+        n,
+        realtarget: tnode;
         paracomplexity: longint;
         paracomplexity: longint;
         pushconstaddr: boolean;
         pushconstaddr: boolean;
         trytotakeaddress : Boolean;
         trytotakeaddress : Boolean;
@@ -4474,6 +4475,7 @@ implementation
                 paracomplexity:=node_complexity(para.left);
                 paracomplexity:=node_complexity(para.left);
                 if para.parasym.varspez=vs_const then
                 if para.parasym.varspez=vs_const then
                   pushconstaddr:=paramanager.push_addr_param(vs_const,para.parasym.vardef,procdefinition.proccalloption);
                   pushconstaddr:=paramanager.push_addr_param(vs_const,para.parasym.vardef,procdefinition.proccalloption);
+                realtarget:=actualtargetnode(@para.left)^;
 
 
                 { if the parameter is "complex", try to take the address
                 { if the parameter is "complex", try to take the address
                   of the parameter expression, store it in a temp and replace
                   of the parameter expression, store it in a temp and replace
@@ -4482,11 +4484,16 @@ implementation
                 }
                 }
                 trytotakeaddress:=
                 trytotakeaddress:=
                   { don't create a temp. for function results }
                   { don't create a temp. for function results }
-                  not(nf_is_funcret in para.left.flags) and
+                  not(nf_is_funcret in realtarget.flags) and
                   { this makes only sense if the parameter is reasonable complex else inserting directly is a better solution }
                   { this makes only sense if the parameter is reasonable complex else inserting directly is a better solution }
-                  ((paracomplexity>2) or
-                  { don't create a temp. for the often seen case that p^ is passed to a var parameter }
-                  ((paracomplexity>1) and not((para.left.nodetype=derefn) and (para.parasym.varspez = vs_var))));
+                  (
+                   (paracomplexity>2) or
+                   { don't create a temp. for the often seen case that p^ is passed to a var parameter }
+                   ((paracomplexity>1) and
+                    not((realtarget.nodetype=derefn) and (para.parasym.varspez in [vs_var,vs_out,vs_constref])) and
+                    not((realtarget.nodetype=loadn) and tloadnode(realtarget).is_addr_param_load)
+                   )
+                  );
 
 
                 { check if we have to create a temp, assign the parameter's
                 { check if we have to create a temp, assign the parameter's
                   contents to that temp and then substitute the parameter
                   contents to that temp and then substitute the parameter