瀏覽代碼

* firstpasscount bug fixed
now all is already set correctly the first time
under EXTDEBUG try -gp to skip all other firstpasses
it works !!
* small bug fixes
- for smallsets with -dTESTSMALLSET
- some warnings removed (by correcting code !)

pierre 27 年之前
父節點
當前提交
af65f86213
共有 5 個文件被更改,包括 108 次插入32 次删除
  1. 11 2
      compiler/ag386int.pas
  2. 11 2
      compiler/ag386nsm.pas
  3. 27 9
      compiler/cgi386.pas
  4. 28 9
      compiler/pass_1.pas
  5. 31 10
      compiler/pexpr.pas

+ 11 - 2
compiler/ag386int.pas

@@ -75,7 +75,7 @@ unit ag386int;
         c  : comp;
         dd : pdouble;
       begin
-         c:=d;
+         c:=comp(d);
          dd:=pdouble(@c); { this makes a bitwise copy of c into a double }
          comp2str:=double2str(dd^);
       end;
@@ -554,7 +554,16 @@ ait_stab_function_name : ;
 end.
 {
   $Log$
-  Revision 1.9  1998-05-23 01:20:55  peter
+  Revision 1.10  1998-05-25 17:11:36  pierre
+    * firstpasscount bug fixed
+      now all is already set correctly the first time
+      under EXTDEBUG try -gp to skip all other firstpasses
+      it works !!
+    * small bug fixes
+      - for smallsets with -dTESTSMALLSET
+      - some warnings removed (by correcting code !)
+
+  Revision 1.9  1998/05/23 01:20:55  peter
     + aktasmmode, aktoptprocessor, aktoutputformat
     + smartlink per module $SMARTLINK-/+ (like MMX) and moved to aktswitches
     + $LIBNAME to set the library name where the unit will be put in

+ 11 - 2
compiler/ag386nsm.pas

@@ -75,7 +75,7 @@ unit ag386nsm;
         c  : comp;
         dd : pdouble;
       begin
-         c:=d;
+         c:=comp(d);
          dd:=pdouble(@c); { this makes a bitwise copy of c into a double }
          comp2str:=double2str(dd^);
       end;
@@ -537,7 +537,16 @@ ait_stab_function_name : ;
 end.
 {
   $Log$
-  Revision 1.1  1998-05-23 01:20:56  peter
+  Revision 1.2  1998-05-25 17:11:37  pierre
+    * firstpasscount bug fixed
+      now all is already set correctly the first time
+      under EXTDEBUG try -gp to skip all other firstpasses
+      it works !!
+    * small bug fixes
+      - for smallsets with -dTESTSMALLSET
+      - some warnings removed (by correcting code !)
+
+  Revision 1.1  1998/05/23 01:20:56  peter
     + aktasmmode, aktoptprocessor, aktoutputformat
     + smartlink per module $SMARTLINK-/+ (like MMX) and moved to aktswitches
     + $LIBNAME to set the library name where the unit will be put in

+ 27 - 9
compiler/cgi386.pas

@@ -4420,17 +4420,20 @@ implementation
          i : longint;
          hp : ptree;
          href,sref : treference;
-         hr : tregister;
+{$ifdef TestSmallSet}
+         smallsetvalue : longint;
+         hr,hr2 : tregister;
+{$endif TestSmallSet}
 
       begin
          { this should be reimplemented for smallsets }
          { differently  (PM) }
          { produce constant part }
 {$ifdef TestSmallSet}
-         if psetdef(p^.resulttype)=smallset then
+         if psetdef(p^.resulttype)^.settype=smallset then
            begin
               smallsetvalue:=(p^.constset^[3]*256)+p^.constset^[2];
-              smallsetvalue:=((smallset*256+p^.constset^[1])*256+p^.constset^[1];
+              smallsetvalue:=(smallsetvalue*256+p^.constset^[1])*256+p^.constset^[0];
               {consts^.concat(new(pai_const,init_32bit(smallsetvalue)));}
               hr:=getregister32;
               exprasmlist^.concat(new(pai386,op_const_reg(A_MOV,S_L,
@@ -4445,14 +4448,20 @@ implementation
                           exit;
                         case hp^.left^.location.loc of
                           LOC_MEM,LOC_REFERENCE :
-                            exprasmlist^.concat(new(pai386,op_ref_reg(A_BTS,S_L,
-                              newreference(p^.left^.location.reference),hr)));
+                            begin
+                               hr2:=getregister32;
+                               exprasmlist^.concat(new(pai386,op_ref_reg(A_MOV,S_L,
+                               newreference(hp^.left^.location.reference),hr2)));
+                               exprasmlist^.concat(new(pai386,op_reg_reg(A_BTS,S_NO,
+                                 hr2,hr)));
+                               ungetregister32(hr2);
+                            end;
                           LOC_REGISTER,LOC_CREGISTER :
-                            exprasmlist^.concat(new(pai386,op_reg_reg(A_BTS,S_L,
-                              p^.left^.location.register,hr)));
+                            exprasmlist^.concat(new(pai386,op_reg_reg(A_BTS,S_NO,
+                              hp^.left^.location.register,hr)));
                           else
                             internalerror(10567);
-                          end
+                          end;
                         hp:=hp^.right;
                      end;
                 end;
@@ -6198,7 +6207,16 @@ do_jmp:
 end.
 {
   $Log$
-  Revision 1.26  1998-05-23 01:21:03  peter
+  Revision 1.27  1998-05-25 17:11:38  pierre
+    * firstpasscount bug fixed
+      now all is already set correctly the first time
+      under EXTDEBUG try -gp to skip all other firstpasses
+      it works !!
+    * small bug fixes
+      - for smallsets with -dTESTSMALLSET
+      - some warnings removed (by correcting code !)
+
+  Revision 1.26  1998/05/23 01:21:03  peter
     + aktasmmode, aktoptprocessor, aktoutputformat
     + smartlink per module $SMARTLINK-/+ (like MMX) and moved to aktswitches
     + $LIBNAME to set the library name where the unit will be put in

+ 28 - 9
compiler/pass_1.pas

@@ -1300,11 +1300,11 @@ unit pass_1;
          { example length(s)+1 gets internal 'longint' type first }
          { if it is a arg it is converted to 'LONGINT' }
          { but a second first pass will reset this to 'longint' }
-         if not assigned(p^.resulttype) then
          case p^.treetype of
             ltn,lten,gtn,gten,equaln,unequaln:
               begin
-                 p^.resulttype:=booldef;
+                 if not assigned(p^.resulttype) then
+                   p^.resulttype:=booldef;
                  p^.location.loc:=LOC_FLAGS;
               end;
             addn:
@@ -1314,7 +1314,8 @@ unit pass_1;
                     (p^.right^.resulttype^.deftype=stringdef) then
                    begin
 {$ifndef UseAnsiString}
-                   p^.resulttype:=cstringdef
+                      if not assigned(p^.resulttype) then
+                        p^.resulttype:=cstringdef
 {$else UseAnsiString}
                       if is_ansistring(p^.left^.resulttype) or
                          is_ansistring(p^.right^.resulttype) then
@@ -1324,9 +1325,11 @@ unit pass_1;
 {$endif UseAnsiString}
                    end
                  else
-                   p^.resulttype:=p^.left^.resulttype;
+                   if not assigned(p^.resulttype) then
+                     p^.resulttype:=p^.left^.resulttype;
               end;
-            else p^.resulttype:=p^.left^.resulttype;
+            else if not assigned(p^.resulttype) then
+              p^.resulttype:=p^.left^.resulttype;
          end;
       end;
 
@@ -2547,9 +2550,10 @@ unit pass_1;
               {if not(assigned(p^.resulttype)) then }
               if not(assigned(p^.resulttype)) or
                 (p^.left^.treetype=typeconvn) then
-                firstpass(p^.left)
-              else
-                exit;
+                firstpass(p^.left);
+              {else
+                exit; this broke the
+                value of registers32 !! }
 
               if codegenerror then
                 begin
@@ -2667,7 +2671,9 @@ unit pass_1;
          exactmatch,inlined : boolean;
          paralength,l : longint;
          pdc : pdefcoll;
+     {$ifdef UseBrowser}
          curtokenpos : tfileposinfo;
+     {$endif UseBrowser}
 
          { only Dummy }
          hcvt : tconverttype;
@@ -4818,6 +4824,10 @@ unit pass_1;
 {$endif extdebug}
 
       begin
+{$ifdef extdebug}
+         if (p^.firstpasscount>0) and only_one_pass then
+           exit;
+{$endif extdebug}
          { if we save there the whole stuff, }
          { line numbers become more correct  }
          oldis:=current_module^.current_inputfile;
@@ -4894,7 +4904,16 @@ unit pass_1;
 end.
 {
   $Log$
-  Revision 1.20  1998-05-23 01:21:17  peter
+  Revision 1.21  1998-05-25 17:11:41  pierre
+    * firstpasscount bug fixed
+      now all is already set correctly the first time
+      under EXTDEBUG try -gp to skip all other firstpasses
+      it works !!
+    * small bug fixes
+      - for smallsets with -dTESTSMALLSET
+      - some warnings removed (by correcting code !)
+
+  Revision 1.20  1998/05/23 01:21:17  peter
     + aktasmmode, aktoptprocessor, aktoutputformat
     + smartlink per module $SMARTLINK-/+ (like MMX) and moved to aktswitches
     + $LIBNAME to set the library name where the unit will be put in

+ 31 - 10
compiler/pexpr.pas

@@ -1448,16 +1448,20 @@ unit pexpr;
                                     do_firstpass(p1);
                                     case p1^.treetype of
                                        ordconstn : begin
+                                                      if p1^.resulttype=s32bitdef then
+                                                        p1^.resulttype:=u8bitdef;
                                                       if pd=nil then
                                                         pd:=p1^.resulttype;
-                                                     if not(is_equal(pd,p1^.resulttype)) then
-                                                       Message(parser_e_typeconflict_in_set)
-                                                     else
-                                                       if token=POINTPOINT then
-                                                         begin
-                                                            consume(POINTPOINT);
-                                                            p3:=comp_expr(true);
-                                                            do_firstpass(p3);
+                                                      if not(is_equal(pd,p1^.resulttype)) then
+                                                        Message(parser_e_typeconflict_in_set)
+                                                      else
+                                                        if token=POINTPOINT then
+                                                          begin
+                                                             consume(POINTPOINT);
+                                                             p3:=comp_expr(true);
+                                                             do_firstpass(p3);
+                                                             if p3^.resulttype=s32bitdef then
+                                                               p3^.resulttype:=u8bitdef;
                                                             if not(is_equal(pd,p3^.resulttype)) then
                                                               Message(parser_e_typeconflict_in_set)
                                                             else
@@ -1481,6 +1485,8 @@ unit pexpr;
                                                 end;
                                        else
                                           begin
+                                             if p1^.resulttype=s32bitdef then
+                                               p1^.resulttype:=u8bitdef;
                                              if pd=nil then
                                                pd:=p1^.resulttype;
                                              if not(is_equal(pd,p1^.resulttype)) then
@@ -1494,7 +1500,13 @@ unit pexpr;
                                  end;
                              consume(RECKKLAMMER);
                              p1:=gensinglenode(setconstrn,p2);
-                             p1^.resulttype:=new(psetdef,init(pd,255));
+                             { use smallset if emudef with max < 32
+                             but allow sets for enumdefs with more than
+                             256 elements like tasmop !! }
+                             if (pd^.deftype=enumdef) and (penumdef(pd)^.max<=255) then
+                               p1^.resulttype:=new(psetdef,init(pd,penumdef(pd)^.max))
+                             else
+                               p1^.resulttype:=new(psetdef,init(pd,255));
                              p1^.constset:=constset;
                           end;
             PLUS     : begin
@@ -1733,7 +1745,16 @@ unit pexpr;
 end.
 {
   $Log$
-  Revision 1.18  1998-05-23 01:21:20  peter
+  Revision 1.19  1998-05-25 17:11:43  pierre
+    * firstpasscount bug fixed
+      now all is already set correctly the first time
+      under EXTDEBUG try -gp to skip all other firstpasses
+      it works !!
+    * small bug fixes
+      - for smallsets with -dTESTSMALLSET
+      - some warnings removed (by correcting code !)
+
+  Revision 1.18  1998/05/23 01:21:20  peter
     + aktasmmode, aktoptprocessor, aktoutputformat
     + smartlink per module $SMARTLINK-/+ (like MMX) and moved to aktswitches
     + $LIBNAME to set the library name where the unit will be put in