Browse Source

* tvarsym.varregable added, split vo_regable from varoptions

peter 21 years ago
parent
commit
63cf4464d3

+ 5 - 2
compiler/htypechk.pas

@@ -636,7 +636,7 @@ implementation
               make_not_regable(ttypeconvnode(p).left);
             loadn :
               if tloadnode(p).symtableentry.typ=varsym then
-                tvarsym(tloadnode(p).symtableentry).varoptions:=tvarsym(tloadnode(p).symtableentry).varoptions-[vo_regable,vo_fpuregable];
+                tvarsym(tloadnode(p).symtableentry).varregable:=vr_none;
          end;
       end;
 
@@ -1922,7 +1922,10 @@ implementation
 end.
 {
   $Log$
-  Revision 1.98  2004-09-27 15:15:52  peter
+  Revision 1.99  2004-10-08 17:09:43  peter
+    * tvarsym.varregable added, split vo_regable from varoptions
+
+  Revision 1.98  2004/09/27 15:15:52  peter
     * register loopvarsym for fields instead of record variable
     * don't allow class fields as loop var
 

+ 6 - 3
compiler/ncal.pas

@@ -1920,7 +1920,7 @@ type
 {$endif ndef VER1_0}
           begin
             if (cs_regvars in aktglobalswitches) and
-               (([vo_regable{$ifndef x86},vo_fpuregable{$endif}] * tvarsym(p).varoptions) <> []) and
+               (tvarsym(p).varregable<>vr_none) and
                (not tvarsym(p).vartype.def.needs_inittable) then
               tempnode := ctempcreatenode.create_reg(tvarsym(p).vartype,tvarsym(p).vartype.def.size,tt_persistent)
             else
@@ -1974,7 +1974,7 @@ type
                      (node_complexity(para.left) >= NODE_COMPLEXITY_INF))) then
                   begin
                     if (cs_regvars in aktglobalswitches) and
-                       (([vo_regable,vo_fpuregable] * tvarsym(para.paraitem.parasym).varoptions) <> []) and
+                       (tvarsym(para.paraitem.parasym).varregable<>vr_none) and
                        (not tvarsym(para.paraitem.parasym).vartype.def.needs_inittable) then
                       tempnode := ctempcreatenode.create_reg(para.left.resulttype,para.left.resulttype.def.size,tt_persistent)
                     else
@@ -2386,7 +2386,10 @@ begin
 end.
 {
   $Log$
-  Revision 1.248  2004-09-21 17:25:12  peter
+  Revision 1.249  2004-10-08 17:09:43  peter
+    * tvarsym.varregable added, split vo_regable from varoptions
+
+  Revision 1.248  2004/09/21 17:25:12  peter
     * paraloc branch merged
 
   Revision 1.247  2004/09/13 20:29:00  peter

+ 5 - 2
compiler/ncgutil.pas

@@ -1723,7 +1723,7 @@ implementation
                     if (cs_regvars in aktglobalswitches) and
                        not(pi_has_assembler_block in current_procinfo.flags) and
                        not(pi_uses_exceptions in current_procinfo.flags) and
-                       (vo_regable in varoptions) then
+                       (varregable<>vr_none) then
                       begin
                         localloc.loc:=LOC_CREGISTER;
                         localloc.size:=def_cgsize(vartype.def);
@@ -2094,7 +2094,10 @@ implementation
 end.
 {
   $Log$
-  Revision 1.219  2004-09-27 15:14:08  peter
+  Revision 1.220  2004-10-08 17:09:43  peter
+    * tvarsym.varregable added, split vo_regable from varoptions
+
+  Revision 1.219  2004/09/27 15:14:08  peter
     * fix compile for oldregvars
 
   Revision 1.218  2004/09/26 17:45:30  peter

+ 5 - 2
compiler/nld.pas

@@ -349,7 +349,7 @@ implementation
                 if (cs_regvars in aktglobalswitches) and
                    (symtable.symtabletype in [localsymtable]) and
                    not(pi_has_assembler_block in current_procinfo.flags) and
-                   (vo_regable in tvarsym(symtableentry).varoptions) then
+                   (tvarsym(symtableentry).varregable<>vr_none) then
                   expectloc:=LOC_CREGISTER
                 else
                   if (tvarsym(symtableentry).varspez=vs_const) then
@@ -1145,7 +1145,10 @@ begin
 end.
 {
   $Log$
-  Revision 1.130  2004-10-06 19:26:50  jonas
+  Revision 1.131  2004-10-08 17:09:43  peter
+    * tvarsym.varregable added, split vo_regable from varoptions
+
+  Revision 1.130  2004/10/06 19:26:50  jonas
     * regvar fixes from Peter
 
   Revision 1.129  2004/09/26 17:45:30  peter

+ 5 - 8
compiler/pdecsub.pas

@@ -110,7 +110,6 @@ implementation
            { Generate result variable accessing function result }
            vs:=tvarsym.create('$result',vs_var,pd.rettype);
            include(vs.varoptions,vo_is_funcret);
-           include(vs.varoptions,vo_regable);
            pd.parast.insert(vs);
            { For left to right add it at the end to be delphi compatible }
            if pd.proccalloption in pushleftright_pocalls then
@@ -206,7 +205,6 @@ implementation
                   end;
                 vs:=tvarsym.create('$self',vsp,tt);
                 include(vs.varoptions,vo_is_self);
-                include(vs.varoptions,vo_regable);
                 { Insert as hidden parameter }
                 pd.parast.insert(vs);
                 pd.insertpara(vs.vartype,vs,nil,true);
@@ -240,10 +238,6 @@ implementation
             begin
               vs:=tvarsym.create('$result',vs_value,pd.rettype);
               include(vs.varoptions,vo_is_funcret);
-              if tstoreddef(pd.rettype.def).is_intregable then
-                include(vs.varoptions,vo_regable);
-              if tstoreddef(pd.rettype.def).is_fpuregable then
-                include(vs.varoptions,vo_fpuregable);
               pd.localst.insert(vs);
               pd.funcretsym:=vs;
             end;
@@ -534,7 +528,7 @@ implementation
               begin
                 if (varspez in [vs_var,vs_const,vs_out]) and
                    paramanager.push_addr_param(varspez,tt.def,pd.proccalloption) then
-                  include(vs.varoptions,vo_regable);
+                  vs.varregable:=vr_intreg;
               end;
              pd.concatpara(nil,tt,vs,defaultvalue,false);
 
@@ -2266,7 +2260,10 @@ const
 end.
 {
   $Log$
-  Revision 1.190  2004-08-29 11:28:41  peter
+  Revision 1.191  2004-10-08 17:09:43  peter
+    * tvarsym.varregable added, split vo_regable from varoptions
+
+  Revision 1.190  2004/08/29 11:28:41  peter
   fixed crash with error in default value
   allow assembler directive in interface
 

+ 5 - 3
compiler/rautils.pas

@@ -908,8 +908,7 @@ Begin
                      symtable_has_varsyms(current_procinfo.procdef.localst) then
                     message1(asmr_e_local_para_unreachable,s);
                   { variable can't be placed in a register anymore }
-                  exclude(tvarsym(sym).varoptions,vo_regable);
-                  exclude(tvarsym(sym).varoptions,vo_fpuregable);
+                  tvarsym(sym).varregable:=vr_none;
                   opr.localsym:=tvarsym(sym);
                   opr.localsymofs:=0;
                   opr.localindexreg:=indexreg;
@@ -1669,7 +1668,10 @@ end;
 end.
 {
   $Log$
-  Revision 1.89  2004-09-27 15:14:34  peter
+  Revision 1.90  2004-10-08 17:09:43  peter
+    * tvarsym.varregable added, split vo_regable from varoptions
+
+  Revision 1.89  2004/09/27 15:14:34  peter
     * reference local varsyms can't be regvar
 
   Revision 1.88  2004/06/20 08:55:30  florian

+ 11 - 4
compiler/symconst.pas

@@ -277,12 +277,10 @@ type
 
   { options for variables }
   tvaroption=(vo_none,
-    vo_regable,
     vo_is_C_var,
     vo_is_external,
     vo_is_dll_var,
     vo_is_thread_var,
-    vo_fpuregable,
     vo_has_local_copy,
     vo_is_const,  { variable is declared as const (parameter) and can't be written to }
     vo_is_exported,
@@ -291,12 +289,18 @@ type
     vo_is_self,
     vo_is_vmt,
     vo_is_result,  { special result variable }
-    vo_is_reg_para, { register parameter, no space allocation in parast, but in localst }
     vo_is_parentfp,
     vo_is_loop_counter { used to detect assignments to loop counter }
   );
   tvaroptions=set of tvaroption;
 
+  { register variable }
+  tvarregable=(vr_none,
+    vr_intreg,
+    vr_fpureg,
+    vr_mmreg
+  );
+
   { types of the symtables }
   tsymtabletype = (abstractsymtable,
     globalsymtable,staticsymtable,
@@ -411,7 +415,10 @@ initialization
 end.
 {
   $Log$
-  Revision 1.88  2004-09-13 20:30:22  peter
+  Revision 1.89  2004-10-08 17:09:43  peter
+    * tvarsym.varregable added, split vo_regable from varoptions
+
+  Revision 1.88  2004/09/13 20:30:22  peter
     * vo_is_loop_counter added
 
   Revision 1.87  2004/08/25 15:57:04  peter

+ 21 - 11
compiler/symsym.pas

@@ -149,6 +149,7 @@ interface
           defaultconstsym : tsym;
           varoptions    : tvaroptions;
           varspez       : tvarspez;  { sets the type of access }
+          varregable    : tvarregable;
           varstate      : tvarstate;
           localloc      : TLocation; { register/reference for local var }
           fieldoffset   : longint;   { offset in record/object }
@@ -1229,16 +1230,19 @@ implementation
 
     procedure tabsolutesym.ppuwrite(ppufile:tcompilerppufile);
       var
-        hvo : tvaroptions;
+        oldintfcrc : boolean;
       begin
          { Note: This needs to write everything of tvarsym.write }
          inherited writesym(ppufile);
          ppufile.putbyte(byte(varspez));
+         oldintfcrc:=ppufile.do_interface_crc;
+         ppufile.do_interface_crc:=false;
+         ppufile.putbyte(byte(varregable));
+         ppufile.do_interface_crc:=oldintfcrc;
          ppufile.putlongint(fieldoffset);
          { write only definition or definitionsym }
          ppufile.puttype(vartype);
-         hvo:=varoptions-[vo_regable,vo_fpuregable];
-         ppufile.putsmallset(hvo);
+         ppufile.putsmallset(varoptions);
          ppufile.putbyte(byte(abstyp));
          case abstyp of
            tovar :
@@ -1345,6 +1349,7 @@ implementation
          refs := 0;
          varstate:=vs_used;
          varspez:=tvarspez(ppufile.getbyte);
+         varregable:=tvarregable(ppufile.getbyte);
          fieldoffset:=ppufile.getlongint;
          defaultconstsym:=nil;
          ppufile.gettype(_vartype);
@@ -1375,9 +1380,15 @@ implementation
 
 
     procedure tvarsym.ppuwrite(ppufile:tcompilerppufile);
+      var
+        oldintfcrc : boolean;
       begin
          inherited writesym(ppufile);
          ppufile.putbyte(byte(varspez));
+         oldintfcrc:=ppufile.do_interface_crc;
+         ppufile.do_interface_crc:=false;
+         ppufile.putbyte(byte(varregable));
+         ppufile.do_interface_crc:=oldintfcrc;
          ppufile.putlongint(fieldoffset);
          ppufile.puttype(vartype);
          ppufile.putsmallset(varoptions);
@@ -1619,14 +1630,10 @@ implementation
            (owner.symtabletype in [localsymtable,parasymtable]) then
           begin
             if tstoreddef(vartype.def).is_intregable then
-              include(varoptions,vo_regable)
+              varregable:=vr_intreg
             else
-              exclude(varoptions,vo_regable);
-
-            if tstoreddef(vartype.def).is_fpuregable then
-              include(varoptions,vo_fpuregable)
-            else
-              exclude(varoptions,vo_fpuregable);
+              if tstoreddef(vartype.def).is_fpuregable then
+                varregable:=vr_fpureg;
           end;
       end;
 
@@ -2211,7 +2218,10 @@ implementation
 end.
 {
   $Log$
-  Revision 1.179  2004-10-06 19:26:50  jonas
+  Revision 1.180  2004-10-08 17:09:43  peter
+    * tvarsym.varregable added, split vo_regable from varoptions
+
+  Revision 1.179  2004/10/06 19:26:50  jonas
     * regvar fixes from Peter
 
   Revision 1.178  2004/10/01 15:22:22  peter

+ 5 - 3
compiler/symtable.pas

@@ -986,8 +986,7 @@ implementation
         if addsym then
           insert(sym);
         { this symbol can't be loaded to a register }
-        exclude(tvarsym(sym).varoptions,vo_regable);
-        exclude(tvarsym(sym).varoptions,vo_fpuregable);
+        tvarsym(sym).varregable:=vr_none;
         { Calculate field offset }
         l:=tvarsym(sym).getvaluesize;
         vardef:=tvarsym(sym).vartype.def;
@@ -2315,7 +2314,10 @@ implementation
 end.
 {
   $Log$
-  Revision 1.155  2004-08-17 16:29:21  jonas
+  Revision 1.156  2004-10-08 17:09:43  peter
+    * tvarsym.varregable added, split vo_regable from varoptions
+
+  Revision 1.155  2004/08/17 16:29:21  jonas
     + padalgingment field for recordsymtables (saved by recorddefs)
     + support for Macintosh PowerPC alignment (if the first field of a record
       or union has an alignment > 4, then the record or union size must be