Browse Source

* make extcycle is working again

peter 21 years ago
parent
commit
ee569d7817
8 changed files with 224 additions and 201 deletions
  1. 6 11
      compiler/cgobj.pas
  2. 14 2
      compiler/htypechk.pas
  3. 7 4
      compiler/ncal.pas
  4. 168 167
      compiler/ncgflw.pas
  5. 5 2
      compiler/pdecl.pas
  6. 5 2
      compiler/pdecvar.pas
  7. 13 10
      compiler/rgobj.pas
  8. 6 3
      compiler/symdef.pas

+ 6 - 11
compiler/cgobj.pas

@@ -918,7 +918,7 @@ implementation
 
               getexplicitregister(list,locpara.register);
               ungetregister(list,locpara.register);
-{ 
+{
               This is now a normal imaginary register, allocated the usual way (JM)
               getexplicitregister(list,reg);
 }
@@ -929,7 +929,7 @@ implementation
             begin
               getexplicitregister(list,locpara.register);
               ungetregister(list,locpara.register);
-{ 
+{
               This is now a normal imaginary register, allocated the usual way (JM)
               getexplicitregister(list,reg);
 }
@@ -1889,13 +1889,9 @@ implementation
            paramanager.freeparaloc(list,paraloc1);
            paramanager.freeparaloc(list,paraloc2);
            { No register saving needed, saveregisters is used }
-{$ifndef x86}
            allocexplicitregisters(list,R_INTREGISTER,paramanager.get_volatile_registers_int(pocall_default));
-{$endif x86}
            a_call_name(list,'FPC_CHECK_OBJECT_EXT');
-{$ifndef x86}
            deallocexplicitregisters(list,R_INTREGISTER,paramanager.get_volatile_registers_int(pocall_default));
-{$endif x86}
          end
         else
          if (cs_check_range in aktlocalswitches) then
@@ -1904,13 +1900,9 @@ implementation
             a_param_reg(list,OS_ADDR,reg,paraloc1);
             paramanager.freeparaloc(list,paraloc1);
             { No register saving needed, saveregisters is used }
-{$ifndef x86}
             allocexplicitregisters(list,R_INTREGISTER,paramanager.get_volatile_registers_int(pocall_default));
-{$endif x86}
             a_call_name(list,'FPC_CHECK_OBJECT');
-{$ifndef x86}
             deallocexplicitregisters(list,R_INTREGISTER,paramanager.get_volatile_registers_int(pocall_default));
-{$endif x86}
           end;
       end;
 
@@ -2151,7 +2143,10 @@ finalization
 end.
 {
   $Log$
-  Revision 1.156  2004-02-08 18:08:59  jonas
+  Revision 1.157  2004-02-12 15:54:03  peter
+    * make extcycle is working again
+
+  Revision 1.156  2004/02/08 18:08:59  jonas
     * fixed regvars support. Needs -doldregvars to activate. Only tested with
       ppc, other processors should however only require maxregvars and
       maxfpuregvars constants in cpubase.pas. Remember to take scratch-

+ 14 - 2
compiler/htypechk.pas

@@ -766,7 +766,16 @@ implementation
                  hp:=tunarynode(hp).left;
                end;
              asn :
-               hp:=tunarynode(hp).left;
+               begin
+                 { asn can't be assigned directly, it returns the value in a register instead
+                   of reference. }
+                 if not(gotsubscript or gotderef or gotvec) then
+                   begin
+                     CGMessagePos(hp.fileinfo,type_e_argument_cant_be_assigned);
+                     exit;
+                   end;
+                 hp:=tunarynode(hp).left;
+               end;
              subscriptn :
                begin
                  gotsubscript:=true;
@@ -929,7 +938,10 @@ implementation
 end.
 {
   $Log$
-  Revision 1.77  2004-02-04 22:15:15  daniel
+  Revision 1.78  2004-02-12 15:54:03  peter
+    * make extcycle is working again
+
+  Revision 1.77  2004/02/04 22:15:15  daniel
     * Rtti generation moved to ncgutil
     * Assmtai usage of symsym removed
     * operator overloading cleanup up

+ 7 - 4
compiler/ncal.pas

@@ -68,7 +68,7 @@ interface
           procedure candidates_free(procs:pcandidate);
           procedure candidates_list(procs:pcandidate;all:boolean);
           procedure candidates_get_information(procs:pcandidate);
-          function  candidates_choose_best(procs:pcandidate;var bestpd:tprocdef):integer;
+          function  candidates_choose_best(procs:pcandidate;var bestpd:tabstractprocdef):integer;
           procedure candidates_find_wrong_para(procs:pcandidate);
 {$ifdef EXTDEBUG}
           procedure candidates_dump_info(lvl:longint;procs:pcandidate);
@@ -1615,7 +1615,7 @@ type
       end;
 
 
-    function Tcallnode.candidates_choose_best(procs:pcandidate;var bestpd:tprocdef):integer;
+    function Tcallnode.candidates_choose_best(procs:pcandidate;var bestpd:tabstractprocdef):integer;
       var
         besthpstart,
         hp       : pcandidate;
@@ -2116,7 +2116,7 @@ type
 
                    { Choose the best candidate and count the number of
                      candidates left }
-                   cand_cnt:=candidates_choose_best(procs,tprocdef(procdefinition));
+                   cand_cnt:=candidates_choose_best(procs,procdefinition);
 
                    { All parameters are checked, check if there are any
                      procedures left }
@@ -2716,7 +2716,10 @@ begin
 end.
 {
   $Log$
-  Revision 1.223  2004-02-05 01:24:08  florian
+  Revision 1.224  2004-02-12 15:54:03  peter
+    * make extcycle is working again
+
+  Revision 1.223  2004/02/05 01:24:08  florian
     * several fixes to compile x86-64 system
 
   Revision 1.222  2004/02/03 22:32:54  peter

+ 168 - 167
compiler/ncgflw.pas

@@ -496,185 +496,183 @@ implementation
          load_all_regvars(exprasmlist);
 {$endif OLDREGVARS}
 
-         cmp_const:=Tordconstnode(right).value;
-         if do_loopvar_at_end then
-            begin
-              {Watch out for wrap around 255 -> 0.}
-              {Ugly: This code is way to long... Use tables?}
-              case opsize of
-                OS_8:
-                  begin
-                    if lnf_backward in loopflags then
-                      begin
-                        if byte(cmp_const)=low(byte) then
-                          begin
-                            hcond:=OC_NE;
-                            cmp_const:=high(byte);
-                          end
-                      end
-                    else
-                      begin
-                        if byte(cmp_const)=high(byte) then
-                          begin
-                            hcond:=OC_NE;
-                            cmp_const:=low(byte);
-                          end
-                      end
-                  end;
-                OS_16:
-                  begin
-                    if lnf_backward in loopflags then
-                      begin
-                        if word(cmp_const)=high(word) then
-                          begin
-                            hcond:=OC_NE;
-                            cmp_const:=low(word);
-                          end
-                      end
-                    else
-                      begin
-                        if word(cmp_const)=low(word) then
-                          begin
-                            hcond:=OC_NE;
-                            cmp_const:=high(word);
-                          end
-                      end
-                  end;
-                OS_32:
-                  begin
-                    if lnf_backward in loopflags then
-                      begin
-                        if cardinal(cmp_const)=high(cardinal) then
-                          begin
-                            hcond:=OC_NE;
-                            cmp_const:=low(cardinal);
-                          end
-                      end
-                    else
-                      begin
-                        if cardinal(cmp_const)=low(cardinal) then
-                          begin
-                            hcond:=OC_NE;
-                            cmp_const:=high(cardinal);
-                          end
-                      end
-                  end;
-                OS_64:
-                  begin
-                    if lnf_backward in loopflags then
-                      begin
-                        if qword(cmp_const)=high(qword) then
-                          begin
-                            hcond:=OC_NE;
-                            cmp_const:=low(qword);
-                          end
-                      end
-                    else
-                      begin
-                        if qword(cmp_const)=low(qword) then
-                          begin
-                            hcond:=OC_NE;
-                            cmp_const:=high(qword);
-                          end
-                      end
-                  end;
-                OS_S8:
-                  begin
-                    if lnf_backward in loopflags then
-                      begin
-                        if shortint(cmp_const)=low(shortint) then
-                          begin
-                            hcond:=OC_NE;
-                            cmp_const:=high(shortint);
-                          end
-                      end
-                    else
-                      begin
-                        if shortint(cmp_const)=high(shortint) then
-                          begin
-                            hcond:=OC_NE;
-                            cmp_const:=low(shortint);
-                          end
-                      end
-                  end;
-                OS_S16:
-                  begin
-                    if lnf_backward in loopflags then
-                      begin
-                        if integer(cmp_const)=high(integer) then
-                          begin
-                            hcond:=OC_NE;
-                            cmp_const:=low(integer);
-                          end
-                      end
-                    else
-                      begin
-                        if integer(cmp_const)=low(integer) then
-                          begin
-                            hcond:=OC_NE;
-                            cmp_const:=high(integer);
-                          end
-                      end
-                  end;
-                OS_S32:
-                  begin
-                    if lnf_backward in loopflags then
-                      begin
-                        if longint(cmp_const)=high(longint) then
-                          begin
-                            hcond:=OC_NE;
-                            cmp_const:=low(longint);
-                          end
-                      end
-                    else
-                      begin
-                        if longint(cmp_const)=low(longint) then
-                          begin
-                            hcond:=OC_NE;
-                            cmp_const:=high(longint);
-                          end
-                      end
-                  end;
-                OS_S64:
-                  begin
-                    if lnf_backward in loopflags then
-                      begin
-                        if int64(cmp_const)=high(int64) then
-                          begin
-                            hcond:=OC_NE;
-                            cmp_const:=low(int64);
-                          end
-                      end
-                    else
-                      begin
-                        if int64(cmp_const)=low(int64) then
-                          begin
-                            hcond:=OC_NE;
-                            cmp_const:=high(int64);
-                          end
-                      end
-                  end;
-                else
-                  internalerror(200201021);
-              end;
-            end;
-
          { produce comparison and the corresponding }
          { jump                                     }
          if temptovalue then
            begin
              cg.a_cmp_ref_loc_label(exprasmlist,opsize,hcond,temp1,
                t2.location,l3);
+             tg.ungetiftemp(exprasmlist,temp1);
            end
          else
            begin
+             cmp_const:=Tordconstnode(right).value;
+             if do_loopvar_at_end then
+               begin
+                 {Watch out for wrap around 255 -> 0.}
+                 {Ugly: This code is way to long... Use tables?}
+                 case opsize of
+                   OS_8:
+                     begin
+                       if lnf_backward in loopflags then
+                         begin
+                           if byte(cmp_const)=low(byte) then
+                             begin
+                               hcond:=OC_NE;
+                               cmp_const:=high(byte);
+                             end
+                         end
+                       else
+                         begin
+                           if byte(cmp_const)=high(byte) then
+                             begin
+                               hcond:=OC_NE;
+                               cmp_const:=low(byte);
+                             end
+                         end
+                     end;
+                   OS_16:
+                     begin
+                       if lnf_backward in loopflags then
+                         begin
+                           if word(cmp_const)=high(word) then
+                             begin
+                               hcond:=OC_NE;
+                               cmp_const:=low(word);
+                             end
+                         end
+                       else
+                         begin
+                           if word(cmp_const)=low(word) then
+                             begin
+                               hcond:=OC_NE;
+                               cmp_const:=high(word);
+                             end
+                         end
+                     end;
+                   OS_32:
+                     begin
+                       if lnf_backward in loopflags then
+                         begin
+                           if cardinal(cmp_const)=high(cardinal) then
+                             begin
+                               hcond:=OC_NE;
+                               cmp_const:=low(cardinal);
+                             end
+                         end
+                       else
+                         begin
+                           if cardinal(cmp_const)=low(cardinal) then
+                             begin
+                               hcond:=OC_NE;
+                               cmp_const:=high(cardinal);
+                             end
+                         end
+                     end;
+                   OS_64:
+                     begin
+                       if lnf_backward in loopflags then
+                         begin
+                           if qword(cmp_const)=high(qword) then
+                             begin
+                               hcond:=OC_NE;
+                               cmp_const:=low(qword);
+                             end
+                         end
+                       else
+                         begin
+                           if qword(cmp_const)=low(qword) then
+                             begin
+                               hcond:=OC_NE;
+                               cmp_const:=high(qword);
+                             end
+                         end
+                     end;
+                   OS_S8:
+                     begin
+                       if lnf_backward in loopflags then
+                         begin
+                           if shortint(cmp_const)=low(shortint) then
+                             begin
+                               hcond:=OC_NE;
+                               cmp_const:=high(shortint);
+                             end
+                         end
+                       else
+                         begin
+                           if shortint(cmp_const)=high(shortint) then
+                             begin
+                               hcond:=OC_NE;
+                               cmp_const:=low(shortint);
+                             end
+                         end
+                     end;
+                   OS_S16:
+                     begin
+                       if lnf_backward in loopflags then
+                         begin
+                           if integer(cmp_const)=high(integer) then
+                             begin
+                               hcond:=OC_NE;
+                               cmp_const:=low(integer);
+                             end
+                         end
+                       else
+                         begin
+                           if integer(cmp_const)=low(integer) then
+                             begin
+                               hcond:=OC_NE;
+                               cmp_const:=high(integer);
+                             end
+                         end
+                     end;
+                   OS_S32:
+                     begin
+                       if lnf_backward in loopflags then
+                         begin
+                           if longint(cmp_const)=high(longint) then
+                             begin
+                               hcond:=OC_NE;
+                               cmp_const:=low(longint);
+                             end
+                         end
+                       else
+                         begin
+                           if longint(cmp_const)=low(longint) then
+                             begin
+                               hcond:=OC_NE;
+                               cmp_const:=high(longint);
+                             end
+                         end
+                     end;
+                   OS_S64:
+                     begin
+                       if lnf_backward in loopflags then
+                         begin
+                           if int64(cmp_const)=high(int64) then
+                             begin
+                               hcond:=OC_NE;
+                               cmp_const:=low(int64);
+                             end
+                         end
+                       else
+                         begin
+                           if int64(cmp_const)=low(int64) then
+                             begin
+                               hcond:=OC_NE;
+                               cmp_const:=high(int64);
+                             end
+                         end
+                     end;
+                   else
+                     internalerror(200201021);
+                 end;
+               end;
+
              cg.a_cmp_const_loc_label(exprasmlist,opsize,hcond,
                cmp_const,t2.location,l3);
            end;
 
-         if temptovalue then
-           tg.ungetiftemp(exprasmlist,temp1);
-
          { this is the break label: }
          cg.a_label(exprasmlist,aktbreaklabel);
 
@@ -1463,7 +1461,10 @@ begin
 end.
 {
   $Log$
-  Revision 1.91  2004-02-05 18:28:37  peter
+  Revision 1.92  2004-02-12 15:54:03  peter
+    * make extcycle is working again
+
+  Revision 1.91  2004/02/05 18:28:37  peter
     * x86_64 fixes for opsize
 
   Revision 1.90  2004/01/31 17:45:17  peter

+ 5 - 2
compiler/pdecl.pas

@@ -341,7 +341,7 @@ implementation
                      begin
                        tpointerdef(pd).pointertype.setsym(srsym);
                        { avoid wrong unused warnings web bug 801 PM }
-                       inc(tstoredsym(srsym).refs);
+                       inc(ttypesym(srsym).refs);
 {$ifdef GDB}
                        if (cs_debuginfo in aktmoduleswitches) and assigned(debuglist) and
                           (tsym(p).owner.symtabletype in [globalsymtable,staticsymtable]) then
@@ -682,7 +682,10 @@ implementation
 end.
 {
   $Log$
-  Revision 1.78  2004-02-11 19:59:06  peter
+  Revision 1.79  2004-02-12 15:54:03  peter
+    * make extcycle is working again
+
+  Revision 1.78  2004/02/11 19:59:06  peter
     * fix compilation without GDB
 
   Revision 1.77  2004/01/31 22:48:31  daniel

+ 5 - 2
compiler/pdecvar.pas

@@ -781,7 +781,7 @@ implementation
                     { remove subscriptn before checking for loadn }
                     hp:=pt;
                     while (hp.nodetype in [subscriptn,typeconvn,vecn]) do
-                      hp:=tsubscriptnode(hp).left;
+                      hp:=tunarynode(hp).left;
                     if (hp.nodetype=loadn) then
                      begin
                        { we should check the result type of loadn }
@@ -1135,7 +1135,10 @@ implementation
 end.
 {
   $Log$
-  Revision 1.64  2004-02-03 22:32:54  peter
+  Revision 1.65  2004-02-12 15:54:03  peter
+    * make extcycle is working again
+
+  Revision 1.64  2004/02/03 22:32:54  peter
     * renamed xNNbittype to xNNinttype
     * renamed registers32 to registersint
     * replace some s32bit,u32bit with torddef([su]inttype).def.typ

+ 13 - 10
compiler/rgobj.pas

@@ -534,11 +534,11 @@ implementation
 
 
     procedure trgobj.ungetregister(list:Taasmoutput;r:Tregister);
-      begin        
-        {$ifdef EXTDEBUG}
-        if reginfo=nil then
+      begin
+{$ifdef EXTDEBUG}
+        if (reginfo=nil) and (getsupreg(r)>=first_imaginary) then
           InternalError(2004020901);
-        {$endif EXTDEBUG}
+{$endif EXTDEBUG}
         { Only explicit allocs insert regalloc info }
         if getsupreg(r)<first_imaginary then
           list.concat(Tai_regalloc.dealloc(r));
@@ -915,7 +915,7 @@ implementation
               {Remove the node from the spillworklist.}
               if not spillworklist.delete(m) then
                 internalerror(200310145);
-    
+
               if move_related(m) then
                 freezeworklist.add(m)
               else
@@ -1092,7 +1092,7 @@ implementation
           p:=0;
           q:=reginfo[u].movelist^.sorted_until;
           i:=0;
-          if q<>0 then 
+          if q<>0 then
             repeat
               i:=(p+q) shr 1;
               if ptrint(searched)>ptrint(reginfo[u].movelist^.data[i]) then
@@ -1578,11 +1578,11 @@ implementation
                   begin
                     if (getregtype(reg)=regtype) then
                       setsupreg(reg,reginfo[getsupreg(reg)].colour);
-  
+
                     {
                       Remove sequences of release and
                       allocation of the same register like:
-  
+
                          # Register X released
                          # Register X allocated
                     }
@@ -1631,7 +1631,7 @@ implementation
                             end;
 {$endif arm}
                         end;
-  
+
                     { Maybe the operation can be removed when
                       it is a move and both arguments are the same }
                     if is_same_reg_move(regtype) then
@@ -2009,7 +2009,10 @@ implementation
 end.
 {
   $Log$
-  Revision 1.121  2004-02-09 20:12:23  olle
+  Revision 1.122  2004-02-12 15:54:03  peter
+    * make extcycle is working again
+
+  Revision 1.121  2004/02/09 20:12:23  olle
     + check that register allocation is not made at the wrong moment
 
   Revision 1.120  2004/02/08 23:10:21  jonas

+ 6 - 3
compiler/symdef.pas

@@ -847,7 +847,7 @@ implementation
              hp2:=p;
              p:=tparaitem(p.next);
              { pull in }
-             tparaitem(hp2.next):=hp1;
+             hp2.next:=hp1;
              hp1:=hp2;
           end;
         reverseparaitems:=hp1;
@@ -963,7 +963,7 @@ implementation
 
     procedure Tstoreddef.reset;
 
-    begin    
+    begin
 {$ifdef GDB}
       if assigned(typesym) then
         ttypesym(typesym).isusedinstab:=false;
@@ -6096,7 +6096,10 @@ implementation
 end.
 {
   $Log$
-  Revision 1.217  2004-02-08 18:08:59  jonas
+  Revision 1.218  2004-02-12 15:54:03  peter
+    * make extcycle is working again
+
+  Revision 1.217  2004/02/08 18:08:59  jonas
     * fixed regvars support. Needs -doldregvars to activate. Only tested with
       ppc, other processors should however only require maxregvars and
       maxfpuregvars constants in cpubase.pas. Remember to take scratch-