浏览代码

* rename swatoperands to swapoperands
+ m68k first compilable version (still needs a lot of testing):
assembler generator, system information , inline
assembler reader.

carl 23 年之前
父节点
当前提交
c68b2dfbee

+ 32 - 150
compiler/Makefile

@@ -1,8 +1,8 @@
 #
 #
-# Don't edit, this file is generated by FPCMake Version 1.1 [2002/08/11]
+# Don't edit, this file is generated by FPCMake Version 1.1 [2002/02/27]
 #
 #
 default: all
 default: all
-MAKEFILETARGETS=linux go32v2 win32 os2 freebsd beos netbsd amiga atari sunos qnx netware openbsd wdosx
+MAKEFILETARGETS=linux go32v2 win32 os2 freebsd beos netbsd amiga atari sunos qnx
 override PATH:=$(subst \,/,$(PATH))
 override PATH:=$(subst \,/,$(PATH))
 ifeq ($(findstring ;,$(PATH)),)
 ifeq ($(findstring ;,$(PATH)),)
 inUnix=1
 inUnix=1
@@ -42,9 +42,6 @@ endif
 ifeq ($(OS_TARGET),netbsd)
 ifeq ($(OS_TARGET),netbsd)
 BSDhier=1
 BSDhier=1
 endif
 endif
-ifeq ($(OS_TARGET),openbsd)
-BSDhier=1
-endif
 ifdef inUnix
 ifdef inUnix
 BATCHEXT=.sh
 BATCHEXT=.sh
 else
 else
@@ -111,7 +108,7 @@ ifndef FPC_VERSION
 FPC_VERSION:=$(shell $(FPC) -iV)
 FPC_VERSION:=$(shell $(FPC) -iV)
 endif
 endif
 export FPC FPC_VERSION
 export FPC FPC_VERSION
-unexport CHECKDEPEND ALLDEPENDENCIES
+unexport CHECKDEPEND ALL_DEPENDENCIES
 ifeq ($(findstring 1.0.,$(FPC_VERSION)),)
 ifeq ($(findstring 1.0.,$(FPC_VERSION)),)
 COMPILERINFO:=$(shell $(FPC) -iSP -iTP -iSO -iTO)
 COMPILERINFO:=$(shell $(FPC) -iSP -iTP -iSO -iTO)
 ifndef CPU_SOURCE
 ifndef CPU_SOURCE
@@ -202,7 +199,7 @@ PACKAGESDIR:=$(wildcard $(FPCDIR) $(FPCDIR)/packages/base $(FPCDIR)/packages/ext
 override PACKAGE_NAME=compiler
 override PACKAGE_NAME=compiler
 override PACKAGE_VERSION=1.1
 override PACKAGE_VERSION=1.1
 unexport FPC_VERSION
 unexport FPC_VERSION
-CYCLETARGETS=i386 powerpc
+CYCLETARGETS=i386 powerpc m68k
 ifdef ALPHA
 ifdef ALPHA
 PPC_TARGET=alpha
 PPC_TARGET=alpha
 endif
 endif
@@ -311,15 +308,9 @@ endif
 ifeq ($(OS_TARGET),netbsd)
 ifeq ($(OS_TARGET),netbsd)
 UNIXINSTALLDIR=1
 UNIXINSTALLDIR=1
 endif
 endif
-ifeq ($(OS_TARGET),openbsd)
-UNIXINSTALLDIR=1
-endif
 ifeq ($(OS_TARGET),sunos)
 ifeq ($(OS_TARGET),sunos)
 UNIXINSTALLDIR=1
 UNIXINSTALLDIR=1
 endif
 endif
-ifeq ($(OS_TARGET),qnx)
-UNIXINSTALLDIR=1
-endif
 else
 else
 ifeq ($(OS_SOURCE),linux)
 ifeq ($(OS_SOURCE),linux)
 UNIXINSTALLDIR=1
 UNIXINSTALLDIR=1
@@ -330,15 +321,9 @@ endif
 ifeq ($(OS_SOURCE),netbsd)
 ifeq ($(OS_SOURCE),netbsd)
 UNIXINSTALLDIR=1
 UNIXINSTALLDIR=1
 endif
 endif
-ifeq ($(OS_SOURCE),openbsd)
-UNIXINSTALLDIR=1
-endif
 ifeq ($(OS_TARGET),sunos)
 ifeq ($(OS_TARGET),sunos)
 UNIXINSTALLDIR=1
 UNIXINSTALLDIR=1
 endif
 endif
-ifeq ($(OS_TARGET),qnx)
-UNIXINSTALLDIR=1
-endif
 endif
 endif
 ifndef INSTALL_PREFIX
 ifndef INSTALL_PREFIX
 ifdef PREFIX
 ifdef PREFIX
@@ -357,9 +342,6 @@ endif
 endif
 endif
 endif
 endif
 export INSTALL_PREFIX
 export INSTALL_PREFIX
-ifdef INSTALL_FPCSUBDIR
-export INSTALL_FPCSUBDIR
-endif
 ifndef DIST_DESTDIR
 ifndef DIST_DESTDIR
 DIST_DESTDIR:=$(BASEDIR)
 DIST_DESTDIR:=$(BASEDIR)
 endif
 endif
@@ -406,27 +388,22 @@ endif
 endif
 endif
 ifndef INSTALL_SOURCEDIR
 ifndef INSTALL_SOURCEDIR
 ifdef UNIXINSTALLDIR
 ifdef UNIXINSTALLDIR
+ifdef INSTALL_FPCPACKAGE
 ifdef BSDhier
 ifdef BSDhier
-SRCPREFIXDIR=share/src
+INSTALL_SOURCEDIR:=$(INSTALL_PREFIX)/share/src/fpc-$(FPC_VERSION)/$(PACKAGE_NAME)
 else
 else
-SRCPREFIXDIR=src
+INSTALL_SOURCEDIR:=$(INSTALL_PREFIX)/src/fpc-$(FPC_VERSION)/$(PACKAGE_NAME)
 endif
 endif
-ifdef INSTALL_FPCPACKAGE
-ifdef INSTALL_FPCSUBDIR
-INSTALL_SOURCEDIR:=$(INSTALL_PREFIX)/$(SRCPREFIXDIR)/fpc-$(FPC_VERSION)/$(INSTALL_FPCSUBDIR)/$(PACKAGE_NAME)
 else
 else
-INSTALL_SOURCEDIR:=$(INSTALL_PREFIX)/$(SRCPREFIXDIR)/fpc-$(FPC_VERSION)/$(PACKAGE_NAME)
-endif
+ifdef BSDhier
+INSTALL_SOURCEDIR:=$(INSTALL_PREFIX)/share/src/$(PACKAGE_NAME)-$(PACKAGE_VERSION)
 else
 else
-INSTALL_SOURCEDIR:=$(INSTALL_PREFIX)/$(SRCPREFIXDIR)/$(PACKAGE_NAME)-$(PACKAGE_VERSION)
+INSTALL_SOURCEDIR:=$(INSTALL_PREFIX)/src/$(PACKAGE_NAME)-$(PACKAGE_VERSION)
+endif
 endif
 endif
 else
 else
 ifdef INSTALL_FPCPACKAGE
 ifdef INSTALL_FPCPACKAGE
-ifdef INSTALL_FPCSUBDIR
-INSTALL_SOURCEDIR:=$(INSTALL_BASEDIR)/source/$(INSTALL_FPCSUBDIR)/$(PACKAGE_NAME)
-else
 INSTALL_SOURCEDIR:=$(INSTALL_BASEDIR)/source/$(PACKAGE_NAME)
 INSTALL_SOURCEDIR:=$(INSTALL_BASEDIR)/source/$(PACKAGE_NAME)
-endif
 else
 else
 INSTALL_SOURCEDIR:=$(INSTALL_BASEDIR)/source
 INSTALL_SOURCEDIR:=$(INSTALL_BASEDIR)/source
 endif
 endif
@@ -434,15 +411,18 @@ endif
 endif
 endif
 ifndef INSTALL_DOCDIR
 ifndef INSTALL_DOCDIR
 ifdef UNIXINSTALLDIR
 ifdef UNIXINSTALLDIR
+ifdef INSTALL_FPCPACKAGE
 ifdef BSDhier
 ifdef BSDhier
-DOCPREFIXDIR=share/doc
+INSTALL_DOCDIR:=$(INSTALL_PREFIX)/share/doc/fpc-$(FPC_VERSION)/$(PACKAGE_NAME)
 else
 else
-DOCPREFIXDIR=doc
+INSTALL_DOCDIR:=$(INSTALL_PREFIX)/doc/fpc-$(FPC_VERSION)/$(PACKAGE_NAME)
 endif
 endif
-ifdef INSTALL_FPCPACKAGE
-INSTALL_DOCDIR:=$(INSTALL_PREFIX)/$(DOCPREFIXDIR)/fpc-$(FPC_VERSION)/$(PACKAGE_NAME)
 else
 else
-INSTALL_DOCDIR:=$(INSTALL_PREFIX)/$(DOCPREFIXDIR)/$(PACKAGE_NAME)-$(PACKAGE_VERSION)
+ifdef BSDhier
+INSTALL_DOCDIR:=$(INSTALL_PREFIX)/share/doc/$(PACKAGE_NAME)-$(PACKAGE_VERSION)
+else
+INSTALL_DOCDIR:=$(INSTALL_PREFIX)/doc/$(PACKAGE_NAME)-$(PACKAGE_VERSION)
+endif
 endif
 endif
 else
 else
 ifdef INSTALL_FPCPACKAGE
 ifdef INSTALL_FPCPACKAGE
@@ -534,12 +514,6 @@ HASSHAREDLIB=1
 FPCMADE=fpcmade.netbsd
 FPCMADE=fpcmade.netbsd
 ZIPSUFFIX=netbsd
 ZIPSUFFIX=netbsd
 endif
 endif
-ifeq ($(OS_TARGET),openbsd)
-EXEEXT=
-HASSHAREDLIB=1
-FPCMADE=fpcmade.openbsd
-ZIPSUFFIX=openbsd
-endif
 ifeq ($(OS_TARGET),win32)
 ifeq ($(OS_TARGET),win32)
 PPUEXT=.ppw
 PPUEXT=.ppw
 OEXT=.ow
 OEXT=.ow
@@ -565,7 +539,7 @@ ECHO=echo
 endif
 endif
 ifeq ($(OS_TARGET),amiga)
 ifeq ($(OS_TARGET),amiga)
 EXEEXT=
 EXEEXT=
-PPUEXT=.ppu
+PPUEXT=.ppa
 ASMEXT=.asm
 ASMEXT=.asm
 OEXT=.o
 OEXT=.o
 SMARTEXT=.sl
 SMARTEXT=.sl
@@ -574,7 +548,7 @@ SHAREDLIBEXT=.library
 FPCMADE=fpcmade.amg
 FPCMADE=fpcmade.amg
 endif
 endif
 ifeq ($(OS_TARGET),atari)
 ifeq ($(OS_TARGET),atari)
-PPUEXT=.ppu
+PPUEXT=.ppt
 ASMEXT=.s
 ASMEXT=.s
 OEXT=.o
 OEXT=.o
 SMARTEXT=.sl
 SMARTEXT=.sl
@@ -612,18 +586,6 @@ EXEEXT=
 FPCMADE=fpcmade.qnx
 FPCMADE=fpcmade.qnx
 ZIPSUFFIX=qnx
 ZIPSUFFIX=qnx
 endif
 endif
-ifeq ($(OS_TARGET),netware)
-STATICLIBPREFIX=
-PPUEXT=.ppn
-OEXT=.on
-ASMEXT=.s
-SMARTEXT=.sl
-STATICLIBEXT=.a
-SHAREDLIBEXT=.nlm
-FPCMADE=fpcmade.nw
-ZIPSUFFIX=nw
-EXEEXT=.nlm
-endif
 ifndef ECHO
 ifndef ECHO
 ECHO:=$(strip $(wildcard $(addsuffix /gecho$(SRCEXEEXT),$(SEARCHPATH))))
 ECHO:=$(strip $(wildcard $(addsuffix /gecho$(SRCEXEEXT),$(SEARCHPATH))))
 ifeq ($(ECHO),)
 ifeq ($(ECHO),)
@@ -879,15 +841,6 @@ endif
 ifeq ($(OS_TARGET),qnx)
 ifeq ($(OS_TARGET),qnx)
 REQUIRE_PACKAGES_RTL=1
 REQUIRE_PACKAGES_RTL=1
 endif
 endif
-ifeq ($(OS_TARGET),netware)
-REQUIRE_PACKAGES_RTL=1
-endif
-ifeq ($(OS_TARGET),openbsd)
-REQUIRE_PACKAGES_RTL=1
-endif
-ifeq ($(OS_TARGET),wdosx)
-REQUIRE_PACKAGES_RTL=1
-endif
 ifdef REQUIRE_PACKAGES_RTL
 ifdef REQUIRE_PACKAGES_RTL
 PACKAGEDIR_RTL:=$(firstword $(subst /Makefile.fpc,,$(strip $(wildcard $(addsuffix /rtl/$(OS_TARGET)/Makefile.fpc,$(PACKAGESDIR))))))
 PACKAGEDIR_RTL:=$(firstword $(subst /Makefile.fpc,,$(strip $(wildcard $(addsuffix /rtl/$(OS_TARGET)/Makefile.fpc,$(PACKAGESDIR))))))
 ifneq ($(PACKAGEDIR_RTL),)
 ifneq ($(PACKAGEDIR_RTL),)
@@ -899,7 +852,7 @@ endif
 ifdef CHECKDEPEND
 ifdef CHECKDEPEND
 $(PACKAGEDIR_RTL)/$(FPCMADE):
 $(PACKAGEDIR_RTL)/$(FPCMADE):
 	$(MAKE) -C $(PACKAGEDIR_RTL) $(FPCMADE)
 	$(MAKE) -C $(PACKAGEDIR_RTL) $(FPCMADE)
-override ALLDEPENDENCIES+=$(PACKAGEDIR_RTL)/$(FPCMADE)
+override ALL_DEPENDENCIES+=$(PACKAGEDIR_RTL)/$(FPCMADE)
 endif
 endif
 else
 else
 PACKAGEDIR_RTL=
 PACKAGEDIR_RTL=
@@ -920,9 +873,6 @@ endif
 ifneq ($(OS_TARGET),$(OS_SOURCE))
 ifneq ($(OS_TARGET),$(OS_SOURCE))
 override FPCOPT+=-T$(OS_TARGET)
 override FPCOPT+=-T$(OS_TARGET)
 endif
 endif
-ifeq ($(OS_SOURCE),openbsd)
-override FPCOPT+=-FD$(NEW_BINUTILS_PATH)
-endif
 ifdef UNITDIR
 ifdef UNITDIR
 override FPCOPT+=$(addprefix -Fu,$(UNITDIR))
 override FPCOPT+=$(addprefix -Fu,$(UNITDIR))
 endif
 endif
@@ -1030,78 +980,12 @@ ifdef TARGET_RSTS
 override RSTFILES=$(addsuffix $(RSTEXT),$(TARGET_RSTS))
 override RSTFILES=$(addsuffix $(RSTEXT),$(TARGET_RSTS))
 override CLEANRSTFILES+=$(RSTFILES)
 override CLEANRSTFILES+=$(RSTFILES)
 endif
 endif
-.PHONY: fpc_install fpc_sourceinstall fpc_exampleinstall
-ifdef INSTALL_UNITS
-override INSTALLPPUFILES+=$(addsuffix $(PPUEXT),$(INSTALL_UNITS))
-endif
-ifdef INSTALL_BUILDUNIT
-override INSTALLPPUFILES:=$(filter-out $(INSTALL_BUILDUNIT)$(PPUEXT),$(INSTALLPPUFILES))
-endif
-ifdef INSTALLPPUFILES
-override INSTALLPPULINKFILES:=$(subst $(PPUEXT),$(OEXT),$(INSTALLPPUFILES)) $(addprefix $(STATICLIBPREFIX),$(subst $(PPUEXT),$(STATICLIBEXT),$(INSTALLPPUFILES)))
-override INSTALLPPUFILES:=$(addprefix $(UNITTARGETDIRPREFIX),$(INSTALLPPUFILES))
-override INSTALLPPULINKFILES:=$(wildcard $(addprefix $(UNITTARGETDIRPREFIX),$(INSTALLPPULINKFILES)))
-override INSTALL_CREATEPACKAGEFPC=1
-endif
-ifdef INSTALLEXEFILES
-override INSTALLEXEFILES:=$(addprefix $(TARGETDIRPREFIX),$(INSTALLEXEFILES))
-endif
-fpc_install: all $(INSTALLTARGET)
-ifdef INSTALLEXEFILES
-	$(MKDIR) $(INSTALL_BINDIR)
-ifdef UPXPROG
-	-$(UPXPROG) $(INSTALLEXEFILES)
-endif
-	$(INSTALLEXE) $(INSTALLEXEFILES) $(INSTALL_BINDIR)
-endif
-ifdef INSTALL_CREATEPACKAGEFPC
-ifdef FPCMAKE
-ifdef PACKAGE_VERSION
-ifneq ($(wildcard Makefile.fpc),)
-	$(FPCMAKE) -p -T$(OS_TARGET) Makefile.fpc
-	$(MKDIR) $(INSTALL_UNITDIR)
-	$(INSTALL) Package.fpc $(INSTALL_UNITDIR)
-endif
-endif
-endif
-endif
-ifdef INSTALLPPUFILES
-	$(MKDIR) $(INSTALL_UNITDIR)
-	$(INSTALL) $(INSTALLPPUFILES) $(INSTALL_UNITDIR)
-ifneq ($(INSTALLPPULINKFILES),)
-	$(INSTALL) $(INSTALLPPULINKFILES) $(INSTALL_UNITDIR)
-endif
-ifneq ($(wildcard $(LIB_FULLNAME)),)
-	$(MKDIR) $(INSTALL_LIBDIR)
-	$(INSTALL) $(LIB_FULLNAME) $(INSTALL_LIBDIR)
-ifdef inUnix
-	ln -sf $(LIB_FULLNAME) $(INSTALL_LIBDIR)/$(LIB_NAME)
-endif
-endif
-endif
-ifdef INSTALL_FILES
-	$(MKDIR) $(INSTALL_DATADIR)
-	$(INSTALL) $(INSTALL_FILES) $(INSTALL_DATADIR)
-endif
-fpc_sourceinstall: distclean
-	$(MKDIR) $(INSTALL_SOURCEDIR)
-	$(COPYTREE) $(BASEDIR)/* $(INSTALL_SOURCEDIR)
-fpc_exampleinstall: $(addsuffix _distclean,$(TARGET_EXAMPLEDIRS))
-ifdef HASEXAMPLES
-	$(MKDIR) $(INSTALL_EXAMPLEDIR)
-endif
-ifdef EXAMPLESOURCEFILES
-	$(COPY) $(EXAMPLESOURCEFILES) $(INSTALL_EXAMPLEDIR)
-endif
-ifdef TARGET_EXAMPLEDIRS
-	$(COPYTREE) $(addsuffix /*,$(TARGET_EXAMPLEDIRS)) $(INSTALL_EXAMPLEDIR)
-endif
 .PHONY: fpc_distinstall
 .PHONY: fpc_distinstall
 fpc_distinstall: install exampleinstall
 fpc_distinstall: install exampleinstall
 .PHONY: fpc_zipinstall fpc_zipsourceinstall fpc_zipexampleinstall
 .PHONY: fpc_zipinstall fpc_zipsourceinstall fpc_zipexampleinstall
 ifndef PACKDIR
 ifndef PACKDIR
 ifndef inUnix
 ifndef inUnix
-PACKDIR=$(BASEDIR)/../fpc-pack
+PACKDIR=$(BASEDIR)/fpc-pack
 else
 else
 PACKDIR=/tmp/fpc-pack
 PACKDIR=/tmp/fpc-pack
 endif
 endif
@@ -1389,8 +1273,8 @@ smart: $(addsuffix _smart,$(TARGET_DIRS))
 release: $(addsuffix _release,$(TARGET_DIRS))
 release: $(addsuffix _release,$(TARGET_DIRS))
 examples: $(addsuffix _examples,$(TARGET_DIRS))
 examples: $(addsuffix _examples,$(TARGET_DIRS))
 shared: $(addsuffix _shared,$(TARGET_DIRS))
 shared: $(addsuffix _shared,$(TARGET_DIRS))
-sourceinstall: fpc_sourceinstall
-exampleinstall: fpc_exampleinstall $(addsuffix _exampleinstall,$(TARGET_DIRS))
+sourceinstall:
+exampleinstall: $(addsuffix _exampleinstall,$(TARGET_DIRS))
 distinstall: fpc_distinstall
 distinstall: fpc_distinstall
 zipinstall: fpc_zipinstall
 zipinstall: fpc_zipinstall
 zipsourceinstall: fpc_zipsourceinstall
 zipsourceinstall: fpc_zipsourceinstall
@@ -1431,13 +1315,13 @@ MAKEDEP=ppdep$(EXEEXT)
 MSG2INC=./msg2inc$(EXEEXT)
 MSG2INC=./msg2inc$(EXEEXT)
 .PHONY: alpha i386 m68k powerpc
 .PHONY: alpha i386 m68k powerpc
 alpha:
 alpha:
-	$(MAKE) PPC_TARGET=alpha CPU_UNITDIR=alpha exeonly
+	$(MAKE) PPC_TARGET=alpha CPU_UNITDIR=alpha all
 i386:
 i386:
-	$(MAKE) PPC_TARGET=i386 CPU_UNITDIR=i386 exeonly
+	$(MAKE) PPC_TARGET=i386 CPU_UNITDIR=i386 all
 m68k:
 m68k:
-	$(MAKE) PPC_TARGET=m68k CPU_UNITDIR=m68k exeonly
+	$(MAKE) PPC_TARGET=m68k CPU_UNITDIR=m68k all
 powerpc:
 powerpc:
-	$(MAKE) PPC_TARGET=powerpc CPU_UNITDIR=powerpc exeonly
+	$(MAKE) PPC_TARGET=powerpc CPU_UNITDIR=powerpc all
 .PHONY: all compiler echotime ppuclean execlean clean distclean
 .PHONY: all compiler echotime ppuclean execlean clean distclean
 all: $(EXENAME) $(addsuffix _all,$(TARGET_DIRS))
 all: $(EXENAME) $(addsuffix _all,$(TARGET_DIRS))
 compiler: $(EXENAME)
 compiler: $(EXENAME)
@@ -1476,21 +1360,19 @@ dependencies : $(MAKEDEP)
 ifdef USEDEPEND
 ifdef USEDEPEND
 include depend
 include depend
 endif
 endif
-.PHONY: exeonly msg
 $(MSG2INC): $(COMPILERUTILSDIR)/msg2inc.pp
 $(MSG2INC): $(COMPILERUTILSDIR)/msg2inc.pp
 	$(COMPILER) -FE. $(COMPILERUTILSDIR)/msg2inc.pp
 	$(COMPILER) -FE. $(COMPILERUTILSDIR)/msg2inc.pp
 msgtxt.inc: $(MSGFILE)
 msgtxt.inc: $(MSGFILE)
 	$(MAKE) $(MSG2INC)
 	$(MAKE) $(MSG2INC)
 	$(MSG2INC) $(MSGFILE) msg msg
 	$(MSG2INC) $(MSGFILE) msg msg
 msg: msgtxt.inc
 msg: msgtxt.inc
-exeonly: $(EXENAME)
 ifndef COMPLETE
 ifndef COMPLETE
 $(EXENAME) : $(wildcard *.pas) $(wildcard *.inc) msg \
 $(EXENAME) : $(wildcard *.pas) $(wildcard *.inc) msg \
 	     $(wildcard targets/*.pas) $(wilcard targets/*.inc) \
 	     $(wildcard targets/*.pas) $(wilcard targets/*.inc) \
 	     $(wildcard $(PPC_TARGET)/*.pas) $(wildcard $(PPC_TARGET)/*.inc)
 	     $(wildcard $(PPC_TARGET)/*.pas) $(wildcard $(PPC_TARGET)/*.inc)
 	$(COMPILER) pp.pas
 	$(COMPILER) pp.pas
 	$(EXECPPAS)
 	$(EXECPPAS)
-	$(MOVE) $(COMPILER_TARGETDIR)/$(PPEXENAME) $(EXENAME)
+	$(MOVE) $(COMPILER_TARGETDIR)/$(PPEXENAME) $(COMPILER_TARGETDIR)/$(EXENAME)
 else
 else
 $(EXENAME) : $(wildcard *.pas) $(wildcard *.inc) msg \
 $(EXENAME) : $(wildcard *.pas) $(wildcard *.inc) msg \
 	     $(wildcard targets/*.pas) $(wilcard targets/*.inc) \
 	     $(wildcard targets/*.pas) $(wilcard targets/*.inc) \
@@ -1501,7 +1383,7 @@ $(EXENAME) : $(wildcard *.pas) $(wildcard *.inc) msg \
 	$(EXECPPAS)
 	$(EXECPPAS)
 	$(COMPILER) pp.pas
 	$(COMPILER) pp.pas
 	$(EXECPPAS)
 	$(EXECPPAS)
-	$(MOVE) $(COMPILER_TARGETDIR)/$(PPEXENAME) $(EXENAME)
+	$(MOVE) $(PPEXENAME) $(EXENAME)
 endif
 endif
 tokens.dat : $(wildcard *.pas) $(wildcard *.inc)
 tokens.dat : $(wildcard *.pas) $(wildcard *.inc)
 	$(COMPILER) tokendat.pas
 	$(COMPILER) tokendat.pas
@@ -1574,7 +1456,7 @@ full: fullcycle
 fullcycle:
 fullcycle:
 	$(MAKE) cycle
 	$(MAKE) cycle
 	$(MAKE) ppuclean
 	$(MAKE) ppuclean
-	$(MAKE) $(filter-out $(PPC_TARGET),$(CYCLETARGETS)) 'FPC=$(BASEDIR)/$(EXENAME)'
+	$(MAKE) $(CYCLETARGETS) 'FPC=$(BASEDIR)/$(EXENAME)'
 htmldocs:
 htmldocs:
 	$(PASDOC) -p -h -o html$(PATHSEP)$(PPC_TARGET) -d fpc -d gdb -d $(PPC_TARGET) -u $(PPC_TARGET) $(PPC_TARGET)$(PATHSEP)*.pas targets$(PATHSEP)*.pas *.pas
 	$(PASDOC) -p -h -o html$(PATHSEP)$(PPC_TARGET) -d fpc -d gdb -d $(PPC_TARGET) -u $(PPC_TARGET) $(PPC_TARGET)$(PATHSEP)*.pas targets$(PATHSEP)*.pas *.pas
 .PHONY: quickinstall install installsym
 .PHONY: quickinstall install installsym

+ 1 - 1
compiler/Makefile.fpc

@@ -30,7 +30,7 @@ fpcdir=..
 unexport FPC_VERSION
 unexport FPC_VERSION
 
 
 # Which platforms are ready for inclusion in the cycle
 # Which platforms are ready for inclusion in the cycle
-CYCLETARGETS=i386 powerpc
+CYCLETARGETS=i386 powerpc m68k
 
 
 # Allow ALPHA, POWERPC, M68K, I386 defines for target cpu
 # Allow ALPHA, POWERPC, M68K, I386 defines for target cpu
 ifdef ALPHA
 ifdef ALPHA

+ 10 - 4
compiler/i386/aasmcpu.pas

@@ -192,7 +192,7 @@ interface
          function  calcsize(p:PInsEntry):longint;
          function  calcsize(p:PInsEntry):longint;
          procedure gencode(sec:TAsmObjectData);
          procedure gencode(sec:TAsmObjectData);
          function  NeedAddrPrefix(opidx:byte):boolean;
          function  NeedAddrPrefix(opidx:byte):boolean;
-         procedure Swatoperands;
+         procedure Swapoperands;
     {$endif NOAG386BIN}
     {$endif NOAG386BIN}
       end;
       end;
 
 
@@ -649,7 +649,7 @@ implementation
       end;
       end;
 
 
 
 
-    procedure taicpu.Swatoperands;
+    procedure taicpu.Swapoperands;
       var
       var
         p : TOper;
         p : TOper;
       begin
       begin
@@ -675,7 +675,7 @@ implementation
       begin
       begin
         if FOperandOrder<>order then
         if FOperandOrder<>order then
          begin
          begin
-           Swatoperands;
+           Swapoperands;
            FOperandOrder:=order;
            FOperandOrder:=order;
          end;
          end;
       end;
       end;
@@ -1796,7 +1796,13 @@ implementation
 end.
 end.
 {
 {
   $Log$
   $Log$
-  Revision 1.2  2002-07-20 11:57:59  florian
+  Revision 1.3  2002-08-13 18:01:52  carl
+    * rename swatoperands to swapoperands
+    + m68k first compilable version (still needs a lot of testing):
+        assembler generator, system information , inline
+        assembler reader.
+
+  Revision 1.2  2002/07/20 11:57:59  florian
     * types.pas renamed to defbase.pas because D6 contains a types
     * types.pas renamed to defbase.pas because D6 contains a types
       unit so this would conflicts if D6 programms are compiled
       unit so this would conflicts if D6 programms are compiled
     + Willamette/SSE2 instructions to assembler added
     + Willamette/SSE2 instructions to assembler added

+ 8 - 2
compiler/i386/ra386att.pas

@@ -1620,7 +1620,7 @@ procedure T386AttInstruction.InitOperands;
 var
 var
   i : longint;
   i : longint;
 begin
 begin
-  for i:=1to 3 do
+  for i:=1to max_operands do
    Operands[i]:=T386AttOperand.Create;
    Operands[i]:=T386AttOperand.Create;
 end;
 end;
 
 
@@ -2129,7 +2129,13 @@ finalization
 end.
 end.
 {
 {
   $Log$
   $Log$
-  Revision 1.29  2002-08-12 15:08:42  carl
+  Revision 1.30  2002-08-13 18:01:52  carl
+    * rename swatoperands to swapoperands
+    + m68k first compilable version (still needs a lot of testing):
+        assembler generator, system information , inline
+        assembler reader.
+
+  Revision 1.29  2002/08/12 15:08:42  carl
     + stab register indexes for powerpc (moved from gdb to cpubase)
     + stab register indexes for powerpc (moved from gdb to cpubase)
     + tprocessor enumeration moved to cpuinfo
     + tprocessor enumeration moved to cpuinfo
     + linker in target_info is now a class
     + linker in target_info is now a class

+ 8 - 2
compiler/i386/ra386int.pas

@@ -1902,7 +1902,7 @@ Begin
           instr:=T386IntelInstruction.Create;
           instr:=T386IntelInstruction.Create;
           instr.BuildOpcode;
           instr.BuildOpcode;
           { We need AT&T style operands }
           { We need AT&T style operands }
-          instr.Swatoperands;
+          instr.Swapoperands;
           { Must be done with args in ATT order }
           { Must be done with args in ATT order }
           instr.CheckNonCommutativeOpcodes;
           instr.CheckNonCommutativeOpcodes;
           instr.AddReferenceSizes;
           instr.AddReferenceSizes;
@@ -1959,7 +1959,13 @@ finalization
 end.
 end.
 {
 {
   $Log$
   $Log$
-  Revision 1.31  2002-08-11 14:32:31  peter
+  Revision 1.32  2002-08-13 18:01:52  carl
+    * rename swatoperands to swapoperands
+    + m68k first compilable version (still needs a lot of testing):
+        assembler generator, system information , inline
+        assembler reader.
+
+  Revision 1.31  2002/08/11 14:32:31  peter
     * renamed current_library to objectlibrary
     * renamed current_library to objectlibrary
 
 
   Revision 1.30  2002/08/11 13:24:17  peter
   Revision 1.30  2002/08/11 13:24:17  peter

+ 8 - 2
compiler/i_amiga.pas

@@ -58,7 +58,7 @@ unit i_amiga;
             newline      : #10;
             newline      : #10;
             dirsep       : '/';
             dirsep       : '/';
             files_case_relevent : true;
             files_case_relevent : true;
-            assem        : as_none;
+            assem        : as_gas;
             assemextern  : as_gas;
             assemextern  : as_gas;
             link         : nil;
             link         : nil;
             linkextern   : nil;
             linkextern   : nil;
@@ -85,7 +85,13 @@ initialization
 end.
 end.
 {
 {
   $Log$
   $Log$
-  Revision 1.2  2002-08-12 15:08:39  carl
+  Revision 1.3  2002-08-13 18:01:51  carl
+    * rename swatoperands to swapoperands
+    + m68k first compilable version (still needs a lot of testing):
+        assembler generator, system information , inline
+        assembler reader.
+
+  Revision 1.2  2002/08/12 15:08:39  carl
     + stab register indexes for powerpc (moved from gdb to cpubase)
     + stab register indexes for powerpc (moved from gdb to cpubase)
     + tprocessor enumeration moved to cpuinfo
     + tprocessor enumeration moved to cpuinfo
     + linker in target_info is now a class
     + linker in target_info is now a class

+ 8 - 2
compiler/i_atari.pas

@@ -58,7 +58,7 @@ unit i_atari;
             newline      : #10;
             newline      : #10;
             dirsep       : '/';
             dirsep       : '/';
             files_case_relevent : true;
             files_case_relevent : true;
-            assem        : as_none;
+            assem        : as_gas;
             assemextern  : as_gas;
             assemextern  : as_gas;
             link         : ld_m68k_atari;
             link         : ld_m68k_atari;
             linkextern   : ld_m68k_atari;
             linkextern   : ld_m68k_atari;
@@ -85,7 +85,13 @@ initialization
 end.
 end.
 {
 {
   $Log$
   $Log$
-  Revision 1.2  2002-08-12 15:08:39  carl
+  Revision 1.3  2002-08-13 18:01:51  carl
+    * rename swatoperands to swapoperands
+    + m68k first compilable version (still needs a lot of testing):
+        assembler generator, system information , inline
+        assembler reader.
+
+  Revision 1.2  2002/08/12 15:08:39  carl
     + stab register indexes for powerpc (moved from gdb to cpubase)
     + stab register indexes for powerpc (moved from gdb to cpubase)
     + tprocessor enumeration moved to cpuinfo
     + tprocessor enumeration moved to cpuinfo
     + linker in target_info is now a class
     + linker in target_info is now a class

+ 8 - 2
compiler/i_fbsd.pas

@@ -189,7 +189,7 @@ unit i_fbsd;
             newline      : #10;
             newline      : #10;
             dirsep       : '/';
             dirsep       : '/';
             files_case_relevent : true;
             files_case_relevent : true;
-            assem        : as_none;
+            assem        : as_gas;
             assemextern  : as_gas;
             assemextern  : as_gas;
             link         : nil;
             link         : nil;
             linkextern   : nil;
             linkextern   : nil;
@@ -239,7 +239,13 @@ initialization
 end.
 end.
 {
 {
   $Log$
   $Log$
-  Revision 1.2  2002-08-12 15:08:39  carl
+  Revision 1.3  2002-08-13 18:01:51  carl
+    * rename swatoperands to swapoperands
+    + m68k first compilable version (still needs a lot of testing):
+        assembler generator, system information , inline
+        assembler reader.
+
+  Revision 1.2  2002/08/12 15:08:39  carl
     + stab register indexes for powerpc (moved from gdb to cpubase)
     + stab register indexes for powerpc (moved from gdb to cpubase)
     + tprocessor enumeration moved to cpuinfo
     + tprocessor enumeration moved to cpuinfo
     + linker in target_info is now a class
     + linker in target_info is now a class

+ 10 - 4
compiler/i_linux.pas

@@ -125,7 +125,7 @@ unit i_linux;
             newline      : #10;
             newline      : #10;
             dirsep       : '/';
             dirsep       : '/';
             files_case_relevent : true;
             files_case_relevent : true;
-            assem        : as_none;
+            assem        : as_gas;
             assemextern  : as_gas;
             assemextern  : as_gas;
             link         : nil;
             link         : nil;
             linkextern   : nil;
             linkextern   : nil;
@@ -253,7 +253,7 @@ unit i_linux;
             newline      : #10;
             newline      : #10;
             dirsep       : '/';
             dirsep       : '/';
             files_case_relevent : true;
             files_case_relevent : true;
-            assem        : as_none;
+            assem        : as_gas;
             assemextern  : as_gas;
             assemextern  : as_gas;
             link         : nil;
             link         : nil;
             linkextern   : nil;
             linkextern   : nil;
@@ -381,7 +381,7 @@ unit i_linux;
             newline      : #10;
             newline      : #10;
             dirsep       : '/';
             dirsep       : '/';
             files_case_relevent : true;
             files_case_relevent : true;
-            assem        : as_none;
+            assem        : as_gas;
             assemextern  : as_gas;
             assemextern  : as_gas;
             link         : nil;
             link         : nil;
             linkextern   : nil;
             linkextern   : nil;
@@ -446,7 +446,13 @@ initialization
 end.
 end.
 {
 {
   $Log$
   $Log$
-  Revision 1.2  2002-08-12 15:08:39  carl
+  Revision 1.3  2002-08-13 18:01:51  carl
+    * rename swatoperands to swapoperands
+    + m68k first compilable version (still needs a lot of testing):
+        assembler generator, system information , inline
+        assembler reader.
+
+  Revision 1.2  2002/08/12 15:08:39  carl
     + stab register indexes for powerpc (moved from gdb to cpubase)
     + stab register indexes for powerpc (moved from gdb to cpubase)
     + tprocessor enumeration moved to cpuinfo
     + tprocessor enumeration moved to cpuinfo
     + linker in target_info is now a class
     + linker in target_info is now a class

+ 8 - 2
compiler/i_palmos.pas

@@ -58,7 +58,7 @@ unit i_palmos;
             newline      : #10;
             newline      : #10;
             dirsep       : '/';
             dirsep       : '/';
             files_case_relevent : true;
             files_case_relevent : true;
-            assem        : as_none;
+            assem        : as_gas;
             assemextern  : as_gas;
             assemextern  : as_gas;
             link         : ld_m68k_palmos;
             link         : ld_m68k_palmos;
             linkextern   : ld_m68k_palmos;
             linkextern   : ld_m68k_palmos;
@@ -85,7 +85,13 @@ initialization
 end.
 end.
 {
 {
   $Log$
   $Log$
-  Revision 1.2  2002-08-12 15:08:39  carl
+  Revision 1.3  2002-08-13 18:01:51  carl
+    * rename swatoperands to swapoperands
+    + m68k first compilable version (still needs a lot of testing):
+        assembler generator, system information , inline
+        assembler reader.
+
+  Revision 1.2  2002/08/12 15:08:39  carl
     + stab register indexes for powerpc (moved from gdb to cpubase)
     + stab register indexes for powerpc (moved from gdb to cpubase)
     + tprocessor enumeration moved to cpuinfo
     + tprocessor enumeration moved to cpuinfo
     + linker in target_info is now a class
     + linker in target_info is now a class

+ 38 - 6
compiler/m68k/aasmcpu.pas

@@ -71,9 +71,11 @@ type
 
 
      constructor op_sym(op : tasmop;_size : topsize;_op1 : tasmsymbol);
      constructor op_sym(op : tasmop;_size : topsize;_op1 : tasmsymbol);
      { for DBxx opcodes }
      { for DBxx opcodes }
-     constructor op_sym_reg(op: tasmop; _size : topsize; _op1 :tasmsymbol; _op2: tregister);
+     constructor op_reg_sym(op: tasmop; _size : topsize; _op1: tregister; _op2 :tasmsymbol);
      constructor op_sym_ofs_reg(op : tasmop;_size : topsize;_op1 : tasmsymbol;_op1ofs:longint;_op2 : tregister);
      constructor op_sym_ofs_reg(op : tasmop;_size : topsize;_op1 : tasmsymbol;_op1ofs:longint;_op2 : tregister);
-
+     
+     constructor op_sym_ofs(op : tasmop;_size : topsize;_op1 : tasmsymbol;_op1ofs:longint);
+     constructor op_sym_ofs_ref(op : tasmop;_size : topsize;_op1 : tasmsymbol;_op1ofs:longint;const _op2 : treference);
 
 
   private
   private
      procedure loadreglist(opidx:longint;r:tregisterlist);
      procedure loadreglist(opidx:longint;r:tregisterlist);
@@ -81,6 +83,12 @@ type
   end;
   end;
 
 
 
 
+  tai_align = class(tai_align_abstract)
+        { nothing to add }
+  end;
+  
+  procedure InitAsm;
+  procedure DoneAsm;
 
 
 
 
 implementation
 implementation
@@ -331,16 +339,34 @@ implementation
       end;
       end;
 
 
 
 
-     constructor taicpu.op_sym_reg(op: tasmop; _size : topsize; _op1 :tasmsymbol; _op2: tregister);
+     constructor taicpu.op_reg_sym(op: tasmop; _size : topsize; _op1: tregister; _op2 :tasmsymbol);
       begin
       begin
          inherited create(op);
          inherited create(op);
          init(_size);
          init(_size);
          ops:=2;
          ops:=2;
-         loadsymbol(0,_op1,0);
-         loadreg(1,_op2);
+         loadreg(0,_op1);
+         loadsymbol(1,_op2,0);
+      end;
+
+
+    constructor taicpu.op_sym_ofs_ref(op : tasmop;_size : topsize;_op1 : tasmsymbol;_op1ofs:longint;const _op2 : treference);
+      begin
+         inherited create(op);
+         init(_size);
+         ops:=2;
+         loadsymbol(0,_op1,_op1ofs);
+         loadref(1,_op2);
       end;
       end;
 
 
 
 
+    constructor taicpu.op_sym_ofs(op : tasmop;_size : topsize;_op1 : tasmsymbol;_op1ofs:longint);
+      begin
+         inherited create(op);
+         init(_size);
+         ops:=1;
+         loadsymbol(0,_op1,_op1ofs);
+      end;
+
     constructor taicpu.op_sym_ofs_reg(op : tasmop;_size : topsize;_op1 : tasmsymbol;_op1ofs:longint;_op2 : tregister);
     constructor taicpu.op_sym_ofs_reg(op : tasmop;_size : topsize;_op1 : tasmsymbol;_op1ofs:longint;_op2 : tregister);
       begin
       begin
          inherited create(op);;
          inherited create(op);;
@@ -383,7 +409,13 @@ implementation
 end.
 end.
 {
 {
   $Log$
   $Log$
-  Revision 1.2  2002-08-12 15:08:43  carl
+  Revision 1.3  2002-08-13 18:01:52  carl
+    * rename swatoperands to swapoperands
+    + m68k first compilable version (still needs a lot of testing):
+        assembler generator, system information , inline
+        assembler reader.
+
+  Revision 1.2  2002/08/12 15:08:43  carl
     + stab register indexes for powerpc (moved from gdb to cpubase)
     + stab register indexes for powerpc (moved from gdb to cpubase)
     + tprocessor enumeration moved to cpuinfo
     + tprocessor enumeration moved to cpuinfo
     + linker in target_info is now a class
     + linker in target_info is now a class

+ 426 - 0
compiler/m68k/agcpugas.pas

@@ -0,0 +1,426 @@
+{
+    $Id$
+    Copyright (c) 1998-2002 by Florian Klaempfl
+
+    This unit implements an asmoutput class for m68k GAS syntax
+
+    This program is free software; you can redistribute it and/or modify
+    it under the terms of the GNU General Public License as published by
+    the Free Software Foundation; either version 2 of the License, or
+    (at your option) any later version.
+
+    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.  See the
+    GNU General Public License for more details.
+
+    You should have received a copy of the GNU General Public License
+    along with this program; if not, write to the Free Software
+    Foundation, Inc., 675 Mass Ave, Cambridge, MA 02139, USA.
+
+ ****************************************************************************
+}
+{ This unit implements an asmoutput class for i386 AT&T syntax
+}
+unit agcpugas;
+
+{$i fpcdefs.inc}
+
+interface
+
+    uses
+      cclasses,cpubase,
+      globals,
+      aasmbase,aasmtai,aasmcpu,assemble,aggas;
+
+    type
+      TM68kAssembler=class(TGNUassembler)
+      public
+        procedure WriteInstruction(hp: tai);override;
+      end;
+
+    const
+      gas_op2str:op2strtable=
+       { 68000 only instructions }
+       ('abcd','add', 'adda','addi','addq','addx','and','andi',
+       'asl','asr','bcc','bcs','beq','bge','bgt','bhi',
+       'ble','bls','blt','bmi','bne','bpl','bvc','bvs',
+       'bchg','bclr','bra','bset','bsr','btst','chk',
+       'clr','cmp','cmpa','cmpi','cmpm','dbcc','dbcs','dbeq','dbge',
+       'dbgt','dbhi','dble','dbls','dblt','dbmi','dbne','dbra',
+       'dbpl','dbt','dbvc','dbvs','dbf','divs','divu',
+       'eor','eori','exg','illegal','ext','jmp','jsr',
+       'lea','link','lsl','lsr','move','movea','movei','moveq',
+       'movem','movep','muls','mulu','nbcd','neg','negx',
+       'nop','not','or','ori','pea','rol','ror','roxl',
+       'roxr','rtr','rts','sbcd','scc','scs','seq','sge',
+       'sgt','shi','sle','sls','slt','smi','sne',
+       'spl','st','svc','svs','sf','sub','suba','subi','subq',
+       'subx','swap','tas','trap','trapv','tst','unlk',
+       'rte','reset','stop',
+       { MC68010 instructions }
+       'bkpt','movec','moves','rtd',
+       { MC68020 instructions }
+       'bfchg','bfclr','bfexts','bfextu','bfffo',
+       'bfins','bfset','bftst','callm','cas','cas2',
+       'chk2','cmp2','divsl','divul','extb','pack','rtm',
+       'trapcc','tracs','trapeq','trapf','trapge','trapgt',
+       'traphi','traple','trapls','traplt','trapmi','trapne',
+       'trappl','trapt','trapvc','trapvs','unpk',
+       { FPU Processor instructions - directly supported only. }
+       { IEEE aware and misc. condition codes not supported   }
+       'fabs','fadd',
+       'fbeq','fbne','fbngt','fbgt','fbge','fbnge',
+       'fblt','fbnlt','fble','fbgl','fbngl','fbgle','fbngle',
+       'fdbeq','fdbne','fdbgt','fdbngt','fdbge','fdnbge',
+       'fdblt','fdbnlt','fdble','fdbgl','fdbngl','fdbgle','fbdngle',
+       'fseq','fsne','fsgt','fsngt','fsge','fsnge',
+       'fslt','fsnlt','fsle','fsgl','fsngl','fsgle','fsngle',
+       'fcmp','fdiv','fmove','fmovem',
+       'fmul','fneg','fnop','fsqrt','fsub','fsgldiv',
+       'fsflmul','ftst',
+       'fint','fintrz',
+       'ftrapeq','ftrapne','ftrapgt','ftrapngt','ftrapge','ftrapnge',
+       'ftraplt','ftrapnlt','ftraple','ftrapgl','ftrapngl','ftrapgle',
+       'ftrapngle',
+       { Useful for assembly langage output }
+       { Protected instructions }
+       'cprestore','cpsave',
+       { FPU Unit protected instructions                    }
+       { and 68030/68851 common MMU instructions            }
+       { (this may include 68040 MMU instructions)          }
+       'frestore','fsave','pflush','pflusha','pload','pmove','ptest',
+       { Useful for assembly langage output }
+       '','','','');
+
+     gas_opsize2str : array[topsize] of string[2] = 
+     ('','.b','.w','.l','.s','.d','.x',''
+     );
+     
+     gas_reg2str : reg2strtable =
+      ('', '%d0','%d1','%d2','%d3','%d4','%d5','%d6','%d7',
+       '%a0','%a1','%a2','%a3','%a4','%a5','%a6','%sp',
+       '-(%sp)','(%sp)+',
+       '%ccr','%fp0','%fp1','%fp2','%fp3','%fp4','%fp5',
+       '%fp6','%fp7','%fpcr','%sr','%ssp','%dfc',
+       '%sfc','%vbr','%fpsr');
+     
+
+  implementation
+
+    uses
+      cutils,systems,
+      verbose;
+
+
+
+    function getreferencestring(var ref : treference) : string;
+      var
+         s,basestr,indexstr : string;
+
+      begin
+         s:='';
+         with ref do
+           begin
+             inc(offset,offsetfixup);
+             offsetfixup:=0;
+             basestr:=gas_reg2str[base];
+             indexstr:=gas_reg2str[index];
+             if assigned(symbol) then
+               s:=s+symbol.name;
+
+             if offset<0 then s:=s+tostr(offset)
+              else if (offset>0) then
+                begin
+                  if (symbol=nil) then s:=tostr(offset)
+                       else s:=s+'+'+tostr(offset);
+                    end
+                  else if (index=R_NO) and (base=R_NO) and not assigned(symbol) then
+                    s:=s+'0';
+
+               if (index<>R_NO) and (base=R_NO) and (direction=dir_none) then
+                begin
+                  if (scalefactor = 1) or (scalefactor = 0) then
+                    s:=s+'(,'+indexstr+'.l)'
+                  else
+                    s:=s+'(,'+indexstr+'.l*'+tostr(scalefactor)+')'
+                end
+                else if (index=R_NO) and (base<>R_NO) and (direction=dir_inc) then
+                begin
+                  if (scalefactor = 1) or (scalefactor = 0) then
+                      s:=s+'('+basestr+')+'
+                  else
+                   InternalError(10002);
+                end
+                else if (index=R_NO) and (base<>R_NO) and (direction=dir_dec) then
+                begin
+                  if (scalefactor = 1) or (scalefactor = 0) then
+                      s:=s+'-('+basestr+')'
+                  else
+                   InternalError(10003);
+                end
+                  else if (index=R_NO) and (base<>R_NO) and (direction=dir_none) then
+                begin
+                  s:=s+'('+basestr+')'
+                end
+                  else if (index<>R_NO) and (base<>R_NO) and (direction=dir_none) then
+                begin
+                  if (scalefactor = 1) or (scalefactor = 0) then
+                    s:=s+'('+basestr+','+indexstr+'.l)'
+                  else
+                    s:=s+'('+basestr+','+indexstr+'.l*'+tostr(scalefactor)+')';
+                end;
+          end;      
+         getreferencestring:=s;
+      end;
+      
+
+    function getopstr(const o:toper) : string;
+    var
+      hs : string;
+      i : tregister;
+    begin
+      case o.typ of
+            top_reg : getopstr:=gas_reg2str[o.reg];
+            top_ref : getopstr:=getreferencestring(o.ref^);
+        top_reglist : begin
+                      hs:='';
+                      for i:=R_NO to R_FPSR do
+                      begin
+                        if i in o.registerlist then
+                         hs:=hs+gas_reg2str[i]+'/';
+                      end;
+                      delete(hs,length(hs),1);
+                      getopstr := hs;
+                    end;
+             top_const : getopstr:='#'+tostr(o.val);
+            top_symbol :
+                    { compare with i386, where a symbol is considered }
+                    { a constant.                                     }
+                    begin
+                     if assigned(o.sym) then
+                       hs:='#'+o.sym.name
+                     else
+                       hs:='#';
+                       if o.symofs>0 then
+                        hs:=hs+'+'+tostr(o.symofs)
+                       else
+                        if o.symofs<0 then
+                         hs:=hs+tostr(o.symofs)
+                       else
+                        if not(assigned(o.sym)) then
+                          hs:=hs+'0';
+                       getopstr:=hs;
+                    end;
+            else internalerror(10001);
+         end;
+      end;
+
+    function getopstr_jmp(const o:toper) : string;
+    var
+      hs : string;
+    begin
+      case o.typ of
+            top_reg : getopstr_jmp:=gas_reg2str[o.reg];
+            top_ref : getopstr_jmp:=getreferencestring(o.ref^);
+            top_const : getopstr_jmp:=tostr(o.val);
+            top_symbol : begin
+                           if assigned(o.sym) then
+                             hs:=o.sym.name
+                           else
+                             hs:='';
+                             if o.symofs>0 then
+                              hs:=hs+'+'+tostr(o.symofs)
+                             else
+                              if o.symofs<0 then
+                               hs:=hs+tostr(o.symofs)
+                             else
+                              if not(assigned(o.sym)) then
+                                hs:=hs+'0';
+                           getopstr_jmp:=hs;
+                         end;
+            else internalerror(10001);
+         end;
+      end;
+
+{****************************************************************************
+                            TM68kASMOUTPUT
+ ****************************************************************************}
+
+(*
+   ait_instruction : begin
+                       { old versions of GAS don't like PEA.L and LEA.L }
+                       if (paicpu(hp)^.opcode in [
+                            A_LEA,A_PEA,A_ABCD,A_BCHG,A_BCLR,A_BSET,A_BTST,
+                            A_EXG,A_NBCD,A_SBCD,A_SWAP,A_TAS,A_SCC,A_SCS,
+                            A_SEQ,A_SGE,A_SGT,A_SHI,A_SLE,A_SLS,A_SLT,A_SMI,
+                            A_SNE,A_SPL,A_ST,A_SVC,A_SVS,A_SF]) then
+                        s:=#9+mot_op2str[paicpu(hp)^.opcode]
+                       else
+                        s:=#9+mot_op2str[paicpu(hp)^.opcode]+mit_opsize2str[paicpu(hp)^.opsize];
+                       if paicpu(hp)^.ops>0 then
+                        begin
+                        { call and jmp need an extra handling                          }
+                        { this code is only callded if jmp isn't a labeled instruction }
+                          if paicpu(hp)^.opcode in [A_BSR,A_BRA,A_LEA,A_PEA,A_JSR,A_JMP] then
+                           s:=s+#9#9+getopstr_jmp(paicpu(hp)^.oper[0])
+                          else
+                            s:=s+#9+getopstr(paicpu(hp)^.oper[0]);
+                           if paicpu(hp)^.ops>1 then
+                            begin
+                              s:=s+','+getopstr(paicpu(hp)^.oper[1]);
+                            { three operands }
+                              if paicpu(hp)^.ops>2 then
+                               begin
+                                   if (paicpu(hp)^.opcode = A_DIVSL) or
+                                      (paicpu(hp)^.opcode = A_DIVUL) or
+                                      (paicpu(hp)^.opcode = A_MULU) or
+                                      (paicpu(hp)^.opcode = A_MULS) or
+                                      (paicpu(hp)^.opcode = A_DIVS) or
+                                      (paicpu(hp)^.opcode = A_DIVU) then
+                                    s:=s+':'+getopstr(paicpu(hp)^.oper[2])
+                                   else
+                                    s:=s+','+getopstr(paicpu(hp)^.oper[2]);
+                               end;
+                            end;
+                        end;
+                       AsmWriteLn(s);
+                     end;
+
+
+ait_labeled_instruction : begin
+                     { labeled operand }
+                       if pai_labeled(hp)^.register = R_NO then
+                         begin
+                           if pai_labeled(hp)^.lab <> nil then
+                             AsmWriteLn(#9+mot_op2str[pai_labeled(hp)^.opcode]+#9+pai_labeled(hp)^.lab^.name)
+                           else
+                             AsmWriteLn(#9+mot_op2str[pai_labeled(hp)^.opcode]+#9+pai_labeled(hp)^.sym^.name);
+                         end
+                       else
+                     { labeled operand with register }
+                        begin
+                           if pai_labeled(hp)^.lab <> nil then
+                             begin
+                                  AsmWriteLn(#9+mot_op2str[pai_labeled(hp)^.opcode]+#9+
+                                    gas_reg2str[pai_labeled(hp)^.register]+','+pai_labeled(hp)^.lab^.name);
+                               end
+                           else
+                           { a symbol is the value }
+                             begin
+                                  AsmWriteLn(#9+mot_op2str[pai_labeled(hp)^.opcode]+#9+
+                                    gas_reg2str[pai_labeled(hp)^.register]+','+pai_labeled(hp)^.sym^.name);
+                             end;
+                        end;
+                     end;
+*)
+
+    { returns the opcode string }
+    function getopcodestring(hp : tai) : string;
+      var
+        op : tasmop;
+        s : string;
+      begin
+        op:=taicpu(hp).opcode;
+        { old versions of GAS don't like PEA.L and LEA.L }
+        if (op in [
+         A_LEA,A_PEA,A_ABCD,A_BCHG,A_BCLR,A_BSET,A_BTST,
+         A_EXG,A_NBCD,A_SBCD,A_SWAP,A_TAS,A_SCC,A_SCS,
+         A_SEQ,A_SGE,A_SGT,A_SHI,A_SLE,A_SLS,A_SLT,A_SMI,
+         A_SNE,A_SPL,A_ST,A_SVC,A_SVS,A_SF]) then
+         s:=gas_op2str[op]
+        else
+        if op = A_SXX then
+         s:=gas_op2str[op]+cond2str[taicpu(hp).condition]
+        else
+        if op in [a_dbxx,a_bxx,a_fbxx] then
+         s:=gas_op2str[op]+cond2str[taicpu(hp).condition]+gas_opsize2str[taicpu(hp).opsize]
+        else
+         s:=gas_op2str[op]+gas_opsize2str[taicpu(hp).opsize];
+        getopcodestring:=s; 
+      end;
+
+    procedure TM68kAssembler. WriteInstruction(hp: tai);
+    var
+      op       : tasmop;
+      s        : string;
+      sep      : char;
+      calljmp  : boolean;
+      i        : integer;
+     begin
+       if hp.typ <> ait_instruction then exit;
+       op:=taicpu(hp).opcode;
+       calljmp:=is_calljmp(op);
+       { call maybe not translated to call }
+       s:=#9+getopcodestring(hp);
+       { process operands }
+       if taicpu(hp).ops<>0 then
+         begin
+           { call and jmp need an extra handling                          }
+           { this code is only called if jmp isn't a labeled instruction  }
+           { quick hack to overcome a problem with manglednames=255 chars }
+           if calljmp then
+              begin
+                AsmWrite(s+#9);
+                s:=getopstr_jmp(taicpu(hp).oper[0]);
+              end
+            else
+              begin
+                for i:=0 to taicpu(hp).ops-1 do
+                  begin
+                    if i=0 then
+                      sep:=#9
+                    else
+                    if ((op = A_DIVSL) or
+                       (op = A_DIVUL) or
+                       (op = A_MULU) or
+                       (op = A_MULS) or
+                       (op = A_DIVS) or
+                       (op = A_DIVU)) and (i=1) then
+                      sep:=':'
+                    else
+                      sep:=',';
+                    s:=s+sep+getopstr(taicpu(hp).oper[i])
+                  end;
+              end;
+         end;
+         AsmWriteLn(s);
+     end;
+
+
+{*****************************************************************************
+                                  Initialize
+*****************************************************************************}
+
+    const
+       as_m68k_as_info : tasminfo =
+          (
+            id     : as_gas;
+            idtxt  : 'AS';
+            asmbin : 'as';
+            asmcmd : '-o $OBJ $ASM';
+            supported_target : system_any;
+            outputbinary: false;
+            allowdirect : true;
+            needar : true;
+            labelprefix_only_inside_procedure : false;
+            labelprefix : '.L';
+            comment : '# ';
+            secnames : ('',
+              '.text','.data','.bss',
+              '','','','','','',
+              '.stab','.stabstr','COMMON')
+          );
+
+initialization
+  RegisterAssembler(as_m68k_as_info,TM68kAssembler);
+end.
+{
+  $Log$
+  Revision 1.1  2002-08-13 18:01:52  carl
+    * rename swatoperands to swapoperands
+    + m68k first compilable version (still needs a lot of testing):
+        assembler generator, system information , inline
+        assembler reader.
+
+}

+ 47 - 0
compiler/m68k/aoptcpu.pas

@@ -0,0 +1,47 @@
+{
+    $Id$
+    Copyright (c) 1998-2002 by The FPC Development Team
+
+    This unit implements the 680x0 optimizer object
+
+    This program is free software; you can redistribute it and/or modify
+    it under the terms of the GNU General Public License as published by
+    the Free Software Foundation; either version 2 of the License, or
+    (at your option) any later version.
+
+    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.  See the
+    GNU General Public License for more details.
+
+    You should have received a copy of the GNU General Public License
+    along with this program; if not, write to the Free Software
+    Foundation, Inc., 675 Mass Ave, Cambridge, MA 02139, USA.
+
+ ****************************************************************************
+}
+
+
+Unit aoptcpu;
+
+Interface
+
+uses cpubase, aoptobj, aoptcpub;
+
+Type
+  TAOptCpu = Object(TAoptObj)
+    { uses the same constructor as TAopObj }
+  End;
+
+Implementation
+
+End.
+{
+ $Log$
+ Revision 1.1  2002-08-13 18:01:52  carl
+   * rename swatoperands to swapoperands
+   + m68k first compilable version (still needs a lot of testing):
+       assembler generator, system information , inline
+       assembler reader.
+
+}

+ 126 - 0
compiler/m68k/aoptcpub.pas

@@ -0,0 +1,126 @@
+ {
+    $Id$
+    Copyright (c) 1998-2002 by Jonas Maebe, member of the Free Pascal
+    Development Team
+
+    This unit contains several types and constants necessary for the
+    optimizer to work on the 80x86 architecture
+
+    This program is free software; you can redistribute it and/or modify
+    it under the terms of the GNU General Public License as published by
+    the Free Software Foundation; either version 2 of the License, or
+    (at your option) any later version.
+
+    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.  See the
+    GNU General Public License for more details.
+
+    You should have received a copy of the GNU General Public License
+    along with this program; if not, write to the Free Software
+    Foundation, Inc., 675 Mass Ave, Cambridge, MA 02139, USA.
+
+ ****************************************************************************
+}
+Unit aoptcpub; { Assembler OPTimizer CPU specific Base }
+
+{ enable the following define if memory references can have both a base and }
+{ index register in 1 operand                                               }
+
+{$define RefsHaveIndexReg}
+
+{ enable the following define if memory references can have a scaled index }
+
+{ define RefsHaveScale}
+
+{ enable the following define if memory references can have a segment }
+{ override                                                            }
+
+{ define RefsHaveSegment}
+
+Interface
+
+Uses
+  aasmcpu,AOptBase;
+
+Type
+
+{ type of a normal instruction }
+  TInstr = Taicpu;
+  PInstr = ^TInstr;
+
+{ ************************************************************************* }
+{ **************************** TCondRegs ********************************** }
+{ ************************************************************************* }
+{ Info about the conditional registers                                      }
+  TCondRegs = Object
+    Constructor Init;
+    Destructor Done;
+  End;
+
+{ ************************************************************************* }
+{ **************************** TAoptBaseCpu ******************************* }
+{ ************************************************************************* }
+
+  TAoptBaseCpu = Object(TAoptBase)
+  End;
+
+
+{ ************************************************************************* }
+{ ******************************* Constants ******************************* }
+{ ************************************************************************* }
+Const
+
+{ the maximum number of things (registers, memory, ...) a single instruction }
+{ changes                                                                    }
+
+  MaxCh = 3;
+
+{ the maximum number of operands an instruction has }
+
+  MaxOps = 3;
+
+{Oper index of operand that contains the source (reference) with a load }
+{instruction                                                            }
+
+  LoadSrc = 0;
+
+{Oper index of operand that contains the destination (register) with a load }
+{instruction                                                                }
+
+  LoadDst = 1;
+
+{Oper index of operand that contains the source (register) with a store }
+{instruction                                                            }
+
+  StoreSrc = 0;
+
+{Oper index of operand that contains the destination (reference) with a load }
+{instruction                                                                 }
+
+  StoreDst = 1;
+
+Implementation
+
+{ ************************************************************************* }
+{ **************************** TCondRegs ********************************** }
+{ ************************************************************************* }
+Constructor TCondRegs.init;
+Begin
+End;
+
+Destructor TCondRegs.Done; {$ifdef inl} inline; {$endif inl}
+Begin
+End;
+
+End.
+
+{
+ $Log$
+ Revision 1.1  2002-08-13 18:01:52  carl
+   * rename swatoperands to swapoperands
+   + m68k first compilable version (still needs a lot of testing):
+       assembler generator, system information , inline
+       assembler reader.
+
+}

+ 11 - 14
compiler/m68k/cpubase.pas

@@ -86,10 +86,10 @@ uses
          { (this may include 68040 mmu instructions)          }
          { (this may include 68040 mmu instructions)          }
          a_frestore,a_fsave,a_pflush,a_pflusha,a_pload,a_pmove,a_ptest,
          a_frestore,a_fsave,a_pflush,a_pflusha,a_pload,a_pmove,a_ptest,
          { useful for assembly langage output }
          { useful for assembly langage output }
-         a_label,a_none,a_dbxx,a_setxx,a_bxx,a_fbxx);
+         a_label,a_none,a_dbxx,a_sxx,a_bxx,a_fbxx);
 
 
       {# This should define the array of instructions as string }
       {# This should define the array of instructions as string }
-      op2strtable=array[tasmop] of string[8];
+      op2strtable=array[tasmop] of string[11];
 
 
     Const
     Const
       {# First value of opcode enumeration }
       {# First value of opcode enumeration }
@@ -123,7 +123,7 @@ uses
       treg64 = tregister64;
       treg64 = tregister64;
 
 
       {# Type definition for the array of string of register nnames }
       {# Type definition for the array of string of register nnames }
-      reg2strtable = array[tregister] of string[5];
+      reg2strtable = array[tregister] of string[7];
 
 
     Const
     Const
       {# First register in the tregister enumeration }
       {# First register in the tregister enumeration }
@@ -131,15 +131,6 @@ uses
       {# Last register in the tregister enumeration }
       {# Last register in the tregister enumeration }
       lastreg  = high(tregister);
       lastreg  = high(tregister);
 
 
-(*      
-     gas_reg2str : reg2strtable =
-      ('', '%d0','%d1','%d2','%d3','%d4','%d5','%d6','%d7',
-       '%a0','%a1','%a2','%a3','%a4','%a5','%a6','%sp',
-       '-(%sp)','(%sp)+',
-       '%ccr','%fp0','%fp1','%fp2','%fp3','%fp4','%fp5',
-       '%fp6','%fp7','%fpcr','%sr','%ssp','%dfc',
-       '%sfc','%vbr','%fpsr');
-*)
      std_reg2str : reg2strtable =
      std_reg2str : reg2strtable =
       ('', 'd0','d1','d2','d3','d4','d5','d6','d7',
       ('', 'd0','d1','d2','d3','d4','d5','d6','d7',
        'a0','a1','a2','a3','a4','a5','a6','sp',
        'a0','a1','a2','a3','a4','a5','a6','sp',
@@ -313,7 +304,7 @@ uses
        { S_FS  = single type (32 bit) }
        { S_FS  = single type (32 bit) }
        { S_FD  = double/64bit integer }
        { S_FD  = double/64bit integer }
        { S_FX  = Extended type      }
        { S_FX  = Extended type      }
-       topsize = (S_NO,S_B,S_W,S_L,S_FS,S_FD,S_FX);
+       topsize = (S_NO,S_B,S_W,S_L,S_FS,S_FD,S_FX,S_IQ);
 
 
 {*****************************************************************************
 {*****************************************************************************
                                  Constants
                                  Constants
@@ -561,7 +552,13 @@ implementation
 end.
 end.
 {
 {
   $Log$
   $Log$
-  Revision 1.4  2002-08-12 15:08:44  carl
+  Revision 1.5  2002-08-13 18:01:52  carl
+    * rename swatoperands to swapoperands
+    + m68k first compilable version (still needs a lot of testing):
+        assembler generator, system information , inline
+        assembler reader.
+
+  Revision 1.4  2002/08/12 15:08:44  carl
     + stab register indexes for powerpc (moved from gdb to cpubase)
     + stab register indexes for powerpc (moved from gdb to cpubase)
     + tprocessor enumeration moved to cpuinfo
     + tprocessor enumeration moved to cpuinfo
     + linker in target_info is now a class
     + linker in target_info is now a class

+ 62 - 0
compiler/m68k/cpunode.pas

@@ -0,0 +1,62 @@
+{
+    $Id$
+    Copyright (c) 2000-2002 by Florian Klaempfl
+
+    Includes the 680x0/Coldfire code generator
+
+    This program is free software; you can redistribute it and/or modify
+    it under the terms of the GNU General Public License as published by
+    the Free Software Foundation; either version 2 of the License, or
+    (at your option) any later version.
+
+    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.  See the
+    GNU General Public License for more details.
+
+    You should have received a copy of the GNU General Public License
+    along with this program; if not, write to the Free Software
+    Foundation, Inc., 675 Mass Ave, Cambridge, MA 02139, USA.
+
+ ****************************************************************************
+}
+unit cpunode;
+
+{$i fpcdefs.inc}
+
+  interface
+
+  implementation
+
+    uses
+       { generic nodes }
+       ncgbas,ncgld,ncgflw,ncgcnv,ncgmem,ncgcon,ncgcal,ncgset,ncginl
+       { to be able to only parts of the generic code,
+         the processor specific nodes must be included
+         after the generic one (FK)
+       }
+//       nm68kadd,
+//       nppccal,
+//       nppccon,
+//       nppcflw,
+//       nppcmem,
+//       nppcset,
+//       nppcinl,
+//       nppcopt,
+       { this not really a node }
+//       nppcobj,
+//       nppcmat,
+//       nppccnv
+       ;
+
+end.
+{
+  $Log$
+  Revision 1.1  2002-08-13 18:01:52  carl
+    * rename swatoperands to swapoperands
+    + m68k first compilable version (still needs a lot of testing):
+        assembler generator, system information , inline
+        assembler reader.
+
+
+}

文件差异内容过多而无法显示
+ 0 - 0
compiler/m68k/cpuswtch.pas


+ 59 - 0
compiler/m68k/cputarg.pas

@@ -0,0 +1,59 @@
+{
+    $Id$
+    Copyright (c) 2001-2002 by Peter Vreman
+
+    Includes the m68k dependent target units
+
+    This program is free software; you can redistribute it and/or modify
+    it under the terms of the GNU General Public License as published by
+    the Free Software Foundation; either version 2 of the License, or
+    (at your option) any later version.
+
+    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.  See the
+    GNU General Public License for more details.
+
+    You should have received a copy of the GNU General Public License
+    along with this program; if not, write to the Free Software
+    Foundation, Inc., 675 Mass Ave, Cambridge, MA 02139, USA.
+
+ ****************************************************************************
+}
+unit cputarg;
+
+{$i fpcdefs.inc}
+
+interface
+
+
+implementation
+
+    uses
+      systems { prevent a syntax error when nothing is included }
+
+{**************************************
+             Targets
+**************************************}
+
+    {$ifndef NOTARGETLINUX}
+      ,t_linux
+    {$endif}
+
+{**************************************
+             Assemblers
+**************************************}
+
+      ,agcpugas
+      ;
+
+end.
+{
+  $Log$
+  Revision 1.1  2002-08-13 18:01:52  carl
+    * rename swatoperands to swapoperands
+    + m68k first compilable version (still needs a lot of testing):
+        assembler generator, system information , inline
+        assembler reader.
+
+}

+ 62 - 0
compiler/m68k/radirect.pas

@@ -0,0 +1,62 @@
+{
+    $Id$
+    Copyright (c) 1998-2002 by Florian Klaempfl
+
+    Reads inline assembler and writes the lines direct to the output
+    This is not supported for the m68k
+
+    This program is free software; you can redistribute it and/or modify
+    it under the terms of the GNU General Public License as published by
+    the Free Software Foundation; either version 2 of the License, or
+    (at your option) any later version.
+
+    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.  See the
+    GNU General Public License for more details.
+
+    You should have received a copy of the GNU General Public License
+    along with this program; if not, write to the Free Software
+    Foundation, Inc., 675 Mass Ave, Cambridge, MA 02139, USA.
+
+ ****************************************************************************
+}
+unit radirect;
+
+{$i fpcdefs.inc}
+
+interface
+
+    uses
+      node;
+
+     function assemble : tnode;
+
+  implementation
+  
+  uses 
+    verbose;
+
+
+    function assemble : tnode;
+
+     begin
+       internalerror(20020813);
+     end;
+
+{*****************************************************************************
+                                     Initialize
+*****************************************************************************}
+
+
+end.
+{
+  $Log$
+  Revision 1.1  2002-08-13 18:01:52  carl
+    * rename swatoperands to swapoperands
+    + m68k first compilable version (still needs a lot of testing):
+        assembler generator, system information , inline
+        assembler reader.
+
+
+}

文件差异内容过多而无法显示
+ 223 - 451
compiler/m68k/rasm.pas


+ 8 - 2
compiler/ncgcal.pas

@@ -63,7 +63,7 @@ implementation
       cginfo,cgbase,pass_2,
       cginfo,cgbase,pass_2,
       cpuinfo,cpubase,aasmbase,aasmtai,aasmcpu,
       cpuinfo,cpubase,aasmbase,aasmtai,aasmcpu,
       nmem,nld,ncnv,
       nmem,nld,ncnv,
-      ncgutil,cga,cgobj,tgobj,regvars,rgobj,rgcpu,cg64f32,cgcpu;
+      ncgutil,cgobj,tgobj,regvars,rgobj,rgcpu,cg64f32,cgcpu;
 
 
 {*****************************************************************************
 {*****************************************************************************
                              TCGCALLPARANODE
                              TCGCALLPARANODE
@@ -1502,7 +1502,13 @@ begin
 end.
 end.
 {
 {
   $Log$
   $Log$
-  Revision 1.7  2002-08-12 15:08:39  carl
+  Revision 1.8  2002-08-13 18:01:51  carl
+    * rename swatoperands to swapoperands
+    + m68k first compilable version (still needs a lot of testing):
+        assembler generator, system information , inline
+        assembler reader.
+
+  Revision 1.7  2002/08/12 15:08:39  carl
     + stab register indexes for powerpc (moved from gdb to cpubase)
     + stab register indexes for powerpc (moved from gdb to cpubase)
     + tprocessor enumeration moved to cpuinfo
     + tprocessor enumeration moved to cpuinfo
     + linker in target_info is now a class
     + linker in target_info is now a class

+ 37 - 11
compiler/ncgcnv.pas

@@ -111,7 +111,7 @@ interface
            st_shortstring :
            st_shortstring :
              begin
              begin
                inc(left.location.reference.offset);
                inc(left.location.reference.offset);
-               location.register:=rg.getregisterint(exprasmlist);
+               location.register:=rg.getaddressregister(exprasmlist);
                cg.a_loadaddr_ref_reg(exprasmlist,left.location.reference,location.register);
                cg.a_loadaddr_ref_reg(exprasmlist,left.location.reference,location.register);
              end;
              end;
            st_ansistring :
            st_ansistring :
@@ -121,12 +121,12 @@ interface
                 begin
                 begin
                   reference_reset(hr);
                   reference_reset(hr);
                   hr.symbol:=objectlibrary.newasmsymbol('FPC_EMPTYCHAR');
                   hr.symbol:=objectlibrary.newasmsymbol('FPC_EMPTYCHAR');
-                  location.register:=rg.getregisterint(exprasmlist);
+                  location.register:=rg.getaddressregister(exprasmlist);
                   cg.a_loadaddr_ref_reg(exprasmlist,hr,location.register);
                   cg.a_loadaddr_ref_reg(exprasmlist,hr,location.register);
                 end
                 end
                else
                else
                 begin
                 begin
-                  location.register:=rg.getregisterint(exprasmlist);
+                  location.register:=rg.getaddressregister(exprasmlist);
                   cg.a_load_ref_reg(exprasmlist,OS_ADDR,left.location.reference,location.register);
                   cg.a_load_ref_reg(exprasmlist,OS_ADDR,left.location.reference,location.register);
                 end;
                 end;
              end;
              end;
@@ -142,7 +142,7 @@ interface
                 begin
                 begin
                   reference_reset(hr);
                   reference_reset(hr);
                   hr.symbol:=objectlibrary.newasmsymbol('FPC_EMPTYCHAR');
                   hr.symbol:=objectlibrary.newasmsymbol('FPC_EMPTYCHAR');
-                  location.register:=rg.getregisterint(exprasmlist);
+                  location.register:=rg.getaddressregister(exprasmlist);
                   cg.a_loadaddr_ref_reg(exprasmlist,hr,location.register);
                   cg.a_loadaddr_ref_reg(exprasmlist,hr,location.register);
                 end
                 end
                else
                else
@@ -185,7 +185,7 @@ interface
       begin
       begin
          location_release(exprasmlist,left.location);
          location_release(exprasmlist,left.location);
          location_reset(location,LOC_REGISTER,OS_ADDR);
          location_reset(location,LOC_REGISTER,OS_ADDR);
-         location.register:=rg.getregisterint(exprasmlist);
+         location.register:=rg.getaddressregister(exprasmlist);
          cg.a_loadaddr_ref_reg(exprasmlist,left.location.reference,location.register);
          cg.a_loadaddr_ref_reg(exprasmlist,left.location.reference,location.register);
       end;
       end;
 
 
@@ -196,7 +196,17 @@ interface
         location_reset(location,LOC_REFERENCE,OS_NO);
         location_reset(location,LOC_REFERENCE,OS_NO);
         case left.location.loc of
         case left.location.loc of
           LOC_REGISTER :
           LOC_REGISTER :
-            location.reference.base:=left.location.register;
+            begin
+              if not rg.isaddressregister(left.location.register) then
+                begin
+                  location_release(exprasmlist,left.location);
+                  location.reference.base:=rg.getaddressregister(exprasmlist);
+                  cg.a_load_reg_reg(exprasmlist,OS_ADDR,
+                          left.location.register,location.reference.base);
+                end
+              else
+                location.reference.base := left.location.register;
+            end;
           LOC_CREGISTER :
           LOC_CREGISTER :
             begin
             begin
               location.reference.base:=rg.getregisterint(exprasmlist);
               location.reference.base:=rg.getregisterint(exprasmlist);
@@ -207,7 +217,7 @@ interface
           LOC_CREFERENCE :
           LOC_CREFERENCE :
             begin
             begin
               location_release(exprasmlist,left.location);
               location_release(exprasmlist,left.location);
-              location.reference.base:=rg.getregisterint(exprasmlist);
+              location.reference.base:=rg.getaddressregister(exprasmlist);
               cg.a_load_ref_reg(exprasmlist,OS_ADDR,left.location.reference,
               cg.a_load_ref_reg(exprasmlist,OS_ADDR,left.location.reference,
                 location.reference.base);
                 location.reference.base);
             end;
             end;
@@ -279,7 +289,7 @@ interface
           begin
           begin
              location_release(exprasmlist,left.location);
              location_release(exprasmlist,left.location);
              location_reset(location,LOC_REGISTER,OS_ADDR);
              location_reset(location,LOC_REGISTER,OS_ADDR);
-             location.register:=rg.getregisterint(exprasmlist);
+             location.register:=rg.getaddressregister(exprasmlist);
              cg.a_loadaddr_ref_reg(exprasmlist,left.location.reference,location.register);
              cg.a_loadaddr_ref_reg(exprasmlist,left.location.reference,location.register);
           end;
           end;
       end;
       end;
@@ -332,11 +342,21 @@ interface
          objectlibrary.getlabel(l1);
          objectlibrary.getlabel(l1);
          case left.location.loc of
          case left.location.loc of
             LOC_CREGISTER,LOC_REGISTER:
             LOC_CREGISTER,LOC_REGISTER:
-              location.register:=left.location.register;
+              begin
+                 if not rg.isaddressregister(left.location.register) then
+                   begin
+                     location_release(exprasmlist,left.location);
+                     location.register:=rg.getaddressregister(exprasmlist);
+                     cg.a_load_reg_reg(exprasmlist,OS_ADDR,
+                              left.location.register,location.register);
+                   end
+                 else
+                    location.register := left.location.register;
+              end;
             LOC_CREFERENCE,LOC_REFERENCE:
             LOC_CREFERENCE,LOC_REFERENCE:
               begin
               begin
                 location_release(exprasmlist,left.location);
                 location_release(exprasmlist,left.location);
-                location.register:=rg.getregisterint(exprasmlist);
+                location.register:=rg.getaddressregister(exprasmlist);
                 cg.a_load_ref_reg(exprasmlist,OS_32,left.location.reference,location.register);
                 cg.a_load_ref_reg(exprasmlist,OS_32,left.location.reference,location.register);
               end;
               end;
             else
             else
@@ -503,7 +523,13 @@ end.
 
 
 {
 {
   $Log$
   $Log$
-  Revision 1.24  2002-08-12 20:39:17  florian
+  Revision 1.25  2002-08-13 18:01:52  carl
+    * rename swatoperands to swapoperands
+    + m68k first compilable version (still needs a lot of testing):
+        assembler generator, system information , inline
+        assembler reader.
+
+  Revision 1.24  2002/08/12 20:39:17  florian
     * casting of classes to interface fixed when the interface was
     * casting of classes to interface fixed when the interface was
       implemented by a parent class
       implemented by a parent class
 
 

+ 7 - 2
compiler/ncgflw.pas

@@ -94,7 +94,6 @@ implementation
       cpubase,cpuinfo,
       cpubase,cpuinfo,
       nld,ncon,
       nld,ncon,
       ncgutil,
       ncgutil,
-      cga,
       tgobj,rgobj,paramgr,
       tgobj,rgobj,paramgr,
       regvars,cgobj,cgcpu,cg64f32;
       regvars,cgobj,cgcpu,cg64f32;
 
 
@@ -1226,7 +1225,13 @@ begin
 end.
 end.
 {
 {
   $Log$
   $Log$
-  Revision 1.34  2002-08-11 14:32:26  peter
+  Revision 1.35  2002-08-13 18:01:52  carl
+    * rename swatoperands to swapoperands
+    + m68k first compilable version (still needs a lot of testing):
+        assembler generator, system information , inline
+        assembler reader.
+
+  Revision 1.34  2002/08/11 14:32:26  peter
     * renamed current_library to objectlibrary
     * renamed current_library to objectlibrary
 
 
   Revision 1.33  2002/08/11 13:24:11  peter
   Revision 1.33  2002/08/11 13:24:11  peter

+ 8 - 39
compiler/ncginl.pas

@@ -32,7 +32,6 @@ interface
     type
     type
        tcginlinenode = class(tinlinenode)
        tcginlinenode = class(tinlinenode)
           procedure pass_2;override;
           procedure pass_2;override;
-          procedure second_assigned;virtual; abstract;
           procedure second_assert;virtual;
           procedure second_assert;virtual;
           procedure second_sizeoftypeof;virtual;
           procedure second_sizeoftypeof;virtual;
           procedure second_length;virtual;
           procedure second_length;virtual;
@@ -60,7 +59,7 @@ implementation
       cginfo,cgbase,pass_1,pass_2,
       cginfo,cgbase,pass_1,pass_2,
       cpubase,paramgr,
       cpubase,paramgr,
       nbas,ncon,ncal,ncnv,nld,
       nbas,ncon,ncal,ncnv,nld,
-      cga,tgobj,ncgutil,cgobj,cg64f32,rgobj,rgcpu;
+      tgobj,ncgutil,cgobj,cg64f32,rgobj,rgcpu;
 
 
 
 
 {*****************************************************************************
 {*****************************************************************************
@@ -105,10 +104,6 @@ implementation
                begin
                begin
                   second_TypeInfo;
                   second_TypeInfo;
                end;
                end;
-            in_assigned_x :
-              begin
-                 second_Assigned;
-              end;
             in_include_x_y,
             in_include_x_y,
             in_exclude_x_y:
             in_exclude_x_y:
               begin
               begin
@@ -410,38 +405,6 @@ implementation
         end;
         end;
 
 
 
 
-{*****************************************************************************
-                         ASSIGNED GENERIC HANDLING
-*****************************************************************************}
-(*
-      procedure tcginlinenode.second_Assigned;
-        var
-         hreg : tregister;
-         ptrvalidlabel : tasmlabel;
-        begin
-          secondpass(tcallparanode(left).left);
-          location_release(exprasmlist,tcallparanode(left).left.location);
-          hreg := rg.getregisterint(exprasmlist);
-          if (tcallparanode(left).left.location.loc in [LOC_REGISTER,LOC_CREGISTER]) then
-            begin
-              { if pointer is non-nil, and is in register, this directly the value we can use }
-              cg.a_load_reg_reg(exprasmlist, OS_ADDR, tcallparanode(left).left.location.register, hreg);
-            end
-          else
-            begin
-              objectlibrary.getlabel(ptrvalidlabel);
-              cg.a_load_const_reg(exprasmlist, OS_INT, 1, hreg);
-              cg.a_cmp_const_ref_label(exprasmlist, OS_ADDR, OC_NE, 0,
-                  tcallparanode(left).left.location.reference, ptrvalidlabel);
-              cg.a_load_const_reg(exprasmlist, OS_INT, 0, hreg);
-              cg.a_label(exprasmlist,ptrvalidlabel);
-            end;
-          location.register := hreg;
-          location_reset(location,LOC_REGISTER,OS_INT);
-          WriteLn('Exiting assigned node!');
-        end;
-
-*)
 {*****************************************************************************
 {*****************************************************************************
                      INCLUDE/EXCLUDE GENERIC HANDLING
                      INCLUDE/EXCLUDE GENERIC HANDLING
 *****************************************************************************}
 *****************************************************************************}
@@ -641,7 +604,13 @@ end.
 
 
 {
 {
   $Log$
   $Log$
-  Revision 1.12  2002-08-11 14:32:26  peter
+  Revision 1.13  2002-08-13 18:01:52  carl
+    * rename swatoperands to swapoperands
+    + m68k first compilable version (still needs a lot of testing):
+        assembler generator, system information , inline
+        assembler reader.
+
+  Revision 1.12  2002/08/11 14:32:26  peter
     * renamed current_library to objectlibrary
     * renamed current_library to objectlibrary
 
 
   Revision 1.11  2002/08/11 13:24:11  peter
   Revision 1.11  2002/08/11 13:24:11  peter

+ 8 - 2
compiler/ncgset.pas

@@ -85,7 +85,7 @@ implementation
       paramgr,
       paramgr,
       pass_2,
       pass_2,
       ncon,
       ncon,
-      cga,tgobj,ncgutil,regvars,rgobj;
+      tgobj,ncgutil,regvars,rgobj;
 
 
 
 
 {*****************************************************************************
 {*****************************************************************************
@@ -956,7 +956,13 @@ begin
 end.
 end.
 {
 {
   $Log$
   $Log$
-  Revision 1.16  2002-08-11 14:32:27  peter
+  Revision 1.17  2002-08-13 18:01:52  carl
+    * rename swatoperands to swapoperands
+    + m68k first compilable version (still needs a lot of testing):
+        assembler generator, system information , inline
+        assembler reader.
+
+  Revision 1.16  2002/08/11 14:32:27  peter
     * renamed current_library to objectlibrary
     * renamed current_library to objectlibrary
 
 
   Revision 1.15  2002/08/11 13:24:12  peter
   Revision 1.15  2002/08/11 13:24:12  peter

+ 9 - 3
compiler/psystem.pas

@@ -40,7 +40,7 @@ implementation
 uses
 uses
   globals,
   globals,
   symconst,symtype,symsym,symdef,symtable,
   symconst,symtype,symsym,symdef,symtable,
-  ninl;
+  ninl,globtype;
 
 
 procedure insertinternsyms(p : tsymtable);
 procedure insertinternsyms(p : tsymtable);
 {
 {
@@ -294,7 +294,7 @@ begin
   if (cs_fp_emulation in aktmoduleswitches) then
   if (cs_fp_emulation in aktmoduleswitches) then
    begin
    begin
      s64floattype.setdef(tfloatdef.create(s32real));
      s64floattype.setdef(tfloatdef.create(s32real));
-     s80floattype.setdef(tfloatdef.create(s32real)))
+     s80floattype.setdef(tfloatdef.create(s32real));
    end
    end
   else
   else
    begin
    begin
@@ -315,7 +315,13 @@ end;
 end.
 end.
 {
 {
   $Log$
   $Log$
-  Revision 1.33  2002-08-11 15:28:00  florian
+  Revision 1.34  2002-08-13 18:01:52  carl
+    * rename swatoperands to swapoperands
+    + m68k first compilable version (still needs a lot of testing):
+        assembler generator, system information , inline
+        assembler reader.
+
+  Revision 1.33  2002/08/11 15:28:00  florian
     + support of explicit type case <any ordinal type>->pointer
     + support of explicit type case <any ordinal type>->pointer
       (delphi mode only)
       (delphi mode only)
 
 

+ 10 - 4
compiler/rautils.pas

@@ -79,7 +79,7 @@ type
       OPR_REFERENCE : (ref:treference);
       OPR_REFERENCE : (ref:treference);
       OPR_REGISTER  : (reg:tregister);
       OPR_REGISTER  : (reg:tregister);
 {$ifdef m68k}
 {$ifdef m68k}
-      OPR_REGLIST   : (reglist:pregisterlist);
+      OPR_REGLIST   : (reglist:tregisterlist);
 {$else not m68k}
 {$else not m68k}
       OPR_REGLIST   : ();
       OPR_REGLIST   : ();
 {$endif m68k}
 {$endif m68k}
@@ -115,7 +115,7 @@ type
     Procedure InitOperands;virtual;
     Procedure InitOperands;virtual;
     Procedure BuildOpcode;virtual;
     Procedure BuildOpcode;virtual;
     procedure ConcatInstruction(p:TAAsmoutput);virtual;
     procedure ConcatInstruction(p:TAAsmoutput);virtual;
-    Procedure Swatoperands;
+    Procedure Swapoperands;
   end;
   end;
 
 
 
 
@@ -1080,7 +1080,7 @@ begin
 end;
 end;
 
 
 
 
-Procedure TInstruction.Swatoperands;
+Procedure TInstruction.Swapoperands;
 Var
 Var
   p : toperand;
   p : toperand;
 Begin
 Begin
@@ -1592,7 +1592,13 @@ end;
 end.
 end.
 {
 {
   $Log$
   $Log$
-  Revision 1.41  2002-08-12 15:08:40  carl
+  Revision 1.42  2002-08-13 18:01:52  carl
+    * rename swatoperands to swapoperands
+    + m68k first compilable version (still needs a lot of testing):
+        assembler generator, system information , inline
+        assembler reader.
+
+  Revision 1.41  2002/08/12 15:08:40  carl
     + stab register indexes for powerpc (moved from gdb to cpubase)
     + stab register indexes for powerpc (moved from gdb to cpubase)
     + tprocessor enumeration moved to cpuinfo
     + tprocessor enumeration moved to cpuinfo
     + linker in target_info is now a class
     + linker in target_info is now a class

+ 13 - 7
compiler/scandir.pas

@@ -158,22 +158,22 @@ implementation
 {$ifdef m68k}
 {$ifdef m68k}
     procedure dir_appid;
     procedure dir_appid;
       begin
       begin
-        if system_info.target<>system_m68k_palmos then
+        if target_info.system<>system_m68k_palmos then
           Message(scan_w_appid_not_support);
           Message(scan_w_appid_not_support);
         { change description global var in all cases }
         { change description global var in all cases }
         { it not used but in win32 and os2 }
         { it not used but in win32 and os2 }
-        current_scanner^.skipspace;
-        palmos_applicationid:=current_scanner^.readcomment;
+        current_scanner.skipspace;
+        palmos_applicationid:=current_scanner.readcomment;
       end;
       end;
 
 
     procedure dir_appname;
     procedure dir_appname;
       begin
       begin
-        if system_info.target<>system_m68k_palmos then
+        if target_info.system<>system_m68k_palmos then
           Message(scan_w_appname_not_support);
           Message(scan_w_appname_not_support);
         { change description global var in all cases }
         { change description global var in all cases }
         { it not used but in win32 and os2 }
         { it not used but in win32 and os2 }
-        current_scanner^.skipspace;
-        palmos_applicationname:=current_scanner^.readcomment;
+        current_scanner.skipspace;
+        palmos_applicationname:=current_scanner.readcomment;
       end;
       end;
 {$endif m68k}
 {$endif m68k}
 
 
@@ -948,7 +948,13 @@ implementation
 end.
 end.
 {
 {
   $Log$
   $Log$
-  Revision 1.18  2002-07-26 21:15:42  florian
+  Revision 1.19  2002-08-13 18:01:52  carl
+    * rename swatoperands to swapoperands
+    + m68k first compilable version (still needs a lot of testing):
+        assembler generator, system information , inline
+        assembler reader.
+
+  Revision 1.18  2002/07/26 21:15:42  florian
     * rewrote the system handling
     * rewrote the system handling
 
 
   Revision 1.17  2002/07/20 17:16:03  florian
   Revision 1.17  2002/07/20 17:16:03  florian

+ 10 - 4
compiler/x86_64/aasmcpu.pas

@@ -196,7 +196,7 @@ interface
          function  calcsize(p:PInsEntry):longint;
          function  calcsize(p:PInsEntry):longint;
          procedure gencode(sec:TAsmObjectData);
          procedure gencode(sec:TAsmObjectData);
          function  NeedAddrPrefix(opidx:byte):boolean;
          function  NeedAddrPrefix(opidx:byte):boolean;
-         procedure Swatoperands;
+         procedure Swapoperands;
     {$endif NOAG386BIN}
     {$endif NOAG386BIN}
       end;
       end;
 
 
@@ -652,7 +652,7 @@ implementation
       end;
       end;
 
 
 
 
-    procedure taicpu.Swatoperands;
+    procedure taicpu.Swapoperands;
       var
       var
         p : TOper;
         p : TOper;
       begin
       begin
@@ -678,7 +678,7 @@ implementation
       begin
       begin
         if FOperandOrder<>order then
         if FOperandOrder<>order then
          begin
          begin
-           Swatoperands;
+           Swapoperands;
            FOperandOrder:=order;
            FOperandOrder:=order;
          end;
          end;
       end;
       end;
@@ -1799,7 +1799,13 @@ implementation
 end.
 end.
 {
 {
   $Log$
   $Log$
-  Revision 1.2  2002-07-25 22:55:33  florian
+  Revision 1.3  2002-08-13 18:01:53  carl
+    * rename swatoperands to swapoperands
+    + m68k first compilable version (still needs a lot of testing):
+        assembler generator, system information , inline
+        assembler reader.
+
+  Revision 1.2  2002/07/25 22:55:33  florian
     * several fixes, small test units can be compiled
     * several fixes, small test units can be compiled
 
 
   Revision 1.1  2002/07/24 22:38:15  florian
   Revision 1.1  2002/07/24 22:38:15  florian

部分文件因为文件数量过多而无法显示