Browse Source

+ introduces vo_volatile for variables, the node cse optimizer takes care of it

git-svn-id: trunk@16851 -
florian 14 years ago
parent
commit
1fef7e4b6c
2 changed files with 9 additions and 4 deletions
  1. 7 3
      compiler/optcse.pas
  2. 2 1
      compiler/symconst.pas

+ 7 - 3
compiler/optcse.pas

@@ -57,12 +57,12 @@ unit optcse;
       procinfo,
       procinfo,
       nbas,nld,ninl,ncal,ncnv,nadd,
       nbas,nld,ninl,ncal,ncnv,nadd,
       pass_1,
       pass_1,
-      symconst,symtype,symdef,
+      symconst,symtype,symdef,symsym,
       defutil,
       defutil,
       optbase;
       optbase;
 
 
     const
     const
-      cseinvariant : set of tnodetype = [loadn,addn,muln,subn,divn,slashn,modn,andn,orn,xorn,notn,vecn,
+      cseinvariant : set of tnodetype = [addn,muln,subn,divn,slashn,modn,andn,orn,xorn,notn,vecn,
         derefn,equaln,unequaln,ltn,gtn,lten,gten,typeconvn,subscriptn,
         derefn,equaln,unequaln,ltn,gtn,lten,gten,typeconvn,subscriptn,
         inn,symdifn,shrn,shln,ordconstn,realconstn,unaryminusn,pointerconstn,stringconstn,setconstn,
         inn,symdifn,shrn,shln,ordconstn,realconstn,unaryminusn,pointerconstn,stringconstn,setconstn,
         isn,asn,starstarn,nothingn,temprefn,loadparentfpn {,callparan}];
         isn,asn,starstarn,nothingn,temprefn,loadparentfpn {,callparan}];
@@ -71,7 +71,11 @@ unit optcse;
       begin
       begin
         if (n.nodetype in cseinvariant) or
         if (n.nodetype in cseinvariant) or
           ((n.nodetype=inlinen) and
           ((n.nodetype=inlinen) and
-            (tinlinenode(n).inlinenumber in [in_assigned_x])
+           (tinlinenode(n).inlinenumber in [in_assigned_x])
+          ) or
+          ((n.nodetype=loadn) and
+            not((tloadnode(n).symtableentry.typ in [staticvarsym,localvarsym,paravarsym]) and
+                (vo_volatile in tabstractvarsym(tloadnode(n).symtableentry).varoptions))
           ) then
           ) then
           result:=fen_true
           result:=fen_true
         else
         else

+ 2 - 1
compiler/symconst.pas

@@ -422,7 +422,8 @@ type
     { Objective-C message selector parameter }
     { Objective-C message selector parameter }
     vo_is_msgsel,
     vo_is_msgsel,
     { first field of variant part of a record }
     { first field of variant part of a record }
-    vo_is_first_field
+    vo_is_first_field,
+    vo_volatile
   );
   );
   tvaroptions=set of tvaroption;
   tvaroptions=set of tvaroption;