Explorar el Código

* m68k updates merged from fixes branch

peter hace 24 años
padre
commit
9a47ac9ec2
Se han modificado 7 ficheros con 92 adiciones y 55 borrados
  1. 21 1
      compiler/gdb.pas
  2. 8 16
      compiler/ncal.pas
  3. 6 5
      compiler/ninl.pas
  4. 16 10
      compiler/pstatmnt.pas
  5. 19 6
      compiler/psub.pas
  6. 6 4
      compiler/regvars.pas
  7. 16 13
      compiler/symdef.pas

+ 21 - 1
compiler/gdb.pas

@@ -97,6 +97,23 @@ Const
           -1,-1,-1,-1,-1,-1,-1,-1
         );
 {$endif i386}
+{$ifdef m68k}
+           { "d0", "d1", "d2", "d3", "d4", "d5", "d6", "d7",
+             "a0", "a1", "a2", "a3", "a4", "a5", "fp", "sp",
+             "ps", "pc", "fp0", "fp1", "fp2", "fp3", "fp4" ,
+             "fp5", "fp6", "fp7", "fpcontrol", "fpstatus",
+             "fpiaddr","fpcode","fpflags"
+           }
+        { this is the register order for GDB }
+        GDB_m68kindex : array[tregister] of shortint =
+        (-1,                 { R_NO }
+          0,1,2,3,4,5,6,7,   { R_D0..R_D7 }
+          8,9,10,11,12,13,14,15,  { R_A0..R_A7 }
+          -1,-1,-1,                { R_SPPUSH, R_SPPULL, R_CCR }
+          18,19,20,21,22,23,24,25, { R_FP0..R_FP7    }
+          -1,-1,-1,-1,-1,-1,-1,-1
+        );
+{$endif}
 
   implementation
 
@@ -249,7 +266,10 @@ end.
 
 {
   $Log$
-  Revision 1.6  2001-04-13 01:22:07  peter
+  Revision 1.7  2001-04-21 12:03:11  peter
+    * m68k updates merged from fixes branch
+
+  Revision 1.6  2001/04/13 01:22:07  peter
     * symtable change to classes
     * range check generation and errors fixed, make cycle DEBUG=1 works
     * memory leaks fixed

+ 8 - 16
compiler/ncal.pas

@@ -1335,13 +1335,11 @@ implementation
               if not (block_type in [bt_const,bt_type]) then
                 procinfo^.flags:=procinfo^.flags or pi_do_call;
 {$ifndef newcg}
-              { calc the correture value for the register }
+              { calc the correct value for the register }
 {$ifdef i386}
               incrementregisterpushed($ff);
-{$endif}
-{$ifdef m68k}
-              for regi:=R_D0 to R_A6 do
-                inc(reg_pushes[regi],t_times*2);
+{$else}
+              incrementregisterpushed(ALL_REGISTERS);
 {$endif}
 {$endif newcg}
            end
@@ -1382,16 +1380,7 @@ implementation
                 end;
 
 {$ifndef newcg}
-{$ifdef i386}
-              incrementregisterpushed(tprocdef(procdefinition).usedregisters);
-{$endif}
-{$ifdef m68k}
-             for regi:=R_D0 to R_A6 do
-               begin
-                  if (tprocdef(procdefinition).usedregisters and ($800 shr word(regi)))<>0 then
-                    inc(reg_pushes[regi],t_times*2);
-               end;
-{$endif}
+             incrementregisterpushed(tprocdef(procdefinition).usedregisters);
 {$endif newcg}
            end;
 
@@ -1617,7 +1606,10 @@ begin
 end.
 {
   $Log$
-  Revision 1.30  2001-04-18 22:01:54  peter
+  Revision 1.31  2001-04-21 12:03:11  peter
+    * m68k updates merged from fixes branch
+
+  Revision 1.30  2001/04/18 22:01:54  peter
     * registration of targets and assemblers
 
   Revision 1.29  2001/04/13 23:52:29  peter

+ 6 - 5
compiler/ninl.pas

@@ -1253,10 +1253,8 @@ implementation
                            begin
 {$ifdef i386}
                              incrementregisterpushed($ff);
-{$endif}
-{$ifdef m68k}
-                             for regi:=R_D0 to R_A6 do
-                               inc(reg_pushes[regi],t_times*2);
+{$else}
+                             incrementregisterpushed(ALL_REGISTERS);
 {$endif}
                              if (tcallparanode(hp).left.nodetype=typen) then
                                CGMessage(type_e_cant_read_write_type);
@@ -1721,7 +1719,10 @@ begin
 end.
 {
   $Log$
-  Revision 1.37  2001-04-13 22:22:30  peter
+  Revision 1.38  2001-04-21 12:03:11  peter
+    * m68k updates merged from fixes branch
+
+  Revision 1.37  2001/04/13 22:22:30  peter
     * call set_varstate for setlength
     * ptr returns pointerconstnode instead of ordconstnode
 

+ 16 - 10
compiler/pstatmnt.pas

@@ -791,15 +791,15 @@ implementation
 {$endif i386}
 {$ifdef m68k}
                   if pattern='D0' then
-                    usedinproc:=usedinproc or ($800 shr word(R_D0))
+                    usedinproc:=usedinproc +[R_D0]
                   else if pattern='D1' then
-                    usedinproc:=usedinproc or ($800 shr word(R_D1))
+                    usedinproc:=usedinproc + [R_D1]
                   else if pattern='D6' then
-                    usedinproc:=usedinproc or ($800 shr word(R_D6))
+                    usedinproc:=usedinproc + [R_D2]
                   else if pattern='A0' then
-                    usedinproc:=usedinproc or ($800 shr word(R_A0))
+                    usedinproc:=usedinproc + [R_A0]
                   else if pattern='A1' then
-                    usedinproc:=usedinproc or ($800 shr word(R_A1))
+                    usedinproc:=usedinproc + [R_A1]
 {$endif m68k}
                   else consume(_RECKKLAMMER);
                   consume(_CSTRING);
@@ -808,7 +808,11 @@ implementation
                 until false;
               consume(_RECKKLAMMER);
            end
+{$ifdef i386}
          else usedinproc:=$ff;
+{$else}
+         else usedinproc := ALL_REGISTERS;
+{$endif i386}
 {$endif newcg}
 
          { mark the start and the end of the assembler block
@@ -1174,10 +1178,9 @@ implementation
 {$ifndef newcg}
 {$ifdef i386}
                    usedinproc:=usedinproc or ($80 shr byte(R_EAX))
-{$endif}
-{$ifdef m68k}
-                   usedinproc:=usedinproc or ($800 shr word(R_D0))
-{$endif}
+{$else}
+                   usedinproc:=usedinproc + [accumulator];
+{$endif i386}
 {$endif newcg}
                 end
               {
@@ -1217,7 +1220,10 @@ implementation
 end.
 {
   $Log$
-  Revision 1.27  2001-04-18 22:01:57  peter
+  Revision 1.28  2001-04-21 12:03:11  peter
+    * m68k updates merged from fixes branch
+
+  Revision 1.27  2001/04/18 22:01:57  peter
     * registration of targets and assemblers
 
   Revision 1.26  2001/04/15 09:48:30  peter

+ 19 - 6
compiler/psub.pas

@@ -150,10 +150,10 @@ implementation
                      usedinproc:=usedinproc or ($80 shr byte(R_EDX))
 {$endif}
 {$ifdef m68k}
-                   usedinproc:=usedinproc or ($800 shr word(R_D0));
+                   usedinproc:=usedinproc + [accumulator];
 
                    if is_64bitint(procinfo^.returntype.def) then
-                     usedinproc:=usedinproc or ($800 shr byte(R_D1))
+                     usedinproc:=usedinproc  + [scratch_reg];
 {$endif}
 {$endif newcg}
                 end;
@@ -299,8 +299,12 @@ implementation
 {$ifdef newcg}
          tg.usedinproc:=[];
 {$else newcg}
-         { no registers are used }
-         usedinproc:=0;
+{$ifdef i386}
+        { no registers are used }
+        usedinproc:=0;
+{$else}
+        usedinproc := [];
+{$endif}
 {$endif newcg}
          { save entry info }
          entrypos:=aktfilepos;
@@ -365,7 +369,13 @@ implementation
 
                 { FPC_POPADDRSTACK destroys all registers (JM) }
                 if (procinfo^.flags and (pi_needs_implicit_finally or pi_uses_exceptions)) <> 0 then
-                 usedinproc := $ff;
+                 begin
+{$ifdef i386}
+                   usedinproc := $ff;
+{$else}
+                   usedinproc := ALL_REGISTERS;
+{$endif}
+                 end;
 
                 { now generate exit code with the correct position and switches }
                 aktfilepos:=exitpos;
@@ -803,7 +813,10 @@ implementation
 end.
 {
   $Log$
-  Revision 1.31  2001-04-18 22:01:57  peter
+  Revision 1.32  2001-04-21 12:03:12  peter
+    * m68k updates merged from fixes branch
+
+  Revision 1.31  2001/04/18 22:01:57  peter
     * registration of targets and assemblers
 
   Revision 1.30  2001/04/14 14:05:47  peter

+ 6 - 4
compiler/regvars.pas

@@ -222,10 +222,9 @@ implementation
                       { procedure uses this register }
 {$ifdef i386}
                       usedinproc:=usedinproc or ($80 shr byte(varregs[i]));
+{$else i386}
+                      usedinproc:=usedinproc + [varregs[i]];
 {$endif i386}
-{$ifdef m68k}
-                      usedinproc:=usedinproc or ($800 shr word(varregs[i]));
-{$endif m68k}
                     end
                   else
                     begin
@@ -519,7 +518,10 @@ end.
 
 {
   $Log$
-  Revision 1.16  2001-04-13 01:22:13  peter
+  Revision 1.17  2001-04-21 12:03:12  peter
+    * m68k updates merged from fixes branch
+
+  Revision 1.16  2001/04/13 01:22:13  peter
     * symtable change to classes
     * range check generation and errors fixed, make cycle DEBUG=1 works
     * memory leaks fixed

+ 16 - 13
compiler/symdef.pas

@@ -517,7 +517,11 @@ interface
 {$ifdef newcg}
           usedregisters : tregisterset;
 {$else newcg}
+{$ifdef i386}
           usedregisters : longint;
+{$else}
+          usedregisters : tregisterset;
+{$endif}
 {$endif newcg}
           constructor create;
           constructor load;
@@ -3353,10 +3357,9 @@ implementation
 {$else newcg}
 {$ifdef i386}
          usedregisters:=$ff;
+{$else}
+         usedregisters:=ALL_REGISTERS;
 {$endif i386}
-{$ifdef m68k}
-         usedregisters:=$FFFF;
-{$endif}
 {$endif newcg}
          forwarddef:=true;
          interfacedef:=false;
@@ -3379,9 +3382,8 @@ implementation
 {$else newcg}
 {$ifdef i386}
          usedregisters:=readbyte;
-{$endif i386}
-{$ifdef m68k}
-         usedregisters:=readword;
+{$else}
+         readnormalset(usedregisters);
 {$endif}
 {$endif newcg}
          _mangledname:=stringdup(readstring);
@@ -3460,10 +3462,9 @@ implementation
 {$else newcg}
 {$ifdef i386}
              usedregisters:=$ff;
+{$else}
+             usedregisters:=[firstreg..lastreg];
 {$endif i386}
-{$ifdef m68k}
-             usedregisters:=$ffff;
-{$endif}
 {$endif newcg}
            end;
 
@@ -3472,10 +3473,9 @@ implementation
 {$else newcg}
 {$ifdef i386}
          writebyte(usedregisters);
+{$else}
+         writenormalset(usedregisters);
 {$endif i386}
-{$ifdef m68k}
-         writeword(usedregisters);
-{$endif}
 {$endif newcg}
          current_ppu^.do_interface_crc:=oldintfcrc;
          writestring(mangledname);
@@ -5515,7 +5515,10 @@ Const local_symtable_index : longint = $8001;
 end.
 {
   $Log$
-  Revision 1.28  2001-04-18 22:01:58  peter
+  Revision 1.29  2001-04-21 12:03:12  peter
+    * m68k updates merged from fixes branch
+
+  Revision 1.28  2001/04/18 22:01:58  peter
     * registration of targets and assemblers
 
   Revision 1.27  2001/04/13 01:22:15  peter