Browse Source

m68k: new 68k register data file format, which eases future subregister support

git-svn-id: trunk@32653 -
Károly Balogh 9 years ago
parent
commit
9133964676
2 changed files with 50 additions and 50 deletions
  1. 35 35
      compiler/m68k/m68kreg.dat
  2. 15 15
      compiler/utils/mk68kreg.pp

+ 35 - 35
compiler/m68k/m68kreg.dat

@@ -2,43 +2,43 @@
 ; Motorola 680x0 registers
 ; Motorola 680x0 registers
 ;
 ;
 ; layout
 ; layout
-; <name>,<type>,<value>,<stdname>,<stabidx>
+; <name>,<value>,<stdname>,<gasname>,<stabidx>
 ;
 ;
-NO,$00,$00,INVALID,INVALID,-1
+NO,$00000000,INVALID,INVALID,-1
 
 
-D0,$01,$00,d0,%d0,0
-D1,$01,$01,d1,%d1,1
-D2,$01,$02,d2,%d2,2
-D3,$01,$03,d3,%d3,3
-D4,$01,$04,d4,%d4,4
-D5,$01,$05,d5,%d5,5
-D6,$01,$06,d6,%d6,6
-D7,$01,$07,d7,%d7,7
+D0,$01000000,d0,%d0,0
+D1,$01000001,d1,%d1,1
+D2,$01000002,d2,%d2,2
+D3,$01000003,d3,%d3,3
+D4,$01000004,d4,%d4,4
+D5,$01000005,d5,%d5,5
+D6,$01000006,d6,%d6,6
+D7,$01000007,d7,%d7,7
 
 
-FP0,$02,$00,fp0,%fp0,16
-FP1,$02,$01,fp1,%fp1,17
-FP2,$02,$02,fp2,%fp2,18
-FP3,$02,$03,fp3,%fp3,19
-FP4,$02,$04,fp4,%fp4,20
-FP5,$02,$05,fp5,%fp5,21
-FP6,$02,$06,fp6,%fp6,22
-FP7,$02,$07,fp7,%fp7,23
+FP0,$02000000,fp0,%fp0,16
+FP1,$02000001,fp1,%fp1,17
+FP2,$02000002,fp2,%fp2,18
+FP3,$02000003,fp3,%fp3,19
+FP4,$02000004,fp4,%fp4,20
+FP5,$02000005,fp5,%fp5,21
+FP6,$02000006,fp6,%fp6,22
+FP7,$02000007,fp7,%fp7,23
 
 
-PC,$05,$00,pc,%pc,24
-CCR,$05,$01,ccr,%ccr,0
-FPCR,$05,$02,fpcr,%fpcr,0
-SR,$05,$03,sr,%sr,0
-SSP,$05,$04,ssp,%ssp,0
-DFC,$05,$05,dfc,%dfc,0
-SFC,$05,$06,sfc,%sfc,0
-VBR,$05,$07,vbr,%vbr,0
-FPSR,$05,$08,fpsr,%fpsr,0
+PC,$05000000,pc,%pc,24
+CCR,$05000001,ccr,%ccr,0
+FPCR,$05000002,fpcr,%fpcr,0
+SR,$05000003,sr,%sr,0
+SSP,$05000004,ssp,%ssp,0
+DFC,$05000005,dfc,%dfc,0
+SFC,$05000006,sfc,%sfc,0
+VBR,$05000007,vbr,%vbr,0
+FPSR,$05000008,fpsr,%fpsr,0
 
 
-A0,$06,$00,a0,%a0,8
-A1,$06,$01,a1,%a1,9
-A2,$06,$02,a2,%a2,10
-A3,$06,$03,a3,%a3,11
-A4,$06,$04,a4,%a4,12
-A5,$06,$05,a5,%a5,13
-A6,$06,$06,a6,%a6,14
-A7,$06,$07,a7,%a7,15
+A0,$06000000,a0,%a0,8
+A1,$06000001,a1,%a1,9
+A2,$06000002,a2,%a2,10
+A3,$06000003,a3,%a3,11
+A4,$06000004,a4,%a4,12
+A5,$06000005,a5,%a5,13
+A6,$06000006,a6,%a6,14
+A7,$06000007,a7,%a7,15

+ 15 - 15
compiler/utils/mk68kreg.pp

@@ -1,7 +1,7 @@
 {
 {
     Copyright (c) 1998-2002 by Peter Vreman and Florian Klaempfl
     Copyright (c) 1998-2002 by Peter Vreman and Florian Klaempfl
 
 
-    Convert spreg.dat to several .inc files for usage with
+    Convert m68kreg.dat to several .inc files for usage with
     the Free pascal compiler
     the Free pascal compiler
 
 
     See the file COPYING.FPC, included in this distribution,
     See the file COPYING.FPC, included in this distribution,
@@ -13,7 +13,7 @@
 
 
  **********************************************************************}
  **********************************************************************}
 {$mode objfpc}
 {$mode objfpc}
-program mkspreg;
+program mk68kreg;
 
 
 const Version = '1.00';
 const Version = '1.00';
       max_regcount = 200;
       max_regcount = 200;
@@ -24,9 +24,7 @@ var s : string;
     regcount:byte;
     regcount:byte;
     regcount_bsstart:byte;
     regcount_bsstart:byte;
     names,
     names,
-    regtypes,
-    supregs,
-    numbers,
+    values,
     stdnames,
     stdnames,
     gasnames,
     gasnames,
     stabs : array[0..max_regcount-1] of string[63];
     stabs : array[0..max_regcount-1] of string[63];
@@ -102,7 +100,7 @@ begin
         i:=h;
         i:=h;
         repeat
         repeat
           j:=i+p;
           j:=i+p;
-          if numbers[regnumber_index[j]]>=numbers[regnumber_index[i]] then
+          if values[regnumber_index[j]]>=values[regnumber_index[i]] then
             break;
             break;
           t:=regnumber_index[i];
           t:=regnumber_index[i];
           regnumber_index[i]:=regnumber_index[j];
           regnumber_index[i]:=regnumber_index[j];
@@ -199,9 +197,7 @@ begin
         i:=1;
         i:=1;
         names[regcount]:=readstr;
         names[regcount]:=readstr;
         readcomma;
         readcomma;
-        regtypes[regcount]:=readstr;
-        readcomma;
-        supregs[regcount]:=readstr;
+        values[regcount]:=readstr;
         readcomma;
         readcomma;
         stdnames[regcount]:=readstr;
         stdnames[regcount]:=readstr;
         readcomma;
         readcomma;
@@ -209,13 +205,12 @@ begin
         readcomma;
         readcomma;
         stabs[regcount]:=readstr;
         stabs[regcount]:=readstr;
         { Create register number }
         { Create register number }
-        if supregs[regcount][1]<>'$' then
+        if values[regcount][1]<>'$' then
           begin
           begin
             writeln('Missing $ before number, at line ',line);
             writeln('Missing $ before number, at line ',line);
             writeln('Line: "',s,'"');
             writeln('Line: "',s,'"');
             halt(1);
             halt(1);
           end;
           end;
-        numbers[regcount]:=regtypes[regcount]+'0000'+copy(supregs[regcount],2,255);
         if i<length(s) then
         if i<length(s) then
           begin
           begin
             writeln('Extra chars at end of line, at line ',line);
             writeln('Extra chars at end of line, at line ',line);
@@ -237,7 +232,8 @@ procedure write_inc_files;
 var
 var
     norfile,stdfile,gasfile,supfile,
     norfile,stdfile,gasfile,supfile,
     numfile,stabfile,confile,
     numfile,stabfile,confile,
-    rnifile,srifile,grifile:text;
+    rnifile,srifile,grifile,
+    bssfile:text;
     first:boolean;
     first:boolean;
 
 
 begin
 begin
@@ -252,6 +248,7 @@ begin
   openinc(rnifile,'r68krni.inc');
   openinc(rnifile,'r68krni.inc');
   openinc(srifile,'r68ksri.inc');
   openinc(srifile,'r68ksri.inc');
   openinc(grifile,'r68kgri.inc');
   openinc(grifile,'r68kgri.inc');
+  openinc(bssfile,'r68kbss.inc');
   first:=true;
   first:=true;
   for i:=0 to regcount-1 do
   for i:=0 to regcount-1 do
     begin
     begin
@@ -267,9 +264,10 @@ begin
         end
         end
       else
       else
         first:=false;
         first:=false;
-      writeln(supfile,'RS_',names[i],' = ',supregs[i],';');
-      writeln(confile,'NR_'+names[i],' = ','tregister(',numbers[i],')',';');
-      write(numfile,'tregister(',numbers[i],')');
+      if (copy(values[i],4,2)='00') or (copy(values[i],4,2)='04') then // subd or subnone -> superregister
+        writeln(supfile,'RS_',names[i],' = $',copy(values[i],length(values[i])-1,2),'; { ',values[i],' }');
+      writeln(confile,'NR_'+names[i],' = ','tregister(',values[i],')',';');
+      write(numfile,'tregister(',values[i],')');
       write(stdfile,'''',stdnames[i],'''');
       write(stdfile,'''',stdnames[i],'''');
       write(gasfile,'''',gasnames[i],'''');
       write(gasfile,'''',gasnames[i],'''');
       write(stabfile,stabs[i]);
       write(stabfile,stabs[i]);
@@ -278,6 +276,7 @@ begin
       write(grifile,gas_regname_index[i]);
       write(grifile,gas_regname_index[i]);
     end;
     end;
   write(norfile,regcount);
   write(norfile,regcount);
+  write(bssfile,'regnumber_count_bsstart = ',regcount_bsstart,';');
   close(confile);
   close(confile);
   close(supfile);
   close(supfile);
   closeinc(numfile);
   closeinc(numfile);
@@ -288,6 +287,7 @@ begin
   closeinc(rnifile);
   closeinc(rnifile);
   closeinc(srifile);
   closeinc(srifile);
   closeinc(grifile);
   closeinc(grifile);
+  closeinc(bssfile);
   writeln('Done!');
   writeln('Done!');
   writeln(regcount,' registers processed');
   writeln(regcount,' registers processed');
 end;
 end;