Browse Source

* never make vs_var or vs_out variabled non-regable, unless it's an
access from a nested procedure. This allows keeping the address
of large function results like shortstrings in a register,
because they were always made non-regable by a typeconversionnode
due to the fact that they are aliased by an absolute alias.

git-svn-id: trunk@2140 -

Jonas Maebe 19 years ago
parent
commit
9bb86eb411
1 changed files with 5 additions and 1 deletions
  1. 5 1
      compiler/htypechk.pas

+ 5 - 1
compiler/htypechk.pas

@@ -643,7 +643,11 @@ implementation
             typeconvn :
             typeconvn :
               make_not_regable(ttypeconvnode(p).left);
               make_not_regable(ttypeconvnode(p).left);
             loadn :
             loadn :
-              if tloadnode(p).symtableentry.typ in [globalvarsym,localvarsym,paravarsym] then
+              if (tloadnode(p).symtableentry.typ in [globalvarsym,localvarsym]) or
+                 ((tloadnode(p).symtableentry.typ = paravarsym) and
+                  { not a nested variable }
+                  (assigned(tloadnode(p).left) or
+                   not(tparavarsym(tloadnode(p).symtableentry).varspez in [vs_var,vs_out]))) then
                 tabstractvarsym(tloadnode(p).symtableentry).varregable:=vr_none;
                 tabstractvarsym(tloadnode(p).symtableentry).varregable:=vr_none;
          end;
          end;
       end;
       end;