diff --git a/.gitattributes b/.gitattributes index 55dffa78cb..0b5d0d0615 100644 --- a/.gitattributes +++ b/.gitattributes @@ -913,6 +913,7 @@ compiler/utils/mkspreg.pp svneol=native#text/plain compiler/utils/mkx86inl.pp svneol=native#text/plain compiler/utils/mkx86ins.pp svneol=native#text/plain compiler/utils/mkx86reg.pp svneol=native#text/plain +compiler/utils/mkxtensareg.pp svneol=native#text/pascal compiler/utils/msg2inc.pp svneol=native#text/plain compiler/utils/msgdif.pp svneol=native#text/plain compiler/utils/msgused.pl svneol=native#text/plain @@ -1009,6 +1010,16 @@ compiler/x86_64/x8664nop.inc svneol=native#text/plain compiler/x86_64/x8664op.inc svneol=native#text/plain compiler/x86_64/x8664pro.inc svneol=native#text/plain compiler/x86_64/x8664tab.inc svneol=native#text/plain +compiler/xtensa/rxtensacon.inc svneol=native#text/plain +compiler/xtensa/rxtensadwa.inc svneol=native#text/plain +compiler/xtensa/rxtensanor.inc svneol=native#text/plain +compiler/xtensa/rxtensanum.inc svneol=native#text/plain +compiler/xtensa/rxtensarni.inc svneol=native#text/plain +compiler/xtensa/rxtensasri.inc svneol=native#text/plain +compiler/xtensa/rxtensasta.inc svneol=native#text/plain +compiler/xtensa/rxtensastd.inc svneol=native#text/plain +compiler/xtensa/rxtensasup.inc svneol=native#text/plain +compiler/xtensa/xtensareg.dat svneol=native#text/plain /fpmake.pp svneol=native#text/plain /fpmake_add1.inc svneol=native#text/plain /fpmake_proc1.inc svneol=native#text/plain diff --git a/compiler/utils/mkxtensareg.pp b/compiler/utils/mkxtensareg.pp new file mode 100644 index 0000000000..016a44fb63 --- /dev/null +++ b/compiler/utils/mkxtensareg.pp @@ -0,0 +1,276 @@ +{ + Copyright (c) 1998-2002 by Peter Vreman and Florian Klaempfl + + Convert xtensareg.dat to several .inc files for usage with + the Free pascal compiler + + See the file COPYING.FPC, included in this distribution, + for details about the copyright. + + This program is distributed in the hope that it will be useful, + but WITHOUT ANY WARRANTY; without even the implied warranty of + MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. + + **********************************************************************} +{$mode objfpc} + +program mkxtensareg; + +const Version = '1.00'; + max_regcount = 200; + +var s : string; + i : longint; + line : longint; + regcount:byte; + regcount_bsstart:byte; + names, + regtypes, + subtypes, + supregs, + numbers, + stdnames, + stabs,dwarf : array[0..max_regcount-1] of string[63]; + regnumber_index, + std_regname_index : array[0..max_regcount-1] of byte; + +function tostr(l : longint) : string; + +begin + str(l,tostr); +end; + +function readstr : string; + + begin + result:=''; + while (s[i]<>',') and (i<=length(s)) do + begin + result:=result+s[i]; + inc(i); + end; + end; + + +procedure readcomma; + begin + if s[i]<>',' then + begin + writeln('Missing "," at line ',line); + writeln('Line: "',s,'"'); + halt(1); + end; + inc(i); + end; + + +procedure skipspace; + + begin + while (s[i] in [' ',#9]) do + inc(i); + end; + +procedure openinc(out f:text;const fn:string); +begin + writeln('creating ',fn); + assign(f,fn); + rewrite(f); + writeln(f,'{ don''t edit, this file is generated from xtensareg.dat }'); +end; + + +procedure closeinc(var f:text); +begin + writeln(f); + close(f); +end; + +procedure build_regnum_index; + +var h,i,j,p,t:byte; + +begin + {Build the registernumber2regindex index. + Step 1: Fill.} + for i:=0 to regcount-1 do + regnumber_index[i]:=i; + {Step 2: Sort. We use a Shell-Metzner sort.} + p:=regcount_bsstart; + repeat + for h:=0 to regcount-p-1 do + begin + i:=h; + repeat + j:=i+p; + if numbers[regnumber_index[j]]>=numbers[regnumber_index[i]] then + break; + t:=regnumber_index[i]; + regnumber_index[i]:=regnumber_index[j]; + regnumber_index[j]:=t; + if i

=stdnames[std_regname_index[i]] then + break; + t:=std_regname_index[i]; + std_regname_index[i]:=std_regname_index[j]; + std_regname_index[j]:=t; + if i

'$' then + begin + writeln('Missing $ before number, at line ',line); + writeln('Line: "',s,'"'); + halt(1); + end; + numbers[regcount]:=regtypes[regcount]+copy(subtypes[regcount],2,255)+'00'+copy(supregs[regcount],2,255); + if imax_regcount then + begin + writeln('Error: Too much registers, please increase maxregcount in source'); + halt(2); + end; + end; + close(infile); +end; + +procedure write_inc_files; + +var + norfile,stdfile,supfile, + numfile,stabfile,dwarffile,confile, + rnifile,srifile:text; + first:boolean; + +begin + { create inc files } + openinc(confile,'rxtensacon.inc'); + openinc(supfile,'rxtensasup.inc'); + openinc(numfile,'rxtensanum.inc'); + openinc(stdfile,'rxtensastd.inc'); + openinc(stabfile,'rxtensasta.inc'); + openinc(dwarffile,'rxtensadwa.inc'); + openinc(norfile,'rxtensanor.inc'); + openinc(rnifile,'rxtensarni.inc'); + openinc(srifile,'rxtensasri.inc'); + first:=true; + for i:=0 to regcount-1 do + begin + if not first then + begin + writeln(numfile,','); + writeln(stdfile,','); + writeln(stabfile,','); + writeln(dwarffile,','); + writeln(rnifile,','); + writeln(srifile,','); + end + else + first:=false; + writeln(supfile,'RS_',names[i],' = ',supregs[i],';'); + writeln(confile,'NR_'+names[i],' = ','tregister(',numbers[i],')',';'); + write(numfile,'tregister(',numbers[i],')'); + write(stdfile,'''',stdnames[i],''''); + write(stabfile,stabs[i]); + write(dwarffile,dwarf[i]); + write(rnifile,regnumber_index[i]); + write(srifile,std_regname_index[i]); + end; + write(norfile,regcount); + close(confile); + close(supfile); + closeinc(numfile); + closeinc(stdfile); + closeinc(stabfile); + closeinc(dwarffile); + closeinc(norfile); + closeinc(rnifile); + closeinc(srifile); + writeln('Done!'); + writeln(regcount,' registers processed'); +end; + + +begin + writeln('Register Table Converter Version ',Version); + line:=0; + regcount:=0; + read_spreg_file; + regcount_bsstart:=1; + while 2*regcount_bsstart,,,,,, +; +NO,$00,$00,$00,INVALID,-1,-1 +; Integer registers +A0,$01,$00,$00,a0,0,0 +A1,$01,$00,$01,a1,1,1 +A2,$01,$00,$02,a2,2,2 +A3,$01,$00,$03,a3,3,3 +A4,$01,$00,$04,a4,4,4 +A5,$01,$00,$05,a5,5,5 +A6,$01,$00,$06,a6,6,6 +A7,$01,$00,$07,a7,7,7 +A8,$01,$00,$08,a8,8,8 +A9,$01,$00,$09,a9,9,9 +A10,$01,$00,$0a,a10,10,10 +A11,$01,$00,$0b,a11,11,11 +A12,$01,$00,$0c,a12,12,12 +A13,$01,$00,$0d,a13,13,13 +A14,$01,$00,$0e,a14,14,14 +A15,$01,$00,$0f,a15,15,15 + +; Floating point registers +F0,$01,$00,$00,f0,0,0 +F1,$01,$00,$01,f1,1,1 +F2,$01,$00,$02,f2,2,2 +F3,$01,$00,$03,f3,3,3 +F4,$01,$00,$04,f4,4,4 +F5,$01,$00,$05,f5,5,5 +F6,$01,$00,$06,f6,6,6 +F7,$01,$00,$07,f7,7,7 +F8,$01,$00,$08,f8,8,8 +F9,$01,$00,$09,f9,9,9 +F10,$01,$00,$0f,f10,10,10 +F11,$01,$00,$0b,f11,11,11 +F12,$01,$00,$0c,f12,12,12 +F13,$01,$00,$0d,f13,13,13 +F14,$01,$00,$0e,f14,14,14 +F15,$01,$00,$0f,f15,15,15 + + +