Browse Source

* moved compilerutils

peter 26 years ago
parent
commit
3629bc6001
3 changed files with 16 additions and 506 deletions
  1. 16 9
      compiler/Makefile
  2. 0 218
      compiler/makecfg
  3. 0 279
      compiler/nasmconv.pas

+ 16 - 9
compiler/Makefile

@@ -52,6 +52,10 @@ DEFAULTFPCDIR=..
 
 
 # RTL
 # RTL
 RTL=../rtl
 RTL=../rtl
+UTILS=../utils
+
+# Utils used by compiler development/installation
+COMPILERUTILS=utils
 
 
 # At least set -Sg
 # At least set -Sg
 override LOCALOPT+=-Sg
 override LOCALOPT+=-Sg
@@ -176,7 +180,7 @@ TEMPNAME=ppc$(EXEEXT)
 TEMPNAME1=ppc1$(EXEEXT)
 TEMPNAME1=ppc1$(EXEEXT)
 TEMPNAME2=ppc2$(EXEEXT)
 TEMPNAME2=ppc2$(EXEEXT)
 TEMPNAME3=ppc3$(EXEEXT)
 TEMPNAME3=ppc3$(EXEEXT)
-MAKEDEP=mkdep$(EXEEXT)
+MAKEDEP=ppdep$(EXEEXT)
 MSG2INC=msg2inc$(EXEEXT)
 MSG2INC=msg2inc$(EXEEXT)
 
 
 
 
@@ -234,9 +238,9 @@ distclean: clean
 # Include depencies
 # Include depencies
 #####################################################################
 #####################################################################
 
 
-$(MAKEDEP): $(RTL)/utils/mkdep.pp
-	$(COMPILER) $(RTL)/utils/mkdep.pp
-	$(COPY) $(RTL)/utils/$(MAKEDEP) $(MAKEDEP)
+$(MAKEDEP): $(UTILS)/ppdep.pp
+	$(COMPILER) $(UTILS)/ppdep.pp
+	$(COPY) $(UTILS)/$(MAKEDEP) $(MAKEDEP)
 
 
 dependencies : $(MAKEDEP)
 dependencies : $(MAKEDEP)
 	$(MAKEDEP) pp.pas $(PPOPTDEF) $(LOCALDEF) '-F$$(COMPILER) $$(LOCALOPT)' > depend
 	$(MAKEDEP) pp.pas $(PPOPTDEF) $(LOCALDEF) '-F$$(COMPILER) $$(LOCALOPT)' > depend
@@ -252,8 +256,8 @@ endif
 # Make targets
 # Make targets
 #####################################################################
 #####################################################################
 
 
-$(MSG2INC): $(RTL)/utils/msg2inc.pp
-	$(COMPILER) -FE. $(RTL)/utils/msg2inc.pp
+$(MSG2INC): $(COMPILERUTILS)/msg2inc.pp
+	$(COMPILER) -FE. $(COMPILERUTILS)/msg2inc.pp
 
 
 # The msgtxt.inc only depends on the error?.msg file, not on msg2inc,
 # The msgtxt.inc only depends on the error?.msg file, not on msg2inc,
 # because that one will be new almost everytime
 # because that one will be new almost everytime
@@ -339,8 +343,8 @@ endif
 
 
 installlib: quickinstall
 installlib: quickinstall
 ifdef inlinux
 ifdef inlinux
-	chmod 755 makecfg
-	makecfg $(LIBINSTALLDIR)/samplecfg
+	chmod 755 $(COMPILERUTILS)/makecfg
+	$(COMPILERUTILS)/makecfg $(LIBINSTALLDIR)/samplecfg
 endif
 endif
 	$(MKDIR) $(MSGINSTALLDIR)
 	$(MKDIR) $(MSGINSTALLDIR)
 	$(INSTALL) $(MSGFILES) $(MSGINSTALLDIR)
 	$(INSTALL) $(MSGFILES) $(MSGINSTALLDIR)
@@ -390,7 +394,10 @@ $(M68KEXENAME): $(PASFILES) $(INCFILES)
 
 
 #
 #
 # $Log$
 # $Log$
-# Revision 1.29  1999-05-09 12:45:05  peter
+# Revision 1.30  1999-05-12 16:11:01  peter
+#   * moved compilerutils
+#
+# Revision 1.29  1999/05/09 12:45:05  peter
 #   * better messagefile recompiling
 #   * better messagefile recompiling
 #
 #
 # Revision 1.28  1999/05/09 11:36:32  peter
 # Revision 1.28  1999/05/09 11:36:32  peter

+ 0 - 218
compiler/makecfg

@@ -1,218 +0,0 @@
-#!/bin/sh
-#
-#   $Id$
-#   This file is part of the Free Pascal run time library.
-#   Copyright (c) 1996-98 by Michael van Canneyt and Peter Vreman
-#
-#   Generate a configuration creationfile which will create /etc/ppc386.cfg
-#
-#   Need 1 Arguments:
-#    $1 = filename to create
-#
-if [ $# != 1 ]; then
-  echo 'Usage :'
-  echo 'makecfg filename'
-  echo 'filename   = filename to create'
-  exit 1
-fi
-cat <<EOFCREATE >$1
-#!/bin/sh
-#
-#  Generate Free Pascal configuration file
-#
-if [ \$# != 2 ]; then
-  echo 'Usage :'
-  echo 'samplecfg basepath libgccpath'
-  echo 'basepath   = Path where FPC is installed'
-  echo 'libgccpath = Path to the GCC lib'
-  exit 1
-fi
-if [ -f /etc/ppc386.cfg ] ; then
-  mv /etc/ppc386.cfg /etc/ppc386.orig  >/dev/null 2>&1
-  if [ \$? == 0 ]; then
-    echo Saved old config to /etc/ppc386.orig
-  else
-    echo Could not save old config. Bailing out...
-  fi
-fi
-echo Writing sample configuration file to /etc/ppc386.cfg
-cat <<EOFCFG > /etc/ppc386.cfg
-#
-# Example ppc386.cfg for Free Pascal Compiler Version 0.99.11
-#
-
-# ----------------------
-# Defines (preprocessor)
-# ----------------------
-
-#
-# nested #IFNDEF, #IFDEF, #ENDIF, #ELSE, #DEFINE, #UNDEF are allowed
-#
-# -d is the same as #DEFINE
-# -u is the same as #UNDEF
-#
-
-# When not m68k is defined at the commandline, define i386
-#IFNDEF m68k
-  #DEFINE i386
-#ENDIF
-
-#
-# Some examples (for switches see below, and the -? helppages)
-#
-# Try compiling with the -dRELEASE or -dDEBUG on the commandline
-#
-
-# For a release compile with optimizes and strip debuginfo
-#IFDEF RELEASE
-  -OG2p2
-  -Xs
-  #WRITE Compiling Release Version
-#ENDIF
-
-# For a debug version compile with debuginfo and all codegeneration checks on
-#IFDEF DEBUG
-  -g
-  -Crtoi
-  #WRITE Compiling Debug Version
-#ENDIF
-
-# ----------------
-# Parsing switches
-# ----------------
-
-# All assembler blocks are intel styled by default
-#-Rintel
-
-# All assembler blocks are AT&T styled by default
-#-Ratt
-
-# Semantic checking
-# -S2   switch some Delphi 2 extension on
-# -Sc   supports operators like C (*=,+=,/= and -=)
-# -Sg   allows LABEL and GOTO
-# -Si   support C++ stlyed INLINE
-# -Sm   support macros like C (global)
-# -So   tries to be TP/BP 7.0 compatible
-# -Ss   constructor name must be init (destructor must be done)
-# -St   allows static keyword in objects
-
-# Allow goto, inline, C-operators, C-vars
--Sgic
-
-# ---------------
-# Code generation
-# ---------------
-
-# Uncomment the next line if you always want static/dynamic units by default
-# (can be overruled with -CD, -CS at the commandline)
-#-CS
-#-CD
-
-# Set the default heapsize to 8Mb
-#-Ch8000000
-
-# Set default codegeneration checks (iocheck, overflow, range, stack)
-#-Ci
-#-Co
-#-Cr
-#-Ct
-
-# Optimizer switches
-# -Og        generate smaller code
-# -OG        generate faster code (default)
-# -Or        keep certain variables in registers (still BUGGY!!!)
-# -Ou        enable uncertain optimizations (see docs)
-# -O1        level 1 optimizations (quick optimizations)
-# -O2        level 2 optimizations (-O1 + slower optimizations)
-# -O3        level 3 optimizations (same as -O2u)
-# -Op        target processor
-#     -Op1  set target processor to 386/486
-#     -Op2  set target processor to Pentium/PentiumMMX (tm)
-#     -Op3  set target processor to PPro/PII/c6x86/K6 (tm)
-
-# Optimize always for Size and Pentium
-#-OG2p2
-
-
-# -----------------------
-# Set Filenames and Paths
-# -----------------------
-
-# Slashes are also allowed under dos
-
-# path to the messagefile, not necessary anymore but can be used to override
-# the default language
-#-Fr\$1/msg/errore.msg
-#-Fr\$1/msg/errorn.msg
-
-# path to the gcclib
--Fg\$2
-
-# searchpath for includefiles
-#-Fi/pp/inc;/pp/rtl/inc
-
-# searchpath for units (does the same as -Up)
-# For statically, smartlinked units
-#IFDEF FPC_LINK_STATIC
--Fu\$1/rtl/static
--Fu\$1/units/static
-#ENDIF
-# For Dynamically linked units
-#IFDEF FPC_LINK_DYNAMIC
--Fu\$1/rtl/shared
--Fu\$1/units/shared
-#ENDIF
-# For normal units
--Fu\$1/rtl
--Fu\$1/units
-#-Fu/pp/units;/pp/rtl/dos/go32v2
-#-Fu/usr/lib/ppc/units;/usr/lib/ppc/linuxunits
-
-# searchpath for libraries
-#-Fl/pp/lib
-#-Fl/lib;/usr/lib
-
-
-# -------------
-# Linking
-# -------------
-
-# generate always debugging information for GDB (slows down the compiling
-# process)
-#-g
-
-# always pass an option to the linker
-#-k-s
-
-# Always strip debuginfo from the executable
--Xs
-
-
-# -------------
-# Miscellaneous
-# -------------
-
-# Write always a nice FPC logo ;)
--l
-
-# Verbosity
-# e : Show errors (default)       d : Show debug info
-# w : Show warnings               u : Show used files
-# n : Show notes                  t : Show tried files
-# h : Show hints                  m : Show defined macros
-# i : Show general info           p : Show compiled procedures
-# l : Show linenumbers            c : Show conditionals
-# a : Show everything             0 : Show nothing (except errors)
-
-# Display Info, Warnings, Notes and Hints
--viwnh
-# If you don't want so much verbosity use
-#-vw
-
-#
-# That's all folks
-#
-EOFCFG
-EOFCREATE
-chmod 755 $1

+ 0 - 279
compiler/nasmconv.pas

@@ -1,279 +0,0 @@
-program nasmconv;
-
-var
-   infile,outfile : text;
-   s : string;
-   i : longint;
-
-
-      function Replace(var s:string;const s1,s2:string):boolean;
-      var
-        i  : longint;
-      begin
-        i:=pos(s1,s);
-        if i>0 then
-         begin
-           Delete(s,i,length(s1));
-           Insert(s2,s,i);
-           Replace:=true;
-         end
-        else
-         Replace:=false;
-      end;
-
-
-function formatop(s:string):string;
-   const
-     replaces=19;
-     replacetab : array[1..replaces,1..2] of string[32]=(
-       (':',' or ot_colon'),
-       ('mem8','mem or ot_bits8'),
-       ('mem16','mem or ot_bits16'),
-       ('mem32','mem or ot_bits32'),
-       ('mem64','mem or ot_bits64'),
-       ('mem80','mem or ot_bits80'),
-       ('mem','memory'),
-       ('memory_offs','mem_offs'),
-       ('imm8','imm or ot_bits8'),
-       ('imm16','imm or ot_bits16'),
-       ('imm32','imm or ot_bits32'),
-       ('imm64','imm or ot_bits64'),
-       ('imm80','imm or ot_bits80'),
-       ('imm','immediate'),
-       ('rm8','regmem or ot_bits8'),
-       ('rm16','regmem or ot_bits16'),
-       ('rm32','regmem or ot_bits32'),
-       ('rm64','regmem or ot_bits64'),
-       ('rm80','regmem or ot_bits80')
-     );
-  var
-    i : longint;
-  begin
-    for i:=1to replaces do
-     replace(s,replacetab[i,1],replacetab[i,2]);
-    formatop:=s;
-  end;
-
-
-procedure maybe_newline;
-
-  begin
-     if s[i]=#10 then
-       begin
-          readln(infile,s);
-          i:=1;
-       end;
-     while s[1]=';' do
-       begin
-          readln(infile,s);
-          i:=1;
-       end;
-  end;
-
-function readnumber : longint;
-
-  var
-     base : longint;
-     result : longint;
-
-  begin
-     result:=0;
-     if s[i]='\' then
-       begin
-          base:=8;
-          inc(i);
-          if s[i]='x' then
-            begin
-               base:=16;
-               inc(i);
-            end;
-       end
-     else
-       base:=10;
-     s[i]:=upcase(s[i]);
-     while s[i] in ['0'..'9','A'..'F'] do
-       begin
-          case s[i] of
-             '0'..'9':
-               result:=result*base+ord(s[i])-ord('0');
-
-             'A'..'F':
-               result:=result*base+ord(s[i])-ord('A')+10;
-          end;
-          inc(i);
-       end;
-     readnumber:=result;
-  end;
-
-function tostr(l : longint) : string;
-
-  var
-     hs : string;
-
-  begin
-     str(l,hs);
-     tostr:=hs;
-  end;
-
-function readstr : string;
-
-  var
-     result : string;
-
-  begin
-     result:='';
-     while (s[i] in ['0'..'9','A'..'Z','a'..'z','_']) and (i<=length(s)) do
-       begin
-          result:=result+s[i];
-          inc(i);
-       end;
-     readstr:=result;
-  end;
-
-procedure skipspace;
-
-  begin
-     while (s[i] in [' ',#9]) do
-       inc(i);
-  end;
-
-var
-   hs : string;
-   j : longint;
-   first : boolean;
-   maxinfolen,
-   code : byte;
-   insns : longint;
-   { instruction fields }
-   last,
-   ops    : longint;
-   opcode,
-   codes,
-   flags   : string;
-   optypes : array[1..3] of string;
-begin
-   writeln('Nasm Instruction Table Converter Version 0.99.11');
-   insns:=0;
-   assign(infile,'insns.dat');
-   reset(infile);
-   assign(outfile,'i386tab.inc');
-   rewrite(outfile);
-   writeln(outfile,'(');
-   first:=true;
-   while not(eof(infile)) do
-     begin
-        { handle comment }
-        readln(infile,s);
-        if s[1]=';' then
-          continue;
-        { clear }
-        opcode:='';
-        ops:=0;
-        optypes[1]:='';
-        optypes[2]:='';
-        optypes[3]:='';
-        codes:='';
-        flags:='';
-        { opcode }
-        opcode:='A_';
-        i:=1;
-        while not(s[i] in [' ',#9]) do
-          begin
-            opcode:=opcode+s[i];
-            inc(i);
-          end;
-        skipspace;
-        { ops and optypes }
-        repeat
-          hs:=readstr;
-          if (hs='void') or (hs='ignore') then
-            break;
-          inc(ops);
-          optypes[ops]:=optypes[ops]+'ot_'+formatop(hs);
-          if s[i]=':' then
-            begin
-               inc(i);
-               optypes[ops]:=optypes[ops]+' or ot_'+formatop(readstr);
-            end;
-          while s[i]='|' do
-            begin
-               inc(i);
-               optypes[ops]:=optypes[ops]+' or ot_'+formatop(readstr);
-            end;
-          if s[i]=',' then
-            inc(i)
-          else
-            break;
-        until false;
-        for j:=1 to 3-ops do
-          optypes[3-j+1]:='ot_none';
-        { codes }
-        skipspace;
-        j:=0;
-        last:=0;
-        if s[i] in ['\','0'..'9'] then
-          begin
-             while not(s[i] in [' ',#9]) do
-               begin
-                 code:=readnumber;
-                 { for some codes we want also to change the optypes, but not
-                   if the last byte was a 1 then this byte belongs to a direct
-                   copy }
-                 if last<>1 then
-                  begin
-                    case code of
-                      12,13,14 :
-                        optypes[code-11]:=optypes[code-11]+' or ot_signed';
-                    end;
-                  end;
-                 codes:=codes+'#'+tostr(code);
-                 last:=code;
-                 inc(j);
-               end;
-          end
-        else
-          codes:='#0';
-        if j>maxinfolen then
-         maxinfolen:=j;
-        { flags }
-        skipspace;
-        while not(s[i] in [' ',#9,#13,#10]) and (i<=length(s)) do
-          begin
-             hs:=readstr;
-             if hs='ignore' then
-              begin
-                flags:='0';
-                break;
-              end;
-             if hs<>'ND' then
-              begin
-                if flags<>'' then
-                 flags:=flags+' or ';
-                flags:=flags+'if_'+hs;
-              end;
-             if (s[i]=',') and (i<=length(s)) then
-              inc(i)
-             else
-              break;
-          end;
-      { write instruction }
-        if not(first) then
-          writeln(outfile,',')
-        else
-          first:=false;
-        writeln(outfile,'  (');
-        writeln(outfile,'    opcode  : ',opcode,';');
-        writeln(outfile,'    ops     : ',ops,';');
-        writeln(outfile,'    optypes : (',optypes[1],',',optypes[2],',',optypes[3],');');
-        writeln(outfile,'    code    : ',codes,';');
-        writeln(outfile,'    flags   : ',flags);
-        write(outfile,'  )');
-        maybe_newline;
-        inc(insns);
-     end;
-   writeln(outfile);
-   writeln(outfile,');');
-   close(infile);
-   close(outfile);
-   writeln(insns,' nodes procesed (maxinfolen=',maxinfolen,')');
-end.