toolchains: branch chris/gcc6-os3 updated. 7b6bafd386a75887df7d5bcacc5b2cc3f0147bc6
by NetSurf Browser Project
Gitweb links:
...log http://git.netsurf-browser.org/toolchains.git/shortlog/7b6bafd386a75887df...
...commit http://git.netsurf-browser.org/toolchains.git/commit/7b6bafd386a75887df7d...
...tree http://git.netsurf-browser.org/toolchains.git/tree/7b6bafd386a75887df7d5b...
The branch, chris/gcc6-os3 has been updated
discards 1cdca17b13035aee852cd20f4b6c071a3e343991 (commit)
discards a4689d07add7cc626fd7ef4bf7d8f57151d7625c (commit)
discards cb3c00dfcca28d56ef8775f9a1217fba9a31f4ef (commit)
via 7b6bafd386a75887df7d5bcacc5b2cc3f0147bc6 (commit)
via f89cd2532d4a6841974a4ffe1163139e1941c20c (commit)
via af866c4c8f065e1e87b169c7949952fe0869dc7c (commit)
via e99c93236efa171418cbb53718623e59db3c35e4 (commit)
via 4dbc815b4d85a325a3e9925da103b26bf871862f (commit)
via 1f75aee2ac01fac16e7218a2824c2d9648daa4a9 (commit)
via d0805722a1afc84af0d72649d5dd72eb358b0159 (commit)
via c750b462082617b0edec51045b00582f7f050647 (commit)
via 9c70e18682f7834dee76c80afe69f8ac2760c48b (commit)
via b191914b9fdb5aa2a4e9969ec543b246f79fdc41 (commit)
via b0b09103ebf62303d9aa4756c4c96d99363fe054 (commit)
via ef2c362769b3ca064c357119e7cef0ab51842c19 (commit)
via 8c54b1f726591a91e1002e3d219688bcb5fa9447 (commit)
via 17496c103b69193a7c03cb737d841a6906390bb2 (commit)
via 515b4483c99475ef2a4bee095bf056afa1893c3d (commit)
via 2962566a50820212c62380c29ce082ad4a461984 (commit)
via f8aad68778cdb783c3e3afb9732ae611e0a3d22f (commit)
This update added new revisions after undoing existing revisions. That is
to say, the old revision is not a strict subset of the new revision. This
situation occurs when you --force push a change and generate a repository
containing something like this:
* -- * -- B -- O -- O -- O (1cdca17b13035aee852cd20f4b6c071a3e343991)
\
N -- N -- N (7b6bafd386a75887df7d5bcacc5b2cc3f0147bc6)
When this happens we assume that you've already had alert emails for all
of the O revisions, and so we here report only the revisions in the N
branch from the common base, B.
Those revisions listed above that are new to this repository have
not appeared on any other notification email; so we list those
revisions in full, below.
- Log -----------------------------------------------------------------
commitdiff http://git.netsurf-browser.org/toolchains.git/commit/?id=7b6bafd386a75887...
commit 7b6bafd386a75887df7d5bcacc5b2cc3f0147bc6
Author: Chris Young <chris(a)unsatisfactorysoftware.co.uk>
Commit: Chris Young <chris(a)unsatisfactorysoftware.co.uk>
Workaround libssp needing a different autotools
diff --git a/m68k-unknown-amigaos/Makefile b/m68k-unknown-amigaos/Makefile
index d540502..89b9139 100644
--- a/m68k-unknown-amigaos/Makefile
+++ b/m68k-unknown-amigaos/Makefile
@@ -164,6 +164,7 @@ $(BUILDSTEPS)/srcdir-step3.d: $(BUILDSTEPS)/srcdir-step2.d
touch $(GCC_SRCDIR)/libbacktrace/aclocal.m4 $(GCC_SRCDIR)/libbacktrace/Makefile.in
touch $(GCC_SRCDIR)/libcc1/aclocal.m4 $(GCC_SRCDIR)/libcc1/Makefile.in
touch $(GCC_SRCDIR)/libquadmath/aclocal.m4 $(GCC_SRCDIR)/libquadmath/Makefile.in
+ touch $(GCC_SRCDIR)/libssp/aclocal.m4 $(GCC_SRCDIR)/libssp/Makefile.in
touch $@
$(BUILDSTEPS)/srcdir-step2.d: $(BUILDSTEPS)/srcdir-step1.d $(SOURCESDIR)/$(UPSTREAM_GMP_TARBALL) $(SOURCESDIR)/$(UPSTREAM_MPFR_TARBALL) $(SOURCESDIR)/$(UPSTREAM_MPC_TARBALL)
commitdiff http://git.netsurf-browser.org/toolchains.git/commit/?id=f89cd2532d4a6841...
commit f89cd2532d4a6841974a4ffe1163139e1941c20c
Author: Chris Young <chris(a)unsatisfactorysoftware.co.uk>
Commit: Chris Young <chris(a)unsatisfactorysoftware.co.uk>
Remove libnix glue
diff --git a/m68k-unknown-amigaos/recipes/patches/gcc/gcc6.p b/m68k-unknown-amigaos/recipes/patches/gcc/gcc6.p
index 6979667..8b4d30c 100644
--- a/m68k-unknown-amigaos/recipes/patches/gcc/gcc6.p
+++ b/m68k-unknown-amigaos/recipes/patches/gcc/gcc6.p
@@ -9660,50 +9660,6 @@ index 12067fdf5348..f0f069f6afa2 100644
/* Subclasses of rtx_def, using indentation to show the class
hierarchy, along with the relevant invariant.
-diff --git a/gcc/cp/g++spec.c b/gcc/cp/g++spec.c
-index 03cbde090cb3..83a5ab514c79 100644
---- gcc/cp/g++spec.c
-+++ gcc/cp/g++spec.c
-@@ -262,7 +262,7 @@ lang_specific_driver (struct cl_decoded_option **in_decoded_options,
- #endif
-
- /* Add one for shared_libgcc or extra static library. */
-- num_args = argc + added + need_math + (library > 0) * 4 + 1;
-+ num_args = argc + added + need_math + (library > 0) * 5 + 1;
- new_decoded_options = XNEWVEC (struct cl_decoded_option, num_args);
-
- i = 0;
-@@ -347,6 +347,30 @@ lang_specific_driver (struct cl_decoded_option **in_decoded_options,
- CL_DRIVER, &new_decoded_options[j]);
- added_libraries++;
- j++;
-+
-+#ifdef TARGET_AMIGA
-+ {
-+ bool addglue = true;
-+ /* do not add glue if exceptions are disabled. */
-+ for (int ii = 0; ii < argc; ++ii)
-+ {
-+ if (decoded_options[ii].opt_index == OPT_fexceptions)
-+ addglue = decoded_options[ii].value;
-+ }
-+ if (addglue)
-+ {
-+ extern const char *
-+ amiga_m68k_prefix_func (int argc, const char ** argv);
-+ char const * cxxglue = "../lib/gcc/m68k-amigaos/"
-+ DEFAULT_TARGET_VERSION
-+ "/cxxglue.o";
-+ char const * p = amiga_m68k_prefix_func (1, &cxxglue);
-+ generate_option_input_file (p, &new_decoded_options[j]);
-+ ++j;
-+ }
-+ }
-+#endif
-+
- /* Add target-dependent static library, if necessary. */
- if ((static_link || library > 1) && LIBSTDCXX_STATIC != NULL)
- {
diff --git a/gcc/df-scan.c b/gcc/df-scan.c
index 98de84405428..1f23452afe19 100644
--- gcc/df-scan.c
@@ -10434,34 +10390,6 @@ index 6f6810cf0baf..7117e7983b53 100644
m68k-*-elf* | fido-*-elf)
tmake_file="$tmake_file m68k/t-floatlib"
;;
-diff --git a/libgcc/config/m68k/cxxglue.c b/libgcc/config/m68k/cxxglue.c
-new file mode 100644
-index 000000000000..2a4e6374d088
---- /dev/null
-+++ libgcc/config/m68k/cxxglue.c
-@@ -0,0 +1,22 @@
-+#include "stabs.h"
-+
-+extern void __register_frame_info(void *, void *);
-+extern void * _EH_FRAME_BEGINS__;
-+extern void * _EH_FRAME_OBJECTS__;
-+
-+void __init_eh() {
-+ void ** frame = &_EH_FRAME_BEGINS__;
-+ void ** object = &_EH_FRAME_OBJECTS__;
-+
-+ int n = *(int *)frame++;
-+ int m = *(int *)object++;
-+ if (n != m)
-+ return;
-+
-+ while (n--) {
-+ __register_frame_info(*frame++, *object++);
-+ }
-+}
-+
-+ADD2INIT(__init_eh,127);
-+
diff --git a/libgcc/config/m68k/fpgnulib.c b/libgcc/config/m68k/fpgnulib.c
index fe41edf26aa0..90926104d8fd 100644
--- libgcc/config/m68k/fpgnulib.c
@@ -10747,17 +10675,6 @@ index 1ee8782d9fd2..2365433a59b3 100644
+ cat $< >> xfpgnulib__cmpxf2.c
+
\ No newline at end of file
-diff --git a/libgcc/config/m68k/t-glue b/libgcc/config/m68k/t-glue
-new file mode 100644
-index 000000000000..09cf7b47911c
---- /dev/null
-+++ libgcc/config/m68k/t-glue
-@@ -0,0 +1,5 @@
-+cxxglue.o: $(srcdir)/config/m68k/cxxglue.c
-+ $(CC) $(CFLAGS) -c $< -noixemul
-+
-+EXTRA_PARTS=cxxglue.o
-+
diff --git a/libgcc/unwind-dw2.c b/libgcc/unwind-dw2.c
index 1fb6026d123f..7bf0e4236f64 100644
--- libgcc/unwind-dw2.c
commitdiff http://git.netsurf-browser.org/toolchains.git/commit/?id=af866c4c8f065e1e...
commit af866c4c8f065e1e87b169c7949952fe0869dc7c
Author: Chris Young <chris(a)unsatisfactorysoftware.co.uk>
Commit: Chris Young <chris(a)unsatisfactorysoftware.co.uk>
Workaround libquadmath needing newer autotools
diff --git a/m68k-unknown-amigaos/Makefile b/m68k-unknown-amigaos/Makefile
index e8394fc..d540502 100644
--- a/m68k-unknown-amigaos/Makefile
+++ b/m68k-unknown-amigaos/Makefile
@@ -163,6 +163,7 @@ $(BUILDSTEPS)/srcdir-step3.d: $(BUILDSTEPS)/srcdir-step2.d
touch $(GCC_SRCDIR)/zlib/aclocal.m4 $(GCC_SRCDIR)/zlib/Makefile.in
touch $(GCC_SRCDIR)/libbacktrace/aclocal.m4 $(GCC_SRCDIR)/libbacktrace/Makefile.in
touch $(GCC_SRCDIR)/libcc1/aclocal.m4 $(GCC_SRCDIR)/libcc1/Makefile.in
+ touch $(GCC_SRCDIR)/libquadmath/aclocal.m4 $(GCC_SRCDIR)/libquadmath/Makefile.in
touch $@
$(BUILDSTEPS)/srcdir-step2.d: $(BUILDSTEPS)/srcdir-step1.d $(SOURCESDIR)/$(UPSTREAM_GMP_TARBALL) $(SOURCESDIR)/$(UPSTREAM_MPFR_TARBALL) $(SOURCESDIR)/$(UPSTREAM_MPC_TARBALL)
commitdiff http://git.netsurf-browser.org/toolchains.git/commit/?id=e99c93236efa1714...
commit e99c93236efa171418cbb53718623e59db3c35e4
Author: Chris Young <chris(a)unsatisfactorysoftware.co.uk>
Commit: Chris Young <chris(a)unsatisfactorysoftware.co.uk>
Workaround various parts of gcc needing a different autotools version
diff --git a/m68k-unknown-amigaos/Makefile b/m68k-unknown-amigaos/Makefile
index 9ca522a..e8394fc 100644
--- a/m68k-unknown-amigaos/Makefile
+++ b/m68k-unknown-amigaos/Makefile
@@ -159,6 +159,10 @@ $(BUILDSTEPS)/srcdir-step3.d: $(BUILDSTEPS)/srcdir-step2.d
for p in `ls $(RECIPES)/patches/gcc/*.p` ; do patch -d $(GCC_SRCDIR) -p0 <$$p ; done
for dir in `find $(RECIPES)/files/gcc/ -type d | grep -v '\.svn' | sed 's#$(RECIPES)/files/gcc##'` ; do mkdir -p $(GCC_SRCDIR)$$dir ; done
for file in `find $(RECIPES)/files/gcc/ -type f | grep -v '\.svn' | sed 's#$(RECIPES)/files/gcc##'` ; do cp -p $(RECIPES)/files/gcc$$file $(GCC_SRCDIR)$$file ; done
+ touch $(GCC_SRCDIR)/lto-plugin/aclocal.m4 $(GCC_SRCDIR)/lto-plugin/Makefile.in
+ touch $(GCC_SRCDIR)/zlib/aclocal.m4 $(GCC_SRCDIR)/zlib/Makefile.in
+ touch $(GCC_SRCDIR)/libbacktrace/aclocal.m4 $(GCC_SRCDIR)/libbacktrace/Makefile.in
+ touch $(GCC_SRCDIR)/libcc1/aclocal.m4 $(GCC_SRCDIR)/libcc1/Makefile.in
touch $@
$(BUILDSTEPS)/srcdir-step2.d: $(BUILDSTEPS)/srcdir-step1.d $(SOURCESDIR)/$(UPSTREAM_GMP_TARBALL) $(SOURCESDIR)/$(UPSTREAM_MPFR_TARBALL) $(SOURCESDIR)/$(UPSTREAM_MPC_TARBALL)
commitdiff http://git.netsurf-browser.org/toolchains.git/commit/?id=4dbc815b4d85a325...
commit 4dbc815b4d85a325a3e9925da103b26bf871862f
Author: Chris Young <chris(a)unsatisfactorysoftware.co.uk>
Commit: Chris Young <chris(a)unsatisfactorysoftware.co.uk>
Update to gcc 6.4
diff --git a/m68k-unknown-amigaos/Makefile b/m68k-unknown-amigaos/Makefile
index 3aaf896..9ca522a 100644
--- a/m68k-unknown-amigaos/Makefile
+++ b/m68k-unknown-amigaos/Makefile
@@ -3,8 +3,8 @@
# sources
-UPSTREAM_GCC_VERSION := 6.2.0
-UPSTREAM_GCC_TARBALL := gcc-$(UPSTREAM_GCC_VERSION).tar.bz2
+UPSTREAM_GCC_VERSION := 6.4.0
+UPSTREAM_GCC_TARBALL := gcc-$(UPSTREAM_GCC_VERSION).tar.xz
UPSTREAM_GCC_URI := http://ftp.gnu.org/gnu/gcc/gcc-$(UPSTREAM_GCC_VERSION)/$(UPSTREAM_GCC_TAR...
UPSTREAM_BINUTILS_VERSION := 2.14
@@ -171,7 +171,7 @@ $(BUILDSTEPS)/srcdir-step2.d: $(BUILDSTEPS)/srcdir-step1.d $(SOURCESDIR)/$(UPSTR
touch $@
$(BUILDSTEPS)/srcdir-step1.d: $(BUILDSTEPS)/$(UPSTREAM_GCC_TARBALL).d
- tar xjf $(SOURCESDIR)/$(UPSTREAM_GCC_TARBALL)
+ tar xJf $(SOURCESDIR)/$(UPSTREAM_GCC_TARBALL)
mv gcc-$(UPSTREAM_GCC_VERSION) $(GCC_SRCDIR)
touch $@
diff --git a/m68k-unknown-amigaos/recipes/files/gcc/gcc/amigacollect2.c b/m68k-unknown-amigaos/recipes/files/gcc/gcc/amigacollect2.c
deleted file mode 100644
index 97e5e55..0000000
--- a/m68k-unknown-amigaos/recipes/files/gcc/gcc/amigacollect2.c
+++ /dev/null
@@ -1,349 +0,0 @@
-/* GG-local whole file: dynamic libraries */
-/* Supplimentary functions that get compiled and linked to collect2 for
- AmigaOS target.
- Copyright (C) 1996 Free Software Foundation, Inc.
-
-This file is part of GCC.
-
-GCC 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, or (at your option)
-any later version.
-
-GCC 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 GCC; see the file COPYING. If not, write to
-the Free Software Foundation, 59 Temple Place - Suite 330,
-Boston, MA 02111-1307, USA. */
-
-#include "config.h"
-#include "system.h"
-#include "coretypes.h"
-#include "tm.h"
-
-/* From collect2.c: */
-
-void maybe_unlink(const char *);
-void fatal_perror(const char *, ...);
-void fork_execute(const char *, char **);
-void fatal(const char *, ...);
-
-extern char *c_file_name;
-extern int debug;
-
-/* Local functions. */
-
-static void safename (char *);
-static void add_lib (const char *);
-static void cat (const char *, FILE *);
-
-/* Names of temporary files we create. */
-#define XLIBS_C_NAME "xlibs.c"
-#define XLIBS_O_NAME "xlibs.o"
-#define SHARED_X_NAME "shared.x"
-
-/* Suffix which is prepended to "-l" options for dynamic libraries. */
-#define DYNAMIC_LIB_SUFFIX "_ixlibrary"
-
-/* Structure that holds library names. */
-struct liblist
-{
- struct liblist *next;
- char *name;
- char *cname;
-};
-
-/* Not zero if "-static" was specified on GCC command line or if all the
- libraries are static. */
-static int flag_static=0;
-
-/* Not zero if linking a base relative executable. This is recognized by
- presence of "-m amiga_bss" on the linker's commandline. */
-static int flag_baserel=0;
-
-/* Not zero if some of the specified libraries are dynamic. */
-static int found_dynamic_libs=0;
-
-/* List of linker libraries. */
-struct liblist *head = NULL;
-
-/* Return 1 if collect2 should do something more apart from tlink. We want it
- to call "postlink" and "strip" if linking with dynamic libraries. */
-
-int
-amigaos_do_collecting (void)
-{
- return !flag_static;
-}
-
-/* Check for presence of "-static" on the GCC command line. We should not do
- collecting if this flag was specified. */
-
-void
-amigaos_gccopts_hook (const char *arg)
-{
- if (strncmp(arg, "-static", strlen("-static"))==0)
- flag_static=1;
-}
-
-/* Replace unprintable characters with underscores. Used by "add_lib()". */
-
-static void
-safename (char *p)
-{
- if (!ISALPHA(*p))
- *p = '_';
- p++;
- while (*p)
- {
- if (!ISALNUM(*p))
- *p = '_';
- p++;
- }
-}
-
-/* Add a library to the list of dynamic libraries. First make sure that the
- library is actually dynamic. Used by "amigaos_libname_hook()". */
-
-static void
-add_lib (const char *name)
-{
- struct liblist *lib;
- static char buf[256];
-
- for (lib = head; lib; lib = lib->next)
- if (!strcmp(lib->name, name))
- return;
-
- /* A2IXDIR_PREFIX is passed by "make". */
- sprintf(buf, A2IXDIR_PREFIX "/ldscripts/%s.x", name);
- if (access(buf, R_OK))
- return;
-
- lib = (struct liblist*)xmalloc(sizeof(struct liblist));
- lib->name = xstrdup(name);
- lib->cname = xstrdup(name);
- safename(lib->cname);
- lib->next = head;
- head = lib;
-
- if (debug)
- fprintf(stderr, "found dynamic library, name: %s, cname: %s\n", lib->name,
- lib->cname);
-
- found_dynamic_libs=1;
-}
-
-/* Check if the argument is a linker library. Call "add_lib()" if yes. */
-
-void
-amigaos_libname_hook (const char *arg)
-{
- int len = strlen(arg);
- if (flag_static)
- return;
-
- if (len > 2 && !memcmp(arg, "-l", 2))
- add_lib(arg + 2);
- else if (len > 2 && !strcmp(arg + len - 2, ".a"))
- {
- const char *lib;
-
- ((char*)arg)[len - 2] = '\0';
- lib = strrchr(arg, '/');
- if (lib == NULL)
- lib = strrchr(arg, ':');
- if (lib == NULL)
- lib = arg - 1;
- if (!strncmp(lib + 1, "lib", 3))
- add_lib(lib + 4);
- ((char *)arg)[len - 2] = '.';
- }
-}
-
-/* Delete temporary files. */
-
-void
-amigaos_collect2_cleanup (void)
-{
- if (flag_static)
- return;
- maybe_unlink(XLIBS_C_NAME);
- maybe_unlink(XLIBS_O_NAME);
- maybe_unlink(SHARED_X_NAME);
-}
-
-/* Copy file named by FNAME to X. */
-
-static void
-cat (const char *fname, FILE *x)
-{
-#define BUFSIZE 16384
- FILE *in;
- static char buf[BUFSIZE];
- int bytes;
-
- in = fopen(fname, "r");
- if (in == NULL)
- fatal_perror("%s", fname);
- while (!feof(in) && (bytes = fread(buf, 1, BUFSIZE, in)))
- fwrite(buf, 1, bytes, x);
- fclose(in);
-}
-
-/* If no dynamic libraries were found, perform like "-static". Otherwise,
- create "xlibs.c", "shared.x" and invoke "gcc" to create "xlibs.o". We also
- have to adjust the linker commandline. */
-
-void
-amigaos_prelink_hook (const char **ld1_argv, int *strip_flag)
-{
- if (flag_static)
- return;
-
- if (!found_dynamic_libs)
- {
- flag_static=1;
- /* If the user has not requested "-static", but has requested "-s",
- collect2 removes "-s" from the "ld1_argv", and calls "strip" after
- linking. However, this would not be efficient if we linked the
- executable without any dynamic library. In this case, we put "-s"
- back. */
- if (*strip_flag)
- {
- /* Add "-s" as the last argument on the command line. */
- while (*ld1_argv)
- ld1_argv++;
- *ld1_argv++="-s";
- *ld1_argv=0;
- *strip_flag=0;
- }
- }
- else
- {
- FILE *x, *out;
- struct liblist *lib;
- static const char* argv[]={0, "-c", XLIBS_C_NAME, 0};
- const char **ld1_end, **ld1;
-
- /* Prepend suffixes to dynamic lib names. In addition, check if we are
- linking a base relative executable. */
- for (ld1=ld1_argv; *ld1; ld1++)
- {
- int len=strlen(*ld1);
- if (strncmp(*ld1, "-l", strlen("-l"))==0)
- {
- for (lib=head; lib; lib=lib->next)
- if (strcmp(*ld1+strlen("-l"), lib->name)==0)
- {
- char *newname=
- xmalloc(strlen(*ld1)+strlen(DYNAMIC_LIB_SUFFIX)+1);
- strcpy(newname, *ld1);
- strcat(newname, DYNAMIC_LIB_SUFFIX);
- *ld1=newname;
- break;
- }
- }
- else if (len > 2 && !strcmp(*ld1 + len - 2, ".a"))
- {
- const char *libname;
- int substituted=0;
-
- ((char *)(*ld1))[len - 2] = '\0';
- libname = strrchr(*ld1, '/');
- if (libname == NULL)
- libname = strrchr(*ld1, ':');
- if (libname == NULL)
- libname = *ld1 - 1;
- if (!strncmp(libname + 1, "lib", 3))
- for (lib=head; lib; lib=lib->next)
- if (strcmp(libname+4, lib->name)==0)
- {
- char *newname=xmalloc(strlen(*ld1)+
- strlen(DYNAMIC_LIB_SUFFIX)+3);
- strcpy(newname, *ld1);
- strcat(newname, DYNAMIC_LIB_SUFFIX);
- strcat(newname, ".a");
- *ld1=newname;
- substituted=1;
- break;
- }
- if (!substituted)
- ((char *)(*ld1))[len - 2] = '.';
- }
- else if (strcmp(ld1[0], "-m")==0 && ld1[1]
- && strcmp(ld1[1], "amiga_bss")==0)
- {
- flag_baserel=1;
- break;
- }
- }
-
- out = fopen(XLIBS_C_NAME, "w");
- if (out == NULL)
- fatal_perror("%s", XLIBS_C_NAME);
- x = fopen(SHARED_X_NAME, "w");
- if (x == NULL)
- fatal_perror("%s", SHARED_X_NAME);
-
- cat((flag_baserel ? A2IXDIR_PREFIX "/amiga_exe_baserel_script.x"
- : A2IXDIR_PREFIX "/amiga_exe_script.x"), x);
- for (lib = head; lib; lib = lib->next)
- {
- static char buf[256];
- sprintf(buf, A2IXDIR_PREFIX "/ldscripts/%s.x", lib->name);
- fprintf(out, "extern long %sBase; long *__p%sBase = &%sBase;\n",
- lib->cname, lib->cname, lib->cname);
- cat(buf, x);
- } /* {{ */
- fprintf(x, "}}\n");
- fclose(out);
- fclose(x);
- argv[0]=c_file_name;
- fork_execute("gcc", (char **)argv);
-
- /* Unfortunately, unlike "-s", "-T" cannot be specified as the last
- argument. We put it after "-L" args. */
- ld1_end=ld1_argv;
- while (*ld1_end)
- ld1_end++;
- ld1_end++;
- /* "ld1_end" now points after the terminating 0 of "ld1_argv". */
-
- ld1=ld1_end-2;
- while (ld1>ld1_argv && strncmp(*ld1, "-L", strlen("-L")))
- ld1--;
- if (ld1==ld1_argv)
- fatal("no -L arguments");
- ld1++;
- /* "ld1" now points after "-L". */
-
- /* Shift all the arguments after "-L" one position right. */
- memmove(ld1+1, ld1, (ld1_end-ld1)*sizeof(*ld1));
- /* Put -Tshared.x in the now empty space. */
- *ld1="-T" SHARED_X_NAME;
- }
-}
-
-/* Be lazy and just call "postlink". */
-
-void
-amigaos_postlink_hook (const char *output_file)
-{
- static const char *argv[]={"postlink", 0, 0, 0};
- if (flag_static)
- return;
-
- if (flag_baserel)
- {
- argv[1]="-baserel";
- argv[2]=output_file;
- }
- else
- argv[1]=output_file;
- fork_execute("postlink", (char **)argv);
-}
diff --git a/m68k-unknown-amigaos/recipes/files/gcc/gcc/config/m68k/amigaos-protos.h b/m68k-unknown-amigaos/recipes/files/gcc/gcc/config/m68k/amigaos-protos.h
deleted file mode 100644
index dd059f8..0000000
--- a/m68k-unknown-amigaos/recipes/files/gcc/gcc/config/m68k/amigaos-protos.h
+++ /dev/null
@@ -1,45 +0,0 @@
-/* Configuration for GNU C-compiler for m68k Amiga, running AmigaOS.
- Copyright (C) 1992, 1993, 1994, 1995, 1996, 1997, 1998, 2003
- Free Software Foundation, Inc.
- Contributed by Markus M. Wild (wild(a)amiga.physik.unizh.ch).
- Heavily modified by Kamil Iskra (iskra(a)student.uci.agh.edu.pl).
-
-This file is part of GCC.
-
-GCC 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, or (at your option)
-any later version.
-
-GCC 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 GCC; see the file COPYING. If not, write to
-the Free Software Foundation, 59 Temple Place - Suite 330,
-Boston, MA 02111-1307, USA. */
-
-extern int amigaos_restore_a4 (void);
-#ifdef RTX_CODE
-extern int read_only_operand (rtx);
-extern void amigaos_select_section (tree, int, unsigned HOST_WIDE_INT);
-extern void amigaos_encode_section_info (tree, rtx, int);
-extern void amigaos_alternate_pic_setup (FILE *);
-extern void amigaos_prologue_begin_hook (FILE *, int);
-extern void amigaos_alternate_frame_setup_f (FILE *, int);
-extern void amigaos_alternate_frame_setup (FILE *, int);
-extern struct rtx_def* gen_stack_cleanup_call (rtx, rtx);
-extern void amigaos_alternate_allocate_stack (rtx *);
-#ifdef TREE_CODE
-extern void amigaos_init_cumulative_args (CUMULATIVE_ARGS *, tree);
-extern void amigaos_function_arg_advance (CUMULATIVE_ARGS *);
-extern struct rtx_def *amigaos_function_arg (CUMULATIVE_ARGS *, enum machine_mode, tree);
-#endif
-#endif
-#ifdef TREE_CODE
-extern tree amigaos_handle_decl_attribute (tree *, tree, tree, int, bool *);
-extern tree amigaos_handle_type_attribute (tree *, tree, tree, int, bool *);
-extern int amigaos_comp_type_attributes (tree, tree);
-#endif
diff --git a/m68k-unknown-amigaos/recipes/files/gcc/gcc/config/m68k/amigaos.c b/m68k-unknown-amigaos/recipes/files/gcc/gcc/config/m68k/amigaos.c
deleted file mode 100644
index 2c5cab1..0000000
--- a/m68k-unknown-amigaos/recipes/files/gcc/gcc/config/m68k/amigaos.c
+++ /dev/null
@@ -1,461 +0,0 @@
-/* Configuration for GNU C-compiler for m68k Amiga, running AmigaOS.
- Copyright (C) 1992, 1993, 1994, 1995, 1996, 1997, 1998, 2003
- Free Software Foundation, Inc.
- Contributed by Markus M. Wild (wild(a)amiga.physik.unizh.ch).
- Heavily modified by Kamil Iskra (iskra(a)student.uci.agh.edu.pl).
-
-This file is part of GCC.
-
-GCC 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, or (at your option)
-any later version.
-
-GCC 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 GCC; see the file COPYING. If not, write to
-the Free Software Foundation, 59 Temple Place - Suite 330,
-Boston, MA 02111-1307, USA. */
-
-#include "config.h"
-#include "system.h"
-#include "coretypes.h"
-#include "tm.h"
-#include "rtl.h"
-#include "output.h"
-#include "tree.h"
-#include "flags.h"
-#include "expr.h"
-#include "toplev.h"
-#include "tm_p.h"
-
-static int amigaos_put_in_text (tree);
-static rtx gen_stack_management_call (rtx, rtx, const char *);
-
-/* Baserel support. */
-
-/* Does operand (which is a symbolic_operand) live in text space? If
- so SYMBOL_REF_FLAG, which is set by ENCODE_SECTION_INFO, will be true.
-
- This function is used in base relative code generation. */
-
-int
-read_only_operand (rtx operand)
-{
- if (GET_CODE (operand) == CONST)
- operand = XEXP (XEXP (operand, 0), 0);
- if (GET_CODE (operand) == SYMBOL_REF)
- return SYMBOL_REF_FLAG (operand) || CONSTANT_POOL_ADDRESS_P (operand);
- return 1;
-}
-
-/* Choose the section to use for DECL. RELOC is true if its value contains
- any relocatable expression. */
-
-void
-amigaos_select_section (tree decl, int reloc,
- unsigned HOST_WIDE_INT align ATTRIBUTE_UNUSED)
-{
- if (TREE_CODE (decl) == STRING_CST)
- {
- if (! flag_writable_strings)
- readonly_data_section ();
- else
- data_section ();
- }
- else if (TREE_CODE (decl) == VAR_DECL)
- {
- if (TREE_READONLY (decl)
- && ! TREE_THIS_VOLATILE (decl)
- && DECL_INITIAL (decl)
- && (DECL_INITIAL (decl) == error_mark_node
- || TREE_CONSTANT (DECL_INITIAL (decl)))
- && (!flag_pic || (flag_pic<3 && !reloc)
- || SYMBOL_REF_FLAG (XEXP (DECL_RTL (decl), 0))))
- readonly_data_section ();
- else
- data_section ();
- }
- else if ((!flag_pic || (flag_pic<3 && !reloc)) && DECL_P(decl)
- && SYMBOL_REF_FLAG (XEXP (DECL_RTL (decl), 0)))
- readonly_data_section ();
- else
- data_section ();
-}
-
-/* This function is used while generating a base relative code.
- It returns 1 if a decl is not relocatable, i. e., if it can be put
- in the text section.
- Currently, it's very primitive: it just checks if the object size
- is less than 4 bytes (i. e., if it can hold a pointer). It also
- supports arrays and floating point types. */
-
-static int
-amigaos_put_in_text (tree decl)
-{
- tree type = TREE_TYPE (decl);
- if (TREE_CODE (type) == ARRAY_TYPE)
- type = TREE_TYPE (type);
- return (TREE_INT_CST_HIGH (TYPE_SIZE (type)) == 0
- && TREE_INT_CST_LOW (TYPE_SIZE (type)) < 32)
- || FLOAT_TYPE_P (type);
-}
-
-/* Record properties of a DECL into the associated SYMBOL_REF. */
-
-void
-amigaos_encode_section_info (tree decl, rtx rtl, int first)
-{
- default_encode_section_info (decl, rtl, first);
-
- if (TREE_CODE (decl) == FUNCTION_DECL)
- SYMBOL_REF_FLAG (XEXP (rtl, 0)) = 1;
- else
- {
- if ((RTX_UNCHANGING_P (rtl) && !MEM_VOLATILE_P (rtl)
- && (flag_pic<3 || (TREE_CODE (decl) == STRING_CST
- && !flag_writable_strings)
- || amigaos_put_in_text (decl)))
- || (TREE_CODE (decl) == VAR_DECL
- && DECL_SECTION_NAME (decl) != NULL_TREE))
- SYMBOL_REF_FLAG (XEXP (rtl, 0)) = 1;
- }
-}
-
-/* Common routine used to check if a4 should be preserved/restored. */
-
-int
-amigaos_restore_a4 (void)
-{
- return (flag_pic >= 3 &&
- (TARGET_RESTORE_A4 || TARGET_ALWAYS_RESTORE_A4
- || lookup_attribute ("saveds",
- TYPE_ATTRIBUTES (TREE_TYPE (current_function_decl)))));
-}
-
-void
-amigaos_alternate_pic_setup (FILE *stream)
-{
- if (TARGET_RESTORE_A4 || TARGET_ALWAYS_RESTORE_A4)
- asm_fprintf (stream, "\tjbsr %U__restore_a4\n");
- else if (lookup_attribute ("saveds",
- TYPE_ATTRIBUTES (TREE_TYPE (current_function_decl))))
- asm_fprintf (stream, "\tlea %U__a4_init,%Ra4\n");
-}
-
-/* Attributes support. */
-
-#define AMIGA_CHIP_SECTION_NAME ".datachip"
-
-/* Handle a "chip" attribute;
- arguments as in struct attribute_spec.handler. */
-
-tree
-amigaos_handle_decl_attribute (tree *node, tree name,
- tree args ATTRIBUTE_UNUSED,
- int flags ATTRIBUTE_UNUSED,
- bool *no_add_attrs)
-{
- if (TREE_CODE (*node) == VAR_DECL)
- {
- if (is_attribute_p ("chip", name))
-#ifdef TARGET_ASM_NAMED_SECTION
- {
- if (! TREE_STATIC (*node) && ! DECL_EXTERNAL (*node))
- error ("`chip' attribute cannot be specified for local variables");
- else
- {
- /* The decl may have already been given a section attribute from
- a previous declaration. Ensure they match. */
- if (DECL_SECTION_NAME (*node) == NULL_TREE)
- DECL_SECTION_NAME (*node) =
- build_string (strlen (AMIGA_CHIP_SECTION_NAME) + 1,
- AMIGA_CHIP_SECTION_NAME);
- else if (strcmp (TREE_STRING_POINTER (DECL_SECTION_NAME (*node)),
- AMIGA_CHIP_SECTION_NAME) != 0)
- {
- error_with_decl (*node,
- "`chip' for `%s' conflicts with previous declaration");
- }
- }
- }
-#else
- error ("`chip' attribute is not supported for this target");
-#endif
- }
- else
- {
- warning ("`%s' attribute only applies to variables",
- IDENTIFIER_POINTER (name));
- *no_add_attrs = true;
- }
-
- return NULL_TREE;
-}
-
-/* Handle a "stackext", "interrupt" or "saveds" attribute;
- arguments as in struct attribute_spec.handler. */
-
-tree
-amigaos_handle_type_attribute (tree *node, tree name,
- tree args ATTRIBUTE_UNUSED,
- int flags ATTRIBUTE_UNUSED,
- bool *no_add_attrs)
-{
- if (TREE_CODE (*node) == FUNCTION_TYPE || TREE_CODE (*node) == METHOD_TYPE)
- {
- if (is_attribute_p ("stackext", name))
- {
- if (lookup_attribute ("interrupt", TYPE_ATTRIBUTES(*node)))
- {
- error ("`stackext' and `interrupt' are mutually exclusive");
- }
- }
- else if (is_attribute_p ("interrupt", name))
- {
- if (lookup_attribute ("stackext", TYPE_ATTRIBUTES(*node)))
- {
- error ("`stackext' and `interrupt' are mutually exclusive");
- }
- }
- else if (is_attribute_p ("saveds", name))
- {
- }
- }
- else
- {
- warning ("`%s' attribute only applies to functions",
- IDENTIFIER_POINTER (name));
- *no_add_attrs = true;
- }
-
- return NULL_TREE;
-}
-
-/* Stack checking and automatic extension support. */
-
-void
-amigaos_prologue_begin_hook (FILE *stream, int fsize)
-{
- if (TARGET_STACKCHECK)
- {
- if (fsize < 256)
- asm_fprintf (stream, "\tcmpl %s,%Rsp\n"
- "\tjcc 0f\n"
- "\tjra %U__stkovf\n"
- "\t0:\n",
- (flag_pic == 3 ? "a4@(___stk_limit:W)" :
- (flag_pic == 4 ? "a4@(___stk_limit:L)" :
- "___stk_limit")));
- else
- asm_fprintf (stream, "\tmovel %I%d,%Rd0\n\tjbsr %U__stkchk_d0\n",
- fsize);
- }
-}
-
-void
-amigaos_alternate_frame_setup_f (FILE *stream, int fsize)
-{
- if (fsize < 128)
- asm_fprintf (stream, "\tcmpl %s,%Rsp\n"
- "\tjcc 0f\n"
- "\tmoveq %I%d,%Rd0\n"
- "\tmoveq %I0,%Rd1\n"
- "\tjbsr %U__stkext_f\n"
- "0:\tlink %Ra5,%I%d:W\n",
- (flag_pic == 3 ? "a4@(___stk_limit:W)" :
- (flag_pic == 4 ? "a4@(___stk_limit:L)" :
- "___stk_limit")),
- fsize, -fsize);
- else
- asm_fprintf (stream, "\tmovel %I%d,%Rd0\n\tjbsr %U__link_a5_d0_f\n",
- fsize);
-}
-
-void
-amigaos_alternate_frame_setup (FILE *stream, int fsize)
-{
- if (!fsize)
- asm_fprintf (stream, "\tcmpl %s,%Rsp\n"
- "\tjcc 0f\n"
- "\tmoveq %I0,%Rd0\n"
- "\tmoveq %I0,%Rd1\n"
- "\tjbsr %U__stkext_f\n"
- "0:\n",
- (flag_pic == 3 ? "a4@(___stk_limit:W)" :
- (flag_pic == 4 ? "a4@(___stk_limit:L)" :
- "___stk_limit")));
- else if (fsize < 128)
- asm_fprintf (stream, "\tcmpl %s,%Rsp\n"
- "\tjcc 0f\n"
- "\tmoveq %I%d,%Rd0\n"
- "\tmoveq %I0,%Rd1\n"
- "\tjbsr %U__stkext_f\n"
- "0:\taddw %I%d,%Rsp\n",
- (flag_pic == 3 ? "a4@(___stk_limit:W)" :
- (flag_pic == 4 ? "a4@(___stk_limit:L)" :
- "___stk_limit")),
- fsize, -fsize);
- else
- asm_fprintf (stream, "\tmovel %I%d,%Rd0\n\tjbsr %U__sub_d0_sp_f\n",
- fsize);
-}
-
-static rtx
-gen_stack_management_call (rtx stack_pointer, rtx arg, const char *func)
-{
- rtx call_insn, call, seq, name;
- start_sequence ();
-
- /* Move arg to d0. */
- emit_move_insn (gen_rtx_REG (SImode, 0), arg);
-
- /* Generate the function reference. */
- name = gen_rtx_SYMBOL_REF (Pmode, func);
- SYMBOL_REF_FLAG (name) = 1;
- /* If optimizing, put it in a psedo so that several loads can be merged
- into one. */
- if (optimize && ! flag_no_function_cse)
- name = copy_to_reg (name);
-
- /* Generate the function call. */
- call = gen_rtx_CALL (VOIDmode, gen_rtx_MEM (FUNCTION_MODE, name),
- const0_rtx);
- /* If we are doing stack extension, notify about the sp change. */
- if (stack_pointer)
- call = gen_rtx_SET (VOIDmode, stack_pointer, call);
-
- /* Generate the call instruction. */
- call_insn = emit_call_insn (call);
- /* Stack extension does not change memory in an unpredictable way. */
- CONST_OR_PURE_CALL_P (call_insn) = 1;
- /* We pass an argument in d0. */
- CALL_INSN_FUNCTION_USAGE (call_insn) = gen_rtx_EXPR_LIST (VOIDmode,
- gen_rtx_USE (VOIDmode, gen_rtx_REG (SImode, 0)), 0);
-
- seq = get_insns ();
- end_sequence ();
- return seq;
-}
-
-rtx
-gen_stack_cleanup_call (rtx stack_pointer, rtx sa)
-{
- return gen_stack_management_call (stack_pointer, sa, "__move_d0_sp");
-}
-
-void
-amigaos_alternate_allocate_stack (rtx *operands)
-{
- if (TARGET_STACKEXTEND)
- emit_insn (gen_stack_management_call (stack_pointer_rtx, operands[1],
- "__sub_d0_sp"));
- else
- {
- if (TARGET_STACKCHECK)
- emit_insn (gen_stack_management_call (0, operands[1], "__stkchk_d0"));
- anti_adjust_stack (operands[1]);
- }
- emit_move_insn (operands[0], virtual_stack_dynamic_rtx);
-}
-
-/* begin-GG-local: explicit register specification for parameters */
-
-/* Initialize a variable CUM of type CUMULATIVE_ARGS
- for a call to a function whose data type is FNTYPE.
- For a library call, FNTYPE is 0. */
-
-void
-amigaos_init_cumulative_args(CUMULATIVE_ARGS *cum, tree fntype)
-{
- m68k_init_cumulative_args(cum, fntype);
-
- if (fntype)
- cum->formal_type=TYPE_ARG_TYPES(fntype);
- else /* Call to compiler-support function. */
- cum->formal_type=0;
-}
-
-/* Update the data in CUM to advance over an argument. */
-
-void
-amigaos_function_arg_advance(CUMULATIVE_ARGS *cum)
-{
- m68k_function_arg_advance(cum);
-
- if (cum->formal_type)
- cum->formal_type=TREE_CHAIN((tree)cum->formal_type);
-}
-
-/* A C expression that controls whether a function argument is passed
- in a register, and which register. */
-
-struct rtx_def *
-amigaos_function_arg(CUMULATIVE_ARGS *cum, enum machine_mode mode, tree type)
-{
- tree asmtree;
- if (cum->formal_type && TREE_VALUE((tree)cum->formal_type)
- && (asmtree=lookup_attribute("asm",
- TYPE_ATTRIBUTES(TREE_VALUE((tree)cum->formal_type)))))
- {
- int i;
-#if 0
- /* See c-decl.c/push_parm_decl for an explanation why this doesn't work.
- */
- cum->last_arg_reg=TREE_INT_CST_LOW(TREE_VALUE(TREE_VALUE(asmtree)));
-#else
- cum->last_arg_reg=TREE_INT_CST_LOW(TREE_VALUE(asmtree));
-#endif
- cum->last_arg_len=HARD_REGNO_NREGS(cum->last_arg_reg, mode);
-
- for (i=0; i<cum->last_arg_len; i++)
- if (cum->regs_already_used & (1 << cum->last_arg_reg+i))
- {
- error("two parameters allocated for one register");
- break;
- }
- return gen_rtx_REG (mode, cum->last_arg_reg);
- }
- else
- return m68k_function_arg(cum, mode, type);
-}
-
-/* Return zero if the attributes on TYPE1 and TYPE2 are incompatible,
- one if they are compatible, and two if they are nearly compatible
- (which causes a warning to be generated). */
-
-int
-amigaos_comp_type_attributes (tree type1, tree type2)
-{
- /* Functions or methods are incompatible if they specify mutually exclusive
- ways of passing arguments. */
- if (TREE_CODE(type1)==FUNCTION_TYPE || TREE_CODE(type1)==METHOD_TYPE)
- {
- tree arg1, arg2;
- arg1=TYPE_ARG_TYPES(type1);
- arg2=TYPE_ARG_TYPES(type2);
- for (; arg1 && arg2; arg1=TREE_CHAIN(arg1), arg2=TREE_CHAIN(arg2))
- if (TREE_VALUE(arg1) && TREE_VALUE(arg2))
- {
- tree asm1, asm2;
- asm1=lookup_attribute("asm", TYPE_ATTRIBUTES(TREE_VALUE(arg1)));
- asm2=lookup_attribute("asm", TYPE_ATTRIBUTES(TREE_VALUE(arg2)));
- if (asm1 && asm2)
- {
- if (TREE_INT_CST_LOW(TREE_VALUE(asm1))!=
- TREE_INT_CST_LOW(TREE_VALUE(asm2)))
- return 0; /* Two different registers specified. */
- }
- else
- if (asm1 || asm2)
- return 0; /* "asm" used in only one type. */
- }
- }
- return 1;
-}
-
-/* end-GG-local */
diff --git a/m68k-unknown-amigaos/recipes/files/gcc/gcc/config/m68k/amigaos.h b/m68k-unknown-amigaos/recipes/files/gcc/gcc/config/m68k/amigaos.h
deleted file mode 100644
index b1e2660..0000000
--- a/m68k-unknown-amigaos/recipes/files/gcc/gcc/config/m68k/amigaos.h
+++ /dev/null
@@ -1,553 +0,0 @@
-/* Configuration for GNU C-compiler for m68k Amiga, running AmigaOS.
- Copyright (C) 1992, 1993, 1994, 1995, 1996, 1997, 1998, 2003
- Free Software Foundation, Inc.
- Contributed by Markus M. Wild (wild(a)amiga.physik.unizh.ch).
- Heavily modified by Kamil Iskra (iskra(a)student.uci.agh.edu.pl).
-
-This file is part of GCC.
-
-GCC 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, or (at your option)
-any later version.
-
-GCC 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 GCC; see the file COPYING. If not, write to
-the Free Software Foundation, 59 Temple Place - Suite 330,
-Boston, MA 02111-1307, USA. */
-
-
-/* Specs, switches. */
-
-/* amiga/amigaos are the new "standard" defines for the Amiga.
- MCH_AMIGA, AMIGA, __chip etc. are used in other compilers and are
- provided for compatibility reasons.
- When creating shared libraries, use different 'errno'. */
-
-#undef TARGET_OS_CPP_BUILTINS
-#define TARGET_OS_CPP_BUILTINS() \
- do \
- { \
- builtin_define ("__chip=__attribute__((__chip__))"); \
- builtin_define ("__saveds=__attribute__((__saveds__))"); \
- builtin_define ("__interrupt=__attribute__((__interrupt__))"); \
- builtin_define ("__stackext=__attribute__((__stackext__))"); \
- builtin_define ("__regargs=__attribute__((__regparm__))"); \
- builtin_define ("__stdargs=__attribute__((__stkparm__))"); \
- builtin_define ("__aligned=__attribute__((__aligned__(4)))"); \
- if (target_flags & (MASK_RESTORE_A4|MASK_ALWAYS_RESTORE_A4)) \
- builtin_define ("errno=(*ixemul_errno)"); \
- builtin_define_std ("amiga"); \
- builtin_define_std ("amigaos"); \
- builtin_define_std ("AMIGA"); \
- builtin_define_std ("MCH_AMIGA"); \
- builtin_assert ("system=amigaos"); \
- } \
- while (0)
-
-/* Inform the program which CPU we compile for. */
-
-#undef TARGET_CPU_CPP_BUILTINS
-#define TARGET_CPU_CPP_BUILTINS() \
- do \
- { \
- if (TARGET_68040_ONLY) \
- { \
- if (TARGET_68060) \
- builtin_define_std ("mc68060"); \
- else \
- builtin_define_std ("mc68040"); \
- } \
- else if (TARGET_68030 && !TARGET_68040) \
- builtin_define_std ("mc68030"); \
- else if (TARGET_68020) \
- builtin_define_std ("mc68020"); \
- builtin_define_std ("mc68000"); \
- if (flag_pic > 2) \
- { \
- builtin_define ("__pic__"); \
- if (flag_pic > 3) \
- builtin_define ("__PIC__"); \
- } \
- builtin_assert ("cpu=m68k"); \
- builtin_assert ("machine=m68k"); \
- } \
- while (0)
-
-/* Define __HAVE_68881__ in preprocessor according to the -m flags.
- This will control the use of inline 68881 insns in certain macros.
- Note: it should be set in TARGET_CPU_CPP_BUILTINS but TARGET_68881
- isn't the same -m68881 since its also true for -m680[46]0 ...
- Differentiate between libnix and ixemul. */
-
-#define CPP_SPEC \
- "%{m68881:-D__HAVE_68881__} " \
- "%{noixemul:%{!ansi:%{!std=*:-Dlibnix}%{std=gnu*:-Dlibnix}} -D__libnix -D__libnix__} " \
- "%{!noixemul:%{!ansi:%{!std=*:-Dixemul}%{std=gnu*:-Dixemul}} -D__ixemul -D__ixemul__}"
-
-/* Translate '-resident' to '-fbaserel' (they differ in linking stage only).
- Don't put function addresses in registers for PC-relative code. */
-
-#define CC1_SPEC \
- "%{resident:-fbaserel} " \
- "%{resident32:-fbaserel32} " \
- "%{msmall-code:-fno-function-cse}"
-
-/* Various -m flags require special flags to the assembler. */
-
-#define ASM_SPEC \
- "%(asm_cpu) %(asm_cpu_default) %{msmall-code:-sc}"
-
-#define ASM_CPU_SPEC \
- "%{m68000|mc68000:-m68010} " \
- "%{m6802*|mc68020:-m68020} " \
- "%{m68030} " \
- "%{m68040} " \
- "%{m68060}"
-
-#define ASM_CPU_DEFAULT_SPEC \
- "%{!m680*:%{!mc680*:-m68010}}"
-
-/* If debugging, tell the linker to output amiga-hunk symbols *and* a BSD
- compatible debug hunk.
- Also, pass appropriate linker flavours depending on user-supplied
- commandline options. */
-
-#define LINK_SPEC \
- "%{noixemul:-fl libnix} " \
- "%{resident*:-amiga-datadata-reloc} " \
- "%{resident|fbaserel:-m amiga_bss -fl libb} " \
- "%{resident32|fbaserel32:-m amiga_bss -fl libb32} " \
- "%{g:-amiga-debug-hunk} " \
- "%(link_cpu)"
-
-#define LINK_CPU_SPEC \
- "%{m6802*|mc68020|m68030|m68040|m68060:-fl libm020} " \
- "%{m68881:-fl libm881}"
-
-/* Choose the right startup file, depending on whether we use base relative
- code, base relative code with automatic relocation (-resident), their
- 32-bit versions, libnix, profiling or plain crt0.o. */
-
-#define STARTFILE_SPEC \
- "%{!noixemul:" \
- "%{fbaserel:%{!resident:bcrt0.o%s}}" \
- "%{resident:rcrt0.o%s}" \
- "%{fbaserel32:%{!resident32:lcrt0.o%s}}" \
- "%{resident32:scrt0.o%s}" \
- "%{!resident:%{!fbaserel:%{!resident32:%{!fbaserel32:" \
- "%{pg:gcrt0.o%s}%{!pg:%{p:mcrt0.o%s}%{!p:crt0.o%s}}}}}}}" \
- "%{noixemul:" \
- "%{resident:libnix/nrcrt0.o%s} " \
- "%{!resident:%{fbaserel:libnix/nbcrt0.o%s}%{!fbaserel:libnix/ncrt0.o%s}}}"
-
-#define ENDFILE_SPEC \
- "%{noixemul:-lstubs}"
-
-/* Automatically search libamiga.a for AmigaOS specific functions. Note
- that we first search the standard C library to resolve as much as
- possible from there, since it has names that are duplicated in libamiga.a
- which we *don't* want from there. Then search libamiga.a for any calls
- that were not generated inline, and finally search the standard C library
- again to resolve any references that libamiga.a might have generated.
- This may only be a temporary solution since it might be better to simply
- remove the things from libamiga.a that should be pulled in from libc.a
- instead, which would eliminate the first reference to libc.a. Note that
- if we don't search it automatically, it is very easy for the user to try
- to put in a -lamiga himself and get it in the wrong place, so that (for
- example) calls like sprintf come from -lamiga rather than -lc. */
-
-#define LIB_SPEC \
- "%{!noixemul:" \
- "%{p|pg:-lc_p}" \
- "%{!p:%{!pg:-lc -lamiga -lc}}}" \
- "%{noixemul:" \
- "-lnixmain -lnix -lamiga %{mstackcheck|mstackextend:-lstack}}"
-
-/* This macro defines names of additional specifications to put in the specs
- that can be used in various specifications like CC1_SPEC. Its definition
- is an initializer with a subgrouping for each command option.
-
- Each subgrouping contains a string constant, that defines the
- specification name, and a string constant that used by the GCC driver
- program.
-
- Do not define this macro if it does not need to do anything. */
-
-#define EXTRA_SPECS \
- { "asm_cpu", ASM_CPU_SPEC }, \
- { "asm_cpu_default", ASM_CPU_DEFAULT_SPEC }, \
- { "link_cpu", LINK_CPU_SPEC }
-
-/* Compile with stack extension. */
-
-#define MASK_STACKEXTEND 0x40000000 /* 1 << 30 */
-#define TARGET_STACKEXTEND (((target_flags & MASK_STACKEXTEND) \
- && !lookup_attribute ("interrupt", \
- TYPE_ATTRIBUTES (TREE_TYPE (current_function_decl)))) \
- || lookup_attribute ("stackext", \
- TYPE_ATTRIBUTES (TREE_TYPE (current_function_decl))))
-
-/* Compile with stack checking. */
-
-#define MASK_STACKCHECK 0x20000000 /* 1 << 29 */
-#define TARGET_STACKCHECK ((target_flags & MASK_STACKCHECK) \
- && !(target_flags & MASK_STACKEXTEND) \
- && !lookup_attribute ("interrupt", \
- TYPE_ATTRIBUTES (TREE_TYPE (current_function_decl))) \
- && !lookup_attribute ("stackext", \
- TYPE_ATTRIBUTES (TREE_TYPE (current_function_decl))))
-
-/* Compile with a4 restoring in public functions. */
-
-#define MASK_RESTORE_A4 0x10000000 /* 1 << 28 */
-#define TARGET_RESTORE_A4 \
- ((target_flags & MASK_RESTORE_A4) && TREE_PUBLIC (current_function_decl))
-
-/* Compile with a4 restoring in all functions. */
-
-#define MASK_ALWAYS_RESTORE_A4 0x8000000 /* 1 << 27 */
-#define TARGET_ALWAYS_RESTORE_A4 (target_flags & MASK_ALWAYS_RESTORE_A4)
-
-/* Provide a dummy entry for the '-msmall-code' switch. This is used by
- the assembler and '*_SPEC'. */
-
-#undef SUBTARGET_SWITCHES
-#define SUBTARGET_SWITCHES \
- { "small-code", 0, \
- "" /* Undocumented. */ }, \
- { "stackcheck", MASK_STACKCHECK, \
- N_("Generate stack-check code") }, \
- { "no-stackcheck", - MASK_STACKCHECK, \
- N_("Do not generate stack-check code") }, \
- { "stackextend", MASK_STACKEXTEND, \
- N_("Generate stack-extension code") }, \
- { "no-stackextend", - MASK_STACKEXTEND, \
- N_("Do not generate stack-extension code") }, \
- { "fixedstack", - (MASK_STACKCHECK|MASK_STACKEXTEND), \
- N_("Do not generate stack-check/stack-extension code") }, \
- { "restore-a4", MASK_RESTORE_A4, \
- N_("Restore a4 in public functions") }, \
- { "no-restore-a4", - MASK_RESTORE_A4, \
- N_("Do not restore a4 in public functions") }, \
- { "always-restore-a4", MASK_ALWAYS_RESTORE_A4, \
- N_("Restore a4 in all functions") }, \
- { "no-always-restore-a4", - MASK_ALWAYS_RESTORE_A4, \
- N_("Do not restore a4 in all functions") },
-
-#undef SUBTARGET_OVERRIDE_OPTIONS
-#define SUBTARGET_OVERRIDE_OPTIONS \
-do \
- { \
- if (!TARGET_68020 && flag_pic==4) \
- error ("-fbaserel32 is not supported on the 68000 or 68010\n"); \
- } \
-while (0)
-
-/* Various ABI issues. */
-
-/* This is (almost;-) BSD, so it wants DBX format. */
-
-#define DBX_DEBUGGING_INFO
-
-/* GDB goes mad if it sees the function end marker. */
-
-#define NO_DBX_FUNCTION_END 1
-
-/* Allow folding division by zero. */
-
-#define REAL_INFINITY
-
-/* Don't try using XFmode since we don't have appropriate runtime software
- support. */
-#undef LONG_DOUBLE_TYPE_SIZE
-#define LONG_DOUBLE_TYPE_SIZE 64
-
-/* Use A5 as framepointer instead of A6, since the AmigaOS ABI requires A6
- to be used as a shared library base pointer in direct library calls. */
-
-#undef FRAME_POINTER_REGNUM
-#define FRAME_POINTER_REGNUM 13
-
-/* We use A4 for the PIC pointer, not A5, which is the framepointer. */
-
-#undef PIC_OFFSET_TABLE_REGNUM
-#define PIC_OFFSET_TABLE_REGNUM (flag_pic ? 12 : INVALID_REGNUM)
-
-/* The AmigaOS ABI does not define how structures should be returned, so,
- contrary to 'm68k.h', we prefer a multithread-safe solution. */
-
-#undef PCC_STATIC_STRUCT_RETURN
-
-/* Setup a default shell return value for those (gazillion..) programs that
- (inspite of ANSI-C) declare main() to be void (or even VOID...) and thus
- cause the shell to randomly caugh upon executing such programs (contrary
- to Unix, AmigaOS scripts are terminated with an error if a program returns
- with an error code above the `error' or even `failure' level
- (which is configurable with the FAILAT command)). */
-
-#define DEFAULT_MAIN_RETURN c_expand_return (integer_zero_node)
-
-#undef WCHAR_TYPE
-#define WCHAR_TYPE "unsigned int"
-
-/* XXX: section support */
-#if 0
-/* Support sections in chip memory, currently '.datachip' only. */
-#undef TARGET_ASM_NAMED_SECTION
-#define TARGET_ASM_NAMED_SECTION amiga_named_section
-
-/* We define TARGET_ASM_NAMED_SECTION, but we don't support arbitrary sections,
- including '.gcc_except_table', so we emulate the standard behaviour. */
-#undef TARGET_ASM_EXCEPTION_SECTION
-#define TARGET_ASM_EXCEPTION_SECTION amiga_exception_section
-
-#undef TARGET_ASM_EH_FRAME_SECTION
-#define TARGET_ASM_EH_FRAME_SECTION amiga_eh_frame_section
-#endif
-
-/* Use sjlj exceptions until problems with DWARF2 unwind info on a.out
- targets using GNU ld are fixed. */
-/*
-#define DWARF2_UNWIND_INFO 0
-*/
-#define NO_DWARF2_UNWIND_INFO
-
-/* GAS supports alignment up to 32768 bytes. */
-#undef ASM_OUTPUT_ALIGN
-#define ASM_OUTPUT_ALIGN(FILE, LOG) \
-do \
- { \
- if ((LOG) == 1) \
- fprintf ((FILE), "\t.even\n"); \
- else \
- fprintf ((FILE), "\t.align %d\n", (LOG)); \
- } \
-while (0)
-
-#define MAX_OFILE_ALIGNMENT ((1 << 15)*BITS_PER_UNIT)
-
-/* Call __flush_cache() after building the trampoline: it will call
- an appropriate OS cache-clearing routine. */
-
-#undef FINALIZE_TRAMPOLINE
-#define FINALIZE_TRAMPOLINE(TRAMP) \
- emit_library_call (gen_rtx_SYMBOL_REF (Pmode, "__flush_cache"), \
- 0, VOIDmode, 2, (TRAMP), Pmode, \
- GEN_INT (TRAMPOLINE_SIZE), SImode)
-
-/* Baserel support. */
-
-/* Given that symbolic_operand(X), return TRUE if no special
- base relative relocation is necessary */
-
-#define LEGITIMATE_BASEREL_OPERAND_P(X) \
- (flag_pic >= 3 && read_only_operand (X))
-
-#undef LEGITIMATE_PIC_OPERAND_P
-#define LEGITIMATE_PIC_OPERAND_P(X) \
- (! symbolic_operand (X, VOIDmode) || LEGITIMATE_BASEREL_OPERAND_P (X))
-
-/* Define this macro if references to a symbol must be treated
- differently depending on something about the variable or
- function named by the symbol (such as what section it is in).
-
- The macro definition, if any, is executed immediately after the
- rtl for DECL or other node is created.
- The value of the rtl will be a `mem' whose address is a
- `symbol_ref'.
-
- The usual thing for this macro to do is to a flag in the
- `symbol_ref' (such as `SYMBOL_REF_FLAG') or to store a modified
- name string in the `symbol_ref' (if one bit is not enough
- information).
-
- On the Amiga we use this to indicate if references to a symbol should be
- absolute or base relative. */
-
-#undef TARGET_ENCODE_SECTION_INFO
-#define TARGET_ENCODE_SECTION_INFO amigaos_encode_section_info
-
-#define LIBCALL_ENCODE_SECTION_INFO(FUN) \
-do \
- { \
- if (flag_pic >= 3) \
- SYMBOL_REF_FLAG (FUN) = 1; \
- } \
-while (0)
-
-/* Select and switch to a section for EXP. */
-
-#undef TARGET_ASM_SELECT_SECTION
-#define TARGET_ASM_SELECT_SECTION amigaos_select_section
-
-/* Preserve A4 for baserel code if necessary. */
-
-#define EXTRA_SAVE_REG(REGNO) \
-do { \
- if (flag_pic && flag_pic >= 3 && REGNO == PIC_OFFSET_TABLE_REGNUM \
- && amigaos_restore_a4()) \
- return true; \
-} while (0)
-
-/* Predicate for ALTERNATE_PIC_SETUP. */
-
-#define HAVE_ALTERNATE_PIC_SETUP (flag_pic >= 3)
-
-/* Make a4 point at data hunk. */
-
-#define ALTERNATE_PIC_SETUP(STREAM) \
- (amigaos_alternate_pic_setup (STREAM))
-
-/* Attribute support. */
-
-/* Generate the test of d0 before return to set cc register in 'interrupt'
- function. */
-
-#define EPILOGUE_END_HOOK(STREAM) \
-do \
- { \
- if (lookup_attribute ("interrupt", \
- TYPE_ATTRIBUTES (TREE_TYPE (current_function_decl)))) \
- asm_fprintf ((STREAM), "\ttstl %Rd0\n"); \
- } \
-while (0)
-
-/* begin-GG-local: explicit register specification for parameters */
-
-/* Note: this is an extension of m68k_args */
-struct amigaos_args
-{
- int num_of_regs;
- long regs_already_used;
- int last_arg_reg;
- int last_arg_len;
- void *formal_type; /* New field: formal type of the current argument. */
-};
-
-/* A C type for declaring a variable that is used as the first
- argument of `FUNCTION_ARG' and other related values. */
-
-#undef CUMULATIVE_ARGS
-#define CUMULATIVE_ARGS struct amigaos_args
-
-/* Initialize a variable CUM of type CUMULATIVE_ARGS
- for a call to a function whose data type is FNTYPE.
- For a library call, FNTYPE is 0. */
-
-#undef INIT_CUMULATIVE_ARGS
-#define INIT_CUMULATIVE_ARGS(CUM, FNTYPE, LIBNAME, INDIRECT, N_NAMED_ARGS) \
- (amigaos_init_cumulative_args(&(CUM), (FNTYPE)))
-
-/* Update the data in CUM to advance over an argument
- of mode MODE and data type TYPE.
- (TYPE is null for libcalls where that information may not be available.) */
-
-#undef FUNCTION_ARG_ADVANCE
-#define FUNCTION_ARG_ADVANCE(CUM, MODE, TYPE, NAMED) \
- (amigaos_function_arg_advance (&(CUM)))
-
-/* A C expression that controls whether a function argument is passed
- in a register, and which register. */
-
-#undef FUNCTION_ARG
-#define FUNCTION_ARG(CUM, MODE, TYPE, NAMED) \
- (amigaos_function_arg (&(CUM), (MODE), (TYPE)))
-
-/* end-GG-local */
-
-/* Stack checking and automatic extension support. */
-
-#define PROLOGUE_BEGIN_HOOK(STREAM, FSIZE) \
- (amigaos_prologue_begin_hook ((STREAM), (FSIZE)))
-
-#define HAVE_ALTERNATE_FRAME_SETUP_F(FSIZE) TARGET_STACKEXTEND
-
-#define ALTERNATE_FRAME_SETUP_F(STREAM, FSIZE) \
- (amigaos_alternate_frame_setup_f ((STREAM), (FSIZE)))
-
-#define HAVE_ALTERNATE_FRAME_SETUP(FSIZE) TARGET_STACKEXTEND
-
-#define ALTERNATE_FRAME_SETUP(STREAM, FSIZE) \
- (amigaos_alternate_frame_setup ((STREAM), (FSIZE)))
-
-#define HAVE_ALTERNATE_FRAME_DESTR_F(FSIZE) \
- (TARGET_STACKEXTEND && current_function_calls_alloca)
-
-#define ALTERNATE_FRAME_DESTR_F(STREAM, FSIZE) \
- (asm_fprintf ((STREAM), "\tjra %U__unlk_a5_rts\n"))
-
-#define HAVE_ALTERNATE_RETURN \
- (TARGET_STACKEXTEND && frame_pointer_needed && \
- current_function_calls_alloca)
-
-#define ALTERNATE_RETURN(STREAM)
-
-#define HAVE_restore_stack_nonlocal TARGET_STACKEXTEND
-#define gen_restore_stack_nonlocal gen_stack_cleanup_call
-
-#define HAVE_restore_stack_function TARGET_STACKEXTEND
-#define gen_restore_stack_function gen_stack_cleanup_call
-
-#define HAVE_restore_stack_block TARGET_STACKEXTEND
-#define gen_restore_stack_block gen_stack_cleanup_call
-
-#undef TARGET_ALTERNATE_ALLOCATE_STACK
-#define TARGET_ALTERNATE_ALLOCATE_STACK 1
-
-#define ALTERNATE_ALLOCATE_STACK(OPERANDS) \
-do \
- { \
- amigaos_alternate_allocate_stack (OPERANDS); \
- DONE; \
- } \
-while (0)
-
-/* begin-GG-local: dynamic libraries */
-
-extern int amigaos_do_collecting (void);
-extern void amigaos_gccopts_hook (const char *);
-extern void amigaos_libname_hook (const char* arg);
-extern void amigaos_collect2_cleanup (void);
-extern void amigaos_prelink_hook (const char **, int *);
-extern void amigaos_postlink_hook (const char *);
-
-/* This macro is used to check if all collect2 facilities should be used.
- We need a few special ones, like stripping after linking. */
-
-#define DO_COLLECTING (do_collecting || amigaos_do_collecting())
-
-/* This macro is called in collect2 for every GCC argument name.
- ARG is a part of commandline (without '\0' at the end). */
-
-#define COLLECT2_GCC_OPTIONS_HOOK(ARG) amigaos_gccopts_hook(ARG)
-
-/* This macro is called in collect2 for every ld's "-l" or "*.o" or "*.a"
- argument. ARG is a complete argument, with '\0' at the end. */
-
-#define COLLECT2_LIBNAME_HOOK(ARG) amigaos_libname_hook(ARG)
-
-/* This macro is called at collect2 exit, to clean everything up. */
-
-#define COLLECT2_EXTRA_CLEANUP amigaos_collect2_cleanup
-
-/* This macro is called just before the first linker invocation.
- LD1_ARGV is "char** argv", which will be passed to "ld". STRIP is an
- *address* of "strip_flag" variable. */
-
-#define COLLECT2_PRELINK_HOOK(LD1_ARGV, STRIP) \
-amigaos_prelink_hook((const char **)(LD1_ARGV), (STRIP))
-
-/* This macro is called just after the first linker invocation, in place of
- "nm" and "ldd". OUTPUT_FILE is the executable's filename. */
-
-#define COLLECT2_POSTLINK_HOOK(OUTPUT_FILE) amigaos_postlink_hook(OUTPUT_FILE)
-/* end-GG-local */
-
-/* Don't use any specific register allocation order. */
-#undef REG_ALLOC_ORDER
diff --git a/m68k-unknown-amigaos/recipes/files/gcc/gcc/config/m68k/host-amigaos.c b/m68k-unknown-amigaos/recipes/files/gcc/gcc/config/m68k/host-amigaos.c
deleted file mode 100644
index aec68d0..0000000
--- a/m68k-unknown-amigaos/recipes/files/gcc/gcc/config/m68k/host-amigaos.c
+++ /dev/null
@@ -1,42 +0,0 @@
-/* AmigaOS/m68k host-specific hook definitions.
- Copyright (C) 2003 Free Software Foundation, Inc.
-
-This file is part of GCC.
-
-GCC 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, or (at your option) any later
-version.
-
-GCC 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 GCC; see the file COPYING. If not, write to the Free
-Software Foundation, 59 Temple Place - Suite 330, Boston, MA
-02111-1307, USA. */
-
-
-#include "config.h"
-#include "system.h"
-#include "coretypes.h"
-#include "hosthooks.h"
-#include "hosthooks-def.h"
-#include "toplev.h"
-
-static void * amigaos_m68k_gt_pch_get_address (size_t);
-
-/* Return the address of the PCH address space, if the PCH will fit in it. */
-
-static void *
-amigaos_m68k_gt_pch_get_address (size_t sz ATTRIBUTE_UNUSED)
-{
- fatal_error ("PCH not supported\n");
-}
-
-#undef HOST_HOOKS_GT_PCH_GET_ADDRESS
-#define HOST_HOOKS_GT_PCH_GET_ADDRESS amigaos_m68k_gt_pch_get_address
-
-const struct host_hooks host_hooks = HOST_HOOKS_INITIALIZER;
diff --git a/m68k-unknown-amigaos/recipes/files/gcc/gcc/config/m68k/t-amigaos b/m68k-unknown-amigaos/recipes/files/gcc/gcc/config/m68k/t-amigaos
deleted file mode 100644
index 085de81..0000000
--- a/m68k-unknown-amigaos/recipes/files/gcc/gcc/config/m68k/t-amigaos
+++ /dev/null
@@ -1,30 +0,0 @@
-# Makefile fragment for AmigaOS target.
-
-# Extra object file linked to the cc1* executables.
-amigaos.o: $(srcdir)/config/m68k/amigaos.c $(CONFIG_H)
- $(CC) -c $(ALL_CFLAGS) $(ALL_CPPFLAGS) $(INCLUDES) $< $(OUTPUT_OPTION)
-
-# Additional target dependent options for compiling libgcc.a. This just
-# ensures that we don't compile libgcc* with anything other than a
-# fixed stack.
-
-TARGET_LIBGCC2_CFLAGS = -mfixedstack
-
-# Support for building multiple version of libgcc.
-
-LIBGCC_MULTI = .; \
- libb;@fbaserel \
- libm020;@m68020 \
- libb/libm020;@fbaserel@m68020 \
- libb32/libm020;@fbaserel32@m68020
-
-### begin-GG-local: dynamic libraries
-# Extra objects that get compiled and linked to collect2
-
-EXTRA_COLLECT2_OBJS = amigacollect2.o
-
-# Build supplimentary AmigaOS target support file for collect2
-amigacollect2.o: amigacollect2.c
- $(CC) -c $(ALL_CFLAGS) $(ALL_CPPFLAGS) $(INCLUDES) \
- -DA2IXDIR_PREFIX=\"$(prefix)/share/a2ixlibrary\" $< $(OUTPUT_OPTION)
-### end-GG-local
diff --git a/m68k-unknown-amigaos/recipes/files/gcc/gcc/config/m68k/x-amigaos b/m68k-unknown-amigaos/recipes/files/gcc/gcc/config/m68k/x-amigaos
deleted file mode 100644
index 4409fc5..0000000
--- a/m68k-unknown-amigaos/recipes/files/gcc/gcc/config/m68k/x-amigaos
+++ /dev/null
@@ -1,104 +0,0 @@
-# Makefile fragment for AmigaOS host
-
-# Each compilation environment (Manx, Dice, GCC, SAS/C, etc) provides its
-# own equivalent of the UNIX /usr/include tree. For gcc, the standard headers
-# are in /gg/include and system specific headers are in /gg/os-include.
-# Use these paths for fixincludes.
-
-SYSTEM_HEADER_DIR = $(prefix)/include
-
-# Uncomment the following macro to get a resident GCC. We don't do it
-# by default, since we want to support users with mc68000.
-# WARNING! If you uncomment this, you MUST add the same flags to the
-# libiberty's Makefile (libiberty is now linked into GCC executables).
-
-#RESIDENT = -m68020 -resident32
-
-# Additional host flags that are not used when compiling with GCC_FOR_TARGET,
-# such as when compiling the libgcc* runtime archives. GCC uses stack
-# a lot, and since AmigaOS provides processes with a small, fixed size
-# stack, we have to generate code that will extend it whenever necessary.
-
-XCFLAGS = -mstackextend $(RESIDENT)
-
-# AmigaOS supports "AmigaGuide(R)" hypertext files. For GCC, these are
-# build with a custom "makeinfo".
-
-# Arrange for guides to be build with GCC, in the build directory.
-
-### begin-GG-local: gcc-amigaos
-#EXTRA_DOC_TARGETS = guide gcc-amigaos-doc
-### end-GG-local
-
-# Actually build guides
-
-guide:: doc/cpp.guide doc/gcc.guide doc/gccint.guide \
- doc/gccinstall.guide doc/cppinternals.guide
-
-doc/cpp.guide: $(TEXI_CPP_FILES)
-doc/gcc.guide: $(TEXI_GCC_FILES)
-doc/gccint.guide: $(TEXI_GCCINT_FILES)
-doc/cppinternals.guide: $(TEXI_CPPINT_FILES)
-
-doc/%.guide: %.texi
- if [ x$(BUILD_INFO) = xinfo ]; then \
- $(MAKEINFO) --amiga $(MAKEINFOFLAGS) -I $(docdir) \
- -I $(docdir)/include -o $@ $<; \
- fi
-
-# Duplicate entry to handle renaming of gccinstall.guide
-doc/gccinstall.guide: $(TEXI_GCCINSTALL_FILES)
- if [ x$(BUILD_INFO) = xinfo ]; then \
- $(MAKEINFO) --amiga $(MAKEINFOFLAGS) -I $(docdir) \
- -I $(docdir)/include -o $@ install.texi; \
- fi
-
-# Arrange for guides to be installed with GCC.
-
-### begin-GG-local: gcc-amigaos
-#EXTRA_INSTALL_TARGETS = install-guide install-gcc-amigaos-doc
-### end-GG-local
-
-# Where the guide files go
-
-guidedir = $(prefix)/guide
-
-# Actually install guides.
-
-installdirs-guide:
- $(SHELL) ${srcdir}/mkinstalldirs $(DESTDIR)$(guidedir)
-
-install-guide: doc installdirs-guide \
- $(DESTDIR)$(guidedir)/cpp.guide \
- $(DESTDIR)$(guidedir)/gcc.guide \
- $(DESTDIR)$(guidedir)/cppinternals.guide \
- $(DESTDIR)$(guidedir)/gccinstall.guide \
- $(DESTDIR)$(guidedir)/gccint.guide
-
-$(DESTDIR)$(guidedir)/%.guide: doc/%.guide installdirs-guide
- rm -f $@
- if [ -f $< ]; then \
- for f in $(<)*; do \
- realfile=`echo $$f | sed -e 's|.*/\([^/]*\)$$|\1|'`; \
- $(INSTALL_DATA) $$f $(DESTDIR)$(guidedir)/$$realfile; \
- chmod a-x $(DESTDIR)$(guidedir)/$$realfile; \
- done; \
- else true; fi
-
-### begin-GG-local: gcc-amigaos
-# Build and install gcc-amigaos.guide - documentation specific to the
-# AmigaOS port of GCC.
-
-gcc-amigaos-doc:: doc/gcc-amigaos.info doc/gcc-amigaos.guide
-
-doc/gcc-amigaos.info doc/gcc-amigaos.guide: gcc-amigaos.texi
-
-install-gcc-amigaos-doc: doc installdirs installdirs-guide \
- $(DESTDIR)$(infodir)/gcc-amigaos.info \
- $(DESTDIR)$(guidedir)/gcc-amigaos.guide
-### end-GG-local
-
-host-amigaos.o : $(srcdir)/config/m68k/host-amigaos.c $(CONFIG_H) $(SYSTEM_H) \
- coretypes.h hosthooks.h hosthooks-def.h toplev.h diagnostic.h
- $(CC) -c $(ALL_CFLAGS) $(ALL_CPPFLAGS) $(INCLUDES) \
- $(srcdir)/config/m68k/host-amigaos.c
diff --git a/m68k-unknown-amigaos/recipes/files/gcc/gcc/config/m68k/xm-amigaos.h b/m68k-unknown-amigaos/recipes/files/gcc/gcc/config/m68k/xm-amigaos.h
deleted file mode 100644
index 8b1a3d6..0000000
--- a/m68k-unknown-amigaos/recipes/files/gcc/gcc/config/m68k/xm-amigaos.h
+++ /dev/null
@@ -1,64 +0,0 @@
-/* Configuration for GNU C-compiler for m68k Amiga, running AmigaOS.
- Copyright (C) 1992, 1993, 1994, 1995, 1996, 1997, 1998, 2003
- Free Software Foundation, Inc.
- Contributed by Markus M. Wild (wild(a)amiga.physik.unizh.ch).
-
-This file is part of GCC.
-
-GCC 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, or (at your option)
-any later version.
-
-GCC 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 GCC; see the file COPYING. If not, write to
-the Free Software Foundation, 59 Temple Place - Suite 330,
-Boston, MA 02111-1307, USA. */
-
-#ifndef _FCNTL_H_
-#include <fcntl.h>
-#endif
-
-/* AmigaOS specific headers, such as from the Native Developer Update kits,
- go in SYSTEM_INCLUDE_DIR. STANDARD_INCLUDE_DIR is the equivalent of
- Unix "/usr/include". All other include paths are set in Makefile. */
-
-#define SYSTEM_INCLUDE_DIR "/gg/os-include"
-#define STANDARD_INCLUDE_DIR "/gg/include"
-
-#define STANDARD_EXEC_PREFIX_1 "/gg/libexec/gcc/"
-#define STANDARD_EXEC_PREFIX_2 "/gg/lib/gcc/"
-#define STANDARD_STARTFILE_PREFIX_1 "/gg/lib/"
-#define STANDARD_STARTFILE_PREFIX_2 "/gg/lib/"
-
-/* The AmigaOS stores file names with regard to upper/lower case, but actions
- on existing files are case independent on the standard filesystems.
-
- A good example of where this causes problems is the conflict between the C
- include file <string.h> and the C++ include file <String.h>, where the C++
- include file dir is searched first and thus causes includes of <string.h>
- to include <String.h> instead.
-
- In order to solve this problem we define the macro OPEN_CASE_SENSITIVE as
- the name of the function that takes the same args as open() and does case
- dependent opens. */
-
-#define OPEN_CASE_SENSITIVE(NAME, FLAGS, MODE) open ((NAME), (FLAGS) | O_CASE, (MODE))
-
-/* On the AmigaOS, there are two pathname separators, '/' (DIR_SEPARATOR)
- and ':' (VOL_SEPARATOR). DIR_SEPARATOR defaults to the correct
- character, so we don't have to explicitly set it. */
-
-#define DIR_SEPARATOR '/'
-#define VOL_SEPARATOR ':'
-#define DIR_SEPARATOR_2 VOL_SEPARATOR
-
-/* Zap PREFIX_INCLUDE_DIR, since with the AmigaOS port it is the same as
- STANDARD_INCLUDE_DIR. */
-
-#undef PREFIX_INCLUDE_DIR
diff --git a/m68k-unknown-amigaos/recipes/files/gcc/gcc/doc/gcc-amigaos.texi b/m68k-unknown-amigaos/recipes/files/gcc/gcc/doc/gcc-amigaos.texi
deleted file mode 100644
index 481c676..0000000
--- a/m68k-unknown-amigaos/recipes/files/gcc/gcc/doc/gcc-amigaos.texi
+++ /dev/null
@@ -1,1116 +0,0 @@
-\input texinfo.tex @c -*-texinfo-*-
-@c %**start of header
-@setfilename gcc-amigaos.info
-@settitle AmigaOS-only features of GCC
-@set lastupdate Nov 5th, 2003
-@c %**end of header
-
-@ifinfo
-This document describes implementation specific features of the GCC
-compiler collection port for the AmigaOS.
-
-@copying
-Copyright @copyright{} 1996, 1997 Kamil Iskra
-
-Permission is granted to make and distribute verbatim copies of this
-manual provided the copyright notice and this permission notice are
-preserved on all copies.
-@end copying
-@end ifinfo
-
-@titlepage
-@sp 10
-@center @titlefont{GCC Amiga}
-@subtitle Description of the AmigaOS-only features of GCC
-@subtitle @value{lastupdate}
-@author Kamil Iskra
-@page
-@end titlepage
-
-@ifinfo
-@node Top, Introduction, (dir), (dir)
-This document describes the AmigaOS-only features of the @samp{GCC}
-compiler collection.
-
-Last updated @value{lastupdate}.
-@end ifinfo
-
-@menu
-* Introduction:: Purpose of this document.
-
-* Invocation:: Command line options.
-* Attributes:: Variable and function attributes.
-* Defines:: Preprocessor symbols.
-* Miscellaneous:: Uncategorizable.
-
-* Index:: Concept index.
-@end menu
-
-@node Introduction, Invocation, Top, Top
-@chapter Introduction
-@cindex Introduction
-@cindex Purpose of this document
-
-This document is supposed to be an addendum to the baseline @samp{GCC}
-documentation.
-Note that given email addresses and urls might be obsolete!
-
-It focuses on the features that are visible by users and are important
-to them. It is not supposed to document the internals of the AmigaOS
-port of @samp{GCC}.
-
-It describes features implemented in the @samp{Geek Gadgets GCC} port.
-For more information about @samp{Geek Gadgets}, please refer to:
-
-@format
-http://www.geekgadgets.org/
-ftp://ftp.geekgadgets.org/pub/geekgadgets/README
-@end format
-
-This document focuses on @samp{GCC}. It does not describe the
-AmigaOS-only features of other @samp{GNU} packages, such as
-@samp{binutils}, unless they are very closely connected to @samp{GCC}.
-
-This means, that, unless stated otherwise, when we talk about the
-``compiler'', we mean the @file{gcc}, @file{cpp} and @file{cc1}
-executables, i.e., the executables that convert @samp{C} source code
-to assembly source code. The assembler and linker are generally beyond
-the scope of this document.
-
-The primary source of information used to create this document was the
-@samp{GCC} source code. Some parts of this document are based on:
-
-@itemize @bullet
-@item
-The @samp{LibNIX} manual, written by Matthias Fleischer and Gunther
-Nikl:
-
-@format
-fleischr@@izfm.uni-stuttgart.de
-gnikl@@informatik.uni-rostock.de
-@end format
-
-@item
-The @samp{A2IXLibrary} manual, written by Hans Verkuil:
-
-@format
-hans@@wyst.hobby.nl
-@end format
-
-@item
-The @samp{README} file, maintained by Rask Ingemann Lambertsen:
-
-@format
-gc948374@@gbar.dtu.dk
-http://www.gbar.dtu.dk/~c948374/GNU/
-@end format
-
-@item
-The @samp{Geek Gadgets FAQ}, maintained by Lynn Winebarger:
-
-@format
-owinebar@@indiana.edu
-http://nickel.ucs.indiana.edu/~owinebar/interests/amiga/amiga.html
-@end format
-
-@item
-The @samp{FAQ for g++ and libg++}, written by Joe Buck:
-
-@format
-jbuck@@synopsys.com
-http://www.cygnus.com/misc/g++FAQ_toc.html
-@end format
-
-@item
-Discussions on the @samp{Geek Gadgets} mailing list:
-
-@format
-gg@@geekgadgets.org
-@end format
-@end itemize
-
-This document was created by Kamil Iskra. Please email any questions,
-suggestions etc. to <iskra@@student.uci.agh.edu.pl> or, even better,
-to the <gg@@geekgadgets.org> mailing list.
-
-The author would like to thank Kriton Kyrimis <kyrimis@@cti.gr> and
-Lars Hecking <lhecking@@nmrc.ucc.ie> for correcting an awful lot of
-language mistakes in this document.
-
-@node Invocation, Attributes, Introduction, Top
-@chapter Invocation
-@cindex Invocation
-@cindex Command line options
-
-The AmigaOS port of @samp{GCC} supports the following non-standard
-command line options:
-
-@menu
-* -noixemul:: Link with @samp{LibNIX}.
-
-* -fbaserel:: Produce @samp{a4}-relative data.
-* -resident:: Produce a @samp{pure} executable.
-* -fbaserel32:: Produce @samp{a4}-relative data with no size limits.
-* -resident32:: Produce a @samp{pure} executable with no size limits.
-* -msmall-code:: Produce @samp{PC}-relative code.
-
-* -mstackcheck:: Produce stack-checking code.
-* -mstackextend:: Produce stack-extending code.
-* -mfixedstack:: Produce plain code.
-
-* -mrestore-a4:: Reload @samp{a4} in public functions.
-* -malways-restore-a4:: Reload @samp{a4} in all functions.
-
-* -mregparm:: Pass function arguments in registers.
-
-* -frepo:: Enable @samp{C++} Template Repository.
-@end menu
-
-Accordingly, the AmigaOS port of @samp{GCC} supports several flavors
-of linker libraries. @xref{Library flavors, Relation between library
-flavors and compile-time options}.
-
-@node -noixemul, -fbaserel, Invocation, Invocation
-@section -noixemul
-@cindex -noixemul
-@cindex Link with LibNIX
-
-@cindex IXEmul
-By default, the executables created with @samp{GCC} require
-(a)samp{ixemul.library} to run. This has its advantages (easy porting of
-@samp{UN*X} programs, resource tracking, debugging, profiling, etc)
-and disadvantages (@samp{UN*X}-style pathnames, large shared library,
-etc).
-
-@cindex LibNIX
-If @samp{-noixemul} is specified on the @samp{GCC} command line, the
-executable created will not require @samp{ixemul.library} --- it will
-use the static linker library @samp{LibNIX} instead. This library is
-very Amiga-like and @samp{SAS/C}-like, so it is convenient for the
-AmigaOS-specific development.
-
-@quotation
-@emph{Note}: There is no great mystery about the @samp{-noixemul}
-option. It has absolutely no effect on the code generated by the
-compiler, only instructing the @samp{gcc} driver to pass different
-options to the linker and preprocessor (@pxref{Options information},
-@pxref{Library flavors}).
-
-This option has no negative form.
-@end quotation
-
-For more information, please refer to the @samp{LibNIX} documentation.
-
-@node -fbaserel, -resident, -noixemul, Invocation
-@section -fbaserel
-@cindex -fbaserel
-@cindex Produce a4-relative data
-
-By default, the code generated by @samp{GCC} references data using
-32-bit, absolute addressing.
-
-@cindex a4
-@cindex 64 KB data limit
-The @samp{-fbaserel} option will make @samp{GCC} generate code that
-references data with 16 bit offsets relative to the @samp{a4} address
-register. This makes executables smaller and faster. Unfortunately,
-the size of the data section cannot exceed 64 KB, so this option
-cannot be used for large programs, like @samp{GCC} itself.
-
-@quotation
-@emph{Note}: For a base-relative executable, @samp{-fbaserel} needs to
-be specified for compiling @emph{and} linking. Base-relative programs
-require special startup code and special versions of linker libraries.
-Since not all linker libraries are available in both plain and base
-relative versions, the usefulness of this option is limited. It is
-important to note that when the base-relative library is missing, the
-linker will attempt to use the plain one. This might result in strange
-link-time or even run-time errors.
-
-@cindex -fpic
-This option is the AmigaOS equivalent of the standard @samp{GCC}
-option @samp{-fpic}, which is not supported by the AmigaOS port.
-@samp{-fpic} generates code that references data indirectly, through a
-@dfn{global offset table}. The special addressing modes available on
-the @samp{m68k} processor family allow for a much more efficient
-implementation with @samp{-fbaserel}.
-
-The negative form of @samp{-fbaserel} is @samp{-fno-baserel}, and is
-on by default.
-@end quotation
-
-For more information, please refer to the @samp{LibNIX} documentation.
-
-@node -resident, -fbaserel32, -fbaserel, Invocation
-@section -resident
-@cindex -resident
-@cindex Produce a pure executable
-
-Executables produced with the @samp{-resident} option are @dfn{pure},
-so they can be made @dfn{resident} using the AmigaShell
-@samp{resident} command. @samp{resident} executables are loaded to
-memory just once, and several concurrent instances share the code
-section.
-
-@quotation
-@emph{Note}: The compiler generates the same code for @samp{-resident}
-as for @samp{-fbaserel} (@pxref{-fbaserel}). Only the linking stage is
-different (special startup code is linked).
-
-This option has no negative form.
-@end quotation
-
-For more information, please refer to the @samp{LibNIX} documentation.
-
-@node -fbaserel32, -resident32, -resident, Invocation
-@section -fbaserel32
-@cindex -fbaserel32
-@cindex Produce a4-relative data with no size limits
-
-The difference between the @samp{-fbaserel32} and @samp{-fbaserel}
-options (@pxref{-fbaserel}) is the same as between the standard
-@samp{GCC} options @samp{-fPIC} and @samp{-fpic}.
-
-Code generated with @samp{-fbaserel32} references data with 32 bit
-offsets relative to the @samp{a4} address register. In contrast to the
-@samp{-fbaserel} (@pxref{-fbaserel}) option, there is no 64 KB size
-limit. Unfortunately, the addressing modes with 32 bit offsets are
-only available on 68020 and higher processors. Therefore, it is
-necessary to specify @samp{-m68020} or higher to use this option.
-
-@quotation
-@emph{Note}: This option used to be called @samp{-flarge-baserel}
-before @samp{Geek Gadgets} snapshot @samp{970109}. Since it was not
-functional then, this should not cause any compatibility problems.
-
-The negative form of @samp{-fbaserel32} is @samp{-fno-baserel32}, and
-is on by default.
-@end quotation
-
-@node -resident32, -msmall-code, -fbaserel32, Invocation
-@section -resident32
-@cindex -resident32
-@cindex Produce a pure executable with no size limits
-
-This option is an improved version of @samp{-resident}
-(@pxref{-resident}) --- it does not impose any limits on data section
-size. Unfortunately, just like @samp{-fbaserel32}
-(@pxref{-fbaserel32}), it is only available for 68020 or higher
-processors. Therefore, it is necessary to specify @samp{-m68020} or
-higher to use this option.
-
-@quotation
-@emph{Note}: This option was first made available in the @samp{GCC}
-2.7.2.1, @samp{Geek Gadgets} snapshot @samp{970109}.
-
-This option has no negative form.
-@end quotation
-
-@node -msmall-code, -mstackcheck, -resident32, Invocation
-@section -msmall-code
-@cindex -msmall-code
-@cindex Produce PC-relative code
-
-By default, the code generated by the compiler references functions
-using 32-bit, absolute addressing.
-
-@cindex 32 KB code limit
-Code generated by @samp{GCC} with the @samp{-msmall-code} option
-references symbols in the code section with 16 bit offsets, relative
-to the @samp{PC} (@dfn{program counter}). This makes executables
-smaller and faster. Unfortunately, the size of the code section is
-generally limited to 32 KB, so this option can only be used for
-relatively small programs.
-
-@quotation
-@emph{Note}: Actually, the compiler always generates 32-bit code
-references. If the assembler can calculate the offset between the
-referencing instruction and the referenced symbol (in other words, if
-the referenced symbol is in the same source file), it replaces the
-32-bit reference with the @samp{PC}-relative one. External references
-are left intact, unless @samp{-msmall-code} is used, in which case the
-assembler generates @samp{PC}-relative references, and the exact
-offsets are calculated by the linker.
-
-This option has no negative form.
-@end quotation
-
-For more information, please refer to the @samp{LibNIX} documentation.
-
-@node -mstackcheck, -mstackextend, -msmall-code, Invocation
-@section -mstackcheck
-@cindex -mstackcheck
-@cindex Produce stack-checking code
-
-By default, the code generated by @samp{GCC} does not check if there
-is enough stack available before performing stack-consuming
-operations. This is generally not necessary on @samp{UN*X} systems,
-where the stack is extended automagically whenever needed.
-
-Unfortunately, the AmigaOS provides tasks with a static, fixed size
-stack.
-
-However, if a program is compiled with @samp{-mstackcheck}, it will
-check if there is enough stack available before performing any
-stack-hungry operations. If there is a danger of stack overflow, the
-program will abort and the user will be notified.
-
-Needless to say, stack checking increases the executable size and the
-execution time.
-
-@quotation
-@emph{Note}: Stack checking cannot be used for functions that might be
-called from outside your task. This includes interrupt handlers,
-shared library functions, hooks etc. In such cases, you should either
-avoid using @samp{-mstackcheck} for files containing such functions,
-or use @code{__attribute__((interrupt))} (@pxref{interrupt}).
-
-It is safe to call a function that performs stack checking from one
-that does not, and vice versa.
-
-The negative form of @samp{-mstackcheck} is @samp{-mno-stackcheck},
-and is on by default.
-
-@emph{Warning}: @samp{-mno-stackcheck} used to be called
-@samp{-mnostackcheck} before @samp{Geek Gadgets} snapshot
-@samp{961012}.
-@end quotation
-
-For more information, please refer to the @samp{LibNIX} documentation.
-
-@node -mstackextend, -mfixedstack, -mstackcheck, Invocation
-@section -mstackextend
-@cindex -mstackextend
-@cindex Produce stack-extending code
-
-@samp{-mstackextend} is very similar to @samp{-mstackcheck}
-(@pxref{-mstackcheck}).
-
-The main difference is that when a program runs out of stack, it is
-not aborted, but a new stack area is allocated and the program
-continues to run.
-
-@quotation
-@emph{Note}: Stack extension can slow down programs significantly. It
-is advised that programs are written in such a way that they do not
-require too much stack. This can generally be achieved by explicitly
-allocating memory for large structures and arrays using functions like
-@samp{malloc()} or @samp{AllocMem()}, instead of creating them as
-local variables. Another method is replacing recursion with iteration.
-In addition, it might be considered to use stack extension only for
-selected, ``dangerous'' functions (@pxref{stackext}), not for all
-functions in a given program.
-
-The negative form of @samp{-mstackextend} is @samp{-mno-stackextend},
-and is on by default.
-
-@emph{Warning}: @samp{-mno-stackextend} used to be called
-@samp{-mnostackextend} before @samp{Geek Gadgets} snapshot
-@samp{961012}.
-@end quotation
-
-For more information, please refer to the @samp{LibNIX} documentation.
-
-@node -mfixedstack, -mrestore-a4, -mstackextend, Invocation
-@section -mfixedstack
-@cindex -mfixedstack
-@cindex Produce plain code
-
-This option makes @samp{GCC} generate plain code, that does neither
-stack checking nor extension. Since this is the default, there is
-generally no need to use this option.
-
-@quotation
-@emph{Note}: This option has no negative form.
-@end quotation
-
-@node -mrestore-a4, -malways-restore-a4, -mfixedstack, Invocation
-@section -mrestore-a4
-@cindex -mrestore-a4
-@cindex Reload a4 in public functions
-
-This option is used to create the @samp{IXEmul} shared libraries
-(those @file{*.ixlibrary} files).
-
-It sets @samp{a4} to the appropriate value in the prologues of all
-public functions (i.e., functions with external linkage). This is
-necessary if these functions are called from the code of application.
-
-@quotation
-@emph{Note}: This option should not be used except for the creation of
-an @samp{IXEmul} shared library.
-
-This option was first made available in the @samp{GCC} 2.7.2,
-@samp{Geek Gadgets} snapshot @samp{960902}. It used to be called
-@samp{-frestore-a4}, and was relabeled to its current name in the
-@samp{GCC} 2.7.2.1, @samp{Geek Gadgets} snapshot @samp{961012}.
-
-The negative form of @samp{-mrestore-a4} is @samp{-mno-restore-a4},
-and is on by default.
-@end quotation
-
-For more information, please refer to the @samp{A2IXLibrary}
-documentation.
-
-@node -malways-restore-a4, -mregparm, -mrestore-a4, Invocation
-@section -malways-restore-a4
-@cindex -malways-restore-a4
-@cindex Reload a4 in all functions
-
-This option is very similar to @samp{-mrestore-a4}
-(@pxref{-mrestore-a4}).
-
-The only difference is that it sets @samp{a4} in all functions,
-including private ones (i.e., functions with internal linkage,
-@samp{static}). This is safer than @samp{-mrestore-a4}
-(@pxref{-mrestore-a4}), but is also slower.
-
-@quotation
-@emph{Note}: This option should not be used except for the creation of
-an @samp{IXEmul} shared library.
-
-This option was first made available in the @samp{GCC} 2.7.2,
-@samp{Geek Gadgets} snapshot @samp{960902}. It used to be called
-@samp{-falways-restore-a4}, and was relabeled to its current name in
-the @samp{GCC} 2.7.2.1, @samp{Geek Gadgets} snapshot @samp{961012}.
-
-The negative form of @samp{-malways-restore-a4} is
-@samp{-mno-always-restore-a4}, and is on by default.
-@end quotation
-
-For more information, please refer to the @samp{A2IXLibrary}
-documentation.
-
-@node -mregparm, -frepo, -malways-restore-a4, Invocation
-@section -mregparm
-@cindex -mregparm
-@cindex Pass function arguments in registers
-
-On the @samp{m68k} architecture, @samp{GCC} passes function arguments
-on the stack by default.
-
-@samp{-mregparm} allows for passing arguments in registers. This can
-be slightly faster than the standard method of passing arguments on
-the stack.
-
-The full syntax of this option is:
-
-@format
--mregparm[=<value>]
-@end format
-
-@samp{value} should be an integer ranging from 1 to 4. If no
-@samp{value} is provided, 2 will be used.
-
-Four types of function arguments are recognized:
-
-@table @samp
-@item Integer
-Integer numbers (this includes enumerations, small structures and
-@samp{bool} in @samp{C++}, but excludes @samp{long long}, which is too
-large). They are passed in data registers, starting from @samp{d0}.
-
-@item Pointer
-Pointers to objects or functions (this includes @samp{C++} references
-and the implicit @samp{this} argument). They are passed in address
-registers, starting from @samp{a0}.
-
-@item Float
-Floating point numbers. If the floating point code generation is
-enabled, they are passed in floating point registers, starting from
-@samp{fp0}. Otherwise, they are handled like the next type.
-
-@item Other
-All the other types of arguments, like large structures, pointers to
-class methods in @samp{C++}, etc. They are always passed on the stack.
-@end table
-
-The value given for @samp{-mregparm} indicates how many arguments of
-each of the above first three types should be passed in registers.
-
-Example: @samp{GCC} is invoked with @samp{-mregparm} (without any
-value, so 2 will be used) to compile a source containing the function:
-
-@example
-void fun(int a, char *str, char b, int c);
-@end example
-
-@samp{a} and @samp{b} will be passed in @samp{d0} and @samp{d1},
-respectively, @samp{str} will be passed in @samp{a0}, and @samp{c}
-will be passed on the stack.
-
-@quotation
-@emph{Note}: To use this option properly, it is very important that
-all sources are fully prototyped. There may be very serious problems
-if they are not, since @samp{GCC} will have to ``guess'' where to put
-arguments, potentially making a wrong decission. Example:
-
-@example
-[in file1.c]
-void f(void)
-@{
- g(0); /* Call to a function with no prototype. The argument
- will be put in d0, since it is an integer. */
-@}
-
-[in file2.c]
-void g(char *a) /* The argument is expected in a0, since it is
- a pointer. */
-@{
-@}
-@end example
-
-@samp{-Wimplicit -Wstrict-prototypes} should be used to ensure that
-there are no prototypes missing.
-
-In case of @samp{stdargs} functions, such as @samp{printf}, all
-arguments are passed on the stack.
-
-As of this writing, @samp{-mregparm} is supported by neither
-@samp{IXEmul} nor @samp{LibNIX}, so its usefulness is very limited.
-
-This option was first made available in the @samp{GCC} 2.7.2.1,
-@samp{Geek Gadgets} snapshot @samp{961012}.
-
-The negative form of @samp{-mregparm} is @samp{-mno-regparm}, and is
-on by default.
-@end quotation
-
-@node -frepo, , -mregparm, Invocation
-@section -frepo
-@cindex -frepo
-@cindex Enable C++ Template Repository
-
-The AmigaOS port of @samp{GCC} includes @samp{C++} @dfn{Template
-Repository} patch, so-called @samp{repo} patch.
-
-In order to activate it, please compile @samp{C++} source files with
-@samp{-frepo}. The compiler will not generate unnecessary
-@samp{template} code, and will create @samp{.rpo} files that contain
-information about @samp{template} symbols used in each source file.
-Afterwards, during linking stage, a special tool called
-@samp{collect2} will make sure that every required instantiation of
-each @samp{template} is linked into the executable, recompiling some
-source files if necessary.
-
-@quotation
-@emph{Note}: This option was first made available in the @samp{GCC}
-2.7.2.1, @samp{Geek Gadgets} snapshot @samp{970109}.
-
-This option is not specific to the AmigaOS port of
-@samp{GCC}, nevertheless it is not fully supported in the baseline
-sources.
-
-This patch has been created in Cygnus Support, a company that is a
-major contributor to the @samp{GNU} project. It has not been
-integrated into the baseline sources due to design disagreements.
-
-The negative form of @samp{-frepo} is @samp{-fno-repo}, and is on by
-default.
-@end quotation
-
-For more information, please refer to the @samp{G++ FAQ}.
-
-@node Attributes, Defines, Invocation, Top
-@chapter Attributes
-@cindex Attributes
-@cindex Variable and function attributes
-
-The following non-standard attributes are available in the AmigaOS
-port of @samp{GCC}:
-
-@menu
-Variable attributes:
-* chip:: Put object in @samp{chip} memory.
-
-Function attributes:
-* saveds:: Reload @samp{a4}.
-* interrupt:: Do not mess with the stack.
-* stackext:: Generate stack extension.
-* regparm:: Pass arguments in registers.
-* stkparm:: Pass arguments on the stack.
-@end menu
-
-@node chip, saveds, Attributes, Attributes
-@section chip
-@cindex chip
-@cindex Put object in chip memory
-
-Amiga hardware requires some data to be located in @samp{chip} memory.
-
-Typically, if an initialized buffer is required (containing a picture
-bitmap, for example), a plain, statically initialized buffer is used,
-and the data is copied into a dynamically allocated @samp{MEMF_CHIP}
-buffer.
-
-This is not necessary with the @samp{chip} attribute. If this
-attribute is specified for an initialized, static variable, it will be
-allocated in @samp{chip} memory automagically by the AmigaOS.
-
-A small example:
-
-@example
-UWORD __attribute__((chip)) bitmap1[] = @{ ... @};
-@end example
-
-@quotation
-@emph{Note}: For compatibility with other AmigaOS @samp{C} compilers,
-a preprocessor symbol @samp{__chip} is available, which expands to
-@code{__attribute__((chip))} (@pxref{Keyword macros}).
-
-All the @samp{chip} attribute does is specifying that data should go
-to a section called @samp{.datachip}. Therefore, the standard
-@samp{GCC} feature @code{__attribute__((section(".datachip")))} can be
-used instead.
-
-This attribute was first made available in the @samp{GCC} 2.7.2.1,
-@samp{Geek Gadgets} snapshot @samp{970328}.
-
-For proper operation, this attribute requires a special version of the
-assembler, which generates standard AmigaOS object files. This version
-is not yet available in @samp{Geek Gadgets} in binary form, since
-support for this object files format is not yet complete.
-@end quotation
-
-@format
-This attribute is not supported with @samp{GCC} 3.3 or newer!
-@end format
-
-@node saveds, interrupt, chip, Attributes
-@section saveds
-@cindex saveds
-@cindex Reload a4
-
-This attribute is ignored, unless base-relative data
-(@pxref{-fbaserel}) is compiled.
-
-To improve speed, programs compiled with the AmigaOS port of
-@samp{GCC} set the @samp{a4} register to the appropriate value only
-once, in the startup code. Code generated with the standard @samp{GCC}
-option @samp{-fpic}, in contrast, sets the @samp{a4} register in every
-function which references global data.
-
-This is only safe as long as all function calls are performed from
-within your own code. Things become ``tricky'' if callback functions,
-like the AmigaOS hooks, interrupt handlers etc. are used. If global
-data is referenced in such functions, @samp{a4} has to be set
-properly.
-
-This is exactly what the @samp{saveds} attribute does: it initializes
-@samp{a4} in the function prologue, and restores it to its original
-value in the function epilogue.
-
-@quotation
-@emph{Note}: For compatibility with other AmigaOS @samp{C} compilers,
-a preprocessor symbol @samp{__saveds} is available, which expands to
-@code{__attribute__((saveds))} (@pxref{Keyword macros}).
-
-Please do not use this attribute in pure executables
-(@pxref{-resident}, @pxref{-resident32}). This is because several
-invocations of pure executables can run concurrently, each one having
-its own data section, and there is no way to find out to which of
-these sections should @samp{a4} be set.
-
-The @samp{saveds} attribute is not necessary in function declarations
-(prototypes).
-@end quotation
-
-This attribute was first made available in the @samp{GCC} 2.7.2.1,
-@samp{Geek Gadgets} snapshot @samp{961012}.
-
-@node interrupt, stackext, saveds, Attributes
-@section interrupt
-@cindex interrupt
-@cindex Do not mess with the stack
-
-This attribute should be used for any kind of callback functions that
-can be called from outside your task. This includes interrupt
-handlers, shared library functions, etc.
-
-Most often, the @samp{interrupt} attribute is only necessary if a
-program is compiled with stack checking or extension
-(@pxref{-mstackcheck}, @pxref{-mstackextend}). It will prevent the
-compiler from generating stack checking or extension code for the
-function it was specified for.
-
-Additionally, it will set @samp{CC} (@dfn{condition codes register})
-in the function epilogue to return value, by performing @code{tstl
-d0}.
-
-@quotation
-@emph{Note}: For compatibility with other AmigaOS @samp{C} compilers,
-a preprocessor symbol @samp{__interrupt} is available, which expands
-to @code{__attribute__((interrupt))} (@pxref{Keyword macros}).
-
-The @samp{interrupt} attribute is mutually exclusive with the
-@samp{stackext} attribute (@pxref{stackext}).
-
-This attribute is not necessary in function declarations (prototypes).
-@end quotation
-
-This attribute was first made available in the @samp{GCC} 2.7.2.1,
-@samp{Geek Gadgets} snapshot @samp{961012}.
-
-@node stackext, regparm, interrupt, Attributes
-@section stackext
-@cindex stackext
-@cindex Generate stack extension
-
-This attribute makes @samp{GCC} generate stack extension code for the
-function for which it was used (@pxref{-mstackextend}). This makes it
-possible to use stack extension selectively, only for the
-``dangerous'' functions --- recursive functions, functions with large
-local variables, etc.
-
-@quotation
-@emph{Note}: For compatibility with other AmigaOS @samp{C} compilers,
-a preprocessor symbol @samp{__stackext} is available, which expands to
-@code{__attribute__((stackext))} (@pxref{Keyword macros}).
-
-The @samp{stackext} attribute is mutually exclusive with the
-@samp{interrupt} attribute (@pxref{interrupt}).
-
-This attribute is not necessary in function declarations (prototypes).
-@end quotation
-
-This attribute was first made available in the @samp{GCC} 2.7.2.1,
-@samp{Geek Gadgets} snapshot @samp{961012}.
-
-@node regparm, stkparm, stackext, Attributes
-@section regparm
-@cindex regparm
-@cindex Pass arguments in registers
-
-The @samp{regparm} attribute, together with the @samp{stkparm}
-attribute (@pxref{stkparm}), can be used to fine-tune the way
-arguments are passed. It makes @samp{GCC} pass arguments in registers
-for the function for which it was used, regardless of whether the
-global @samp{-mregparm} option was used or not (@pxref{-mregparm}).
-
-An optional integer argument ranging from 1 to 4 indicates how many
-arguments of each type should be passed in registers
-(@pxref{-mregparm}). The syntax is the following:
-
-@example
-void __attribute__((regparm(3))) fun(int a, char *str, char b, int c);
-@end example
-
-This will make @samp{GCC} pass @samp{a}, @samp{b} and @samp{c} in
-@samp{d0}, @samp{d1} and @samp{d2}, respectively, and @samp{str} in
-@samp{a0}.
-
-If the argument is not provided, the value given for @samp{-mregparm}
-will be used (or 2 if that option was not specified,
-@pxref{-mregparm}).
-
-@quotation
-@emph{Note}: There is generally no need to use this attribute unless
-files compiled with different calling conventions are linked together.
-
-For compatibility with other AmigaOS @samp{C} compilers, a
-preprocessor symbol @samp{__regargs} is available, which expands to
-@code{__attribute__((regparm))} (@pxref{Keyword macros}).
-
-The @samp{regparm} attribute is mutually exclusive with the
-@samp{stkparm} attribute (@pxref{stkparm}).
-
-This attribute is necessary both in function declarations (prototypes)
-and definitions (function code).
-@end quotation
-
-This attribute was first made available in the @samp{GCC} 2.7.2.1,
-@samp{Geek Gadgets} snapshot @samp{961012}.
-
-@node stkparm, , regparm, Attributes
-@section stkparm
-@cindex stkparm
-@cindex Pass arguments on the stack
-
-The @samp{stkparm} attribute, together with the @samp{regparm}
-attribute (@pxref{regparm}), can be used to fine-tune the way
-arguments are passed. It makes @samp{GCC} pass arguments on stack for
-the function for which it was used, regardless of whether the global
-@samp{-mregparm} option was used or not (@pxref{-mregparm}).
-
-@quotation
-@emph{Note}: There is generally no need to use this attribute unless
-files compiled with different calling conventions are linked together.
-
-For compatibility with other AmigaOS @samp{C} compilers, a
-preprocessor symbol @samp{__stdargs} is available, which expands to
-@code{__attribute__((stkparm))} (@pxref{Keyword macros}).
-
-The @samp{stkparm} attribute is mutually exclusive with the
-@samp{regparm} attribute (@pxref{regparm}).
-
-This attribute is necessary both in function declarations (prototypes)
-and definitions (function code).
-@end quotation
-
-This attribute was first made available in the @samp{GCC} 2.7.2.1,
-@samp{Geek Gadgets} snapshot @samp{961012}.
-
-@node Defines, Miscellaneous, Attributes, Top
-@chapter Defines
-@cindex Defines
-@cindex Preprocessor symbols
-
-The AmigaOS-specific preprocessor symbols available in @samp{GCC} can
-be divided into three groups:
-
-@menu
-* Identifying machine:: What machine is this?
-* Options information:: Which options have been specified?
-* Keyword macros:: Compatibility with other compilers.
-@end menu
-
-@node Identifying machine, Options information, Defines, Defines
-@section Symbols identifying machine
-@cindex Symbols identifying machine
-@cindex What machine is this
-
-The following machine-identifying preprocessor symbols are available:
-
-@table @samp
-@item mc68000
-This macro identifies the machine as having a CPU from the Motorola
-68000 family.
-
-@item amiga
-@item amigaos
-@item amigados
-These macros identify the machine as being an Amiga, running the
-AmigaOS.
-
-@item AMIGA
-@item MCH_AMIGA
-These macros are provided for compatibility with other AmigaOS
-@samp{C} compilers.
-@end table
-
-@quotation
-@emph{Note}: These symbols are available in three groups: plain (as
-specified above), with two leading underscores, and with two leading
-and two tailing underscores. The plain ones are not available when
-compiling with the @samp{-ansi} option.
-
-The @samp{amigados} symbol is obsolete and will be removed in future.
-Please use @samp{amigaos}, which was first made available in the
-@samp{GCC} 2.7.2.1, @samp{Geek Gadgets} snapshot @samp{961012}.
-@end quotation
-
-@node Options information, Keyword macros, Identifying machine, Defines
-@section Symbols identifying specified options
-@cindex Symbols identifying specified options
-@cindex Symbols identifying CPU
-@cindex Symbols identifying ixemul
-@cindex Which CPU model options have been specified
-
-@samp{GCC} has several options to choose the CPU model that the code
-should be generated for. The following preprocessor symbols identify
-which options have been specified on the command line:
-
-@table @samp
-@item mc68020
-Either one of @samp{-m68020}, @samp{-mc68020} or @samp{-mc68020-40}
-has been specified.
-
-@item mc68030
-@samp{-m68030} has been specified.
-
-@item mc68040
-@samp{-m68040} has been specified.
-
-@item mc68060
-@samp{-m68060} @emph{[EXPERIMENTAL]} has been specified.
-
-@item __HAVE_68881__
-@samp{-m68881} has been specified.
-@end table
-
-@quotation
-@emph{Note}: The symbols beginning with @samp{mc} are available in
-three groups: plain (as specified above), with two leading
-underscores, and with two leading and two tailing underscores. The
-plain ones are not available when compiling with the @samp{-ansi}
-option. The ``underscored'' ones were first made available in the
-@samp{GCC} 2.7.2.1, @samp{Geek Gadgets} snapshot @samp{970109}.
-
-@samp{mc68000} is defined regardless of which @samp{-m680x0} options
-have been used.
-@end quotation
-
-In addition to the above, a preprocessor symbol @samp{ixemul}
-(together with the ``underscored'' versions) is available when not
-compiling with @samp{-noixemul} (@pxref{-noixemul}) and identifies the
-runtime environment as @samp{IXEmul}. This symbol was first made
-available in the @samp{GCC} 2.7.2.1, @samp{Geek Gadgets} snapshot
-@samp{970328}.
-
-@node Keyword macros, , Options information, Defines
-@section ``Keyword'' macros
-@cindex Keyword macros
-@cindex Compatibility with other compilers
-
-Most AmigaOS-specific @samp{C} compilers have special ``custom
-keywords'', which make the AmigaOS-specific development easier.
-Unfortunately, the idea of ``custom keywords'' is not available in
-@samp{GCC}. However, @samp{attributes} are available, and they provide
-virtually identical functionality. For compatibility with other
-AmigaOS @samp{C} compilers, preprocessor symbols are provided, which
-expand to the appropriate @samp{attributes} (@pxref{Attributes}).
-
-@table @samp
-@item __chip
-@xref{chip}.
-
-@item __saveds
-@xref{saveds}.
-
-@item __interrupt
-@xref{interrupt}.
-
-@item __stackext
-@xref{stackext}.
-
-@item __regargs
-@xref{regparm}.
-
-@item __stdargs
-@xref{stkparm}.
-
-@item __aligned
-This expands to the standard @samp{GCC}
-@samp{__attribute__((aligned(4)))}.
-@end table
-
-@quotation
-@emph{Note}: With @samp{SAS/C}, these keywords may be specified either
-before or after the type, so the following declaration is correct:
-
-@example
-__saveds void func(void);
-@end example
-
-Unfortunately, the syntax rules of @samp{GCC} 2.7.2.1 do not allow to
-specify the attributes before the type, so the above example must be
-changed to:
-
-@example
-void __saveds func(void);
-@end example
-
-This will be fixed in @samp{GCC} 2.8.0.
-@end quotation
-
-@node Miscellaneous, Index, Defines, Top
-@chapter Miscellaneous
-@cindex Miscellaneous
-@cindex Uncategorizable
-
-The following ``hard to categorize'' features are available in the
-AmigaOS port of @samp{GCC}:
-
-@menu
-* Explicit register specification:: Specify registers for arguments.
-* Case sensitive CPP:: <String.h> is not the same as <string.h>
-* Library flavors:: Linker libraries.
-@end menu
-
-@node Explicit register specification, Case sensitive CPP, Miscellaneous, Miscellaneous
-@section Explicit register specification
-@cindex Explicit register specification
-@cindex Specify registers for arguments
-
-In certain situations, like writing callback hooks, ``patchers'',
-standard shared libraries, etc., functions have to receive arguments
-in particular registers.
-
-@samp{-mregparm} (@pxref{-mregparm}) is not appropriate in this case,
-since it does not give the programmer enough control on @emph{which}
-registers will be used.
-
-To overcome this problem in the AmigaOS port of @samp{GCC}, explicit
-register specification has been extended to be available for function
-arguments, as well:
-
-@example
-void myhook(struct Hook* hook __asm("a0"), APTR object __asm("a2"),
- APTR message __asm("a1"))
-@{
- ...
-@}
-@end example
-
-@quotation
-@emph{Note}: This feature is currently not available in @samp{G++}.
-
-Only the @samp{ANSI}-style declarations (prototypes) are supported.
-
-Registers have to be specified both in function declarations
-(prototypes) and definitions (function code).
-@end quotation
-
-This feature was first made available in the @samp{GCC} 2.7.2.1,
-@samp{Geek Gadgets} snapshot @samp{961012}.
-
-@node Case sensitive CPP, Library flavors, Explicit register specification, Miscellaneous
-@section Case sensitive CPP
-@cindex Case sensitive CPP
-@cindex <String.h> is not the same as <string.h>
-
-The preprocessor available in the AmigaOS port of @samp{GCC} is case
-sensitive. This means, that the header names provided in the
-@code{#include} directives have to be correct, including upper and
-lower case letters. This affects only the way the preprocessor works.
-Currently available native AmigaOS file systems are case insensitive.
-
-@quotation
-@emph{Note}: This might seem like a horrible hack and a crazy attempt
-to implement a ``ridiculous'' UNIX feature on Amiga. However, this
-feature has been introduced to terminate the endless @samp{G++}
-problems with a standard @samp{ANSI C} header @file{string.h}: under
-the AmigaOS, a @samp{C++} header @file{String.h} would be included,
-instead.
-@end quotation
-
-@node Library flavors, , Case sensitive CPP, Miscellaneous
-@section Library flavors
-@cindex Library flavors
-@cindex Linker libraries
-
-The AmigaOS port of @samp{GCC} may use different linker libraries
-depending upon the options used while invoking the compiler. These
-libraries reside in subdirectories of the standard locations, such as
-@file{GG:lib/} or, with @samp{GCC} 2.7.2.1,
-@file{GG:lib/gcc-lib/m68k-amigaos/2.7.2.1/}.
-
-If you invoke @code{gcc} with @samp{-v}, you'll see the precise flavor
-of libraries used as a @samp{-fl} option in the @code{ld} invocation.
-Here is a list of the available flavors (and hence the subdirectories
-names):
-
-@itemize @bullet
-@item
-@file{libb} corresponds to the @ref{-fbaserel} option.
-@item
-@file{libb32} corresponds to the @ref{-fbaserel32} option.
-@item
-@file{libm020} corresponds to the @samp{-m68020} (or higher) options.
-@item
-@file{libm881} corresponds to the @samp{-m68881} option.
-@item
-@file{libnix} corresponds to the @ref{-noixemul} option.
-@end itemize
-
-More than one flavor can be specified simultaneously. For example,
-when both @ref{-fbaserel} and @samp{-m68020} are specified, the
-libraries will be searched in @file{libb/libm020} subdirectory (as
-well as in @file{libb} subdirectory and in the standard location).
-
-@node Index, , Miscellaneous, Top
-@chapter Index
-@printindex cp
-
-@contents
-@bye
diff --git a/m68k-unknown-amigaos/recipes/patches/gcc/gcc6.p b/m68k-unknown-amigaos/recipes/patches/gcc/gcc6.p
index c3dcdb7..6979667 100644
--- a/m68k-unknown-amigaos/recipes/patches/gcc/gcc6.p
+++ b/m68k-unknown-amigaos/recipes/patches/gcc/gcc6.p
@@ -1,21596 +1,1499 @@
-From 64dc72223bfc308f487ea8c70c6f961075cd4f24 Mon Sep 17 00:00:00 2001
-From: bebbo <bebbo(a)bejy.net>
-Date: Thu, 1 Dec 2016 00:19:04 +0100
-Subject: [PATCH 001/303] @R add support for m68k-*-amiga
-
----
- gcc/Makefile.in | 2 +-
- gcc/amigacollect2.c | 348 ++++++++++++++++++
- gcc/c/c-decl.c | 78 ++++
- gcc/c/c-parser.c | 18 +-
- gcc/c/c-tree.h | 4 +
- gcc/calls.c | 2 +-
- gcc/collect2.c | 31 ++
- gcc/config.gcc | 10 +
- gcc/config/m68k/amigaos-protos.h | 58 +++
- gcc/config/m68k/amigaos.c | 773 +++++++++++++++++++++++++++++++++++++++
- gcc/config/m68k/amigaos.h | 490 +++++++++++++++++++++++++
- gcc/config/m68k/amigaos.opt | 13 +
- gcc/config/m68k/host-amigaos.c | 42 +++
- gcc/config/m68k/m68k.c | 30 +-
- gcc/config/m68k/m68k.h | 5 +
- gcc/config/m68k/m68k.md | 2 +
- gcc/config/m68k/m68kamigaos.h | 424 +++++++++++++++++++++
- gcc/config/m68k/m68kemb.h | 2 +
- gcc/config/m68k/t-amigaos | 30 ++
- gcc/config/m68k/x-amigaos | 104 ++++++
- gcc/config/m68k/xm-amigaos.h | 64 ++++
- gcc/expr.c | 2 +-
- gcc/function.c | 2 +-
- gcc/ipa-chkp.c | 2 +
- gcc/tree-chkp.c | 1 +
- gcc/var-tracking.c | 2 +-
- libstdc++-v3/configure | 4 +
- 27 files changed, 2533 insertions(+), 10 deletions(-)
- create mode 100755 gcc/amigacollect2.c
- create mode 100755 gcc/config/m68k/amigaos-protos.h
- create mode 100755 gcc/config/m68k/amigaos.c
- create mode 100755 gcc/config/m68k/amigaos.h
- create mode 100755 gcc/config/m68k/amigaos.opt
- create mode 100755 gcc/config/m68k/host-amigaos.c
- create mode 100755 gcc/config/m68k/m68kamigaos.h
- create mode 100755 gcc/config/m68k/t-amigaos
- create mode 100755 gcc/config/m68k/x-amigaos
- create mode 100755 gcc/config/m68k/xm-amigaos.h
-
-diff --git a/gcc/Makefile.in b/gcc/Makefile.in
-index 513f9c57013f..c1986279752f 100644
---- gcc/Makefile.in
-+++ gcc/Makefile.in
-@@ -1985,7 +1985,7 @@ gcc-nm.c: gcc-ar.c
- cp $^ $@
-
- COLLECT2_OBJS = collect2.o collect2-aix.o tlink.o vec.o ggc-none.o \
-- collect-utils.o file-find.o hash-table.o
-+ collect-utils.o file-find.o hash-table.o $(EXTRA_COLLECT2_OBJS)
- COLLECT2_LIBS = @COLLECT2_LIBS@
- collect2$(exeext): $(COLLECT2_OBJS) $(LIBDEPS)
- # Don't try modifying collect2 (aka ld) in place--it might be linking this.
-diff --git a/gcc/amigacollect2.c b/gcc/amigacollect2.c
+diff --git a/.cproject b/.cproject
new file mode 100755
-index 000000000000..941ea0248fbe
+index 000000000000..6db4cbe2447e
--- /dev/null
-+++ gcc/amigacollect2.c
-@@ -0,0 +1,348 @@
-+/* GG-local whole file: dynamic libraries */
-+/* Supplimentary functions that get compiled and linked to collect2 for
-+ AmigaOS target.
-+ Copyright (C) 1996 Free Software Foundation, Inc.
-+
-+This file is part of GCC.
-+
-+GCC 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, or (at your option)
-+any later version.
-+
-+GCC 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 GCC; see the file COPYING. If not, write to
-+the Free Software Foundation, 59 Temple Place - Suite 330,
-+Boston, MA 02111-1307, USA. */
-+
-+#include "config.h"
-+#include "system.h"
-+#include "coretypes.h"
-+#include "tm.h"
-+
-+/* From collect2.c: */
-+
-+void maybe_unlink(const char *);
-+void fatal_error(location_t, const char *, ...);
-+void fork_execute(const char *, char **, bool);
-+
-+extern char *c_file_name;
-+extern int debug;
-+
-+/* Local functions. */
-+
-+static void safename (char *);
-+static void add_lib (const char *);
-+static void cat (const char *, FILE *);
-+
-+/* Names of temporary files we create. */
-+#define XLIBS_C_NAME "xlibs.c"
-+#define XLIBS_O_NAME "xlibs.o"
-+#define SHARED_X_NAME "shared.x"
-+
-+/* Suffix which is prepended to "-l" options for dynamic libraries. */
-+#define DYNAMIC_LIB_SUFFIX "_ixlibrary"
-+
-+/* Structure that holds library names. */
-+struct liblist
-+{
-+ struct liblist *next;
-+ char *name;
-+ char *cname;
-+};
-+
-+/* Not zero if "-static" was specified on GCC command line or if all the
-+ libraries are static. */
-+static int flag_static=0;
-+
-+/* Not zero if linking a base relative executable. This is recognized by
-+ presence of "-m amiga_bss" on the linker's commandline. */
-+static int flag_baserel=0;
-+
-+/* Not zero if some of the specified libraries are dynamic. */
-+static int found_dynamic_libs=0;
-+
-+/* List of linker libraries. */
-+struct liblist *head = NULL;
-+
-+/* Return 1 if collect2 should do something more apart from tlink. We want it
-+ to call "postlink" and "strip" if linking with dynamic libraries. */
-+
-+int
-+amigaos_do_collecting (void)
-+{
-+ return !flag_static;
-+}
-+
-+/* Check for presence of "-static" on the GCC command line. We should not do
-+ collecting if this flag was specified. */
-+
-+void
-+amigaos_gccopts_hook (const char *arg)
-+{
-+ if (strncmp(arg, "-static", strlen("-static"))==0)
-+ flag_static=1;
-+}
-+
-+/* Replace unprintable characters with underscores. Used by "add_lib()". */
-+
-+static void
-+safename (char *p)
-+{
-+ if (!ISALPHA(*p))
-+ *p = '_';
-+ p++;
-+ while (*p)
-+ {
-+ if (!ISALNUM(*p))
-+ *p = '_';
-+ p++;
-+ }
-+}
-+
-+/* Add a library to the list of dynamic libraries. First make sure that the
-+ library is actually dynamic. Used by "amigaos_libname_hook()". */
-+
-+static void
-+add_lib (const char *name)
-+{
-+ struct liblist *lib;
-+ static char buf[256];
-+
-+ for (lib = head; lib; lib = lib->next)
-+ if (!strcmp(lib->name, name))
-+ return;
-+
-+ /* A2IXDIR_PREFIX is passed by "make". */
-+ sprintf(buf, A2IXDIR_PREFIX "/ldscripts/%s.x", name);
-+ if (access(buf, R_OK))
-+ return;
-+
-+ lib = (struct liblist*)xmalloc(sizeof(struct liblist));
-+ lib->name = xstrdup(name);
-+ lib->cname = xstrdup(name);
-+ safename(lib->cname);
-+ lib->next = head;
-+ head = lib;
-+
-+ if (debug)
-+ fprintf(stderr, "found dynamic library, name: %s, cname: %s\n", lib->name,
-+ lib->cname);
-+
-+ found_dynamic_libs=1;
-+}
-+
-+/* Check if the argument is a linker library. Call "add_lib()" if yes. */
-+
-+void
-+amigaos_libname_hook (const char *arg)
-+{
-+ int len = strlen(arg);
-+ if (flag_static)
-+ return;
-+
-+ if (len > 2 && !memcmp(arg, "-l", 2))
-+ add_lib(arg + 2);
-+ else if (len > 2 && !strcmp(arg + len - 2, ".a"))
-+ {
-+ const char *lib;
-+
-+ ((char*)arg)[len - 2] = '\0';
-+ lib = strrchr(arg, '/');
-+ if (lib == NULL)
-+ lib = strrchr(arg, ':');
-+ if (lib == NULL)
-+ lib = arg - 1;
-+ if (!strncmp(lib + 1, "lib", 3))
-+ add_lib(lib + 4);
-+ ((char *)arg)[len - 2] = '.';
-+ }
-+}
-+
-+/* Delete temporary files. */
-+
-+void
-+amigaos_collect2_cleanup (void)
-+{
-+ if (flag_static)
-+ return;
-+ maybe_unlink(XLIBS_C_NAME);
-+ maybe_unlink(XLIBS_O_NAME);
-+ maybe_unlink(SHARED_X_NAME);
-+}
-+
-+/* Copy file named by FNAME to X. */
-+
-+static void
-+cat (const char *fname, FILE *x)
-+{
-+#define BUFSIZE 16384
-+ FILE *in;
-+ static char buf[BUFSIZE];
-+ int bytes;
-+
-+ in = fopen(fname, "r");
-+ if (in == NULL)
-+ fatal_error (input_location, "%s", fname);
-+ while (!feof(in) && (bytes = fread(buf, 1, BUFSIZE, in)))
-+ fwrite(buf, 1, bytes, x);
-+ fclose(in);
-+}
-+
-+/* If no dynamic libraries were found, perform like "-static". Otherwise,
-+ create "xlibs.c", "shared.x" and invoke "gcc" to create "xlibs.o". We also
-+ have to adjust the linker commandline. */
-+
-+void
-+amigaos_prelink_hook (const char **ld1_argv, int *strip_flag)
-+{
-+ if (flag_static)
-+ return;
-+
-+ if (!found_dynamic_libs)
-+ {
-+ flag_static=1;
-+ /* If the user has not requested "-static", but has requested "-s",
-+ collect2 removes "-s" from the "ld1_argv", and calls "strip" after
-+ linking. However, this would not be efficient if we linked the
-+ executable without any dynamic library. In this case, we put "-s"
-+ back. */
-+ if (*strip_flag)
-+ {
-+ /* Add "-s" as the last argument on the command line. */
-+ while (*ld1_argv)
-+ ld1_argv++;
-+ *ld1_argv++="-s";
-+ *ld1_argv=0;
-+ *strip_flag=0;
-+ }
-+ }
-+ else
-+ {
-+ FILE *x, *out;
-+ struct liblist *lib;
-+ static const char* argv[]={0, "-c", XLIBS_C_NAME, 0};
-+ const char **ld1_end, **ld1;
-+
-+ /* Prepend suffixes to dynamic lib names. In addition, check if we are
-+ linking a base relative executable. */
-+ for (ld1=ld1_argv; *ld1; ld1++)
-+ {
-+ int len=strlen(*ld1);
-+ if (strncmp(*ld1, "-l", strlen("-l"))==0)
-+ {
-+ for (lib=head; lib; lib=lib->next)
-+ if (strcmp(*ld1+strlen("-l"), lib->name)==0)
-+ {
-+ char *newname=(char*)
-+ xmalloc(strlen(*ld1)+strlen(DYNAMIC_LIB_SUFFIX)+1);
-+ strcpy(newname, *ld1);
-+ strcat(newname, DYNAMIC_LIB_SUFFIX);
-+ *ld1=newname;
-+ break;
-+ }
-+ }
-+ else if (len > 2 && !strcmp(*ld1 + len - 2, ".a"))
-+ {
-+ const char *libname;
-+ int substituted=0;
-+
-+ ((char *)(*ld1))[len - 2] = '\0';
-+ libname = strrchr(*ld1, '/');
-+ if (libname == NULL)
-+ libname = strrchr(*ld1, ':');
-+ if (libname == NULL)
-+ libname = *ld1 - 1;
-+ if (!strncmp(libname + 1, "lib", 3))
-+ for (lib=head; lib; lib=lib->next)
-+ if (strcmp(libname+4, lib->name)==0)
-+ {
-+ char *newname=(char*)xmalloc(strlen(*ld1)+
-+ strlen(DYNAMIC_LIB_SUFFIX)+3);
-+ strcpy(newname, *ld1);
-+ strcat(newname, DYNAMIC_LIB_SUFFIX);
-+ strcat(newname, ".a");
-+ *ld1=newname;
-+ substituted=1;
-+ break;
-+ }
-+ if (!substituted)
-+ ((char *)(*ld1))[len - 2] = '.';
-+ }
-+ else if (strcmp(ld1[0], "-m")==0 && ld1[1]
-+ && strcmp(ld1[1], "amiga_bss")==0)
-+ {
-+ flag_baserel=1;
-+ break;
-+ }
-+ }
-+
-+ out = fopen(XLIBS_C_NAME, "w");
-+ if (out == NULL)
-+ fatal_error (input_location, "%s", XLIBS_C_NAME);
-+ x = fopen(SHARED_X_NAME, "w");
-+ if (x == NULL)
-+ fatal_error (input_location, "%s", SHARED_X_NAME);
-+
-+ cat((flag_baserel ? A2IXDIR_PREFIX "/amiga_exe_baserel_script.x"
-+ : A2IXDIR_PREFIX "/amiga_exe_script.x"), x);
-+ for (lib = head; lib; lib = lib->next)
-+ {
-+ static char buf[256];
-+ sprintf(buf, A2IXDIR_PREFIX "/ldscripts/%s.x", lib->name);
-+ fprintf(out, "extern long %sBase; long *__p%sBase = &%sBase;\n",
-+ lib->cname, lib->cname, lib->cname);
-+ cat(buf, x);
-+ } /* {{ */
-+ fprintf(x, "}}\n");
-+ fclose(out);
-+ fclose(x);
-+ argv[0]=c_file_name;
-+ fork_execute("gcc", (char **)argv, false);
-+
-+ /* Unfortunately, unlike "-s", "-T" cannot be specified as the last
-+ argument. We put it after "-L" args. */
-+ ld1_end=ld1_argv;
-+ while (*ld1_end)
-+ ld1_end++;
-+ ld1_end++;
-+ /* "ld1_end" now points after the terminating 0 of "ld1_argv". */
-+
-+ ld1=ld1_end-2;
-+ while (ld1>ld1_argv && strncmp(*ld1, "-L", strlen("-L")))
-+ ld1--;
-+ if (ld1==ld1_argv)
-+ fatal_error (input_location, "no -L arguments");
-+ ld1++;
-+ /* "ld1" now points after "-L". */
-+
-+ /* Shift all the arguments after "-L" one position right. */
-+ memmove(ld1+1, ld1, (ld1_end-ld1)*sizeof(*ld1));
-+ /* Put -Tshared.x in the now empty space. */
-+ *ld1="-T" SHARED_X_NAME;
-+ }
-+}
-+
-+/* Be lazy and just call "postlink". */
-+
-+void
-+amigaos_postlink_hook (const char *output_file)
-+{
-+ static const char *argv[]={"postlink", 0, 0, 0};
-+ if (flag_static)
-+ return;
-+
-+ if (flag_baserel)
-+ {
-+ argv[1]="-baserel";
-+ argv[2]=output_file;
-+ }
-+ else
-+ argv[1]=output_file;
-+ fork_execute("postlink", (char **)argv, false);
-+}
-diff --git a/gcc/c/c-decl.c b/gcc/c/c-decl.c
-index b237e93b927d..3107bdfac430 100644
---- gcc/c/c-decl.c
-+++ gcc/c/c-decl.c
-@@ -51,6 +51,8 @@ along with GCC; see the file COPYING3. If not see
- #include "c-family/c-ada-spec.h"
- #include "cilk.h"
- #include "builtins.h"
-+#include "output.h"
-+#include "tm_p.h"
-
- /* In grokdeclarator, distinguish syntactic contexts of declarators. */
- enum decl_context
-@@ -5024,6 +5026,29 @@ grokparm (const struct c_parm *parm, tree *expr)
- return decl;
- }
-
-+#ifdef TARGET_AMIGA
-+
-+/* Create a new variant of TYPE, equivalent but distinct.
-+ This is so the caller can modify it. */
-+
-+static tree
-+build_type_copy (tree type)
-+ {
-+ tree t, m = TYPE_MAIN_VARIANT (type);
-+
-+ t = copy_node (type);
-+
-+ TYPE_POINTER_TO (t) = 0;
-+ TYPE_REFERENCE_TO (t) = 0;
-+
-+ /* Add this type to the chain of variants of TYPE. */
-+ TYPE_NEXT_VARIANT (t) = TYPE_NEXT_VARIANT (m);
-+ TYPE_NEXT_VARIANT (m) = t;
-+
-+ return t;
-+ }
-+#endif
-+
- /* Given a parsed parameter declaration, decode it into a PARM_DECL
- and push that on the current scope. EXPR is a pointer to an
- expression that needs to be evaluated for the side effects of array
-@@ -5041,6 +5066,59 @@ push_parm_decl (const struct c_parm *parm, tree *expr)
-
- decl = pushdecl (decl);
-
-+#ifdef TARGET_AMIGAOS
-+ if (parm->asmspec)
-+ {
-+ tree atype = TREE_TYPE(decl);
-+ const char *asmspec = TREE_STRING_POINTER(parm->asmspec);
-+ if (*asmspec == '%')
-+ ++asmspec;
-+ int reg_number = decode_reg_name (asmspec);
-+
-+ /* First detect errors in declaring global registers. */
-+ if (reg_number == -1)
-+ error ("%Jregister name not specified for %qD", decl, decl);
-+ else if (reg_number < 0)
-+ error ("%Jinvalid register name for %qD", decl, decl);
-+ else if (TYPE_MODE (TREE_TYPE (decl)) == BLKmode)
-+ error ("%Jdata type of %qD isn%'t suitable for a register", decl, decl);
-+ else if (!HARD_REGNO_MODE_OK(reg_number, TYPE_MODE (TREE_TYPE (decl))))
-+ error ("%Jregister specified for %qD isn%'t suitable for data type",
-+ decl, decl);
-+ /* Now handle properly declared static register variables. */
-+ else
-+ {
-+ /* Build tree for __attribute__ ((asm(regnum))). */
-+ FIXED_VALUE_TYPE fv =
-+ { reg_number, 0, BImode };
-+ tree ttasm = get_identifier("asm");
-+ tree t, attrs = tree_cons(ttasm, build_fixed (ttasm, fv), NULL_TREE);
-+ /* First check whether such a type already exists - if yes, use
-+ that one. This is very important, since otherwise
-+ common_type() would think that it sees two different
-+ types and would try to merge them - this could result in
-+ warning messages. */
-+ for (t = TYPE_MAIN_VARIANT(atype); t; t = TYPE_NEXT_VARIANT(t))
-+ if (comptypes (t, atype) == 1
-+ && attribute_list_equal (TYPE_ATTRIBUTES(t), attrs))
-+ break;
-+ if (t)
-+ atype = t;
-+ else
-+ {
-+ /* Create a new variant, with differing attributes.
-+ (Hack! Type with differing attributes should no longer be
-+ a variant of its main type. See comment above for
-+ explanation why this was necessary). */
-+ atype = build_type_copy (atype);
-+ TYPE_ATTRIBUTES(atype) = chainon (attrs, TYPE_ATTRIBUTES(atype));
-+ }
-+ TREE_TYPE(decl) = atype;
-+// printf("%s using %s, cdecl=%p, type=%p\n", IDENTIFIER_POINTER(DECL_NAME (decl), asmspec, decl, atype);
-+ }
-+ }
-+#endif
-+
- finish_decl (decl, input_location, NULL_TREE, NULL_TREE, NULL_TREE);
- }
-
-diff --git a/gcc/c/c-parser.c b/gcc/c/c-parser.c
-index c9eb8ddbae3a..d8725b572b55 100644
---- gcc/c/c-parser.c
-+++ gcc/c/c-parser.c
-@@ -3837,10 +3837,26 @@ c_parser_parameter_declaration (c_parser *parser, tree attrs)
- c_parser_skip_until_found (parser, CPP_COMMA, NULL);
- return NULL;
- }
-+ /**
-+ * SBF: Add support for __asm("xy") register spec.
-+ */
-+#ifdef TARGET_AMIGAOS
-+ tree asmspec = NULL_TREE;
-+ if (c_parser_next_token_is_keyword (parser, RID_ASM))
-+ {
-+ asmspec = c_parser_simple_asm_expr (parser);
-+// printf("asmspec: %s\n", TREE_STRING_POINTER(asmspec));
-+ }
-+#endif
- if (c_parser_next_token_is_keyword (parser, RID_ATTRIBUTE))
- postfix_attrs = c_parser_attributes (parser);
-- return build_c_parm (specs, chainon (postfix_attrs, prefix_attrs),
-+
-+ struct c_parm * cparm = build_c_parm (specs, chainon (postfix_attrs, prefix_attrs),
- declarator);
-+#ifdef TARGET_AMIGAOS
-+ cparm->asmspec = asmspec;
-+#endif
-+ return cparm;
- }
-
- /* Parse a string literal in an asm expression. It should not be
-diff --git a/gcc/c/c-tree.h b/gcc/c/c-tree.h
-index bb12a200f709..e3404fd8b0a6 100644
---- gcc/c/c-tree.h
-+++ gcc/c/c-tree.h
-@@ -453,6 +453,10 @@ struct c_parm {
- tree attrs;
- /* The declarator. */
- struct c_declarator *declarator;
-+#ifdef TARGET_AMIGAOS
-+ /* The optional asm spec to specify the register. */
-+ tree asmspec;
-+#endif
- };
-
- /* Used when parsing an enum. Initialized by start_enum. */
-diff --git a/gcc/calls.c b/gcc/calls.c
-index 6cc1fc721e45..e5188b93ba94 100644
---- gcc/calls.c
-+++ gcc/calls.c
-@@ -21,12 +21,12 @@ along with GCC; see the file COPYING3. If not see
- #include "system.h"
- #include "coretypes.h"
- #include "backend.h"
-+#include "tm_p.h"
- #include "target.h"
- #include "rtl.h"
- #include "tree.h"
- #include "gimple.h"
- #include "predict.h"
--#include "tm_p.h"
- #include "stringpool.h"
- #include "expmed.h"
- #include "optabs.h"
-diff --git a/gcc/collect2.c b/gcc/collect2.c
-index bffac802b8fe..f52a66ef1b58 100644
---- gcc/collect2.c
-+++ gcc/collect2.c
-@@ -1392,6 +1392,11 @@ main (int argc, char **argv)
- add_to_list (&libs, s);
- }
- #endif
-+ /* begin-GG-local: dynamic libraries */
-+ #ifdef COLLECT2_LIBNAME_HOOK
-+ COLLECT2_LIBNAME_HOOK(arg);
-+ #endif
-+ /* end-GG-local */
- break;
-
- #ifdef COLLECT_EXPORT_LIST
-@@ -1492,6 +1497,11 @@ main (int argc, char **argv)
- add_to_list (&libs, arg);
- }
- #endif
-+ /* begin-GG-local: dynamic libraries */
-+#ifdef COLLECT2_LIBNAME_HOOK
-+ COLLECT2_LIBNAME_HOOK(arg);
-+#endif
-+ /* end-GG-local */
- }
- }
-
-@@ -1608,6 +1618,11 @@ main (int argc, char **argv)
-
- fprintf (stderr, "\n");
- }
-+ /* begin-GG-local: dynamic libraries */
-+#ifdef COLLECT2_PRELINK_HOOK
-+ COLLECT2_PRELINK_HOOK(ld1_argv, &strip_flag);
-+#endif
-+ /* end-GG-local */
-
- /* Load the program, searching all libraries and attempting to provide
- undefined symbols from repository information.
-@@ -1648,6 +1663,8 @@ main (int argc, char **argv)
- }
- }
-
-+ /* begin-GG-local: dynamic libraries */
-+#ifndef COLLECT2_POSTLINK_HOOK
- /* Unless we have done it all already, examine the namelist and search for
- static constructors and destructors to call. Write the constructor and
- destructor tables to a .s file and reload. */
-@@ -1674,6 +1691,10 @@ main (int argc, char **argv)
- frame_tables.number),
- frame_tables.number);
- }
-+#else /* COLLECT2_POSTLINK_HOOK */
-+ COLLECT2_POSTLINK_HOOK(output_file);
-+#endif
-+/* end-GG-local */
-
- /* If the scan exposed nothing of special interest, there's no need to
- generate the glue code and relink so return now. */
-@@ -1716,6 +1737,11 @@ main (int argc, char **argv)
-
- maybe_unlink (c_file);
- maybe_unlink (o_file);
-+ /* begin-GG-local: dynamic libraries */
-+#ifdef COLLECT2_EXTRA_CLEANUP
-+ COLLECT2_EXTRA_CLEANUP();
-+#endif
-+ /* end-GG-local */
- return 0;
- }
-
-@@ -1821,6 +1847,11 @@ main (int argc, char **argv)
- maybe_unlink (export_file);
- #endif
-
-+ /* begin-GG-local: dynamic libraries */
-+#ifdef COLLECT2_EXTRA_CLEANUP
-+ COLLECT2_EXTRA_CLEANUP();
-+#endif
-+ /* end-GG-local */
- return 0;
- }
-
-diff --git a/gcc/config.gcc b/gcc/config.gcc
-index 1d5b23f228d2..3ef1a5f110f3 100644
---- gcc/config.gcc
-+++ gcc/config.gcc
-@@ -1931,6 +1931,16 @@ m68k-*-elf* | fido-*-elf*)
- ;;
- esac
- ;;
-+m68k*-*-amigaos*)
-+ default_m68k_cpu=68000
-+ tm_file="${tm_file} dbx.h newlib-stdint.h m68k/m68kamigaos.h"
-+ tm_defines="${tm_defines} MOTOROLA=1 TARGET_AMIGAOS TARGET_CPU_DEFAULT=0"
-+ tmake_file="m68k/t-floatlib m68k/t-m68kbare m68k/t-amigaos"
-+ tm_p_file="${tm_p_file} m68k/amigaos-protos.h"
-+ extra_objs=amigaos.o
-+ extra_options="${extra_options} m68k/amigaos.opt"
-+ gnu_ld=yes
-+ ;;
- m68k*-*-netbsdelf*)
- default_m68k_cpu=68020
- default_cf_cpu=5475
-diff --git a/gcc/config/m68k/amigaos-protos.h b/gcc/config/m68k/amigaos-protos.h
-new file mode 100755
-index 000000000000..66b553ab568f
---- /dev/null
-+++ gcc/config/m68k/amigaos-protos.h
-@@ -0,0 +1,58 @@
-+/* Configuration for GNU C-compiler for m68k Amiga, running AmigaOS.
-+ Copyright (C) 1992, 1993, 1994, 1995, 1996, 1997, 1998, 2003
-+ Free Software Foundation, Inc.
-+ Contributed by Markus M. Wild (wild(a)amiga.physik.unizh.ch).
-+ Heavily modified by Kamil Iskra (iskra(a)student.uci.agh.edu.pl).
-+
-+This file is part of GCC.
-+
-+GCC 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, or (at your option)
-+any later version.
-+
-+GCC 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 GCC; see the file COPYING. If not, write to
-+the Free Software Foundation, 59 Temple Place - Suite 330,
-+Boston, MA 02111-1307, USA. */
-+
-+#undef TARGET_AMIGAOS
-+#define TARGET_AMIGAOS 1
-+
-+extern void amigaos_init_cumulative_args (CUMULATIVE_ARGS *, tree);
-+
-+/* Initialize a variable CUM of type CUMULATIVE_ARGS
-+ for a call to a function whose data type is FNTYPE.
-+ For a library call, FNTYPE is 0. */
-+
-+#undef INIT_CUMULATIVE_ARGS
-+#define INIT_CUMULATIVE_ARGS(CUM, FNTYPE, LIBNAME, INDIRECT, N_NAMED_ARGS) \
-+ (amigaos_init_cumulative_args(&(CUM), (FNTYPE)))
-+
-+
-+extern int amigaos_restore_a4 (void);
-+#ifdef RTX_CODE
-+extern int read_only_operand (rtx);
-+extern void amigaos_select_section (tree, int, unsigned HOST_WIDE_INT);
-+extern void amigaos_encode_section_info (tree, rtx, int);
-+extern void amigaos_alternate_pic_setup (FILE *);
-+extern void amigaos_prologue_begin_hook (FILE *, int);
-+extern void amigaos_alternate_frame_setup_f (FILE *, int);
-+extern void amigaos_alternate_frame_setup (FILE *, int);
-+extern struct rtx_def* gen_stack_cleanup_call (rtx, rtx);
-+extern void amigaos_alternate_allocate_stack (rtx *);
-+#ifdef TREE_CODE
-+//extern void amigaos_function_arg_advance (CUMULATIVE_ARGS *);
-+extern struct rtx_def *amigaos_function_arg (CUMULATIVE_ARGS *, enum machine_mode, tree);
-+#endif
-+#endif
-+#ifdef TREE_CODE
-+extern tree amigaos_handle_decl_attribute (tree *, tree, tree, int, bool *);
-+extern tree amigaos_handle_type_attribute (tree *, tree, tree, int, bool *);
-+#endif
-+
-diff --git a/gcc/config/m68k/amigaos.c b/gcc/config/m68k/amigaos.c
-new file mode 100755
-index 000000000000..90bc3218bab7
---- /dev/null
-+++ gcc/config/m68k/amigaos.c
-@@ -0,0 +1,773 @@
-+/* Configuration for GNU C-compiler for m68k Amiga, running AmigaOS.
-+ Copyright (C) 1992, 1993, 1994, 1995, 1996, 1997, 1998, 2003
-+ Free Software Foundation, Inc.
-+ Contributed by Markus M. Wild (wild(a)amiga.physik.unizh.ch).
-+ Heavily modified by Kamil Iskra (iskra(a)student.uci.agh.edu.pl).
-+
-+This file is part of GCC.
-+
-+GCC 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, or (at your option)
-+any later version.
-+
-+GCC 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 GCC; see the file COPYING. If not, write to
-+the Free Software Foundation, 59 Temple Place - Suite 330,
-+Boston, MA 02111-1307, USA. */
-+
-+//work without flag_writable_strings which is not in GCC4
-+#define REGPARMS_68K 1
-+
-+#include "config.h"
-+#include "system.h"
-+#include "coretypes.h"
-+#include "tm.h"
-+#include "rtl.h"
-+#include "output.h"
-+#include "tree.h"
-+#include "attribs.h"
-+#include "flags.h"
-+#include "expr.h"
-+#include "toplev.h"
-+#include "tm_p.h"
-+#include "target.h"
-+#include "diagnostic-core.h"
-+#include "config/m68k/amigaos.h"
-+
-+
-+#if 0
-+static int amigaos_put_in_text (tree);
-+static rtx gen_stack_management_call (rtx, rtx, const char *);
-+
-+/* Baserel support. */
-+
-+/* Does operand (which is a symbolic_operand) live in text space? If
-+ so SYMBOL_REF_FLAG, which is set by ENCODE_SECTION_INFO, will be true.
-+
-+ This function is used in base relative code generation. */
-+
-+int
-+read_only_operand (rtx operand)
-+{
-+ if (GET_CODE (operand) == CONST)
-+ operand = XEXP (XEXP (operand, 0), 0);
-+ if (GET_CODE (operand) == SYMBOL_REF)
-+ return SYMBOL_REF_FLAG (operand) || CONSTANT_POOL_ADDRESS_P (operand);
-+ return 1;
-+}
-+
-+/* Choose the section to use for DECL. RELOC is true if its value contains
-+ any relocatable expression. */
-+
-+void
-+amigaos_select_section (tree decl ATTRIBUTE_UNUSED, int reloc ATTRIBUTE_UNUSED,
-+ unsigned HOST_WIDE_INT align ATTRIBUTE_UNUSED)
-+{
-+ // if (TREE_CODE (decl) == STRING_CST)
-+// {
-+//// flag_writable_strings /data_section not in gcc4,
-+////make life easy and put to same section
-+//// if (! flag_writable_strings)
-+//// readonly_data_section ();
-+//// else
-+// //data_section ();
-+// }
-+// else if (TREE_CODE (decl) == VAR_DECL)
-+// {
-+// if (TREE_READONLY (decl)
-+// && ! TREE_THIS_VOLATILE (decl)
-+// && DECL_INITIAL (decl)
-+// && (DECL_INITIAL (decl) == error_mark_node
-+// || TREE_CONSTANT (DECL_INITIAL (decl)))
-+// && (!flag_pic || (flag_pic<3 && !reloc)
-+// || SYMBOL_REF_FLAG (XEXP (DECL_RTL (decl), 0))))
-+// readonly_data_section ();
-+// else
-+// data_section ();
-+// }
-+// else if ((!flag_pic || (flag_pic<3 && !reloc)) && DECL_P(decl)
-+// && SYMBOL_REF_FLAG (XEXP (DECL_RTL (decl), 0)))
-+// readonly_data_section ();
-+// else
-+ //data_section ();
-+}
-+
-+/* This function is used while generating a base relative code.
-+ It returns 1 if a decl is not relocatable, i. e., if it can be put
-+ in the text section.
-+ Currently, it's very primitive: it just checks if the object size
-+ is less than 4 bytes (i. e., if it can hold a pointer). It also
-+ supports arrays and floating point types. */
-+
-+static int
-+amigaos_put_in_text (tree decl)
-+{
-+ tree type = TREE_TYPE (decl);
-+ if (TREE_CODE (type) == ARRAY_TYPE)
-+ type = TREE_TYPE (type);
-+ return (TREE_INT_CST_ELT(TYPE_SIZE (type), 1) == 0
-+ && TREE_INT_CST_LOW (TYPE_SIZE (type)) < 32)
-+ || FLOAT_TYPE_P (type);
-+}
-+
-+/* Record properties of a DECL into the associated SYMBOL_REF. */
-+
-+void
-+amigaos_encode_section_info (tree decl, rtx rtl, int first)
-+{
-+ default_encode_section_info (decl, rtl, first);
-+
-+
-+ SYMBOL_REF_FLAG (XEXP (rtl, 0)) = 1;
-+ if (TREE_CODE (decl) == FUNCTION_DECL) // huh seem do same. not in gcc4 flag_writable_strings
-+ SYMBOL_REF_FLAG (XEXP (rtl, 0)) = 1;
-+ else
-+ {
-+ if ((MEM_READONLY_P (rtl) && !MEM_VOLATILE_P (rtl)
-+ && (flag_pic<3 || (TREE_CODE (decl) == STRING_CST
-+ )
-+ || amigaos_put_in_text (decl)))
-+ || (TREE_CODE (decl) == VAR_DECL
-+ && DECL_SECTION_NAME (decl) != NULL))
-+ SYMBOL_REF_FLAG (XEXP (rtl, 0)) = 1;
-+ }
-+}
-+
-+/* Common routine used to check if a4 should be preserved/restored. */
-+
-+int
-+amigaos_restore_a4 (void)
-+{
-+ return (flag_pic >= 3 &&
-+ (TARGET_RESTORE_A4 || TARGET_ALWAYS_RESTORE_A4
-+ || lookup_attribute ("saveds",
-+ TYPE_ATTRIBUTES (TREE_TYPE (current_function_decl)))));
-+}
-+
-+void
-+amigaos_alternate_pic_setup (FILE *stream)
-+{
-+ if (TARGET_RESTORE_A4 || TARGET_ALWAYS_RESTORE_A4)
-+ asm_fprintf (stream, "\tjbsr %U__restore_a4\n");
-+ else if (lookup_attribute ("saveds",
-+ TYPE_ATTRIBUTES (TREE_TYPE (current_function_decl))))
-+ asm_fprintf (stream, "\tlea %U__a4_init,%Ra4\n");
-+}
-+
-+/* Attributes support. */
-+
-+#define AMIGA_CHIP_SECTION_NAME ".datachip"
-+
-+/* Handle a "chip" attribute;
-+ arguments as in struct attribute_spec.handler. */
-+
-+tree
-+amigaos_handle_decl_attribute (tree *node, tree name,
-+ tree args ATTRIBUTE_UNUSED,
-+ int flags ATTRIBUTE_UNUSED,
-+ bool *no_add_attrs)
-+{
-+ if (TREE_CODE (*node) == VAR_DECL)
-+ {
-+ if (is_attribute_p ("chip", name))
-+#ifdef TARGET_ASM_NAMED_SECTION
-+ {
-+ if (! TREE_STATIC (*node) && ! DECL_EXTERNAL (*node))
-+ error ("`chip' attribute cannot be specified for local variables");
-+ else
-+ {
-+ /* The decl may have already been given a section attribute from
-+ a previous declaration. Ensure they match. */
-+ if (DECL_SECTION_NAME (*node) == NULL_TREE)
-+ DECL_SECTION_NAME (*node) =
-+ build_string (strlen (AMIGA_CHIP_SECTION_NAME) + 1,
-+ AMIGA_CHIP_SECTION_NAME);
-+ else if (strcmp (TREE_STRING_POINTER (DECL_SECTION_NAME (*node)),
-+ AMIGA_CHIP_SECTION_NAME) != 0)
-+ {
-+ error_with_decl (*node,
-+ "`chip' for `%s' conflicts with previous declaration");
-+ }
-+ }
-+ }
-+#else
-+ error ("`chip' attribute is not supported for this target");
-+#endif
-+ }
-+ else
-+ {
-+ warning (OPT_Wattributes, "`%s' attribute only applies to variables",
-+ IDENTIFIER_POINTER (name));
-+ *no_add_attrs = true;
-+ }
-+
-+ return NULL_TREE;
-+}
-+
-+//----- from 68k.c start
-+
-+
-+
-+
-+
-+
-+/* Stack checking and automatic extension support. */
-+
-+void
-+amigaos_prologue_begin_hook (FILE *stream, int fsize)
-+{
-+ if (TARGET_STACKCHECK)
-+ {
-+ if (fsize < 256)
-+ asm_fprintf (stream, "\tcmpl %s,%Rsp\n"
-+ "\tjcc 0f\n"
-+ "\tjra %U__stkovf\n"
-+ "\t0:\n",
-+ (flag_pic == 3 ? "a4@(___stk_limit:W)" :
-+ (flag_pic == 4 ? "a4@(___stk_limit:L)" :
-+ "___stk_limit")));
-+ else
-+ asm_fprintf (stream, "\tmovel %I%d,%Rd0\n\tjbsr %U__stkchk_d0\n",
-+ fsize);
-+ }
-+}
-+
-+void
-+amigaos_alternate_frame_setup_f (FILE *stream, int fsize)
-+{
-+ if (fsize < 128)
-+ asm_fprintf (stream, "\tcmpl %s,%Rsp\n"
-+ "\tjcc 0f\n"
-+ "\tmoveq %I%d,%Rd0\n"
-+ "\tmoveq %I0,%Rd1\n"
-+ "\tjbsr %U__stkext_f\n"
-+ "0:\tlink %Ra5,%I%d:W\n",
-+ (flag_pic == 3 ? "a4@(___stk_limit:W)" :
-+ (flag_pic == 4 ? "a4@(___stk_limit:L)" :
-+ "___stk_limit")),
-+ fsize, -fsize);
-+ else
-+ asm_fprintf (stream, "\tmovel %I%d,%Rd0\n\tjbsr %U__link_a5_d0_f\n",
-+ fsize);
-+}
-+
-+void
-+amigaos_alternate_frame_setup (FILE *stream, int fsize)
-+{
-+ if (!fsize)
-+ asm_fprintf (stream, "\tcmpl %s,%Rsp\n"
-+ "\tjcc 0f\n"
-+ "\tmoveq %I0,%Rd0\n"
-+ "\tmoveq %I0,%Rd1\n"
-+ "\tjbsr %U__stkext_f\n"
-+ "0:\n",
-+ (flag_pic == 3 ? "a4@(___stk_limit:W)" :
-+ (flag_pic == 4 ? "a4@(___stk_limit:L)" :
-+ "___stk_limit")));
-+ else if (fsize < 128)
-+ asm_fprintf (stream, "\tcmpl %s,%Rsp\n"
-+ "\tjcc 0f\n"
-+ "\tmoveq %I%d,%Rd0\n"
-+ "\tmoveq %I0,%Rd1\n"
-+ "\tjbsr %U__stkext_f\n"
-+ "0:\taddw %I%d,%Rsp\n",
-+ (flag_pic == 3 ? "a4@(___stk_limit:W)" :
-+ (flag_pic == 4 ? "a4@(___stk_limit:L)" :
-+ "___stk_limit")),
-+ fsize, -fsize);
-+ else
-+ asm_fprintf (stream, "\tmovel %I%d,%Rd0\n\tjbsr %U__sub_d0_sp_f\n",
-+ fsize);
-+}
-+
-+//static rtx
-+//gen_stack_management_call (rtx stack_pointer, rtx arg, const char *func)
-+//{
-+// rtx call_insn, call, seq, name;
-+// start_sequence ();
-+//
-+// /* Move arg to d0. */
-+// emit_move_insn (gen_rtx_REG (SImode, 0), arg);
-+//
-+// /* Generate the function reference. */
-+// name = gen_rtx_SYMBOL_REF (Pmode, func);
-+// SYMBOL_REF_FLAG (name) = 1;
-+// /* If optimizing, put it in a psedo so that several loads can be merged
-+// into one. */
-+// if (optimize && ! flag_no_function_cse)
-+// name = copy_to_reg (name);
-+//
-+// /* Generate the function call. */
-+// call = gen_rtx_CALL (VOIDmode, gen_rtx_MEM (FUNCTION_MODE, name),
-+// const0_rtx);
-+// /* If we are doing stack extension, notify about the sp change. */
-+// if (stack_pointer)
-+// call = gen_rtx_SET (VOIDmode, stack_pointer, call);
-+//
-+// /* Generate the call instruction. */
-+// call_insn = emit_call_insn (call);
-+// /* Stack extension does not change memory in an unpredictable way. */
-+// RTL_CONST_OR_PURE_CALL_P (call_insn) = 1;
-+// /* We pass an argument in d0. */
-+// CALL_INSN_FUNCTION_USAGE (call_insn) = gen_rtx_EXPR_LIST (VOIDmode,
-+// gen_rtx_USE (VOIDmode, gen_rtx_REG (SImode, 0)), 0);
-+//
-+// seq = get_insns ();
-+// end_sequence ();
-+// return seq;
-+//}
-+//
-+//rtx
-+//gen_stack_cleanup_call (rtx stack_pointer, rtx sa)
-+//{
-+// return gen_stack_management_call (stack_pointer, sa, "__move_d0_sp");
-+//}
-+//
-+//void
-+//amigaos_alternate_allocate_stack (rtx *operands)
-+//{
-+// if (TARGET_STACKEXTEND)
-+// emit_insn (gen_stack_management_call (stack_pointer_rtx, operands[1],
-+// "__sub_d0_sp"));
-+// else
-+// {
-+// if (TARGET_STACKCHECK)
-+// emit_insn (gen_stack_management_call (0, operands[1], "__stkchk_d0"));
-+// anti_adjust_stack (operands[1]);
-+// }
-+// emit_move_insn (operands[0], virtual_stack_dynamic_rtx);
-+//}
-+#endif
-+
-+/*
-+ * begin-GG-local: explicit register specification for parameters.
-+ *
-+ * Reworked and ported to gcc-6.2.0 by Stefan "Bebbo" Franke.
-+ */
-+
-+/**
-+ * Define this here and add it to tm_p -> all know the custom type and allocate/use the correct size.
-+ */
-+struct amigaos_args
-+{
-+ int num_of_regs;
-+ long regs_already_used;
-+ int last_arg_reg;
-+ int last_arg_len;
-+ tree formal_type; /* New field: formal type of the current argument. */
-+};
-+
-+static struct amigaos_args mycum;
-+static CUMULATIVE_ARGS * lastcum;
-+
-+/* Argument-passing support functions. */
-+
-+/* Initialize a variable CUM of type CUMULATIVE_ARGS
-+ for a call to a function whose data type is FNTYPE.
-+ For a library call, FNTYPE is 0. */
-+
-+void
-+amigaos_init_cumulative_args (CUMULATIVE_ARGS *cump, tree fntype)
-+{
-+ struct amigaos_args * cum = &mycum;
-+ lastcum = cump;
-+ cum->num_of_regs = amigaos_regparm;
-+// printf("amigaos_init_cumulative_args %p -> %d\r\n", cum, cum->num_of_regs); fflush(stdout);
-+
-+ /* Initialize a variable CUM of type CUMULATIVE_ARGS
-+ for a call to a function whose data type is FNTYPE.
-+ For a library call, FNTYPE is 0. */
-+
-+ cum->last_arg_reg = -1;
-+ cum->regs_already_used = 0;
-+
-+ if (fntype)
-+ {
-+ if (lookup_attribute ("stkparm", TYPE_ATTRIBUTES(fntype)))
-+ cum->num_of_regs = 0;
-+ else
-+ {
-+ tree ratree = lookup_attribute ("regparm", TYPE_ATTRIBUTES(fntype));
-+ cum->num_of_regs = amigaos_regparm ?
-+ amigaos_regparm : AMIGAOS_DEFAULT_REGPARM;
-+ if (ratree)
-+ {
-+ tree args = TREE_VALUE(ratree);
-+
-+ if (args && TREE_CODE (args) == TREE_LIST)
-+ {
-+ tree val = TREE_VALUE(args);
-+ if (TREE_CODE (val) == INTEGER_CST)
-+ {
-+ int no = TREE_INT_CST_LOW(val);
-+ if (no > 0 && no < AMIGAOS_MAX_REGPARM)
-+ cum->num_of_regs = no;
-+ }
-+ }
-+ }
-+ }
-+ }
-+ else
-+ /* Libcall. */
-+ cum->num_of_regs = 0;
-+
-+ if (cum->num_of_regs)
-+ {
-+ /* If this is a vararg call, put all arguments on stack. */
-+ tree param, next_param;
-+ for (param = TYPE_ARG_TYPES(fntype); param; param = next_param)
-+ {
-+ next_param = TREE_CHAIN(param);
-+ if (!next_param && TREE_VALUE (param) != void_type_node)
-+ cum->num_of_regs = 0;
-+ }
-+ }
-+
-+ //#if ! defined (PCC_STATIC_STRUCT_RETURN) && defined (M68K_STRUCT_VALUE_REGNUM)
-+ // /* If return value is a structure, and we pass the buffer address in a
-+ // register, we can't use this register for our own purposes.
-+ // FIXME: Something similar would be useful for static chain. */
-+ // if (fntype && aggregate_value_p (TREE_TYPE (fntype), fntype))
-+ // cum->regs_already_used |= (1 << M68K_STRUCT_VALUE_REGNUM);
-+ //#endif
-+
-+ if (fntype)
-+ cum->formal_type = TYPE_ARG_TYPES(fntype);
-+ else
-+ /* Call to compiler-support function. */
-+ cum->formal_type = 0;
-+}
-+
-+/* Update the data in CUM to advance over an argument. */
-+
-+void
-+amigaos_function_arg_advance (cumulative_args_t cum_v, machine_mode, const_tree,
-+ bool)
-+{
-+ struct amigaos_args * cum = &mycum;
-+ CUMULATIVE_ARGS *cump = (CUMULATIVE_ARGS *) get_cumulative_args (cum_v);
-+ /* Update the data in CUM to advance over an argument. */
-+
-+ // printf("amigaos_function_arg_advance1 %p\r\n", cump); fflush(stdout);
-+ if (cump != lastcum)
-+ return;
-+
-+ if (cum->last_arg_reg != -1)
-+ {
-+ int count;
-+ for (count = 0; count < cum->last_arg_len; count++)
-+ cum->regs_already_used |= (1 << (cum->last_arg_reg + count));
-+ cum->last_arg_reg = -1;
-+ }
-+
-+ if (cum->formal_type)
-+ cum->formal_type = TREE_CHAIN(cum->formal_type);
-+}
-+
-+/* Define where to put the arguments to a function.
-+ Value is zero to push the argument on the stack,
-+ or a hard register in which to store the argument.
-+
-+ MODE is the argument's machine mode.
-+ TYPE is the data type of the argument (as a tree).
-+ This is null for libcalls where that information may
-+ not be available.
-+ CUM is a variable of type CUMULATIVE_ARGS which gives info about
-+ the preceding args and about the function being called. */
-+
-+static struct rtx_def *
-+_m68k_function_arg (CUMULATIVE_ARGS *, machine_mode, const_tree);
-+
-+static struct rtx_def *
-+_m68k_function_arg (CUMULATIVE_ARGS *cump, machine_mode mode, const_tree type)
-+{
-+ struct amigaos_args * cum = &mycum;
-+ // printf("m68k_function_arg numOfRegs=%p\r\n", cum);
-+
-+ if (cump != lastcum)
-+ return 0;
-+
-+ if (cum->num_of_regs)
-+ {
-+ int regbegin = -1, altregbegin = -1, len;
-+
-+ /* FIXME: The last condition below is a workaround for a bug. */
-+ if (TARGET_68881 && FLOAT_MODE_P(mode) &&
-+ GET_MODE_UNIT_SIZE (mode) <= 12
-+ && (GET_MODE_CLASS (mode) != MODE_COMPLEX_FLOAT || mode == SCmode))
-+ {
-+ regbegin = 16; /* FPx */
-+ len = GET_MODE_NUNITS(mode);
-+ }
-+ /* FIXME: Two last conditions below are workarounds for bugs. */
-+ else if (INTEGRAL_MODE_P (mode) && mode != CQImode && mode != CHImode)
-+ {
-+ if (POINTER_TYPE_P(type))
-+ regbegin = 8; /* Ax */
-+ else
-+ regbegin = 0; /* Dx */
-+ altregbegin = 8 - regbegin;
-+ len = (GET_MODE_SIZE (mode) + (UNITS_PER_WORD - 1)) / UNITS_PER_WORD;
-+ }
-+
-+ if (regbegin != -1)
-+ {
-+ int reg;
-+ long mask;
-+
-+ look_for_reg: mask = 1 << regbegin;
-+ for (reg = 0; reg < cum->num_of_regs; reg++, mask <<= 1)
-+ if (!(cum->regs_already_used & mask))
-+ {
-+ int end;
-+ for (end = reg; end < cum->num_of_regs && end < reg + len;
-+ end++, mask <<= 1)
-+ if (cum->regs_already_used & mask)
-+ break;
-+ if (end == reg + len)
-+ {
-+ cum->last_arg_reg = reg + regbegin;
-+ cum->last_arg_len = len;
-+ break;
-+ }
-+ }
-+
-+ if (reg == cum->num_of_regs && altregbegin != -1)
-+ {
-+ regbegin = altregbegin;
-+ altregbegin = -1;
-+ goto look_for_reg;
-+ }
-+ }
-+
-+ if (cum->last_arg_reg != -1)
-+ {
-+ // printf("-> gen_rtx_REG %d\r\n", cum->last_arg_reg);
-+ return gen_rtx_REG (mode, cum->last_arg_reg);
-+ }
-+ }
-+ return 0;
-+}
-+
-+/* A C expression that controls whether a function argument is passed
-+ in a register, and which register. */
-+
-+struct rtx_def *
-+amigaos_function_arg (cumulative_args_t cum_v, machine_mode mode,
-+ const_tree type, bool)
-+{
-+ struct amigaos_args * cum = &mycum;
-+
-+ // printf("amigaos_function_arg %p\r\n", cum_v.p); fflush(stdout);
-+
-+ CUMULATIVE_ARGS *cump = (CUMULATIVE_ARGS *) get_cumulative_args (cum_v);
-+
-+ if (cump != lastcum)
-+ return 0;
-+
-+ tree asmtree = type ? TYPE_ATTRIBUTES(type) : NULL_TREE;
-+ if (asmtree && 0 == strcmp ("asm", IDENTIFIER_POINTER(TREE_PURPOSE(asmtree))))
-+ {
-+ int i;
-+ cum->last_arg_reg = TREE_FIXED_CST_PTR(TREE_VALUE(asmtree))->data.low;
-+ cum->last_arg_len = HARD_REGNO_NREGS(cum->last_arg_reg, mode);
-+
-+ for (i = 0; i < cum->last_arg_len; i++)
-+ if (cum->regs_already_used & (1 << (cum->last_arg_reg + i)))
-+ {
-+ error ("two parameters allocated for one register");
-+ break;
-+ }
-+ return gen_rtx_REG (mode, cum->last_arg_reg);
-+ }
-+ return _m68k_function_arg (cump, mode, type);
-+}
-+
-+/* Return zero if the attributes on TYPE1 and TYPE2 are incompatible,
-+ one if they are compatible, and two if they are nearly compatible
-+ (which causes a warning to be generated). */
-+
-+int
-+amigaos_comp_type_attributes (const_tree type1, const_tree type2)
-+{
-+ printf("amigaos_comp_type_attributes\n");
-+ /* Functions or methods are incompatible if they specify mutually exclusive
-+ ways of passing arguments. */
-+ if (TREE_CODE(type1) == FUNCTION_TYPE || TREE_CODE(type1) == METHOD_TYPE)
-+ {
-+ tree arg1, arg2;
-+ arg1 = TYPE_ARG_TYPES(type1);
-+ arg2 = TYPE_ARG_TYPES(type2);
-+ for (; arg1 && arg2; arg1 = TREE_CHAIN(arg1), arg2 = TREE_CHAIN(arg2))
-+ {
-+ tree attr1 = TYPE_ATTRIBUTES(arg1);
-+ tree attr2 = TYPE_ATTRIBUTES(arg2);
-+ if (strcmp ("asm", IDENTIFIER_POINTER(TREE_PURPOSE(attr1))))
-+ attr1 = NULL_TREE;
-+ if (strcmp ("asm", IDENTIFIER_POINTER(TREE_PURPOSE(attr2))))
-+ attr2 = NULL_TREE;
-+ if (attr1 && attr2)
-+ {
-+ if (TREE_FIXED_CST_PTR(TREE_VALUE(attr1))->data.low
-+ != TREE_FIXED_CST_PTR(TREE_VALUE(attr2))->data.low)
-+ return 0;
-+ }
-+ else if (attr1 || attr2)
-+ return 0; /* asm attribute only on one side. */
-+ }
-+ if (arg1 || arg2)
-+ return 0; /* different count of parameters. */
-+ }
-+ return 1;
-+}
-+
-+/* Return zero if the attributes on TYPE1 and TYPE2 are incompatible,
-+ one if they are compatible, and two if they are nearly compatible
-+ (which causes a warning to be generated). */
-+#if 0
-+static int
-+m68k_comp_type_attributes (tree type1, tree type2)
-+{
-+
-+ /* Functions or methods are incompatible if they specify mutually
-+ exclusive ways of passing arguments. */
-+ if (TREE_CODE (type1) == FUNCTION_TYPE || TREE_CODE (type1) == METHOD_TYPE)
-+ {
-+ tree arg1, arg2;
-+ if (!! lookup_attribute ("stkparm", TYPE_ATTRIBUTES (type1)) !=
-+ !! lookup_attribute ("stkparm", TYPE_ATTRIBUTES (type2))
-+ || !! lookup_attribute ("regparm", TYPE_ATTRIBUTES (type1)) !=
-+ !! lookup_attribute ("regparm", TYPE_ATTRIBUTES (type2)))
-+ return 0; /* 'regparm' and 'stkparm' are mutually exclusive. */
-+
-+ arg1 = lookup_attribute ("regparm", TYPE_ATTRIBUTES (type1));
-+ arg2 = lookup_attribute ("regparm", TYPE_ATTRIBUTES (type2));
-+ if (arg1 && arg2)
-+ {
-+ int num1 = 0, num2 = 0;
-+ if (TREE_VALUE (arg1) && TREE_CODE (TREE_VALUE (arg1)) == TREE_LIST)
-+ {
-+ tree numofregs = TREE_VALUE (TREE_VALUE (arg1));
-+ if (numofregs)
-+ num1 = TREE_INT_CST_LOW (numofregs);
-+ }
-+ if (TREE_VALUE (arg2) && TREE_CODE (TREE_VALUE (arg2)) == TREE_LIST)
-+ {
-+ tree numofregs = TREE_VALUE (TREE_VALUE (arg2));
-+ if (numofregs)
-+ num2 = TREE_INT_CST_LOW (numofregs);
-+ }
-+ if (num1 != num2)
-+ return 0; /* Different numbers, or no number in one type. */
-+ }
-+ }
-+#ifdef TARGET_AMIGAOS
-+ return amigaos_comp_type_attributes(type1, type2);
-+#else
-+ return 1;
-+#endif
-+}
-+#endif
-+
-+/* end-GG-local */
-+
-+
-+/* Handle a "regparm", "stkparm" attribute;
-+ arguments as in struct attribute_spec.handler. */
-+tree
-+amigaos_handle_type_attribute (tree *node, tree name, tree args,
-+ int flags ATTRIBUTE_UNUSED, bool *no_add_attrs)
-+{
-+ tree nnn = *node;
-+ do { // while (0);
-+// printf("%p with treecode %d\n", node, TREE_CODE(nnn)); fflush(stdout);
-+ if (TREE_CODE (nnn) == FUNCTION_DECL || TREE_CODE (nnn) == FUNCTION_TYPE
-+ || TREE_CODE (nnn) == METHOD_TYPE)
-+ {
-+ /* 'regparm' accepts one optional argument - number of registers in
-+ single class that should be used to pass arguments. */
-+ if (is_attribute_p ("regparm", name))
-+ {
-+// printf ("regparm found\n"); fflush(stdout);
-+
-+ if (lookup_attribute ("stkparm", TYPE_ATTRIBUTES(nnn)))
-+ {
-+ error ("`regparm' and `stkparm' are mutually exclusive");
-+ break;
-+ }
-+ if (args && TREE_CODE (args) == TREE_LIST)
-+ {
-+ tree val = TREE_VALUE(args);
-+// printf ("regparm with val: %d\n", TREE_CODE(val));
-+ if (TREE_CODE (val) == INTEGER_CST)
-+ {
-+ int no = TREE_INT_CST_LOW(val);
-+ if (no < 0 || no > AMIGAOS_MAX_REGPARM)
-+ {
-+ error ("`regparm' attribute: value %d not in [0 - %d]",
-+ no,
-+ AMIGAOS_MAX_REGPARM);
-+ break;
-+ }
-+ }
-+ else
-+ {
-+ error ("invalid argument(s) to `regparm' attribute");
-+ break;
-+ }
-+ }
-+ }
-+ else if (is_attribute_p ("stkparm", name))
-+ {
-+ if (lookup_attribute ("regparm", TYPE_ATTRIBUTES(nnn)))
-+ {
-+ error ("`regparm' and `stkparm' are mutually exclusive");
-+ break;
-+ }
-+ }
-+ else if (is_attribute_p ("stackext", name))
-+ {
-+ if (lookup_attribute ("interrupt", TYPE_ATTRIBUTES(nnn)))
-+ {
-+ error ("`stackext' and `interrupt' are mutually exclusive");
-+ break;
-+ }
-+ }
-+ else if (is_attribute_p ("saveds", name))
-+ {
-+ }
-+ }
-+ else
-+ {
-+ warning (OPT_Wattributes, "`%s' attribute only applies to functions",
-+ IDENTIFIER_POINTER(name));
-+ }
-+ return NULL_TREE;
-+ } while (0);
-+ // error case
-+ *no_add_attrs = true;
-+ return NULL_TREE;
-+}
-+
-+
-+extern bool
-+m68k_rtx_costs (rtx, machine_mode, int, int, int *, bool);
-+
-+bool
-+amigaos_rtx_costs (rtx x, machine_mode mode, int outer_code, int opno,
-+ int *total, bool speed)
-+{
-+// printf("outer: %d, opno: %d", outer_code, opno); fflush(stdout);
-+// debug_rtx(x);
-+ bool r = m68k_rtx_costs (x, mode, outer_code, opno, total, speed);
-+ *total *= 4;
-+ return r;
-+}
-+
-+
-diff --git a/gcc/config/m68k/amigaos.h b/gcc/config/m68k/amigaos.h
-new file mode 100755
-index 000000000000..1a33225ab60f
---- /dev/null
-+++ gcc/config/m68k/amigaos.h
-@@ -0,0 +1,490 @@
-+/* Configuration for GNU C-compiler for m68k Amiga, running AmigaOS.
-+ Copyright (C) 1992, 1993, 1994, 1995, 1996, 1997, 1998, 2003
-+ Free Software Foundation, Inc.
-+ Contributed by Markus M. Wild (wild(a)amiga.physik.unizh.ch).
-+ Heavily modified by Kamil Iskra (iskra(a)student.uci.agh.edu.pl).
-+
-+
-+This file is part of GCC.
-+
-+GCC 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, or (at your option)
-+any later version.
-+
-+GCC 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 GCC; see the file COPYING. If not, write to
-+the Free Software Foundation, 59 Temple Place - Suite 330,
-+Boston, MA 02111-1307, USA. */
-+
-+#ifndef TARGET_AMIGAOS
-+#define TARGET_AMIGAOS 1
-+#endif
-+
-+#if 0
-+/* The function name __transfer_from_trampoline is not actually used.
-+ The function definition just permits use of asm with operands"
-+ (though the operand list is empty). */
-+
-+#undef TRANSFER_FROM_TRAMPOLINE
-+
-+/* Call __flush_cache() after building the trampoline: it will call
-+ an appropriate OS cache-clearing routine. */
-+
-+#undef FINALIZE_TRAMPOLINE
-+#define FINALIZE_TRAMPOLINE(TRAMP) \
-+ emit_library_call (gen_rtx_SYMBOL_REF (Pmode, "__flush_cache"), \
-+ 0, VOIDmode, 2, (TRAMP), Pmode, \
-+ GEN_INT (TRAMPOLINE_SIZE), SImode)
-+
-+#endif
-+
-+/* Compile using the first 'm68k_regparm' data, address and float
-+ registers for arguments passing. */
-+/*#define SUBTARGET_OPTIONS { "regparm=", &m68k_regparm_string, \
-+ N_("Use this register count to pass arguments"), 0},*/
-+
-+
-+/* Nonzero if we need to generate special stack-allocating insns.
-+ On most systems they are not needed.
-+ When they are needed, also define ALTERNATE_ALLOCATE_STACK (see m68k.md)
-+ to perform the necessary actions. */
-+//#undef TARGET_ALTERNATE_ALLOCATE_STACK
-+//#define TARGET_ALTERNATE_ALLOCATE_STACK 0
-+
-+
-+/* Compile with stack extension. */
-+
-+#define MASK_STACKEXTEND 0x40000000 /* 1 << 30 */
-+#define TARGET_STACKEXTEND (((target_flags & MASK_STACKEXTEND) \
-+ && !lookup_attribute ("interrupt", \
-+ TYPE_ATTRIBUTES (TREE_TYPE (current_function_decl)))) \
-+ || lookup_attribute ("stackext", \
-+ TYPE_ATTRIBUTES (TREE_TYPE (current_function_decl))))
-+
-+///* Compile with stack checking. */
-+//
-+#define MASK_STACKCHECK 0x20000000 /* 1 << 29 */
-+#define TARGET_STACKCHECK ((target_flags & MASK_STACKCHECK) \
-+ && !(target_flags & MASK_STACKEXTEND) \
-+ && !lookup_attribute ("interrupt", \
-+ TYPE_ATTRIBUTES (TREE_TYPE (current_function_decl))) \
-+ && !lookup_attribute ("stackext", \
-+ TYPE_ATTRIBUTES (TREE_TYPE (current_function_decl))))
-+
-+/* Compile with a4 restoring in public functions. */
-+
-+#define MASK_RESTORE_A4 0x10000000 /* 1 << 28 */
-+#define TARGET_RESTORE_A4 \
-+ ((target_flags & MASK_RESTORE_A4) && TREE_PUBLIC (current_function_decl))
-+
-+/* Compile with a4 restoring in all functions. */
-+
-+#define MASK_ALWAYS_RESTORE_A4 0x8000000 /* 1 << 27 */
-+#define TARGET_ALWAYS_RESTORE_A4 (target_flags & MASK_ALWAYS_RESTORE_A4)
-+
-+/* Provide a dummy entry for the '-msmall-code' switch. This is used by
-+ the assembler and '*_SPEC'. */
-+
-+#undef SUBTARGET_SWITCHES
-+#define SUBTARGET_SWITCHES \
-+ { "small-code", 0, \
-+ "" /* Undocumented. */ }, \
-+ { "stackcheck", MASK_STACKCHECK, \
-+ N_("Generate stack-check code") }, \
-+ { "no-stackcheck", - MASK_STACKCHECK, \
-+ N_("Do not generate stack-check code") }, \
-+ { "stackextend", MASK_STACKEXTEND, \
-+ N_("Generate stack-extension code") }, \
-+ { "no-stackextend", - MASK_STACKEXTEND, \
-+ N_("Do not generate stack-extension code") }, \
-+ { "fixedstack", - (MASK_STACKCHECK|MASK_STACKEXTEND), \
-+ N_("Do not generate stack-check/stack-extension code") }, \
-+ { "restore-a4", MASK_RESTORE_A4, \
-+ N_("Restore a4 in public functions") }, \
-+ { "no-restore-a4", - MASK_RESTORE_A4, \
-+ N_("Do not restore a4 in public functions") }, \
-+ { "always-restore-a4", MASK_ALWAYS_RESTORE_A4, \
-+ N_("Restore a4 in all functions") }, \
-+ { "no-always-restore-a4", - MASK_ALWAYS_RESTORE_A4, \
-+ N_("Do not restore a4 in all functions") }
-+
-+#if 0
-+/* Various ABI issues. */
-+
-+/* This is (almost;-) BSD, so it wants DBX format. */
-+#undef DBX_DEBUGGING_INFO
-+#define DBX_DEBUGGING_INFO
-+
-+/* GDB goes mad if it sees the function end marker. */
-+
-+#define NO_DBX_FUNCTION_END 1
-+
-+/* Allow folding division by zero. */
-+
-+#define REAL_INFINITY
-+
-+/* Don't try using XFmode since we don't have appropriate runtime software
-+ support. */
-+#undef LONG_DOUBLE_TYPE_SIZE
-+#define LONG_DOUBLE_TYPE_SIZE 64
-+
-+/* We use A4 for the PIC pointer, not A5, which is the framepointer. */
-+
-+#undef PIC_OFFSET_TABLE_REGNUM
-+#define PIC_OFFSET_TABLE_REGNUM (flag_pic ? 12 : INVALID_REGNUM)
-+
-+#undef PIC_REG
-+#define PIC_REG 12
-+
-+/* Use A5 as framepointer instead of A6, since the AmigaOS ABI requires A6
-+ to be used as a shared library base pointer in direct library calls. */
-+
-+#undef FRAME_POINTER_REGNUM
-+#define FRAME_POINTER_REGNUM 13
-+
-+#undef M68K_REGNAME
-+#define M68K_REGNAME(r) ( \
-+ ( ((r) == FRAME_POINTER_REGNUM) \
-+ && frame_pointer_needed) ? \
-+ M68K_FP_REG_NAME : reg_names[(r)])
-+
-+
-+/* The AmigaOS ABI does not define how structures should be returned, so,
-+ contrary to 'm68k.h', we prefer a multithread-safe solution. */
-+
-+#undef PCC_STATIC_STRUCT_RETURN
-+
-+/* Setup a default shell return value for those (gazillion..) programs that
-+ (inspite of ANSI-C) declare main() to be void (or even VOID...) and thus
-+ cause the shell to randomly caugh upon executing such programs (contrary
-+ to Unix, AmigaOS scripts are terminated with an error if a program returns
-+ with an error code above the `error' or even `failure' level
-+ (which is configurable with the FAILAT command)). */
-+
-+//+2004-06-24 Ulrich Weigand <uweigand(a)de.ibm.com>
-+//+
-+//+ * c-decl.c (finish_function): Do not check for DEFAULT_MAIN_RETURN.
-+//+ * system.h (DEFAULT_MAIN_RETURN): Poison.
-+//+ * doc/tm.texi (DEFAULT_MAIN_RETURN): Remove documentation.
-+//+
-+
-+//poison VAR
-+//#define DEFAULT_MAIN_RETURN c_expand_return (integer_zero_node)
-+
-+#undef WCHAR_TYPE
-+#define WCHAR_TYPE "unsigned int"
-+
-+/* XXX: section support */
-+#if 0
-+/* Support sections in chip memory, currently '.datachip' only. */
-+#undef TARGET_ASM_NAMED_SECTION
-+#define TARGET_ASM_NAMED_SECTION amiga_named_section
-+
-+/* We define TARGET_ASM_NAMED_SECTION, but we don't support arbitrary sections,
-+ including '.gcc_except_table', so we emulate the standard behaviour. */
-+#undef TARGET_ASM_EXCEPTION_SECTION
-+#define TARGET_ASM_EXCEPTION_SECTION amiga_exception_section
-+
-+#undef TARGET_ASM_EH_FRAME_SECTION
-+#define TARGET_ASM_EH_FRAME_SECTION amiga_eh_frame_section
-+#endif
-+
-+/* Use sjlj exceptions because dwarf work only on elf targets */
-+#undef DWARF2_UNWIND_INFO
-+#define DWARF2_UNWIND_INFO 0
-+
-+
-+/* This is how to output an assembler line that says to advance the
-+ location counter to a multiple of 2**LOG bytes. */
-+
-+#ifndef ALIGN_ASM_OP
-+#define ALIGN_ASM_OP "\t.align\t"
-+#endif
-+
-+/* GAS supports alignment up to 32768 bytes. */
-+#undef ASM_OUTPUT_ALIGN
-+#define ASM_OUTPUT_ALIGN(FILE, LOG) \
-+do \
-+ { \
-+ if ((LOG) == 1) \
-+ fprintf ((FILE), "\t.even\n"); \
-+ else \
-+ fprintf ((FILE), "\t.align %d\n", (LOG)); \
-+ } \
-+while (0)
-+
-+/* Baserel support. */
-+
-+/* Given that symbolic_operand(X), return TRUE if no special
-+ base relative relocation is necessary */
-+
-+#define LEGITIMATE_BASEREL_OPERAND_P(X) \
-+ (flag_pic >= 3 && read_only_operand (X))
-+
-+#undef LEGITIMATE_PIC_OPERAND_P
-+#define LEGITIMATE_PIC_OPERAND_P(X) \
-+ (! symbolic_operand (X, VOIDmode) || LEGITIMATE_BASEREL_OPERAND_P (X))
-+
-+/* Define this macro if references to a symbol must be treated
-+ differently depending on something about the variable or
-+ function named by the symbol (such as what section it is in).
-+
-+ The macro definition, if any, is executed immediately after the
-+ rtl for DECL or other node is created.
-+ The value of the rtl will be a `mem' whose address is a
-+ `symbol_ref'.
-+
-+ The usual thing for this macro to do is to a flag in the
-+ `symbol_ref' (such as `SYMBOL_REF_FLAG') or to store a modified
-+ name string in the `symbol_ref' (if one bit is not enough
-+ information).
-+
-+ On the Amiga we use this to indicate if references to a symbol should be
-+ absolute or base relative. */
-+
-+#undef TARGET_ENCODE_SECTION_INFO
-+#define TARGET_ENCODE_SECTION_INFO amigaos_encode_section_info
-+
-+#define LIBCALL_ENCODE_SECTION_INFO(FUN) \
-+do \
-+ { \
-+ if (flag_pic >= 3) \
-+ SYMBOL_REF_FLAG (FUN) = 1; \
-+ } \
-+while (0)
-+
-+/* Select and switch to a section for EXP. */
-+
-+//#undef TARGET_ASM_SELECT_SECTION
-+//#define TARGET_ASM_SELECT_SECTION amigaos_select_section
-+
-+/* Preserve A4 for baserel code if necessary. */
-+
-+#define EXTRA_SAVE_REG(REGNO) \
-+do { \
-+ if (flag_pic && flag_pic >= 3 && REGNO == PIC_OFFSET_TABLE_REGNUM \
-+ && amigaos_restore_a4()) \
-+ return true; \
-+} while (0)
-+
-+/* Predicate for ALTERNATE_PIC_SETUP. */
-+
-+#define HAVE_ALTERNATE_PIC_SETUP (flag_pic >= 3)
-+
-+/* Make a4 point at data hunk. */
-+
-+#define ALTERNATE_PIC_SETUP(STREAM) \
-+ (amigaos_alternate_pic_setup (STREAM))
-+
-+/* Attribute support. */
-+
-+/* Generate the test of d0 before return to set cc register in 'interrupt'
-+ function. */
-+
-+#define EPILOGUE_END_HOOK(STREAM) \
-+do \
-+ { \
-+ if (lookup_attribute ("interrupt", \
-+ TYPE_ATTRIBUTES (TREE_TYPE (current_function_decl)))) \
-+ asm_fprintf ((STREAM), "\ttstl %Rd0\n"); \
-+ } \
-+while (0)
-+
-+
-+/* Stack checking and automatic extension support. */
-+
-+#define PROLOGUE_BEGIN_HOOK(STREAM, FSIZE) \
-+ (amigaos_prologue_begin_hook ((STREAM), (FSIZE)))
-+
-+#define HAVE_ALTERNATE_FRAME_SETUP_F(FSIZE) TARGET_STACKEXTEND
-+
-+#define ALTERNATE_FRAME_SETUP_F(STREAM, FSIZE) \
-+ (amigaos_alternate_frame_setup_f ((STREAM), (FSIZE)))
-+
-+#define HAVE_ALTERNATE_FRAME_SETUP(FSIZE) TARGET_STACKEXTEND
-+
-+#define ALTERNATE_FRAME_SETUP(STREAM, FSIZE) \
-+ (amigaos_alternate_frame_setup ((STREAM), (FSIZE)))
-+
-+#define HAVE_ALTERNATE_FRAME_DESTR_F(FSIZE) \
-+ (TARGET_STACKEXTEND && current_function_calls_alloca)
-+
-+#define ALTERNATE_FRAME_DESTR_F(STREAM, FSIZE) \
-+ (asm_fprintf ((STREAM), "\tjra %U__unlk_a5_rts\n"))
-+
-+#define HAVE_ALTERNATE_RETURN \
-+ (TARGET_STACKEXTEND && frame_pointer_needed && \
-+ current_function_calls_alloca)
-+
-+#define ALTERNATE_RETURN(STREAM)
-+
-+#if 0
-+#define HAVE_restore_stack_nonlocal TARGET_STACKEXTEND
-+#define gen_restore_stack_nonlocal gen_stack_cleanup_call
-+
-+#define HAVE_restore_stack_function TARGET_STACKEXTEND
-+#define gen_restore_stack_function gen_stack_cleanup_call
-+
-+#define HAVE_restore_stack_block TARGET_STACKEXTEND
-+#define gen_restore_stack_block gen_stack_cleanup_call
-+
-+#undef TARGET_ALTERNATE_ALLOCATE_STACK
-+#define TARGET_ALTERNATE_ALLOCATE_STACK 1
-+
-+#define ALTERNATE_ALLOCATE_STACK(OPERANDS) \
-+do \
-+ { \
-+ amigaos_alternate_allocate_stack (OPERANDS); \
-+ DONE; \
-+ } \
-+while (0)
-+#endif
-+
-+/* begin-GG-local: dynamic libraries */
-+
-+extern int amigaos_do_collecting (void);
-+extern void amigaos_gccopts_hook (const char *);
-+extern void amigaos_libname_hook (const char* arg);
-+extern void amigaos_collect2_cleanup (void);
-+extern void amigaos_prelink_hook (const char **, int *);
-+extern void amigaos_postlink_hook (const char *);
-+
-+/* This macro is used to check if all collect2 facilities should be used.
-+ We need a few special ones, like stripping after linking. */
-+
-+#define DO_COLLECTING (do_collecting || amigaos_do_collecting())
-+#define COLLECT2_POSTLINK_HOOK(OUTPUT_FILE) amigaos_postlink_hook(OUTPUT_FILE) //new
-+
-+/* This macro is called in collect2 for every GCC argument name.
-+ ARG is a part of commandline (without '\0' at the end). */
-+
-+#define COLLECT2_GCC_OPTIONS_HOOK(ARG) amigaos_gccopts_hook(ARG)
-+
-+/* This macro is called in collect2 for every ld's "-l" or "*.o" or "*.a"
-+ argument. ARG is a complete argument, with '\0' at the end. */
-+
-+#define COLLECT2_LIBNAME_HOOK(ARG) amigaos_libname_hook(ARG)
-+
-+/* This macro is called at collect2 exit, to clean everything up. */
-+
-+#define COLLECT2_EXTRA_CLEANUP amigaos_collect2_cleanup
-+
-+/* This macro is called just before the first linker invocation.
-+ LD1_ARGV is "char** argv", which will be passed to "ld". STRIP is an
-+ *address* of "strip_flag" variable. */
-+
-+#define COLLECT2_PRELINK_HOOK(LD1_ARGV, STRIP) \
-+amigaos_prelink_hook((const char **)(LD1_ARGV), (STRIP))
-+
-+/* This macro is called just after the first linker invocation, in place of
-+ "nm" and "ldd". OUTPUT_FILE is the executable's filename. */
-+
-+#define COLLECT2_POSTLINK_HOOK(OUTPUT_FILE) amigaos_postlink_hook(OUTPUT_FILE)
-+/* end-GG-local */
-+
-+#endif
-+
-+/* begin-GG-local: explicit register specification for parameters */
-+
-+/* Note: this is an extension of m68k_args */
-+
-+
-+/* A C type for declaring a variable that is used as the first
-+ argument of `FUNCTION_ARG' and other related values. */
-+/* Max. number of data, address and float registers to be used for passing
-+ integer, pointer and float arguments when TARGET_REGPARM.
-+ It's 4, so d0-d3, a0-a3 and fp0-fp3 can be used. */
-+#undef AMIGAOS_MAX_REGPARM
-+#define AMIGAOS_MAX_REGPARM 4
-+
-+/* The default number of data, address and float registers to use when
-+ user specified '-mregparm' switch, not '-mregparm=<value>' option. */
-+#undef AMIGAOS_DEFAULT_REGPARM
-+#define AMIGAOS_DEFAULT_REGPARM 2
-+
-+
-+#undef CLASS_MAX_NREGS
-+#define CLASS_MAX_NREGS(CLASS, MODE) \
-+ ((CLASS) == FP_REGS ? GET_MODE_NUNITS (MODE) \
-+ : ((GET_MODE_SIZE (MODE) + UNITS_PER_WORD - 1) / UNITS_PER_WORD))
-+
-+/* 1 if N is a possible register number for function argument passing. */
-+#undef FUNCTION_ARG_REGNO_P
-+#define FUNCTION_ARG_REGNO_P(N) \
-+ ((((int)N) >= 0 && (N) < AMIGAOS_MAX_REGPARM) \
-+ || ((N) >= 8 && (N) < 8 + AMIGAOS_MAX_REGPARM) \
-+ || (TARGET_68881 && (N) >= 16 && (N) < 16 + AMIGAOS_MAX_REGPARM))
-+
-+/*
-+ On the m68k, this is a structure:
-+ num_of_regs: number of data, address and float registers to use for
-+ arguments passing (if it's 2, than pass arguments in d0, d1, a0, a1,
-+ fp0 and fp1). 0 - pass everything on stack. vararg calls are
-+ always passed entirely on stack.
-+ regs_already_used: bitmask of the already used registers.
-+ last_arg_reg - register number of the most recently passed argument.
-+ -1 if passed on stack.
-+ last_arg_len - number of registers used by the most recently passed
-+ argument.
-+*/
-+
-+extern void amigaos_init_cumulative_args (CUMULATIVE_ARGS *cum, tree);
-+extern void amigaos_function_arg_advance (cumulative_args_t, machine_mode, const_tree, bool);
-+extern rtx amigaos_function_arg (cumulative_args_t, machine_mode, const_tree, bool);
-+extern cumulative_args_t amigaos_pack_cumulative_args (CUMULATIVE_ARGS *);
-+extern int amigaos_comp_type_attributes (const_tree, const_tree);
-+extern tree amigaos_handle_type_attribute(tree *, tree, tree, int, bool*);
-+
-+/* Update the data in CUM to advance over an argument
-+ of mode MODE and data type TYPE.
-+ (TYPE is null for libcalls where that information may not be available.) */
-+
-+#undef TARGET_FUNCTION_ARG_ADVANCE
-+#define TARGET_FUNCTION_ARG_ADVANCE amigaos_function_arg_advance
-+
-+/* A C expression that controls whether a function argument is passed
-+ in a register, and which register. */
-+
-+#undef TARGET_FUNCTION_ARG
-+#define TARGET_FUNCTION_ARG amigaos_function_arg
-+
-+#undef TARGET_PACK_CUMULATIVE_ARGS
-+#define TARGET_PACK_CUMULATIVE_ARGS(CUM) \
-+ (amigaos_pack_cumulative_args(&(CUM)))
-+
-+#undef TARGET_COMP_TYPE_ATTRIBUTES
-+#define TARGET_COMP_TYPE_ATTRIBUTES amigaos_comp_type_attributes
-+
-+
-+/* end-GG-local */
-+
-+#undef SUBTARGET_OVERRIDE_OPTIONS
-+#define SUBTARGET_OVERRIDE_OPTIONS \
-+do \
-+ { \
-+ if (!TARGET_68020 && flag_pic==4) \
-+ error ("-fbaserel32 is not supported on the 68000 or 68010\n"); \
-+ if (amigaos_regparm > 0 && amigaos_regparm > AMIGAOS_MAX_REGPARM) \
-+ error ("-mregparm=x with 1 <= x <= %d\n", AMIGAOS_MAX_REGPARM); \
-+ } \
-+while (0)
-+
-+/* { name, min_len, max_len, decl_req, type_req, fn_type_req, handler,
-+ affects_type_identity } */
-+#define SUBTARGET_ATTRIBUTES \
-+ { "regparm", 1, 1, true, false, false, amigaos_handle_type_attribute,\
-+ false },
-+
-+#define GOT_SYMBOL_NAME ""
-+
-+#undef TARGET_RTX_COSTS
-+#define TARGET_RTX_COSTS amigaos_rtx_costs
-+bool
-+amigaos_rtx_costs (rtx, machine_mode, int, int, int *, bool);
-+
-diff --git a/gcc/config/m68k/amigaos.opt b/gcc/config/m68k/amigaos.opt
-new file mode 100755
-index 000000000000..a9bc80c4f5b6
---- /dev/null
-+++ gcc/config/m68k/amigaos.opt
-@@ -0,0 +1,13 @@
-+
-+mregparm=
-+Target RejectNegative Var(amigaos_regparm) Joined UInteger
-+Pass arguments through registers.
-+
-+noixemul
-+Target RejectNegative
-+Do not use ixemul.library - use libnix instead to link
-+
-+msmall-code
-+Target RejectNegative
-+small code model
-+
-diff --git a/gcc/config/m68k/host-amigaos.c b/gcc/config/m68k/host-amigaos.c
-new file mode 100755
-index 000000000000..8c72d516a378
---- /dev/null
-+++ gcc/config/m68k/host-amigaos.c
-@@ -0,0 +1,42 @@
-+/* AmigaOS/m68k host-specific hook definitions.
-+ Copyright (C) 2003 Free Software Foundation, Inc.
-+
-+This file is part of GCC.
-+
-+GCC 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, or (at your option) any later
-+version.
-+
-+GCC 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 GCC; see the file COPYING. If not, write to the Free
-+Software Foundation, 59 Temple Place - Suite 330, Boston, MA
-+02111-1307, USA. */
-+
-+
-+#include "config.h"
-+#include "system.h"
-+#include "coretypes.h"
-+#include "hosthooks.h"
-+#include "hosthooks-def.h"
-+#include "toplev.h"
-+
-+static void * amigaos_m68k_gt_pch_get_address (size_t);
-+
-+/* Return the address of the PCH address space, if the PCH will fit in it. */
-+
-+static void *
-+amigaos_m68k_gt_pch_get_address (size_t sz ATTRIBUTE_UNUSED)
-+{
-+ fatal_error ("PCH not supported\n");
-+}
-+
-+#undef HOST_HOOKS_GT_PCH_GET_ADDRESS
-+#define HOST_HOOKS_GT_PCH_GET_ADDRESS amigaos_m68k_gt_pch_get_address
-+
-+const struct host_hooks host_hooks = HOST_HOOKS_INITIALIZER;
-\ No newline at end of file
-diff --git a/gcc/config/m68k/m68k.c b/gcc/config/m68k/m68k.c
-index 03f474e1b63c..fe3a939e1530 100644
---- gcc/config/m68k/m68k.c
-+++ gcc/config/m68k/m68k.c
-@@ -166,7 +166,10 @@ static bool m68k_save_reg (unsigned int regno, bool interrupt_handler);
- static bool m68k_ok_for_sibcall_p (tree, tree);
- static bool m68k_tls_symbol_p (rtx);
- static rtx m68k_legitimize_address (rtx, rtx, machine_mode);
--static bool m68k_rtx_costs (rtx, machine_mode, int, int, int *, bool);
-+#ifndef TARGET_AMIGAOS
-+static
-+#endif
-+bool m68k_rtx_costs (rtx, machine_mode, int, int, int *, bool);
- #if M68K_HONOR_TARGET_STRICT_ALIGNMENT
- static bool m68k_return_in_memory (const_tree, const_tree);
- #endif
-@@ -174,10 +177,12 @@ static void m68k_output_dwarf_dtprel (FILE *, int, rtx) ATTRIBUTE_UNUSED;
- static void m68k_trampoline_init (rtx, tree, rtx);
- static int m68k_return_pops_args (tree, tree, int);
- static rtx m68k_delegitimize_address (rtx);
-+#ifndef TARGET_AMIGA
- static void m68k_function_arg_advance (cumulative_args_t, machine_mode,
- const_tree, bool);
- static rtx m68k_function_arg (cumulative_args_t, machine_mode,
- const_tree, bool);
-+#endif
- static bool m68k_cannot_force_const_mem (machine_mode mode, rtx x);
- static bool m68k_output_addr_const_extra (FILE *, rtx);
- static void m68k_init_sync_libfuncs (void) ATTRIBUTE_UNUSED;
-@@ -322,6 +327,10 @@ static void m68k_init_sync_libfuncs (void) ATTRIBUTE_UNUSED;
- #undef TARGET_ATOMIC_TEST_AND_SET_TRUEVAL
- #define TARGET_ATOMIC_TEST_AND_SET_TRUEVAL 128
-
-+#ifdef TARGET_AMIGA
-+#include "amigaos.h"
-+#endif
-+
- static const struct attribute_spec m68k_attribute_table[] =
- {
- /* { name, min_len, max_len, decl_req, type_req, fn_type_req, handler,
-@@ -332,6 +341,9 @@ static const struct attribute_spec m68k_attribute_table[] =
- m68k_handle_fndecl_attribute, false },
- { "interrupt_thread", 0, 0, true, false, false,
- m68k_handle_fndecl_attribute, false },
-+#ifdef SUBTARGET_ATTRIBUTES
-+ SUBTARGET_ATTRIBUTES
-+#endif
- { NULL, 0, 0, false, false, false, NULL, false }
- };
-
-@@ -1419,6 +1431,7 @@ m68k_ok_for_sibcall_p (tree decl, tree exp)
- return false;
- }
-
-+#ifndef TARGET_AMIGA
- /* On the m68k all args are always pushed. */
-
- static rtx
-@@ -1440,6 +1453,7 @@ m68k_function_arg_advance (cumulative_args_t cum_v, machine_mode mode,
- ? (GET_MODE_SIZE (mode) + 3) & ~3
- : (int_size_in_bytes (type) + 3) & ~3);
- }
-+#endif
-
- /* Convert X to a legitimate function call memory reference and return the
- result. */
-@@ -2172,6 +2186,8 @@ m68k_get_gp (void)
- if (pic_offset_table_rtx == NULL_RTX)
- pic_offset_table_rtx = gen_rtx_REG (Pmode, PIC_REG);
-
-+// debug_rtx(pic_offset_table_rtx);
-+
- crtl->uses_pic_offset_table = 1;
-
- return pic_offset_table_rtx;
-@@ -2442,9 +2458,9 @@ legitimize_pic_address (rtx orig, machine_mode mode ATTRIBUTE_UNUSED,
- if (GET_CODE (orig) == SYMBOL_REF || GET_CODE (orig) == LABEL_REF)
- {
- gcc_assert (reg);
--
- pic_ref = m68k_wrap_symbol_into_got_ref (orig, RELOC_GOT, reg);
- pic_ref = m68k_move_to_reg (pic_ref, orig, reg);
-+// debug_rtx(pic_ref);
- }
- else if (GET_CODE (orig) == CONST)
- {
-@@ -2787,7 +2803,10 @@ const_int_cost (HOST_WIDE_INT i)
- }
- }
-
--static bool
-+#ifndef TARGET_AMIGAOS
-+static
-+#endif
-+bool
- m68k_rtx_costs (rtx x, machine_mode mode, int outer_code,
- int opno ATTRIBUTE_UNUSED,
- int *total, bool speed ATTRIBUTE_UNUSED)
-@@ -4424,6 +4443,7 @@ floating_exact_log2 (rtx x)
- void
- print_operand (FILE *file, rtx op, int letter)
- {
-+// printf("letter: %c\n", letter);
- if (letter == '.')
- {
- if (MOTOROLA)
-@@ -4521,7 +4541,9 @@ m68k_get_reloc_decoration (enum m68k_reloc reloc)
- switch (reloc)
- {
- case RELOC_GOT:
-- if (MOTOROLA)
-+ if (TARGET_AMIGAOS)
-+ return "";
-+ else if (MOTOROLA)
- {
- if (flag_pic == 1 && TARGET_68020)
- return "@GOT.w";
-diff --git a/gcc/config/m68k/m68k.h b/gcc/config/m68k/m68k.h
-index 2aa858fa23b5..74d5aa042059 100644
---- gcc/config/m68k/m68k.h
-+++ gcc/config/m68k/m68k.h
-@@ -971,3 +971,8 @@ extern int m68k_sched_address_bypass_p (rtx_insn *, rtx_insn *);
- extern int m68k_sched_indexed_address_bypass_p (rtx_insn *, rtx_insn *);
-
- #define CPU_UNITS_QUERY 1
-+
-+#if 1
-+extern void default_stabs_asm_out_constructor (rtx, int);
-+extern void default_stabs_asm_out_destructor (rtx, int);
-+#endif
-diff --git a/gcc/config/m68k/m68k.md b/gcc/config/m68k/m68k.md
-index ec37bd76f55f..f5b63f43c372 100644
---- gcc/config/m68k/m68k.md
-+++ gcc/config/m68k/m68k.md
-@@ -7092,6 +7092,8 @@
- operands[1] = gen_rtx_REG (Pmode, PIC_REG);
- return MOTOROLA ? "move.l %?(%1),%0" : "movel %1@(%?), %0";
- }
-+ else if (TARGET_AMIGAOS)
-+ return "lea (%%pc, __GLOBAL_OFFSET_TABLE_), %0";
- else if (MOTOROLA)
- {
- if (TARGET_COLDFIRE)
-diff --git a/gcc/config/m68k/m68kamigaos.h b/gcc/config/m68k/m68kamigaos.h
-new file mode 100755
-index 000000000000..0ce599138c7d
---- /dev/null
-+++ gcc/config/m68k/m68kamigaos.h
-@@ -0,0 +1,424 @@
-+/* m68kelf support, derived from m68kv4.h */
-+
-+/* Target definitions for GNU compiler for mc680x0 running AmigaOs
-+ Copyright (C) 1991-2016 Free Software Foundation, Inc.
-+
-+ Written by Ron Guilmette (rfg(a)netcom.com) and Fred Fish (fnf(a)cygnus.com).
-+
-+This file is part of GCC.
-+
-+GCC 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 3, or (at your option)
-+any later version.
-+
-+GCC 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 GCC; see the file COPYING3. If not see
-+<http://www.gnu.org/licenses/>. */
-+
-+#ifndef TARGET_AMIGA
-+#define TARGET_AMIGA 1
-+#endif
-+
-+#ifndef SWBEG_ASM_OP
-+#define SWBEG_ASM_OP "\t.swbeg\t"
-+#endif
-+
-+#undef PIC_REG
-+#define PIC_REG 12
-+
-+#undef FRAME_POINTER_REGNUM
-+#define FRAME_POINTER_REGNUM 13
-+
-+#undef M68K_REGNAME
-+#define M68K_REGNAME(r) ( \
-+ ( ((r) == FRAME_POINTER_REGNUM) \
-+ && frame_pointer_needed) ? \
-+ M68K_FP_REG_NAME : reg_names[(r)])
-+
-+
-+
-+/* Here are three prefixes that are used by asm_fprintf to
-+ facilitate customization for alternate assembler syntaxes.
-+ Machines with no likelihood of an alternate syntax need not
-+ define these and need not use asm_fprintf. */
-+
-+/* The prefix for register names. Note that REGISTER_NAMES
-+ is supposed to include this prefix. Also note that this is NOT an
-+ fprintf format string, it is a literal string */
-+
-+#undef REGISTER_PREFIX
-+#define REGISTER_PREFIX ""
-+
-+/* The prefix for local (compiler generated) labels.
-+ These labels will not appear in the symbol table. */
-+
-+#undef LOCAL_LABEL_PREFIX
-+#define LOCAL_LABEL_PREFIX "."
-+
-+/* The prefix to add to user-visible assembler symbols. */
-+
-+#undef USER_LABEL_PREFIX
-+#define USER_LABEL_PREFIX "_"
-+
-+/* config/m68k.md has an explicit reference to the program counter,
-+ prefix this by the register prefix. */
-+
-+#define ASM_RETURN_CASE_JUMP \
-+ do { \
-+ return "jmp %%pc@(2,%0:w)"; \
-+ } while (0)
-+
-+/* This is how to output an assembler line that says to advance the
-+ location counter to a multiple of 2**LOG bytes. */
-+
-+#ifndef ALIGN_ASM_OP
-+#define ALIGN_ASM_OP "\t.align\t"
-+#endif
-+
-+#undef ASM_OUTPUT_ALIGN
-+#define ASM_OUTPUT_ALIGN(FILE,LOG) \
-+do { \
-+ if ((LOG) > 0) \
-+ fprintf ((FILE), "%s%u\n", ALIGN_ASM_OP, 1 << (LOG)); \
-+} while (0)
-+
-+/* Register in which address to store a structure value is passed to a
-+ function. The default in m68k.h is a1. For m68k/SVR4 it is a0. */
-+
-+#undef M68K_STRUCT_VALUE_REGNUM
-+#define M68K_STRUCT_VALUE_REGNUM A0_REG
-+
-+/* The static chain regnum defaults to a0, but we use that for
-+ structure return, so have to use a1 for the static chain. */
-+
-+#undef STATIC_CHAIN_REGNUM
-+#define STATIC_CHAIN_REGNUM A1_REG
-+#undef M68K_STATIC_CHAIN_REG_NAME
-+#define M68K_STATIC_CHAIN_REG_NAME REGISTER_PREFIX "a1"
-+
-+#define ASM_COMMENT_START "|"
-+
-+/* Define how the m68k registers should be numbered for Dwarf output.
-+ The numbering provided here should be compatible with the native
-+ SVR4 SDB debugger in the m68k/SVR4 reference port, where d0-d7
-+ are 0-7, a0-a8 are 8-15, and fp0-fp7 are 16-23. */
-+
-+#undef DBX_REGISTER_NUMBER
-+#define DBX_REGISTER_NUMBER(REGNO) (REGNO)
-+
-+#if 0
-+/* SVR4 m68k assembler is bitching on the `comm i,1,1' which askes for
-+ 1 byte alignment. Don't generate alignment for COMMON seems to be
-+ safer until we the assembler is fixed. */
-+#undef ASM_OUTPUT_ALIGNED_COMMON
-+/* Same problem with this one. */
-+#undef ASM_OUTPUT_ALIGNED_LOCAL
-+#endif
-+
-+#undef ASM_OUTPUT_COMMON
-+#undef ASM_OUTPUT_LOCAL
-+#define ASM_OUTPUT_COMMON(FILE, NAME, SIZE, ROUNDED) \
-+( fputs (".comm ", (FILE)), \
-+ assemble_name ((FILE), (NAME)), \
-+ fprintf ((FILE), ",%u\n", (int)(SIZE)))
-+
-+#define ASM_OUTPUT_LOCAL(FILE, NAME, SIZE, ROUNDED) \
-+( fputs (".lcomm ", (FILE)), \
-+ assemble_name ((FILE), (NAME)), \
-+ fprintf ((FILE), ",%u\n", (int)(SIZE)))
-+
-+/* Currently, JUMP_TABLES_IN_TEXT_SECTION must be defined in order to
-+ keep switch tables in the text section. */
-+
-+#define JUMP_TABLES_IN_TEXT_SECTION 1
-+
-+/* In m68k svr4, using swbeg is the standard way to do switch
-+ table. */
-+#undef ASM_OUTPUT_BEFORE_CASE_LABEL
-+#define ASM_OUTPUT_BEFORE_CASE_LABEL(FILE,PREFIX,NUM,TABLE) \
-+ fprintf ((FILE), "%s&%d\n", SWBEG_ASM_OP, XVECLEN (PATTERN (TABLE), 1));
-+/* end of stuff from m68kv4.h */
-+
-+#undef ENDFILE_SPEC
-+#define ENDFILE_SPEC "crtend.o%s"
-+
-+#undef STARTFILE_SPEC
-+#define STARTFILE_SPEC "crtbegin.o%s"
-+
-+#ifndef BSS_SECTION_ASM_OP
-+#define BSS_SECTION_ASM_OP "\t.section\t.bss"
-+#endif
-+
-+#ifndef ASM_OUTPUT_ALIGNED_BSS
-+#define ASM_OUTPUT_ALIGNED_BSS(FILE, DECL, NAME, SIZE, ALIGN) \
-+ asm_output_aligned_bss (FILE, DECL, NAME, SIZE, ALIGN)
-+#endif
-+
-+
-+/* Specs, switches. */
-+
-+/* amiga/amigaos are the new "standard" defines for the Amiga.
-+ MCH_AMIGA, AMIGA, __chip etc. are used in other compilers and are
-+ provided for compatibility reasons.
-+ When creating shared libraries, use different 'errno'. */
-+
-+
-+
-+#undef TARGET_OS_CPP_BUILTINS
-+#define TARGET_OS_CPP_BUILTINS() \
-+ do \
-+ { \
-+ builtin_define ("__chip=__attribute__((__chip__))"); \
-+ builtin_define ("__saveds=__attribute__((__saveds__))"); \
-+ builtin_define ("__interrupt=__attribute__((__interrupt__))"); \
-+ builtin_define ("__stackext=__attribute__((__stackext__))"); \
-+ builtin_define ("__regargs_x=__attribute__((regparm))"); \
-+ builtin_define ("__stdargs_x=__attribute__((stkparm))"); \
-+ builtin_define ("__aligned=__attribute__((__aligned__(4)))"); \
-+ builtin_define_std ("amiga"); \
-+ builtin_define_std ("amigaos"); \
-+ builtin_define_std ("AMIGA"); \
-+ builtin_define_std ("MCH_AMIGA"); \
-+ builtin_assert ("system=amigaos"); \
-+ } \
-+ while (0)
-+
-+#if 0
-+if (target_flags & (MASK_RESTORE_A4|MASK_ALWAYS_RESTORE_A4)) \
-+ builtin_define ("errno=(*ixemul_errno)"); \
-+
-+#endif
-+
-+/* Inform the program which CPU we compile for. */
-+
-+//#undef TARGET_CPU_CPP_BUILTINS
-+/*
-+ use --with-cpu=mc68040 etc.. instead on config. code was after #define TARGET_CPU_CPP_BUILTINS()
-+ if (TARGET_68040_ONLY) \
-+ { \
-+ if (TARGET_68060) \
-+ builtin_define_std ("mc68060"); \
-+ else \
-+ builtin_define_std ("mc68040"); \
-+ } \
-+ else if (TARGET_68030 && !TARGET_68040) \
-+ builtin_define_std ("mc68030"); \
-+ else if (TARGET_68020) \
-+ builtin_define_std ("mc68020"); \
-+ builtin_define_std ("mc68000"); \
-+*/
-+/*
-+#define TARGET_CPU_CPP_BUILTINS() \
-+ do \
-+ { \
-+ builtin_define_std ("mc68040"); \
-+ if (flag_pic > 2) \
-+ { \
-+ builtin_define ("__pic__"); \
-+ if (flag_pic > 3) \
-+ builtin_define ("__PIC__"); \
-+ } \
-+ builtin_assert ("cpu=m68k"); \
-+ builtin_assert ("machine=m68k"); \
-+ } \
-+ while (0)
-+*/
-+/* Define __HAVE_68881__ in preprocessor according to the -m flags.
-+ This will control the use of inline 68881 insns in certain macros.
-+ Note: it should be set in TARGET_CPU_CPP_BUILTINS but TARGET_68881
-+ isn't the same -m68881 since its also true for -m680[46]0 ...
-+ Differentiate between libnix and ixemul. */
-+
-+#define CPP_SPEC \
-+ "%{m68881:-D__HAVE_68881__} " \
-+ "%{!ansi:" \
-+ "%{m68020:-Dmc68020} " \
-+ "%{mc68020:-Dmc68020} " \
-+ "%{m68020-40:-Dmc68020} " \
-+ "%{m68020-60:-Dmc68020} " \
-+ "%{m68030:-Dmc68030} " \
-+ "%{m68040:-Dmc68040} " \
-+ "%{m68060:-Dmc68060}} " \
-+ "%{m68020:-D__mc68020__ -D__mc68020} " \
-+ "%{mc68020:-D__mc68020__ -D__mc68020} " \
-+ "%{m68020-40:-D__mc68020__ -D__mc68020} " \
-+ "%{m68020-60:-D__mc68020__ -D__mc68020} " \
-+ "%{m68030:-D__mc68030__ -D__mc68030} " \
-+ "%{m68040:-D__mc68040__ -D__mc68040} " \
-+ "%{m68060:-D__mc68060__ -D__mc68060} " \
-+ "%{noixemul:%{!ansi:%{!std=*:-Dlibnix}%{std=gnu*:-Dlibnix}} -D__libnix -D__libnix__} " \
-+ "%{!noixemul:%{!ansi:%{!std=*:-Dixemul}%{std=gnu*:-Dixemul}} -D__ixemul -D__ixemul__}"
-+
-+/* Translate '-resident' to '-fbaserel' (they differ in linking stage only).
-+ Don't put function addresses in registers for PC-relative code. */
-+
-+#define CC1_SPEC \
-+ "%{resident:-fbaserel} " \
-+ "%{resident32:-fbaserel32} " \
-+ "%{msmall-code:-fno-function-cse}"
-+
-+/* Various -m flags require special flags to the assembler. */
-+
-+#undef ASM_SPEC
-+#define ASM_SPEC \
-+ "%(asm_cpu) %(asm_cpu_default) %{msmall-code:-sc}"
-+
-+#undef ASM_CPU_SPEC
-+#define ASM_CPU_SPEC \
-+ "%{m68000|mc68000:-m68010} " \
-+ "%{m6802*|mc68020:-m68020} " \
-+ "%{m68030} " \
-+ "%{m68040} " \
-+ "%{m68060}"
-+
-+#define ASM_CPU_DEFAULT_SPEC \
-+ "%{!m680*:%{!mc680*:-m68040}}"
-+
-+/* If debugging, tell the linker to output amiga-hunk symbols *and* a BSD
-+ compatible debug hunk.
-+ Also, pass appropriate linker flavours depending on user-supplied
-+ commandline options. */
-+
-+#define LINK_SPEC \
-+ "%{noixemul:-fl libnix} " \
-+ "%{resident*:-amiga-datadata-reloc} " \
-+ "%{resident|fbaserel:-m amiga_bss -fl libb} " \
-+ "%{resident32|fbaserel32:-m amiga_bss -fl libb32} " \
-+ "%{g:-amiga-debug-hunk} " \
-+ "%(link_cpu)"
-+
-+#define LINK_CPU_SPEC \
-+ "%{m6802*|mc68020|m68030|m68040|m68060:-fl libm020} " \
-+ "%{m68881:-fl libm881}"
-+
-+/* Choose the right startup file, depending on whether we use base relative
-+ code, base relative code with automatic relocation (-resident), their
-+ 32-bit versions, libnix, profiling or plain crt0.o. */
-+
-+#undef STARTFILE_SPEC
-+#define STARTFILE_SPEC \
-+ "%{!noixemul:" \
-+ "%{fbaserel:%{!resident:bcrt0.o%s}}" \
-+ "%{resident:rcrt0.o%s}" \
-+ "%{fbaserel32:%{!resident32:lcrt0.o%s}}" \
-+ "%{resident32:scrt0.o%s}" \
-+ "%{!resident:%{!fbaserel:%{!resident32:%{!fbaserel32:" \
-+ "%{pg:gcrt0.o%s}%{!pg:%{p:mcrt0.o%s}%{!p:crt0.o%s}}}}}}}" \
-+ "%{noixemul:" \
-+ "%{resident:libnix/nrcrt0.o%s} " \
-+ "%{!resident:%{fbaserel:libnix/nbcrt0.o%s}%{!fbaserel:libnix/ncrt0.o%s}}}"
-+
-+#undef ENDFILE_SPEC
-+#define ENDFILE_SPEC \
-+ "%{noixemul:-lstubs}"
-+
-+/* put return values in FPU build in FP0 Reg */
-+#undef FUNCTION_VALUE_REGNO_P
-+#define FUNCTION_VALUE_REGNO_P(N) \
-+ ((N) == D0_REG || (N) == A0_REG || (TARGET_68881 && (N) == FP0_REG))
-+
-+
-+/* Automatically search libamiga.a for AmigaOS specific functions. Note
-+ that we first search the standard C library to resolve as much as
-+ possible from there, since it has names that are duplicated in libamiga.a
-+ which we *don't* want from there. Then search libamiga.a for any calls
-+ that were not generated inline, and finally search the standard C library
-+ again to resolve any references that libamiga.a might have generated.
-+ This may only be a temporary solution since it might be better to simply
-+ remove the things from libamiga.a that should be pulled in from libc.a
-+ instead, which would eliminate the first reference to libc.a. Note that
-+ if we don't search it automatically, it is very easy for the user to try
-+ to put in a -lamiga himself and get it in the wrong place, so that (for
-+ example) calls like sprintf come from -lamiga rather than -lc. */
-+
-+#undef LIB_SPEC
-+#define LIB_SPEC \
-+ "%{!noixemul:" \
-+ "%{p|pg:-lc_p}" \
-+ "%{!p:%{!pg:-lc -lamiga -lc}}}" \
-+ "%{noixemul:" \
-+ "-lnixmain -lnix -lamiga %{mstackcheck|mstackextend:-lstack}}"
-+
-+/* This macro defines names of additional specifications to put in the specs
-+ that can be used in various specifications like CC1_SPEC. Its definition
-+ is an initializer with a subgrouping for each command option.
-+
-+ Each subgrouping contains a string constant, that defines the
-+ specification name, and a string constant that used by the GCC driver
-+ program.
-+
-+ Do not define this macro if it does not need to do anything. */
-+#undef EXTRA_SPECS
-+#define EXTRA_SPECS \
-+ { "asm_cpu", ASM_CPU_SPEC }, \
-+ { "asm_cpu_default", ASM_CPU_DEFAULT_SPEC }, \
-+ { "link_cpu", LINK_CPU_SPEC }
-+
-+
-+/* begin-GG-local: dynamic libraries */
-+
-+extern int amigaos_do_collecting (void);
-+extern void amigaos_gccopts_hook (const char *);
-+extern void amigaos_libname_hook (const char* arg);
-+extern void amigaos_collect2_cleanup (void);
-+extern void amigaos_prelink_hook (const char **, int *);
-+extern void amigaos_postlink_hook (const char *);
-+
-+/* This macro is used to check if all collect2 facilities should be used.
-+ We need a few special ones, like stripping after linking. */
-+
-+#define DO_COLLECTING (do_collecting || amigaos_do_collecting())
-+
-+/* This macro is called in collect2 for every GCC argument name.
-+ ARG is a part of commandline (without '\0' at the end). */
-+
-+#define COLLECT2_GCC_OPTIONS_HOOK(ARG) amigaos_gccopts_hook(ARG)
-+
-+/* This macro is called in collect2 for every ld's "-l" or "*.o" or "*.a"
-+ argument. ARG is a complete argument, with '\0' at the end. */
-+
-+#define COLLECT2_LIBNAME_HOOK(ARG) amigaos_libname_hook(ARG)
-+
-+/* This macro is called at collect2 exit, to clean everything up. */
-+
-+#define COLLECT2_EXTRA_CLEANUP amigaos_collect2_cleanup
-+
-+/* This macro is called just before the first linker invocation.
-+ LD1_ARGV is "char** argv", which will be passed to "ld". STRIP is an
-+ *address* of "strip_flag" variable. */
-+
-+#define COLLECT2_PRELINK_HOOK(LD1_ARGV, STRIP) \
-+amigaos_prelink_hook((const char **)(LD1_ARGV), (STRIP))
-+
-+/* This macro is called just after the first linker invocation, in place of
-+ "nm" and "ldd". OUTPUT_FILE is the executable's filename. */
-+
-+#define COLLECT2_POSTLINK_HOOK(OUTPUT_FILE) amigaos_postlink_hook(OUTPUT_FILE)
-+/* end-GG-local */
-+
-+#undef MAX_OFILE_ALIGNMENT
-+#define MAX_OFILE_ALIGNMENT ((1 << 15)*BITS_PER_UNIT)
-+
-+#if 0
-+#undef INCLUDE_DEFAULTS
-+#define INCLUDE_DEFAULTS \
-+ { \
-+ { GPLUSPLUS_INCLUDE_DIR, "G++", 1, 1, \
-+ GPLUSPLUS_INCLUDE_DIR_ADD_SYSROOT, 0 }, \
-+ { GCC_INCLUDE_DIR, "GCC", 0, 0 }, \
-+ { CROSS_INCLUDE_DIR "/../../os-include", "GCC", 0, 0 }, \
-+ { TOOL_INCLUDE_DIR "/../ndk/include", "GCC", 0, 0 }, \
-+ { CROSS_INCLUDE_DIR, "GCC", 0, 0, 0 }, \
-+ { 0, 0, 0, 0 } \
-+ }
-+#endif
-+
-+#undef FIXED_INCLUDE_DIR
-+#define FIXED_INCLUDE_DIR CROSS_INCLUDE_DIR "/../../os-include"
-+
-diff --git a/gcc/config/m68k/m68kemb.h b/gcc/config/m68k/m68kemb.h
-index 0d8d88c74ea9..29b3e194f12d 100644
---- gcc/config/m68k/m68kemb.h
-+++ gcc/config/m68k/m68kemb.h
-@@ -32,12 +32,14 @@
- #define NEEDS_UNTYPED_CALL 1
-
- /* Target OS builtins. */
-+#ifndef TARGET_OS_CPP_BUILTINS
- #define TARGET_OS_CPP_BUILTINS() \
- do \
- { \
- builtin_define ("__embedded__"); \
- } \
- while (0)
-+#endif
-
- /* Override the default LIB_SPEC from gcc.c. We don't currently support
- profiling, or libg.a. */
-diff --git a/gcc/config/m68k/t-amigaos b/gcc/config/m68k/t-amigaos
-new file mode 100755
-index 000000000000..112d5daa06fb
---- /dev/null
-+++ gcc/config/m68k/t-amigaos
-@@ -0,0 +1,30 @@
-+# Makefile fragment for AmigaOS target.
-+
-+# Extra object file linked to the cc1* executables.
-+amigaos.o: $(srcdir)/config/m68k/amigaos.c $(CONFIG_H)
-+ $(CXX) -c $(ALL_CFLAGS) $(ALL_CPPFLAGS) $(INCLUDES) $< $(OUTPUT_OPTION)
-+
-+# Additional target dependent options for compiling libgcc.a. This just
-+# ensures that we don't compile libgcc* with anything other than a
-+# fixed stack.
-+
-+#TARGET_LIBGCC2_CFLAGS = -mfixedstack
-+
-+# Support for building multiple version of libgcc.
-+
-+LIBGCC_MULTI = .; \
-+ libb;@fbaserel \
-+ libm020;@m68020 \
-+ libb/libm020;@fbaserel@m68020 \
-+ libb32/libm020;@fbaserel32@m68020
-+
-+### begin-GG-local: dynamic libraries
-+# Extra objects that get compiled and linked to collect2
-+
-+EXTRA_COLLECT2_OBJS = amigacollect2.o
-+
-+# Build supplimentary AmigaOS target support file for collect2
-+amigacollect2.o: amigacollect2.c
-+ $(CXX) -c $(ALL_CFLAGS) $(ALL_CPPFLAGS) $(INCLUDES) \
-+ -DA2IXDIR_PREFIX=\"$(prefix)/share/a2ixlibrary\" $< $(OUTPUT_OPTION)
-+### end-GG-local
-diff --git a/gcc/config/m68k/x-amigaos b/gcc/config/m68k/x-amigaos
-new file mode 100755
-index 000000000000..a8f60b80f9f4
---- /dev/null
-+++ gcc/config/m68k/x-amigaos
-@@ -0,0 +1,104 @@
-+# Makefile fragment for AmigaOS host
-+
-+# Each compilation environment (Manx, Dice, GCC, SAS/C, etc) provides its
-+# own equivalent of the UNIX /usr/include tree. For gcc, the standard headers
-+# are in /gg/include and system specific headers are in /gg/os-include.
-+# Use these paths for fixincludes.
-+
-+SYSTEM_HEADER_DIR = $(prefix)/include
-+
-+# Uncomment the following macro to get a resident GCC. We don't do it
-+# by default, since we want to support users with mc68000.
-+# WARNING! If you uncomment this, you MUST add the same flags to the
-+# libiberty's Makefile (libiberty is now linked into GCC executables).
-+
-+#RESIDENT = -m68020 -resident32
-+
-+# Additional host flags that are not used when compiling with GCC_FOR_TARGET,
-+# such as when compiling the libgcc* runtime archives. GCC uses stack
-+# a lot, and since AmigaOS provides processes with a small, fixed size
-+# stack, we have to generate code that will extend it whenever necessary.
-+
-+XCFLAGS = -mstackextend $(RESIDENT)
-+
-+# AmigaOS supports "AmigaGuide(R)" hypertext files. For GCC, these are
-+# build with a custom "makeinfo".
-+
-+# Arrange for guides to be build with GCC, in the build directory.
-+
-+### begin-GG-local: gcc-amigaos
-+#EXTRA_DOC_TARGETS = guide gcc-amigaos-doc
-+### end-GG-local
-+
-+# Actually build guides
-+
-+guide:: doc/cpp.guide doc/gcc.guide doc/gccint.guide \
-+ doc/gccinstall.guide doc/cppinternals.guide
-+
-+doc/cpp.guide: $(TEXI_CPP_FILES)
-+doc/gcc.guide: $(TEXI_GCC_FILES)
-+doc/gccint.guide: $(TEXI_GCCINT_FILES)
-+doc/cppinternals.guide: $(TEXI_CPPINT_FILES)
-+
-+doc/%.guide: %.texi
-+ if [ x$(BUILD_INFO) = xinfo ]; then \
-+ $(MAKEINFO) --amiga $(MAKEINFOFLAGS) -I $(docdir) \
-+ -I $(docdir)/include -o $@ $<; \
-+ fi
-+
-+# Duplicate entry to handle renaming of gccinstall.guide
-+doc/gccinstall.guide: $(TEXI_GCCINSTALL_FILES)
-+ if [ x$(BUILD_INFO) = xinfo ]; then \
-+ $(MAKEINFO) --amiga $(MAKEINFOFLAGS) -I $(docdir) \
-+ -I $(docdir)/include -o $@ install.texi; \
-+ fi
-+
-+# Arrange for guides to be installed with GCC.
-+
-+### begin-GG-local: gcc-amigaos
-+#EXTRA_INSTALL_TARGETS = install-guide install-gcc-amigaos-doc
-+### end-GG-local
-+
-+# Where the guide files go
-+
-+guidedir = $(prefix)/guide
-+
-+# Actually install guides.
-+
-+installdirs-guide:
-+ $(SHELL) ${srcdir}/mkinstalldirs $(DESTDIR)$(guidedir)
-+
-+install-guide: doc installdirs-guide \
-+ $(DESTDIR)$(guidedir)/cpp.guide \
-+ $(DESTDIR)$(guidedir)/gcc.guide \
-+ $(DESTDIR)$(guidedir)/cppinternals.guide \
-+ $(DESTDIR)$(guidedir)/gccinstall.guide \
-+ $(DESTDIR)$(guidedir)/gccint.guide
-+
-+$(DESTDIR)$(guidedir)/%.guide: doc/%.guide installdirs-guide
-+ rm -f $@
-+ if [ -f $< ]; then \
-+ for f in $(<)*; do \
-+ realfile=`echo $$f | sed -e 's|.*/\([^/]*\)$$|\1|'`; \
-+ $(INSTALL_DATA) $$f $(DESTDIR)$(guidedir)/$$realfile; \
-+ chmod a-x $(DESTDIR)$(guidedir)/$$realfile; \
-+ done; \
-+ else true; fi
-+
-+### begin-GG-local: gcc-amigaos
-+# Build and install gcc-amigaos.guide - documentation specific to the
-+# AmigaOS port of GCC.
-+
-+gcc-amigaos-doc:: doc/gcc-amigaos.info doc/gcc-amigaos.guide
-+
-+doc/gcc-amigaos.info doc/gcc-amigaos.guide: gcc-amigaos.texi
-+
-+install-gcc-amigaos-doc: doc installdirs installdirs-guide \
-+ $(DESTDIR)$(infodir)/gcc-amigaos.info \
-+ $(DESTDIR)$(guidedir)/gcc-amigaos.guide
-+### end-GG-local
-+
-+host-amigaos.o : $(srcdir)/config/m68k/host-amigaos.c $(CONFIG_H) $(SYSTEM_H) \
-+ coretypes.h hosthooks.h hosthooks-def.h toplev.h diagnostic.h
-+ $(CC) -c $(ALL_CFLAGS) $(ALL_CPPFLAGS) $(INCLUDES) \
-+ $(srcdir)/config/m68k/host-amigaos.c
-diff --git a/gcc/config/m68k/xm-amigaos.h b/gcc/config/m68k/xm-amigaos.h
-new file mode 100755
-index 000000000000..bb571ba040b3
---- /dev/null
-+++ gcc/config/m68k/xm-amigaos.h
-@@ -0,0 +1,64 @@
-+/* Configuration for GNU C-compiler for m68k Amiga, running AmigaOS.
-+ Copyright (C) 1992, 1993, 1994, 1995, 1996, 1997, 1998, 2003
-+ Free Software Foundation, Inc.
-+ Contributed by Markus M. Wild (wild(a)amiga.physik.unizh.ch).
-+
-+This file is part of GCC.
-+
-+GCC 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, or (at your option)
-+any later version.
-+
-+GCC 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 GCC; see the file COPYING. If not, write to
-+the Free Software Foundation, 59 Temple Place - Suite 330,
-+Boston, MA 02111-1307, USA. */
-+
-+#ifndef _FCNTL_H_
-+#include <fcntl.h>
-+#endif
-+
-+/* AmigaOS specific headers, such as from the Native Developer Update kits,
-+ go in SYSTEM_INCLUDE_DIR. STANDARD_INCLUDE_DIR is the equivalent of
-+ Unix "/usr/include". All other include paths are set in Makefile. */
-+
-+#define SYSTEM_INCLUDE_DIR "/gg/os-include"
-+#define STANDARD_INCLUDE_DIR "/gg/include"
-+
-+#define STANDARD_EXEC_PREFIX_1 "/gg/libexec/gcc/"
-+#define STANDARD_EXEC_PREFIX_2 "/gg/lib/gcc/"
-+#define STANDARD_STARTFILE_PREFIX_1 "/gg/lib/"
-+#define STANDARD_STARTFILE_PREFIX_2 "/gg/lib/"
-+
-+/* The AmigaOS stores file names with regard to upper/lower case, but actions
-+ on existing files are case independent on the standard filesystems.
-+
-+ A good example of where this causes problems is the conflict between the C
-+ include file <string.h> and the C++ include file <String.h>, where the C++
-+ include file dir is searched first and thus causes includes of <string.h>
-+ to include <String.h> instead.
-+
-+ In order to solve this problem we define the macro OPEN_CASE_SENSITIVE as
-+ the name of the function that takes the same args as open() and does case
-+ dependent opens. */
-+
-+#define OPEN_CASE_SENSITIVE(NAME, FLAGS, MODE) open ((NAME), (FLAGS) | O_CASE, (MODE))
-+
-+/* On the AmigaOS, there are two pathname separators, '/' (DIR_SEPARATOR)
-+ and ':' (VOL_SEPARATOR). DIR_SEPARATOR defaults to the correct
-+ character, so we don't have to explicitly set it. */
-+
-+#define DIR_SEPARATOR '/'
-+#define VOL_SEPARATOR ':'
-+#define DIR_SEPARATOR_2 VOL_SEPARATOR
-+
-+/* Zap PREFIX_INCLUDE_DIR, since with the AmigaOS port it is the same as
-+ STANDARD_INCLUDE_DIR. */
-+
-+#undef PREFIX_INCLUDE_DIR
-diff --git a/gcc/expr.c b/gcc/expr.c
-index eb77ba0fe533..a2e6a7cac927 100644
---- gcc/expr.c
-+++ gcc/expr.c
-@@ -21,12 +21,12 @@ along with GCC; see the file COPYING3. If not see
- #include "system.h"
- #include "coretypes.h"
- #include "backend.h"
-+#include "tm_p.h"
- #include "target.h"
- #include "rtl.h"
- #include "tree.h"
- #include "gimple.h"
- #include "predict.h"
--#include "tm_p.h"
- #include "ssa.h"
- #include "expmed.h"
- #include "optabs.h"
-diff --git a/gcc/function.c b/gcc/function.c
-index 401f8f90160d..0c35f094f4cb 100644
---- gcc/function.c
-+++ gcc/function.c
-@@ -35,13 +35,13 @@ along with GCC; see the file COPYING3. If not see
- #include "system.h"
- #include "coretypes.h"
- #include "backend.h"
-+#include "tm_p.h"
- #include "target.h"
- #include "rtl.h"
- #include "tree.h"
- #include "gimple-expr.h"
- #include "cfghooks.h"
- #include "df.h"
--#include "tm_p.h"
- #include "stringpool.h"
- #include "expmed.h"
- #include "optabs.h"
-diff --git a/gcc/ipa-chkp.c b/gcc/ipa-chkp.c
-index 86c48f14f64d..dc72a5f21021 100644
---- gcc/ipa-chkp.c
-+++ gcc/ipa-chkp.c
-@@ -23,6 +23,8 @@ along with GCC; see the file COPYING3. If not see
- #include "system.h"
- #include "coretypes.h"
- #include "backend.h"
-+#include "tm_p.h"
-+#include "target.h"
- #include "tree.h"
- #include "gimple.h"
- #include "tree-pass.h"
-diff --git a/gcc/tree-chkp.c b/gcc/tree-chkp.c
-index 4ca2d34607c6..472e203306b8 100644
---- gcc/tree-chkp.c
-+++ gcc/tree-chkp.c
-@@ -22,6 +22,7 @@ along with GCC; see the file COPYING3. If not see
- #include "system.h"
- #include "coretypes.h"
- #include "backend.h"
-+#include "tm_p.h"
- #include "target.h"
- #include "rtl.h"
- #include "tree.h"
-diff --git a/gcc/var-tracking.c b/gcc/var-tracking.c
-index 9f09d30b1f91..149c0c123804 100644
---- gcc/var-tracking.c
-+++ gcc/var-tracking.c
-@@ -89,13 +89,13 @@
- #include "system.h"
- #include "coretypes.h"
- #include "backend.h"
-+#include "tm_p.h"
- #include "target.h"
- #include "rtl.h"
- #include "tree.h"
- #include "cfghooks.h"
- #include "alloc-pool.h"
- #include "tree-pass.h"
--#include "tm_p.h"
- #include "insn-config.h"
- #include "regs.h"
- #include "emit-rtl.h"
-diff --git a/libstdc++-v3/configure b/libstdc++-v3/configure
-index bbbcd5d7ce0c..c8ce02987284 100755
---- libstdc++-v3/configure
-+++ libstdc++-v3/configure
-@@ -28820,6 +28820,10 @@ else
-
- # Base decisions on target environment.
- case "${host}" in
-+ m68k-*-*)
-+ # Nothing to do here.
-+ ;;
-+
- arm*-*-symbianelf*)
- # This is a freestanding configuration; there is nothing to do here.
- ;;
-
-From 6951210c6e4901b5e963a19f5cae44bc0560a915 Mon Sep 17 00:00:00 2001
-From: bebbo <bebbo(a)bejy.net>
-Date: Thu, 15 Dec 2016 00:37:25 +0100
-Subject: [PATCH 002/303] @N add .project file
-
----
- .project | 11 +++++++++++
- 1 file changed, 11 insertions(+)
- create mode 100644 .project
-
-diff --git a/.project b/.project
-new file mode 100644
-index 000000000000..ab5c4b198d08
---- /dev/null
-+++ .project
-@@ -0,0 +1,11 @@
-+<?xml version="1.0" encoding="UTF-8"?>
-+<projectDescription>
-+ <name>gcc-6</name>
-+ <comment></comment>
-+ <projects>
-+ </projects>
-+ <buildSpec>
-+ </buildSpec>
-+ <natures>
-+ </natures>
-+</projectDescription>
-
-From c81713312a097d40d212a5ac5bce13b1aff7b226 Mon Sep 17 00:00:00 2001
-From: bebbo <bebbo(a)bejy.net>
-Date: Wed, 11 Jan 2017 12:09:34 +0100
-Subject: [PATCH 003/303] @B support named sections
-
----
- gcc/config/m68k/amigaos.c | 8 ++++++++
- gcc/config/m68k/amigaos.h | 17 ++++++++++-------
- 2 files changed, 18 insertions(+), 7 deletions(-)
- mode change 100755 => 100644 gcc/config/m68k/amigaos.c
- mode change 100755 => 100644 gcc/config/m68k/amigaos.h
-
-diff --git a/gcc/config/m68k/amigaos.c b/gcc/config/m68k/amigaos.c
-old mode 100755
-new mode 100644
-index 90bc3218bab7..facb57a28aa3
---- gcc/config/m68k/amigaos.c
-+++ gcc/config/m68k/amigaos.c
-@@ -771,3 +771,11 @@ amigaos_rtx_costs (rtx x, machine_mode mode, int outer_code, int opno,
- }
-
-
-+/* Output assembly to switch to section NAME with attribute FLAGS. */
-+
-+extern void
-+amiga_named_section (const char *name, unsigned int flags, tree decl ATTRIBUTE_UNUSED)
-+{
-+ fprintf (asm_out_file, "\t.section\t%s\n", name);
-+}
-+
-diff --git a/gcc/config/m68k/amigaos.h b/gcc/config/m68k/amigaos.h
-old mode 100755
-new mode 100644
-index 1a33225ab60f..d347a9be63db
---- gcc/config/m68k/amigaos.h
-+++ gcc/config/m68k/amigaos.h
-@@ -113,7 +113,15 @@ Boston, MA 02111-1307, USA. */
- N_("Restore a4 in all functions") }, \
- { "no-always-restore-a4", - MASK_ALWAYS_RESTORE_A4, \
- N_("Do not restore a4 in all functions") }
--
-+
-+
-+/* Support sections in chip memory, currently '.datachip' only. */
-+extern void
-+amiga_named_section (const char *name, unsigned int flags, tree decl);
-+
-+#undef TARGET_ASM_NAMED_SECTION
-+#define TARGET_ASM_NAMED_SECTION amiga_named_section
-+
- #if 0
- /* Various ABI issues. */
-
-@@ -139,9 +147,6 @@ Boston, MA 02111-1307, USA. */
- #undef PIC_OFFSET_TABLE_REGNUM
- #define PIC_OFFSET_TABLE_REGNUM (flag_pic ? 12 : INVALID_REGNUM)
-
--#undef PIC_REG
--#define PIC_REG 12
--
- /* Use A5 as framepointer instead of A6, since the AmigaOS ABI requires A6
- to be used as a shared library base pointer in direct library calls. */
-
-@@ -182,9 +187,7 @@ Boston, MA 02111-1307, USA. */
-
- /* XXX: section support */
- #if 0
--/* Support sections in chip memory, currently '.datachip' only. */
--#undef TARGET_ASM_NAMED_SECTION
--#define TARGET_ASM_NAMED_SECTION amiga_named_section
-+
-
- /* We define TARGET_ASM_NAMED_SECTION, but we don't support arbitrary sections,
- including '.gcc_except_table', so we emulate the standard behaviour. */
-
-From 6a04e2c9671b3d0d0de708cd0eb9fdb9bb4d5811 Mon Sep 17 00:00:00 2001
-From: bebbo <bebbo(a)bejy.net>
-Date: Thu, 12 Jan 2017 00:10:47 +0100
-Subject: [PATCH 004/303] @B fix null ptr
-
----
- gcc/config/m68k/amigaos.c | 2 +-
- 1 file changed, 1 insertion(+), 1 deletion(-)
-
-diff --git a/gcc/config/m68k/amigaos.c b/gcc/config/m68k/amigaos.c
-index facb57a28aa3..8727c7184812 100644
---- gcc/config/m68k/amigaos.c
-+++ gcc/config/m68k/amigaos.c
-@@ -508,7 +508,7 @@ _m68k_function_arg (CUMULATIVE_ARGS *cump, machine_mode mode, const_tree type)
- /* FIXME: Two last conditions below are workarounds for bugs. */
- else if (INTEGRAL_MODE_P (mode) && mode != CQImode && mode != CHImode)
- {
-- if (POINTER_TYPE_P(type))
-+ if (!type || POINTER_TYPE_P(type))
- regbegin = 8; /* Ax */
- else
- regbegin = 0; /* Dx */
-
-From 09a2cda05b28a749e39d8e0af34ef3556eb21d6a Mon Sep 17 00:00:00 2001
-From: bebbo <bebbo(a)bejy.net>
-Date: Thu, 12 Jan 2017 00:12:11 +0100
-Subject: [PATCH 005/303] @I added quirky -fbaserel -fbaserel32 - really
- working? nut sure...
-
----
- gcc/config/m68k/amigaos.h | 2 +-
- gcc/config/m68k/amigaos.opt | 7 +++++++
- gcc/config/m68k/m68k.c | 20 +++++++++++---------
- 3 files changed, 19 insertions(+), 10 deletions(-)
- mode change 100755 => 100644 gcc/config/m68k/amigaos.opt
-
-diff --git a/gcc/config/m68k/amigaos.h b/gcc/config/m68k/amigaos.h
-index d347a9be63db..fd89bb34352c 100644
---- gcc/config/m68k/amigaos.h
-+++ gcc/config/m68k/amigaos.h
-@@ -471,7 +471,7 @@ extern tree amigaos_handle_type_attribute(tree *, tree, tree, int, bool*);
- #define SUBTARGET_OVERRIDE_OPTIONS \
- do \
- { \
-- if (!TARGET_68020 && flag_pic==4) \
-+ if (!TARGET_68020 && flag_pic==2) \
- error ("-fbaserel32 is not supported on the 68000 or 68010\n"); \
- if (amigaos_regparm > 0 && amigaos_regparm > AMIGAOS_MAX_REGPARM) \
- error ("-mregparm=x with 1 <= x <= %d\n", AMIGAOS_MAX_REGPARM); \
-diff --git a/gcc/config/m68k/amigaos.opt b/gcc/config/m68k/amigaos.opt
-old mode 100755
-new mode 100644
-index a9bc80c4f5b6..4298bc90abe1
---- gcc/config/m68k/amigaos.opt
-+++ gcc/config/m68k/amigaos.opt
-@@ -11,3 +11,10 @@ msmall-code
- Target RejectNegative
- small code model
-
-+fbaserel
-+Target Common Report Var(flag_pic,3) Negative(fpie) Init(-1)
-+Backward compatibility, use -fpic now
-+
-+fbaserel32
-+Target Common Report Var(flag_pic,4) Negative(fPIE) Init(-1)
-+Backward compatibility, use -fPIC now
-\ No newline at end of file
-diff --git a/gcc/config/m68k/m68k.c b/gcc/config/m68k/m68k.c
-index fe3a939e1530..ce28681c1dc9 100644
---- gcc/config/m68k/m68k.c
-+++ gcc/config/m68k/m68k.c
-@@ -557,7 +557,7 @@ m68k_option_override (void)
- : (m68k_cpu_flags & FL_COLDFIRE) != 0 ? FPUTYPE_COLDFIRE
- : FPUTYPE_68881);
-
-- /* Sanity check to ensure that msep-data and mid-sahred-library are not
-+ /* Sanity check to ensure that msep-data and mid-shared-library are not
- * both specified together. Doing so simply doesn't make sense.
- */
- if (TARGET_SEP_DATA && TARGET_ID_SHARED_LIBRARY)
-@@ -568,7 +568,7 @@ m68k_option_override (void)
- * -fpic but it hasn't been tested properly.
- */
- if (TARGET_SEP_DATA || TARGET_ID_SHARED_LIBRARY)
-- flag_pic = 2;
-+ flag_pic = TARGET_68020 ? 2 : 1;
-
- /* -mpcrel -fPIC uses 32-bit pc-relative displacements. Raise an
- error if the target does not support them. */
-@@ -1139,9 +1139,9 @@ m68k_expand_prologue (void)
- current_frame.reg_mask, true, true));
- }
-
-- if (!TARGET_SEP_DATA
-- && crtl->uses_pic_offset_table)
-- emit_insn (gen_load_got (pic_offset_table_rtx));
-+// if (!TARGET_SEP_DATA
-+// && crtl->uses_pic_offset_table)
-+// emit_insn (gen_load_got (pic_offset_table_rtx));
- }
-
- /* Return true if a simple (return) instruction is sufficient for this
-@@ -4693,8 +4693,10 @@ print_operand_address (FILE *file, rtx addr)
- {
- struct m68k_address address;
-
-- if (!m68k_decompose_address (QImode, addr, true, &address))
-+ if (!m68k_decompose_address (QImode, addr, true, &address)) {
-+ debug_rtx(addr);
- gcc_unreachable ();
-+ }
-
- if (address.code == PRE_DEC)
- fprintf (file, MOTOROLA ? "-(%s)" : "%s@-",
-@@ -4719,7 +4721,7 @@ print_operand_address (FILE *file, rtx addr)
- /* (d16,PC) or (bd,PC,Xn) (with suppressed index register). */
- fputc ('(', file);
- output_addr_const (file, addr);
-- asm_fprintf (file, flag_pic == 1 ? ":w,%Rpc)" : ":l,%Rpc)");
-+ asm_fprintf (file, flag_pic == 1 || flag_pic == 3 ? ":w,%Rpc)" : ":l,%Rpc)");
- }
- else
- {
-@@ -5124,8 +5126,8 @@ m68k_output_mi_thunk (FILE *file, tree thunk ATTRIBUTE_UNUSED,
- /* Use the static chain register as a temporary (call-clobbered)
- GOT pointer for this function. We can use the static chain
- register because it isn't live on entry to the thunk. */
-- SET_REGNO (pic_offset_table_rtx, STATIC_CHAIN_REGNUM);
-- emit_insn (gen_load_got (pic_offset_table_rtx));
-+// SET_REGNO (pic_offset_table_rtx, STATIC_CHAIN_REGNUM);
-+// emit_insn (gen_load_got (pic_offset_table_rtx));
- }
- legitimize_pic_address (XEXP (mem, 0), Pmode, tmp);
- mem = replace_equiv_address (mem, tmp);
-
-From e807bcc3fe2a83cc3b617c78c7f81685e861b5d1 Mon Sep 17 00:00:00 2001
-From: bebbo <bebbo(a)bejy.net>
-Date: Thu, 12 Jan 2017 00:20:27 +0100
-Subject: [PATCH 006/303] @I
-
----
- gcc/config/m68k/amigaos.c | 0
- gcc/config/m68k/amigaos.h | 0
- gcc/config/m68k/amigaos.opt | 0
- 3 files changed, 0 insertions(+), 0 deletions(-)
- mode change 100644 => 100755 gcc/config/m68k/amigaos.c
- mode change 100644 => 100755 gcc/config/m68k/amigaos.h
- mode change 100644 => 100755 gcc/config/m68k/amigaos.opt
-
-diff --git a/gcc/config/m68k/amigaos.c b/gcc/config/m68k/amigaos.c
-old mode 100644
-new mode 100755
-diff --git a/gcc/config/m68k/amigaos.h b/gcc/config/m68k/amigaos.h
-old mode 100644
-new mode 100755
-diff --git a/gcc/config/m68k/amigaos.opt b/gcc/config/m68k/amigaos.opt
-old mode 100644
-new mode 100755
-
-From 79e34a64428598cfb90bdf9f67aa32ad8c02effb Mon Sep 17 00:00:00 2001
-From: bebbo <bebbo(a)bejy.net>
-Date: Thu, 12 Jan 2017 00:21:21 +0100
-Subject: [PATCH 007/303] Revert "@I"
-
-This reverts commit e807bcc3fe2a83cc3b617c78c7f81685e861b5d1.
----
- gcc/config/m68k/amigaos.c | 0
- gcc/config/m68k/amigaos.h | 0
- gcc/config/m68k/amigaos.opt | 0
- 3 files changed, 0 insertions(+), 0 deletions(-)
- mode change 100755 => 100644 gcc/config/m68k/amigaos.c
- mode change 100755 => 100644 gcc/config/m68k/amigaos.h
- mode change 100755 => 100644 gcc/config/m68k/amigaos.opt
-
-diff --git a/gcc/config/m68k/amigaos.c b/gcc/config/m68k/amigaos.c
-old mode 100755
-new mode 100644
-diff --git a/gcc/config/m68k/amigaos.h b/gcc/config/m68k/amigaos.h
-old mode 100755
-new mode 100644
-diff --git a/gcc/config/m68k/amigaos.opt b/gcc/config/m68k/amigaos.opt
-old mode 100755
-new mode 100644
-
-From 010fd69732e88d124686e46202f7a26bc9fa77ec Mon Sep 17 00:00:00 2001
-From: bebbo <bebbo(a)bejy.net>
-Date: Thu, 12 Jan 2017 15:13:10 +0100
-Subject: [PATCH 008/303] @B fix endless option parsing loop
-
----
- gcc/config/m68k/amigaos.opt | 4 ++--
- 1 file changed, 2 insertions(+), 2 deletions(-)
-
-diff --git a/gcc/config/m68k/amigaos.opt b/gcc/config/m68k/amigaos.opt
-index 4298bc90abe1..f933fe29b98b 100644
---- gcc/config/m68k/amigaos.opt
-+++ gcc/config/m68k/amigaos.opt
-@@ -12,9 +12,9 @@ Target RejectNegative
- small code model
-
- fbaserel
--Target Common Report Var(flag_pic,3) Negative(fpie) Init(-1)
-+Target Common Report Var(flag_pic,3) Init(-1)
- Backward compatibility, use -fpic now
-
- fbaserel32
--Target Common Report Var(flag_pic,4) Negative(fPIE) Init(-1)
-+Target Common Report Var(flag_pic,4) Init(-1)
- Backward compatibility, use -fPIC now
-\ No newline at end of file
-
-From c8b17fa2d8719ce6efc9535408966cd7ce87e2b8 Mon Sep 17 00:00:00 2001
-From: bebbo <bebbo(a)bejy.net>
-Date: Tue, 31 Jan 2017 20:42:38 +0100
-Subject: [PATCH 009/303] @N re-added old target options, @R -fbaserel seems to
- work
-
----
- gcc/config/m68k/amigaos.c | 7 +-
- gcc/config/m68k/amigaos.opt | 20 ++-
- gcc/config/m68k/m68k.c | 30 +++--
- gcc/config/m68k/m68kamigaos.h | 283 ++++++++++++++++++++++++++++++++----------
- 4 files changed, 257 insertions(+), 83 deletions(-)
- mode change 100755 => 100644 gcc/config/m68k/m68kamigaos.h
-
-diff --git a/gcc/config/m68k/amigaos.c b/gcc/config/m68k/amigaos.c
-index 8727c7184812..19b0f5b4cc82 100644
---- gcc/config/m68k/amigaos.c
-+++ gcc/config/m68k/amigaos.c
-@@ -41,6 +41,8 @@ Boston, MA 02111-1307, USA. */
- #include "config/m68k/amigaos.h"
-
-
-+//int amiga_declare_object;
-+
- #if 0
- static int amigaos_put_in_text (tree);
- static rtx gen_stack_management_call (rtx, rtx, const char *);
-@@ -776,6 +778,9 @@ amigaos_rtx_costs (rtx x, machine_mode mode, int outer_code, int opno,
- extern void
- amiga_named_section (const char *name, unsigned int flags, tree decl ATTRIBUTE_UNUSED)
- {
-- fprintf (asm_out_file, "\t.section\t%s\n", name);
-+ if (0 == strncmp(".text", name, 5))
-+ name = ".text";
-+// fprintf (asm_out_file, "\t.section\t%s\n", name);
-+ fprintf (asm_out_file, "\t%s\n", name);
- }
-
-diff --git a/gcc/config/m68k/amigaos.opt b/gcc/config/m68k/amigaos.opt
-index f933fe29b98b..29a3688470d0 100644
---- gcc/config/m68k/amigaos.opt
-+++ gcc/config/m68k/amigaos.opt
-@@ -12,9 +12,21 @@ Target RejectNegative
- small code model
-
- fbaserel
--Target Common Report Var(flag_pic,3) Init(-1)
--Backward compatibility, use -fpic now
-+Target Common Report Var(flag_mybaserel,1)
-+data is adressed relativ to a4
-
- fbaserel32
--Target Common Report Var(flag_pic,4) Init(-1)
--Backward compatibility, use -fPIC now
-\ No newline at end of file
-+Target Common Report Var(flag_mybaserel,2)
-+data is adressed relativ to a4 with 32 bit offsets
-+
-+resident
-+Target Common Report Var(flag_mybaserel,1)
-+data is adressed relativ to a4, linked as resident
-+
-+resident32
-+Target Common Report Var(flag_mybaserel,2)
-+data is adressed relativ to a4 with 32 bit offsets, linked as resident
-+
-+mcrt=
-+Target RejectNegative Var(amigaos_crt) Joined
-+Specify startup binary
-\ No newline at end of file
-diff --git a/gcc/config/m68k/m68k.c b/gcc/config/m68k/m68k.c
-index ce28681c1dc9..387f0c1b9e02 100644
---- gcc/config/m68k/m68k.c
-+++ gcc/config/m68k/m68k.c
-@@ -1139,9 +1139,9 @@ m68k_expand_prologue (void)
- current_frame.reg_mask, true, true));
- }
-
--// if (!TARGET_SEP_DATA
--// && crtl->uses_pic_offset_table)
--// emit_insn (gen_load_got (pic_offset_table_rtx));
-+ if (!TARGET_SEP_DATA
-+ && crtl->uses_pic_offset_table)
-+ emit_insn (gen_load_got (pic_offset_table_rtx));
- }
-
- /* Return true if a simple (return) instruction is sufficient for this
-@@ -4496,7 +4496,10 @@ print_operand (FILE *file, rtx op, int letter)
- && !(GET_CODE (XEXP (op, 0)) == CONST_INT
- && INTVAL (XEXP (op, 0)) < 0x8000
- && INTVAL (XEXP (op, 0)) >= -0x8000))
-- fprintf (file, MOTOROLA ? ".l" : ":l");
-+#ifdef TARGET_AMIGA
-+ if (!flag_mybaserel)
-+#endif
-+ fprintf (file, MOTOROLA ? ".l" : ":l");
- }
- else if (GET_CODE (op) == CONST_DOUBLE && GET_MODE (op) == SFmode)
- {
-@@ -4693,10 +4696,8 @@ print_operand_address (FILE *file, rtx addr)
- {
- struct m68k_address address;
-
-- if (!m68k_decompose_address (QImode, addr, true, &address)) {
-- debug_rtx(addr);
-+ if (!m68k_decompose_address (QImode, addr, true, &address))
- gcc_unreachable ();
-- }
-
- if (address.code == PRE_DEC)
- fprintf (file, MOTOROLA ? "-(%s)" : "%s@-",
-@@ -4721,7 +4722,7 @@ print_operand_address (FILE *file, rtx addr)
- /* (d16,PC) or (bd,PC,Xn) (with suppressed index register). */
- fputc ('(', file);
- output_addr_const (file, addr);
-- asm_fprintf (file, flag_pic == 1 || flag_pic == 3 ? ":w,%Rpc)" : ":l,%Rpc)");
-+ asm_fprintf (file, flag_pic == 1 ? ":w,%Rpc)" : ":l,%Rpc)");
- }
- else
- {
-@@ -4738,6 +4739,15 @@ print_operand_address (FILE *file, rtx addr)
- }
- else
- output_addr_const (file, addr);
-+
-+ if (!RTX_FLAG (addr, frame_related))
-+ {
-+// debug_rtx(addr);
-+ if (flag_mybaserel == 1)
-+ asm_fprintf (file, ".w(a4)");
-+ else if (flag_mybaserel == 2)
-+ asm_fprintf (file, "(a4)");
-+ }
- }
- }
- else
-@@ -5126,8 +5136,8 @@ m68k_output_mi_thunk (FILE *file, tree thunk ATTRIBUTE_UNUSED,
- /* Use the static chain register as a temporary (call-clobbered)
- GOT pointer for this function. We can use the static chain
- register because it isn't live on entry to the thunk. */
--// SET_REGNO (pic_offset_table_rtx, STATIC_CHAIN_REGNUM);
--// emit_insn (gen_load_got (pic_offset_table_rtx));
-+ SET_REGNO (pic_offset_table_rtx, STATIC_CHAIN_REGNUM);
-+ emit_insn (gen_load_got (pic_offset_table_rtx));
- }
- legitimize_pic_address (XEXP (mem, 0), Pmode, tmp);
- mem = replace_equiv_address (mem, tmp);
-diff --git a/gcc/config/m68k/m68kamigaos.h b/gcc/config/m68k/m68kamigaos.h
-old mode 100755
-new mode 100644
-index 0ce599138c7d..df0ce5b52ede
---- gcc/config/m68k/m68kamigaos.h
-+++ gcc/config/m68k/m68kamigaos.h
-@@ -25,6 +25,8 @@ along with GCC; see the file COPYING3. If not see
- #define TARGET_AMIGA 1
- #endif
-
-+#define HAS_INIT_SECTION
-+
- #ifndef SWBEG_ASM_OP
- #define SWBEG_ASM_OP "\t.swbeg\t"
- #endif
-@@ -88,6 +90,28 @@ do { \
- fprintf ((FILE), "%s%u\n", ALIGN_ASM_OP, 1 << (LOG)); \
- } while (0)
-
-+#if 0
-+extern int amiga_declare_object;
-+
-+#define ASM_DECLARE_OBJECT_NAME(FILE,NAME,DECL) \
-+if (!DECL_INITIAL (DECL) || \
-+ initializer_zerop (DECL_INITIAL (decl))) \
-+ { \
-+ amiga_declare_object = 1; \
-+ fprintf ((FILE), ".comm\t%s,", NAME); \
-+ } \
-+else \
-+ASM_OUTPUT_LABEL (FILE, NAME)
-+
-+#undef ASM_OUTPUT_SKIP
-+#define ASM_OUTPUT_SKIP(FILE,SIZE) \
-+if (amiga_declare_object) \
-+ fprintf (FILE, "%u\n", (int)(SIZE)); \
-+else \
-+ fprintf (FILE, "\t.skip %u\n", (int)(SIZE)); \
-+amiga_declare_object = 0
-+#endif
-+
- /* Register in which address to store a structure value is passed to a
- function. The default in m68k.h is a1. For m68k/SVR4 it is a0. */
-
-@@ -145,14 +169,8 @@ do { \
- fprintf ((FILE), "%s&%d\n", SWBEG_ASM_OP, XVECLEN (PATTERN (TABLE), 1));
- /* end of stuff from m68kv4.h */
-
--#undef ENDFILE_SPEC
--#define ENDFILE_SPEC "crtend.o%s"
--
--#undef STARTFILE_SPEC
--#define STARTFILE_SPEC "crtbegin.o%s"
--
- #ifndef BSS_SECTION_ASM_OP
--#define BSS_SECTION_ASM_OP "\t.section\t.bss"
-+#define BSS_SECTION_ASM_OP "\t.bss"
- #endif
-
- #ifndef ASM_OUTPUT_ALIGNED_BSS
-@@ -168,8 +186,6 @@ do { \
- provided for compatibility reasons.
- When creating shared libraries, use different 'errno'. */
-
--
--
- #undef TARGET_OS_CPP_BUILTINS
- #define TARGET_OS_CPP_BUILTINS() \
- do \
-@@ -178,8 +194,8 @@ do { \
- builtin_define ("__saveds=__attribute__((__saveds__))"); \
- builtin_define ("__interrupt=__attribute__((__interrupt__))"); \
- builtin_define ("__stackext=__attribute__((__stackext__))"); \
-- builtin_define ("__regargs_x=__attribute__((regparm))"); \
-- builtin_define ("__stdargs_x=__attribute__((stkparm))"); \
-+ builtin_define ("__regargs=__attribute__((regparm))"); \
-+ builtin_define ("__stdargs=__attribute__((stkparm))"); \
- builtin_define ("__aligned=__attribute__((__aligned__(4)))"); \
- builtin_define_std ("amiga"); \
- builtin_define_std ("amigaos"); \
-@@ -195,6 +211,11 @@ if (target_flags & (MASK_RESTORE_A4|MASK_ALWAYS_RESTORE_A4)) \
-
- #endif
-
-+/* put return values in FPU build in FP0 Reg */
-+#undef FUNCTION_VALUE_REGNO_P
-+#define FUNCTION_VALUE_REGNO_P(N) \
-+ ((N) == D0_REG || (N) == A0_REG || (TARGET_68881 && (N) == FP0_REG))
-+
- /* Inform the program which CPU we compile for. */
-
- //#undef TARGET_CPU_CPP_BUILTINS
-@@ -229,14 +250,27 @@ if (target_flags & (MASK_RESTORE_A4|MASK_ALWAYS_RESTORE_A4)) \
- } \
- while (0)
- */
-+
-+/* When creating shared libraries, use different 'errno'. */
-+#define CPP_IXEMUL_SPEC \
-+ "%{!ansi:-Dixemul} -D__ixemul__ -D__ixemul " \
-+ "%{malways-restore-a4:-Derrno=(*ixemul_errno)} " \
-+ "%{mrestore-a4:-Derrno=(*ixemul_errno)}"
-+#define CPP_LIBNIX_SPEC \
-+ "-isystem %(sdk_root)libnix/include " \
-+ "%{!ansi:-Dlibnix} -D__libnix__ -D__libnix"
-+#define CPP_CLIB2_SPEC \
-+ "-isystem %(sdk_root)clib2/include " \
-+ "%{!ansi:-DCLIB2} -D__CLIB2__ -D__CLIB2"
-+
- /* Define __HAVE_68881__ in preprocessor according to the -m flags.
- This will control the use of inline 68881 insns in certain macros.
- Note: it should be set in TARGET_CPU_CPP_BUILTINS but TARGET_68881
- isn't the same -m68881 since its also true for -m680[46]0 ...
- Differentiate between libnix and ixemul. */
-
--#define CPP_SPEC \
-- "%{m68881:-D__HAVE_68881__} " \
-+#define CPP_SPEC \
-+ "%{m68881:-D__HAVE_68881__} " \
- "%{!ansi:" \
- "%{m68020:-Dmc68020} " \
- "%{mc68020:-Dmc68020} " \
-@@ -252,16 +286,10 @@ if (target_flags & (MASK_RESTORE_A4|MASK_ALWAYS_RESTORE_A4)) \
- "%{m68030:-D__mc68030__ -D__mc68030} " \
- "%{m68040:-D__mc68040__ -D__mc68040} " \
- "%{m68060:-D__mc68060__ -D__mc68060} " \
-- "%{noixemul:%{!ansi:%{!std=*:-Dlibnix}%{std=gnu*:-Dlibnix}} -D__libnix -D__libnix__} " \
-- "%{!noixemul:%{!ansi:%{!std=*:-Dixemul}%{std=gnu*:-Dixemul}} -D__ixemul -D__ixemul__}"
--
--/* Translate '-resident' to '-fbaserel' (they differ in linking stage only).
-- Don't put function addresses in registers for PC-relative code. */
--
--#define CC1_SPEC \
-- "%{resident:-fbaserel} " \
-- "%{resident32:-fbaserel32} " \
-- "%{msmall-code:-fno-function-cse}"
-+ "%{noixemul:%(cpp_libnix)} " \
-+ "%{mcrt=nix*:%(cpp_libnix)} " \
-+ "%{mcrt=ixemul:%(cpp_ixemul)} " \
-+ "%{mcrt=clib2:%(cpp_clib2)}"
-
- /* Various -m flags require special flags to the assembler. */
-
-@@ -280,48 +308,56 @@ if (target_flags & (MASK_RESTORE_A4|MASK_ALWAYS_RESTORE_A4)) \
- #define ASM_CPU_DEFAULT_SPEC \
- "%{!m680*:%{!mc680*:-m68040}}"
-
--/* If debugging, tell the linker to output amiga-hunk symbols *and* a BSD
-- compatible debug hunk.
-- Also, pass appropriate linker flavours depending on user-supplied
-- commandline options. */
--
--#define LINK_SPEC \
-- "%{noixemul:-fl libnix} " \
-- "%{resident*:-amiga-datadata-reloc} " \
-- "%{resident|fbaserel:-m amiga_bss -fl libb} " \
-- "%{resident32|fbaserel32:-m amiga_bss -fl libb32} " \
-- "%{g:-amiga-debug-hunk} " \
-- "%(link_cpu)"
--
--#define LINK_CPU_SPEC \
-- "%{m6802*|mc68020|m68030|m68040|m68060:-fl libm020} " \
-- "%{m68881:-fl libm881}"
--
- /* Choose the right startup file, depending on whether we use base relative
- code, base relative code with automatic relocation (-resident), their
- 32-bit versions, libnix, profiling or plain crt0.o. */
-
--#undef STARTFILE_SPEC
--#define STARTFILE_SPEC \
-- "%{!noixemul:" \
-- "%{fbaserel:%{!resident:bcrt0.o%s}}" \
-- "%{resident:rcrt0.o%s}" \
-- "%{fbaserel32:%{!resident32:lcrt0.o%s}}" \
-- "%{resident32:scrt0.o%s}" \
-- "%{!resident:%{!fbaserel:%{!resident32:%{!fbaserel32:" \
-- "%{pg:gcrt0.o%s}%{!pg:%{p:mcrt0.o%s}%{!p:crt0.o%s}}}}}}}" \
-- "%{noixemul:" \
-- "%{resident:libnix/nrcrt0.o%s} " \
-- "%{!resident:%{fbaserel:libnix/nbcrt0.o%s}%{!fbaserel:libnix/ncrt0.o%s}}}"
-+#define STARTFILE_IXEMUL_SPEC \
-+ "%{fbaserel:%{!resident:bcrt0.o%s}}" \
-+ "%{resident:rcrt0.o%s}" \
-+ "%{fbaserel32:%{!resident32:lcrt0.o%s}}" \
-+ "%{resident32:scrt0.o%s}" \
-+ "%{!resident:%{!fbaserel:%{!resident32:%{!fbaserel32:" \
-+ "%{pg:gcrt0.o%s}%{!pg:%{p:mcrt0.o%s}%{!p:crt0.o%s}}}}}}"
-+#define STARTFILE_LIBNIX_SPEC \
-+ "%(sdk_root)lib/libnix/" \
-+ "%{ramiga-*:" \
-+ "%{ramiga-lib:libinit.o%s}" \
-+ "%{ramiga-libr:libinitr.o%s}" \
-+ "%{ramiga-dev:devinit.o%s}}" \
-+ "%{!ramiga-*:" \
-+ "%{resident:nrcrt0.o%s}" \
-+ "%{!resident:" \
-+ "%{fbaserel:nbcrt0.o%s}" \
-+ "%{!fbaserel:ncrt0.o%s}}}"
-+#define STARTFILE_CLIB2_SPEC \
-+ "%(sdk_root)clib2/lib/" \
-+ "%{resident32:nr32crt0.o%s}" \
-+ "%{!resident32:" \
-+ "%{fbaserel32:nb32crt0.o%s}" \
-+ "%{!fbaserel32:" \
-+ "%{resident:nrcrt0.o%s}" \
-+ "%{!resident:" \
-+ "%{fbaserel:nbcrt0.o%s}" \
-+ "%{!fbaserel:ncrt0.o%s}}}}"
-
--#undef ENDFILE_SPEC
--#define ENDFILE_SPEC \
-- "%{noixemul:-lstubs}"
-+#undef STARTFILE_SPEC
-+#define STARTFILE_SPEC \
-+ "%{noixemul:%(startfile_libnix)} " \
-+ "%{mcrt=nix*:%(startfile_libnix)} " \
-+ "%{mcrt=ixemul:%(startfile_ixemul)} " \
-+ "%{mcrt=clib2:%(startfile_clib2)}"
-
--/* put return values in FPU build in FP0 Reg */
--#undef FUNCTION_VALUE_REGNO_P
--#define FUNCTION_VALUE_REGNO_P(N) \
-- ((N) == D0_REG || (N) == A0_REG || (TARGET_68881 && (N) == FP0_REG))
-+#define ENDFILE_IXEMUL_SPEC ""
-+#define ENDFILE_LIBNIX_SPEC "-lstubs"
-+#define ENDFILE_CLIB2_SPEC ""
-+
-+#undef ENDFILE_SPEC
-+#define ENDFILE_SPEC \
-+ "%{noixemul:%(endfile_libnix)} " \
-+ "%{mcrt=nix*:%(endfile_libnix)} " \
-+ "%{mcrt=ixemul:%(endfile_ixemul)} " \
-+ "%{mcrt=clib2:%(endfile_clib2)}"
-
-
- /* Automatically search libamiga.a for AmigaOS specific functions. Note
-@@ -337,13 +373,106 @@ if (target_flags & (MASK_RESTORE_A4|MASK_ALWAYS_RESTORE_A4)) \
- to put in a -lamiga himself and get it in the wrong place, so that (for
- example) calls like sprintf come from -lamiga rather than -lc. */
-
--#undef LIB_SPEC
--#define LIB_SPEC \
-- "%{!noixemul:" \
-- "%{p|pg:-lc_p}" \
-- "%{!p:%{!pg:-lc -lamiga -lc}}}" \
-- "%{noixemul:" \
-- "-lnixmain -lnix -lamiga %{mstackcheck|mstackextend:-lstack}}"
-+#define LIB_IXEMUL_SPEC \
-+ "%{!p:%{!pg:-lc -lamiga -lc}} " \
-+ "%{p:-lc_p} %{pg:-lc_p}"
-+#define LIB_LIBNIX_SPEC \
-+ "-lnixmain -lnix -lstubs " \
-+ "%{mcrt=*:-l%*} " \
-+ "%{!mcrt=*:-lnix20} " \
-+ "-lamiga " \
-+ "%{mstackcheck:-lstack} " \
-+ "%{mstackextend:-lstack}"
-+#define LIB_CLIB2_SPEC \
-+ "-lc -lamiga -ldebug " \
-+ "%{mstackcheck:-lstack} " \
-+ "%{mstackextend:-lstack}"
-+
-+#define LIB_SPEC \
-+ "%{noixemul:%(lib_libnix)} " \
-+ "%{mcrt=nix*:%(lib_libnix)} " \
-+ "%{mcrt=ixemul:%(lib_ixemul)} " \
-+ "%{mcrt=clib2:%(lib_clib2)}"
-+
-+#define LIBGCC_IXEMUL_SPEC ""
-+#define LIBGCC_LIBNIX_SPEC "-lnix " \
-+ "%{mcrt=*:-l%*} " \
-+ "%{!mcrt=*:-lnix20}"
-+#define LIBGCC_CLIB2_SPEC "-lc"
-+//#define LIBGCC_SPEC "-lgcc "
-+#define LIBGCC_SPEC " " \
-+ "%{noixemul:%(libgcc_libnix)} " \
-+ "%{mcrt=nix*:%(libgcc_libnix)} " \
-+ "%{mcrt=ixemul:%(libgcc_ixemul)} " \
-+ "%{mcrt=clib2:%(libgcc_clib2)}"
-+
-+/* If debugging, tell the linker to output amiga-hunk symbols *and* a BSD
-+ compatible debug hunk.
-+ Also, pass appropriate linker flavours depending on user-supplied
-+ commandline options. */
-+
-+#define LINK_IXEMUL_SPEC ""
-+#define LINK_LIBNIX_SPEC "-L%(sdk_root)libnix/lib -fl libnix"
-+#define LINK_CLIB2_SPEC "-L%(sdk_root)clib2/lib"
-+
-+/* If debugging, tell the linker to output amiga-hunk symbols *and* a BSD
-+ compatible debug hunk.
-+ Also, pass appropriate linker flavours depending on user-supplied
-+ commandline options. */
-+
-+#define LINK_SPEC \
-+ "%{noixemul:%(link_libnix)} " \
-+ "%{mcrt=nix*:%(link_libnix)} " \
-+ "%{mcrt=ixemul:%(link_ixemul)} " \
-+ "%{mcrt=clib2:%(link_clib2)} " \
-+ "%{fbaserel:%{!resident:-m amiga_bss -fl libb}} " \
-+ "%{resident:-m amiga_bss -amiga-datadata-reloc -fl libb} " \
-+ "%{fbaserel32:%{!resident32:-m amiga_bss -fl libb32}} " \
-+ "%{resident32:-m amiga_bss -amiga-datadata-reloc -fl libb32} " \
-+ "%{g:-amiga-debug-hunk} " \
-+ "%{m68020:-fl libm020} " \
-+ "%{mc68020:-fl libm020} " \
-+ "%{m68030:-fl libm020} " \
-+ "%{m68040:-fl libm020} " \
-+ "%{m68060:-fl libm020} " \
-+ "%{m68020-40:-fl libm020} " \
-+ "%{m68020-60:-fl libm020} " \
-+ "%{m68881:-fl libm881}"
-+
-+/* Translate '-resident' to '-fbaserel' (they differ in linking stage only).
-+ Don't put function addresses in registers for PC-relative code. */
-+
-+#define CC1_SPEC \
-+ "%{resident:-fbaserel} " \
-+ "%{resident32:-fbaserel32} " \
-+ "%{msmall-code:-fno-function-cse}"
-+
-+#define LINK_CPU_SPEC \
-+ "%{m6802*|mc68020|m68030|m68040|m68060:-fl libm020} " \
-+ "%{m68881:-fl libm881}"
-+
-+/* [cahirwpz] A modified copy of LINK_COMMAND_SPEC from gcc/gcc.c file.
-+ Don't prepend libgcc.a to link libraries and make sure the options is
-+ at the end of command line. Otherwise linker chooses generic functions
-+ from libgcc.a instead AmigaOS-specific counterparts from libnix.a. */
-+
-+#define LINK_COMMAND_SPEC \
-+ "%{!fsyntax-only:" \
-+ "%{!c:" \
-+ "%{!M:" \
-+ "%{!MM:" \
-+ "%{!E:" \
-+ "%{!S:" \
-+ "%(linker) %l %X %{o*} %{A} %{d} %{e*} %{m} " \
-+ "%{N} %{n} %{r} %{s} %{t} %{u*} %{x} %{z} %{Z} " \
-+ "%{!A:%{!nostdlib:%{!nostartfiles:%S}}} " \
-+ "%{static:} %{L*} %D %o " \
-+ "%{!nostdlib:%{!nodefaultlibs:%L}} " \
-+ "%{!A:%{!nostdlib:%{!nostartfiles:%E}}} " \
-+ "%{!nostdlib:%{!nodefaultlibs:%G}} " \
-+ "%{T*} }}}}}} " \
-+
-+
-
- /* This macro defines names of additional specifications to put in the specs
- that can be used in various specifications like CC1_SPEC. Its definition
-@@ -358,8 +487,26 @@ if (target_flags & (MASK_RESTORE_A4|MASK_ALWAYS_RESTORE_A4)) \
- #define EXTRA_SPECS \
- { "asm_cpu", ASM_CPU_SPEC }, \
- { "asm_cpu_default", ASM_CPU_DEFAULT_SPEC }, \
-- { "link_cpu", LINK_CPU_SPEC }
--
-+ { "link_cpu", LINK_CPU_SPEC }, \
-+ {"sdk_root", TOOLDIR_BASE_PREFIX "m68k-amigaos/"}, \
-+ {"cpp_ixemul", CPP_IXEMUL_SPEC}, \
-+ {"cpp_libnix", CPP_LIBNIX_SPEC}, \
-+ {"cpp_clib2", CPP_CLIB2_SPEC}, \
-+ {"lib_ixemul", LIB_IXEMUL_SPEC}, \
-+ {"lib_libnix", LIB_LIBNIX_SPEC}, \
-+ {"lib_clib2", LIB_CLIB2_SPEC}, \
-+ {"link_ixemul", LINK_IXEMUL_SPEC}, \
-+ {"link_libnix", LINK_LIBNIX_SPEC}, \
-+ {"link_clib2", LINK_CLIB2_SPEC}, \
-+ {"startfile_ixemul", STARTFILE_IXEMUL_SPEC}, \
-+ {"startfile_libnix", STARTFILE_LIBNIX_SPEC}, \
-+ {"startfile_clib2", STARTFILE_CLIB2_SPEC}, \
-+ {"endfile_ixemul", ENDFILE_IXEMUL_SPEC}, \
-+ {"endfile_libnix", ENDFILE_LIBNIX_SPEC}, \
-+ {"endfile_clib2", ENDFILE_CLIB2_SPEC}, \
-+ {"libgcc_ixemul", LIBGCC_IXEMUL_SPEC}, \
-+ {"libgcc_libnix", LIBGCC_LIBNIX_SPEC}, \
-+ {"libgcc_clib2", LIBGCC_CLIB2_SPEC}
-
- /* begin-GG-local: dynamic libraries */
-
-
-From d1df1ebb0f08f356222c21b1744476eb881b3b0c Mon Sep 17 00:00:00 2001
-From: bebbo <bebbo(a)bejy.net>
-Date: Wed, 1 Feb 2017 11:40:21 +0100
-Subject: [PATCH 010/303] @B mregparm was always enabled with 2 registers. Now
- it's off.
-
----
- gcc/config/m68k/amigaos.c | 30 ++++++++++++++++++------------
- gcc/config/m68k/amigaos.opt | 2 +-
- gcc/config/m68k/m68k.c | 11 ++++++-----
- 3 files changed, 25 insertions(+), 18 deletions(-)
-
-diff --git a/gcc/config/m68k/amigaos.c b/gcc/config/m68k/amigaos.c
-index 19b0f5b4cc82..e2dd5bab75f9 100644
---- gcc/config/m68k/amigaos.c
-+++ gcc/config/m68k/amigaos.c
-@@ -40,6 +40,12 @@ Boston, MA 02111-1307, USA. */
- #include "diagnostic-core.h"
- #include "config/m68k/amigaos.h"
-
-+//#define MYDEBUG 1
-+#ifdef MYDEBUG
-+#define DPRINTF(x) printf x; fflush(stdout);
-+#else
-+#define DPRINTF(x)
-+#endif
-
- //int amiga_declare_object;
-
-@@ -379,8 +385,8 @@ amigaos_init_cumulative_args (CUMULATIVE_ARGS *cump, tree fntype)
- {
- struct amigaos_args * cum = &mycum;
- lastcum = cump;
-- cum->num_of_regs = amigaos_regparm;
--// printf("amigaos_init_cumulative_args %p -> %d\r\n", cum, cum->num_of_regs); fflush(stdout);
-+ cum->num_of_regs = amigaos_regparm > 0 ? amigaos_regparm : 0;
-+ DPRINTF(("amigaos_init_cumulative_args %p -> %d\r\n", cum, cum->num_of_regs));
-
- /* Initialize a variable CUM of type CUMULATIVE_ARGS
- for a call to a function whose data type is FNTYPE.
-@@ -396,7 +402,7 @@ amigaos_init_cumulative_args (CUMULATIVE_ARGS *cump, tree fntype)
- else
- {
- tree ratree = lookup_attribute ("regparm", TYPE_ATTRIBUTES(fntype));
-- cum->num_of_regs = amigaos_regparm ?
-+ cum->num_of_regs = amigaos_regparm != 0 ?
- amigaos_regparm : AMIGAOS_DEFAULT_REGPARM;
- if (ratree)
- {
-@@ -456,7 +462,7 @@ amigaos_function_arg_advance (cumulative_args_t cum_v, machine_mode, const_tree,
- CUMULATIVE_ARGS *cump = (CUMULATIVE_ARGS *) get_cumulative_args (cum_v);
- /* Update the data in CUM to advance over an argument. */
-
-- // printf("amigaos_function_arg_advance1 %p\r\n", cump); fflush(stdout);
-+ DPRINTF(("amigaos_function_arg_advance1 %p\r\n", cump));
- if (cump != lastcum)
- return;
-
-@@ -490,7 +496,7 @@ static struct rtx_def *
- _m68k_function_arg (CUMULATIVE_ARGS *cump, machine_mode mode, const_tree type)
- {
- struct amigaos_args * cum = &mycum;
-- // printf("m68k_function_arg numOfRegs=%p\r\n", cum);
-+ DPRINTF(("m68k_function_arg numOfRegs=%d\r\n", cum ? cum->num_of_regs : 0));
-
- if (cump != lastcum)
- return 0;
-@@ -550,7 +556,7 @@ _m68k_function_arg (CUMULATIVE_ARGS *cump, machine_mode mode, const_tree type)
-
- if (cum->last_arg_reg != -1)
- {
-- // printf("-> gen_rtx_REG %d\r\n", cum->last_arg_reg);
-+ DPRINTF(("-> gen_rtx_REG %d\r\n", cum->last_arg_reg));
- return gen_rtx_REG (mode, cum->last_arg_reg);
- }
- }
-@@ -566,7 +572,7 @@ amigaos_function_arg (cumulative_args_t cum_v, machine_mode mode,
- {
- struct amigaos_args * cum = &mycum;
-
-- // printf("amigaos_function_arg %p\r\n", cum_v.p); fflush(stdout);
-+ DPRINTF(("amigaos_function_arg %p\r\n", cum_v.p));
-
- CUMULATIVE_ARGS *cump = (CUMULATIVE_ARGS *) get_cumulative_args (cum_v);
-
-@@ -598,7 +604,7 @@ amigaos_function_arg (cumulative_args_t cum_v, machine_mode mode,
- int
- amigaos_comp_type_attributes (const_tree type1, const_tree type2)
- {
-- printf("amigaos_comp_type_attributes\n");
-+ DPRINTF(("amigaos_comp_type_attributes\n"));
- /* Functions or methods are incompatible if they specify mutually exclusive
- ways of passing arguments. */
- if (TREE_CODE(type1) == FUNCTION_TYPE || TREE_CODE(type1) == METHOD_TYPE)
-@@ -688,7 +694,7 @@ amigaos_handle_type_attribute (tree *node, tree name, tree args,
- {
- tree nnn = *node;
- do { // while (0);
--// printf("%p with treecode %d\n", node, TREE_CODE(nnn)); fflush(stdout);
-+ DPRINTF(("%p with treecode %d\n", node, TREE_CODE(nnn)));
- if (TREE_CODE (nnn) == FUNCTION_DECL || TREE_CODE (nnn) == FUNCTION_TYPE
- || TREE_CODE (nnn) == METHOD_TYPE)
- {
-@@ -696,7 +702,7 @@ amigaos_handle_type_attribute (tree *node, tree name, tree args,
- single class that should be used to pass arguments. */
- if (is_attribute_p ("regparm", name))
- {
--// printf ("regparm found\n"); fflush(stdout);
-+ DPRINTF(("regparm found\n"));
-
- if (lookup_attribute ("stkparm", TYPE_ATTRIBUTES(nnn)))
- {
-@@ -706,7 +712,7 @@ amigaos_handle_type_attribute (tree *node, tree name, tree args,
- if (args && TREE_CODE (args) == TREE_LIST)
- {
- tree val = TREE_VALUE(args);
--// printf ("regparm with val: %d\n", TREE_CODE(val));
-+ DPRINTF(("regparm with val: %d\n", TREE_CODE(val)));
- if (TREE_CODE (val) == INTEGER_CST)
- {
- int no = TREE_INT_CST_LOW(val);
-@@ -765,7 +771,7 @@ bool
- amigaos_rtx_costs (rtx x, machine_mode mode, int outer_code, int opno,
- int *total, bool speed)
- {
--// printf("outer: %d, opno: %d", outer_code, opno); fflush(stdout);
-+ DPRINTF(("outer: %d, opno: %d", outer_code, opno));
- // debug_rtx(x);
- bool r = m68k_rtx_costs (x, mode, outer_code, opno, total, speed);
- *total *= 4;
-diff --git a/gcc/config/m68k/amigaos.opt b/gcc/config/m68k/amigaos.opt
-index 29a3688470d0..212ab8e6efda 100644
---- gcc/config/m68k/amigaos.opt
-+++ gcc/config/m68k/amigaos.opt
-@@ -1,6 +1,6 @@
-
- mregparm=
--Target RejectNegative Var(amigaos_regparm) Joined UInteger
-+Target RejectNegative Var(amigaos_regparm) Joined UInteger Init(-1)
- Pass arguments through registers.
-
- noixemul
-diff --git a/gcc/config/m68k/m68k.c b/gcc/config/m68k/m68k.c
-index 387f0c1b9e02..3ebc9020c4e0 100644
---- gcc/config/m68k/m68k.c
-+++ gcc/config/m68k/m68k.c
-@@ -166,7 +166,7 @@ static bool m68k_save_reg (unsigned int regno, bool interrupt_handler);
- static bool m68k_ok_for_sibcall_p (tree, tree);
- static bool m68k_tls_symbol_p (rtx);
- static rtx m68k_legitimize_address (rtx, rtx, machine_mode);
--#ifndef TARGET_AMIGAOS
-+#ifndef TARGET_AMIGA
- static
- #endif
- bool m68k_rtx_costs (rtx, machine_mode, int, int, int *, bool);
-@@ -2803,7 +2803,7 @@ const_int_cost (HOST_WIDE_INT i)
- }
- }
-
--#ifndef TARGET_AMIGAOS
-+#ifndef TARGET_AMIGA
- static
- #endif
- bool
-@@ -4544,9 +4544,10 @@ m68k_get_reloc_decoration (enum m68k_reloc reloc)
- switch (reloc)
- {
- case RELOC_GOT:
-- if (TARGET_AMIGAOS)
-- return "";
-- else if (MOTOROLA)
-+// if (TARGET_AMIGA)
-+// return "";
-+// else
-+ if (MOTOROLA)
- {
- if (flag_pic == 1 && TARGET_68020)
- return "@GOT.w";
-
-From 0a6678c57629151eaec736ce82fa69dcc4e08c53 Mon Sep 17 00:00:00 2001
-From: bebbo <bebbo(a)bejy.net>
-Date: Thu, 9 Feb 2017 22:01:27 +0100
-Subject: [PATCH 011/303] @B select correct crt0 file with baserel32
-
----
- gcc/config/m68k/m68kamigaos.h | 6 +++++-
- 1 file changed, 5 insertions(+), 1 deletion(-)
-
-diff --git a/gcc/config/m68k/m68kamigaos.h b/gcc/config/m68k/m68kamigaos.h
-index df0ce5b52ede..0650102861e8 100644
---- gcc/config/m68k/m68kamigaos.h
-+++ gcc/config/m68k/m68kamigaos.h
-@@ -329,7 +329,10 @@ if (target_flags & (MASK_RESTORE_A4|MASK_ALWAYS_RESTORE_A4)) \
- "%{resident:nrcrt0.o%s}" \
- "%{!resident:" \
- "%{fbaserel:nbcrt0.o%s}" \
-- "%{!fbaserel:ncrt0.o%s}}}"
-+ "%{!fbaserel:" \
-+ "%{fbaserel32:nlbcrt0.o%s}" \
-+ "%{!fbaserel32:ncrt0.o%s}}}}"
-+
- #define STARTFILE_CLIB2_SPEC \
- "%(sdk_root)clib2/lib/" \
- "%{resident32:nr32crt0.o%s}" \
-@@ -430,6 +433,7 @@ if (target_flags & (MASK_RESTORE_A4|MASK_ALWAYS_RESTORE_A4)) \
- "%{fbaserel32:%{!resident32:-m amiga_bss -fl libb32}} " \
- "%{resident32:-m amiga_bss -amiga-datadata-reloc -fl libb32} " \
- "%{g:-amiga-debug-hunk} " \
-+ "%{mcpu=68020:-fl libm020} " \
- "%{m68020:-fl libm020} " \
- "%{mc68020:-fl libm020} " \
- "%{m68030:-fl libm020} " \
-
-From 38ec4180a5c5d9d7a87725d347838f3b55f837fa Mon Sep 17 00:00:00 2001
-From: bebbo <bebbo(a)bejy.net>
-Date: Thu, 9 Feb 2017 22:02:40 +0100
-Subject: [PATCH 012/303] @B -m68881 is not longer enabled by default for
- -m68020
-
----
- gcc/config/m68k/m68k.c | 14 ++++++++++++--
- 1 file changed, 12 insertions(+), 2 deletions(-)
-
-diff --git a/gcc/config/m68k/m68k.c b/gcc/config/m68k/m68k.c
-index 3ebc9020c4e0..c67194fa292d 100644
---- gcc/config/m68k/m68k.c
-+++ gcc/config/m68k/m68k.c
-@@ -352,11 +352,21 @@ struct gcc_target targetm = TARGET_INITIALIZER;
- /* Base flags for 68k ISAs. */
- #define FL_FOR_isa_00 FL_ISA_68000
- #define FL_FOR_isa_10 (FL_FOR_isa_00 | FL_ISA_68010)
--/* FL_68881 controls the default setting of -m68881. gcc has traditionally
-+/* "FL_68881 controls the default setting of -m68881. gcc has traditionally
- generated 68881 code for 68020 and 68030 targets unless explicitly told
-- not to. */
-+ not to."
-+
-+ This is not true at least for the AMIGA.
-+ gcc 2.93 does not set the 68881 flag.
-+
-+ */
-+#ifdef TARGET_AMIGA
-+#define FL_FOR_isa_20 (FL_FOR_isa_10 | FL_ISA_68020 \
-+ | FL_BITFIELD | FL_CAS)
-+#else
- #define FL_FOR_isa_20 (FL_FOR_isa_10 | FL_ISA_68020 \
- | FL_BITFIELD | FL_68881 | FL_CAS)
-+#endif
- #define FL_FOR_isa_40 (FL_FOR_isa_20 | FL_ISA_68040)
- #define FL_FOR_isa_cpu32 (FL_FOR_isa_10 | FL_ISA_68020)
-
-
-From 5d9da9f9a2d9fec32fba2b7b9f2326d1f1c4f1f0 Mon Sep 17 00:00:00 2001
-From: bebbo <bebbo(a)bejy.net>
-Date: Thu, 9 Feb 2017 22:05:42 +0100
-Subject: [PATCH 013/303] @R added a hack to support multiline __asm("...")
- statements
-
----
- gcc/c/c-parser.c | 7 +++++++
- libcpp/lex.c | 23 ++++++++++++++++++++++-
- 2 files changed, 29 insertions(+), 1 deletion(-)
-
-diff --git a/gcc/c/c-parser.c b/gcc/c/c-parser.c
-index d8725b572b55..cde6fe0c1c59 100644
---- gcc/c/c-parser.c
-+++ gcc/c/c-parser.c
-@@ -3908,6 +3908,7 @@ c_parser_asm_string_literal (c_parser *parser)
- static tree
- c_parser_simple_asm_expr (c_parser *parser)
- {
-+ extern int in_assembler_directive;
- tree str;
- gcc_assert (c_parser_next_token_is_keyword (parser, RID_ASM));
- /* ??? Follow the C++ parser rather than using the
-@@ -3919,7 +3920,13 @@ c_parser_simple_asm_expr (c_parser *parser)
- parser->lex_untranslated_string = false;
- return NULL_TREE;
- }
-+
-+ // SBF: set in_assembler_directive to enable multi-line strings. And yes, it's a HACK.
-+ in_assembler_directive = 1;
- str = c_parser_asm_string_literal (parser);
-+ // SBF: in_assembler_directive disabled
-+ in_assembler_directive = 0;
-+
- parser->lex_untranslated_string = false;
- if (!c_parser_require (parser, CPP_CLOSE_PAREN, "expected %<)%>"))
- {
-diff --git a/libcpp/lex.c b/libcpp/lex.c
-index e5a0397f3099..c2131adeb38e 100644
---- libcpp/lex.c
-+++ libcpp/lex.c
-@@ -64,6 +64,10 @@ static tokenrun *next_tokenrun (tokenrun *);
-
- static _cpp_buff *new_buff (size_t);
-
-+/*
-+ * SBF: This flag is set if an asm statement is parsed, to support multiline strings in __asm()
-+ */
-+int in_assembler_directive;
-
- /* Utility routine:
-
-@@ -1063,7 +1067,10 @@ _cpp_process_line_notes (cpp_reader *pfile, int in_comment)
- else if (note->type == 0)
- /* Already processed in lex_raw_string. */;
- else
-- abort ();
-+ {
-+// abort ();
-+ printf("ups: note type=%d\n", note->type);
-+ }
- }
- }
-
-@@ -1875,6 +1882,20 @@ lex_string (cpp_reader *pfile, cpp_token *token, const uchar *base)
- break;
- else if (c == '\n')
- {
-+ /*
-+ * SBF: allow multi-line strings
-+ * Ignore the line end and move to next line.
-+ * Only fail, if there is no next line
-+ */
-+ if (in_assembler_directive)
-+ {
-+ cpp_buffer *buffer = pfile->buffer;
-+ if (buffer->cur < buffer->rlimit)
-+ CPP_INCREMENT_LINE (pfile, 0);
-+ buffer->need_line = true;
-+ if (_cpp_get_fresh_line (pfile))
-+ continue;
-+ }
- cur--;
- /* Unmatched quotes always yield undefined behavior, but
- greedy lexing means that what appears to be an unterminated
-
-From 6515b7470c3baf385a0dca132bc1c71acbcdda5f Mon Sep 17 00:00:00 2001
-From: bebbo <bebbo(a)bejy.net>
-Date: Sun, 12 Feb 2017 12:40:37 +0100
-Subject: [PATCH 014/303] @R allow used registers inside of the clobber list
-
----
- gcc/cfgexpand.c | 12 ++++++++++--
- 1 file changed, 10 insertions(+), 2 deletions(-)
-
-diff --git a/gcc/cfgexpand.c b/gcc/cfgexpand.c
-index b612293b1a7a..4215ae90c63d 100644
---- gcc/cfgexpand.c
-+++ gcc/cfgexpand.c
-@@ -2732,6 +2732,10 @@ tree_conflicts_with_clobbers_p (tree t, HARD_REG_SET *clobbered_regs)
- {
- /* Conflicts between asm-declared register variables and the clobber
- list are not allowed. */
-+ /*
-+ * SBF: Why?
-+ */
-+#ifndef TARGET_AMIGA
- tree overlap = tree_overlaps_hard_reg_set (t, clobbered_regs);
-
- if (overlap)
-@@ -2744,7 +2748,7 @@ tree_conflicts_with_clobbers_p (tree t, HARD_REG_SET *clobbered_regs)
- DECL_REGISTER (overlap) = 0;
- return true;
- }
--
-+#endif
- return false;
- }
-
-@@ -3255,11 +3259,15 @@ expand_asm_stmt (gasm *stmt)
- if (reg_overlap_mentioned_p (clobbered_reg, output_rvec[k]))
- internal_error ("asm clobber conflict with output operand");
-
-+/**
-+ * SBF: Why?
-+ */
-+#ifndef TARGET_AMIGA
- for (unsigned k = 0; k < ninputs - ninout; ++k)
- if (reg_overlap_mentioned_p (clobbered_reg, input_rvec[k]))
- internal_error ("asm clobber conflict with input operand");
-+#endif
- }
--
- XVECEXP (body, 0, i++) = gen_rtx_CLOBBER (VOIDmode, clobbered_reg);
- }
-
-
-From 7de2f3e6f2786a6d5e789230227f9d7c5f3e2316 Mon Sep 17 00:00:00 2001
-From: bebbo <bebbo(a)bejy.net>
-Date: Sun, 12 Feb 2017 12:41:09 +0100
-Subject: [PATCH 015/303] @B fix mixing struct/class for the same class.
-
----
- gcc/coretypes.h | 6 +++---
- 1 file changed, 3 insertions(+), 3 deletions(-)
-
-diff --git a/gcc/coretypes.h b/gcc/coretypes.h
-index 12067fdf5348..f0f069f6afa2 100644
---- gcc/coretypes.h
-+++ gcc/coretypes.h
-@@ -52,9 +52,9 @@ typedef const struct bitmap_head *const_bitmap;
- struct simple_bitmap_def;
- typedef struct simple_bitmap_def *sbitmap;
- typedef const struct simple_bitmap_def *const_sbitmap;
--struct rtx_def;
--typedef struct rtx_def *rtx;
--typedef const struct rtx_def *const_rtx;
-+class rtx_def;
-+typedef class rtx_def *rtx;
-+typedef const class rtx_def *const_rtx;
-
- /* Subclasses of rtx_def, using indentation to show the class
- hierarchy, along with the relevant invariant.
-
-From bb99da7652edb584a7825632fdccf0db0d7080d4 Mon Sep 17 00:00:00 2001
-From: bebbo <bebbo(a)bejy.net>
-Date: Sun, 12 Feb 2017 12:42:09 +0100
-Subject: [PATCH 016/303] @B fixed - on an unsigned value, add cast to signed
-
----
- gcc/hwint.h | 2 +-
- 1 file changed, 1 insertion(+), 1 deletion(-)
-
-diff --git a/gcc/hwint.h b/gcc/hwint.h
-index 14740ccc939a..cd4a35c98f7b 100644
---- gcc/hwint.h
-+++ gcc/hwint.h
-@@ -294,7 +294,7 @@ abs_hwi (HOST_WIDE_INT x)
- inline unsigned HOST_WIDE_INT
- absu_hwi (HOST_WIDE_INT x)
- {
-- return x >= 0 ? (unsigned HOST_WIDE_INT)x : -(unsigned HOST_WIDE_INT)x;
-+ return x >= 0 ? (unsigned HOST_WIDE_INT)x : -(signed HOST_WIDE_INT)x;
- }
-
- #endif /* ! GCC_HWINT_H */
-
-From e66d5a27e1e5257373172597fe9a699011b011d7 Mon Sep 17 00:00:00 2001
-From: bebbo <bebbo(a)bejy.net>
-Date: Sun, 12 Feb 2017 12:42:45 +0100
-Subject: [PATCH 017/303] @N add amiga target
-
----
- libgcc/config.host | 3 +++
- 1 file changed, 3 insertions(+)
-
-diff --git a/libgcc/config.host b/libgcc/config.host
-index 124f2ceaefda..1849a2ec1980 100644
---- libgcc/config.host
-+++ libgcc/config.host
-@@ -811,6 +811,9 @@ m32r-*-linux*)
- m32rle-*-linux*)
- tmake_file="$tmake_file m32r/t-linux t-fdpbit"
- ;;
-+m68k-*-amiga*)
-+ tmake_file="$tmake_file m68k/t-floatlib"
-+ ;;
- m68k-*-elf* | fido-*-elf)
- tmake_file="$tmake_file m68k/t-floatlib"
- ;;
-
-From c61b7d29f7f89cbec99115f6dfbb81b5e2967188 Mon Sep 17 00:00:00 2001
-From: bebbo <bebbo(a)bejy.net>
-Date: Sun, 12 Feb 2017 12:44:25 +0100
-Subject: [PATCH 018/303] @B fix specs and linking paths issues
-
----
- gcc/config/m68k/amigaos.h | 9 ++++-----
- gcc/config/m68k/m68kamigaos.h | 41 ++++++++++++++++++++++-------------------
- gcc/gcc.c | 37 +++++++++++++++++++++++++++++++++++++
- 3 files changed, 63 insertions(+), 24 deletions(-)
-
-diff --git a/gcc/config/m68k/amigaos.h b/gcc/config/m68k/amigaos.h
-index fd89bb34352c..5f3348feb726 100644
---- gcc/config/m68k/amigaos.h
-+++ gcc/config/m68k/amigaos.h
-@@ -122,7 +122,6 @@ amiga_named_section (const char *name, unsigned int flags, tree decl);
- #undef TARGET_ASM_NAMED_SECTION
- #define TARGET_ASM_NAMED_SECTION amiga_named_section
-
--#if 0
- /* Various ABI issues. */
-
- /* This is (almost;-) BSD, so it wants DBX format. */
-@@ -183,12 +182,10 @@ amiga_named_section (const char *name, unsigned int flags, tree decl);
- //#define DEFAULT_MAIN_RETURN c_expand_return (integer_zero_node)
-
- #undef WCHAR_TYPE
--#define WCHAR_TYPE "unsigned int"
-+#define WCHAR_TYPE "unsigned short"
-
- /* XXX: section support */
--#if 0
--
--
-+#if 0
- /* We define TARGET_ASM_NAMED_SECTION, but we don't support arbitrary sections,
- including '.gcc_except_table', so we emulate the standard behaviour. */
- #undef TARGET_ASM_EXCEPTION_SECTION
-@@ -222,6 +219,8 @@ do \
- } \
- while (0)
-
-+#if 0
-+
- /* Baserel support. */
-
- /* Given that symbolic_operand(X), return TRUE if no special
-diff --git a/gcc/config/m68k/m68kamigaos.h b/gcc/config/m68k/m68kamigaos.h
-index 0650102861e8..6ba2e6736b6a 100644
---- gcc/config/m68k/m68kamigaos.h
-+++ gcc/config/m68k/m68kamigaos.h
-@@ -257,10 +257,10 @@ if (target_flags & (MASK_RESTORE_A4|MASK_ALWAYS_RESTORE_A4)) \
- "%{malways-restore-a4:-Derrno=(*ixemul_errno)} " \
- "%{mrestore-a4:-Derrno=(*ixemul_errno)}"
- #define CPP_LIBNIX_SPEC \
-- "-isystem %(sdk_root)libnix/include " \
-+ "-isystem %:sdk_root(libnix/include) " \
- "%{!ansi:-Dlibnix} -D__libnix__ -D__libnix"
- #define CPP_CLIB2_SPEC \
-- "-isystem %(sdk_root)clib2/include " \
-+ "-isystem %:sdk_root(clib2/include) " \
- "%{!ansi:-DCLIB2} -D__CLIB2__ -D__CLIB2"
-
- /* Define __HAVE_68881__ in preprocessor according to the -m flags.
-@@ -320,7 +320,7 @@ if (target_flags & (MASK_RESTORE_A4|MASK_ALWAYS_RESTORE_A4)) \
- "%{!resident:%{!fbaserel:%{!resident32:%{!fbaserel32:" \
- "%{pg:gcrt0.o%s}%{!pg:%{p:mcrt0.o%s}%{!p:crt0.o%s}}}}}}"
- #define STARTFILE_LIBNIX_SPEC \
-- "%(sdk_root)lib/libnix/" \
-+ "%:sdk_root(libnix/lib/libnix/ " \
- "%{ramiga-*:" \
- "%{ramiga-lib:libinit.o%s}" \
- "%{ramiga-libr:libinitr.o%s}" \
-@@ -331,10 +331,11 @@ if (target_flags & (MASK_RESTORE_A4|MASK_ALWAYS_RESTORE_A4)) \
- "%{fbaserel:nbcrt0.o%s}" \
- "%{!fbaserel:" \
- "%{fbaserel32:nlbcrt0.o%s}" \
-- "%{!fbaserel32:ncrt0.o%s}}}}"
-+ "%{!fbaserel32:ncrt0.o%s}}}}" \
-+ ")"
-
- #define STARTFILE_CLIB2_SPEC \
-- "%(sdk_root)clib2/lib/" \
-+ "%:sdk_root(clib2/lib/ " \
- "%{resident32:nr32crt0.o%s}" \
- "%{!resident32:" \
- "%{fbaserel32:nb32crt0.o%s}" \
-@@ -342,7 +343,8 @@ if (target_flags & (MASK_RESTORE_A4|MASK_ALWAYS_RESTORE_A4)) \
- "%{resident:nrcrt0.o%s}" \
- "%{!resident:" \
- "%{fbaserel:nbcrt0.o%s}" \
-- "%{!fbaserel:ncrt0.o%s}}}}"
-+ "%{!fbaserel:ncrt0.o%s}}}}" \
-+ ")"
-
- #undef STARTFILE_SPEC
- #define STARTFILE_SPEC \
-@@ -398,12 +400,11 @@ if (target_flags & (MASK_RESTORE_A4|MASK_ALWAYS_RESTORE_A4)) \
- "%{mcrt=clib2:%(lib_clib2)}"
-
- #define LIBGCC_IXEMUL_SPEC ""
--#define LIBGCC_LIBNIX_SPEC "-lnix " \
-+#define LIBGCC_LIBNIX_SPEC "-lnix -fl libnix " \
- "%{mcrt=*:-l%*} " \
- "%{!mcrt=*:-lnix20}"
- #define LIBGCC_CLIB2_SPEC "-lc"
--//#define LIBGCC_SPEC "-lgcc "
--#define LIBGCC_SPEC " " \
-+#define LIBGCC_SPEC "-lgcc " \
- "%{noixemul:%(libgcc_libnix)} " \
- "%{mcrt=nix*:%(libgcc_libnix)} " \
- "%{mcrt=ixemul:%(libgcc_ixemul)} " \
-@@ -415,8 +416,8 @@ if (target_flags & (MASK_RESTORE_A4|MASK_ALWAYS_RESTORE_A4)) \
- commandline options. */
-
- #define LINK_IXEMUL_SPEC ""
--#define LINK_LIBNIX_SPEC "-L%(sdk_root)libnix/lib -fl libnix"
--#define LINK_CLIB2_SPEC "-L%(sdk_root)clib2/lib"
-+#define LINK_LIBNIX_SPEC "-L%:sdk_root(libnix/lib) -fl libnix"
-+#define LINK_CLIB2_SPEC "-L%:sdk_root(clib2/lib)"
-
- /* If debugging, tell the linker to output amiga-hunk symbols *and* a BSD
- compatible debug hunk.
-@@ -428,10 +429,10 @@ if (target_flags & (MASK_RESTORE_A4|MASK_ALWAYS_RESTORE_A4)) \
- "%{mcrt=nix*:%(link_libnix)} " \
- "%{mcrt=ixemul:%(link_ixemul)} " \
- "%{mcrt=clib2:%(link_clib2)} " \
-- "%{fbaserel:%{!resident:-m amiga_bss -fl libb}} " \
-- "%{resident:-m amiga_bss -amiga-datadata-reloc -fl libb} " \
-- "%{fbaserel32:%{!resident32:-m amiga_bss -fl libb32}} " \
-- "%{resident32:-m amiga_bss -amiga-datadata-reloc -fl libb32} " \
-+ "%{fbaserel:%{!resident:-m amiga_bss -fl libb %{noixemul:-fl libnix} %{mcrt=nix*:-fl libnix}}} " \
-+ "%{resident:-m amiga_bss -amiga-datadata-reloc -fl libb %{noixemul:-fl libnix} %{mcrt=nix*:-fl libnix}} " \
-+ "%{fbaserel32:%{!resident32:-m amiga_bss -fl libb32 %{noixemul:-fl libnix} %{mcrt=nix*:-fl libnix}}} " \
-+ "%{resident32:-m amiga_bss -amiga-datadata-reloc -fl libb32 %{noixemul:-fl libnix} %{mcrt=nix*:-fl libnix}} " \
- "%{g:-amiga-debug-hunk} " \
- "%{mcpu=68020:-fl libm020} " \
- "%{m68020:-fl libm020} " \
-@@ -476,7 +477,10 @@ if (target_flags & (MASK_RESTORE_A4|MASK_ALWAYS_RESTORE_A4)) \
- "%{!nostdlib:%{!nodefaultlibs:%G}} " \
- "%{T*} }}}}}} " \
-
-+extern const char * amiga_m68k_prefix_func(int, const char **);
-
-+#define EXTRA_SPEC_FUNCTIONS \
-+ { "sdk_root", amiga_m68k_prefix_func },
-
- /* This macro defines names of additional specifications to put in the specs
- that can be used in various specifications like CC1_SPEC. Its definition
-@@ -489,10 +493,9 @@ if (target_flags & (MASK_RESTORE_A4|MASK_ALWAYS_RESTORE_A4)) \
- Do not define this macro if it does not need to do anything. */
- #undef EXTRA_SPECS
- #define EXTRA_SPECS \
-- { "asm_cpu", ASM_CPU_SPEC }, \
-- { "asm_cpu_default", ASM_CPU_DEFAULT_SPEC }, \
-- { "link_cpu", LINK_CPU_SPEC }, \
-- {"sdk_root", TOOLDIR_BASE_PREFIX "m68k-amigaos/"}, \
-+ {"asm_cpu", ASM_CPU_SPEC }, \
-+ {"asm_cpu_default", ASM_CPU_DEFAULT_SPEC }, \
-+ {"link_cpu", LINK_CPU_SPEC }, \
- {"cpp_ixemul", CPP_IXEMUL_SPEC}, \
- {"cpp_libnix", CPP_LIBNIX_SPEC}, \
- {"cpp_clib2", CPP_CLIB2_SPEC}, \
-diff --git a/gcc/gcc.c b/gcc/gcc.c
-index 0f042b0f12f7..479a912c7b3e 100644
---- gcc/gcc.c
-+++ gcc/gcc.c
-@@ -10075,3 +10075,40 @@ driver_get_configure_time_options (void (*cb) (const char *option,
- obstack_free (&obstack, NULL);
- n_switches = 0;
- }
-+
-+#ifdef TARGET_AMIGA
-+const char * amiga_m68k_prefix_func(int argc, const char ** argv) {
-+ char * p = 0;
-+ if (standard_libexec_prefix)
-+ {
-+ char * glp = concat(standard_libexec_prefix, "",0);
-+ p = strrchr(glp, '/');
-+ if (p)
-+ {
-+ *p = 0;
-+ p = strrchr(glp, '/');
-+ if (p)
-+ {
-+ *p = 0;
-+ p = strrchr(glp, '/');
-+ if (p)
-+ {
-+ p[1] = 0;
-+ p = concat(glp, "m68k-amigaos/", 0);
-+ }
-+ }
-+ }
-+ free(glp);
-+ }
-+ if (!p)
-+ p = concat("../../../../", "", 0);
-+
-+ for (int i = 0; i < argc; ++i) {
-+ char * q = concat(p, argv[i], 0);
-+ free(p);
-+ p = q;
-+ }
-+// printf("amiga_m68k_prefix_func='%s'\n", p);
-+ return p;
-+}
-+#endif
-
-From 476bb08c1155ea1a630fb456301fe273f24caca7 Mon Sep 17 00:00:00 2001
-From: bebbo <bebbo(a)bejy.net>
-Date: Mon, 13 Feb 2017 18:47:13 +0100
-Subject: [PATCH 019/303] @B disable builtins which also disables
- tree-loop-distribute-patterns which causes an infinite recursion since e.g.
- in memset the pattern is recognized and memset is called...
-
----
- gcc/config/m68k/m68kamigaos.h | 2 ++
- 1 file changed, 2 insertions(+)
-
-diff --git a/gcc/config/m68k/m68kamigaos.h b/gcc/config/m68k/m68kamigaos.h
-index 6ba2e6736b6a..a0ab3f1a91da 100644
---- gcc/config/m68k/m68kamigaos.h
-+++ gcc/config/m68k/m68kamigaos.h
-@@ -576,3 +576,5 @@ amigaos_prelink_hook((const char **)(LD1_ARGV), (STRIP))
- #undef FIXED_INCLUDE_DIR
- #define FIXED_INCLUDE_DIR CROSS_INCLUDE_DIR "/../../os-include"
-
-+// this disables tree_loop_distribute_patterns
-+#define C_COMMON_OVERRIDE_OPTIONS flag_no_builtin = 1
-
-From c1d1a53baaa94d5560d8e5d9daa749fb8b773b3a Mon Sep 17 00:00:00 2001
-From: bebbo <bebbo(a)bejy.net>
-Date: Thu, 16 Feb 2017 12:20:05 +0100
-Subject: [PATCH 020/303] @B fix includes for target AMIGA
-
----
- libstdc++-v3/include/c_global/cstdio | 2 ++
- libstdc++-v3/include/tr1/cstdint | 1 +
- 2 files changed, 3 insertions(+)
-
-diff --git a/libstdc++-v3/include/c_global/cstdio b/libstdc++-v3/include/c_global/cstdio
-index 86d524f96a62..522d065d4dc6 100644
---- libstdc++-v3/include/c_global/cstdio
-+++ libstdc++-v3/include/c_global/cstdio
-@@ -149,7 +149,9 @@ namespace std
- #if _GLIBCXX_USE_C99_STDIO
-
- #undef snprintf
-+#ifndef AMIGA
- #undef vfscanf
-+#endif
- #undef vscanf
- #undef vsnprintf
- #undef vsscanf
-diff --git a/libstdc++-v3/include/tr1/cstdint b/libstdc++-v3/include/tr1/cstdint
-index 7304d9008413..cdb8b704f0bb 100644
---- libstdc++-v3/include/tr1/cstdint
-+++ libstdc++-v3/include/tr1/cstdint
-@@ -31,6 +31,7 @@
-
- #pragma GCC system_header
-
-+#include <stdint.h>
- #include <bits/c++config.h>
-
- // For 8.22.1/1 (see C99, Notes 219, 220, 222)
-
-From 8a098e5a7bb1c14c1afa7946dce4416596418e8a Mon Sep 17 00:00:00 2001
-From: bebbo <bebbo(a)bejy.net>
-Date: Thu, 16 Feb 2017 13:48:01 +0100
-Subject: [PATCH 021/303] @B fix header only for AMIGA
-
----
- libstdc++-v3/include/tr1/cstdint | 3 ++-
- 1 file changed, 2 insertions(+), 1 deletion(-)
-
-diff --git a/libstdc++-v3/include/tr1/cstdint b/libstdc++-v3/include/tr1/cstdint
-index cdb8b704f0bb..7d6ab77ce17a 100644
---- libstdc++-v3/include/tr1/cstdint
-+++ libstdc++-v3/include/tr1/cstdint
-@@ -30,8 +30,9 @@
- #define _GLIBCXX_TR1_CSTDINT 1
-
- #pragma GCC system_header
--
-+#ifdef AMIGA
- #include <stdint.h>
-+#endif
- #include <bits/c++config.h>
-
- // For 8.22.1/1 (see C99, Notes 219, 220, 222)
-
-From a3e959953b7386e1576961fb4666f704b2edac7f Mon Sep 17 00:00:00 2001
-From: bebbo <bebbo(a)bejy.net>
-Date: Sat, 18 Feb 2017 20:19:06 +0100
-Subject: [PATCH 022/303] @V version resports now 6.3.1a instead of 6.3.1
-
----
- gcc/BASE-VER | 2 +-
- 1 file changed, 1 insertion(+), 1 deletion(-)
-
-diff --git a/gcc/BASE-VER b/gcc/BASE-VER
-index dc0208aba8e4..b557a4031409 100644
---- gcc/BASE-VER
-+++ gcc/BASE-VER
-@@ -1 +1 @@
--6.3.1
-+6.3.1a
-
-From 708b7bc6002cf54e04d7f67e3fdb6627aead7714 Mon Sep 17 00:00:00 2001
-From: bebbo <bebbo(a)bejy.net>
-Date: Sun, 19 Feb 2017 20:24:20 +0100
-Subject: [PATCH 023/303] @B fix __regargs, __stdargs plus register
- distribution
-
----
- gcc/config/m68k/amigaos-protos.h | 4 ++--
- gcc/config/m68k/amigaos.c | 19 +++++++++++--------
- gcc/config/m68k/amigaos.h | 2 ++
- gcc/config/m68k/m68kamigaos.h | 4 ++--
- 4 files changed, 17 insertions(+), 12 deletions(-)
- mode change 100755 => 100644 gcc/config/m68k/amigaos-protos.h
-
-diff --git a/gcc/config/m68k/amigaos-protos.h b/gcc/config/m68k/amigaos-protos.h
-old mode 100755
-new mode 100644
-index 66b553ab568f..97733002f4f9
---- gcc/config/m68k/amigaos-protos.h
-+++ gcc/config/m68k/amigaos-protos.h
-@@ -24,7 +24,7 @@ Boston, MA 02111-1307, USA. */
- #undef TARGET_AMIGAOS
- #define TARGET_AMIGAOS 1
-
--extern void amigaos_init_cumulative_args (CUMULATIVE_ARGS *, tree);
-+extern void amigaos_init_cumulative_args (CUMULATIVE_ARGS *, tree, tree);
-
- /* Initialize a variable CUM of type CUMULATIVE_ARGS
- for a call to a function whose data type is FNTYPE.
-@@ -32,7 +32,7 @@ extern void amigaos_init_cumulative_args (CUMULATIVE_ARGS *, tree);
-
- #undef INIT_CUMULATIVE_ARGS
- #define INIT_CUMULATIVE_ARGS(CUM, FNTYPE, LIBNAME, INDIRECT, N_NAMED_ARGS) \
-- (amigaos_init_cumulative_args(&(CUM), (FNTYPE)))
-+ (amigaos_init_cumulative_args(&(CUM), (FNTYPE), (INDIRECT)))
-
-
- extern int amigaos_restore_a4 (void);
-diff --git a/gcc/config/m68k/amigaos.c b/gcc/config/m68k/amigaos.c
-index e2dd5bab75f9..ad4bb9130cd5 100644
---- gcc/config/m68k/amigaos.c
-+++ gcc/config/m68k/amigaos.c
-@@ -381,7 +381,7 @@ static CUMULATIVE_ARGS * lastcum;
- For a library call, FNTYPE is 0. */
-
- void
--amigaos_init_cumulative_args (CUMULATIVE_ARGS *cump, tree fntype)
-+amigaos_init_cumulative_args (CUMULATIVE_ARGS *cump, tree fntype, tree decl)
- {
- struct amigaos_args * cum = &mycum;
- lastcum = cump;
-@@ -397,11 +397,12 @@ amigaos_init_cumulative_args (CUMULATIVE_ARGS *cump, tree fntype)
-
- if (fntype)
- {
-- if (lookup_attribute ("stkparm", TYPE_ATTRIBUTES(fntype)))
-- cum->num_of_regs = 0;
-+ tree attrs = DECL_ATTRIBUTES(decl);
-+ if (lookup_attribute ("stkparm", attrs))
-+ cum->num_of_regs = 0;
- else
- {
-- tree ratree = lookup_attribute ("regparm", TYPE_ATTRIBUTES(fntype));
-+ tree ratree = lookup_attribute ("regparm", attrs);
- cum->num_of_regs = amigaos_regparm != 0 ?
- amigaos_regparm : AMIGAOS_DEFAULT_REGPARM;
- if (ratree)
-@@ -530,11 +531,11 @@ _m68k_function_arg (CUMULATIVE_ARGS *cump, machine_mode mode, const_tree type)
- long mask;
-
- look_for_reg: mask = 1 << regbegin;
-- for (reg = 0; reg < cum->num_of_regs; reg++, mask <<= 1)
-+ for (reg = 0; reg < AMIGAOS_MAX_REGPARM; reg++, mask <<= 1)
- if (!(cum->regs_already_used & mask))
- {
- int end;
-- for (end = reg; end < cum->num_of_regs && end < reg + len;
-+ for (end = reg; end < AMIGAOS_MAX_REGPARM && end < reg + len;
- end++, mask <<= 1)
- if (cum->regs_already_used & mask)
- break;
-@@ -546,8 +547,9 @@ _m68k_function_arg (CUMULATIVE_ARGS *cump, machine_mode mode, const_tree type)
- }
- }
-
-- if (reg == cum->num_of_regs && altregbegin != -1)
-+ if (reg == AMIGAOS_MAX_REGPARM && altregbegin != -1)
- {
-+ DPRINTF(("look for alt reg\n"));
- regbegin = altregbegin;
- altregbegin = -1;
- goto look_for_reg;
-@@ -556,6 +558,7 @@ _m68k_function_arg (CUMULATIVE_ARGS *cump, machine_mode mode, const_tree type)
-
- if (cum->last_arg_reg != -1)
- {
-+ --cum->num_of_regs;
- DPRINTF(("-> gen_rtx_REG %d\r\n", cum->last_arg_reg));
- return gen_rtx_REG (mode, cum->last_arg_reg);
- }
-@@ -771,7 +774,7 @@ bool
- amigaos_rtx_costs (rtx x, machine_mode mode, int outer_code, int opno,
- int *total, bool speed)
- {
-- DPRINTF(("outer: %d, opno: %d", outer_code, opno));
-+// DPRINTF(("outer: %d, opno: %d", outer_code, opno));
- // debug_rtx(x);
- bool r = m68k_rtx_costs (x, mode, outer_code, opno, total, speed);
- *total *= 4;
-diff --git a/gcc/config/m68k/amigaos.h b/gcc/config/m68k/amigaos.h
-index 5f3348feb726..71a978e6df97 100644
---- gcc/config/m68k/amigaos.h
-+++ gcc/config/m68k/amigaos.h
-@@ -481,6 +481,8 @@ while (0)
- affects_type_identity } */
- #define SUBTARGET_ATTRIBUTES \
- { "regparm", 1, 1, true, false, false, amigaos_handle_type_attribute,\
-+ false }, \
-+ { "stkparm", 0, 0, true, false, false, amigaos_handle_type_attribute,\
- false },
-
- #define GOT_SYMBOL_NAME ""
-diff --git a/gcc/config/m68k/m68kamigaos.h b/gcc/config/m68k/m68kamigaos.h
-index a0ab3f1a91da..539d5f0bf934 100644
---- gcc/config/m68k/m68kamigaos.h
-+++ gcc/config/m68k/m68kamigaos.h
-@@ -194,8 +194,8 @@ amiga_declare_object = 0
- builtin_define ("__saveds=__attribute__((__saveds__))"); \
- builtin_define ("__interrupt=__attribute__((__interrupt__))"); \
- builtin_define ("__stackext=__attribute__((__stackext__))"); \
-- builtin_define ("__regargs=__attribute__((regparm))"); \
-- builtin_define ("__stdargs=__attribute__((stkparm))"); \
-+ builtin_define ("__regargs=__attribute__((__regparm__))"); \
-+ builtin_define ("__stdargs=__attribute__((__stkparm__))"); \
- builtin_define ("__aligned=__attribute__((__aligned__(4)))"); \
- builtin_define_std ("amiga"); \
- builtin_define_std ("amigaos"); \
-
-From e9ccb451229b09a1fdb64eb125d3ac0c733c5e9e Mon Sep 17 00:00:00 2001
-From: bebbo <bebbo(a)bejy.net>
-Date: Mon, 20 Feb 2017 08:32:06 +0100
-Subject: [PATCH 024/303] @B do not append (a4) to function references.
-
----
- gcc/config/m68k/m68k.c | 2 +-
- 1 file changed, 1 insertion(+), 1 deletion(-)
-
-diff --git a/gcc/config/m68k/m68k.c b/gcc/config/m68k/m68k.c
-index c67194fa292d..bd76c766a735 100644
---- gcc/config/m68k/m68k.c
-+++ gcc/config/m68k/m68k.c
-@@ -4751,7 +4751,7 @@ print_operand_address (FILE *file, rtx addr)
- else
- output_addr_const (file, addr);
-
-- if (!RTX_FLAG (addr, frame_related))
-+ if (!RTX_FLAG (addr, frame_related) && !SYMBOL_REF_FUNCTION_P(addr))
- {
- // debug_rtx(addr);
- if (flag_mybaserel == 1)
-
-From 40f1afb4c03c2bb79e86c5fb8fa2e7daa45d8600 Mon Sep 17 00:00:00 2001
-From: bebbo <bebbo(a)bejy.net>
-Date: Mon, 20 Feb 2017 08:35:34 +0100
-Subject: [PATCH 025/303] @B enable reg-rename in O2+ and fix it.
-
----
- gcc/regrename.c | 5 +++--
- gcc/toplev.c | 2 +-
- 2 files changed, 4 insertions(+), 3 deletions(-)
-
-diff --git a/gcc/regrename.c b/gcc/regrename.c
-index 9643f328ea3e..9816d3eaf5d2 100644
---- gcc/regrename.c
-+++ gcc/regrename.c
-@@ -406,8 +406,9 @@ find_rename_reg (du_head_p this_head, enum reg_class super_class,
-
- /* In the first pass, we force the renaming of registers that
- don't belong to PREFERRED_CLASS to registers that do, even
-- though the latters were used not very long ago. */
-- if ((pass == 0
-+ though the latters were used not very long ago.
-+ Also use a register if no best_new_reg was found till now */
-+ if (((pass == 0 || !has_preferred_class)
- && !TEST_HARD_REG_BIT (reg_class_contents[preferred_class],
- best_new_reg))
- || tick[best_new_reg] > tick[new_reg])
-diff --git a/gcc/toplev.c b/gcc/toplev.c
-index 8979d2634260..96d17ee1cccc 100644
---- gcc/toplev.c
-+++ gcc/toplev.c
-@@ -1299,7 +1299,7 @@ process_options (void)
- flag_web = flag_unroll_loops || flag_peel_loops;
-
- if (flag_rename_registers == AUTODETECT_VALUE)
-- flag_rename_registers = flag_unroll_loops || flag_peel_loops;
-+ flag_rename_registers = flag_unroll_loops || flag_peel_loops || optimize >= 2;
-
- if (flag_non_call_exceptions)
- flag_asynchronous_unwind_tables = 1;
-
-From b980bd29d8cf05a2c6d6c947547b3f1e1c4cff23 Mon Sep 17 00:00:00 2001
-From: bebbo <bebbo(a)bejy.net>
-Date: Mon, 20 Feb 2017 10:52:45 +0100
-Subject: [PATCH 026/303] @B fix npe in amigaos_init_cumulative_args
-
----
- gcc/config/m68k/amigaos.c | 2 +-
- 1 file changed, 1 insertion(+), 1 deletion(-)
-
-diff --git a/gcc/config/m68k/amigaos.c b/gcc/config/m68k/amigaos.c
-index ad4bb9130cd5..c675bc8e01ed 100644
---- gcc/config/m68k/amigaos.c
-+++ gcc/config/m68k/amigaos.c
-@@ -395,7 +395,7 @@ amigaos_init_cumulative_args (CUMULATIVE_ARGS *cump, tree fntype, tree decl)
- cum->last_arg_reg = -1;
- cum->regs_already_used = 0;
-
-- if (fntype)
-+ if (decl)
- {
- tree attrs = DECL_ATTRIBUTES(decl);
- if (lookup_attribute ("stkparm", attrs))
-
-From 215f15335dca293e65f47fde15a3d6486c551629 Mon Sep 17 00:00:00 2001
-From: bebbo <bebbo(a)bejy.net>
-Date: Thu, 23 Feb 2017 12:46:18 +0100
-Subject: [PATCH 027/303] @B -mregparm conforms now to the spec.
-
----
- gcc/config/m68k/amigaos.c | 22 +++++++++++-----------
- 1 file changed, 11 insertions(+), 11 deletions(-)
-
-diff --git a/gcc/config/m68k/amigaos.c b/gcc/config/m68k/amigaos.c
-index c675bc8e01ed..916140bdc628 100644
---- gcc/config/m68k/amigaos.c
-+++ gcc/config/m68k/amigaos.c
-@@ -386,7 +386,7 @@ amigaos_init_cumulative_args (CUMULATIVE_ARGS *cump, tree fntype, tree decl)
- struct amigaos_args * cum = &mycum;
- lastcum = cump;
- cum->num_of_regs = amigaos_regparm > 0 ? amigaos_regparm : 0;
-- DPRINTF(("amigaos_init_cumulative_args %p -> %d\r\n", cum, cum->num_of_regs));
-+ DPRINTF(("0amigaos_init_cumulative_args %p -> %d\r\n", cum, cum->num_of_regs));
-
- /* Initialize a variable CUM of type CUMULATIVE_ARGS
- for a call to a function whose data type is FNTYPE.
-@@ -451,6 +451,7 @@ amigaos_init_cumulative_args (CUMULATIVE_ARGS *cump, tree fntype, tree decl)
- else
- /* Call to compiler-support function. */
- cum->formal_type = 0;
-+ DPRINTF(("1amigaos_init_cumulative_args %p -> %d\r\n", cum, cum->num_of_regs));
- }
-
- /* Update the data in CUM to advance over an argument. */
-@@ -531,11 +532,11 @@ _m68k_function_arg (CUMULATIVE_ARGS *cump, machine_mode mode, const_tree type)
- long mask;
-
- look_for_reg: mask = 1 << regbegin;
-- for (reg = 0; reg < AMIGAOS_MAX_REGPARM; reg++, mask <<= 1)
-+ for (reg = 0; reg < cum->num_of_regs; reg++, mask <<= 1)
- if (!(cum->regs_already_used & mask))
- {
- int end;
-- for (end = reg; end < AMIGAOS_MAX_REGPARM && end < reg + len;
-+ for (end = reg; end < cum->num_of_regs && end < reg + len;
- end++, mask <<= 1)
- if (cum->regs_already_used & mask)
- break;
-@@ -547,18 +548,17 @@ _m68k_function_arg (CUMULATIVE_ARGS *cump, machine_mode mode, const_tree type)
- }
- }
-
-- if (reg == AMIGAOS_MAX_REGPARM && altregbegin != -1)
-- {
-- DPRINTF(("look for alt reg\n"));
-- regbegin = altregbegin;
-- altregbegin = -1;
-- goto look_for_reg;
-- }
-+// if (reg == AMIGAOS_MAX_REGPARM && altregbegin != -1)
-+// {
-+// DPRINTF(("look for alt reg\n"));
-+// regbegin = altregbegin;
-+// altregbegin = -1;
-+// goto look_for_reg;
-+// }
- }
-
- if (cum->last_arg_reg != -1)
- {
-- --cum->num_of_regs;
- DPRINTF(("-> gen_rtx_REG %d\r\n", cum->last_arg_reg));
- return gen_rtx_REG (mode, cum->last_arg_reg);
- }
-
-From 419b54e138b5322b468189fbf9e234f6315b0914 Mon Sep 17 00:00:00 2001
-From: bebbo <bebbo(a)bejy.net>
-Date: Thu, 23 Feb 2017 12:47:40 +0100
-Subject: [PATCH 028/303] @B if -fbaserel32 -m68020 (or better) must be present
- too
-
----
- gcc/config/m68k/amigaos.h | 2 +-
- 1 file changed, 1 insertion(+), 1 deletion(-)
-
-diff --git a/gcc/config/m68k/amigaos.h b/gcc/config/m68k/amigaos.h
-index 71a978e6df97..afc2c6563143 100644
---- gcc/config/m68k/amigaos.h
-+++ gcc/config/m68k/amigaos.h
-@@ -470,7 +470,7 @@ extern tree amigaos_handle_type_attribute(tree *, tree, tree, int, bool*);
- #define SUBTARGET_OVERRIDE_OPTIONS \
- do \
- { \
-- if (!TARGET_68020 && flag_pic==2) \
-+ if (!TARGET_68020 && flag_mybaserel==2) \
- error ("-fbaserel32 is not supported on the 68000 or 68010\n"); \
- if (amigaos_regparm > 0 && amigaos_regparm > AMIGAOS_MAX_REGPARM) \
- error ("-mregparm=x with 1 <= x <= %d\n", AMIGAOS_MAX_REGPARM); \
-
-From f76ce97a5f8b9542814e5700e9d728ede215749d Mon Sep 17 00:00:00 2001
-From: bebbo <bebbo(a)bejy.net>
-Date: Thu, 23 Feb 2017 12:48:23 +0100
-Subject: [PATCH 029/303] @I -msmall-code sets now flag_smallcode
-
----
- gcc/config/m68k/amigaos.opt | 2 +-
- 1 file changed, 1 insertion(+), 1 deletion(-)
-
-diff --git a/gcc/config/m68k/amigaos.opt b/gcc/config/m68k/amigaos.opt
-index 212ab8e6efda..1faa3f2eeb26 100644
---- gcc/config/m68k/amigaos.opt
-+++ gcc/config/m68k/amigaos.opt
-@@ -8,7 +8,7 @@ Target RejectNegative
- Do not use ixemul.library - use libnix instead to link
-
- msmall-code
--Target RejectNegative
-+Target RejectNegative Var(flag_smallcode,1)
- small code model
-
- fbaserel
-
-From d08bd9d2a479285104f394f70be45e5f77dfa419 Mon Sep 17 00:00:00 2001
-From: bebbo <bebbo(a)bejy.net>
-Date: Thu, 23 Feb 2017 12:50:51 +0100
-Subject: [PATCH 030/303] @B fix baserel(32): use a4 only if common or bss is
- referenced @N support -msmall-code
-
----
- gcc/config/m68k/m68k.c | 36 ++++++++++++++++++++++++++++++------
- 1 file changed, 30 insertions(+), 6 deletions(-)
-
-diff --git a/gcc/config/m68k/m68k.c b/gcc/config/m68k/m68k.c
-index bd76c766a735..b6ef99024ea6 100644
---- gcc/config/m68k/m68k.c
-+++ gcc/config/m68k/m68k.c
-@@ -4751,14 +4751,38 @@ print_operand_address (FILE *file, rtx addr)
- else
- output_addr_const (file, addr);
-
-- if (!RTX_FLAG (addr, frame_related) && !SYMBOL_REF_FUNCTION_P(addr))
-+#ifdef TARGET_AMIGA
-+ if (SYMBOL_REF_FUNCTION_P(addr))
- {
--// debug_rtx(addr);
-- if (flag_mybaserel == 1)
-- asm_fprintf (file, ".w(a4)");
-- else if (flag_mybaserel == 2)
-- asm_fprintf (file, "(a4)");
-+ if (flag_smallcode)
-+ asm_fprintf(file, ":w(pc)");
- }
-+ else if (flag_mybaserel)
-+ {
-+ /* search the decl. */
-+ tree decl = SYMBOL_REF_DECL (addr);
-+ if (!decl)
-+ {
-+ rtx x = XEXP(addr, 0);
-+ if (CONSTANT_POOL_ADDRESS_P(x))
-+ decl = SYMBOL_REF_DECL (x);
-+ if (!decl)
-+ {
-+ x = XEXP(x, 0);
-+ decl = SYMBOL_REF_DECL (x);
-+ }
-+ }
-+
-+ /* Qualifies for a4 if common or bss. Do not ref to .text! */
-+ if (decl && (DECL_COMMON (decl) || bss_initializer_p (decl)))
-+ {
-+ if (flag_mybaserel == 1)
-+ asm_fprintf (file, ":W(a4)");
-+ else if (flag_mybaserel == 2)
-+ asm_fprintf (file, ":L(a4)");
-+ }
-+ }
-+#endif
- }
- }
- else
-
-From c72e9ebfc07a0b31d523b9d7428544427fe551b7 Mon Sep 17 00:00:00 2001
-From: bebbo <bebbo(a)bejy.net>
-Date: Thu, 23 Feb 2017 20:15:17 +0100
-Subject: [PATCH 031/303] @B undo a too optimistic change ;)
-
----
- gcc/regrename.c | 2 +-
- 1 file changed, 1 insertion(+), 1 deletion(-)
-
-diff --git a/gcc/regrename.c b/gcc/regrename.c
-index 9816d3eaf5d2..df4c320700c5 100644
---- gcc/regrename.c
-+++ gcc/regrename.c
-@@ -408,7 +408,7 @@ find_rename_reg (du_head_p this_head, enum reg_class super_class,
- don't belong to PREFERRED_CLASS to registers that do, even
- though the latters were used not very long ago.
- Also use a register if no best_new_reg was found till now */
-- if (((pass == 0 || !has_preferred_class)
-+ if (((pass == 0)
- && !TEST_HARD_REG_BIT (reg_class_contents[preferred_class],
- best_new_reg))
- || tick[best_new_reg] > tick[new_reg])
-
-From 181421087bf57fab0f047c47861b5c2a1e745d96 Mon Sep 17 00:00:00 2001
-From: bebbo <bebbo(a)bejy.net>
-Date: Tue, 14 Mar 2017 21:38:30 +0100
-Subject: [PATCH 032/303] @R add better -fbaserel(32) support for TARGET_AMIGA
-
----
- gcc/BASE-VER | 2 +-
- gcc/config/m68k/amigaos.c | 51 +++++++++++++----
- gcc/config/m68k/amigaos.h | 21 +++----
- gcc/config/m68k/amigaos.opt | 4 +-
- gcc/config/m68k/m68k.c | 130 ++++++++++++++++++++++++++++--------------
- gcc/config/m68k/m68k.md | 6 +-
- gcc/config/m68k/m68kamigaos.h | 23 ++++++++
- gcc/config/m68k/predicates.md | 4 ++
- 8 files changed, 170 insertions(+), 71 deletions(-)
-
-diff --git a/gcc/BASE-VER b/gcc/BASE-VER
-index b557a4031409..6352d5267189 100644
---- gcc/BASE-VER
-+++ gcc/BASE-VER
-@@ -1 +1 @@
--6.3.1a
-+6.3.1b
-diff --git a/gcc/config/m68k/amigaos.c b/gcc/config/m68k/amigaos.c
-index 916140bdc628..81d08245b580 100644
---- gcc/config/m68k/amigaos.c
-+++ gcc/config/m68k/amigaos.c
-@@ -548,13 +548,13 @@ _m68k_function_arg (CUMULATIVE_ARGS *cump, machine_mode mode, const_tree type)
- }
- }
-
--// if (reg == AMIGAOS_MAX_REGPARM && altregbegin != -1)
--// {
--// DPRINTF(("look for alt reg\n"));
--// regbegin = altregbegin;
--// altregbegin = -1;
--// goto look_for_reg;
--// }
-+ if (reg == AMIGAOS_MAX_REGPARM && altregbegin != -1)
-+ {
-+ DPRINTF(("look for alt reg\n"));
-+ regbegin = altregbegin;
-+ altregbegin = -1;
-+ goto look_for_reg;
-+ }
- }
-
- if (cum->last_arg_reg != -1)
-@@ -775,9 +775,10 @@ amigaos_rtx_costs (rtx x, machine_mode mode, int outer_code, int opno,
- int *total, bool speed)
- {
- // DPRINTF(("outer: %d, opno: %d", outer_code, opno));
--// debug_rtx(x);
- bool r = m68k_rtx_costs (x, mode, outer_code, opno, total, speed);
-- *total *= 4;
-+// *total *= 4;
-+// fprintf(stderr, "costs: %d, mode=%d, outer=%d, opno=%d, speed=%d, ok=%d\n", *total * 4, mode, outer_code, opno, speed, r);
-+// debug_rtx(x);
- return r;
- }
-
-@@ -789,7 +790,37 @@ amiga_named_section (const char *name, unsigned int flags, tree decl ATTRIBUTE_U
- {
- if (0 == strncmp(".text", name, 5))
- name = ".text";
--// fprintf (asm_out_file, "\t.section\t%s\n", name);
- fprintf (asm_out_file, "\t%s\n", name);
- }
-
-+/* Baserel support. */
-+
-+/**
-+ * Does x reference the pic_reg and is const or plus?
-+ */
-+int amiga_is_const_pic_ref(const_rtx x)
-+{
-+ const_rtx y = x;
-+ if (flag_pic < 3)
-+ return false;
-+ while (GET_CODE(y) == CONST || GET_CODE(y) == PLUS)
-+ y = XEXP(y, 0);
-+ return (x != y && REG_P(y) && REGNO(y) == PIC_REG);
-+}
-+
-+
-+/* Does operand (which is a symbolic_operand) live in text space? If
-+ so SYMBOL_REF_FLAG, which is set by ENCODE_SECTION_INFO, will be true.
-+
-+ This function is used in base relative code generation. */
-+
-+int
-+read_only_operand (rtx operand)
-+{
-+ if (GET_CODE (operand) == CONST)
-+ operand = XEXP (XEXP (operand, 0), 0);
-+ if (GET_CODE (operand) == SYMBOL_REF)
-+ return SYMBOL_REF_FLAG (operand) || CONSTANT_POOL_ADDRESS_P (operand);
-+ return 1;
-+}
-+
-diff --git a/gcc/config/m68k/amigaos.h b/gcc/config/m68k/amigaos.h
-index afc2c6563143..9820f0ed1219 100644
---- gcc/config/m68k/amigaos.h
-+++ gcc/config/m68k/amigaos.h
-@@ -221,18 +221,6 @@ while (0)
-
- #if 0
-
--/* Baserel support. */
--
--/* Given that symbolic_operand(X), return TRUE if no special
-- base relative relocation is necessary */
--
--#define LEGITIMATE_BASEREL_OPERAND_P(X) \
-- (flag_pic >= 3 && read_only_operand (X))
--
--#undef LEGITIMATE_PIC_OPERAND_P
--#define LEGITIMATE_PIC_OPERAND_P(X) \
-- (! symbolic_operand (X, VOIDmode) || LEGITIMATE_BASEREL_OPERAND_P (X))
--
- /* Define this macro if references to a symbol must be treated
- differently depending on something about the variable or
- function named by the symbol (such as what section it is in).
-@@ -492,3 +480,12 @@ while (0)
- bool
- amigaos_rtx_costs (rtx, machine_mode, int, int, int *, bool);
-
-+/* SBF: macro to test for const via pic_reg. */
-+#define CONST_PLUS_PIC_REG_CONST_UNSPEC_P(x) \
-+ (GET_CODE(x) == CONST \
-+ && GET_CODE(XEXP(x, 0)) == PLUS \
-+ && REG_P(XEXP(XEXP(x, 0), 0)) \
-+ && REGNO(XEXP(XEXP(x, 0), 0)) == PIC_REG \
-+ && GET_CODE(XEXP(XEXP(x, 0), 1)) == CONST \
-+ && GET_CODE(XEXP(XEXP(XEXP(x, 0), 1), 0)) == UNSPEC \
-+ )
-diff --git a/gcc/config/m68k/amigaos.opt b/gcc/config/m68k/amigaos.opt
-index 1faa3f2eeb26..4d9a42052355 100644
---- gcc/config/m68k/amigaos.opt
-+++ gcc/config/m68k/amigaos.opt
-@@ -12,11 +12,11 @@ Target RejectNegative Var(flag_smallcode,1)
- small code model
-
- fbaserel
--Target Common Report Var(flag_mybaserel,1)
-+Target Report Var(flag_pic,3)
- data is adressed relativ to a4
-
- fbaserel32
--Target Common Report Var(flag_mybaserel,2)
-+Target Report Var(flag_pic,4)
- data is adressed relativ to a4 with 32 bit offsets
-
- resident
-diff --git a/gcc/config/m68k/m68k.c b/gcc/config/m68k/m68k.c
-index b6ef99024ea6..64dcbf6969ee 100644
---- gcc/config/m68k/m68k.c
-+++ gcc/config/m68k/m68k.c
-@@ -591,7 +591,8 @@ m68k_option_override (void)
- if (TARGET_PCREL && flag_pic == 0)
- flag_pic = 1;
-
-- if (!flag_pic)
-+ /* SBF: use normal jumps/calls with baserel(32) modes. */
-+ if (!flag_pic || flag_pic > 2)
- {
- m68k_symbolic_call_var = M68K_SYMBOLIC_CALL_JSR;
-
-@@ -888,8 +889,9 @@ m68k_save_reg (unsigned int regno, bool interrupt_handler)
- {
- if (crtl->saves_all_registers)
- return true;
-+ /* SBF: do not save the PIC_REG with baserel(32) modes. */
- if (crtl->uses_pic_offset_table)
-- return true;
-+ return flag_pic < 3;
- /* Reload may introduce constant pool references into a function
- that thitherto didn't need a PIC register. Note that the test
- above will not catch that case because we will only set
-@@ -1149,8 +1151,9 @@ m68k_expand_prologue (void)
- current_frame.reg_mask, true, true));
- }
-
-+ /* SBF: do not load the PIC_REG with baserel(32) */
- if (!TARGET_SEP_DATA
-- && crtl->uses_pic_offset_table)
-+ && crtl->uses_pic_offset_table && flag_pic < 3)
- emit_insn (gen_load_got (pic_offset_table_rtx));
- }
-
-@@ -2135,6 +2138,12 @@ m68k_legitimate_address_p (machine_mode mode, rtx x, bool strict_p)
- {
- struct m68k_address address;
-
-+#ifdef TARGET_AMIGA
-+ /* SBF: the baserel(32) const plus pic_ref, symbol is an address. */
-+ if (amiga_is_const_pic_ref(x))
-+ return true;
-+#endif
-+
- return m68k_decompose_address (mode, x, strict_p, &address);
- }
-
-@@ -2468,9 +2477,33 @@ legitimize_pic_address (rtx orig, machine_mode mode ATTRIBUTE_UNUSED,
- if (GET_CODE (orig) == SYMBOL_REF || GET_CODE (orig) == LABEL_REF)
- {
- gcc_assert (reg);
-- pic_ref = m68k_wrap_symbol_into_got_ref (orig, RELOC_GOT, reg);
-- pic_ref = m68k_move_to_reg (pic_ref, orig, reg);
--// debug_rtx(pic_ref);
-+ if (flag_pic < 3)
-+ {
-+ pic_ref = m68k_wrap_symbol_into_got_ref (orig, RELOC_GOT, reg);
-+ pic_ref = m68k_move_to_reg (pic_ref, orig, reg);
-+ }
-+ #ifdef TARGET_AMIGA
-+ else
-+ {
-+ tree decl = SYMBOL_REF_DECL (orig);
-+
-+ /* SBF: Does the symbol use common or bss and qualifies for pic_reg?
-+ * Do not ref to .text via pic_reg!
-+ */
-+ if (!SYMBOL_REF_FUNCTION_P(orig) && decl && (DECL_COMMON (decl) || bss_initializer_p (decl)))
-+ {
-+ /* SBF: unfortunately using the wrapped symbol without MEM does not work.
-+ * The pic_ref reference gets decomposed and leads to no working code.
-+ */
-+ pic_ref = m68k_wrap_symbol (pic_ref, RELOC_GOT, m68k_get_gp (), reg);
-+
-+ /* SBF: adding const avoids decomposing. */
-+ pic_ref = gen_rtx_CONST (Pmode, pic_ref);
-+ }
-+ else
-+ pic_ref = gen_rtx_CONST (Pmode, pic_ref);
-+ }
-+#endif
- }
- else if (GET_CODE (orig) == CONST)
- {
-@@ -2489,7 +2522,8 @@ legitimize_pic_address (rtx orig, machine_mode mode ATTRIBUTE_UNUSED,
- orig = legitimize_pic_address (XEXP (XEXP (orig, 0), 1), Pmode,
- base == reg ? 0 : reg);
-
-- if (GET_CODE (orig) == CONST_INT)
-+ /* SBF: use normal plus and rely on optimizer with baserel(32). */
-+ if (flag_pic < 3 && GET_CODE (orig) == CONST_INT)
- pic_ref = plus_constant (Pmode, base, INTVAL (orig));
- else
- pic_ref = gen_rtx_PLUS (Pmode, base, orig);
-@@ -4453,7 +4487,6 @@ floating_exact_log2 (rtx x)
- void
- print_operand (FILE *file, rtx op, int letter)
- {
--// printf("letter: %c\n", letter);
- if (letter == '.')
- {
- if (MOTOROLA)
-@@ -4486,7 +4519,9 @@ print_operand (FILE *file, rtx op, int letter)
- else if (letter == 'p')
- {
- output_addr_const (file, op);
-- if (!(GET_CODE (op) == SYMBOL_REF && SYMBOL_REF_LOCAL_P (op)))
-+ /* SBF: do not add @PLTPC with baserel(32). */
-+ if (flag_pic < 3
-+ && !(GET_CODE (op) == SYMBOL_REF && SYMBOL_REF_LOCAL_P (op)))
- fprintf (file, "@PLTPC");
- }
- else if (GET_CODE (op) == REG)
-@@ -4505,10 +4540,12 @@ print_operand (FILE *file, rtx op, int letter)
- && CONSTANT_ADDRESS_P (XEXP (op, 0))
- && !(GET_CODE (XEXP (op, 0)) == CONST_INT
- && INTVAL (XEXP (op, 0)) < 0x8000
-- && INTVAL (XEXP (op, 0)) >= -0x8000))
-+ && INTVAL (XEXP (op, 0)) >= -0x8000)
- #ifdef TARGET_AMIGA
-- if (!flag_mybaserel)
-+/* SBF: Do not append some 'l' with baserel(32). */
-+ && !CONST_PLUS_PIC_REG_CONST_UNSPEC_P(XEXP(op, 0))
- #endif
-+ )
- fprintf (file, MOTOROLA ? ".l" : ":l");
- }
- else if (GET_CODE (op) == CONST_DOUBLE && GET_MODE (op) == SFmode)
-@@ -4554,9 +4591,18 @@ m68k_get_reloc_decoration (enum m68k_reloc reloc)
- switch (reloc)
- {
- case RELOC_GOT:
--// if (TARGET_AMIGA)
--// return "";
--// else
-+ /* SBF: add the proper extension for baserel relocs with baserel(32). */
-+ if (TARGET_AMIGA)
-+ {
-+ if (flag_pic == 1)
-+ return ".w";
-+ else if (flag_pic == 3)
-+ return ":W";
-+ else if (flag_pic == 4)
-+ return ":L";
-+ else
-+ return "";
-+ }
- if (MOTOROLA)
- {
- if (flag_pic == 1 && TARGET_68020)
-@@ -4707,6 +4753,22 @@ print_operand_address (FILE *file, rtx addr)
- {
- struct m68k_address address;
-
-+#ifdef TARGET_AMIGA
-+ /*
-+ * SBF: remove the const wrapper.
-+ */
-+ if (CONST_PLUS_PIC_REG_CONST_UNSPEC_P(addr))
-+ {
-+ print_operand_address(file, XEXP(addr, 0));
-+ return;
-+ }
-+ if (symbolic_operand(addr, VOIDmode))
-+ {
-+ memset (&address, 0, sizeof (address));
-+ address.offset = addr;
-+ }
-+ else
-+#endif
- if (!m68k_decompose_address (QImode, addr, true, &address))
- gcc_unreachable ();
-
-@@ -4757,31 +4819,6 @@ print_operand_address (FILE *file, rtx addr)
- if (flag_smallcode)
- asm_fprintf(file, ":w(pc)");
- }
-- else if (flag_mybaserel)
-- {
-- /* search the decl. */
-- tree decl = SYMBOL_REF_DECL (addr);
-- if (!decl)
-- {
-- rtx x = XEXP(addr, 0);
-- if (CONSTANT_POOL_ADDRESS_P(x))
-- decl = SYMBOL_REF_DECL (x);
-- if (!decl)
-- {
-- x = XEXP(x, 0);
-- decl = SYMBOL_REF_DECL (x);
-- }
-- }
--
-- /* Qualifies for a4 if common or bss. Do not ref to .text! */
-- if (decl && (DECL_COMMON (decl) || bss_initializer_p (decl)))
-- {
-- if (flag_mybaserel == 1)
-- asm_fprintf (file, ":W(a4)");
-- else if (flag_mybaserel == 2)
-- asm_fprintf (file, ":L(a4)");
-- }
-- }
- #endif
- }
- }
-@@ -5224,7 +5261,9 @@ m68k_hard_regno_rename_ok (unsigned int old_reg ATTRIBUTE_UNUSED,
-
- /* Value is true if hard register REGNO can hold a value of machine-mode
- MODE. On the 68000, we let the cpu registers can hold any mode, but
-- restrict the 68881 registers to floating-point modes. */
-+ restrict the 68881 registers to floating-point modes.
-+ SBF: Disallow the frame pointer register, if the frame pointer is used.
-+ */
-
- bool
- m68k_regno_mode_ok (int regno, machine_mode mode)
-@@ -5233,12 +5272,12 @@ m68k_regno_mode_ok (int regno, machine_mode mode)
- {
- /* Data Registers, can hold aggregate if fits in. */
- if (regno + GET_MODE_SIZE (mode) / 4 <= 8)
-- return true;
-+ return !flag_omit_frame_pointer || regno != FRAME_POINTER_REGNUM;
- }
- else if (ADDRESS_REGNO_P (regno))
- {
- if (regno + GET_MODE_SIZE (mode) / 4 <= 16)
-- return true;
-+ return !flag_omit_frame_pointer || regno != FRAME_POINTER_REGNUM;
- }
- else if (FP_REGNO_P (regno))
- {
-@@ -5259,6 +5298,13 @@ m68k_secondary_reload_class (enum reg_class rclass,
- machine_mode mode, rtx x)
- {
- int regno;
-+#ifdef TARGET_AMIGA
-+ /* SBF: check for baserel's const pic_ref
-+ * and return ADDR_REGS or NO_REGS
-+ */
-+ if (!MEM_P(x) && amiga_is_const_pic_ref(x))
-+ return rclass == ADDR_REGS ? NO_REGS : ADDR_REGS;
-+#endif
-
- regno = true_regnum (x);
-
-diff --git a/gcc/config/m68k/m68k.md b/gcc/config/m68k/m68k.md
-index f5b63f43c372..24332476b91b 100644
---- gcc/config/m68k/m68k.md
-+++ gcc/config/m68k/m68k.md
-@@ -128,13 +128,11 @@
- (UNSPECV_TAS_2 4)
- ])
-
--;; Registers by name.
-+;; Registers by name. SBF: Do not define PIC_REG / A6_REG here!
- (define_constants
- [(D0_REG 0)
- (A0_REG 8)
- (A1_REG 9)
-- (PIC_REG 13)
-- (A6_REG 14)
- (SP_REG 15)
- (FP0_REG 16)
- ])
-@@ -502,7 +500,7 @@
- [(set (cc0)
- (compare (match_operand:SI 0 "nonimmediate_operand" "rKT,rKs,mr,ma,>")
- (match_operand:SI 1 "general_operand" "mr,ma,KTr,Ksr,>")))]
-- "!TARGET_COLDFIRE"
-+ "!TARGET_COLDFIRE && (flag_pic < 3 || GET_CODE(operands[1]) != CONST || GET_CODE(XEXP(operands[1], 0)) != PLUS || !REG_P(XEXP(XEXP(operands[1], 0), 0)) || REGNO(XEXP(XEXP(operands[1], 0), 0)) != PIC_REG)"
- {
- if (GET_CODE (operands[0]) == MEM && GET_CODE (operands[1]) == MEM)
- return "cmpm%.l %1,%0";
-diff --git a/gcc/config/m68k/m68kamigaos.h b/gcc/config/m68k/m68kamigaos.h
-index 539d5f0bf934..74403a50bb67 100644
---- gcc/config/m68k/m68kamigaos.h
-+++ gcc/config/m68k/m68kamigaos.h
-@@ -578,3 +578,26 @@ amigaos_prelink_hook((const char **)(LD1_ARGV), (STRIP))
-
- // this disables tree_loop_distribute_patterns
- #define C_COMMON_OVERRIDE_OPTIONS flag_no_builtin = 1
-+/* Baserel support. */
-+
-+extern int amiga_is_const_pic_ref(const_rtx x);
-+
-+#undef CONSTANT_ADDRESS_P
-+#define CONSTANT_ADDRESS_P(X) \
-+((GET_CODE (X) == LABEL_REF || GET_CODE (X) == SYMBOL_REF \
-+ || GET_CODE (X) == CONST_INT || GET_CODE (X) == CONST \
-+ || GET_CODE (X) == HIGH \
-+ ) && !amiga_is_const_pic_ref(X))
-+
-+
-+/* Given that symbolic_operand(X), return TRUE if no special
-+ base relative relocation is necessary */
-+
-+#define LEGITIMATE_BASEREL_OPERAND_P(X) \
-+ (flag_pic >= 3 && read_only_operand (X))
-+
-+#undef LEGITIMATE_PIC_OPERAND_P
-+#define LEGITIMATE_PIC_OPERAND_P(X) ( \
-+ ! symbolic_operand (X, VOIDmode) || LEGITIMATE_BASEREL_OPERAND_P (X))
-+
-+// (GET_CODE(X) == CONST && (GET_CODE(XEXP(X, 0)) == SYMBOL_REF || GET_CODE(XEXP(X, 0)) == LABEL_REF) && !CONSTANT_POOL_ADDRESS_P (XEXP(X, 0))) ||
-diff --git a/gcc/config/m68k/predicates.md b/gcc/config/m68k/predicates.md
-index 186436c42b77..9533e65ceaab 100644
---- gcc/config/m68k/predicates.md
-+++ gcc/config/m68k/predicates.md
-@@ -30,6 +30,10 @@
- || GET_CODE (XEXP (op, 0)) == LABEL_REF
- || GET_CODE (XEXP (op, 0)) == CONST))
- return 1;
-+#ifdef TARGET_AMIGA
-+ if (flag_pic >= 3 && amiga_is_const_pic_ref(op))
-+ return 0;
-+#endif
- return general_operand (op, mode);
- })
-
-
-From e74ef22307cef4b728ea06a9bb78f24d3c7879d6 Mon Sep 17 00:00:00 2001
-From: bebbo <bebbo(a)bejy.net>
-Date: Mon, 20 Mar 2017 22:47:47 +0100
-Subject: [PATCH 033/303] @R improved register renamingRegister renaming now
- updates the register ref count. Also the stack variable creation is scheduled
- later, to omitt push/pop of unused variables.The regs d0/a0 are preferred and
- rarely renamed.
-
----
- gcc/calls.c | 2 +-
- gcc/config/m68k/amigaos.c | 9 +++++
- gcc/config/m68k/amigaos.h | 5 +++
- gcc/config/m68k/m68k.c | 12 ++++---
- gcc/config/m68k/m68k.h | 10 +++---
- gcc/df-scan.c | 7 ++++
- gcc/doc/tm.texi | 4 +++
- gcc/doc/tm.texi.in | 2 ++
- gcc/expr.c | 2 +-
- gcc/passes.def | 6 ++--
- gcc/regrename.c | 84 +++++++++++++++++++++++++++--------------------
- gcc/target.def | 19 +++++++++++
- gcc/targhooks.c | 7 ++++
- gcc/targhooks.h | 1 +
- 14 files changed, 120 insertions(+), 50 deletions(-)
-
-diff --git a/gcc/calls.c b/gcc/calls.c
-index 730d82e65cf3..c78059fb5199 100644
---- gcc/calls.c
-+++ gcc/calls.c
-@@ -21,12 +21,12 @@ along with GCC; see the file COPYING3. If not see
- #include "system.h"
- #include "coretypes.h"
- #include "backend.h"
--#include "tm_p.h"
- #include "target.h"
- #include "rtl.h"
- #include "tree.h"
- #include "gimple.h"
- #include "predict.h"
-+#include "tm_p.h"
- #include "stringpool.h"
- #include "expmed.h"
- #include "optabs.h"
-diff --git a/gcc/config/m68k/amigaos.c b/gcc/config/m68k/amigaos.c
-index 81d08245b580..88205e25476e 100644
---- gcc/config/m68k/amigaos.c
-+++ gcc/config/m68k/amigaos.c
-@@ -824,3 +824,12 @@ read_only_operand (rtx operand)
- return 1;
- }
-
-+reg_class_t
-+amiga_preferred_rename_class2(reg_class_t rclass ATTRIBUTE_UNUSED, int regno )
-+{
-+ if (regno == 0)
-+ return D0_REGS;
-+ if (regno == 8)
-+ return A0_REGS;
-+ return regno_reg_class[regno];
-+}
-diff --git a/gcc/config/m68k/amigaos.h b/gcc/config/m68k/amigaos.h
-index 9820f0ed1219..7259611edc9e 100644
---- gcc/config/m68k/amigaos.h
-+++ gcc/config/m68k/amigaos.h
-@@ -489,3 +489,8 @@ amigaos_rtx_costs (rtx, machine_mode, int, int, int *, bool);
- && GET_CODE(XEXP(XEXP(x, 0), 1)) == CONST \
- && GET_CODE(XEXP(XEXP(XEXP(x, 0), 1), 0)) == UNSPEC \
- )
-+
-+#undef TARGET_PREFERRED_RENAME_CLASS2
-+#define TARGET_PREFERRED_RENAME_CLASS2 amiga_preferred_rename_class2
-+reg_class_t
-+amiga_preferred_rename_class2(reg_class_t, int);
-diff --git a/gcc/config/m68k/m68k.c b/gcc/config/m68k/m68k.c
-index 64dcbf6969ee..d60371a92bc6 100644
---- gcc/config/m68k/m68k.c
-+++ gcc/config/m68k/m68k.c
-@@ -801,9 +801,11 @@ m68k_compute_frame_layout (void)
-
- /* Only compute the frame once per function.
- Don't cache information until reload has been completed. */
-- if (current_frame.funcdef_no == current_function_funcdef_no
-- && reload_completed)
-- return;
-+ /* SBF: No. Register renaming may free some variables,
-+ * => compute it again and again... */
-+// if (current_frame.funcdef_no == current_function_funcdef_no
-+// && reload_completed)
-+// return;
-
- current_frame.size = (get_frame_size () + 3) & -4;
-
-@@ -5272,12 +5274,12 @@ m68k_regno_mode_ok (int regno, machine_mode mode)
- {
- /* Data Registers, can hold aggregate if fits in. */
- if (regno + GET_MODE_SIZE (mode) / 4 <= 8)
-- return !flag_omit_frame_pointer || regno != FRAME_POINTER_REGNUM;
-+ return true;
- }
- else if (ADDRESS_REGNO_P (regno))
- {
- if (regno + GET_MODE_SIZE (mode) / 4 <= 16)
-- return !flag_omit_frame_pointer || regno != FRAME_POINTER_REGNUM;
-+ return !frame_pointer_needed || regno != FRAME_POINTER_REGNUM;
- }
- else if (FP_REGNO_P (regno))
- {
-diff --git a/gcc/config/m68k/m68k.h b/gcc/config/m68k/m68k.h
-index 74d5aa042059..5142adf24e4d 100644
---- gcc/config/m68k/m68k.h
-+++ gcc/config/m68k/m68k.h
-@@ -440,8 +440,8 @@ along with GCC; see the file COPYING3. If not see
- /* The m68k has three kinds of registers, so eight classes would be
- a complete set. One of them is not needed. */
- enum reg_class {
-- NO_REGS, DATA_REGS,
-- ADDR_REGS, FP_REGS,
-+ NO_REGS, DATA_REGS, D0_REGS,
-+ ADDR_REGS, A0_REGS, FP_REGS,
- GENERAL_REGS, DATA_OR_FP_REGS,
- ADDR_OR_FP_REGS, ALL_REGS,
- LIM_REG_CLASSES };
-@@ -449,8 +449,8 @@ enum reg_class {
- #define N_REG_CLASSES (int) LIM_REG_CLASSES
-
- #define REG_CLASS_NAMES \
-- { "NO_REGS", "DATA_REGS", \
-- "ADDR_REGS", "FP_REGS", \
-+ { "NO_REGS", "DATA_REGS", "D0_REGS" \
-+ "ADDR_REGS", "A0_REGS", "FP_REGS", \
- "GENERAL_REGS", "DATA_OR_FP_REGS", \
- "ADDR_OR_FP_REGS", "ALL_REGS" }
-
-@@ -458,7 +458,9 @@ enum reg_class {
- { \
- {0x00000000}, /* NO_REGS */ \
- {0x000000ff}, /* DATA_REGS */ \
-+ {0x00000001}, /* D0_REGS */ \
- {0x0100ff00}, /* ADDR_REGS */ \
-+ {0x00000100}, /* A0_REGS */ \
- {0x00ff0000}, /* FP_REGS */ \
- {0x0100ffff}, /* GENERAL_REGS */ \
- {0x00ff00ff}, /* DATA_OR_FP_REGS */ \
-diff --git a/gcc/df-scan.c b/gcc/df-scan.c
-index 98de84405428..b0ef0813d07d 100644
---- gcc/df-scan.c
-+++ gcc/df-scan.c
-@@ -1807,6 +1807,13 @@ df_ref_change_reg_with_loc_1 (struct df_reg_info *old_df,
- df_ref *ref_ptr;
- struct df_insn_info *insn_info = DF_REF_INSN_INFO (the_ref);
-
-+ if (DF_REF_FLAGS_IS_SET(the_ref, DF_HARD_REG_LIVE))
-+ {
-+ if (DF_REF_REGNO(the_ref) < FIRST_PSEUDO_REGISTER)
-+ --df->hard_regs_live_count[DF_REF_REGNO(the_ref)];
-+ ++df->hard_regs_live_count[new_regno];
-+ }
-+
- DF_REF_REGNO (the_ref) = new_regno;
- DF_REF_REG (the_ref) = regno_reg_rtx[new_regno];
-
-diff --git a/gcc/doc/tm.texi b/gcc/doc/tm.texi
-index 745910f9a331..6604514427fa 100644
---- gcc/doc/tm.texi
-+++ gcc/doc/tm.texi
-@@ -2489,6 +2489,10 @@ only if neither labeling works.
- A target hook that places additional preference on the register class to use when it is necessary to rename a register in class @var{rclass} to another class, or perhaps @var{NO_REGS}, if no preferred register class is found or hook @code{preferred_rename_class} is not implemented. Sometimes returning a more restrictive class makes better code. For example, on ARM, thumb-2 instructions using @code{LO_REGS} may be smaller than instructions using @code{GENERIC_REGS}. By returning @code{LO_REGS} from @code{preferred_rename_class}, code size can be reduced.
- @end deftypefn
-
-+@deftypefn {Target Hook} reg_class_t TARGET_PREFERRED_RENAME_CLASS2 (reg_class_t @var{rclass}, int @var{regno})
-+A target hook that places additional preference on the register class to use when it is necessary to rename a register in class @var{rclass} to another class, or perhaps @var{NO_REGS}, if no preferred register class is found or hook @code{preferred_rename_class2} is not implemented. Sometimes returning a more restrictive class makes better code. For example, on ARM, thumb-2 instructions using @code{LO_REGS} may be smaller than instructions using @code{GENERIC_REGS}. By returning @code{LO_REGS} from @code{preferred_rename_class2}, code size can be reduced.
-+@end deftypefn
-+
- @deftypefn {Target Hook} reg_class_t TARGET_PREFERRED_RELOAD_CLASS (rtx @var{x}, reg_class_t @var{rclass})
- A target hook that places additional restrictions on the register class
- to use when it is necessary to copy value @var{x} into a register in class
-diff --git a/gcc/doc/tm.texi.in b/gcc/doc/tm.texi.in
-index f31c763991c5..e4da2a94249b 100644
---- gcc/doc/tm.texi.in
-+++ gcc/doc/tm.texi.in
-@@ -2281,6 +2281,8 @@ only if neither labeling works.
-
- @hook TARGET_PREFERRED_RENAME_CLASS
-
-+@hook TARGET_PREFERRED_RENAME_CLASS2
-+
- @hook TARGET_PREFERRED_RELOAD_CLASS
-
- @defmac PREFERRED_RELOAD_CLASS (@var{x}, @var{class})
-diff --git a/gcc/expr.c b/gcc/expr.c
-index 01fe6437da12..6260f5ed7ed2 100644
---- gcc/expr.c
-+++ gcc/expr.c
-@@ -21,12 +21,12 @@ along with GCC; see the file COPYING3. If not see
- #include "system.h"
- #include "coretypes.h"
- #include "backend.h"
--#include "tm_p.h"
- #include "target.h"
- #include "rtl.h"
- #include "tree.h"
- #include "gimple.h"
- #include "predict.h"
-+#include "tm_p.h"
- #include "ssa.h"
- #include "expmed.h"
- #include "optabs.h"
-diff --git a/gcc/passes.def b/gcc/passes.def
-index 7aed14445429..ec796082ae7f 100644
---- gcc/passes.def
-+++ gcc/passes.def
-@@ -447,9 +447,6 @@ along with GCC; see the file COPYING3. If not see
- NEXT_PASS (pass_ree);
- NEXT_PASS (pass_compare_elim_after_reload);
- NEXT_PASS (pass_branch_target_load_optimize1);
-- NEXT_PASS (pass_thread_prologue_and_epilogue);
-- NEXT_PASS (pass_rtl_dse2);
-- NEXT_PASS (pass_stack_adjustments);
- NEXT_PASS (pass_jump2);
- NEXT_PASS (pass_duplicate_computed_gotos);
- NEXT_PASS (pass_sched_fusion);
-@@ -457,6 +454,9 @@ along with GCC; see the file COPYING3. If not see
- NEXT_PASS (pass_if_after_reload);
- NEXT_PASS (pass_regrename);
- NEXT_PASS (pass_cprop_hardreg);
-+ NEXT_PASS (pass_thread_prologue_and_epilogue);
-+ NEXT_PASS (pass_rtl_dse2);
-+ NEXT_PASS (pass_stack_adjustments);
- NEXT_PASS (pass_fast_rtl_dce);
- NEXT_PASS (pass_reorder_blocks);
- NEXT_PASS (pass_branch_target_load_optimize2);
-diff --git a/gcc/regrename.c b/gcc/regrename.c
-index df4c320700c5..ca7e24774afd 100644
---- gcc/regrename.c
-+++ gcc/regrename.c
-@@ -370,32 +370,31 @@ find_rename_reg (du_head_p this_head, enum reg_class super_class,
-
- /* Compute preferred rename class of super union of all the classes
- in the chain. */
-- preferred_class
-- = (enum reg_class) targetm.preferred_rename_class (super_class);
-+ preferred_class = (enum reg_class) targetm.preferred_rename_class2 (
-+ super_class, old_reg);
-
- /* Pick and check the register from the tied chain iff the tied chain
-- is not renamed. */
-+ is not renamed. */
- if (this_head->tied_chain && !this_head->tied_chain->renamed
-- && check_new_reg_p (old_reg, this_head->tied_chain->regno,
-- this_head, *unavailable))
-+ && check_new_reg_p (old_reg, this_head->tied_chain->regno, this_head,
-+ *unavailable))
- return this_head->tied_chain->regno;
-
- /* If PREFERRED_CLASS is not NO_REGS, we iterate in the first pass
-- over registers that belong to PREFERRED_CLASS and try to find the
-- best register within the class. If that failed, we iterate in
-- the second pass over registers that don't belong to the class.
-- If PREFERRED_CLASS is NO_REGS, we iterate over all registers in
-- ascending order without any preference. */
-+ over registers that belong to PREFERRED_CLASS and try to find the
-+ best register within the class. If that failed, we iterate in
-+ the second pass over registers that don't belong to the class.
-+ If PREFERRED_CLASS is NO_REGS, we iterate over all registers in
-+ ascending order without any preference. */
- has_preferred_class = (preferred_class != NO_REGS);
-- for (pass = (has_preferred_class ? 0 : 1); pass < 2; pass++)
- {
- int new_reg;
- for (new_reg = 0; new_reg < FIRST_PSEUDO_REGISTER; new_reg++)
- {
- if (has_preferred_class
-- && (pass == 0)
-- != TEST_HARD_REG_BIT (reg_class_contents[preferred_class],
-- new_reg))
-+ && 0
-+ == TEST_HARD_REG_BIT(reg_class_contents[preferred_class],
-+ new_reg))
- continue;
-
- if (!check_new_reg_p (old_reg, new_reg, this_head, *unavailable))
-@@ -405,17 +404,13 @@ find_rename_reg (du_head_p this_head, enum reg_class super_class,
- return new_reg;
-
- /* In the first pass, we force the renaming of registers that
-- don't belong to PREFERRED_CLASS to registers that do, even
-- though the latters were used not very long ago.
-- Also use a register if no best_new_reg was found till now */
-- if (((pass == 0)
-- && !TEST_HARD_REG_BIT (reg_class_contents[preferred_class],
-- best_new_reg))
-- || tick[best_new_reg] > tick[new_reg])
-+ don't belong to PREFERRED_CLASS to registers that do, even
-+ though the latters were used not very long ago.
-+ Also use a register if no best_new_reg was found till now */
-+ if ((tick[best_new_reg] > tick[new_reg]
-+ || (old_reg == best_new_reg && new_reg < old_reg)))
- best_new_reg = new_reg;
- }
-- if (pass == 0 && best_new_reg != old_reg)
-- break;
- }
- return best_new_reg;
- }
-@@ -955,7 +950,7 @@ regrename_analyze (bitmap bb_mask)
- numbering in its subpatterns. */
-
- bool
--regrename_do_replace (struct du_head *head, int reg)
-+regrename_do_replace (struct du_head *head, int regno)
- {
- struct du_chain *chain;
- unsigned int base_regno = head->regno;
-@@ -963,19 +958,20 @@ regrename_do_replace (struct du_head *head, int reg)
-
- for (chain = head->first; chain; chain = chain->next_use)
- {
-- unsigned int regno = ORIGINAL_REGNO (*chain->loc);
-- struct reg_attrs *attr = REG_ATTRS (*chain->loc);
-- int reg_ptr = REG_POINTER (*chain->loc);
-+ unsigned int orig_regno = ORIGINAL_REGNO(*chain->loc);
-+ struct reg_attrs *attr = REG_ATTRS(*chain->loc);
-+ int reg_ptr = REG_POINTER(*chain->loc);
-
- if (DEBUG_INSN_P (chain->insn) && REGNO (*chain->loc) != base_regno)
-- validate_change (chain->insn, &(INSN_VAR_LOCATION_LOC (chain->insn)),
-- gen_rtx_UNKNOWN_VAR_LOC (), true);
-+ validate_change (chain->insn, &(INSN_VAR_LOCATION_LOC(chain->insn)),
-+ gen_rtx_UNKNOWN_VAR_LOC (),
-+ true);
- else
- {
-- validate_change (chain->insn, chain->loc,
-- gen_raw_REG (GET_MODE (*chain->loc), reg), true);
-- if (regno >= FIRST_PSEUDO_REGISTER)
-- ORIGINAL_REGNO (*chain->loc) = regno;
-+ validate_change (chain->insn, chain->loc,
-+ gen_raw_REG (GET_MODE(*chain->loc), regno), true);
-+ if (orig_regno >= FIRST_PSEUDO_REGISTER)
-+ ORIGINAL_REGNO (*chain->loc) = orig_regno;
- REG_ATTRS (*chain->loc) = attr;
- REG_POINTER (*chain->loc) = reg_ptr;
- }
-@@ -984,10 +980,26 @@ regrename_do_replace (struct du_head *head, int reg)
- if (!apply_change_group ())
- return false;
-
-- mode = GET_MODE (*head->first->loc);
-+ mode = GET_MODE(*head->first->loc);
- head->renamed = 1;
-- head->regno = reg;
-- head->nregs = hard_regno_nregs[reg][mode];
-+ head->regno = regno;
-+ head->nregs = hard_regno_nregs[regno][mode];
-+
-+ /* SBF: also update the current df info, move from base_regno -> regno. */
-+ for (chain = head->first; chain; chain = chain->next_use)
-+ {
-+ /* undo regno patch - will be patched again */
-+ if (REGNO (*chain->loc) == regno)
-+ SET_REGNO(*chain->loc, base_regno);
-+ df_ref_change_reg_with_loc (*chain->loc, regno);
-+
-+ SET_REGNO(*chain->loc, regno);
-+ }
-+
-+ /* Mark the old regno as no longer used. */
-+ if (!df->hard_regs_live_count[base_regno])
-+ df_set_regs_ever_live (base_regno, false);
-+
- return true;
- }
-
-diff --git a/gcc/target.def b/gcc/target.def
-index 20f2b32da1e9..d0208812d83b 100644
---- gcc/target.def
-+++ gcc/target.def
-@@ -5170,6 +5170,25 @@ DEFHOOK
- reg_class_t, (reg_class_t rclass),
- default_preferred_rename_class)
-
-+/*A target hook that places additional preference on the register
-+ class
-+ */
-+DEFHOOK
-+(preferred_rename_class2,
-+ "A target hook that places additional preference on the register\
-+ class to use when it is necessary to rename a register in class\
-+ @var{rclass} to another class, or perhaps @var{NO_REGS}, if no\
-+ preferred register class is found or hook @code{preferred_rename_class2}\
-+ is not implemented.\
-+ Sometimes returning a more restrictive class makes better code. For\
-+ example, on ARM, thumb-2 instructions using @code{LO_REGS} may be\
-+ smaller than instructions using @code{GENERIC_REGS}. By returning\
-+ @code{LO_REGS} from @code{preferred_rename_class2}, code size can\
-+ be reduced.",
-+ reg_class_t, (reg_class_t rclass, int regno),
-+ default_preferred_rename_class2)
-+
-+
- /* This target hook allows the backend to avoid unsafe substitution
- during register allocation. */
- DEFHOOK
-diff --git a/gcc/targhooks.c b/gcc/targhooks.c
-index a34227705d2b..e106af7b261d 100644
---- gcc/targhooks.c
-+++ gcc/targhooks.c
-@@ -1542,6 +1542,13 @@ default_preferred_rename_class (reg_class_t rclass ATTRIBUTE_UNUSED)
- return NO_REGS;
- }
-
-+/* The default implementation of TARGET_PREFERRED_RENAME_CLASS2. */
-+reg_class_t
-+default_preferred_rename_class2 (reg_class_t rclass, int regno ATTRIBUTE_UNUSED)
-+{
-+ return targetm.preferred_rename_class(rclass);
-+}
-+
- /* The default implementation of TARGET_CLASS_LIKELY_SPILLED_P. */
-
- bool
-diff --git a/gcc/targhooks.h b/gcc/targhooks.h
-index 7687c39b53b5..0a21ef982a65 100644
---- gcc/targhooks.h
-+++ gcc/targhooks.h
-@@ -204,6 +204,7 @@ extern bool default_profile_before_prologue (void);
- extern reg_class_t default_preferred_reload_class (rtx, reg_class_t);
- extern reg_class_t default_preferred_output_reload_class (rtx, reg_class_t);
- extern reg_class_t default_preferred_rename_class (reg_class_t rclass);
-+extern reg_class_t default_preferred_rename_class2 (reg_class_t rclass, int regno);
- extern bool default_class_likely_spilled_p (reg_class_t);
- extern unsigned char default_class_max_nregs (reg_class_t, machine_mode);
-
-
-From 6b9057baef40c5661b35c995f764401a82fcf9b7 Mon Sep 17 00:00:00 2001
-From: bebbo <bebbo(a)bejy.net>
-Date: Mon, 20 Mar 2017 23:11:56 +0100
-Subject: [PATCH 034/303] @B fix include order
-
----
- gcc/function.c | 2 +-
- gcc/var-tracking.c | 2 +-
- 2 files changed, 2 insertions(+), 2 deletions(-)
-
-diff --git a/gcc/function.c b/gcc/function.c
-index e903b1bcdf65..c614f9b9c000 100644
---- gcc/function.c
-+++ gcc/function.c
-@@ -35,11 +35,11 @@ along with GCC; see the file COPYING3. If not see
- #include "system.h"
- #include "coretypes.h"
- #include "backend.h"
--#include "tm_p.h"
- #include "target.h"
- #include "rtl.h"
- #include "tree.h"
- #include "gimple-expr.h"
-+#include "tm_p.h"
- #include "cfghooks.h"
- #include "df.h"
- #include "stringpool.h"
-diff --git a/gcc/var-tracking.c b/gcc/var-tracking.c
-index 149c0c123804..ab9c0117b078 100644
---- gcc/var-tracking.c
-+++ gcc/var-tracking.c
-@@ -89,10 +89,10 @@
- #include "system.h"
- #include "coretypes.h"
- #include "backend.h"
--#include "tm_p.h"
- #include "target.h"
- #include "rtl.h"
- #include "tree.h"
-+#include "tm_p.h"
- #include "cfghooks.h"
- #include "alloc-pool.h"
- #include "tree-pass.h"
-
-From 1176f20fb5eb00f735a1c1ad2bb9d005fdac44aa Mon Sep 17 00:00:00 2001
-From: bebbo <bebbo(a)bejy.net>
-Date: Tue, 21 Mar 2017 00:15:07 +0100
-Subject: [PATCH 035/303] @B fix pssible NPE
-
----
- gcc/regrename.c | 19 +++++++++++--------
- 1 file changed, 11 insertions(+), 8 deletions(-)
-
-diff --git a/gcc/regrename.c b/gcc/regrename.c
-index ca7e24774afd..4a9b4c2735a1 100644
---- gcc/regrename.c
-+++ gcc/regrename.c
-@@ -986,15 +986,18 @@ regrename_do_replace (struct du_head *head, int regno)
- head->nregs = hard_regno_nregs[regno][mode];
-
- /* SBF: also update the current df info, move from base_regno -> regno. */
-- for (chain = head->first; chain; chain = chain->next_use)
-- {
-- /* undo regno patch - will be patched again */
-- if (REGNO (*chain->loc) == regno)
-- SET_REGNO(*chain->loc, base_regno);
-- df_ref_change_reg_with_loc (*chain->loc, regno);
-+ if (base_regno < FIRST_PSEUDO_REGISTER && regno < FIRST_PSEUDO_REGISTER)
-+ for (chain = head->first; chain; chain = chain->next_use)
-+ {
-+ if (DEBUG_INSN_P (chain->insn))
-+ continue;
-+ /* undo regno patch - will be patched again */
-+ if (REGNO (*chain->loc) == regno)
-+ SET_REGNO(*chain->loc, base_regno);
-+ df_ref_change_reg_with_loc (*chain->loc, regno);
-
-- SET_REGNO(*chain->loc, regno);
-- }
-+ SET_REGNO(*chain->loc, regno);
-+ }
-
- /* Mark the old regno as no longer used. */
- if (!df->hard_regs_live_count[base_regno])
-
-From 5844c3b50f6c2e52c83592a41e570603450d47b4 Mon Sep 17 00:00:00 2001
-From: bebbo <bebbo(a)bejy.net>
-Date: Wed, 22 Mar 2017 15:48:28 +0100
-Subject: [PATCH 036/303] @B decrement ref count correctly
-
----
- gcc/df-scan.c | 3 +--
- 1 file changed, 1 insertion(+), 2 deletions(-)
-
-diff --git a/gcc/df-scan.c b/gcc/df-scan.c
-index b0ef0813d07d..1f23452afe19 100644
---- gcc/df-scan.c
-+++ gcc/df-scan.c
-@@ -1809,8 +1809,7 @@ df_ref_change_reg_with_loc_1 (struct df_reg_info *old_df,
-
- if (DF_REF_FLAGS_IS_SET(the_ref, DF_HARD_REG_LIVE))
- {
-- if (DF_REF_REGNO(the_ref) < FIRST_PSEUDO_REGISTER)
-- --df->hard_regs_live_count[DF_REF_REGNO(the_ref)];
-+ --df->hard_regs_live_count[DF_REF_REGNO(the_ref)];
- ++df->hard_regs_live_count[new_regno];
- }
-
-
-From e9a9e3005a6160dc5e9a4338c5516f3787e657da Mon Sep 17 00:00:00 2001
-From: bebbo <bebbo(a)bejy.net>
-Date: Wed, 22 Mar 2017 15:49:15 +0100
-Subject: [PATCH 037/303] @I cleanup
-
----
- gcc/regrename.c | 40 ++++++++++++++++++----------------------
- 1 file changed, 18 insertions(+), 22 deletions(-)
-
-diff --git a/gcc/regrename.c b/gcc/regrename.c
-index 4a9b4c2735a1..2dd96db5b87f 100644
---- gcc/regrename.c
-+++ gcc/regrename.c
-@@ -356,8 +356,8 @@ find_rename_reg (du_head_p this_head, enum reg_class super_class,
- {
- bool has_preferred_class;
- enum reg_class preferred_class;
-- int pass;
- int best_new_reg = old_reg;
-+ int new_reg;
-
- /* Further narrow the set of registers we can use for renaming.
- If the chain needs a call-saved register, mark the call-used
-@@ -387,30 +387,26 @@ find_rename_reg (du_head_p this_head, enum reg_class super_class,
- If PREFERRED_CLASS is NO_REGS, we iterate over all registers in
- ascending order without any preference. */
- has_preferred_class = (preferred_class != NO_REGS);
-+ for (new_reg = 0; new_reg < FIRST_PSEUDO_REGISTER; new_reg++)
- {
-- int new_reg;
-- for (new_reg = 0; new_reg < FIRST_PSEUDO_REGISTER; new_reg++)
-- {
-- if (has_preferred_class
-- && 0
-- == TEST_HARD_REG_BIT(reg_class_contents[preferred_class],
-- new_reg))
-- continue;
-+ if (has_preferred_class
-+ && !TEST_HARD_REG_BIT(reg_class_contents[preferred_class],
-+ new_reg))
-+ continue;
-
-- if (!check_new_reg_p (old_reg, new_reg, this_head, *unavailable))
-- continue;
-+ if (!check_new_reg_p (old_reg, new_reg, this_head, *unavailable))
-+ continue;
-
-- if (!best_rename)
-- return new_reg;
-+ if (!best_rename)
-+ return new_reg;
-
-- /* In the first pass, we force the renaming of registers that
-- don't belong to PREFERRED_CLASS to registers that do, even
-- though the latters were used not very long ago.
-- Also use a register if no best_new_reg was found till now */
-- if ((tick[best_new_reg] > tick[new_reg]
-- || (old_reg == best_new_reg && new_reg < old_reg)))
-- best_new_reg = new_reg;
-- }
-+ /* In the first pass, we force the renaming of registers that
-+ don't belong to PREFERRED_CLASS to registers that do, even
-+ though the latters were used not very long ago.
-+ Also use a register if no best_new_reg was found till now */
-+ if ((tick[best_new_reg] > tick[new_reg]
-+ || (old_reg == best_new_reg && new_reg < old_reg)))
-+ best_new_reg = new_reg;
- }
- return best_new_reg;
- }
-@@ -989,7 +985,7 @@ regrename_do_replace (struct du_head *head, int regno)
- if (base_regno < FIRST_PSEUDO_REGISTER && regno < FIRST_PSEUDO_REGISTER)
- for (chain = head->first; chain; chain = chain->next_use)
- {
-- if (DEBUG_INSN_P (chain->insn))
-+ if (DEBUG_INSN_P (chain->insn) && VAR_LOC_UNKNOWN_P(INSN_VAR_LOCATION_LOC(chain->insn)))
- continue;
- /* undo regno patch - will be patched again */
- if (REGNO (*chain->loc) == regno)
-
-From ed41bbc9c042c73e2c423a93d98b6c83988fc8e3 Mon Sep 17 00:00:00 2001
-From: bebbo <bebbo(a)bejy.net>
-Date: Wed, 22 Mar 2017 16:02:57 +0100
-Subject: [PATCH 038/303] @R -ftree-loop-vectorize and -ftree-slp-vectorize are
- no longer enabled with -O3
-
----
- gcc/opts.c | 2 ++
- 1 file changed, 2 insertions(+)
-
-diff --git a/gcc/opts.c b/gcc/opts.c
-index 0f9431a0b323..28a617c0f14f 100644
---- gcc/opts.c
-+++ gcc/opts.c
-@@ -530,8 +530,10 @@ static const struct default_options default_options_table[] =
- { OPT_LEVELS_1_PLUS_NOT_DEBUG, OPT_finline_functions_called_once, NULL, 1 },
- { OPT_LEVELS_3_PLUS, OPT_funswitch_loops, NULL, 1 },
- { OPT_LEVELS_3_PLUS, OPT_fgcse_after_reload, NULL, 1 },
-+#ifndef TARGET_AMIGA
- { OPT_LEVELS_3_PLUS, OPT_ftree_loop_vectorize, NULL, 1 },
- { OPT_LEVELS_3_PLUS, OPT_ftree_slp_vectorize, NULL, 1 },
-+#endif
- { OPT_LEVELS_3_PLUS, OPT_fvect_cost_model_, NULL, VECT_COST_MODEL_DYNAMIC },
- { OPT_LEVELS_3_PLUS, OPT_fipa_cp_clone, NULL, 1 },
- { OPT_LEVELS_3_PLUS, OPT_ftree_partial_pre, NULL, 1 },
-
-From 25f75fe3179ceb6da6f50b1c30d8fe810c1ccccd Mon Sep 17 00:00:00 2001
-From: bebbo <bebbo(a)bejy.net>
-Date: Wed, 22 Mar 2017 16:05:51 +0100
-Subject: [PATCH 039/303] @N added a new combine optimization.i2 something ->
- regi3 reg -> somewherewithi4 compare reg, const_0is replaced with: something
- -> somewhere, if the reg is dead at the comparison
-
----
- gcc/combine.c | 60 +++++++++++++++++++++++++++++++++++++++++++++++++++++++++++
- 1 file changed, 60 insertions(+)
-
-diff --git a/gcc/combine.c b/gcc/combine.c
-index 75c6229766c0..333f8fef9655 100644
---- gcc/combine.c
-+++ gcc/combine.c
-@@ -102,6 +102,7 @@ along with GCC; see the file COPYING3. If not see
- #include "valtrack.h"
- #include "rtl-iter.h"
- #include "print-rtl.h"
-+#include "conditions.h"
-
- #ifndef LOAD_EXTEND_OP
- #define LOAD_EXTEND_OP(M) UNKNOWN
-@@ -2578,6 +2579,7 @@ static rtx_insn *
- try_combine (rtx_insn *i3, rtx_insn *i2, rtx_insn *i1, rtx_insn *i0,
- int *new_direct_jump_p, rtx_insn *last_combined_insn)
- {
-+ rtx_insn * del4 = 0;
- /* New patterns for I3 and I2, respectively. */
- rtx newpat, newi2pat = 0;
- rtvec newpat_vec_with_clobbers = 0;
-@@ -3350,6 +3352,52 @@ try_combine (rtx_insn *i3, rtx_insn *i2, rtx_insn *i1, rtx_insn *i0,
- substed_i0 = 1;
- }
-
-+#if HAVE_cc0
-+ /* SBF: This is an attempt to combine
-+ * i2 something -> reg
-+ * i3 reg -> somewhere
-+ * with the next insn i4
-+ * i4 compare reg, 0
-+ *
-+ * then
-+ * newpat = something -> somewhere
-+ *
-+ * If the comparison with 0 is already done in the insn newpat
-+ * and the reg is dead at the compare insn
-+ * then perform the combine and mark the compare as deleted.
-+ */
-+ if (i2dest_killed && !i0 && !i1 && i2pat && i2_is_used + added_sets_2 > 1
-+ && NEXT_INSN(i3))
-+ {
-+ rtx_insn *next = NEXT_INSN(i3);
-+ rtx setn = single_set(next);
-+ if (setn)
-+ {
-+ rtx srcn = SET_SRC(setn);
-+ if (GET_CODE(srcn) == COMPARE)
-+ {
-+ rtx dstn = XEXP(srcn, 0);
-+ srcn = XEXP(srcn, 1);
-+
-+ if (CONST_INT_P(srcn) && INTVAL(srcn) == 0
-+ && find_reg_note(next, REG_DEAD, dstn))
-+ {
-+ /* now check via NOTICE_UPDATE_CC*/
-+ NOTICE_UPDATE_CC(PATTERN(i2), i2);
-+ if (cc_status.flags == 0 && rtx_equal_p(dstn, cc_status.value1))
-+ {
-+ added_sets_2 = 0;
-+ i2_is_used = 0;
-+
-+ /* perform deletion later, if all other checks are ok. */
-+ del4 = next;
-+ }
-+ }
-+ }
-+ }
-+ }
-+#endif
-+
- /* Fail if an autoincrement side-effect has been duplicated. Be careful
- to count all the ways that I2SRC and I1SRC can be used. */
- if ((FIND_REG_INC_NOTE (i2, NULL_RTX) != 0
-@@ -4387,6 +4435,18 @@ try_combine (rtx_insn *i3, rtx_insn *i2, rtx_insn *i1, rtx_insn *i0,
- move_deaths (newi2pat, NULL_RTX, from_luid, i2, &midnotes);
- move_deaths (newpat, newi2pat, from_luid, i3, &midnotes);
-
-+ /* SBF: perform the deletion of the next insn, if marked. */
-+ if (del4)
-+ {
-+ int del_from_luid = DF_INSN_LUID(del4);
-+ LOG_LINKS(del4) = NULL;
-+ REG_NOTES(del4) = 0;
-+ SET_INSN_DELETED(del4);
-+ if (newi2pat)
-+ move_deaths(newi2pat, NULL_RTX, del_from_luid, del4, &midnotes);
-+ move_deaths(newpat, NULL_RTX, del_from_luid, del4, &midnotes);
-+ }
-+
- /* Distribute all the LOG_LINKS and REG_NOTES from I1, I2, and I3. */
- if (i3notes)
- distribute_notes (i3notes, i3, i3, newi2pat ? i2 : NULL,
-
-From 464f34464d1abdb6e5dfcab0e78e12e15ca133b5 Mon Sep 17 00:00:00 2001
-From: bebbo <bebbo(a)bejy.net>
-Date: Thu, 23 Mar 2017 16:12:37 +0100
-Subject: [PATCH 040/303] @B added further constraints to optimize the compare
- away
-
----
- gcc/combine.c | 13 ++++++++++---
- 1 file changed, 10 insertions(+), 3 deletions(-)
-
-diff --git a/gcc/combine.c b/gcc/combine.c
-index 333f8fef9655..1103521f9cf1 100644
---- gcc/combine.c
-+++ gcc/combine.c
-@@ -2598,7 +2598,7 @@ try_combine (rtx_insn *i3, rtx_insn *i2, rtx_insn *i1, rtx_insn *i0,
- I2 and not in I3, a REG_DEAD note must be made. */
- rtx i3dest_killed = 0;
- /* SET_DEST and SET_SRC of I2, I1 and I0. */
-- rtx i2dest = 0, i2src = 0, i1dest = 0, i1src = 0, i0dest = 0, i0src = 0;
-+ rtx i3src = 0, i2dest = 0, i2src = 0, i1dest = 0, i1src = 0, i0dest = 0, i0src = 0;
- /* Copy of SET_SRC of I1 and I0, if needed. */
- rtx i1src_copy = 0, i0src_copy = 0, i0src_copy2 = 0;
- /* Set if I2DEST was reused as a scratch register. */
-@@ -2632,6 +2632,9 @@ try_combine (rtx_insn *i3, rtx_insn *i2, rtx_insn *i1, rtx_insn *i0,
- if (i1 == i2 || i0 == i2 || (i0 && i0 == i1))
- return 0;
-
-+ if (single_set(i3))
-+ i3src = SET_SRC(single_set(i3));
-+
- /* Only try four-insn combinations when there's high likelihood of
- success. Look for simple insns, such as loads of constants or
- binary operations involving a constant. */
-@@ -3367,6 +3370,7 @@ try_combine (rtx_insn *i3, rtx_insn *i2, rtx_insn *i1, rtx_insn *i0,
- * then perform the combine and mark the compare as deleted.
- */
- if (i2dest_killed && !i0 && !i1 && i2pat && i2_is_used + added_sets_2 > 1
-+ && rtx_equal_p(i2dest, i3src)
- && NEXT_INSN(i3))
- {
- rtx_insn *next = NEXT_INSN(i3);
-@@ -3391,7 +3395,7 @@ try_combine (rtx_insn *i3, rtx_insn *i2, rtx_insn *i1, rtx_insn *i0,
-
- /* perform deletion later, if all other checks are ok. */
- del4 = next;
-- }
-+ }
- }
- }
- }
-@@ -4438,10 +4442,13 @@ try_combine (rtx_insn *i3, rtx_insn *i2, rtx_insn *i1, rtx_insn *i0,
- /* SBF: perform the deletion of the next insn, if marked. */
- if (del4)
- {
-+// rtx set = SET_SRC(single_set(del4));
-+
- int del_from_luid = DF_INSN_LUID(del4);
- LOG_LINKS(del4) = NULL;
- REG_NOTES(del4) = 0;
-- SET_INSN_DELETED(del4);
-+ SET_INSN_DELETED(del4);
-+// XEXP(set, 0) = XEXP(set, 1);
- if (newi2pat)
- move_deaths(newi2pat, NULL_RTX, del_from_luid, del4, &midnotes);
- move_deaths(newpat, NULL_RTX, del_from_luid, del4, &midnotes);
-
-From 704efeb80a44bf883699e620c4b51eef32d9659c Mon Sep 17 00:00:00 2001
-From: bebbo <bebbo(a)bejy.net>
-Date: Fri, 24 Mar 2017 17:05:33 +0100
-Subject: [PATCH 041/303] @N support -ramiga-... stuff
-
----
- gcc/config/m68k/amigaos.opt | 12 ++++++++++++
- 1 file changed, 12 insertions(+)
-
-diff --git a/gcc/config/m68k/amigaos.opt b/gcc/config/m68k/amigaos.opt
-index 4d9a42052355..f985cf5e2845 100644
---- gcc/config/m68k/amigaos.opt
-+++ gcc/config/m68k/amigaos.opt
-@@ -7,6 +7,18 @@ noixemul
- Target RejectNegative
- Do not use ixemul.library - use libnix instead to link
-
-+ramiga-lib
-+Target RejectNegative
-+Use libinit.o as start file
-+
-+ramiga-libr
-+Target RejectNegative
-+Use libinitr.o as start file
-+
-+ramiga-dev
-+Target RejectNegative
-+Use devinit.o as start file
-+
- msmall-code
- Target RejectNegative Var(flag_smallcode,1)
- small code model
-
-From d62a4d349a55a59aa9d8b9a3f02827d66be960b4 Mon Sep 17 00:00:00 2001
-From: bebbo <bebbo(a)bejy.net>
-Date: Fri, 24 Mar 2017 17:06:31 +0100
-Subject: [PATCH 042/303] @R make exception section name configurable by TARGET
-
----
- gcc/config/m68k/m68kamigaos.h | 6 ++++++
- gcc/except.c | 4 ++--
- gcc/target-def.h | 8 ++++++++
- 3 files changed, 16 insertions(+), 2 deletions(-)
-
-diff --git a/gcc/config/m68k/m68kamigaos.h b/gcc/config/m68k/m68kamigaos.h
-index 74403a50bb67..ececc6d76498 100644
---- gcc/config/m68k/m68kamigaos.h
-+++ gcc/config/m68k/m68kamigaos.h
-@@ -601,3 +601,9 @@ extern int amiga_is_const_pic_ref(const_rtx x);
- ! symbolic_operand (X, VOIDmode) || LEGITIMATE_BASEREL_OPERAND_P (X))
-
- // (GET_CODE(X) == CONST && (GET_CODE(XEXP(X, 0)) == SYMBOL_REF || GET_CODE(XEXP(X, 0)) == LABEL_REF) && !CONSTANT_POOL_ADDRESS_P (XEXP(X, 0))) ||
-+
-+#undef TARGET_GCC_EXCEPT_TABLE
-+#define TARGET_GCC_EXCEPT_TABLE ".data"
-+
-+#undef TARGET_GCC_EXCEPT_TABLE_S
-+#define TARGET_GCC_EXCEPT_TABLE_S ".data"
-diff --git a/gcc/except.c b/gcc/except.c
-index 2a1073f80cc4..156d7b76d249 100644
---- gcc/except.c
-+++ gcc/except.c
-@@ -2850,14 +2850,14 @@ switch_to_exception_section (const char * ARG_UNUSED (fnname))
- it linkonce if we have COMDAT groups to tie them together. */
- if (DECL_COMDAT_GROUP (current_function_decl) && HAVE_COMDAT_GROUP)
- flags |= SECTION_LINKONCE;
-- sprintf (section_name, ".gcc_except_table.%s", fnname);
-+ sprintf (section_name, TARGET_GCC_EXCEPT_TABLE_S, fnname);
- s = get_section (section_name, flags, current_function_decl);
- free (section_name);
- }
- else
- #endif
- exception_section
-- = s = get_section (".gcc_except_table", flags, NULL);
-+ = s = get_section (TARGET_GCC_EXCEPT_TABLE, flags, NULL);
- }
- else
- exception_section
-diff --git a/gcc/target-def.h b/gcc/target-def.h
-index ec5e09e568e6..9fbfde121095 100644
---- gcc/target-def.h
-+++ gcc/target-def.h
-@@ -108,3 +108,11 @@
- #include "hooks.h"
- #include "targhooks.h"
- #include "insn-target-def.h"
-+
-+#ifndef TARGET_GCC_EXCEPT_TABLE
-+#define TARGET_GCC_EXCEPT_TABLE ".gcc_except_table"
-+#endif
-+
-+#ifndef TARGET_GCC_EXCEPT_TABLE_S
-+#define TARGET_GCC_EXCEPT_TABLE_S ".gcc_except_table.%s"
-+#endif
-
-From bd6fbbbc0a587184db27e691e05a795e1abdeaf6 Mon Sep 17 00:00:00 2001
-From: bebbo <bebbo(a)bejy.net>
-Date: Fri, 24 Mar 2017 17:07:18 +0100
-Subject: [PATCH 043/303] @R build libstdc++-v3 with noiexmul
-
----
- libstdc++-v3/configure | 2 ++
- 1 file changed, 2 insertions(+)
-
-diff --git a/libstdc++-v3/configure b/libstdc++-v3/configure
-index 44ba3aca42af..d61b41b2fb7c 100755
---- libstdc++-v3/configure
-+++ libstdc++-v3/configure
-@@ -8636,6 +8636,8 @@ $as_echo_n "checking for $compiler option to produce PIC... " >&6; }
- # adding the `-m68020' flag to GCC prevents building anything better,
- # like `-m68040'.
- lt_prog_compiler_pic='-m68020 -resident32 -malways-restore-a4'
-+ enable_shared=no
-+ CXXFLAGS="$CXXFLAGS -noixemul"
- ;;
- esac
- ;;
-
-From f05e1e6bd5a30ee7dfea2399acf268771c986767 Mon Sep 17 00:00:00 2001
-From: bebbo <bebbo(a)bejy.net>
-Date: Sat, 25 Mar 2017 23:11:55 +0100
-Subject: [PATCH 044/303] @R move all EH data into .text section
-
----
- gcc/config/m68k/m68kamigaos.h | 7 +++++--
- gcc/dwarf2out.c | 2 +-
- 2 files changed, 6 insertions(+), 3 deletions(-)
-
-diff --git a/gcc/config/m68k/m68kamigaos.h b/gcc/config/m68k/m68kamigaos.h
-index ececc6d76498..68f3277bd87c 100644
---- gcc/config/m68k/m68kamigaos.h
-+++ gcc/config/m68k/m68kamigaos.h
-@@ -603,7 +603,10 @@ extern int amiga_is_const_pic_ref(const_rtx x);
- // (GET_CODE(X) == CONST && (GET_CODE(XEXP(X, 0)) == SYMBOL_REF || GET_CODE(XEXP(X, 0)) == LABEL_REF) && !CONSTANT_POOL_ADDRESS_P (XEXP(X, 0))) ||
-
- #undef TARGET_GCC_EXCEPT_TABLE
--#define TARGET_GCC_EXCEPT_TABLE ".data"
-+#define TARGET_GCC_EXCEPT_TABLE ".text"
-
- #undef TARGET_GCC_EXCEPT_TABLE_S
--#define TARGET_GCC_EXCEPT_TABLE_S ".data"
-+#define TARGET_GCC_EXCEPT_TABLE_S ".text"
-+
-+#define EH_TABLES_CAN_BE_READ_ONLY 1
-+
-diff --git a/gcc/dwarf2out.c b/gcc/dwarf2out.c
-index 995ae7f18758..2740e417b0b2 100644
---- gcc/dwarf2out.c
-+++ gcc/dwarf2out.c
-@@ -451,7 +451,7 @@ switch_to_eh_frame_section (bool back ATTRIBUTE_UNUSED)
- /*global=*/1);
- lsda_encoding = ASM_PREFERRED_EH_DATA_FORMAT (/*code=*/0,
- /*global=*/0);
-- flags = ((! flag_pic
-+ flags = (( (!flag_pic || flag_pic > 2)
- || ((fde_encoding & 0x70) != DW_EH_PE_absptr
- && (fde_encoding & 0x70) != DW_EH_PE_aligned
- && (per_encoding & 0x70) != DW_EH_PE_absptr
-
-From 3be02d432149821fde6d3de2eca3830943c9dfc1 Mon Sep 17 00:00:00 2001
-From: bebbo <bebbo(a)bejy.net>
-Date: Sun, 26 Mar 2017 20:49:43 +0200
-Subject: [PATCH 045/303] @R patches to work with amigaos-*-m68k
-
----
- libstdc++-v3/configure.host | 5 +++++
- libstdc++-v3/include/c_global/cstdio | 2 --
- 2 files changed, 5 insertions(+), 2 deletions(-)
-
-diff --git a/libstdc++-v3/configure.host b/libstdc++-v3/configure.host
-index 304a7f5aff61..354b1c7ead46 100644
---- libstdc++-v3/configure.host
-+++ libstdc++-v3/configure.host
-@@ -226,6 +226,11 @@ case "${host_os}" in
- os_include_dir="os/generic"
- atomicity_dir="cpu/generic"
- ;;
-+ amiga*)
-+ os_include_dir="os/newlib"
-+ CXXFLAGS="${CXXFLAGS} -noixemul"
-+ CPPFLAGS="${CPPFLAGS} -noixemul"
-+ ;;
- bsd*)
- # Plain BSD attempts to share FreeBSD files.
- os_include_dir="os/bsd/freebsd"
-diff --git a/libstdc++-v3/include/c_global/cstdio b/libstdc++-v3/include/c_global/cstdio
-index 522d065d4dc6..86d524f96a62 100644
---- libstdc++-v3/include/c_global/cstdio
-+++ libstdc++-v3/include/c_global/cstdio
-@@ -149,9 +149,7 @@ namespace std
- #if _GLIBCXX_USE_C99_STDIO
-
- #undef snprintf
--#ifndef AMIGA
- #undef vfscanf
--#endif
- #undef vscanf
- #undef vsnprintf
- #undef vsscanf
-
-From 1a1c3869ddd0e8e75eef0849dcd0b060dd26cbbd Mon Sep 17 00:00:00 2001
-From: bebbo <bebbo(a)bejy.net>
-Date: Sun, 26 Mar 2017 20:50:20 +0200
-Subject: [PATCH 046/303] @R patches to work with amigaos-*-m68k
-
----
- libobjc/configure | 3 ++-
- libobjc/objc/objc.h | 4 ++++
- 2 files changed, 6 insertions(+), 1 deletion(-)
-
-diff --git a/libobjc/configure b/libobjc/configure
-index 55fcc33dbe2d..a60258f422d8 100755
---- libobjc/configure
-+++ libobjc/configure
-@@ -7637,7 +7637,8 @@ $as_echo_n "checking for $compiler option to produce PIC... " >&6; }
- # FIXME: we need at least 68020 code to build shared libraries, but
- # adding the `-m68020' flag to GCC prevents building anything better,
- # like `-m68040'.
-- lt_prog_compiler_pic='-m68020 -resident32 -malways-restore-a4'
-+ #lt_prog_compiler_pic='-m68020 -resident32 -malways-restore-a4'
-+ enable_shared=no
- ;;
- esac
- ;;
-diff --git a/libobjc/objc/objc.h b/libobjc/objc/objc.h
-index 37391a446bb0..6c73f53290e8 100644
---- libobjc/objc/objc.h
-+++ libobjc/objc/objc.h
-@@ -52,7 +52,11 @@ extern "C" {
- Important: this could change and we could switch to 'typedef bool
- BOOL' in the future. Do not depend on the type of BOOL. */
- #undef BOOL
-+#ifdef AMIGA
-+typedef short BOOL;
-+#else
- typedef unsigned char BOOL;
-+#endif
-
- #define YES (BOOL)1
- #define NO (BOOL)0
-
-From 7f8948f412f79fb2efd6835a3062720c1b34febf Mon Sep 17 00:00:00 2001
-From: bebbo <bebbo(a)bejy.net>
-Date: Wed, 29 Mar 2017 18:08:05 +0200
-Subject: [PATCH 047/303] @B fix for possible corrupted code, due to combine
- optimization. Maybe incorrect...
-
----
- gcc/reload1.c | 3 ++-
- 1 file changed, 2 insertions(+), 1 deletion(-)
-
-diff --git a/gcc/reload1.c b/gcc/reload1.c
-index c2800f8cb790..7f386a3aaab0 100644
---- gcc/reload1.c
-+++ gcc/reload1.c
-@@ -7943,7 +7943,8 @@ do_input_reload (struct insn_chain *chain, struct reload *rl, int j)
- AUTO_INC reload if reload_out is set but reload_out_reg isn't. */
- && (! reload_inherited[j] || (rl->out && ! rl->out_reg))
- && ! rtx_equal_p (reg_rtx, old)
-- && reg_rtx != 0)
-+ && reg_rtx != 0
-+ && rl->in_reg != rl->out_reg)
- emit_input_reload_insns (chain, rld + j, old, j);
-
- /* When inheriting a wider reload, we have a MEM in rl->in,
-
-From 709da5eaf06c7d9d1aa3332feab227469be4cc48 Mon Sep 17 00:00:00 2001
-From: bebbo <bebbo(a)bejy.net>
-Date: Thu, 30 Mar 2017 11:29:16 +0200
-Subject: [PATCH 048/303] @B remove optimization The side effects are not
- solved yet, so this experiment is removed from the 'stable' branch
-
----
- gcc/combine.c | 69 +----------------------------------------------------------
- gcc/reload1.c | 3 +--
- 2 files changed, 2 insertions(+), 70 deletions(-)
-
-diff --git a/gcc/combine.c b/gcc/combine.c
-index 1103521f9cf1..75c6229766c0 100644
---- gcc/combine.c
-+++ gcc/combine.c
-@@ -102,7 +102,6 @@ along with GCC; see the file COPYING3. If not see
- #include "valtrack.h"
- #include "rtl-iter.h"
- #include "print-rtl.h"
--#include "conditions.h"
-
- #ifndef LOAD_EXTEND_OP
- #define LOAD_EXTEND_OP(M) UNKNOWN
-@@ -2579,7 +2578,6 @@ static rtx_insn *
- try_combine (rtx_insn *i3, rtx_insn *i2, rtx_insn *i1, rtx_insn *i0,
- int *new_direct_jump_p, rtx_insn *last_combined_insn)
- {
-- rtx_insn * del4 = 0;
- /* New patterns for I3 and I2, respectively. */
- rtx newpat, newi2pat = 0;
- rtvec newpat_vec_with_clobbers = 0;
-@@ -2598,7 +2596,7 @@ try_combine (rtx_insn *i3, rtx_insn *i2, rtx_insn *i1, rtx_insn *i0,
- I2 and not in I3, a REG_DEAD note must be made. */
- rtx i3dest_killed = 0;
- /* SET_DEST and SET_SRC of I2, I1 and I0. */
-- rtx i3src = 0, i2dest = 0, i2src = 0, i1dest = 0, i1src = 0, i0dest = 0, i0src = 0;
-+ rtx i2dest = 0, i2src = 0, i1dest = 0, i1src = 0, i0dest = 0, i0src = 0;
- /* Copy of SET_SRC of I1 and I0, if needed. */
- rtx i1src_copy = 0, i0src_copy = 0, i0src_copy2 = 0;
- /* Set if I2DEST was reused as a scratch register. */
-@@ -2632,9 +2630,6 @@ try_combine (rtx_insn *i3, rtx_insn *i2, rtx_insn *i1, rtx_insn *i0,
- if (i1 == i2 || i0 == i2 || (i0 && i0 == i1))
- return 0;
-
-- if (single_set(i3))
-- i3src = SET_SRC(single_set(i3));
--
- /* Only try four-insn combinations when there's high likelihood of
- success. Look for simple insns, such as loads of constants or
- binary operations involving a constant. */
-@@ -3355,53 +3350,6 @@ try_combine (rtx_insn *i3, rtx_insn *i2, rtx_insn *i1, rtx_insn *i0,
- substed_i0 = 1;
- }
-
--#if HAVE_cc0
-- /* SBF: This is an attempt to combine
-- * i2 something -> reg
-- * i3 reg -> somewhere
-- * with the next insn i4
-- * i4 compare reg, 0
-- *
-- * then
-- * newpat = something -> somewhere
-- *
-- * If the comparison with 0 is already done in the insn newpat
-- * and the reg is dead at the compare insn
-- * then perform the combine and mark the compare as deleted.
-- */
-- if (i2dest_killed && !i0 && !i1 && i2pat && i2_is_used + added_sets_2 > 1
-- && rtx_equal_p(i2dest, i3src)
-- && NEXT_INSN(i3))
-- {
-- rtx_insn *next = NEXT_INSN(i3);
-- rtx setn = single_set(next);
-- if (setn)
-- {
-- rtx srcn = SET_SRC(setn);
-- if (GET_CODE(srcn) == COMPARE)
-- {
-- rtx dstn = XEXP(srcn, 0);
-- srcn = XEXP(srcn, 1);
--
-- if (CONST_INT_P(srcn) && INTVAL(srcn) == 0
-- && find_reg_note(next, REG_DEAD, dstn))
-- {
-- /* now check via NOTICE_UPDATE_CC*/
-- NOTICE_UPDATE_CC(PATTERN(i2), i2);
-- if (cc_status.flags == 0 && rtx_equal_p(dstn, cc_status.value1))
-- {
-- added_sets_2 = 0;
-- i2_is_used = 0;
--
-- /* perform deletion later, if all other checks are ok. */
-- del4 = next;
-- }
-- }
-- }
-- }
-- }
--#endif
--
- /* Fail if an autoincrement side-effect has been duplicated. Be careful
- to count all the ways that I2SRC and I1SRC can be used. */
- if ((FIND_REG_INC_NOTE (i2, NULL_RTX) != 0
-@@ -4439,21 +4387,6 @@ try_combine (rtx_insn *i3, rtx_insn *i2, rtx_insn *i1, rtx_insn *i0,
- move_deaths (newi2pat, NULL_RTX, from_luid, i2, &midnotes);
- move_deaths (newpat, newi2pat, from_luid, i3, &midnotes);
-
-- /* SBF: perform the deletion of the next insn, if marked. */
-- if (del4)
-- {
--// rtx set = SET_SRC(single_set(del4));
--
-- int del_from_luid = DF_INSN_LUID(del4);
-- LOG_LINKS(del4) = NULL;
-- REG_NOTES(del4) = 0;
-- SET_INSN_DELETED(del4);
--// XEXP(set, 0) = XEXP(set, 1);
-- if (newi2pat)
-- move_deaths(newi2pat, NULL_RTX, del_from_luid, del4, &midnotes);
-- move_deaths(newpat, NULL_RTX, del_from_luid, del4, &midnotes);
-- }
--
- /* Distribute all the LOG_LINKS and REG_NOTES from I1, I2, and I3. */
- if (i3notes)
- distribute_notes (i3notes, i3, i3, newi2pat ? i2 : NULL,
-diff --git a/gcc/reload1.c b/gcc/reload1.c
-index 7f386a3aaab0..c2800f8cb790 100644
---- gcc/reload1.c
-+++ gcc/reload1.c
-@@ -7943,8 +7943,7 @@ do_input_reload (struct insn_chain *chain, struct reload *rl, int j)
- AUTO_INC reload if reload_out is set but reload_out_reg isn't. */
- && (! reload_inherited[j] || (rl->out && ! rl->out_reg))
- && ! rtx_equal_p (reg_rtx, old)
-- && reg_rtx != 0
-- && rl->in_reg != rl->out_reg)
-+ && reg_rtx != 0)
- emit_input_reload_insns (chain, rld + j, old, j);
-
- /* When inheriting a wider reload, we have a MEM in rl->in,
-
-From c44d7bced301829dbab55b307545a7e029e69e6f Mon Sep 17 00:00:00 2001
-From: bebbo <bebbo(a)bejy.net>
-Date: Thu, 30 Mar 2017 20:44:57 +0200
-Subject: [PATCH 049/303] @N added a separate optimization pass
-
----
- gcc/Makefile.in | 1 +
- gcc/bbb-opts.c | 401 ++++++++++++++++++++++++++++++++++++++++++++++++++++++++
- gcc/passes.c | 27 ++++
- gcc/passes.def | 1 +
- gcc/regrename.c | 9 +-
- gcc/tree-pass.h | 1 +
- 6 files changed, 437 insertions(+), 3 deletions(-)
- create mode 100755 gcc/bbb-opts.c
- mode change 100644 => 100755 gcc/regrename.c
-
-diff --git a/gcc/Makefile.in b/gcc/Makefile.in
-index 575d308907cc..dc01aeef0f0c 100644
---- gcc/Makefile.in
-+++ gcc/Makefile.in
-@@ -1199,6 +1199,7 @@ OBJS = \
- auto-inc-dec.o \
- auto-profile.o \
- bb-reorder.o \
-+ bbb-opts.o \
- bitmap.o \
- bt-load.o \
- builtins.o \
-diff --git a/gcc/bbb-opts.c b/gcc/bbb-opts.c
-new file mode 100755
-index 000000000000..ff447c9e335e
---- /dev/null
-+++ gcc/bbb-opts.c
-@@ -0,0 +1,401 @@
-+/* Bebbo's Optimizations.
-+ Copyright (C) 2010-2016 Free Software Foundation, Inc.
-+
-+ This file is part of GCC.
-+
-+ GCC 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 3, or (at your option) any later
-+ version.
-+
-+ GCC 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 GCC; see the file COPYING3. If not see
-+ <http://www.gnu.org/licenses/>. */
-+
-+/**
-+ * SBF (Stefan "Bebbo" Franke):
-+ *
-+ * This pass performs multiple optimizations.
-+ *
-+ * #1 propagate_moves
-+ * check if a->b->a can be moved out of a loop.
-+ *
-+ * #2 strcpy
-+ * move a,reg
-+ * move reg,b
-+ * cmp #0,reg
-+ * jne/jeq
-+ */
-+
-+#include "config.h"
-+#include "system.h"
-+#include "coretypes.h"
-+#include "backend.h"
-+#include "target.h"
-+#include "rtl.h"
-+#include "df.h"
-+#include "tm_p.h"
-+#include "insn-config.h"
-+#include "recog.h"
-+#include "cfgrtl.h"
-+#include "emit-rtl.h"
-+#include "tree-pass.h"
-+#include "conditions.h"
-+#include <vector>
-+#include <map>
-+
-+extern void
-+dump_insns (char const * name);
-+
-+/*
-+ * #1 propagate a->b->a moves out of a loop.
-+ *
-+ * consider a loop:
-+ *
-+ * .L1
-+ * ...
-+ * move d0, a0 ; (1)
-+ * ...
-+ * move xy, (a0)+
-+ * ...
-+ * move a0, d0 ; (2)
-+ * ...
-+ * jxx .L1
-+ *
-+ * Then the statements (1) and (2) can be moved out of the loop:
-+ *
-+ * move d0, a0 ; (3)
-+ * .L1
-+ * ...
-+ * move *, (a0)+ ; a0 is modified somehow
-+ * ...
-+ * jxx .L1
-+ * move a0, d0 ; (4)
-+ *
-+ * if all criteria are met:
-+ *
-+ * a) no other jump to .L1 -> (LABEL_NUSES(insn) == 1)
-+ * b) no other use of d0 inside the loop
-+ * c) no other use of a0 before (1)
-+ * d) no other use of a1 after (2)
-+ *
-+ * Optional:
-+ * - omit (4) if d0 is dead
-+ *
-+ * this will e.g. convert
-+ .L6:
-+ move.l d0,a1
-+ move.b (a1)+,d1
-+ move.l a1,d0
-+ move.b d1,(a0)+
-+ cmp.b #0, d1
-+ jne .L6
-+ * to
-+ move.l d0,a1
-+ .L6:
-+ move.b (a1)+,d1
-+ move.b d1,(a0)+
-+ cmp.b #0, d1
-+ jne .L6
-+ *
-+ */
-+static int
-+propagate_moves ()
-+{
-+ rtx_insn *insn, *next;
-+ rtx_insn * current_label = 0;
-+ int change_count = 0;
-+ std
-+ ::vector<rtx_insn *> reg_reg;
-+
-+ for (insn = get_insns (); insn; insn = next)
-+ {
-+ next = NEXT_INSN (insn);
-+
-+ if (DEBUG_INSN_P(insn))
-+ continue;
-+
-+ if (LABEL_P(insn))
-+ {
-+ if (LABEL_NUSES(insn) == 1)
-+ {
-+ current_label = insn;
-+ reg_reg.clear ();
-+ }
-+ else
-+ current_label = 0;
-+ }
-+
-+ if (current_label == 0)
-+ continue;
-+
-+ if (NONJUMP_INSN_P(insn))
-+ {
-+ // check for set reg, reg
-+ rtx set = single_set (insn);
-+ if (set)
-+ {
-+ rtx src = SET_SRC(set);
-+ rtx dst = SET_DEST(set);
-+ if (REG_P(src) && REG_P(dst))
-+ reg_reg.push_back (insn);
-+ }
-+ continue;
-+ }
-+
-+ if (JUMP_P(insn))
-+ {
-+ if (JUMP_LABEL (insn) == current_label && reg_reg.size () > 1)
-+ {
-+ /* Search for reg/reg pairs. */
-+ for (auto i = reg_reg.begin ();
-+ i != reg_reg.end () && i + 1 != reg_reg.end ();)
-+ {
-+ bool inc = true;
-+ for (auto j = i + 1; j != reg_reg.end ();)
-+ {
-+ rtx seti = single_set (*i);
-+ rtx srci = SET_SRC(seti);
-+ rtx dsti = SET_DEST(seti);
-+ rtx setj = single_set (*j);
-+ rtx srcj = SET_SRC(setj);
-+ rtx dstj = SET_DEST(setj);
-+
-+ if (rtx_equal_p (srci, dstj) && rtx_equal_p (srcj, dsti))
-+ {
-+ /* Ensure correct usage. */
-+ if (!reg_used_between_p (srci, current_label, *i)
-+ && !reg_used_between_p (srci, *i, *j)
-+ && !reg_used_between_p (srci, *j, insn)
-+ && !reg_used_between_p (dsti, current_label, *i)
-+ && !reg_used_between_p (dsti, *j, insn))
-+ {
-+ fprintf (stderr,
-+ "condition met, moving regs %d, %d\n",
-+ REGNO(srci), REGNO(dsti));
-+
-+ /* Move out of loop. */
-+ remove_insn (*i);
-+ if (PREV_INSN (current_label))
-+ add_insn_after (*i, PREV_INSN (current_label),
-+ 0);
-+ else
-+ add_insn_before (*i, current_label, 0);
-+
-+ remove_insn (*j);
-+ add_insn_after (*j, insn, 0);
-+
-+ reg_reg.erase (j);
-+ reg_reg.erase (i);
-+ j = reg_reg.end ();
-+ inc = false;
-+
-+ ++change_count;
-+ }
-+ }
-+ if (inc)
-+ ++j;
-+ }
-+ if (inc)
-+ ++i;
-+ }
-+ }
-+ current_label = 0;
-+ }
-+ }
-+
-+ return change_count;
-+}
-+
-+/**
-+ * Search for
-+ *
-+ * mov x,reg
-+ * mov reg,x
-+ * cmp #0, reg
-+ * jxx
-+ *
-+ * patterns.
-+ *
-+ * Use a simple state machine to find the patterns.
-+ */
-+static void
-+opt_strcpy ()
-+{
-+ rtx_insn *insn, *next;
-+ rtx_insn * x2reg = 0;
-+ rtx_insn * reg2x;
-+ unsigned int regno;
-+
-+ for (insn = get_insns (); insn; insn = next)
-+ {
-+ rtx src;
-+
-+ next = NEXT_INSN (insn);
-+
-+ if (NONJUMP_INSN_P(insn))
-+ {
-+ rtx set = single_set (insn);
-+ if (!set)
-+ continue;
-+
-+ if (x2reg && reg2x)
-+ {
-+ src = SET_SRC(set);
-+ if (GET_CODE(src) == COMPARE)
-+ {
-+ rtx dst = XEXP(src, 0);
-+ src = XEXP(src, 1);
-+
-+ if (CONST_INT_P(src) && INTVAL(src) == 0
-+ && find_reg_note (insn, REG_DEAD, dst))
-+ {
-+ /* now check via NOTICE_UPDATE_CC*/
-+ NOTICE_UPDATE_CC (PATTERN (reg2x), reg2x);
-+ if (cc_status.flags == 0
-+ && rtx_equal_p (dst, cc_status.value2))
-+ {
-+ int num_clobbers_to_add = 0;
-+ int insn_code_number;
-+
-+ SET_SRC(single_set(reg2x)) = SET_SRC(
-+ single_set (x2reg));
-+ insn_code_number = recog (PATTERN (reg2x), reg2x,
-+ &num_clobbers_to_add);
-+
-+ if (insn_code_number < 0)
-+ {
-+ /* restore register. */
-+ SET_SRC(single_set(reg2x)) = SET_DEST(
-+ single_set (x2reg));
-+ }
-+ else
-+ {
-+
-+ rtx link;
-+
-+ fprintf (
-+ stderr,
-+ "condition met, removing compare and joining insns - omit reg %d\n",
-+ REGNO(dst));
-+
-+ for (link = REG_NOTES(x2reg); link;
-+ link = XEXP(link, 1))
-+ if (REG_NOTE_KIND (link) != REG_LABEL_OPERAND)
-+ {
-+ if (GET_CODE (link) == EXPR_LIST)
-+ add_reg_note (
-+ reg2x, REG_NOTE_KIND(link),
-+ copy_insn_1 (XEXP(link, 0)));
-+ else
-+ add_shallow_copy_of_reg_note (reg2x,
-+ link);
-+ }
-+
-+ SET_INSN_DELETED(x2reg);
-+ SET_INSN_DELETED(insn);
-+
-+ df_insn_rescan (reg2x);
-+
-+ }
-+ }
-+ }
-+ x2reg = 0;
-+ continue;
-+ }
-+ reg2x = 0;
-+ }
-+
-+ /* check for reg2x first, maybe fallback to x2reg. */
-+ if (x2reg && reg2x == 0)
-+ {
-+ if (REG_P(SET_SRC(set)) && REGNO(SET_SRC(set)) == regno)
-+ {
-+ reg2x = insn;
-+ continue;
-+ }
-+ x2reg = 0;
-+ }
-+
-+ /* check for a match for x2reg. */
-+ if (x2reg == 0)
-+ {
-+ if (REG_P(SET_DEST(set)))
-+ {
-+ x2reg = insn;
-+ reg2x = 0;
-+ regno = REGNO(SET_DEST(set));
-+ }
-+ }
-+ }
-+ }
-+}
-+
-+/* Main entry point to the pass. */
-+
-+static unsigned int
-+execute_bbb_optimizations (void)
-+{
-+ df_set_flags (DF_LR_RUN_DCE + DF_DEFER_INSN_RESCAN);
-+ df_note_add_problem ();
-+ df_analyze ();
-+
-+// dump_insns ("bbb 0");
-+
-+ propagate_moves ();
-+
-+ opt_strcpy ();
-+
-+ dump_insns ("bbb 1");
-+
-+ return 0;
-+}
-+
-+namespace
-+ {
-+
-+ const pass_data pass_data_bbb_optimizations =
-+ {
-+ RTL_PASS, /* type */
-+ "bbb", /* name */
-+ OPTGROUP_NONE, /* optinfo_flags */
-+ TV_NONE, /* tv_id */
-+ 0, /* properties_required */
-+ 0, /* properties_provided */
-+ 0, /* properties_destroyed */
-+ 0, /* todo_flags_start */
-+ ( TODO_df_finish | TODO_df_verify ), /* todo_flags_finish */
-+ };
-+
-+ class pass_bbb_optimizations : public rtl_opt_pass
-+ {
-+ public:
-+ pass_bbb_optimizations (gcc::context *ctxt)
-+ : rtl_opt_pass (pass_data_bbb_optimizations, ctxt)
-+ {}
-+
-+ /* opt_pass methods: */
-+ virtual bool gate (function *)
-+ {
-+ return true;
-+ }
-+
-+ virtual unsigned int execute (function *)
-+ {
-+ return execute_bbb_optimizations ();
-+ }
-+
-+ }; // class pass_bbb_optimizations
-+
-+ } // anon namespace
-+
-+rtl_opt_pass *
-+make_pass_bbb_optimizations (gcc::context *ctxt)
-+ {
-+ return new pass_bbb_optimizations (ctxt);
-+ }
-diff --git a/gcc/passes.c b/gcc/passes.c
-index e89618111245..321adbc61e2d 100644
---- gcc/passes.c
-+++ gcc/passes.c
-@@ -2269,6 +2269,31 @@ override_gate_status (opt_pass *pass, tree func, bool gate_status)
- }
-
-
-+void dump_insns(char const * name)
-+{
-+ rtx_insn *insn, *next;
-+ fprintf(stderr, "====================================\npass: %s\n", name);
-+ for (insn = get_insns(); insn; insn = next)
-+ {
-+ next = NEXT_INSN(insn);
-+ debug_rtx(insn);
-+#if 0
-+ if (NONJUMP_INSN_P (insn))
-+ {
-+ rtx x, y, set= single_set (insn);
-+ if (!set)
-+ continue;
-+ x = y = SET_SRC(set);
-+
-+ while (GET_CODE(y) == CONST || GET_CODE(y) == PLUS)
-+ y = XEXP(y, 0);
-+ if (x != y && REG_P(y) && REGNO(y) == PIC_REG)
-+ debug_rtx(insn);
-+ }
-+#endif
-+ }
-+}
-+
- /* Execute PASS. */
-
- bool
-@@ -2278,6 +2303,8 @@ execute_one_pass (opt_pass *pass)
-
- bool gate_status;
-
-+// dump_insns(pass->name);
-+
- /* IPA passes are executed on whole program, so cfun should be NULL.
- Other passes need function context set. */
- if (pass->type == SIMPLE_IPA_PASS || pass->type == IPA_PASS)
-diff --git a/gcc/passes.def b/gcc/passes.def
-index ec796082ae7f..45ff86c383e4 100644
---- gcc/passes.def
-+++ gcc/passes.def
-@@ -446,6 +446,7 @@ along with GCC; see the file COPYING3. If not see
- NEXT_PASS (pass_split_after_reload);
- NEXT_PASS (pass_ree);
- NEXT_PASS (pass_compare_elim_after_reload);
-+ NEXT_PASS (pass_bbb_optimizations);
- NEXT_PASS (pass_branch_target_load_optimize1);
- NEXT_PASS (pass_jump2);
- NEXT_PASS (pass_duplicate_computed_gotos);
-diff --git a/gcc/regrename.c b/gcc/regrename.c
-old mode 100644
-new mode 100755
-index 2dd96db5b87f..4ba825e8d8e8
---- gcc/regrename.c
-+++ gcc/regrename.c
-@@ -358,6 +358,7 @@ find_rename_reg (du_head_p this_head, enum reg_class super_class,
- enum reg_class preferred_class;
- int best_new_reg = old_reg;
- int new_reg;
-+ int hit = 0;
-
- /* Further narrow the set of registers we can use for renaming.
- If the chain needs a call-saved register, mark the call-used
-@@ -404,9 +405,11 @@ find_rename_reg (du_head_p this_head, enum reg_class super_class,
- don't belong to PREFERRED_CLASS to registers that do, even
- though the latters were used not very long ago.
- Also use a register if no best_new_reg was found till now */
-- if ((tick[best_new_reg] > tick[new_reg]
-- || (old_reg == best_new_reg && new_reg < old_reg)))
-- best_new_reg = new_reg;
-+ if (new_reg < old_reg || !hit)
-+ {
-+ hit = 1;
-+ best_new_reg = new_reg;
-+ }
- }
- return best_new_reg;
- }
-diff --git a/gcc/tree-pass.h b/gcc/tree-pass.h
-index 5f5055d3a6c1..b3f66ad529b9 100644
---- gcc/tree-pass.h
-+++ gcc/tree-pass.h
-@@ -590,6 +590,7 @@ extern rtl_opt_pass *make_pass_branch_target_load_optimize2 (gcc::context
- *ctxt);
- extern rtl_opt_pass *make_pass_leaf_regs (gcc::context *ctxt);
- extern rtl_opt_pass *make_pass_split_before_sched2 (gcc::context *ctxt);
-+extern rtl_opt_pass *make_pass_bbb_optimizations (gcc::context *ctxt);
- extern rtl_opt_pass *make_pass_compare_elim_after_reload (gcc::context *ctxt);
- extern rtl_opt_pass *make_pass_sched2 (gcc::context *ctxt);
- extern rtl_opt_pass *make_pass_stack_regs (gcc::context *ctxt);
-
-From eb051946c1a720575b80bcd5cf8038710f1c27c1 Mon Sep 17 00:00:00 2001
-From: bebbo <bebbo(a)bejy.net>
-Date: Fri, 31 Mar 2017 11:19:56 +0200
-Subject: [PATCH 050/303] @B compiles again with other targets
-
----
- gcc/bbb-opts.c | 205 ++++++++++++++++++++++++++++++++++-----------------------
- gcc/except.c | 1 +
- 2 files changed, 124 insertions(+), 82 deletions(-)
-
-diff --git a/gcc/bbb-opts.c b/gcc/bbb-opts.c
-index ff447c9e335e..aeec7a8b4e6a 100755
---- gcc/bbb-opts.c
-+++ gcc/bbb-opts.c
-@@ -107,11 +107,10 @@ dump_insns (char const * name);
- static int
- propagate_moves ()
- {
-+ int change_count = 0;
- rtx_insn *insn, *next;
- rtx_insn * current_label = 0;
-- int change_count = 0;
-- std
-- ::vector<rtx_insn *> reg_reg;
-+ std::vector<rtx_insn *> reg_reg;
-
- for (insn = get_insns (); insn; insn = next)
- {
-@@ -153,11 +152,11 @@ propagate_moves ()
- if (JUMP_LABEL (insn) == current_label && reg_reg.size () > 1)
- {
- /* Search for reg/reg pairs. */
-- for (auto i = reg_reg.begin ();
-+ for (std::vector<rtx_insn *>::iterator i = reg_reg.begin ();
- i != reg_reg.end () && i + 1 != reg_reg.end ();)
- {
- bool inc = true;
-- for (auto j = i + 1; j != reg_reg.end ();)
-+ for (std::vector<rtx_insn *>::iterator j = i + 1; j != reg_reg.end ();)
- {
- rtx seti = single_set (*i);
- rtx srci = SET_SRC(seti);
-@@ -208,7 +207,6 @@ propagate_moves ()
- current_label = 0;
- }
- }
--
- return change_count;
- }
-
-@@ -224,9 +222,11 @@ propagate_moves ()
- *
- * Use a simple state machine to find the patterns.
- */
--static void
-+static int
- opt_strcpy ()
- {
-+ int change_count = 0;
-+#if HAVE_cc0
- rtx_insn *insn, *next;
- rtx_insn * x2reg = 0;
- rtx_insn * reg2x;
-@@ -234,106 +234,145 @@ opt_strcpy ()
-
- for (insn = get_insns (); insn; insn = next)
- {
-- rtx src;
--
- next = NEXT_INSN (insn);
-
-- if (NONJUMP_INSN_P(insn))
-- {
-- rtx set = single_set (insn);
-- if (!set)
-- continue;
-+ if (!NONJUMP_INSN_P(insn))
-+ continue;
-+
-+ rtx set = single_set (insn);
-+ if (!set)
-+ continue;
-
-- if (x2reg && reg2x)
-+ if (x2reg && reg2x)
-+ {
-+ rtx src = SET_SRC(set);
-+ if (GET_CODE(src) == COMPARE)
- {
-- src = SET_SRC(set);
-- if (GET_CODE(src) == COMPARE)
-- {
-- rtx dst = XEXP(src, 0);
-- src = XEXP(src, 1);
-+ rtx dst = XEXP(src, 0);
-+ src = XEXP(src, 1);
-
-- if (CONST_INT_P(src) && INTVAL(src) == 0
-- && find_reg_note (insn, REG_DEAD, dst))
-+ if (CONST_INT_P(src) && INTVAL(src) == 0
-+ && find_reg_note (insn, REG_DEAD, dst))
-+ {
-+ /* now check via NOTICE_UPDATE_CC*/
-+ NOTICE_UPDATE_CC (PATTERN (reg2x), reg2x);
-+ if (cc_status.flags == 0
-+ && rtx_equal_p (dst, cc_status.value2))
- {
-- /* now check via NOTICE_UPDATE_CC*/
-- NOTICE_UPDATE_CC (PATTERN (reg2x), reg2x);
-- if (cc_status.flags == 0
-- && rtx_equal_p (dst, cc_status.value2))
-- {
-- int num_clobbers_to_add = 0;
-- int insn_code_number;
-+ int num_clobbers_to_add = 0;
-+ int insn_code_number;
-
-- SET_SRC(single_set(reg2x)) = SET_SRC(
-- single_set (x2reg));
-- insn_code_number = recog (PATTERN (reg2x), reg2x,
-- &num_clobbers_to_add);
-+ SET_SRC(single_set(reg2x)) = SET_SRC(single_set (x2reg));
-+ insn_code_number = recog (PATTERN (reg2x), reg2x,
-+ &num_clobbers_to_add);
-
-- if (insn_code_number < 0)
-- {
-- /* restore register. */
-- SET_SRC(single_set(reg2x)) = SET_DEST(
-- single_set (x2reg));
-- }
-- else
-- {
-+ if (insn_code_number < 0)
-+ {
-+ /* restore register. */
-+ SET_SRC(single_set(reg2x)) = SET_DEST(
-+ single_set (x2reg));
-+ }
-+ else
-+ {
-
-- rtx link;
-+ rtx link;
-
-- fprintf (
-- stderr,
-- "condition met, removing compare and joining insns - omit reg %d\n",
-- REGNO(dst));
-+ fprintf (
-+ stderr,
-+ "condition met, removing compare and joining insns - omit reg %d\n",
-+ REGNO(dst));
-
-- for (link = REG_NOTES(x2reg); link;
-- link = XEXP(link, 1))
-- if (REG_NOTE_KIND (link) != REG_LABEL_OPERAND)
-- {
-- if (GET_CODE (link) == EXPR_LIST)
-- add_reg_note (
-- reg2x, REG_NOTE_KIND(link),
-- copy_insn_1 (XEXP(link, 0)));
-- else
-- add_shallow_copy_of_reg_note (reg2x,
-- link);
-- }
-+ for (link = REG_NOTES(x2reg); link;
-+ link = XEXP(link, 1))
-+ if (REG_NOTE_KIND (link) != REG_LABEL_OPERAND)
-+ {
-+ if (GET_CODE (link) == EXPR_LIST)
-+ add_reg_note (reg2x, REG_NOTE_KIND(link),
-+ copy_insn_1 (XEXP(link, 0)));
-+ else
-+ add_shallow_copy_of_reg_note (reg2x, link);
-+ }
-
-- SET_INSN_DELETED(x2reg);
-- SET_INSN_DELETED(insn);
-+ SET_INSN_DELETED(x2reg);
-+ SET_INSN_DELETED(insn);
-
-- df_insn_rescan (reg2x);
-+ df_insn_rescan (reg2x);
-
-- }
-+ ++change_count;
- }
- }
-- x2reg = 0;
-- continue;
- }
-- reg2x = 0;
-+ x2reg = 0;
-+ continue;
- }
-+ reg2x = 0;
-+ }
-
-- /* check for reg2x first, maybe fallback to x2reg. */
-- if (x2reg && reg2x == 0)
-+ /* check for reg2x first, maybe fallback to x2reg. */
-+ if (x2reg && reg2x == 0)
-+ {
-+ if (REG_P(SET_SRC(set)) && REGNO(SET_SRC(set)) == regno)
- {
-- if (REG_P(SET_SRC(set)) && REGNO(SET_SRC(set)) == regno)
-- {
-- reg2x = insn;
-- continue;
-- }
-- x2reg = 0;
-+ reg2x = insn;
-+ continue;
- }
-+ x2reg = 0;
-+ }
-
-- /* check for a match for x2reg. */
-- if (x2reg == 0)
-+ /* check for a match for x2reg. */
-+ if (x2reg == 0)
-+ {
-+ if (REG_P(SET_DEST(set)))
- {
-- if (REG_P(SET_DEST(set)))
-- {
-- x2reg = insn;
-- reg2x = 0;
-- regno = REGNO(SET_DEST(set));
-- }
-+ x2reg = insn;
-+ reg2x = 0;
-+ regno = REGNO(SET_DEST(set));
- }
- }
- }
-+#endif
-+ return change_count;
-+}
-+
-+/*
-+ * Convert loops using a counting reg as offset with an address reg
-+ * into a loop with auto inc address regs.
-+ */
-+static int
-+offset_2_autoinc (void)
-+{
-+ rtx_insn *insn, *next;
-+ rtx_insn * reg_const = 0;
-+ int change_count = 0;
-+
-+ for (insn = get_insns (); insn; insn = next)
-+ {
-+ next = NEXT_INSN (insn);
-+
-+ if (!next || !LABEL_P(next) || LABEL_NUSES(next) != 1)
-+ continue;
-+
-+ if (!NONJUMP_INSN_P(insn))
-+ continue;
-+
-+ rtx set = single_set (insn);
-+ if (!set)
-+ continue;
-+
-+ rtx reg = SET_DEST(set);
-+ if (!REG_P(reg))
-+ continue;
-+
-+ rtx val = SET_SRC(set);
-+
-+
-+// fprintf(stderr, "possible start for offset_2_autoinc\n");
-+// debug_rtx(insn);
-+// debug_rtx(next);
-+
-+ }
-+
-+ return change_count;
- }
-
- /* Main entry point to the pass. */
-@@ -349,9 +388,11 @@ execute_bbb_optimizations (void)
-
- propagate_moves ();
-
-+ offset_2_autoinc ();
-+
- opt_strcpy ();
-
-- dump_insns ("bbb 1");
-+// dump_insns ("bbb 1");
-
- return 0;
- }
-diff --git a/gcc/except.c b/gcc/except.c
-index 156d7b76d249..194478f8454c 100644
---- gcc/except.c
-+++ gcc/except.c
-@@ -142,6 +142,7 @@ along with GCC; see the file COPYING3. If not see
- #include "cfgloop.h"
- #include "builtins.h"
- #include "tree-hash-traits.h"
-+#include "target-def.h"
-
- static GTY(()) int call_site_base;
-
-
-From 73b869461936fd68a37b9edc8f0e4eba48d5c440 Mon Sep 17 00:00:00 2001
-From: bebbo <bebbo(a)bejy.net>
-Date: Wed, 5 Apr 2017 16:03:47 +0200
-Subject: [PATCH 051/303] @R use a5 instead of fp
-
----
- gcc/config/m68k/amigaos.h | 6 +-----
- 1 file changed, 1 insertion(+), 5 deletions(-)
-
-diff --git a/gcc/config/m68k/amigaos.h b/gcc/config/m68k/amigaos.h
-index 7259611edc9e..ce47723e962f 100644
---- gcc/config/m68k/amigaos.h
-+++ gcc/config/m68k/amigaos.h
-@@ -153,11 +153,7 @@ amiga_named_section (const char *name, unsigned int flags, tree decl);
- #define FRAME_POINTER_REGNUM 13
-
- #undef M68K_REGNAME
--#define M68K_REGNAME(r) ( \
-- ( ((r) == FRAME_POINTER_REGNUM) \
-- && frame_pointer_needed) ? \
-- M68K_FP_REG_NAME : reg_names[(r)])
--
-+#define M68K_REGNAME(r) (reg_names[(r)])
-
- /* The AmigaOS ABI does not define how structures should be returned, so,
- contrary to 'm68k.h', we prefer a multithread-safe solution. */
-
-From 626d238b27f86a4369aeb13ad11153accd414f90 Mon Sep 17 00:00:00 2001
-From: bebbo <bebbo(a)bejy.net>
-Date: Wed, 5 Apr 2017 16:06:55 +0200
-Subject: [PATCH 052/303] @R make MEM_P more expensive than REG_P
-
----
- gcc/config/m68k/m68k.c | 30 ++++++++++++++++++++++++++++++
- 1 file changed, 30 insertions(+)
-
-diff --git a/gcc/config/m68k/m68k.c b/gcc/config/m68k/m68k.c
-index d60371a92bc6..6c0d9211598d 100644
---- gcc/config/m68k/m68k.c
-+++ gcc/config/m68k/m68k.c
-@@ -2928,6 +2928,17 @@ m68k_rtx_costs (rtx x, machine_mode mode, int outer_code,
- *total = COSTS_N_INSNS (TARGET_COLDFIRE ? 2 : 3);
- return true;
- }
-+ /* reg + value */
-+// if (mode == SImode
-+// && REG_P(XEXP(x, 0))) {
-+// if (m68k_rtx_costs(XEXP(x, 1), mode, PLUS, 1, total, speed))
-+// {
-+// if (REGNO_REG_CLASS(REGNO(XEXP(x, 0))) == ADDR_REGS)
-+// *total += 4;
-+// return true;
-+// }
-+// }
-+
- return false;
-
- case ASHIFT:
-@@ -2996,6 +3007,25 @@ m68k_rtx_costs (rtx x, machine_mode mode, int outer_code,
- *total = 0;
- return false;
-
-+ case MEM:
-+ {
-+ /* simple but not exact */
-+ rtx y = XEXP(x, 0);
-+ int yc = GET_CODE(y);
-+ if (yc == REG || yc == PRE_INC || yc == POST_INC || yc == POST_DEC)
-+ *total += 4;
-+ else
-+ if (yc == PRE_DEC)
-+ *total += 6;
-+ else
-+ *total += 8;
-+
-+ if (mode != QImode && mode != QImode)
-+ *total += 4;
-+
-+ return true;
-+ }
-+
- default:
- return false;
- }
-
-From 9c9c8b4c31a9ed000a27ff22245ad21b7ad21e67 Mon Sep 17 00:00:00 2001
-From: bebbo <bebbo(a)bejy.net>
-Date: Wed, 5 Apr 2017 16:08:30 +0200
-Subject: [PATCH 053/303] @R added reg life analysis to own optimizer
-
----
- gcc/bbb-opts.c | 793 ++++++++++++++++++++++++++++++++++++++++++++++++---------
- gcc/passes.def | 1 +
- 2 files changed, 672 insertions(+), 122 deletions(-)
-
-diff --git a/gcc/bbb-opts.c b/gcc/bbb-opts.c
-index aeec7a8b4e6a..7fd01139d0f3 100755
---- gcc/bbb-opts.c
-+++ gcc/bbb-opts.c
-@@ -25,11 +25,16 @@
- * #1 propagate_moves
- * check if a->b->a can be moved out of a loop.
- *
-- * #2 strcpy
-+ * #2 strcpy_opt
- * move a,reg
- * move reg,b
- * cmp #0,reg
-- * jne/jeq
-+ * jcc
-+ *
-+ * ->
-+ * move a,b
-+ * jcc
-+ *
- */
-
- #include "config.h"
-@@ -49,8 +54,285 @@
- #include <vector>
- #include <map>
-
--extern void
--dump_insns (char const * name);
-+/* enough for m68k. */
-+typedef unsigned insn_info; //[(FIRST_PSEUDO_REGISTER + sizeof(unsigned) * 8 - 1) / (sizeof(unsigned) * 8)];
-+
-+static inline void
-+resetii (unsigned & ii)
-+{
-+ ii = 0;
-+}
-+
-+static inline void
-+setii (unsigned regno, unsigned & ii)
-+{
-+ ii |= 1 << regno;
-+}
-+
-+static inline void
-+clearii (unsigned regno, unsigned & ii)
-+{
-+ ii &= ~(1 << regno);
-+}
-+
-+static inline bool
-+getii (unsigned regno, unsigned & ii)
-+{
-+ return ii & (1 << regno) ? true : false;
-+}
-+
-+/* scan rtx for registers. */
-+static void
-+scanii (rtx x, unsigned & ii)
-+{
-+ if (REG_P(x))
-+ {
-+ setii (REGNO(x), ii);
-+ return;
-+ }
-+
-+ RTX_CODE code = GET_CODE(x);
-+ const char *fmt = GET_RTX_FORMAT(code);
-+ for (int i = GET_RTX_LENGTH (code) - 1; i >= 0; i--)
-+ {
-+ if (fmt[i] == 'e')
-+ scanii (XEXP(x, i), ii);
-+ else if (fmt[i] == 'E')
-+ for (int j = XVECLEN (x, i) - 1; j >= 0; j--)
-+ scanii (XVECEXP(x, i, j), ii);
-+ }
-+}
-+
-+static std::vector<rtx_insn *> insns;
-+static std::vector<rtx_insn *> jumps;
-+static std::map<rtx_insn *, unsigned> insn2index;
-+static std::vector<insn_info> infos;
-+
-+static void
-+clear (void)
-+{
-+ insns.clear ();
-+ jumps.clear ();
-+ insn2index.clear ();
-+ infos.clear ();
-+}
-+
-+static void
-+dump_costs (void)
-+{
-+ rtx d0 = gen_raw_REG (SImode, 0);
-+ rtx d0b = gen_raw_REG (QImode, 0);
-+ rtx d1 = gen_raw_REG (SImode, 1);
-+ rtx d1b = gen_raw_REG (QImode, 1);
-+ rtx a0 = gen_raw_REG (SImode, 8);
-+ rtx a1 = gen_raw_REG (SImode, 9);
-+
-+ struct ICO
-+ {
-+ char const * name;
-+ rtx set;
-+ } data[] =
-+ {
-+ { "move d0,(a0)", gen_rtx_SET(gen_rtx_MEM (SImode, a0), d0) },
-+ { "move a0,d0", gen_rtx_SET(d0, a0) },
-+ { "move (a0),d0", gen_rtx_SET(d0, gen_rtx_MEM (SImode, a0)) },
-+ { "move d0,(a0)", gen_rtx_SET(gen_rtx_MEM (SImode, a0), d0) },
-+ { "move d1,(a1)+", gen_rtx_SET(d1, gen_rtx_MEM (SImode, gen_rtx_POST_INC (SImode, a1))) },
-+ { "move (a0),(a1)", gen_rtx_SET(gen_rtx_MEM (SImode, a1), gen_rtx_MEM (SImode, a0)) },
-+ { 0, 0 } }, *p;
-+
-+ for (p = data; p->name; ++p)
-+ {
-+ int cost = insn_rtx_cost (p->set, true);
-+ fprintf (stderr, "%s: %d\n", p->name, cost);
-+ }
-+}
-+
-+
-+static void
-+dump_insns (char const * name)
-+{
-+ rtx_insn *insn, *next;
-+ fprintf(stderr, "====================================: %s\n", name);
-+ for (unsigned i = 0; i < insns.size(); ++i)
-+ {
-+ insn_info & ii = infos[i];
-+
-+ for (int j = 0; j < 8; ++j)
-+ if (getii(j, ii))
-+ fprintf(stderr, "d%d ", j);
-+
-+ for (int j = 8; j < 16; ++j)
-+ if (getii(j, ii))
-+ fprintf(stderr, "a%d ", j-8);
-+
-+ fprintf(stderr, "\t");
-+ debug_rtx(insns[i]);
-+ }
-+}
-+
-+
-+/*
-+ * Create a filtered view of insns - keep only those to work with.
-+ */
-+static void
-+filter_insns ()
-+{
-+ rtx_insn *insn, *next;
-+ clear ();
-+
-+ df_insn_rescan_all ();
-+
-+ /* create a vector with relevant insn. */
-+ for (insn = get_insns (); insn; insn = next)
-+ {
-+ next = NEXT_INSN (insn);
-+
-+ if (NONJUMP_INSN_P (insn) || LABEL_P(insn) || JUMP_P(insn) || CALL_P(insn))
-+ {
-+ // debug_rtx (insn);
-+ if (JUMP_P(insn))
-+ jumps.push_back(insn);
-+
-+ insn2index.insert (std::make_pair (insn, insns.size ()));
-+ insns.push_back (insn);
-+ }
-+ }
-+
-+ /* prepare insn_info */
-+ insn_info ii;
-+ resetii (ii);
-+ for (unsigned i = 0; i < insns.size (); ++i)
-+ {
-+ infos.push_back (ii);
-+ }
-+
-+ /* own analyze life */
-+ std::vector<std::pair<unsigned, insn_info>> todo;
-+ todo.push_back (std::make_pair (insns.size () - 1, ii));
-+
-+ int pass = 0;
-+ while (!todo.empty ())
-+ {
-+ std::pair<unsigned, insn_info> p = *todo.rbegin ();
-+ todo.pop_back ();
-+
-+ insn_info ii = p.second;
-+
-+ for (int pos = p.first; pos >= 0; --pos)
-+ {
-+ rtx_insn * insn = insns[pos];
-+
-+ if (pass && ii == infos[pos])
-+ break;
-+
-+ ii |= infos[pos];
-+
-+ if (LABEL_P(insn))
-+ {
-+ /* work on all jumps referring to that label. */
-+ for (std::vector<rtx_insn *>::iterator i = jumps.begin (); i != jumps.end (); ++i)
-+ {
-+ if (JUMP_LABEL(*i) == insn)
-+ {
-+ std::map<rtx_insn *, unsigned>::iterator j = insn2index.find (*i);
-+ if (j != insn2index.end())
-+ todo.push_back (std::make_pair (j->second, ii));
-+ }
-+ }
-+ continue;
-+ }
-+
-+ rtx set = single_set (insn);
-+ if (set == 0)
-+ {
-+ if (JUMP_P(insn)) {
-+ resetii(ii);
-+ setii(0, ii);
-+ infos[pos] = ii;
-+ continue;
-+ }
-+ fprintf(stderr, "##### ");
-+ debug_rtx(insn);
-+ continue;
-+ }
-+
-+ rtx src = SET_SRC(set);
-+ rtx dst = SET_DEST(set);
-+
-+ debug_rtx(insn);
-+
-+ if (CALL_P(insn))
-+ {
-+ /* a call sets d0 and kills d1,a0,a1. */
-+ if (getii (1, ii))
-+ fprintf (stderr, "d1 used after call\n");
-+ if (getii (8, ii))
-+ fprintf (stderr, "a0 used after call\n");
-+ if (getii (9, ii))
-+ fprintf (stderr, "a1 used after call\n");
-+
-+ resetii (ii);
-+ // use regs depending on flag mregparm
-+ for (int i = 0; i < amigaos_regparm; ++i)
-+ {
-+ setii (i, ii);
-+ setii (i + 8, ii);
-+ }
-+
-+ // check for reg use
-+ if (REG_P(src))
-+ setii (REGNO(src), ii);
-+
-+ infos[pos] = ii;
-+ continue;
-+ }
-+
-+ if (JUMP_P(insn))
-+ {
-+ if (ANY_RETURN_P(src))
-+ {
-+ resetii (ii);
-+ setii (0, ii);
-+ }
-+ else
-+ {
-+ ii |= infos[pos];
-+
-+ // check for reg use
-+ if (REG_P(src))
-+ setii (REGNO(src), ii);
-+
-+ }
-+ infos[pos] = ii;
-+ continue;
-+ }
-+
-+ // scan insn for regs
-+ // a def stop propagation
-+ // a use starts propagation
-+ // also add use to current ii
-+ insn_info use;
-+ resetii (use);
-+
-+ insn_info def;
-+ resetii (def);
-+
-+ scanii (src, use);
-+ if (REG_P(dst))
-+ setii (REGNO(dst), def);
-+ else
-+ scanii (dst, use);
-+
-+ infos[pos] = use | ii;
-+
-+ ii &= ~def;
-+ ii |= use;
-+ }
-+ ++pass;
-+ }
-+
-+}
-
- /*
- * #1 propagate a->b->a moves out of a loop.
-@@ -102,29 +384,34 @@ dump_insns (char const * name);
- move.b d1,(a0)+
- cmp.b #0, d1
- jne .L6
-+
- *
-+ * Also allow exit jumps, if the modification of the reg is const
-+ * and insert a correction after the exit label.
-+ * The label must only be reachable by the exit jump.
- */
--static int
-+static unsigned
- propagate_moves ()
- {
-- int change_count = 0;
-- rtx_insn *insn, *next;
-+ unsigned change_count = 0;
- rtx_insn * current_label = 0;
-- std::vector<rtx_insn *> reg_reg;
-+ unsigned current_label_index;
-+ std::vector<unsigned> reg_reg;
-+ std::vector<rtx_insn *> jump_out;
-
-- for (insn = get_insns (); insn; insn = next)
-+ /* start at 1 since there must be an insn before the label. */
-+ for (unsigned index = 1; index < insns.size (); ++index)
- {
-- next = NEXT_INSN (insn);
--
-- if (DEBUG_INSN_P(insn))
-- continue;
-+ rtx_insn * insn = insns[index];
-
- if (LABEL_P(insn))
- {
- if (LABEL_NUSES(insn) == 1)
- {
- current_label = insn;
-+ current_label_index = index;
- reg_reg.clear ();
-+ jump_out.clear ();
- }
- else
- current_label = 0;
-@@ -142,59 +429,180 @@ propagate_moves ()
- rtx src = SET_SRC(set);
- rtx dst = SET_DEST(set);
- if (REG_P(src) && REG_P(dst))
-- reg_reg.push_back (insn);
-+ reg_reg.push_back (index);
- }
-+ else
-+ current_label = 0;
-+
- continue;
- }
-
- if (JUMP_P(insn))
- {
-- if (JUMP_LABEL (insn) == current_label && reg_reg.size () > 1)
-+ rtx_insn * label = (rtx_insn *) JUMP_LABEL(insn);
-+ if (label != current_label)
-+ {
-+ /* collect the labels for a later check if a fixup is possible. */
-+ if (LABEL_NUSES(label) == 1 && BARRIER_P(PREV_INSN (label)))
-+ jump_out.push_back (label);
-+ else
-+ current_label = 0;
-+ continue;
-+ }
-+
-+ if (reg_reg.size () > 1)
- {
- /* Search for reg/reg pairs. */
-- for (std::vector<rtx_insn *>::iterator i = reg_reg.begin ();
-- i != reg_reg.end () && i + 1 != reg_reg.end ();)
-+ for (std::vector<unsigned>::iterator i = reg_reg.begin (); i != reg_reg.end () && i + 1 != reg_reg.end ();
-+ )
- {
- bool inc = true;
-- for (std::vector<rtx_insn *>::iterator j = i + 1; j != reg_reg.end ();)
-+ for (std::vector<unsigned>::iterator j = i + 1; j != reg_reg.end ();)
- {
-- rtx seti = single_set (*i);
-+ rtx_insn * ii = insns[*i];
-+ rtx seti = single_set (ii);
- rtx srci = SET_SRC(seti);
- rtx dsti = SET_DEST(seti);
-- rtx setj = single_set (*j);
-+ rtx_insn * jj = insns[*j];
-+ rtx setj = single_set (jj);
- rtx srcj = SET_SRC(setj);
- rtx dstj = SET_DEST(setj);
-
- if (rtx_equal_p (srci, dstj) && rtx_equal_p (srcj, dsti))
- {
- /* Ensure correct usage. */
-- if (!reg_used_between_p (srci, current_label, *i)
-- && !reg_used_between_p (srci, *i, *j)
-- && !reg_used_between_p (srci, *j, insn)
-- && !reg_used_between_p (dsti, current_label, *i)
-- && !reg_used_between_p (dsti, *j, insn))
-+ if (!reg_used_between_p (srci, current_label, ii) && !reg_used_between_p (srci, ii, jj)
-+ && !reg_used_between_p (srci, jj, insn) && !reg_used_between_p (dsti, current_label, ii)
-+ && !reg_used_between_p (dsti, jj, insn))
- {
-- fprintf (stderr,
-- "condition met, moving regs %d, %d\n",
-- REGNO(srci), REGNO(dsti));
--
-- /* Move out of loop. */
-- remove_insn (*i);
-- if (PREV_INSN (current_label))
-- add_insn_after (*i, PREV_INSN (current_label),
-- 0);
-- else
-- add_insn_before (*i, current_label, 0);
--
-- remove_insn (*j);
-- add_insn_after (*j, insn, 0);
--
-- reg_reg.erase (j);
-- reg_reg.erase (i);
-- j = reg_reg.end ();
-- inc = false;
--
-- ++change_count;
-+ std::vector<int> fixups;
-+
-+ /* if there are jumps out of the loop,
-+ * check if the modification occurs before the jump,
-+ * and if, that it's a plus const.
-+ */
-+ if (jump_out.size ())
-+ {
-+ std::vector<rtx_insn *>::iterator label_iter = jump_out.begin ();
-+ int fixup = 0;
-+ fprintf (stderr, "need %d jump out fixups\n", jump_out.size ());
-+
-+ for (unsigned k = *i + 1; k != *j; ++k)
-+ {
-+ rtx_insn * check = insns[k];
-+ if (JUMP_P(check))
-+ {
-+ fixups.push_back (fixup);
-+ if (++label_iter == jump_out.end ())
-+ break;
-+ continue;
-+ }
-+
-+ if (reg_overlap_mentioned_p (dsti, PATTERN (check)))
-+ {
-+ /* right now only support auto_incs. */
-+ rtx set = single_set (check);
-+ rtx src = SET_SRC(set);
-+ rtx dst = SET_DEST(set);
-+
-+ if (reg_overlap_mentioned_p (dsti, dst))
-+ {
-+ if (REG_P(dst))
-+ break;
-+ if (!MEM_P(dst))
-+ break;
-+
-+ rtx x = XEXP(dst, 0);
-+ if (GET_CODE(x) == REG)
-+ fixup += 0; // direct use
-+ else if (GET_CODE(x) == PRE_INC ||
-+ GET_CODE(x) == POST_INC)
-+ fixup -= GET_MODE_SIZE(GET_MODE(dst));
-+ else if (GET_CODE(dst) == PRE_DEC ||
-+ GET_CODE(dst) == POST_DEC)
-+ fixup += GET_MODE_SIZE(GET_MODE(dst));
-+ else
-+ break;
-+ }
-+
-+ if (reg_overlap_mentioned_p (dsti, src))
-+ {
-+ if (REG_P(src))
-+ fixup += 0;
-+ else
-+ {
-+ if (!MEM_P(src))
-+ break;
-+
-+ rtx x = XEXP(src, 0);
-+ if (GET_CODE(x) == REG)
-+ fixup += 0; // direct use
-+ else if (GET_CODE(x) == PRE_INC ||
-+ GET_CODE(x) == POST_INC)
-+ fixup -= GET_MODE_SIZE(GET_MODE(dst));
-+ else if (GET_CODE(dst) == PRE_DEC ||
-+ GET_CODE(dst) == POST_DEC)
-+ fixup += GET_MODE_SIZE(GET_MODE(dst));
-+ else
-+ break;
-+ }
-+ }
-+ }
-+ }
-+ }
-+
-+ /* got a fixup for all jump_outs? */
-+ if (fixups.size () == jump_out.size ())
-+ {
-+ rtx_insn * before = insns[current_label_index - 1];
-+ rtx_insn * after = insns[index + 1];
-+ rtx bset = single_set (before);
-+
-+ fprintf (stderr, "condition met, moving regs %d, %d\n", REGNO(srci), REGNO(dsti));
-+
-+ /* Move in front of loop and mark as dead. */
-+ remove_insn (ii);
-+ add_insn_after (ii, before, 0);
-+ add_reg_note (ii, REG_DEAD, srci);
-+
-+ /* Plus check if the reg was just loaded. */
-+ if (bset)
-+ {
-+ rtx bdst = SET_DEST(bset);
-+ if (REG_P(bdst) && REGNO(bdst) == REGNO(srci))
-+ {
-+ SET_DEST(bset) = dsti;
-+ SET_INSN_DELETED(ii);
-+ }
-+ }
-+
-+ /* Move behind loop - into next BB. */
-+ remove_insn (jj);
-+ add_insn_before (jj, after, 0);
-+
-+ reg_reg.erase (j);
-+ reg_reg.erase (i);
-+ j = reg_reg.end ();
-+ inc = false;
-+
-+ df_insn_rescan (ii);
-+ df_insn_rescan (jj);
-+
-+ /* add fixes if there were jumps out of the loop. */
-+ if (jump_out.size ())
-+ {
-+ fprintf (stderr, "fixing %d jump outs\n", jump_out.size ());
-+
-+ for (unsigned k = 0; k < jump_out.size (); ++k)
-+ {
-+ rtx neu = gen_rtx_SET(
-+ dstj, gen_rtx_PLUS(Pmode, dsti, gen_rtx_CONST_INT(Pmode, fixups[k])));
-+ rtx_insn * neui = emit_insn_after (neu, jump_out[k]);
-+ df_insn_rescan (neui);
-+ }
-+ }
-+ ++change_count;
-+ }
- }
- }
- if (inc)
-@@ -222,19 +630,18 @@ propagate_moves ()
- *
- * Use a simple state machine to find the patterns.
- */
--static int
-+static unsigned
- opt_strcpy ()
- {
-- int change_count = 0;
-+ unsigned change_count = 0;
- #if HAVE_cc0
-- rtx_insn *insn, *next;
- rtx_insn * x2reg = 0;
- rtx_insn * reg2x;
- unsigned int regno;
-
-- for (insn = get_insns (); insn; insn = next)
-+ for (unsigned index = 0; index < insns.size (); ++index)
- {
-- next = NEXT_INSN (insn);
-+ rtx_insn * insn = insns[index];
-
- if (!NONJUMP_INSN_P(insn))
- continue;
-@@ -251,26 +658,22 @@ opt_strcpy ()
- rtx dst = XEXP(src, 0);
- src = XEXP(src, 1);
-
-- if (CONST_INT_P(src) && INTVAL(src) == 0
-- && find_reg_note (insn, REG_DEAD, dst))
-+ if (CONST_INT_P(src) && INTVAL(src) == 0 && find_reg_note (insn, REG_DEAD, dst))
- {
- /* now check via NOTICE_UPDATE_CC*/
-- NOTICE_UPDATE_CC (PATTERN (reg2x), reg2x);
-- if (cc_status.flags == 0
-- && rtx_equal_p (dst, cc_status.value2))
-+ NOTICE_UPDATE_CC(PATTERN (reg2x), reg2x);
-+ if (cc_status.flags == 0 && rtx_equal_p (dst, cc_status.value2))
- {
- int num_clobbers_to_add = 0;
- int insn_code_number;
-
- SET_SRC(single_set(reg2x)) = SET_SRC(single_set (x2reg));
-- insn_code_number = recog (PATTERN (reg2x), reg2x,
-- &num_clobbers_to_add);
-+ insn_code_number = recog (PATTERN (reg2x), reg2x, &num_clobbers_to_add);
-
- if (insn_code_number < 0)
- {
- /* restore register. */
-- SET_SRC(single_set(reg2x)) = SET_DEST(
-- single_set (x2reg));
-+ SET_SRC(single_set(reg2x)) = SET_DEST(single_set (x2reg));
- }
- else
- {
-@@ -278,17 +681,14 @@ opt_strcpy ()
- rtx link;
-
- fprintf (
-- stderr,
-- "condition met, removing compare and joining insns - omit reg %d\n",
-- REGNO(dst));
-+ stderr,
-+ "condition met, removing compare and joining insns - omit reg %d\n", REGNO(dst));
-
-- for (link = REG_NOTES(x2reg); link;
-- link = XEXP(link, 1))
-+ for (link = REG_NOTES(x2reg); link; link = XEXP(link, 1))
- if (REG_NOTE_KIND (link) != REG_LABEL_OPERAND)
- {
- if (GET_CODE (link) == EXPR_LIST)
-- add_reg_note (reg2x, REG_NOTE_KIND(link),
-- copy_insn_1 (XEXP(link, 0)));
-+ add_reg_note (reg2x, REG_NOTE_KIND(link), copy_insn_1 (XEXP(link, 0)));
- else
- add_shallow_copy_of_reg_note (reg2x, link);
- }
-@@ -338,45 +738,165 @@ opt_strcpy ()
- * Convert loops using a counting reg as offset with an address reg
- * into a loop with auto inc address regs.
- */
--static int
-+static unsigned
- offset_2_autoinc (void)
- {
-- rtx_insn *insn, *next;
-+ unsigned change_count = 0;
-+#if 0
- rtx_insn * reg_const = 0;
-- int change_count = 0;
-
-- for (insn = get_insns (); insn; insn = next)
-+ for (unsigned index = 0; index < insns.size (); ++index)
- {
-- next = NEXT_INSN (insn);
-+ rtx_insn * insn = insns[index];
-
- if (!next || !LABEL_P(next) || LABEL_NUSES(next) != 1)
-- continue;
-+ continue;
-
- if (!NONJUMP_INSN_P(insn))
-- continue;
-+ continue;
-
- rtx set = single_set (insn);
- if (!set)
-- continue;
-+ continue;
-
- rtx reg = SET_DEST(set);
- if (!REG_P(reg))
-- continue;
-+ continue;
-
- rtx val = SET_SRC(set);
-
--
- // fprintf(stderr, "possible start for offset_2_autoinc\n");
--// debug_rtx(insn);
--// debug_rtx(next);
-+// //debug_rtx(insn);
-+// //debug_rtx(next);
-
- }
-
-+#endif
- return change_count;
- }
-
--/* Main entry point to the pass. */
-+/*
-+ * convert
-+ *
-+ * set reg1, plus (reg2, const)
-+ * set mem(reg2), y
-+ *
-+ * ->
-+ * set reg1, reg2
-+ * set mem(reg1+), y
-+ *
-+ * if size of postinc == const
-+ *
-+ (insn 33 32 35 4 (set (reg/v/f:SI 8 a0 [orig:47 s ] [47])
-+ (plus:SI (reg/v/f:SI 9 a1 [orig:46 s ] [46])
-+ (const_int 1 [0x1]))) sn.c:5 141 {*addsi3_internal}
-+ (nil))
-+ (insn 36 35 37 4 (set (mem:QI (reg/v/f:SI 9 a1 [orig:46 s ] [46]) [0 MEM[base: s_17, offset: 4294967295B]+0 S1 A8])
-+ (mem:QI (post_inc:SI (reg/v/f:SI 10 a2 [orig:53 s2 ] [53])) [0 MEM[base: s2_19, offset: 4294967295B]+0 S1 A8])) sn.c:5 46 {*m68k.md:1083}
-+ (expr_list:REG_INC (reg/v/f:SI 10 a2 [orig:53 s2 ] [53])
-+ (nil)))
-+ */
-+static unsigned
-+commute_add_move (void)
-+{
-+ unsigned change_count = 0;
-+
-+ for (unsigned index = 0; index + 1 < insns.size (); ++index)
-+ {
-+ rtx_insn * insn = insns[index];
-+ rtx set = single_set (insn);
-+ if (!set)
-+ continue;
-+
-+ rtx reg1 = SET_DEST(set);
-+ if (!REG_P(reg1))
-+ continue;
-+
-+ rtx plus = SET_SRC(set);
-+ if (GET_CODE(plus) != PLUS)
-+ continue;
-+
-+ rtx reg2 = XEXP(plus, 0);
-+ if (!REG_P(reg2))
-+ continue;
-+
-+ rtx cnst = XEXP(plus, 1);
-+ if (!CONST_INT_P(cnst))
-+ continue;
-+
-+ rtx_insn * next = insns[index + 1];
-+ rtx set2 = single_set (next);
-+ if (!set2)
-+ continue;
-+
-+ rtx dst = SET_DEST(set2);
-+ if (!MEM_P(dst) || GET_MODE_SIZE(GET_MODE(dst)) != INTVAL(cnst))
-+ continue;
-+
-+ rtx memreg = XEXP(dst, 0);
-+ if (!REG_P(memreg) || REGNO(memreg) != REGNO(reg2))
-+ continue;
-
-+ int oldcost1 = insn_rtx_cost (set, true);
-+ int oldcost2 = insn_rtx_cost (set2, true);
-+
-+ fprintf (stderr, "commute_add_move found, oldcost: %d = %d + %d\n", oldcost1 + oldcost2, oldcost1, oldcost2);
-+
-+ //debug_rtx (insn);
-+ //debug_rtx (next);
-+
-+ rtx pinc = gen_rtx_POST_INC(GET_MODE(dst), reg1);
-+ rtx newmem = replace_equiv_address_nv (dst, pinc);
-+
-+ if (validate_change (next, &SET_DEST(set2), newmem, 0))
-+ {
-+ SET_INSN_DELETED(insn);
-+
-+ insn = emit_insn_before (gen_movsi (reg1, reg2), next);
-+
-+ add_reg_note (next, REG_INC, reg1);
-+
-+ int newcost1 = insn_rtx_cost (set, true);
-+ int newcost2 = insn_rtx_cost (set2, true);
-+
-+ fprintf (stderr, "commute_add_move found, newcost: %d = %d + %d\n", newcost1 + newcost2, newcost1, newcost2);
-+
-+ //debug_rtx (insn);
-+ //debug_rtx (next);
-+
-+ df_insn_rescan (insn);
-+ df_insn_rescan (next);
-+
-+ ++change_count;
-+ }
-+ }
-+ return change_count;
-+}
-+
-+static unsigned
-+const_cmp_to_sub (void)
-+{
-+ unsigned change_count = 0;
-+#if HAVE_cc0
-+ for (unsigned index = 0; index + 1 < insns.size (); ++index)
-+ {
-+ rtx_insn * insn = insns[index];
-+ rtx set = single_set (insn);
-+ if (!set)
-+ continue;
-+
-+ rtx dst = SET_DEST(set);
-+ if (dst != cc0_rtx)
-+ continue;
-+
-+ fprintf (stderr, "cc0:");
-+ debug_rtx (insn);
-+ }
-+#endif
-+ return change_count;
-+}
-+
-+/* Main entry point to the pass. */
- static unsigned int
- execute_bbb_optimizations (void)
- {
-@@ -385,58 +905,87 @@ execute_bbb_optimizations (void)
- df_analyze ();
-
- // dump_insns ("bbb 0");
-+ filter_insns ();
-+
-+ for (;;)
-+ {
-+ int done = 1;
-+ if (propagate_moves ())
-+ done = 0, filter_insns ();
-+
-+ if (offset_2_autoinc ())
-+ done = 0, filter_insns ();
-
-- propagate_moves ();
-+ if (opt_strcpy ())
-+ done = 0, filter_insns ();
-
-- offset_2_autoinc ();
-+ if (commute_add_move ())
-+ done = 0, filter_insns ();
-
-- opt_strcpy ();
-+ if (const_cmp_to_sub ())
-+ done = 0, filter_insns ();
-
--// dump_insns ("bbb 1");
-+ if (done)
-+ break;
-+ }
-+
-+ dump_insns ("bbb 1");
-+ clear ();
-+
-+ dump_costs ();
-
- return 0;
- }
-
- namespace
-+{
-+
-+ const pass_data pass_data_bbb_optimizations =
-+ { RTL_PASS, /* type */
-+ "bbb", /* name */
-+ OPTGROUP_NONE, /* optinfo_flags */
-+ TV_NONE, /* tv_id */
-+ 0, /* properties_required */
-+ 0, /* properties_provided */
-+ 0, /* properties_destroyed */
-+ 0, /* todo_flags_start */
-+ ( TODO_df_finish | TODO_df_verify), /* todo_flags_finish */
-+ };
-+
-+ class pass_bbb_optimizations : public rtl_opt_pass
- {
-+ public:
-+ pass_bbb_optimizations (gcc::context *ctxt) :
-+ rtl_opt_pass (pass_data_bbb_optimizations, ctxt)
-+ {
-+ }
-
-- const pass_data pass_data_bbb_optimizations =
-- {
-- RTL_PASS, /* type */
-- "bbb", /* name */
-- OPTGROUP_NONE, /* optinfo_flags */
-- TV_NONE, /* tv_id */
-- 0, /* properties_required */
-- 0, /* properties_provided */
-- 0, /* properties_destroyed */
-- 0, /* todo_flags_start */
-- ( TODO_df_finish | TODO_df_verify ), /* todo_flags_finish */
-- };
--
-- class pass_bbb_optimizations : public rtl_opt_pass
-- {
-- public:
-- pass_bbb_optimizations (gcc::context *ctxt)
-- : rtl_opt_pass (pass_data_bbb_optimizations, ctxt)
-- {}
--
-- /* opt_pass methods: */
-- virtual bool gate (function *)
-- {
-- return true;
-- }
--
-- virtual unsigned int execute (function *)
-- {
-- return execute_bbb_optimizations ();
-- }
--
-- }; // class pass_bbb_optimizations
--
-- } // anon namespace
-+ /* opt_pass methods: */
-+ virtual bool
-+ gate (function *)
-+ {
-+ return TARGET_AMIGA;
-+ }
-+
-+ virtual unsigned int
-+ execute (function *)
-+ {
-+ return execute_bbb_optimizations ();
-+ }
-+
-+ opt_pass *
-+ clone ()
-+ {
-+ return new pass_bbb_optimizations (m_ctxt);
-+ }
-+
-+ };
-+// class pass_bbb_optimizations
-+
-+}// anon namespace
-
- rtl_opt_pass *
--make_pass_bbb_optimizations (gcc::context *ctxt)
-- {
-- return new pass_bbb_optimizations (ctxt);
-- }
-+make_pass_bbb_optimizations (gcc::context * ctxt)
-+{
-+ return new pass_bbb_optimizations (ctxt);
-+}
-diff --git a/gcc/passes.def b/gcc/passes.def
-index 45ff86c383e4..ca5b94552d4e 100644
---- gcc/passes.def
-+++ gcc/passes.def
-@@ -460,6 +460,7 @@ along with GCC; see the file COPYING3. If not see
- NEXT_PASS (pass_stack_adjustments);
- NEXT_PASS (pass_fast_rtl_dce);
- NEXT_PASS (pass_reorder_blocks);
-+ NEXT_PASS (pass_bbb_optimizations);
- NEXT_PASS (pass_branch_target_load_optimize2);
- NEXT_PASS (pass_leaf_regs);
- NEXT_PASS (pass_split_before_sched2);
-
-From a56cbf57c5732afe7dfe0b67472284434ccfcbb2 Mon Sep 17 00:00:00 2001
-From: bebbo <bebbo(a)bejy.net>
-Date: Wed, 5 Apr 2017 22:54:53 +0200
-Subject: [PATCH 054/303] @B fix resident options, add -fbbb
-
----
- gcc/config/m68k/amigaos.h | 2 +-
- gcc/config/m68k/amigaos.opt | 10 +++++++---
- 2 files changed, 8 insertions(+), 4 deletions(-)
-
-diff --git a/gcc/config/m68k/amigaos.h b/gcc/config/m68k/amigaos.h
-index ce47723e962f..49dd90d745c3 100644
---- gcc/config/m68k/amigaos.h
-+++ gcc/config/m68k/amigaos.h
-@@ -454,7 +454,7 @@ extern tree amigaos_handle_type_attribute(tree *, tree, tree, int, bool*);
- #define SUBTARGET_OVERRIDE_OPTIONS \
- do \
- { \
-- if (!TARGET_68020 && flag_mybaserel==2) \
-+ if (!TARGET_68020 && flag_pic==4) \
- error ("-fbaserel32 is not supported on the 68000 or 68010\n"); \
- if (amigaos_regparm > 0 && amigaos_regparm > AMIGAOS_MAX_REGPARM) \
- error ("-mregparm=x with 1 <= x <= %d\n", AMIGAOS_MAX_REGPARM); \
-diff --git a/gcc/config/m68k/amigaos.opt b/gcc/config/m68k/amigaos.opt
-index f985cf5e2845..2d8bed0a9103 100644
---- gcc/config/m68k/amigaos.opt
-+++ gcc/config/m68k/amigaos.opt
-@@ -32,13 +32,17 @@ Target Report Var(flag_pic,4)
- data is adressed relativ to a4 with 32 bit offsets
-
- resident
--Target Common Report Var(flag_mybaserel,1)
-+Target Common Report Var(flag_pic,3)
- data is adressed relativ to a4, linked as resident
-
- resident32
--Target Common Report Var(flag_mybaserel,2)
-+Target Common Report Var(flag_pic,4)
- data is adressed relativ to a4 with 32 bit offsets, linked as resident
-
- mcrt=
- Target RejectNegative Var(amigaos_crt) Joined
--Specify startup binary
-\ No newline at end of file
-+Specify startup binary
-+
-+fbbb
-+Target Var(flag_bbb_opts,1) UInteger Init(0)
-+Enable Bebbo's optimizations
-
-From 01bd7d9ab157a9d973115a47cb9d24446f30f619 Mon Sep 17 00:00:00 2001
-From: bebbo <bebbo(a)bejy.net>
-Date: Wed, 5 Apr 2017 22:55:25 +0200
-Subject: [PATCH 055/303] @I cleanup
-
----
- gcc/config/m68k/m68k.c | 10 ----------
- 1 file changed, 10 deletions(-)
-
-diff --git a/gcc/config/m68k/m68k.c b/gcc/config/m68k/m68k.c
-index 6c0d9211598d..52eabeaafb23 100644
---- gcc/config/m68k/m68k.c
-+++ gcc/config/m68k/m68k.c
-@@ -2928,16 +2928,6 @@ m68k_rtx_costs (rtx x, machine_mode mode, int outer_code,
- *total = COSTS_N_INSNS (TARGET_COLDFIRE ? 2 : 3);
- return true;
- }
-- /* reg + value */
--// if (mode == SImode
--// && REG_P(XEXP(x, 0))) {
--// if (m68k_rtx_costs(XEXP(x, 1), mode, PLUS, 1, total, speed))
--// {
--// if (REGNO_REG_CLASS(REGNO(XEXP(x, 0))) == ADDR_REGS)
--// *total += 4;
--// return true;
--// }
--// }
-
- return false;
-
-
-From ab8a4e993790f397307d8ec74581791e12470cf9 Mon Sep 17 00:00:00 2001
-From: bebbo <bebbo(a)bejy.net>
-Date: Wed, 5 Apr 2017 23:00:59 +0200
-Subject: [PATCH 056/303] @B fix life analysis and commute_add_move, also some
- cleanup
-
----
- gcc/bbb-opts.c | 314 +++++++++++++++++++++++++++++++++------------------------
- 1 file changed, 180 insertions(+), 134 deletions(-)
-
-diff --git a/gcc/bbb-opts.c b/gcc/bbb-opts.c
-index 7fd01139d0f3..48e2fa3fd255 100755
---- gcc/bbb-opts.c
-+++ gcc/bbb-opts.c
-@@ -1,5 +1,6 @@
- /* Bebbo's Optimizations.
-- Copyright (C) 2010-2016 Free Software Foundation, Inc.
-+ Copyright (C) 2010-2017 Free Software Foundation, Inc.
-+ Copyright (C) 2017 Stefan "Bebbo" Franke.
-
- This file is part of GCC.
-
-@@ -26,14 +27,7 @@
- * check if a->b->a can be moved out of a loop.
- *
- * #2 strcpy_opt
-- * move a,reg
-- * move reg,b
-- * cmp #0,reg
-- * jcc
-- *
-- * ->
-- * move a,b
-- * jcc
-+ * check if a temp reg can be eliminated.
- *
- */
-
-@@ -55,39 +49,91 @@
- #include <map>
-
- /* enough for m68k. */
--typedef unsigned insn_info; //[(FIRST_PSEUDO_REGISTER + sizeof(unsigned) * 8 - 1) / (sizeof(unsigned) * 8)];
--
--static inline void
--resetii (unsigned & ii)
-+struct insn_info
- {
-- ii = 0;
--}
-+ unsigned mask;
-
--static inline void
--setii (unsigned regno, unsigned & ii)
--{
-- ii |= 1 << regno;
--}
-+ insn_info () :
-+ mask (0)
-+ {
-+ }
-
--static inline void
--clearii (unsigned regno, unsigned & ii)
--{
-- ii &= ~(1 << regno);
--}
-+ inline void
-+ reset ()
-+ {
-+ mask = 0;
-+ }
-
--static inline bool
--getii (unsigned regno, unsigned & ii)
--{
-- return ii & (1 << regno) ? true : false;
--}
-+ inline void
-+ set (int regno)
-+ {
-+ mask |= 1 << regno;
-+ }
-+
-+ inline void
-+ unset (int regno)
-+ {
-+ mask &= ~(1 << regno);
-+ }
-+
-+ inline bool
-+ get (int regno)
-+ {
-+ return (mask & (1 << regno)) != 0;
-+ }
-+
-+ inline insn_info
-+ operator | (insn_info const & o) const
-+ {
-+ insn_info t;
-+ t.mask = mask | o.mask;
-+ return t;
-+ }
-+
-+ inline insn_info
-+ operator & (insn_info const & o) const
-+ {
-+ insn_info t;
-+ t.mask = mask & o.mask;
-+ return t;
-+ }
-+
-+ inline insn_info &
-+ operator |= (insn_info const & o)
-+ {
-+ mask |= o.mask;
-+ return *this;
-+ }
-+
-+ inline insn_info &
-+ operator &= (insn_info const & o)
-+ {
-+ mask &= o.mask;
-+ return *this;
-+ }
-+
-+ inline bool
-+ operator == (insn_info const & o)
-+ {
-+ return mask == o.mask;
-+ }
-+
-+ inline insn_info
-+ operator ~ () const
-+ {
-+ insn_info t;
-+ t.mask = ~mask;
-+ return t;
-+ }
-+};
-
- /* scan rtx for registers. */
- static void
--scanii (rtx x, unsigned & ii)
-+scanii (rtx x, insn_info & ii)
- {
- if (REG_P(x))
- {
-- setii (REGNO(x), ii);
-+ ii.set (REGNO(x));
- return;
- }
-
-@@ -117,61 +163,27 @@ clear (void)
- infos.clear ();
- }
-
--static void
--dump_costs (void)
--{
-- rtx d0 = gen_raw_REG (SImode, 0);
-- rtx d0b = gen_raw_REG (QImode, 0);
-- rtx d1 = gen_raw_REG (SImode, 1);
-- rtx d1b = gen_raw_REG (QImode, 1);
-- rtx a0 = gen_raw_REG (SImode, 8);
-- rtx a1 = gen_raw_REG (SImode, 9);
--
-- struct ICO
-- {
-- char const * name;
-- rtx set;
-- } data[] =
-- {
-- { "move d0,(a0)", gen_rtx_SET(gen_rtx_MEM (SImode, a0), d0) },
-- { "move a0,d0", gen_rtx_SET(d0, a0) },
-- { "move (a0),d0", gen_rtx_SET(d0, gen_rtx_MEM (SImode, a0)) },
-- { "move d0,(a0)", gen_rtx_SET(gen_rtx_MEM (SImode, a0), d0) },
-- { "move d1,(a1)+", gen_rtx_SET(d1, gen_rtx_MEM (SImode, gen_rtx_POST_INC (SImode, a1))) },
-- { "move (a0),(a1)", gen_rtx_SET(gen_rtx_MEM (SImode, a1), gen_rtx_MEM (SImode, a0)) },
-- { 0, 0 } }, *p;
--
-- for (p = data; p->name; ++p)
-- {
-- int cost = insn_rtx_cost (p->set, true);
-- fprintf (stderr, "%s: %d\n", p->name, cost);
-- }
--}
--
--
- static void
- dump_insns (char const * name)
- {
-- rtx_insn *insn, *next;
-- fprintf(stderr, "====================================: %s\n", name);
-- for (unsigned i = 0; i < insns.size(); ++i)
-+ fprintf (stderr, "====================================: %s\n", name);
-+ for (unsigned i = 0; i < insns.size (); ++i)
- {
- insn_info & ii = infos[i];
-
- for (int j = 0; j < 8; ++j)
-- if (getii(j, ii))
-- fprintf(stderr, "d%d ", j);
-+ if (ii.get (j))
-+ fprintf (stderr, "d%d ", j);
-
- for (int j = 8; j < 16; ++j)
-- if (getii(j, ii))
-- fprintf(stderr, "a%d ", j-8);
-+ if (ii.get (j))
-+ fprintf (stderr, "a%d ", j - 8);
-
-- fprintf(stderr, "\t");
-- debug_rtx(insns[i]);
-+ fprintf (stderr, "\t");
-+ debug_rtx (insns[i]);
- }
- }
-
--
- /*
- * Create a filtered view of insns - keep only those to work with.
- */
-@@ -192,7 +204,7 @@ filter_insns ()
- {
- // debug_rtx (insn);
- if (JUMP_P(insn))
-- jumps.push_back(insn);
-+ jumps.push_back (insn);
-
- insn2index.insert (std::make_pair (insn, insns.size ()));
- insns.push_back (insn);
-@@ -201,13 +213,12 @@ filter_insns ()
-
- /* prepare insn_info */
- insn_info ii;
-- resetii (ii);
- for (unsigned i = 0; i < insns.size (); ++i)
- {
- infos.push_back (ii);
- }
-
-- /* own analyze life */
-+ /* own analyze reg life */
- std::vector<std::pair<unsigned, insn_info>> todo;
- todo.push_back (std::make_pair (insns.size () - 1, ii));
-
-@@ -236,53 +247,40 @@ filter_insns ()
- if (JUMP_LABEL(*i) == insn)
- {
- std::map<rtx_insn *, unsigned>::iterator j = insn2index.find (*i);
-- if (j != insn2index.end())
-+ if (j != insn2index.end ())
- todo.push_back (std::make_pair (j->second, ii));
- }
- }
- continue;
- }
-
-- rtx set = single_set (insn);
-- if (set == 0)
-- {
-- if (JUMP_P(insn)) {
-- resetii(ii);
-- setii(0, ii);
-- infos[pos] = ii;
-- continue;
-- }
-- fprintf(stderr, "##### ");
-- debug_rtx(insn);
-- continue;
-- }
--
-- rtx src = SET_SRC(set);
-- rtx dst = SET_DEST(set);
--
-- debug_rtx(insn);
-+ rtx pattern = PATTERN (insn);
-
- if (CALL_P(insn))
- {
- /* a call sets d0 and kills d1,a0,a1. */
-- if (getii (1, ii))
-+ if (ii.get (1))
- fprintf (stderr, "d1 used after call\n");
-- if (getii (8, ii))
-+ if (ii.get (8))
- fprintf (stderr, "a0 used after call\n");
-- if (getii (9, ii))
-+ if (ii.get (9))
- fprintf (stderr, "a1 used after call\n");
-
-- resetii (ii);
-+ ii.unset(0);
-+ ii.unset(1);
-+ ii.unset(8);
-+ ii.unset(9);
-+
-+ // FIXME: get the DECL and read attributes.
- // use regs depending on flag mregparm
- for (int i = 0; i < amigaos_regparm; ++i)
- {
-- setii (i, ii);
-- setii (i + 8, ii);
-+ ii.set (i);
-+ ii.set (i + 8);
- }
-
- // check for reg use
-- if (REG_P(src))
-- setii (REGNO(src), ii);
-+ scanii (pattern, ii);
-
- infos[pos] = ii;
- continue;
-@@ -290,37 +288,55 @@ filter_insns ()
-
- if (JUMP_P(insn))
- {
-- if (ANY_RETURN_P(src))
-+ if (ANY_RETURN_P(pattern))
- {
-- resetii (ii);
-- setii (0, ii);
-+ ii.reset ();
-+ ii.set (0);
- }
- else
- {
- ii |= infos[pos];
-
- // check for reg use
-- if (REG_P(src))
-- setii (REGNO(src), ii);
-+ scanii(PATTERN(insn), ii);
-+
-+ }
-+ infos[pos] = ii;
-+ continue;
-+ }
-+
-
-+ rtx set = single_set (insn);
-+ if (set == 0)
-+ {
-+ if (GET_CODE (pattern) == USE)
-+ {
-+ rtx x = XEXP(pattern, 0);
-+ if (REG_P(x))
-+ ii.set(REGNO(x));
-+ infos[pos] = ii;
-+ continue;
- }
-+
-+ fprintf (stderr, "##### ");
-+ debug_rtx (insn);
-+ scanii (pattern, ii);
- infos[pos] = ii;
- continue;
- }
-
-+ rtx src = SET_SRC(set);
-+ rtx dst = SET_DEST(set);
- // scan insn for regs
- // a def stop propagation
- // a use starts propagation
- // also add use to current ii
- insn_info use;
-- resetii (use);
--
- insn_info def;
-- resetii (def);
-
- scanii (src, use);
- if (REG_P(dst))
-- setii (REGNO(dst), def);
-+ def.set (REGNO(dst));
- else
- scanii (dst, use);
-
-@@ -808,16 +824,16 @@ commute_add_move (void)
- if (!set)
- continue;
-
-- rtx reg1 = SET_DEST(set);
-- if (!REG_P(reg1))
-+ rtx reg1dst = SET_DEST(set);
-+ if (!REG_P(reg1dst))
- continue;
-
- rtx plus = SET_SRC(set);
- if (GET_CODE(plus) != PLUS)
- continue;
-
-- rtx reg2 = XEXP(plus, 0);
-- if (!REG_P(reg2))
-+ rtx reg1src = XEXP(plus, 0);
-+ if (!REG_P(reg1src) || reg1src == reg1dst)
- continue;
-
- rtx cnst = XEXP(plus, 1);
-@@ -834,35 +850,35 @@ commute_add_move (void)
- continue;
-
- rtx memreg = XEXP(dst, 0);
-- if (!REG_P(memreg) || REGNO(memreg) != REGNO(reg2))
-+ if (!REG_P(memreg) || REGNO(memreg) != REGNO(reg1src))
- continue;
-
- int oldcost1 = insn_rtx_cost (set, true);
- int oldcost2 = insn_rtx_cost (set2, true);
-
-- fprintf (stderr, "commute_add_move found, oldcost: %d = %d + %d\n", oldcost1 + oldcost2, oldcost1, oldcost2);
-+ fprintf (stderr, "commute_add_move found, old cost: %d = %d + %d\n", oldcost1 + oldcost2, oldcost1, oldcost2);
-
-- //debug_rtx (insn);
-- //debug_rtx (next);
-+ debug_rtx (insn);
-+ debug_rtx (next);
-
-- rtx pinc = gen_rtx_POST_INC(GET_MODE(dst), reg1);
-+ rtx pinc = gen_rtx_POST_INC(GET_MODE(dst), reg1dst);
- rtx newmem = replace_equiv_address_nv (dst, pinc);
-
- if (validate_change (next, &SET_DEST(set2), newmem, 0))
- {
- SET_INSN_DELETED(insn);
-
-- insn = emit_insn_before (gen_movsi (reg1, reg2), next);
-+ insn = emit_insn_before (gen_movsi (reg1dst, reg1src), next);
-
-- add_reg_note (next, REG_INC, reg1);
-+ add_reg_note (next, REG_INC, reg1dst);
-
- int newcost1 = insn_rtx_cost (set, true);
- int newcost2 = insn_rtx_cost (set2, true);
-
-- fprintf (stderr, "commute_add_move found, newcost: %d = %d + %d\n", newcost1 + newcost2, newcost1, newcost2);
-+ fprintf (stderr, "commute_add_move found, new cost: %d = %d + %d\n", newcost1 + newcost2, newcost1, newcost2);
-
-- //debug_rtx (insn);
-- //debug_rtx (next);
-+ debug_rtx (insn);
-+ debug_rtx (next);
-
- df_insn_rescan (insn);
- df_insn_rescan (next);
-@@ -889,13 +905,43 @@ const_cmp_to_sub (void)
- if (dst != cc0_rtx)
- continue;
-
-- fprintf (stderr, "cc0:");
-- debug_rtx (insn);
-+// fprintf (stderr, "cc0:");
-+// debug_rtx (insn);
- }
- #endif
- return change_count;
- }
-
-+static unsigned
-+elim_dead_assign (void)
-+{
-+ unsigned change_count = 0;
-+ for (unsigned index = 0; index + 1 < insns.size (); ++index)
-+ {
-+ rtx_insn * insn = insns[index];
-+ if (!NONJUMP_INSN_P(insn))
-+ continue;
-+
-+ rtx set = single_set (insn);
-+ if (!set)
-+ continue;
-+
-+ rtx src = SET_SRC(set);
-+ rtx dst = SET_DEST(set);
-+ if (!REG_P(dst) || !REG_P(src))
-+ continue;
-+
-+ if (!infos[index].get (REGNO(dst)))
-+ {
-+ fprintf (stderr, "eliminate dead assignment to %d:", REGNO(dst));
-+ debug_rtx (insn);
-+ SET_INSN_DELETED(insn);
-+ ++change_count;
-+ }
-+ }
-+ return change_count;
-+}
-+
- /* Main entry point to the pass. */
- static unsigned int
- execute_bbb_optimizations (void)
-@@ -904,7 +950,6 @@ execute_bbb_optimizations (void)
- df_note_add_problem ();
- df_analyze ();
-
--// dump_insns ("bbb 0");
- filter_insns ();
-
- for (;;)
-@@ -925,15 +970,16 @@ execute_bbb_optimizations (void)
- if (const_cmp_to_sub ())
- done = 0, filter_insns ();
-
-+ if (elim_dead_assign ())
-+ done = 0, filter_insns ();
-+
- if (done)
- break;
- }
-
-- dump_insns ("bbb 1");
-+// dump_insns ("bbb 1");
- clear ();
-
-- dump_costs ();
--
- return 0;
- }
-
-@@ -964,7 +1010,7 @@ namespace
- virtual bool
- gate (function *)
- {
-- return TARGET_AMIGA;
-+ return TARGET_AMIGA && flag_bbb_opts;
- }
-
- virtual unsigned int
-
-From f5cd54a27e20a9ef7b1ec441fad9486216a87253 Mon Sep 17 00:00:00 2001
-From: bebbo <bebbo(a)bejy.net>
-Date: Thu, 6 Apr 2017 13:41:46 +0200
-Subject: [PATCH 057/303] @N const_cmp_to_sub
-
----
- gcc/bbb-opts.c | 187 ++++++++++++++++++++++++++++++++++++++++++++-------------
- 1 file changed, 146 insertions(+), 41 deletions(-)
-
-diff --git a/gcc/bbb-opts.c b/gcc/bbb-opts.c
-index 48e2fa3fd255..44616bcabd6b 100755
---- gcc/bbb-opts.c
-+++ gcc/bbb-opts.c
-@@ -48,7 +48,9 @@
- #include <vector>
- #include <map>
-
--/* enough for m68k. */
-+/* Enough for m68k.
-+ * Why a class? Maybe extend it for general usage.
-+ */
- struct insn_info
- {
- unsigned mask;
-@@ -127,7 +129,7 @@ struct insn_info
- }
- };
-
--/* scan rtx for registers. */
-+/* scan rtx for registers and set the corresponding flags. */
- static void
- scanii (rtx x, insn_info & ii)
- {
-@@ -149,11 +151,17 @@ scanii (rtx x, insn_info & ii)
- }
- }
-
-+/*
-+ * Collect some data.
-+ */
- static std::vector<rtx_insn *> insns;
- static std::vector<rtx_insn *> jumps;
- static std::map<rtx_insn *, unsigned> insn2index;
- static std::vector<insn_info> infos;
-
-+/*
-+ * Reset collected data.
-+ */
- static void
- clear (void)
- {
-@@ -163,6 +171,10 @@ clear (void)
- infos.clear ();
- }
-
-+/*
-+ * Helper function to dump the code.
-+ * Sometimes used during debugging.
-+ */
- static void
- dump_insns (char const * name)
- {
-@@ -188,7 +200,7 @@ dump_insns (char const * name)
- * Create a filtered view of insns - keep only those to work with.
- */
- static void
--filter_insns ()
-+update_meta_data ()
- {
- rtx_insn *insn, *next;
- clear ();
-@@ -258,18 +270,11 @@ filter_insns ()
-
- if (CALL_P(insn))
- {
-- /* a call sets d0 and kills d1,a0,a1. */
-- if (ii.get (1))
-- fprintf (stderr, "d1 used after call\n");
-- if (ii.get (8))
-- fprintf (stderr, "a0 used after call\n");
-- if (ii.get (9))
-- fprintf (stderr, "a1 used after call\n");
--
-- ii.unset(0);
-- ii.unset(1);
-- ii.unset(8);
-- ii.unset(9);
-+ /* a call sets d0 and maybe also d1,a0,a1. */
-+ ii.unset (0);
-+ ii.unset (1);
-+ ii.unset (8);
-+ ii.unset (9);
-
- // FIXME: get the DECL and read attributes.
- // use regs depending on flag mregparm
-@@ -298,14 +303,13 @@ filter_insns ()
- ii |= infos[pos];
-
- // check for reg use
-- scanii(PATTERN(insn), ii);
-+ scanii (PATTERN (insn), ii);
-
- }
- infos[pos] = ii;
- continue;
- }
-
--
- rtx set = single_set (insn);
- if (set == 0)
- {
-@@ -313,13 +317,16 @@ filter_insns ()
- {
- rtx x = XEXP(pattern, 0);
- if (REG_P(x))
-- ii.set(REGNO(x));
-+ ii.set (REGNO(x));
- infos[pos] = ii;
- continue;
- }
-
-- fprintf (stderr, "##### ");
-- debug_rtx (insn);
-+ if (GET_CODE (pattern) != PARALLEL)
-+ {
-+ fprintf (stderr, "##### ");
-+ debug_rtx (insn);
-+ }
- scanii (pattern, ii);
- infos[pos] = ii;
- continue;
-@@ -501,7 +508,7 @@ propagate_moves ()
- {
- std::vector<rtx_insn *>::iterator label_iter = jump_out.begin ();
- int fixup = 0;
-- fprintf (stderr, "need %d jump out fixups\n", jump_out.size ());
-+ fprintf (stderr, ": need %d jump out fixups\n", jump_out.size ());
-
- for (unsigned k = *i + 1; k != *j; ++k)
- {
-@@ -574,7 +581,7 @@ propagate_moves ()
- rtx_insn * after = insns[index + 1];
- rtx bset = single_set (before);
-
-- fprintf (stderr, "condition met, moving regs %d, %d\n", REGNO(srci), REGNO(dsti));
-+ fprintf (stderr, ": condition met, moving regs %d, %d\n", REGNO(srci), REGNO(dsti));
-
- /* Move in front of loop and mark as dead. */
- remove_insn (ii);
-@@ -607,7 +614,7 @@ propagate_moves ()
- /* add fixes if there were jumps out of the loop. */
- if (jump_out.size ())
- {
-- fprintf (stderr, "fixing %d jump outs\n", jump_out.size ());
-+ fprintf (stderr, ": fixing %d jump outs\n", jump_out.size ());
-
- for (unsigned k = 0; k < jump_out.size (); ++k)
- {
-@@ -698,7 +705,7 @@ opt_strcpy ()
-
- fprintf (
- stderr,
-- "condition met, removing compare and joining insns - omit reg %d\n", REGNO(dst));
-+ ": condition met, removing compare and joining insns - omit reg %d\n", REGNO(dst));
-
- for (link = REG_NOTES(x2reg); link; link = XEXP(link, 1))
- if (REG_NOTE_KIND (link) != REG_LABEL_OPERAND)
-@@ -856,7 +863,7 @@ commute_add_move (void)
- int oldcost1 = insn_rtx_cost (set, true);
- int oldcost2 = insn_rtx_cost (set2, true);
-
-- fprintf (stderr, "commute_add_move found, old cost: %d = %d + %d\n", oldcost1 + oldcost2, oldcost1, oldcost2);
-+ fprintf (stderr, ": commute_add_move found, old cost: %d = %d + %d\n", oldcost1 + oldcost2, oldcost1, oldcost2);
-
- debug_rtx (insn);
- debug_rtx (next);
-@@ -875,7 +882,7 @@ commute_add_move (void)
- int newcost1 = insn_rtx_cost (set, true);
- int newcost2 = insn_rtx_cost (set2, true);
-
-- fprintf (stderr, "commute_add_move found, new cost: %d = %d + %d\n", newcost1 + newcost2, newcost1, newcost2);
-+ fprintf (stderr, ": commute_add_move found, new cost: %d = %d + %d\n", newcost1 + newcost2, newcost1, newcost2);
-
- debug_rtx (insn);
- debug_rtx (next);
-@@ -889,24 +896,122 @@ commute_add_move (void)
- return change_count;
- }
-
-+/*
-+ * Replace
-+ *
-+ * move x,dx
-+ * cmp dx,dy
-+ *
-+ * if dx and dy are both dead after compare.
-+ *
-+ * with
-+ *
-+ * sub #n,dx
-+ *
-+ d0 d1 d2 a0 a1 a7 (insn 99 59 41 7 (set (reg:SI 2 d2)
-+ (const_int 1 [0x1])) sn.c:8 38 {*movsi_m68k}
-+ (nil))
-+ d0 d1 d2 a0 a1 a7 (insn 41 99 42 7 (set (cc0)
-+ (compare (reg/v:SI 1 d1 [orig:54 n ] [54])
-+ (reg:SI 2 d2))) sn.c:8 16 {*m68k.md:499}
-+ (expr_list:REG_DEAD (reg:SI 2 d2)
-+ (expr_list:REG_DEAD (reg/v:SI 1 d1 [orig:54 n ] [54])
-+ (nil))))
-+ *
-+ */
- static unsigned
- const_cmp_to_sub (void)
- {
- unsigned change_count = 0;
- #if HAVE_cc0
-- for (unsigned index = 0; index + 1 < insns.size (); ++index)
-+ for (unsigned index = 1; index + 1 < insns.size (); ++index)
- {
- rtx_insn * insn = insns[index];
-- rtx set = single_set (insn);
-- if (!set)
-+ rtx seti = single_set (insn);
-+ if (!seti)
- continue;
-
-- rtx dst = SET_DEST(set);
-- if (dst != cc0_rtx)
-+ rtx dsti = SET_DEST(seti);
-+ if (dsti != cc0_rtx)
-+ continue;
-+
-+ rtx srci = SET_SRC(seti);
-+ if (GET_CODE(srci) != COMPARE)
-+ continue;
-+
-+ rtx left = XEXP(srci, 0);
-+ rtx right = XEXP(srci, 1);
-+ if (!REG_P(left) || !REG_P(right))
- continue;
-
--// fprintf (stderr, "cc0:");
--// debug_rtx (insn);
-+ if (!find_reg_note (insn, REG_DEAD, left) || !find_reg_note (insn, REG_DEAD, right))
-+ continue;
-+
-+ fprintf (stderr, ": found reg-reg compare with both dead\n");
-+
-+ // maybe add a search?
-+ rtx_insn * prev = insns[index - 1];
-+ rtx setp = single_set (prev);
-+ if (!setp)
-+ continue;
-+
-+ rtx dstp = SET_DEST(setp);
-+ if (!REG_P(dstp) || dstp != left)
-+ continue;
-+
-+ rtx srcp = SET_SRC(setp);
-+ if (!CONST_INT_P(srcp))
-+ continue;
-+
-+ int intval = -INTVAL(srcp);
-+ if (intval < -8 || intval > 7)
-+ continue;
-+
-+ enum machine_mode mode = GET_MODE(dstp);
-+ rtx reg = dstp == left ? right : left;
-+ rtx plus = gen_rtx_PLUS(mode, reg, gen_rtx_CONST_INT(mode, intval));
-+
-+ SET_SRC(setp) = plus;
-+ SET_DEST(setp) = reg;
-+
-+ int num_clobbers_to_add = 0;
-+ int insn_code_number = recog (PATTERN (prev), prev, &num_clobbers_to_add);
-+
-+ SET_SRC(setp) = srcp;
-+ SET_DEST(setp) = dstp;
-+
-+ if (insn_code_number < 0)
-+ continue;
-+
-+ debug_rtx(prev);
-+ debug_rtx(insn);
-+
-+ // also convert current statement to cmp #0, reg
-+ SET_INSN_DELETED(insn);
-+ rtx neu = gen_rtx_SET(cc0_rtx, gen_rtx_COMPARE(mode, reg, gen_rtx_CONST_INT(mode, 0)));
-+ insn = emit_insn_after(neu, prev);
-+ add_reg_note (insn, REG_DEAD, reg);
-+
-+ SET_INSN_DELETED(prev);
-+ neu = gen_rtx_SET(reg, plus);
-+ prev = emit_insn_before(neu, insn);
-+
-+ int omitted_regno = REGNO(dstp == left ? left: right);
-+ if (!(df->hard_regs_live_count[omitted_regno] -= 2))
-+ df_set_regs_ever_live (omitted_regno, false);
-+
-+ fprintf (stderr, ": replaced reg-reg compare with sub\n");
-+ debug_rtx(prev);
-+ debug_rtx(insn);
-+
-+ if (dstp != left)
-+ {
-+ // invert all conditions using this statement.
-+
-+ }
-+
-+
-+ ++change_count;
- }
- #endif
- return change_count;
-@@ -933,7 +1038,7 @@ elim_dead_assign (void)
-
- if (!infos[index].get (REGNO(dst)))
- {
-- fprintf (stderr, "eliminate dead assignment to %d:", REGNO(dst));
-+ fprintf (stderr, ": eliminate dead assignment to %d:", REGNO(dst));
- debug_rtx (insn);
- SET_INSN_DELETED(insn);
- ++change_count;
-@@ -950,28 +1055,28 @@ execute_bbb_optimizations (void)
- df_note_add_problem ();
- df_analyze ();
-
-- filter_insns ();
-+ update_meta_data ();
-
- for (;;)
- {
- int done = 1;
- if (propagate_moves ())
-- done = 0, filter_insns ();
-+ done = 0, update_meta_data ();
-
- if (offset_2_autoinc ())
-- done = 0, filter_insns ();
-+ done = 0, update_meta_data ();
-
- if (opt_strcpy ())
-- done = 0, filter_insns ();
-+ done = 0, update_meta_data ();
-
- if (commute_add_move ())
-- done = 0, filter_insns ();
-+ done = 0, update_meta_data ();
-
- if (const_cmp_to_sub ())
-- done = 0, filter_insns ();
-+ done = 0, update_meta_data ();
-
- if (elim_dead_assign ())
-- done = 0, filter_insns ();
-+ done = 0, update_meta_data ();
-
- if (done)
- break;
-
-From 485cc891b48af316e84f77e6142a0c28b80c596d Mon Sep 17 00:00:00 2001
-From: bebbo <bebbo(a)bejy.net>
-Date: Thu, 6 Apr 2017 22:05:20 +0200
-Subject: [PATCH 058/303] @N const_cmp_to_sub seems working
-
----
- gcc/bbb-opts.c | 249 ++++++++++++++++++++++++++++++++++++++++++++-------------
- 1 file changed, 192 insertions(+), 57 deletions(-)
-
-diff --git a/gcc/bbb-opts.c b/gcc/bbb-opts.c
-index 44616bcabd6b..8a98fbfaad7c 100755
---- gcc/bbb-opts.c
-+++ gcc/bbb-opts.c
-@@ -50,45 +50,64 @@
-
- /* Enough for m68k.
- * Why a class? Maybe extend it for general usage.
-+ *
-+ * Track use & def separate to determine starting points.
- */
- struct insn_info
- {
-- unsigned mask;
-+ unsigned _use;
-+ unsigned _def;
-
- insn_info () :
-- mask (0)
-+ _use (0), _def (0)
- {
- }
-
- inline void
- reset ()
- {
-- mask = 0;
-+ _use = 0;
-+ _def = 0;
- }
-
- inline void
-- set (int regno)
-+ use (int regno)
- {
-- mask |= 1 << regno;
-+ _use |= 1 << regno;
-+ }
-+
-+ inline void
-+ def (int regno)
-+ {
-+ _use |= 1 << regno;
-+ _def |= 1 << regno;
- }
-
- inline void
- unset (int regno)
- {
-- mask &= ~(1 << regno);
-+ _use &= ~(1 << regno);
-+ _def &= ~(1 << regno);
- }
-
- inline bool
-- get (int regno)
-+ is_use (int regno)
- {
-- return (mask & (1 << regno)) != 0;
-+ return (_use & (1 << regno)) != 0;
-+ }
-+
-+ inline bool
-+ is_def (int regno)
-+ {
-+ return (_def & (1 << regno)) != 0;
- }
-
- inline insn_info
- operator | (insn_info const & o) const
- {
- insn_info t;
-- t.mask = mask | o.mask;
-+ t._use = _use | o._use;
-+ t._def = _def | o._def;
- return t;
- }
-
-@@ -96,46 +115,67 @@ struct insn_info
- operator & (insn_info const & o) const
- {
- insn_info t;
-- t.mask = mask & o.mask;
-+ t._use = _use & o._use;
-+ t._def = _def & o._def;
- return t;
- }
-
- inline insn_info &
- operator |= (insn_info const & o)
- {
-- mask |= o.mask;
-+ _use |= o._use;
-+ _def |= o._def;
- return *this;
- }
-
- inline insn_info &
- operator &= (insn_info const & o)
- {
-- mask &= o.mask;
-+ _use &= o._use;
-+ _def &= o._def;
- return *this;
- }
-
- inline bool
- operator == (insn_info const & o)
- {
-- return mask == o.mask;
-+ return _use == o._use;
- }
-
- inline insn_info
- operator ~ () const
- {
- insn_info t;
-- t.mask = ~mask;
-+ t._use = ~_use;
-+ t._def = ~_def;
- return t;
- }
-+
-+ inline bool contains(insn_info const & o) const {
-+ if (o._def & ~_def)
-+ return false;
-+ if (o._use & ~_use)
-+ return false;
-+ return true;
-+ }
-+
-+ void
-+ scan (rtx);
- };
-
- /* scan rtx for registers and set the corresponding flags. */
--static void
--scanii (rtx x, insn_info & ii)
-+void
-+insn_info::scan (rtx x)
- {
- if (REG_P(x))
- {
-- ii.set (REGNO(x));
-+ use (REGNO(x));
-+ return;
-+ }
-+
-+ if (x == cc0_rtx)
-+ {
-+ use (FIRST_PSEUDO_REGISTER);
- return;
- }
-
-@@ -144,10 +184,10 @@ scanii (rtx x, insn_info & ii)
- for (int i = GET_RTX_LENGTH (code) - 1; i >= 0; i--)
- {
- if (fmt[i] == 'e')
-- scanii (XEXP(x, i), ii);
-+ scan (XEXP(x, i));
- else if (fmt[i] == 'E')
- for (int j = XVECLEN (x, i) - 1; j >= 0; j--)
-- scanii (XVECEXP(x, i, j), ii);
-+ scan (XVECEXP(x, i, j));
- }
- }
-
-@@ -171,6 +211,23 @@ clear (void)
- infos.clear ();
- }
-
-+static bool is_reg_dead(unsigned regno, unsigned pos)
-+{
-+ if (pos >= infos.size())
-+ return true;
-+
-+ insn_info & ii0 = infos[pos++];
-+ if (!ii0.is_use(regno))
-+ return true;
-+
-+ if (pos >= infos.size())
-+ return true;
-+
-+ insn_info & ii1 = infos[pos];
-+
-+ return !ii1.is_use(regno);
-+}
-+
- /*
- * Helper function to dump the code.
- * Sometimes used during debugging.
-@@ -184,12 +241,15 @@ dump_insns (char const * name)
- insn_info & ii = infos[i];
-
- for (int j = 0; j < 8; ++j)
-- if (ii.get (j))
-- fprintf (stderr, "d%d ", j);
-+ if (ii.is_use (j))
-+ fprintf (stderr, ii.is_def (j) ? "*d%d " : "d%d ", j);
-
- for (int j = 8; j < 16; ++j)
-- if (ii.get (j))
-- fprintf (stderr, "a%d ", j - 8);
-+ if (ii.is_use (j))
-+ fprintf (stderr, ii.is_def (j) ? "*a%d " : "a%d ", j - 8);
-+
-+ if (ii.is_use (FIRST_PSEUDO_REGISTER))
-+ fprintf (stderr, ii.is_def (FIRST_PSEUDO_REGISTER) ? "*cc " : "cc ");
-
- fprintf (stderr, "\t");
- debug_rtx (insns[i]);
-@@ -246,7 +306,7 @@ update_meta_data ()
- {
- rtx_insn * insn = insns[pos];
-
-- if (pass && ii == infos[pos])
-+ if (pass && infos[pos].contains(ii))
- break;
-
- ii |= infos[pos];
-@@ -276,16 +336,16 @@ update_meta_data ()
- ii.unset (8);
- ii.unset (9);
-
-- // FIXME: get the DECL and read attributes.
-+ // FIXME: isuse the DECL and read attributes.
- // use regs depending on flag mregparm
- for (int i = 0; i < amigaos_regparm; ++i)
- {
-- ii.set (i);
-- ii.set (i + 8);
-+ ii.use (i);
-+ ii.use (i + 8);
- }
-
- // check for reg use
-- scanii (pattern, ii);
-+ ii.scan (pattern);
-
- infos[pos] = ii;
- continue;
-@@ -296,14 +356,14 @@ update_meta_data ()
- if (ANY_RETURN_P(pattern))
- {
- ii.reset ();
-- ii.set (0);
-+ ii.use (0);
- }
- else
- {
- ii |= infos[pos];
-
- // check for reg use
-- scanii (PATTERN (insn), ii);
-+ ii.scan (PATTERN (insn));
-
- }
- infos[pos] = ii;
-@@ -317,7 +377,7 @@ update_meta_data ()
- {
- rtx x = XEXP(pattern, 0);
- if (REG_P(x))
-- ii.set (REGNO(x));
-+ ii.use (REGNO(x));
- infos[pos] = ii;
- continue;
- }
-@@ -327,7 +387,7 @@ update_meta_data ()
- fprintf (stderr, "##### ");
- debug_rtx (insn);
- }
-- scanii (pattern, ii);
-+ ii.scan (pattern);
- infos[pos] = ii;
- continue;
- }
-@@ -341,13 +401,23 @@ update_meta_data ()
- insn_info use;
- insn_info def;
-
-- scanii (src, use);
-+ use.scan (src);
- if (REG_P(dst))
-- def.set (REGNO(dst));
-+ def.def (REGNO(dst));
-+ else if (dst == cc0_rtx)
-+ def.def (FIRST_PSEUDO_REGISTER);
- else
-- scanii (dst, use);
-+ use.scan (dst);
-
-- infos[pos] = use | ii;
-+ if (dst != cc0_rtx)
-+ {
-+ CC_STATUS_INIT;
-+ NOTICE_UPDATE_CC(PATTERN (insn), insn);
-+ if (cc_status.value1 || cc_status.value2)
-+ def.def (FIRST_PSEUDO_REGISTER);
-+ }
-+
-+ infos[pos] = def | use | ii;
-
- ii &= ~def;
- ii |= use;
-@@ -778,15 +848,15 @@ offset_2_autoinc (void)
- if (!NONJUMP_INSN_P(insn))
- continue;
-
-- rtx set = single_set (insn);
-- if (!set)
-+ rtx use = single_set (insn);
-+ if (!use)
- continue;
-
-- rtx reg = SET_DEST(set);
-+ rtx reg = SET_DEST(use);
- if (!REG_P(reg))
- continue;
-
-- rtx val = SET_SRC(set);
-+ rtx val = SET_SRC(use);
-
- // fprintf(stderr, "possible start for offset_2_autoinc\n");
- // //debug_rtx(insn);
-@@ -882,7 +952,8 @@ commute_add_move (void)
- int newcost1 = insn_rtx_cost (set, true);
- int newcost2 = insn_rtx_cost (set2, true);
-
-- fprintf (stderr, ": commute_add_move found, new cost: %d = %d + %d\n", newcost1 + newcost2, newcost1, newcost2);
-+ fprintf (stderr, ": commute_add_move found, new cost: %d = %d + %d\n", newcost1 + newcost2, newcost1,
-+ newcost2);
-
- debug_rtx (insn);
- debug_rtx (next);
-@@ -944,10 +1015,14 @@ const_cmp_to_sub (void)
- if (!REG_P(left) || !REG_P(right))
- continue;
-
-- if (!find_reg_note (insn, REG_DEAD, left) || !find_reg_note (insn, REG_DEAD, right))
-- continue;
-+// if (!find_reg_note (insn, REG_DEAD, left) || !find_reg_note (insn, REG_DEAD, right))
-+// continue;
-
-- fprintf (stderr, ": found reg-reg compare with both dead\n");
-+ if (!is_reg_dead(REGNO(left), index) || !is_reg_dead(REGNO(right), index))
-+ continue;
-+
-+ fprintf (stderr, ": found reg-reg compare with both dead: %d %d\n",
-+ is_reg_dead(REGNO(left), index), is_reg_dead(REGNO(right), index));
-
- // maybe add a search?
- rtx_insn * prev = insns[index - 1];
-@@ -956,7 +1031,7 @@ const_cmp_to_sub (void)
- continue;
-
- rtx dstp = SET_DEST(setp);
-- if (!REG_P(dstp) || dstp != left)
-+ if (!REG_P(dstp))
- continue;
-
- rtx srcp = SET_SRC(setp);
-@@ -969,7 +1044,7 @@ const_cmp_to_sub (void)
-
- enum machine_mode mode = GET_MODE(dstp);
- rtx reg = dstp == left ? right : left;
-- rtx plus = gen_rtx_PLUS(mode, reg, gen_rtx_CONST_INT(mode, intval));
-+ rtx plus = gen_rtx_PLUS(mode, reg, gen_rtx_CONST_INT (mode, intval));
-
- SET_SRC(setp) = plus;
- SET_DEST(setp) = reg;
-@@ -983,33 +1058,93 @@ const_cmp_to_sub (void)
- if (insn_code_number < 0)
- continue;
-
-- debug_rtx(prev);
-- debug_rtx(insn);
-+ debug_rtx (prev);
-+ debug_rtx (insn);
-
- // also convert current statement to cmp #0, reg
- SET_INSN_DELETED(insn);
- rtx neu = gen_rtx_SET(cc0_rtx, gen_rtx_COMPARE(mode, reg, gen_rtx_CONST_INT(mode, 0)));
-- insn = emit_insn_after(neu, prev);
-+ insn = emit_insn_after (neu, prev);
- add_reg_note (insn, REG_DEAD, reg);
-
- SET_INSN_DELETED(prev);
- neu = gen_rtx_SET(reg, plus);
-- prev = emit_insn_before(neu, insn);
-+ prev = emit_insn_before (neu, insn);
-
-- int omitted_regno = REGNO(dstp == left ? left: right);
-- if (!(df->hard_regs_live_count[omitted_regno] -= 2))
-- df_set_regs_ever_live (omitted_regno, false);
-+// urks - unknown side effects
-+// int omitted_regno = REGNO(dstp);
-+// if (!(df->hard_regs_live_count[omitted_regno] -= 2))
-+// df_set_regs_ever_live (omitted_regno, false);
-
- fprintf (stderr, ": replaced reg-reg compare with sub\n");
-- debug_rtx(prev);
-- debug_rtx(insn);
-+ debug_rtx (prev);
-+ debug_rtx (insn);
-
- if (dstp != left)
- {
- // invert all conditions using this statement.
-+ std::vector<unsigned> todo;
-+ std::vector<unsigned> done;
-+ done.resize(insns.size());
-+ todo.push_back (index + 1);
-
-- }
-+ while (todo.size ())
-+ {
-+ unsigned pos = todo[todo.size () - 1];
-+ todo.pop_back ();
-+
-+ if (done[pos])
-+ continue;
-
-+ done[pos] = 1;
-+
-+ if (infos[pos].is_def (FIRST_PSEUDO_REGISTER))
-+ continue;
-+
-+ if (pos + 1 < infos.size ())
-+ todo.push_back (pos + 1);
-+
-+ rtx_insn * patchme = insns[pos];
-+ if (!JUMP_P(insn))
-+ continue;
-+
-+ std::map<rtx_insn *, unsigned>::iterator j = insn2index.find ((rtx_insn *) JUMP_LABEL(patchme));
-+ if (j != insn2index.end ())
-+ todo.push_back (j->second);
-+
-+ rtx jmppattern = PATTERN (patchme);
-+
-+ rtx jmpsrc = XEXP(jmppattern, 1);
-+ if (GET_CODE(jmpsrc) == IF_THEN_ELSE)
-+ {
-+ rtx condition = XEXP(jmpsrc, 0);
-+ RTX_CODE code = GET_CODE(condition);
-+ RTX_CODE newcode = code;
-+ if (code == GE)
-+ newcode = LE;
-+ else if (code == GT)
-+ newcode = LT;
-+ else if (code == LT)
-+ newcode = GT;
-+ else if (code == LE)
-+ newcode = GE;
-+ else if (code == GEU)
-+ newcode = LEU;
-+ else if (code == GTU)
-+ newcode = LTU;
-+ else if (code == LTU)
-+ newcode = GTU;
-+ else if (code == LEU)
-+ newcode = GEU;
-+
-+ if (code != newcode)
-+ {
-+ fprintf (stderr, ": patch jcc %d -> %d\n", code, newcode);
-+ XEXP(jmpsrc, 0) = gen_rtx_fmt_ee(newcode, VOIDmode, XEXP(condition, 0), XEXP(condition, 1));
-+ }
-+ }
-+ }
-+ }
-
- ++change_count;
- }
-@@ -1036,7 +1171,7 @@ elim_dead_assign (void)
- if (!REG_P(dst) || !REG_P(src))
- continue;
-
-- if (!infos[index].get (REGNO(dst)))
-+ if (!infos[index].is_use (REGNO(dst)))
- {
- fprintf (stderr, ": eliminate dead assignment to %d:", REGNO(dst));
- debug_rtx (insn);
-
-From 9967eed30e2e8f28bb48aa5a39d1cd578d4e0a7a Mon Sep 17 00:00:00 2001
-From: bebbo <bebbo(a)bejy.net>
-Date: Fri, 7 Apr 2017 04:03:53 +0200
-Subject: [PATCH 059/303] @B avoid illegal insns
-
----
- gcc/bbb-opts.c | 188 ++++++++++++++++++++++++++++++++++++++++-----------------
- 1 file changed, 132 insertions(+), 56 deletions(-)
-
-diff --git a/gcc/bbb-opts.c b/gcc/bbb-opts.c
-index 8a98fbfaad7c..d9e77c53856d 100755
---- gcc/bbb-opts.c
-+++ gcc/bbb-opts.c
-@@ -79,7 +79,6 @@ struct insn_info
- inline void
- def (int regno)
- {
-- _use |= 1 << regno;
- _def |= 1 << regno;
- }
-
-@@ -151,7 +150,9 @@ struct insn_info
- return t;
- }
-
-- inline bool contains(insn_info const & o) const {
-+ inline bool
-+ contains (insn_info const & o) const
-+ {
- if (o._def & ~_def)
- return false;
- if (o._use & ~_use)
-@@ -211,21 +212,22 @@ clear (void)
- infos.clear ();
- }
-
--static bool is_reg_dead(unsigned regno, unsigned pos)
-+static bool
-+is_reg_dead (unsigned regno, unsigned pos)
- {
-- if (pos >= infos.size())
-+ if (pos >= infos.size ())
- return true;
-
- insn_info & ii0 = infos[pos++];
-- if (!ii0.is_use(regno))
-+ if (!ii0.is_use (regno))
- return true;
-
-- if (pos >= infos.size())
-+ if (pos >= infos.size ())
- return true;
-
- insn_info & ii1 = infos[pos];
-
-- return !ii1.is_use(regno);
-+ return !ii1.is_use (regno);
- }
-
- /*
-@@ -274,7 +276,6 @@ update_meta_data ()
-
- if (NONJUMP_INSN_P (insn) || LABEL_P(insn) || JUMP_P(insn) || CALL_P(insn))
- {
-- // debug_rtx (insn);
- if (JUMP_P(insn))
- jumps.push_back (insn);
-
-@@ -306,7 +307,7 @@ update_meta_data ()
- {
- rtx_insn * insn = insns[pos];
-
-- if (pass && infos[pos].contains(ii))
-+ if (pass && infos[pos].contains (ii))
- break;
-
- ii |= infos[pos];
-@@ -578,7 +579,6 @@ propagate_moves ()
- {
- std::vector<rtx_insn *>::iterator label_iter = jump_out.begin ();
- int fixup = 0;
-- fprintf (stderr, ": need %d jump out fixups\n", jump_out.size ());
-
- for (unsigned k = *i + 1; k != *j; ++k)
- {
-@@ -651,7 +651,8 @@ propagate_moves ()
- rtx_insn * after = insns[index + 1];
- rtx bset = single_set (before);
-
-- fprintf (stderr, ": condition met, moving regs %d, %d\n", REGNO(srci), REGNO(dsti));
-+ fprintf (stderr, ":bbb: propagate_moves condition met, moving regs %d, %d\n",
-+ REGNO(srci), REGNO(dsti));
-
- /* Move in front of loop and mark as dead. */
- remove_insn (ii);
-@@ -684,7 +685,7 @@ propagate_moves ()
- /* add fixes if there were jumps out of the loop. */
- if (jump_out.size ())
- {
-- fprintf (stderr, ": fixing %d jump outs\n", jump_out.size ());
-+ fprintf (stderr, ":bbb: propagate_moves fixing %d jump outs\n", jump_out.size ());
-
- for (unsigned k = 0; k < jump_out.size (); ++k)
- {
-@@ -763,7 +764,7 @@ opt_strcpy ()
- SET_SRC(single_set(reg2x)) = SET_SRC(single_set (x2reg));
- insn_code_number = recog (PATTERN (reg2x), reg2x, &num_clobbers_to_add);
-
-- if (insn_code_number < 0)
-+ if (insn_code_number < 0 || !check_asm_operands (reg2x))
- {
- /* restore register. */
- SET_SRC(single_set(reg2x)) = SET_DEST(single_set (x2reg));
-@@ -775,7 +776,8 @@ opt_strcpy ()
-
- fprintf (
- stderr,
-- ": condition met, removing compare and joining insns - omit reg %d\n", REGNO(dst));
-+ ":bbb: opt_strcpy condition met, removing compare and joining insns - omit reg %d\n",
-+ REGNO(dst));
-
- for (link = REG_NOTES(x2reg); link; link = XEXP(link, 1))
- if (REG_NOTE_KIND (link) != REG_LABEL_OPERAND)
-@@ -930,14 +932,6 @@ commute_add_move (void)
- if (!REG_P(memreg) || REGNO(memreg) != REGNO(reg1src))
- continue;
-
-- int oldcost1 = insn_rtx_cost (set, true);
-- int oldcost2 = insn_rtx_cost (set2, true);
--
-- fprintf (stderr, ": commute_add_move found, old cost: %d = %d + %d\n", oldcost1 + oldcost2, oldcost1, oldcost2);
--
-- debug_rtx (insn);
-- debug_rtx (next);
--
- rtx pinc = gen_rtx_POST_INC(GET_MODE(dst), reg1dst);
- rtx newmem = replace_equiv_address_nv (dst, pinc);
-
-@@ -949,14 +943,7 @@ commute_add_move (void)
-
- add_reg_note (next, REG_INC, reg1dst);
-
-- int newcost1 = insn_rtx_cost (set, true);
-- int newcost2 = insn_rtx_cost (set2, true);
--
-- fprintf (stderr, ": commute_add_move found, new cost: %d = %d + %d\n", newcost1 + newcost2, newcost1,
-- newcost2);
--
-- debug_rtx (insn);
-- debug_rtx (next);
-+ fprintf (stderr, ":bbb: commute_add_move found\n");
-
- df_insn_rescan (insn);
- df_insn_rescan (next);
-@@ -1018,11 +1005,15 @@ const_cmp_to_sub (void)
- // if (!find_reg_note (insn, REG_DEAD, left) || !find_reg_note (insn, REG_DEAD, right))
- // continue;
-
-- if (!is_reg_dead(REGNO(left), index) || !is_reg_dead(REGNO(right), index))
-- continue;
-+ // TODO
-+ // FEATURE: check if the next uses are also a add/sub
-+ // then maybe that add/sub can be adjusted too
-
-- fprintf (stderr, ": found reg-reg compare with both dead: %d %d\n",
-- is_reg_dead(REGNO(left), index), is_reg_dead(REGNO(right), index));
-+ if (!is_reg_dead (REGNO(left), index) || !is_reg_dead (REGNO(right), index))
-+ continue;
-+
-+ fprintf (stderr, ":bbb: found reg-reg compare with both dead: %d %d\n", is_reg_dead (REGNO(left), index),
-+ is_reg_dead (REGNO(right), index));
-
- // maybe add a search?
- rtx_insn * prev = insns[index - 1];
-@@ -1051,6 +1042,8 @@ const_cmp_to_sub (void)
-
- int num_clobbers_to_add = 0;
- int insn_code_number = recog (PATTERN (prev), prev, &num_clobbers_to_add);
-+ if (insn_code_number >= 0 && !check_asm_operands (prev))
-+ insn_code_number = -1;
-
- SET_SRC(setp) = srcp;
- SET_DEST(setp) = dstp;
-@@ -1058,9 +1051,6 @@ const_cmp_to_sub (void)
- if (insn_code_number < 0)
- continue;
-
-- debug_rtx (prev);
-- debug_rtx (insn);
--
- // also convert current statement to cmp #0, reg
- SET_INSN_DELETED(insn);
- rtx neu = gen_rtx_SET(cc0_rtx, gen_rtx_COMPARE(mode, reg, gen_rtx_CONST_INT(mode, 0)));
-@@ -1076,16 +1066,14 @@ const_cmp_to_sub (void)
- // if (!(df->hard_regs_live_count[omitted_regno] -= 2))
- // df_set_regs_ever_live (omitted_regno, false);
-
-- fprintf (stderr, ": replaced reg-reg compare with sub\n");
-- debug_rtx (prev);
-- debug_rtx (insn);
-+ fprintf (stderr, ":bbb: const_cmp_to_sub replaced reg-reg compare with sub\n");
-
- if (dstp != left)
- {
- // invert all conditions using this statement.
- std::vector<unsigned> todo;
- std::vector<unsigned> done;
-- done.resize(insns.size());
-+ done.resize (insns.size ());
- todo.push_back (index + 1);
-
- while (todo.size ())
-@@ -1139,7 +1127,7 @@ const_cmp_to_sub (void)
-
- if (code != newcode)
- {
-- fprintf (stderr, ": patch jcc %d -> %d\n", code, newcode);
-+ fprintf (stderr, ":bbb: patch jcc %d -> %d\n", code, newcode);
- XEXP(jmpsrc, 0) = gen_rtx_fmt_ee(newcode, VOIDmode, XEXP(condition, 0), XEXP(condition, 1));
- }
- }
-@@ -1173,8 +1161,7 @@ elim_dead_assign (void)
-
- if (!infos[index].is_use (REGNO(dst)))
- {
-- fprintf (stderr, ": eliminate dead assignment to %d:", REGNO(dst));
-- debug_rtx (insn);
-+ fprintf (stderr, ":bbb: elim_dead_assign to %d\n", REGNO(dst));
- SET_INSN_DELETED(insn);
- ++change_count;
- }
-@@ -1182,6 +1169,86 @@ elim_dead_assign (void)
- return change_count;
- }
-
-+/*
-+ * rare and only little gain - but :-)
-+ lea (-1,a0),a1
-+ add.l d1,a1
-+ subq.l #1,d1
-+ ->
-+ move.l a0,a1
-+ subq.l #1,d1
-+ add.l d1,a1
-+ */
-+static unsigned
-+merge_add (void)
-+{
-+ unsigned change_count = 0;
-+ for (unsigned index = 0; index + 2 < insns.size (); ++index)
-+ {
-+ rtx_insn * ins1 = insns[index];
-+ rtx_insn * ins2 = insns[index + 1];
-+ rtx_insn * ins3 = insns[index + 2];
-+ if (!NONJUMP_INSN_P(ins1) && !NONJUMP_INSN_P(ins2) && !NONJUMP_INSN_P(ins3))
-+ continue;
-+
-+ rtx set1 = single_set (ins1);
-+ rtx set2 = single_set (ins2);
-+ rtx set3 = single_set (ins3);
-+ if (!set1 || !set2 || !set3)
-+ continue;
-+
-+ rtx dst1 = SET_DEST(set1);
-+ rtx dst2 = SET_DEST(set2);
-+ rtx dst3 = SET_DEST(set3);
-+ if (!REG_P(dst1) || !REG_P(dst2) || !REG_P(dst3))
-+ continue;
-+
-+ CC_STATUS_INIT;
-+ NOTICE_UPDATE_CC(PATTERN (ins2), ins2);
-+ if (cc_status.value1 || cc_status.value2)
-+ continue;
-+
-+ rtx src1 = SET_SRC(set1);
-+ rtx src2 = SET_SRC(set2);
-+ rtx src3 = SET_SRC(set3);
-+ if (GET_CODE(src1) != PLUS || GET_CODE(src2) != PLUS || GET_CODE(src3) != PLUS)
-+ continue;
-+
-+ rtx l1 = XEXP(src1, 0);
-+ rtx l2 = XEXP(src2, 0);
-+ rtx l3 = XEXP(src3, 0);
-+
-+ rtx r1 = XEXP(src1, 1);
-+ rtx r2 = XEXP(src2, 1);
-+ rtx r3 = XEXP(src3, 1);
-+ if (!CONST_INT_P(r1) || !REG_P(r2) || !CONST_INT_P(r3))
-+ continue;
-+
-+ if (REGNO(dst1) != REGNO(dst2) || REGNO(r2) != REGNO(dst3))
-+ continue;
-+
-+ fprintf (stderr, ": merge_add pattern found\n");
-+
-+ SET_SRC(set1) = l1;
-+ remove_insn (ins2);
-+ add_insn_after (ins2, ins3, 0);
-+ }
-+ return change_count;
-+}
-+
-+/*
-+ * Always prefer lower register numbers within the class.
-+ */
-+static unsigned
-+bb_reg_rename(void)
-+{
-+ unsigned change_count = 0;
-+ for (unsigned index = 0; index < insns.size (); ++index)
-+ {
-+ }
-+ return change_count;
-+}
-+
- /* Main entry point to the pass. */
- static unsigned int
- execute_bbb_optimizations (void)
-@@ -1195,22 +1262,31 @@ execute_bbb_optimizations (void)
- for (;;)
- {
- int done = 1;
-- if (propagate_moves ())
-- done = 0, update_meta_data ();
-+ for (;;)
-+ {
-+ if (propagate_moves ())
-+ done = 0, update_meta_data ();
-
-- if (offset_2_autoinc ())
-- done = 0, update_meta_data ();
-+ if (offset_2_autoinc ())
-+ done = 0, update_meta_data ();
-
-- if (opt_strcpy ())
-- done = 0, update_meta_data ();
-+ if (opt_strcpy ())
-+ done = 0, update_meta_data ();
-
-- if (commute_add_move ())
-- done = 0, update_meta_data ();
-+ if (commute_add_move ())
-+ done = 0, update_meta_data ();
-
-- if (const_cmp_to_sub ())
-- done = 0, update_meta_data ();
-+ if (const_cmp_to_sub ())
-+ done = 0, update_meta_data ();
-+
-+ if (merge_add ())
-+ done = 0, update_meta_data ();
-+
-+ if (elim_dead_assign ())
-+ done = 0, update_meta_data ();
-+ }
-
-- if (elim_dead_assign ())
-+ if (bb_reg_rename ())
- done = 0, update_meta_data ();
-
- if (done)
-@@ -1250,7 +1326,7 @@ namespace
- virtual bool
- gate (function *)
- {
-- return TARGET_AMIGA && flag_bbb_opts;
-+ return TARGET_AMIGA;// && flag_bbb_opts;
- }
-
- virtual unsigned int
-
-From 7ea53a15d0e3f77f38f9383d8779c7755c499e4b Mon Sep 17 00:00:00 2001
-From: bebbo <bebbo(a)bejy.net>
-Date: Fri, 7 Apr 2017 04:07:36 +0200
-Subject: [PATCH 060/303] @B fix loop hang
-
----
- gcc/bbb-opts.c | 35 ++++++++++++++++-------------------
- 1 file changed, 16 insertions(+), 19 deletions(-)
-
-diff --git a/gcc/bbb-opts.c b/gcc/bbb-opts.c
-index d9e77c53856d..c525ae432071 100755
---- gcc/bbb-opts.c
-+++ gcc/bbb-opts.c
-@@ -1240,7 +1240,7 @@ merge_add (void)
- * Always prefer lower register numbers within the class.
- */
- static unsigned
--bb_reg_rename(void)
-+bb_reg_rename (void)
- {
- unsigned change_count = 0;
- for (unsigned index = 0; index < insns.size (); ++index)
-@@ -1262,29 +1262,26 @@ execute_bbb_optimizations (void)
- for (;;)
- {
- int done = 1;
-- for (;;)
-- {
-- if (propagate_moves ())
-- done = 0, update_meta_data ();
-+ if (propagate_moves ())
-+ done = 0, update_meta_data ();
-
-- if (offset_2_autoinc ())
-- done = 0, update_meta_data ();
-+ if (offset_2_autoinc ())
-+ done = 0, update_meta_data ();
-
-- if (opt_strcpy ())
-- done = 0, update_meta_data ();
-+ if (opt_strcpy ())
-+ done = 0, update_meta_data ();
-
-- if (commute_add_move ())
-- done = 0, update_meta_data ();
-+ if (commute_add_move ())
-+ done = 0, update_meta_data ();
-
-- if (const_cmp_to_sub ())
-- done = 0, update_meta_data ();
-+ if (const_cmp_to_sub ())
-+ done = 0, update_meta_data ();
-
-- if (merge_add ())
-- done = 0, update_meta_data ();
-+ if (merge_add ())
-+ done = 0, update_meta_data ();
-
-- if (elim_dead_assign ())
-- done = 0, update_meta_data ();
-- }
-+ if (elim_dead_assign ())
-+ done = 0, update_meta_data ();
-
- if (bb_reg_rename ())
- done = 0, update_meta_data ();
-@@ -1326,7 +1323,7 @@ namespace
- virtual bool
- gate (function *)
- {
-- return TARGET_AMIGA;// && flag_bbb_opts;
-+ return TARGET_AMIGA; // && flag_bbb_opts;
- }
-
- virtual unsigned int
-
-From cf6a128caf791e74460c8f312e624be2ab373b4e Mon Sep 17 00:00:00 2001
-From: bebbo <bebbo(a)bejy.net>
-Date: Sat, 8 Apr 2017 17:06:18 +0200
-Subject: [PATCH 061/303] @N add option letters to -fbbb
-
----
- gcc/config/m68k/amigaos.opt | 4 ++--
- 1 file changed, 2 insertions(+), 2 deletions(-)
-
-diff --git a/gcc/config/m68k/amigaos.opt b/gcc/config/m68k/amigaos.opt
-index 2d8bed0a9103..a5a14449dea9 100644
---- gcc/config/m68k/amigaos.opt
-+++ gcc/config/m68k/amigaos.opt
-@@ -43,6 +43,6 @@ mcrt=
- Target RejectNegative Var(amigaos_crt) Joined
- Specify startup binary
-
--fbbb
--Target Var(flag_bbb_opts,1) UInteger Init(0)
-+fbbb=
-+Target Var(flag_bbb_opts) Joined
- Enable Bebbo's optimizations
-
-From 477bce8c47781fce8d11797829a3bd6ade798273 Mon Sep 17 00:00:00 2001
-From: bebbo <bebbo(a)bejy.net>
-Date: Sat, 8 Apr 2017 17:07:04 +0200
-Subject: [PATCH 062/303] @B some fixes, also invoke regrename directly, @R use
- letter from -fbbb=
-
----
- gcc/bbb-opts.c | 347 ++++++++++++++++++++++++++++++++++++++++----------------
- gcc/regrename.c | 12 +-
- 2 files changed, 260 insertions(+), 99 deletions(-)
-
-diff --git a/gcc/bbb-opts.c b/gcc/bbb-opts.c
-index c525ae432071..737a5c00af3b 100755
---- gcc/bbb-opts.c
-+++ gcc/bbb-opts.c
-@@ -45,6 +45,7 @@
- #include "emit-rtl.h"
- #include "tree-pass.h"
- #include "conditions.h"
-+#include "cselib.h"
- #include <vector>
- #include <map>
-
-@@ -110,14 +111,14 @@ struct insn_info
- return t;
- }
-
-- inline insn_info
-- operator & (insn_info const & o) const
-- {
-- insn_info t;
-- t._use = _use & o._use;
-- t._def = _def & o._def;
-- return t;
-- }
-+// inline insn_info
-+// operator & (insn_info const & o) const
-+// {
-+// insn_info t;
-+// t._use = _use & o._use;
-+// t._def = _def & o._def;
-+// return t;
-+// }
-
- inline insn_info &
- operator |= (insn_info const & o)
-@@ -130,7 +131,7 @@ struct insn_info
- inline insn_info &
- operator &= (insn_info const & o)
- {
-- _use &= o._use;
-+ _use &= o._use & o._def;
- _def &= o._def;
- return *this;
- }
-@@ -162,6 +163,18 @@ struct insn_info
-
- void
- scan (rtx);
-+
-+ unsigned
-+ get_def_mask () const
-+ {
-+ if (!_def || _def > 0xffff)
-+ return 0;
-+
-+ unsigned mask = _def - 1;
-+ if (_def > 0xff)
-+ mask &= 0xff00;
-+ return mask;
-+ }
- };
-
- /* scan rtx for registers and set the corresponding flags. */
-@@ -192,6 +205,47 @@ insn_info::scan (rtx x)
- }
- }
-
-+/* perform reg renaming. */
-+static void
-+do_reg_rename (rtx x, unsigned oldregno, unsigned newregno)
-+{
-+ if (REG_P(x))
-+ {
-+ if (REGNO(x) == oldregno)
-+ df_ref_change_reg_with_loc (x, newregno);
-+ return;
-+ }
-+
-+ if (x == cc0_rtx)
-+ return;
-+
-+ RTX_CODE code = GET_CODE(x);
-+ const char *fmt = GET_RTX_FORMAT(code);
-+ for (int i = GET_RTX_LENGTH (code) - 1; i >= 0; i--)
-+ {
-+ if (fmt[i] == 'e')
-+ do_reg_rename (XEXP(x, i), oldregno, newregno);
-+ else if (fmt[i] == 'E')
-+ for (int j = XVECLEN (x, i) - 1; j >= 0; j--)
-+ do_reg_rename (XVECEXP(x, i, j), oldregno, newregno);
-+ }
-+}
-+
-+static int
-+bit2regno (unsigned bit)
-+{
-+ if (!bit)
-+ return -1;
-+
-+ unsigned regno = 0;
-+ while (!(bit & 1))
-+ {
-+ ++regno;
-+ bit >>= 1;
-+ }
-+ return regno;
-+}
-+
- /*
- * Collect some data.
- */
-@@ -212,22 +266,25 @@ clear (void)
- infos.clear ();
- }
-
-+/*
-+ * return true if the register is DEAD.
-+ */
- static bool
- is_reg_dead (unsigned regno, unsigned pos)
- {
-- if (pos >= infos.size ())
-- return true;
--
-- insn_info & ii0 = infos[pos++];
-- if (!ii0.is_use (regno))
-- return true;
--
-- if (pos >= infos.size ())
-- return true;
--
-- insn_info & ii1 = infos[pos];
-+ for(;;) {
-+ if (pos + 1 >= infos.size ())
-+ return true;
-+
-+ rtx_insn * insn = insns[pos + 1];
-+ if (!LABEL_P(insn) && GET_CODE(insn) != USE)
-+ break;
-+ ++pos;
-+ }
-
-- return !ii1.is_use (regno);
-+ insn_info & ii0 = infos[pos + 1];
-+ // not dead if usage is reported in the next statement
-+ return !ii0.is_use (regno);
- }
-
- /*
-@@ -242,6 +299,8 @@ dump_insns (char const * name)
- {
- insn_info & ii = infos[i];
-
-+ fprintf(stderr, "%d: ", i);
-+
- for (int j = 0; j < 8; ++j)
- if (ii.is_use (j))
- fprintf (stderr, ii.is_def (j) ? "*d%d " : "d%d ", j);
-@@ -301,6 +360,9 @@ update_meta_data ()
- std::pair<unsigned, insn_info> p = *todo.rbegin ();
- todo.pop_back ();
-
-+// fprintf(stderr, "%d ", p.first);
-+// dump_insns("update");
-+
- insn_info ii = p.second;
-
- for (int pos = p.first; pos >= 0; --pos)
-@@ -655,9 +717,8 @@ propagate_moves ()
- REGNO(srci), REGNO(dsti));
-
- /* Move in front of loop and mark as dead. */
-- remove_insn (ii);
-- add_insn_after (ii, before, 0);
-- add_reg_note (ii, REG_DEAD, srci);
-+ rtx_insn * newii = make_insn_raw(PATTERN(ii));
-+ SET_INSN_DELETED(ii);
-
- /* Plus check if the reg was just loaded. */
- if (bset)
-@@ -665,22 +726,31 @@ propagate_moves ()
- rtx bdst = SET_DEST(bset);
- if (REG_P(bdst) && REGNO(bdst) == REGNO(srci))
- {
-- SET_DEST(bset) = dsti;
-- SET_INSN_DELETED(ii);
-+ SET_SRC(PATTERN(newii)) = SET_SRC(bset);
-+// SET_INSN_DELETED(ii);
- }
- }
-+ else
-+ add_reg_note (newii, REG_DEAD, srci);
-+
-+
-+ add_insn_after (newii, before, 0);
-+
-
- /* Move behind loop - into next BB. */
-- remove_insn (jj);
-- add_insn_before (jj, after, 0);
-+ rtx_insn * newjj = make_insn_raw(PATTERN(jj));
-+ add_insn_before (newjj, after, 0);
-+ SET_INSN_DELETED(jj);
-
- reg_reg.erase (j);
- reg_reg.erase (i);
- j = reg_reg.end ();
- inc = false;
-
-- df_insn_rescan (ii);
-- df_insn_rescan (jj);
-+// df_insn_rescan (ii);
-+// df_insn_rescan (jj);
-+ df_insn_rescan (newii);
-+ df_insn_rescan (newjj);
-
- /* add fixes if there were jumps out of the loop. */
- if (jump_out.size ())
-@@ -761,17 +831,11 @@ opt_strcpy ()
- int num_clobbers_to_add = 0;
- int insn_code_number;
-
-- SET_SRC(single_set(reg2x)) = SET_SRC(single_set (x2reg));
-- insn_code_number = recog (PATTERN (reg2x), reg2x, &num_clobbers_to_add);
--
-- if (insn_code_number < 0 || !check_asm_operands (reg2x))
-+ rtx_insn * newinsn = make_insn_raw (
-+ gen_rtx_SET(SET_DEST(single_set(reg2x)), SET_SRC(single_set (x2reg))));
-+ insn_code_number = recog (PATTERN (newinsn), newinsn, &num_clobbers_to_add);
-+ if (insn_code_number >= 0 && check_asm_operands (PATTERN (newinsn)))
- {
-- /* restore register. */
-- SET_SRC(single_set(reg2x)) = SET_DEST(single_set (x2reg));
-- }
-- else
-- {
--
- rtx link;
-
- fprintf (
-@@ -779,6 +843,8 @@ opt_strcpy ()
- ":bbb: opt_strcpy condition met, removing compare and joining insns - omit reg %d\n",
- REGNO(dst));
-
-+ SET_SRC(single_set(reg2x)) = SET_SRC(single_set (x2reg));
-+
- for (link = REG_NOTES(x2reg); link; link = XEXP(link, 1))
- if (REG_NOTE_KIND (link) != REG_LABEL_OPERAND)
- {
-@@ -935,16 +1001,20 @@ commute_add_move (void)
- rtx pinc = gen_rtx_POST_INC(GET_MODE(dst), reg1dst);
- rtx newmem = replace_equiv_address_nv (dst, pinc);
-
-+ rtx_insn * newinsn = make_insn_raw (gen_rtx_SET(reg1dst, reg1src));
-+ if (recog (PATTERN (newinsn), newinsn, 0) < 0 || !check_asm_operands (PATTERN (newinsn)))
-+ continue;
-+
- if (validate_change (next, &SET_DEST(set2), newmem, 0))
- {
-+ fprintf (stderr, ":bbb: commute_add_move found\n");
-+
- SET_INSN_DELETED(insn);
-
-- insn = emit_insn_before (gen_movsi (reg1dst, reg1src), next);
-+ insn = emit_insn_before (newinsn, next);
-
- add_reg_note (next, REG_INC, reg1dst);
-
-- fprintf (stderr, ":bbb: commute_add_move found\n");
--
- df_insn_rescan (insn);
- df_insn_rescan (next);
-
-@@ -1037,18 +1107,11 @@ const_cmp_to_sub (void)
- rtx reg = dstp == left ? right : left;
- rtx plus = gen_rtx_PLUS(mode, reg, gen_rtx_CONST_INT (mode, intval));
-
-- SET_SRC(setp) = plus;
-- SET_DEST(setp) = reg;
-+ rtx_insn * neuprev = make_insn_raw (gen_rtx_SET(reg, plus));
-
- int num_clobbers_to_add = 0;
-- int insn_code_number = recog (PATTERN (prev), prev, &num_clobbers_to_add);
-- if (insn_code_number >= 0 && !check_asm_operands (prev))
-- insn_code_number = -1;
--
-- SET_SRC(setp) = srcp;
-- SET_DEST(setp) = dstp;
--
-- if (insn_code_number < 0)
-+ int insn_code_number = recog (PATTERN (neuprev), neuprev, &num_clobbers_to_add);
-+ if (insn_code_number >= 0 && !check_asm_operands (PATTERN (neuprev)))
- continue;
-
- // also convert current statement to cmp #0, reg
-@@ -1058,11 +1121,11 @@ const_cmp_to_sub (void)
- add_reg_note (insn, REG_DEAD, reg);
-
- SET_INSN_DELETED(prev);
-- neu = gen_rtx_SET(reg, plus);
-- prev = emit_insn_before (neu, insn);
-+ prev = emit_insn_before (neuprev, insn);
-
- // urks - unknown side effects
- // int omitted_regno = REGNO(dstp);
-+// cselib_invalidate_rtx (dstp);
- // if (!(df->hard_regs_live_count[omitted_regno] -= 2))
- // df_set_regs_ever_live (omitted_regno, false);
-
-@@ -1159,7 +1222,7 @@ elim_dead_assign (void)
- if (!REG_P(dst) || !REG_P(src))
- continue;
-
-- if (!infos[index].is_use (REGNO(dst)))
-+ if (is_reg_dead(REGNO(dst),index))
- {
- fprintf (stderr, ":bbb: elim_dead_assign to %d\n", REGNO(dst));
- SET_INSN_DELETED(insn);
-@@ -1227,7 +1290,7 @@ merge_add (void)
- if (REGNO(dst1) != REGNO(dst2) || REGNO(r2) != REGNO(dst3))
- continue;
-
-- fprintf (stderr, ": merge_add pattern found\n");
-+ fprintf (stderr, ":bbb: merge_add applied\n");
-
- SET_SRC(set1) = l1;
- remove_insn (ins2);
-@@ -1242,60 +1305,82 @@ merge_add (void)
- static unsigned
- bb_reg_rename (void)
- {
-- unsigned change_count = 0;
-+ dump_insns("bb_reg_rename");
- for (unsigned index = 0; index < insns.size (); ++index)
- {
-- }
-- return change_count;
--}
-+ insn_info & ii = infos[index];
-+ const unsigned def = ii._def;
-+ unsigned mask = ii.get_def_mask ();
-
--/* Main entry point to the pass. */
--static unsigned int
--execute_bbb_optimizations (void)
--{
-- df_set_flags (DF_LR_RUN_DCE + DF_DEFER_INSN_RESCAN);
-- df_note_add_problem ();
-- df_analyze ();
-+ if (!mask)
-+ continue;
-
-- update_meta_data ();
-+ std::vector<unsigned> found;
-+ std::vector<unsigned> todo;
-+ if (index + 1 < insns.size ())
-+ todo.push_back (index + 1);
-
-- for (;;)
-- {
-- int done = 1;
-- if (propagate_moves ())
-- done = 0, update_meta_data ();
-+ found.push_back (index);
-+ /* a register was defined, follow all branches. */
-+ while (todo.size ())
-+ {
-+ unsigned pos = todo[todo.size () - 1];
-+ todo.pop_back ();
-
-- if (offset_2_autoinc ())
-- done = 0, update_meta_data ();
-+ insn_info & jj = infos[pos];
-+ /* defined again. */
-+ if (jj._def & def)
-+ continue;
-
-- if (opt_strcpy ())
-- done = 0, update_meta_data ();
-+ /* not referenced. */
-+ if (!(jj._use & def))
-+ continue;
-
-- if (commute_add_move ())
-- done = 0, update_meta_data ();
-+ /* update free regs. */
-+ mask &= ~jj._use;
-+ if (!mask)
-+ break;
-
-- if (const_cmp_to_sub ())
-- done = 0, update_meta_data ();
-+ found.push_back (pos);
-
-- if (merge_add ())
-- done = 0, update_meta_data ();
-+ /* follow jump and/or next insn. */
-+ rtx_insn * insn = insns[index];
-+ if (JUMP_P(insn))
-+ {
-+ std::map<rtx_insn *, unsigned>::iterator j = insn2index.find ((rtx_insn *) JUMP_LABEL(insn));
-+ if (j != insn2index.end ())
-+ todo.push_back (j->second);
-
-- if (elim_dead_assign ())
-- done = 0, update_meta_data ();
-+ rtx jmppattern = PATTERN (insn);
-
-- if (bb_reg_rename ())
-- done = 0, update_meta_data ();
-+ rtx jmpsrc = XEXP(jmppattern, 1);
-+ if (GET_CODE(jmpsrc) == IF_THEN_ELSE)
-+ if (pos + 1 < insns.size ())
-+ todo.push_back (pos + 1);
-+ }
-+ else if (pos + 1 < insns.size ())
-+ todo.push_back (pos + 1);
-+ }
-
-- if (done)
-- break;
-- }
-+ if (mask)
-+ {
-+ int oldregno = bit2regno (def);
-+ int newregno = bit2regno (mask);
-+ fprintf (stderr, ":bbb: bb_reg_rename %d -> %d\n", oldregno, newregno);
-
--// dump_insns ("bbb 1");
-- clear ();
-+ for (std::vector<unsigned>::iterator i = found.begin (); i != found.end (); ++i)
-+ do_reg_rename (PATTERN (insns[*i]), oldregno, newregno);
-
-+ cselib_invalidate_rtx (gen_raw_REG (SImode, oldregno));
-+ cselib_invalidate_rtx (gen_raw_REG (SImode, newregno));
-+ return 1;
-+ }
-+ }
- return 0;
- }
-
-+extern class opt_pass * global_pass_regrename;
-+
- namespace
- {
-
-@@ -1315,7 +1400,7 @@ namespace
- {
- public:
- pass_bbb_optimizations (gcc::context *ctxt) :
-- rtl_opt_pass (pass_data_bbb_optimizations, ctxt)
-+ rtl_opt_pass (pass_data_bbb_optimizations, ctxt), pp (0)
- {
- }
-
-@@ -1323,7 +1408,7 @@ namespace
- virtual bool
- gate (function *)
- {
-- return TARGET_AMIGA; // && flag_bbb_opts;
-+ return TARGET_AMIGA && flag_bbb_opts;
- }
-
- virtual unsigned int
-@@ -1335,13 +1420,81 @@ namespace
- opt_pass *
- clone ()
- {
-- return new pass_bbb_optimizations (m_ctxt);
-+ pass_bbb_optimizations * bbb = new pass_bbb_optimizations (m_ctxt);
-+ // bbb->pp = pp + 1;
-+ return bbb;
- }
-
-+ unsigned int pp;
-+
-+ unsigned
-+ execute_bbb_optimizations (void);
- };
- // class pass_bbb_optimizations
-
--}// anon namespace
-+
-+ /* Main entry point to the pass. */
-+ unsigned
-+ pass_bbb_optimizations::execute_bbb_optimizations (void)
-+ {
-+ df_set_flags (DF_LR_RUN_DCE + DF_DEFER_INSN_RESCAN);
-+ df_note_add_problem ();
-+ df_analyze ();
-+
-+ update_meta_data ();
-+
-+ bool do_opt_strcpy = strchr(flag_bbb_opts, 's') || strchr(flag_bbb_opts, '*');
-+ bool do_commute_add_move = strchr(flag_bbb_opts, 'a') || strchr(flag_bbb_opts, '*');
-+ bool do_propagate_moves = strchr(flag_bbb_opts, 'p') || strchr(flag_bbb_opts, '*');
-+ bool do_const_cmp_to_sub = strchr(flag_bbb_opts, 'c') || strchr(flag_bbb_opts, '*');
-+ bool do_merge_add = strchr(flag_bbb_opts, 'm') || strchr(flag_bbb_opts, '*');
-+ bool do_elim_dead_assign = strchr(flag_bbb_opts, 'e') || strchr(flag_bbb_opts, '*');
-+ bool do_bb_reg_rename = strchr(flag_bbb_opts, 'r') || strchr(flag_bbb_opts, '*');
-+
-+
-+ for (;;)
-+ {
-+ int done = 1;
-+ if (do_opt_strcpy && opt_strcpy ())
-+ done = 0, update_meta_data ();
-+
-+ if (do_commute_add_move && commute_add_move ())
-+ done = 0, update_meta_data ();
-+
-+ if (do_propagate_moves && propagate_moves ())
-+ done = 0, update_meta_data ();
-+
-+// if (offset_2_autoinc ())
-+// done = 0, update_meta_data ();
-+
-+ if (do_const_cmp_to_sub && const_cmp_to_sub ())
-+ done = 0, update_meta_data ();
-+
-+ if (do_merge_add && merge_add ())
-+ done = 0, update_meta_data ();
-+
-+ if (do_elim_dead_assign && elim_dead_assign ())
-+ done = 0, update_meta_data ();
-+
-+// if (do_bb_reg_rename && bb_reg_rename ())
-+// done = 0, update_meta_data ();
-+ if (done)
-+ break;
-+ }
-+
-+ if (do_bb_reg_rename && ::global_pass_regrename)
-+ {
-+ class opt_pass * rr = ::global_pass_regrename->clone();
-+ rr->execute(0);
-+ }
-+
-+ if (strchr(flag_bbb_opts, 'X')) dump_insns ("bbb 1");
-+ clear ();
-+
-+ return 0;
-+ }
-+
-+} // anon namespace
-
- rtl_opt_pass *
- make_pass_bbb_optimizations (gcc::context * ctxt)
-diff --git a/gcc/regrename.c b/gcc/regrename.c
-index 4ba825e8d8e8..696e5557780e 100755
---- gcc/regrename.c
-+++ gcc/regrename.c
-@@ -1913,6 +1913,8 @@ regrename_optimize (void)
- return 0;
- }
-
-+class opt_pass * global_pass_regrename;
-+
- namespace {
-
- const pass_data pass_data_regrename =
-@@ -1927,13 +1929,14 @@ const pass_data pass_data_regrename =
- 0, /* todo_flags_start */
- TODO_df_finish, /* todo_flags_finish */
- };
--
- class pass_regrename : public rtl_opt_pass
- {
- public:
- pass_regrename (gcc::context *ctxt)
- : rtl_opt_pass (pass_data_regrename, ctxt)
-- {}
-+ {
-+ ::global_pass_regrename = this;
-+ }
-
- /* opt_pass methods: */
- virtual bool gate (function *)
-@@ -1943,6 +1946,11 @@ class pass_regrename : public rtl_opt_pass
-
- virtual unsigned int execute (function *) { return regrename_optimize (); }
-
-+ opt_pass * clone ()
-+ {
-+ return new pass_regrename(m_ctxt);
-+ }
-+
- }; // class pass_regrename
-
- } // anon namespace
-
-From b747a5666a06f73ae8628788246f6d9e614f6393 Mon Sep 17 00:00:00 2001
-From: bebbo <bebbo(a)bejy.net>
-Date: Mon, 10 Apr 2017 10:46:07 +0200
-Subject: [PATCH 063/303] @B shrink_stack_frame starts working
-
----
- gcc/bbb-opts.c | 583 ++++++++++++++++++++++++++++++++++++++++++---------------
- gcc/passes.def | 1 -
- 2 files changed, 427 insertions(+), 157 deletions(-)
-
-diff --git a/gcc/bbb-opts.c b/gcc/bbb-opts.c
-index 737a5c00af3b..6114e2fa5ed0 100755
---- gcc/bbb-opts.c
-+++ gcc/bbb-opts.c
-@@ -111,15 +111,6 @@ struct insn_info
- return t;
- }
-
--// inline insn_info
--// operator & (insn_info const & o) const
--// {
--// insn_info t;
--// t._use = _use & o._use;
--// t._def = _def & o._def;
--// return t;
--// }
--
- inline insn_info &
- operator |= (insn_info const & o)
- {
-@@ -250,6 +241,7 @@ bit2regno (unsigned bit)
- * Collect some data.
- */
- static std::vector<rtx_insn *> insns;
-+static std::vector<rtx_insn *> temp;
- static std::vector<rtx_insn *> jumps;
- static std::map<rtx_insn *, unsigned> insn2index;
- static std::vector<insn_info> infos;
-@@ -272,15 +264,16 @@ clear (void)
- static bool
- is_reg_dead (unsigned regno, unsigned pos)
- {
-- for(;;) {
-- if (pos + 1 >= infos.size ())
-- return true;
--
-- rtx_insn * insn = insns[pos + 1];
-- if (!LABEL_P(insn) && GET_CODE(insn) != USE)
-- break;
-- ++pos;
-- }
-+ for (;;)
-+ {
-+ if (pos + 1 >= infos.size ())
-+ return true;
-+
-+ rtx_insn * insn = insns[pos + 1];
-+ if (!LABEL_P(insn) && GET_CODE(insn) != USE)
-+ break;
-+ ++pos;
-+ }
-
- insn_info & ii0 = infos[pos + 1];
- // not dead if usage is reported in the next statement
-@@ -292,14 +285,19 @@ is_reg_dead (unsigned regno, unsigned pos)
- * Sometimes used during debugging.
- */
- static void
--dump_insns (char const * name)
-+dump_insns (char const * name, bool all)
- {
- fprintf (stderr, "====================================: %s\n", name);
-+ if (all)
-+ {
-+ for (rtx_insn * insn = get_insns (); insn && insn != insns[0]; insn = NEXT_INSN (insn))
-+ debug_rtx (insn);
-+ }
- for (unsigned i = 0; i < insns.size (); ++i)
- {
- insn_info & ii = infos[i];
-
-- fprintf(stderr, "%d: ", i);
-+ fprintf (stderr, "%d: ", i);
-
- for (int j = 0; j < 8; ++j)
- if (ii.is_use (j))
-@@ -314,6 +312,13 @@ dump_insns (char const * name)
-
- fprintf (stderr, "\t");
- debug_rtx (insns[i]);
-+
-+ if (all)
-+ {
-+ rtx_insn * p = i + 1 < insns.size () ? insns[i + 1] : 0;
-+ for (rtx_insn * q = NEXT_INSN (insns[i]); q && q != p; q = NEXT_INSN (q))
-+ debug_rtx (q);
-+ }
- }
- }
-
-@@ -321,7 +326,7 @@ dump_insns (char const * name)
- * Create a filtered view of insns - keep only those to work with.
- */
- static void
--update_meta_data ()
-+update_insns ()
- {
- rtx_insn *insn, *next;
- clear ();
-@@ -342,7 +347,11 @@ update_meta_data ()
- insns.push_back (insn);
- }
- }
-+}
-
-+static void
-+update_insn_infos (void)
-+{
- /* prepare insn_info */
- insn_info ii;
- for (unsigned i = 0; i < insns.size (); ++i)
-@@ -360,14 +369,13 @@ update_meta_data ()
- std::pair<unsigned, insn_info> p = *todo.rbegin ();
- todo.pop_back ();
-
--// fprintf(stderr, "%d ", p.first);
--// dump_insns("update");
--
- insn_info ii = p.second;
-
- for (int pos = p.first; pos >= 0; --pos)
- {
- rtx_insn * insn = insns[pos];
-+ if (!insn) // moved to temp for stack frame cleanup
-+ continue;
-
- if (pass && infos[pos].contains (ii))
- break;
-@@ -487,7 +495,6 @@ update_meta_data ()
- }
- ++pass;
- }
--
- }
-
- /*
-@@ -717,7 +724,7 @@ propagate_moves ()
- REGNO(srci), REGNO(dsti));
-
- /* Move in front of loop and mark as dead. */
-- rtx_insn * newii = make_insn_raw(PATTERN(ii));
-+ rtx_insn * newii = make_insn_raw (PATTERN (ii));
- SET_INSN_DELETED(ii);
-
- /* Plus check if the reg was just loaded. */
-@@ -733,12 +740,10 @@ propagate_moves ()
- else
- add_reg_note (newii, REG_DEAD, srci);
-
--
- add_insn_after (newii, before, 0);
-
--
- /* Move behind loop - into next BB. */
-- rtx_insn * newjj = make_insn_raw(PATTERN(jj));
-+ rtx_insn * newjj = make_insn_raw (PATTERN (jj));
- add_insn_before (newjj, after, 0);
- SET_INSN_DELETED(jj);
-
-@@ -895,47 +900,6 @@ opt_strcpy ()
- return change_count;
- }
-
--/*
-- * Convert loops using a counting reg as offset with an address reg
-- * into a loop with auto inc address regs.
-- */
--static unsigned
--offset_2_autoinc (void)
--{
-- unsigned change_count = 0;
--#if 0
-- rtx_insn * reg_const = 0;
--
-- for (unsigned index = 0; index < insns.size (); ++index)
-- {
-- rtx_insn * insn = insns[index];
--
-- if (!next || !LABEL_P(next) || LABEL_NUSES(next) != 1)
-- continue;
--
-- if (!NONJUMP_INSN_P(insn))
-- continue;
--
-- rtx use = single_set (insn);
-- if (!use)
-- continue;
--
-- rtx reg = SET_DEST(use);
-- if (!REG_P(reg))
-- continue;
--
-- rtx val = SET_SRC(use);
--
--// fprintf(stderr, "possible start for offset_2_autoinc\n");
--// //debug_rtx(insn);
--// //debug_rtx(next);
--
-- }
--
--#endif
-- return change_count;
--}
--
- /*
- * convert
- *
-@@ -1052,7 +1016,7 @@ const_cmp_to_sub (void)
- {
- unsigned change_count = 0;
- #if HAVE_cc0
-- for (unsigned index = 1; index + 1 < insns.size (); ++index)
-+ for (unsigned index = insns.size () - 2; index > 0; --index)
- {
- rtx_insn * insn = insns[index];
- rtx seti = single_set (insn);
-@@ -1072,13 +1036,13 @@ const_cmp_to_sub (void)
- if (!REG_P(left) || !REG_P(right))
- continue;
-
--// if (!find_reg_note (insn, REG_DEAD, left) || !find_reg_note (insn, REG_DEAD, right))
--// continue;
--
- // TODO
- // FEATURE: check if the next uses are also a add/sub
- // then maybe that add/sub can be adjusted too
-
-+ // if (!find_reg_note (insn, REG_DEAD, left) || !find_reg_note (insn, REG_DEAD, right))
-+ // continue;
-+ // use own reg_dead
- if (!is_reg_dead (REGNO(left), index) || !is_reg_dead (REGNO(right), index))
- continue;
-
-@@ -1222,7 +1186,7 @@ elim_dead_assign (void)
- if (!REG_P(dst) || !REG_P(src))
- continue;
-
-- if (is_reg_dead(REGNO(dst),index))
-+ if (is_reg_dead (REGNO(dst), index))
- {
- fprintf (stderr, ":bbb: elim_dead_assign to %d\n", REGNO(dst));
- SET_INSN_DELETED(insn);
-@@ -1278,8 +1242,8 @@ merge_add (void)
- continue;
-
- rtx l1 = XEXP(src1, 0);
-- rtx l2 = XEXP(src2, 0);
-- rtx l3 = XEXP(src3, 0);
-+// rtx l2 = XEXP(src2, 0);
-+// rtx l3 = XEXP(src3, 0);
-
- rtx r1 = XEXP(src1, 1);
- rtx r2 = XEXP(src2, 1);
-@@ -1293,89 +1257,393 @@ merge_add (void)
- fprintf (stderr, ":bbb: merge_add applied\n");
-
- SET_SRC(set1) = l1;
-- remove_insn (ins2);
-- add_insn_after (ins2, ins3, 0);
-+ rtx_insn * newins2 = make_insn_raw (PATTERN (ins2));
-+ add_insn_after (newins2, ins3, 0);
-+ SET_INSN_DELETED(ins2);
-+ df_insn_rescan (ins1);
- }
- return change_count;
- }
-
--/*
-- * Always prefer lower register numbers within the class.
-+static void
-+clear_temp ()
-+{
-+ for (unsigned i = 0; i < temp.size (); ++i)
-+ if (temp[i])
-+ insns[i] = temp[i], temp[i] = 0;
-+}
-+
-+/**
-+ * 1. scan for all used registers.
-+ * 2. scan the stack from for omittable push/pop
-+ * 3. adjust stack frame + insns referring to stack pointer
-+ * typical code:
-+ subq.l #4,sp
-+ movem.l #16190,-(sp)
-+ move.l 52(sp),d2
-+ move.l 56(sp),d3
-+
-+ * or
-+ link a5,#4
-+ movem.l #16190,-(sp)
-+ move.l 8(a5),d2
-+ move.l 12(a5),d3
-+ *
-+ * => with a5 check only prolog/epilog
-+ * => without a5 adjust insns referring sp if offset > startoffset + current sp diff
-+ *
-+ * startvalue count(pushes)*4
-+ * newstartvalue = startvalue - omitted pushes
- */
- static unsigned
--bb_reg_rename (void)
-+shrink_stack_frame (void)
- {
-- dump_insns("bb_reg_rename");
-- for (unsigned index = 0; index < insns.size (); ++index)
-+ /* nothing to do. */
-+ if (!insns.size ())
-+ return 0;
-+
-+ temp.resize (insns.size ());
-+
-+ unsigned pos = 0;
-+ rtx_insn * insn = insns[pos];
-+ if (JUMP_P(insn)) /* return -> empty function*/
-+ return 0;
-+
-+ bool usea5 = false;
-+ unsigned paramstart = 4;
-+ /*
-+ * Move prologue to temp.
-+ * Only register push and parallel insn unless its a link a5 are moved.
-+ */
-+ rtx_insn * prev = get_insns ();
-+ for (; pos < insns.size ();)
- {
-- insn_info & ii = infos[index];
-- const unsigned def = ii._def;
-- unsigned mask = ii.get_def_mask ();
-+ insn = insns[pos];
-
-- if (!mask)
-- continue;
-+ /* check for prologue end. */
-+ for (; prev != insn; prev = NEXT_INSN (prev))
-+ if (NOTE_P(prev) && NOTE_KIND(prev) == NOTE_INSN_PROLOGUE_END)
-+ break;
-+ if (prev != insn)
-+ break;
-+
-+ rtx pattern = PATTERN (insn);
-+ if (GET_CODE(pattern) == PARALLEL)
-+ {
-+ rtx set = XVECEXP(pattern, 0, 0);
-+ rtx dst = SET_DEST(set);
-+ /* ignore link a5 */
-+ if (REG_P(dst) && REGNO(dst) == 13)
-+ usea5 = true;
-+ else
-+ {
-+ /* use movem */
-+ temp[pos] = insn;
-+ insns[pos] = 0;
-+ }
-+ ++pos;
-+ continue;
-+ }
-+ if (GET_CODE(pattern) != SET)
-+ {
-+ ++pos;
-+ continue;
-+ }
-+
-+ /* move only the push statements. */
-+ rtx src = SET_SRC(pattern);
-+ rtx dest = SET_DEST(pattern);
-+ if (REG_P(src))
-+ {
-+ if (MEM_P(dest))
-+ {
-+ rtx predec = XEXP(dest, 0);
-+ if (GET_CODE(predec) == PRE_DEC)
-+ {
-+ rtx reg = XEXP(predec, 0);
-+ if (REG_P(reg) && REGNO(reg) == 15)
-+ {
-+ temp[pos] = insn;
-+ insns[pos] = 0;
-+ }
-+ }
-+ }
-+ }
-+ else if (GET_CODE(src) == PLUS && REG_P(dest) && REGNO(dest) == 15)
-+ {
-+ /* check for stack variables. */
-+ rtx reg = XEXP(src, 0);
-+ rtx cx = XEXP(src, 1);
-+ if (REG_P(reg) && REGNO(reg) == 15 && CONST_INT_P(cx))
-+ paramstart -= INTVAL(cx);
-+ }
-+
-+ if (++pos >= insns.size ())
-+ {
-+ clear_temp ();
-+ return 0;
-+ }
-+ }
-
-- std::vector<unsigned> found;
-- std::vector<unsigned> todo;
-- if (index + 1 < insns.size ())
-- todo.push_back (index + 1);
-+ if (pos == 0)
-+ return 0;
-+
-+ unsigned prologueend = pos;
-
-- found.push_back (index);
-- /* a register was defined, follow all branches. */
-- while (todo.size ())
-+ /* search epilogues - there can be multiple epilogues. */
-+ while (pos < insns.size ())
-+ {
-+ while (pos < insns.size ())
- {
-- unsigned pos = todo[todo.size () - 1];
-- todo.pop_back ();
-+ insn = insns[pos];
-+ for (; prev != insn; prev = NEXT_INSN (prev))
-+ if (NOTE_P(prev) && NOTE_KIND(prev) == NOTE_INSN_EPILOGUE_BEG)
-+ break;
-
-- insn_info & jj = infos[pos];
-- /* defined again. */
-- if (jj._def & def)
-- continue;
-+ if (prev != insn)
-+ break;
-
-- /* not referenced. */
-- if (!(jj._use & def))
-- continue;
-+ ++pos;
-+ }
-
-- /* update free regs. */
-- mask &= ~jj._use;
-- if (!mask)
-+ /* move epilogues away. */
-+ for (; pos < insns.size (); ++pos)
-+ {
-+ insn = insns[pos];
-+ if (JUMP_P(insn)) /* return */
- break;
-
-- found.push_back (pos);
-+ if (LABEL_P(insn))
-+ break;
-
-- /* follow jump and/or next insn. */
-- rtx_insn * insn = insns[index];
-- if (JUMP_P(insn))
-+ /* omitt the frame pointer a5. */
-+ rtx pattern = PATTERN (insn);
-+ if (GET_CODE(pattern) == PARALLEL)
- {
-- std::map<rtx_insn *, unsigned>::iterator j = insn2index.find ((rtx_insn *) JUMP_LABEL(insn));
-- if (j != insn2index.end ())
-- todo.push_back (j->second);
-+ rtx set = XVECEXP(pattern, 0, 0);
-+ rtx dst = SET_DEST(set);
-+ /* unlink is last. */
-+ if (REG_P(dst) && REGNO(dst) == 13)
-+ break;
-+
-+ /* movem. */
-+ temp[pos] = insn;
-+ insns[pos] = 0;
-+ }
-+ else if (GET_CODE(pattern) == SET)
-+ {
-+ /* check for move (a7+), x */
-+ rtx src = SET_SRC(pattern);
-+ rtx dst = SET_DEST(pattern);
-+ if (REG_P(dst))
-+ {
-+ if (MEM_P(src))
-+ {
-+ rtx postinc = XEXP(src, 0);
-+ if (GET_CODE(postinc) == POST_INC)
-+ {
-+ rtx reg = XEXP(postinc, 0);
-+ if (REG_P(reg) && REGNO(reg) == 15)
-+ {
-+ temp[pos] = insn;
-+ insns[pos] = 0;
-+ }
-+ }
-+ }
-+ }
-+ }
-+ }
-+ ++pos;
-+ }
-+ /* gather usage stats without prologue/epilogue */
-+ update_insn_infos ();
-+ insn_info ii;
-+ for (unsigned i = 0; i < infos.size (); ++i)
-+ ii |= infos[i];
-+ unsigned freemask = ~ii._use;
-
-- rtx jmppattern = PATTERN (insn);
-+ rtx a7 = gen_raw_REG (SImode, 15);
-
-- rtx jmpsrc = XEXP(jmppattern, 1);
-- if (GET_CODE(jmpsrc) == IF_THEN_ELSE)
-- if (pos + 1 < insns.size ())
-- todo.push_back (pos + 1);
-+ unsigned adjust = 0;
-+ /* now all push/pop insns are in temp. */
-+ for (unsigned i = 0; i < temp.size (); ++i)
-+ {
-+ insn = temp[i];
-+ if (!insn)
-+ continue;
-+
-+ rtx pattern = PATTERN (insn);
-+ /* check the pushed regs, either a vector or single statements */
-+ if (GET_CODE(pattern) == PARALLEL)
-+ {
-+ std::vector<rtx> regs;
-+ std::vector<rtx> clobbers;
-+ for (int j = 0; j < XVECLEN(pattern, 0); ++j)
-+ {
-+ rtx set = XVECEXP(pattern, 0, j);
-+ if (GET_CODE(set) == CLOBBER)
-+ {
-+ clobbers.push_back (set);
-+ continue;
-+ }
-+ rtx src = SET_SRC(set);
-+ rtx dst = SET_DEST(set);
-+ rtx reg;
-+ if (MEM_P(src))
-+ reg = dst;
-+ else if (MEM_P(dst))
-+ reg = src;
-+ else
-+ continue;
-+
-+ if (i < prologueend)
-+ paramstart += 4;
-+ unsigned regbit = 1 << REGNO(reg);
-+ if (freemask & regbit)
-+ {
-+ fprintf (stderr, i < prologueend ? "remove push for %d\n" : "remove pop for %d\n", REGNO(reg));
-+ if (i < prologueend)
-+ adjust += 4;
-+ }
-+ else
-+ regs.push_back (reg);
-+ }
-+
-+ /* don't touch - clobbers! */
-+ if (clobbers.size())
-+ continue;
-+
-+ if ((int) regs.size () + 1 < XVECLEN(pattern, 0) || regs.size () <= 2)
-+ {
-+ if (regs.size () <= 2)
-+ {
-+ for (unsigned k = 0; k < regs.size (); ++k)
-+ {
-+ rtx reg = regs[k];
-+ if (i < prologueend)
-+ {
-+ /* push */
-+ rtx dec = gen_rtx_PRE_DEC(SImode, a7);
-+ rtx mem = gen_rtx_MEM (SImode, dec);
-+ rtx set = gen_rtx_SET(mem, reg);
-+ emit_insn_after (set, insn);
-+ }
-+ else
-+ {
-+ /* pop */
-+ rtx dec = gen_rtx_POST_INC(SImode, a7);
-+ rtx mem = gen_rtx_MEM (SImode, dec);
-+ rtx set = gen_rtx_SET(reg, mem);
-+ emit_insn_before (set, insn);
-+ }
-+ }
-+ }
-+ else
-+ {
-+ rtx parallel = gen_rtx_PARALLEL(VOIDmode, rtvec_alloc (regs.size () + 1));
-+ int x = regs.size () * 4 + 4;
-+
-+ rtx plus = gen_rtx_PLUS(SImode, a7, gen_rtx_CONST_INT (SImode, i < prologueend ? -x : x));
-+ XVECEXP(parallel, 0, 0) = gen_rtx_SET(a7, plus);
-+
-+ if (i >= prologueend)
-+ x = 0;
-+
-+ for (unsigned k = 0; k < regs.size (); ++k)
-+ {
-+ if (i < prologueend)
-+ {
-+ /* push */
-+ plus = gen_rtx_PLUS(SImode, a7, gen_rtx_CONST_INT (SImode, -x));
-+ x -= 4;
-+ rtx mem = gen_rtx_MEM (SImode, plus);
-+ rtx set = gen_rtx_SET(mem, regs[k]);
-+ XVECEXP(parallel, 0, k + 1) = set;
-+ }
-+ else
-+ {
-+ /* pop */
-+ plus = x ? gen_rtx_PLUS(SImode, a7, gen_rtx_CONST_INT (SImode, x)) : a7;
-+ x += 4;
-+ rtx mem = gen_rtx_MEM (SImode, plus);
-+ rtx set = gen_rtx_SET(regs[k], mem);
-+ XVECEXP(parallel, 0, k + 1) = set;
-+ }
-+ }
-+ emit_insn_after (parallel, insn);
-+ }
-+ SET_INSN_DELETED(insn);
-+ }
-+ }
-+ else
-+ {
-+ rtx set = PATTERN (insn);
-+
-+ if (i < prologueend)
-+ {
-+ /* move x,-(a7). */
-+ paramstart += 4;
-+ rtx src = SET_SRC(set);
-+ unsigned regbit = 1 << REGNO(src);
-+ if (freemask & regbit)
-+ {
-+ adjust += 4;
-+ fprintf (stderr, "remove push for %d\n", REGNO(src));
-+ SET_INSN_DELETED(insn);
-+ }
-+ }
-+ else
-+ {
-+ /* move (a7)+,x */
-+ rtx dst = SET_DEST(set);
-+ unsigned regbit = 1 << REGNO(dst);
-+ if (freemask & regbit)
-+ {
-+ fprintf (stderr, "remove pop for %d\n", REGNO(dst));
-+ SET_INSN_DELETED(insn);
-+ }
- }
-- else if (pos + 1 < insns.size ())
-- todo.push_back (pos + 1);
- }
-+ }
-
-- if (mask)
-+ /* fix sp offsets. */
-+ if (!usea5 && adjust)
-+ {
-+ for (unsigned index = 0; index < insns.size (); ++index)
- {
-- int oldregno = bit2regno (def);
-- int newregno = bit2regno (mask);
-- fprintf (stderr, ":bbb: bb_reg_rename %d -> %d\n", oldregno, newregno);
-+ insn = insns[index];
-+ if (!insn || !INSN_P(insn))
-+ continue;
-
-- for (std::vector<unsigned>::iterator i = found.begin (); i != found.end (); ++i)
-- do_reg_rename (PATTERN (insns[*i]), oldregno, newregno);
-+ rtx set = single_set (insn);
-+ if (!set)
-+ continue;
-
-- cselib_invalidate_rtx (gen_raw_REG (SImode, oldregno));
-- cselib_invalidate_rtx (gen_raw_REG (SImode, newregno));
-- return 1;
-+ rtx mem = SET_SRC(set);
-+ if (MEM_P(mem))
-+ {
-+ rtx plus = XEXP(mem, 0);
-+ if (GET_CODE(plus) == PLUS)
-+ {
-+ rtx sp = XEXP(plus, 0);
-+ if (REG_P(sp) && REGNO(sp) == 15)
-+ {
-+ rtx c = XEXP(plus, 1);
-+ if (CONST_INT_P(c))
-+ {
-+ int n = INTVAL(c);
-+ if (n >= paramstart)
-+ XEXP(plus, 1) = gen_rtx_CONST_INT (SImode, n - adjust);
-+ }
-+ }
-+ }
-+ }
- }
- }
-+
-+ /* restore stack insns */
-+ clear_temp ();
-+
- return 0;
- }
-
-@@ -1420,7 +1688,7 @@ namespace
- opt_pass *
- clone ()
- {
-- pass_bbb_optimizations * bbb = new pass_bbb_optimizations (m_ctxt);
-+ pass_bbb_optimizations * bbb = new pass_bbb_optimizations (m_ctxt);
- // bbb->pp = pp + 1;
- return bbb;
- }
-@@ -1432,7 +1700,6 @@ namespace
- };
- // class pass_bbb_optimizations
-
--
- /* Main entry point to the pass. */
- unsigned
- pass_bbb_optimizations::execute_bbb_optimizations (void)
-@@ -1441,54 +1708,58 @@ namespace
- df_note_add_problem ();
- df_analyze ();
-
-- update_meta_data ();
--
-- bool do_opt_strcpy = strchr(flag_bbb_opts, 's') || strchr(flag_bbb_opts, '*');
-- bool do_commute_add_move = strchr(flag_bbb_opts, 'a') || strchr(flag_bbb_opts, '*');
-- bool do_propagate_moves = strchr(flag_bbb_opts, 'p') || strchr(flag_bbb_opts, '*');
-- bool do_const_cmp_to_sub = strchr(flag_bbb_opts, 'c') || strchr(flag_bbb_opts, '*');
-- bool do_merge_add = strchr(flag_bbb_opts, 'm') || strchr(flag_bbb_opts, '*');
-- bool do_elim_dead_assign = strchr(flag_bbb_opts, 'e') || strchr(flag_bbb_opts, '*');
-- bool do_bb_reg_rename = strchr(flag_bbb_opts, 'r') || strchr(flag_bbb_opts, '*');
-+ update_insns ();
-
-+ bool do_opt_strcpy = strchr (flag_bbb_opts, 's') || strchr (flag_bbb_opts, '*');
-+ bool do_commute_add_move = strchr (flag_bbb_opts, 'a') || strchr (flag_bbb_opts, '*');
-+ bool do_propagate_moves = strchr (flag_bbb_opts, 'p') || strchr (flag_bbb_opts, '*');
-+ bool do_const_cmp_to_sub = strchr (flag_bbb_opts, 'c') || strchr (flag_bbb_opts, '*');
-+ bool do_merge_add = strchr (flag_bbb_opts, 'm') || strchr (flag_bbb_opts, '*');
-+ bool do_elim_dead_assign = strchr (flag_bbb_opts, 'e') || strchr (flag_bbb_opts, '*');
-+ bool do_bb_reg_rename = strchr (flag_bbb_opts, 'r') || strchr (flag_bbb_opts, '*');
-+ bool do_shrink_stack_frame = strchr (flag_bbb_opts, 'f') || strchr (flag_bbb_opts, '*');
-
- for (;;)
- {
- int done = 1;
- if (do_opt_strcpy && opt_strcpy ())
-- done = 0, update_meta_data ();
-+ done = 0, update_insns ();
-
- if (do_commute_add_move && commute_add_move ())
-- done = 0, update_meta_data ();
-+ done = 0, update_insns ();
-
- if (do_propagate_moves && propagate_moves ())
-- done = 0, update_meta_data ();
--
--// if (offset_2_autoinc ())
--// done = 0, update_meta_data ();
-+ done = 0, update_insns ();
-
-+ update_insn_infos ();
- if (do_const_cmp_to_sub && const_cmp_to_sub ())
-- done = 0, update_meta_data ();
-+ done = 0, update_insns (), update_insn_infos ();
-
- if (do_merge_add && merge_add ())
-- done = 0, update_meta_data ();
-+ done = 0, update_insns (), update_insn_infos ();
-
- if (do_elim_dead_assign && elim_dead_assign ())
-- done = 0, update_meta_data ();
-+ done = 0, update_insns ();
-
--// if (do_bb_reg_rename && bb_reg_rename ())
--// done = 0, update_meta_data ();
- if (done)
- break;
- }
-
- if (do_bb_reg_rename && ::global_pass_regrename)
- {
-- class opt_pass * rr = ::global_pass_regrename->clone();
-- rr->execute(0);
-+ class opt_pass * rr = ::global_pass_regrename->clone ();
-+ rr->execute (0);
-+ update_insns ();
-+ }
-+
-+ if (do_shrink_stack_frame)
-+ {
-+ shrink_stack_frame ();
-+ update_insns ();
- }
-
-- if (strchr(flag_bbb_opts, 'X')) dump_insns ("bbb 1");
-+ if (strchr (flag_bbb_opts, 'X') || strchr (flag_bbb_opts, 'x'))
-+ dump_insns ("bbb 1", strchr (flag_bbb_opts, 'X'));
- clear ();
-
- return 0;
-diff --git a/gcc/passes.def b/gcc/passes.def
-index ca5b94552d4e..5b78cbd7fb38 100644
---- gcc/passes.def
-+++ gcc/passes.def
-@@ -446,7 +446,6 @@ along with GCC; see the file COPYING3. If not see
- NEXT_PASS (pass_split_after_reload);
- NEXT_PASS (pass_ree);
- NEXT_PASS (pass_compare_elim_after_reload);
-- NEXT_PASS (pass_bbb_optimizations);
- NEXT_PASS (pass_branch_target_load_optimize1);
- NEXT_PASS (pass_jump2);
- NEXT_PASS (pass_duplicate_computed_gotos);
-
-From dcfedefbc4883ebaf068b40920b7830971d02923 Mon Sep 17 00:00:00 2001
-From: bebbo <bebbo(a)bejy.net>
-Date: Tue, 11 Apr 2017 18:01:13 +0200
-Subject: [PATCH 064/303] @B various bugs, shrink stack frame supports also
- fp-regs
-
----
- gcc/bbb-opts.c | 300 +++++++++++++++++++++++++++++++++++++++++++++------------
- 1 file changed, 238 insertions(+), 62 deletions(-)
-
-diff --git a/gcc/bbb-opts.c b/gcc/bbb-opts.c
-index 6114e2fa5ed0..c688ca8ae192 100755
---- gcc/bbb-opts.c
-+++ gcc/bbb-opts.c
-@@ -43,9 +43,11 @@
- #include "recog.h"
- #include "cfgrtl.h"
- #include "emit-rtl.h"
-+#include "tree.h"
- #include "tree-pass.h"
- #include "conditions.h"
- #include "cselib.h"
-+#include "langhooks.h"
- #include <vector>
- #include <map>
-
-@@ -158,10 +160,16 @@ struct insn_info
- unsigned
- get_def_mask () const
- {
-- if (!_def || _def > 0xffff)
-+ if (!_def || _def > 0x7fff)
- return 0;
-
- unsigned mask = _def - 1;
-+ /* more than one register -> don't touch. */
-+ if ((mask & ~_def) != mask)
-+ return 0;
-+
-+ if (_def > 0x1000)
-+ return 0;
- if (_def > 0xff)
- mask &= 0xff00;
- return mask;
-@@ -349,6 +357,19 @@ update_insns ()
- }
- }
-
-+extern struct lang_hooks lang_hooks;
-+extern tree current_function_decl;
-+static char const *
-+getCurrentFunctionName ()
-+{
-+ static char fxname[512];
-+ if (current_function_decl == NULL)
-+ strcpy (fxname, "<toplevel>");
-+ else
-+ strcpy (fxname, lang_hooks.decl_printable_name (current_function_decl, 2));
-+ return fxname;
-+}
-+
- static void
- update_insn_infos (void)
- {
-@@ -401,24 +422,44 @@ update_insn_infos (void)
-
- if (CALL_P(insn))
- {
-+ insn_info def;
-+ insn_info use;
-+
- /* a call sets d0 and maybe also d1,a0,a1. */
-- ii.unset (0);
-- ii.unset (1);
-- ii.unset (8);
-- ii.unset (9);
-+ if (ii.is_use(0))
-+ def.def (0);
-+ if (ii.is_use (1))
-+ {
-+ fprintf (stderr, ":bbb: use of d1 after call in %s\n", getCurrentFunctionName ());
-+ def.def (1);
-+ }
-+ if (ii.is_use (8))
-+ {
-+ fprintf (stderr, ":bbb: use of a0 after call in %s\n", getCurrentFunctionName ());
-+ def.def (8);
-+ }
-+ if (ii.is_use (9))
-+ {
-+ fprintf (stderr, ":bbb: use of a1 after call in %s\n", getCurrentFunctionName ());
-+ def.def (9);
-+ }
-
- // FIXME: isuse the DECL and read attributes.
- // use regs depending on flag mregparm
- for (int i = 0; i < amigaos_regparm; ++i)
- {
-- ii.use (i);
-- ii.use (i + 8);
-+ use.use (i);
-+ use.use (i + 8);
- }
-
- // check for reg use
-- ii.scan (pattern);
-+ use.scan (pattern);
-+
-+ infos[pos] = def | use | ii;
-+
-+ ii &= ~def;
-+ ii |= use;
-
-- infos[pos] = ii;
- continue;
- }
-
-@@ -720,8 +761,9 @@ propagate_moves ()
- rtx_insn * after = insns[index + 1];
- rtx bset = single_set (before);
-
-- fprintf (stderr, ":bbb: propagate_moves condition met, moving regs %d, %d\n",
-- REGNO(srci), REGNO(dsti));
-+ fprintf (stderr, ":bbb: propagate_moves condition met, moving regs %s, %s\n",
-+ reg_names[REGNO(srci)],
-+ reg_names[REGNO(dsti)]);
-
- /* Move in front of loop and mark as dead. */
- rtx_insn * newii = make_insn_raw (PATTERN (ii));
-@@ -752,8 +794,6 @@ propagate_moves ()
- j = reg_reg.end ();
- inc = false;
-
--// df_insn_rescan (ii);
--// df_insn_rescan (jj);
- df_insn_rescan (newii);
- df_insn_rescan (newjj);
-
-@@ -813,11 +853,17 @@ opt_strcpy ()
- rtx_insn * insn = insns[index];
-
- if (!NONJUMP_INSN_P(insn))
-- continue;
-+ {
-+ x2reg = 0;
-+ continue;
-+ }
-
- rtx set = single_set (insn);
- if (!set)
-- continue;
-+ {
-+ x2reg = 0;
-+ continue;
-+ }
-
- if (x2reg && reg2x)
- {
-@@ -845,8 +891,8 @@ opt_strcpy ()
-
- fprintf (
- stderr,
-- ":bbb: opt_strcpy condition met, removing compare and joining insns - omit reg %d\n",
-- REGNO(dst));
-+ ":bbb: opt_strcpy condition met, removing compare and joining insns - omit reg %s\n",
-+ reg_names[REGNO(dst)]);
-
- SET_SRC(single_set(reg2x)) = SET_SRC(single_set (x2reg));
-
-@@ -1040,15 +1086,12 @@ const_cmp_to_sub (void)
- // FEATURE: check if the next uses are also a add/sub
- // then maybe that add/sub can be adjusted too
-
-- // if (!find_reg_note (insn, REG_DEAD, left) || !find_reg_note (insn, REG_DEAD, right))
-- // continue;
-- // use own reg_dead
-+// if (!find_reg_note (insn, REG_DEAD, left) || !find_reg_note (insn, REG_DEAD, right))
-+// continue;
-+ /* use own reg_dead - reg_notes seem to be inaccurate!? */
- if (!is_reg_dead (REGNO(left), index) || !is_reg_dead (REGNO(right), index))
- continue;
-
-- fprintf (stderr, ":bbb: found reg-reg compare with both dead: %d %d\n", is_reg_dead (REGNO(left), index),
-- is_reg_dead (REGNO(right), index));
--
- // maybe add a search?
- rtx_insn * prev = insns[index - 1];
- rtx setp = single_set (prev);
-@@ -1087,12 +1130,6 @@ const_cmp_to_sub (void)
- SET_INSN_DELETED(prev);
- prev = emit_insn_before (neuprev, insn);
-
--// urks - unknown side effects
--// int omitted_regno = REGNO(dstp);
--// cselib_invalidate_rtx (dstp);
--// if (!(df->hard_regs_live_count[omitted_regno] -= 2))
--// df_set_regs_ever_live (omitted_regno, false);
--
- fprintf (stderr, ":bbb: const_cmp_to_sub replaced reg-reg compare with sub\n");
-
- if (dstp != left)
-@@ -1188,7 +1225,7 @@ elim_dead_assign (void)
-
- if (is_reg_dead (REGNO(dst), index))
- {
-- fprintf (stderr, ":bbb: elim_dead_assign to %d\n", REGNO(dst));
-+ fprintf (stderr, ":bbb: elim_dead_assign to %s\n", reg_names[REGNO(dst)]);
- SET_INSN_DELETED(insn);
- ++change_count;
- }
-@@ -1311,6 +1348,8 @@ shrink_stack_frame (void)
-
- bool usea5 = false;
- unsigned paramstart = 4;
-+ int a5offset = 0;
-+
- /*
- * Move prologue to temp.
- * Only register push and parallel insn unless its a link a5 are moved.
-@@ -1333,8 +1372,12 @@ shrink_stack_frame (void)
- rtx set = XVECEXP(pattern, 0, 0);
- rtx dst = SET_DEST(set);
- /* ignore link a5 */
-- if (REG_P(dst) && REGNO(dst) == 13)
-- usea5 = true;
-+ if (REG_P(dst) && REGNO(dst) == FRAME_POINTER_REGNUM)
-+ {
-+ usea5 = true;
-+ set = XVECEXP(pattern, 0, 2);
-+ a5offset = INTVAL(XEXP(SET_SRC(set), 1));
-+ }
- else
- {
- /* use movem */
-@@ -1361,7 +1404,7 @@ shrink_stack_frame (void)
- if (GET_CODE(predec) == PRE_DEC)
- {
- rtx reg = XEXP(predec, 0);
-- if (REG_P(reg) && REGNO(reg) == 15)
-+ if (REG_P(reg) && REGNO(reg) == STACK_POINTER_REGNUM)
- {
- temp[pos] = insn;
- insns[pos] = 0;
-@@ -1369,12 +1412,12 @@ shrink_stack_frame (void)
- }
- }
- }
-- else if (GET_CODE(src) == PLUS && REG_P(dest) && REGNO(dest) == 15)
-+ else if (GET_CODE(src) == PLUS && REG_P(dest) && REGNO(dest) == STACK_POINTER_REGNUM)
- {
- /* check for stack variables. */
- rtx reg = XEXP(src, 0);
- rtx cx = XEXP(src, 1);
-- if (REG_P(reg) && REGNO(reg) == 15 && CONST_INT_P(cx))
-+ if (REG_P(reg) && REGNO(reg) == STACK_POINTER_REGNUM && CONST_INT_P(cx))
- paramstart -= INTVAL(cx);
- }
-
-@@ -1390,6 +1433,8 @@ shrink_stack_frame (void)
-
- unsigned prologueend = pos;
-
-+ prev = insn;
-+
- /* search epilogues - there can be multiple epilogues. */
- while (pos < insns.size ())
- {
-@@ -1406,6 +1451,7 @@ shrink_stack_frame (void)
- ++pos;
- }
-
-+
- /* move epilogues away. */
- for (; pos < insns.size (); ++pos)
- {
-@@ -1423,7 +1469,7 @@ shrink_stack_frame (void)
- rtx set = XVECEXP(pattern, 0, 0);
- rtx dst = SET_DEST(set);
- /* unlink is last. */
-- if (REG_P(dst) && REGNO(dst) == 13)
-+ if (REG_P(dst) && REGNO(dst) == FRAME_POINTER_REGNUM)
- break;
-
- /* movem. */
-@@ -1443,7 +1489,7 @@ shrink_stack_frame (void)
- if (GET_CODE(postinc) == POST_INC)
- {
- rtx reg = XEXP(postinc, 0);
-- if (REG_P(reg) && REGNO(reg) == 15)
-+ if (REG_P(reg) && REGNO(reg) == STACK_POINTER_REGNUM)
- {
- temp[pos] = insn;
- insns[pos] = 0;
-@@ -1453,6 +1499,7 @@ shrink_stack_frame (void)
- }
- }
- }
-+ prev = insn;
- ++pos;
- }
- /* gather usage stats without prologue/epilogue */
-@@ -1462,7 +1509,8 @@ shrink_stack_frame (void)
- ii |= infos[i];
- unsigned freemask = ~ii._use;
-
-- rtx a7 = gen_raw_REG (SImode, 15);
-+ rtx a7 = gen_raw_REG (SImode, STACK_POINTER_REGNUM);
-+ rtx a5 = gen_raw_REG (SImode, FRAME_POINTER_REGNUM);
-
- unsigned adjust = 0;
- /* now all push/pop insns are in temp. */
-@@ -1501,7 +1549,8 @@ shrink_stack_frame (void)
- unsigned regbit = 1 << REGNO(reg);
- if (freemask & regbit)
- {
-- fprintf (stderr, i < prologueend ? "remove push for %d\n" : "remove pop for %d\n", REGNO(reg));
-+ fprintf (stderr, i < prologueend ? ":bbb: remove push for %s\n" : ":bbb: remove pop for %s\n",
-+ reg_names[REGNO(reg)]);
- if (i < prologueend)
- adjust += 4;
- }
-@@ -1510,11 +1559,12 @@ shrink_stack_frame (void)
- }
-
- /* don't touch - clobbers! */
-- if (clobbers.size())
-+ if (clobbers.size ())
- continue;
-
- if ((int) regs.size () + 1 < XVECLEN(pattern, 0) || regs.size () <= 2)
- {
-+ fprintf (stderr, ":bbb: shrinking stack frame from %d to %d\n", XVECLEN(pattern, 0), regs.size () + 1);
- if (regs.size () <= 2)
- {
- for (unsigned k = 0; k < regs.size (); ++k)
-@@ -1523,16 +1573,16 @@ shrink_stack_frame (void)
- if (i < prologueend)
- {
- /* push */
-- rtx dec = gen_rtx_PRE_DEC(SImode, a7);
-- rtx mem = gen_rtx_MEM (SImode, dec);
-+ rtx dec = gen_rtx_PRE_DEC(REGNO(regs[k]) > STACK_POINTER_REGNUM ? XFmode : SImode, a7);
-+ rtx mem = gen_rtx_MEM (REGNO(regs[k]) > STACK_POINTER_REGNUM ? XFmode : SImode, dec);
- rtx set = gen_rtx_SET(mem, reg);
- emit_insn_after (set, insn);
- }
- else
- {
- /* pop */
-- rtx dec = gen_rtx_POST_INC(SImode, a7);
-- rtx mem = gen_rtx_MEM (SImode, dec);
-+ rtx dec = gen_rtx_POST_INC(REGNO(regs[k]) > STACK_POINTER_REGNUM ? XFmode : SImode, a7);
-+ rtx mem = gen_rtx_MEM (REGNO(regs[k]) > STACK_POINTER_REGNUM ? XFmode : SImode, dec);
- rtx set = gen_rtx_SET(reg, mem);
- emit_insn_before (set, insn);
- }
-@@ -1540,14 +1590,24 @@ shrink_stack_frame (void)
- }
- else
- {
-- rtx parallel = gen_rtx_PARALLEL(VOIDmode, rtvec_alloc (regs.size () + 1));
-- int x = regs.size () * 4 + 4;
-+ /* add romm for add. */
-+ int add1 = i < prologueend || !usea5 ? 1 : 0;
-+ rtx parallel = gen_rtx_PARALLEL(VOIDmode, rtvec_alloc (regs.size () + add1));
-+ rtx plus;
-+
-+ int x = 0;
-+ for (unsigned k = 0; k < regs.size (); ++k)
-+ x += REGNO(regs[k]) > STACK_POINTER_REGNUM ? 12 : 4;
-
-- rtx plus = gen_rtx_PLUS(SImode, a7, gen_rtx_CONST_INT (SImode, i < prologueend ? -x : x));
-- XVECEXP(parallel, 0, 0) = gen_rtx_SET(a7, plus);
-+ /* no add if a5 is used with pop */
-+ if (!usea5 || i < prologueend)
-+ {
-+ plus = gen_rtx_PLUS(SImode, a7, gen_rtx_CONST_INT (SImode, i < prologueend ? -x : x));
-+ XVECEXP(parallel, 0, 0) = gen_rtx_SET(a7, plus);
-+ }
-
- if (i >= prologueend)
-- x = 0;
-+ x = usea5 ? -x : 0;
-
- for (unsigned k = 0; k < regs.size (); ++k)
- {
-@@ -1555,19 +1615,30 @@ shrink_stack_frame (void)
- {
- /* push */
- plus = gen_rtx_PLUS(SImode, a7, gen_rtx_CONST_INT (SImode, -x));
-- x -= 4;
-- rtx mem = gen_rtx_MEM (SImode, plus);
-+ x -= REGNO(regs[k]) > STACK_POINTER_REGNUM ? 12 : 4;
-+ rtx mem = gen_rtx_MEM (REGNO(regs[k]) > STACK_POINTER_REGNUM ? XFmode : SImode, plus);
- rtx set = gen_rtx_SET(mem, regs[k]);
- XVECEXP(parallel, 0, k + 1) = set;
- }
- else
- {
- /* pop */
-- plus = x ? gen_rtx_PLUS(SImode, a7, gen_rtx_CONST_INT (SImode, x)) : a7;
-- x += 4;
-- rtx mem = gen_rtx_MEM (SImode, plus);
-- rtx set = gen_rtx_SET(regs[k], mem);
-- XVECEXP(parallel, 0, k + 1) = set;
-+ if (usea5)
-+ {
-+ x += REGNO(regs[k]) > STACK_POINTER_REGNUM ? 12 : 4;
-+ plus = gen_rtx_PLUS(SImode, a5, gen_rtx_CONST_INT (SImode, a5offset + x));
-+ rtx mem = gen_rtx_MEM (REGNO(regs[k]) > STACK_POINTER_REGNUM ? XFmode : SImode, plus);
-+ rtx set = gen_rtx_SET(regs[k], mem);
-+ XVECEXP(parallel, 0, k) = set;
-+ }
-+ else
-+ {
-+ plus = x ? gen_rtx_PLUS(SImode, a7, gen_rtx_CONST_INT (SImode, x)) : a7;
-+ x += REGNO(regs[k]) > STACK_POINTER_REGNUM ? 12 : 4;
-+ rtx mem = gen_rtx_MEM (REGNO(regs[k]) > STACK_POINTER_REGNUM ? XFmode : SImode, plus);
-+ rtx set = gen_rtx_SET(regs[k], mem);
-+ XVECEXP(parallel, 0, k + 1) = set;
-+ }
- }
- }
- emit_insn_after (parallel, insn);
-@@ -1582,13 +1653,13 @@ shrink_stack_frame (void)
- if (i < prologueend)
- {
- /* move x,-(a7). */
-- paramstart += 4;
- rtx src = SET_SRC(set);
-+ paramstart += REGNO(src) > STACK_POINTER_REGNUM ? 12 : 4;
- unsigned regbit = 1 << REGNO(src);
- if (freemask & regbit)
- {
-- adjust += 4;
-- fprintf (stderr, "remove push for %d\n", REGNO(src));
-+ adjust += REGNO(src) > STACK_POINTER_REGNUM ? 12 : 4;
-+ fprintf (stderr, ":bbb: remove push for %s\n", reg_names[REGNO(src)]);
- SET_INSN_DELETED(insn);
- }
- }
-@@ -1599,7 +1670,7 @@ shrink_stack_frame (void)
- unsigned regbit = 1 << REGNO(dst);
- if (freemask & regbit)
- {
-- fprintf (stderr, "remove pop for %d\n", REGNO(dst));
-+ fprintf (stderr, ":bbb: remove pop for %s\n", reg_names[REGNO(dst)]);
- SET_INSN_DELETED(insn);
- }
- }
-@@ -1626,7 +1697,7 @@ shrink_stack_frame (void)
- if (GET_CODE(plus) == PLUS)
- {
- rtx sp = XEXP(plus, 0);
-- if (REG_P(sp) && REGNO(sp) == 15)
-+ if (REG_P(sp) && REGNO(sp) == STACK_POINTER_REGNUM)
- {
- rtx c = XEXP(plus, 1);
- if (CONST_INT_P(c))
-@@ -1647,6 +1718,99 @@ shrink_stack_frame (void)
- return 0;
- }
-
-+/*
-+ * Always prefer lower register numbers within the class.
-+ */
-+static unsigned
-+bb_reg_rename (void)
-+{
-+ for (unsigned index = 0; index < insns.size (); ++index)
-+ {
-+ insn_info & ii = infos[index];
-+ const unsigned def = ii._def;
-+ unsigned mask = ii.get_def_mask ();
-+
-+ if (!mask)
-+ continue;
-+
-+ std::vector<unsigned> found;
-+ std::vector<unsigned> todo;
-+ if (index + 1 < insns.size ())
-+ todo.push_back (index + 1);
-+
-+ found.push_back (index);
-+ /* a register was defined, follow all branches. */
-+ while (todo.size ())
-+ {
-+ unsigned pos = todo[todo.size () - 1];
-+ todo.pop_back ();
-+
-+ if (LABEL_P(insns[pos]))
-+ {
-+ if (pos + 1 < insns.size ())
-+ todo.push_back (pos + 1);
-+ continue;
-+ }
-+
-+ insn_info & jj = infos[pos];
-+
-+ /* update free regs. */
-+ mask &= ~jj._use;
-+ mask &= ~jj._def;
-+ if (!mask)
-+ break;
-+
-+ /* defined again. */
-+ if (jj._def & def)
-+ continue;
-+
-+ /* not referenced. */
-+ if (!(jj._use & def))
-+ continue;
-+
-+ found.push_back (pos);
-+
-+ /* follow jump and/or next insn. */
-+ rtx_insn * insn = insns[pos];
-+ if (JUMP_P(insn))
-+ {
-+ std::map<rtx_insn *, unsigned>::iterator j = insn2index.find ((rtx_insn *) JUMP_LABEL(insn));
-+ if (j != insn2index.end ())
-+ todo.push_back (j->second);
-+
-+ rtx jmppattern = PATTERN (insn);
-+
-+ rtx jmpsrc = XEXP(jmppattern, 1);
-+ if (GET_CODE(jmpsrc) == IF_THEN_ELSE)
-+ if (pos + 1 < insns.size ())
-+ todo.push_back (pos + 1);
-+ }
-+ else if (pos + 1 < insns.size ())
-+ todo.push_back (pos + 1);
-+ }
-+
-+ if (mask)
-+ {
-+ int oldregno = bit2regno (def);
-+ int newregno = bit2regno (mask);
-+ fprintf (stderr, ":bbb: bb_reg_rename %s -> %s (%d insns)\n", reg_names[oldregno], reg_names[newregno],
-+ found.size ());
-+
-+ for (std::vector<unsigned>::iterator i = found.begin (); i != found.end (); ++i)
-+ {
-+ debug_rtx (insns[*i]);
-+ do_reg_rename (PATTERN (insns[*i]), oldregno, newregno);
-+ }
-+
-+ cselib_invalidate_rtx (gen_raw_REG (SImode, oldregno));
-+ cselib_invalidate_rtx (gen_raw_REG (SImode, newregno));
-+ return 1;
-+ }
-+ }
-+ return 0;
-+}
-+
-+extern const char * current_function_func_begin_label;
- extern class opt_pass * global_pass_regrename;
-
- namespace
-@@ -1676,7 +1840,10 @@ namespace
- virtual bool
- gate (function *)
- {
-- return TARGET_AMIGA && flag_bbb_opts;
-+ if (!flag_bbb_opts)
-+ flag_bbb_opts = "*";
-+
-+ return TARGET_AMIGA && optimize > 0 && flag_bbb_opts;
- }
-
- virtual unsigned int
-@@ -1704,6 +1871,10 @@ namespace
- unsigned
- pass_bbb_optimizations::execute_bbb_optimizations (void)
- {
-+
-+ if (strchr (flag_bbb_opts, 'X') || strchr (flag_bbb_opts, 'x'))
-+ fprintf (stderr, "%s:\n", current_function_func_begin_label);
-+
- df_set_flags (DF_LR_RUN_DCE + DF_DEFER_INSN_RESCAN);
- df_note_add_problem ();
- df_analyze ();
-@@ -1749,6 +1920,11 @@ namespace
- {
- class opt_pass * rr = ::global_pass_regrename->clone ();
- rr->execute (0);
-+
-+// update_insns ();
-+// update_insn_infos ();
-+// bb_reg_rename ();
-+
- update_insns ();
- }
-
-
-From 56aa60f1154c2988edf35ba30ec259a798ba61f2 Mon Sep 17 00:00:00 2001
-From: bebbo <bebbo(a)bejy.net>
-Date: Thu, 13 Apr 2017 23:49:13 +0200
-Subject: [PATCH 065/303] @B fix stack frame handling and suspicious other
- stuff
-
----
- gcc/bbb-opts.c | 80 ++++++++++++++++++++++++++++++----------------------------
- gcc/final.c | 7 ++++-
- 2 files changed, 48 insertions(+), 39 deletions(-)
-
-diff --git a/gcc/bbb-opts.c b/gcc/bbb-opts.c
-index c688ca8ae192..56251b906184 100755
---- gcc/bbb-opts.c
-+++ gcc/bbb-opts.c
-@@ -182,7 +182,8 @@ insn_info::scan (rtx x)
- {
- if (REG_P(x))
- {
-- use (REGNO(x));
-+ for (int n = REG_NREGS(x), r = REGNO(x); n > 0; --n, ++r)
-+ use (r);
- return;
- }
-
-@@ -425,35 +426,34 @@ update_insn_infos (void)
- insn_info def;
- insn_info use;
-
-- /* a call sets d0 and maybe also d1,a0,a1. */
-- if (ii.is_use(0))
-- def.def (0);
-- if (ii.is_use (1))
-- {
-- fprintf (stderr, ":bbb: use of d1 after call in %s\n", getCurrentFunctionName ());
-- def.def (1);
-- }
-- if (ii.is_use (8))
-+ /* add mregparm registers. */
-+ for (rtx link = CALL_INSN_FUNCTION_USAGE(insn); link; link = XEXP(link, 1))
- {
-- fprintf (stderr, ":bbb: use of a0 after call in %s\n", getCurrentFunctionName ());
-- def.def (8);
-- }
-- if (ii.is_use (9))
-- {
-- fprintf (stderr, ":bbb: use of a1 after call in %s\n", getCurrentFunctionName ());
-- def.def (9);
-+ rtx op, reg;
-+
-+ if (GET_CODE (op = XEXP (link, 0)) == USE && REG_P(reg = XEXP (op, 0)))
-+ for (int r = REGNO(reg); r <= END_REGNO (reg); ++r)
-+ use.use (r);
- }
-
-- // FIXME: isuse the DECL and read attributes.
-- // use regs depending on flag mregparm
-- for (int i = 0; i < amigaos_regparm; ++i)
-+ rtx set = single_set (insn);
-+ if (set)
- {
-- use.use (i);
-- use.use (i + 8);
-+ use.scan (SET_SRC(set));
-+ def.scan (SET_DEST(set));
- }
-+ else
-+ use.scan (pattern);
-
-- // check for reg use
-- use.scan (pattern);
-+ /* fix missing defs - a call sets d0 and maybe also d1,a0,a1. */
-+ if (ii.is_use (0))
-+ def.def (0);
-+ if (ii.is_use (1))
-+ def.def (1);
-+ if (ii.is_use (8))
-+ def.def (8);
-+ if (ii.is_use (9))
-+ def.def (9);
-
- infos[pos] = def | use | ii;
-
-@@ -494,7 +494,7 @@ update_insn_infos (void)
- continue;
- }
-
-- if (GET_CODE (pattern) != PARALLEL)
-+ if (GET_CODE (pattern) != PARALLEL && GET_CODE (pattern) != CLOBBER)
- {
- fprintf (stderr, "##### ");
- debug_rtx (insn);
-@@ -1062,7 +1062,7 @@ const_cmp_to_sub (void)
- {
- unsigned change_count = 0;
- #if HAVE_cc0
-- for (unsigned index = insns.size () - 2; index > 0; --index)
-+ for (int index = insns.size () - 2; index > 0; --index)
- {
- rtx_insn * insn = insns[index];
- rtx seti = single_set (insn);
-@@ -1079,7 +1079,7 @@ const_cmp_to_sub (void)
-
- rtx left = XEXP(srci, 0);
- rtx right = XEXP(srci, 1);
-- if (!REG_P(left) || !REG_P(right))
-+ if (!REG_P(left) || !REG_P(right) || REG_NREGS(left) > 1 || REG_NREGS(right) > 1)
- continue;
-
- // TODO
-@@ -1451,7 +1451,6 @@ shrink_stack_frame (void)
- ++pos;
- }
-
--
- /* move epilogues away. */
- for (; pos < insns.size (); ++pos)
- {
-@@ -1506,7 +1505,12 @@ shrink_stack_frame (void)
- update_insn_infos ();
- insn_info ii;
- for (unsigned i = 0; i < infos.size (); ++i)
-- ii |= infos[i];
-+ {
-+ insn_info & jj = infos[i];
-+ ii |= jj;
-+// fprintf (stderr, "%08lx %08lx\n", jj._use, jj._def);
-+ }
-+// fprintf (stderr, "%08lx %08lx\n", ii._use, ii._def);
- unsigned freemask = ~ii._use;
-
- rtx a7 = gen_raw_REG (SImode, STACK_POINTER_REGNUM);
-@@ -1562,9 +1566,15 @@ shrink_stack_frame (void)
- if (clobbers.size ())
- continue;
-
-- if ((int) regs.size () + 1 < XVECLEN(pattern, 0) || regs.size () <= 2)
-+ /* add romm for add.
-+ * push is always using -(a7) addressing.
-+ * If a5 is used a movem offset(a5) is generated to pop saved registers..
-+ * Otherwise a7 is used and with (a7)+ addressing.
-+ */
-+ int add1 = i < prologueend || !usea5 ? 1 : 0;
-+ if ((int) regs.size () + add1 < XVECLEN(pattern, 0) || regs.size () <= 2)
- {
-- fprintf (stderr, ":bbb: shrinking stack frame from %d to %d\n", XVECLEN(pattern, 0), regs.size () + 1);
-+ fprintf (stderr, ":bbb: shrinking stack frame from %d to %d\n", XVECLEN(pattern, 0) - add1, regs.size ());
- if (regs.size () <= 2)
- {
- for (unsigned k = 0; k < regs.size (); ++k)
-@@ -1590,8 +1600,6 @@ shrink_stack_frame (void)
- }
- else
- {
-- /* add romm for add. */
-- int add1 = i < prologueend || !usea5 ? 1 : 0;
- rtx parallel = gen_rtx_PARALLEL(VOIDmode, rtvec_alloc (regs.size () + add1));
- rtx plus;
-
-@@ -1856,7 +1864,7 @@ namespace
- clone ()
- {
- pass_bbb_optimizations * bbb = new pass_bbb_optimizations (m_ctxt);
-- // bbb->pp = pp + 1;
-+ bbb->pp = pp + 1;
- return bbb;
- }
-
-@@ -1871,10 +1879,6 @@ namespace
- unsigned
- pass_bbb_optimizations::execute_bbb_optimizations (void)
- {
--
-- if (strchr (flag_bbb_opts, 'X') || strchr (flag_bbb_opts, 'x'))
-- fprintf (stderr, "%s:\n", current_function_func_begin_label);
--
- df_set_flags (DF_LR_RUN_DCE + DF_DEFER_INSN_RESCAN);
- df_note_add_problem ();
- df_analyze ();
-diff --git a/gcc/final.c b/gcc/final.c
-index 55cf509611f7..9d21ffc1baff 100644
---- gcc/final.c
-+++ gcc/final.c
-@@ -2165,7 +2165,7 @@ final_scan_insn (rtx_insn *insn, FILE *file, int optimize_p ATTRIBUTE_UNUSED,
-
- /* Ignore deleted insns. These can occur when we split insns (due to a
- template of "#") while not optimizing. */
-- if (insn->deleted ())
-+ if (insn->deleted () || GET_CODE(insn) == VALUE || GET_CODE(insn) == CONST_FIXED)
- return NEXT_INSN (insn);
-
- switch (GET_CODE (insn))
-@@ -4430,12 +4430,17 @@ leaf_renumber_regs_insn (rtx in_rtx)
- }
- #endif
-
-+
-+extern void dump_insns(char const *);
-+
- /* Turn the RTL into assembly. */
- static unsigned int
- rest_of_handle_final (void)
- {
- const char *fnname = get_fnname_from_decl (current_function_decl);
-
-+// dump_insns("final");
-+
- assemble_start_function (current_function_decl, fnname);
- final_start_function (get_insns (), asm_out_file, optimize);
- final (get_insns (), asm_out_file, optimize);
-
-From 51c5b7b668483ac0cdc30a3fee718754a03bcca9 Mon Sep 17 00:00:00 2001
-From: bebbo <bebbo(a)bejy.net>
-Date: Fri, 14 Apr 2017 18:33:26 +0200
-Subject: [PATCH 066/303] @R add option description for command line help
-
----
- gcc/config/m68k/amigaos.opt | 12 ++++++------
- 1 file changed, 6 insertions(+), 6 deletions(-)
-
-diff --git a/gcc/config/m68k/amigaos.opt b/gcc/config/m68k/amigaos.opt
-index a5a14449dea9..9c08ba43196e 100644
---- gcc/config/m68k/amigaos.opt
-+++ gcc/config/m68k/amigaos.opt
-@@ -25,24 +25,24 @@ small code model
-
- fbaserel
- Target Report Var(flag_pic,3)
--data is adressed relativ to a4
-+data is addressed relative to a4
-
- fbaserel32
- Target Report Var(flag_pic,4)
--data is adressed relativ to a4 with 32 bit offsets
-+data is addressed relative to a4 with 32 bit offsets
-
- resident
- Target Common Report Var(flag_pic,3)
--data is adressed relativ to a4, linked as resident
-+data is addressed relative to a4, linked as resident
-
- resident32
- Target Common Report Var(flag_pic,4)
--data is adressed relativ to a4 with 32 bit offsets, linked as resident
-+data is addressed relative to a4 with 32 bit offsets, linked as resident
-
- mcrt=
- Target RejectNegative Var(amigaos_crt) Joined
- Specify startup binary
-
- fbbb=
--Target Var(flag_bbb_opts) Joined
--Enable Bebbo's optimizations
-+Target RejectNegative Report Var(string_bbb_opts) Joined
-+-fbbb=\t\tEnable Bebbo's optimizations. Default: -fbbb=+\n valid letters:\n\t\t+\t\tenable all\n\t\t-\t\tdisable all\n\t\ta\t\tadd move optimization\n\t\tc\t\tcompare to sub\n\t\te\t\teliminate dead assignments\n\t\tf\t\tshrink stack frame\n\t\tm\t\tmerge add statements\n\t\tp\t\tpropagate move pairs from loops\n\t\tr\t\tadditional reg rename pass\n\t\tv\t\tbe verbose\n\t\tx or X\t\tdump insns
-
-From 5abbd0e25e9cc50d4449884567079df90141511b Mon Sep 17 00:00:00 2001
-From: bebbo <bebbo(a)bejy.net>
-Date: Fri, 14 Apr 2017 18:34:31 +0200
-Subject: [PATCH 067/303] @B resolv issues to get everything built
-
----
- gcc/bbb-opts.c | 255 +++++++++++++++++++--------------------------------------
- gcc/final.c | 2 +-
- gcc/passes.def | 6 +-
- 3 files changed, 89 insertions(+), 174 deletions(-)
-
-diff --git a/gcc/bbb-opts.c b/gcc/bbb-opts.c
-index 56251b906184..1b1863e9ae8f 100755
---- gcc/bbb-opts.c
-+++ gcc/bbb-opts.c
-@@ -51,6 +51,42 @@
- #include <vector>
- #include <map>
-
-+static bool be_verbose;
-+
-+extern struct lang_hooks lang_hooks;
-+extern tree current_function_decl;
-+static tree last_function_decl;
-+static char const *
-+getCurrentFunctionName ()
-+{
-+ static char fxname[512];
-+ if (current_function_decl == NULL)
-+ strcpy (fxname, "<toplevel>");
-+ else
-+ strcpy (fxname, lang_hooks.decl_printable_name (current_function_decl, 2));
-+ return fxname;
-+}
-+
-+static int
-+log (char const * fmt, ...)
-+{
-+ if (!be_verbose)
-+ return 0;
-+
-+ va_list args;
-+ va_start(args, fmt);
-+ if (last_function_decl != current_function_decl)
-+ {
-+ last_function_decl = current_function_decl;
-+ printf (":bbb: in '%s'\n", getCurrentFunctionName ());
-+ }
-+ printf (":bbb: ");
-+ int retval = vprintf (fmt, args);
-+ va_end(args);
-+ fflush (stdout);
-+ return retval;
-+}
-+
- /* Enough for m68k.
- * Why a class? Maybe extend it for general usage.
- *
-@@ -231,21 +267,6 @@ do_reg_rename (rtx x, unsigned oldregno, unsigned newregno)
- }
- }
-
--static int
--bit2regno (unsigned bit)
--{
-- if (!bit)
-- return -1;
--
-- unsigned regno = 0;
-- while (!(bit & 1))
-- {
-- ++regno;
-- bit >>= 1;
-- }
-- return regno;
--}
--
- /*
- * Collect some data.
- */
-@@ -358,19 +379,6 @@ update_insns ()
- }
- }
-
--extern struct lang_hooks lang_hooks;
--extern tree current_function_decl;
--static char const *
--getCurrentFunctionName ()
--{
-- static char fxname[512];
-- if (current_function_decl == NULL)
-- strcpy (fxname, "<toplevel>");
-- else
-- strcpy (fxname, lang_hooks.decl_printable_name (current_function_decl, 2));
-- return fxname;
--}
--
- static void
- update_insn_infos (void)
- {
-@@ -432,7 +440,7 @@ update_insn_infos (void)
- rtx op, reg;
-
- if (GET_CODE (op = XEXP (link, 0)) == USE && REG_P(reg = XEXP (op, 0)))
-- for (int r = REGNO(reg); r <= END_REGNO (reg); ++r)
-+ for (unsigned r = REGNO(reg); r <= END_REGNO (reg); ++r)
- use.use (r);
- }
-
-@@ -468,7 +476,7 @@ update_insn_infos (void)
- if (ANY_RETURN_P(pattern))
- {
- ii.reset ();
-- ii.use (0);
-+// ii.use (0);
- }
- else
- {
-@@ -494,7 +502,7 @@ update_insn_infos (void)
- continue;
- }
-
-- if (GET_CODE (pattern) != PARALLEL && GET_CODE (pattern) != CLOBBER)
-+ if (GET_CODE (pattern) != PARALLEL && GET_CODE (pattern) != CLOBBER && be_verbose)
- {
- fprintf (stderr, "##### ");
- debug_rtx (insn);
-@@ -761,9 +769,9 @@ propagate_moves ()
- rtx_insn * after = insns[index + 1];
- rtx bset = single_set (before);
-
-- fprintf (stderr, ":bbb: propagate_moves condition met, moving regs %s, %s\n",
-+ log ("propagate_moves condition met, moving regs %s, %s\n",
- reg_names[REGNO(srci)],
-- reg_names[REGNO(dsti)]);
-+ reg_names[REGNO(dsti)]);
-
- /* Move in front of loop and mark as dead. */
- rtx_insn * newii = make_insn_raw (PATTERN (ii));
-@@ -800,7 +808,7 @@ propagate_moves ()
- /* add fixes if there were jumps out of the loop. */
- if (jump_out.size ())
- {
-- fprintf (stderr, ":bbb: propagate_moves fixing %d jump outs\n", jump_out.size ());
-+ log ("propagate_moves fixing %d jump outs\n", jump_out.size ());
-
- for (unsigned k = 0; k < jump_out.size (); ++k)
- {
-@@ -873,7 +881,8 @@ opt_strcpy ()
- rtx dst = XEXP(src, 0);
- src = XEXP(src, 1);
-
-- if (CONST_INT_P(src) && INTVAL(src) == 0 && find_reg_note (insn, REG_DEAD, dst))
-+// if (CONST_INT_P(src) && INTVAL(src) == 0 && find_reg_note (insn, REG_DEAD, dst))
-+ if (REG_P(dst) && CONST_INT_P(src) && INTVAL(src) == 0 && is_reg_dead(REGNO(dst), index))
- {
- /* now check via NOTICE_UPDATE_CC*/
- NOTICE_UPDATE_CC(PATTERN (reg2x), reg2x);
-@@ -889,10 +898,8 @@ opt_strcpy ()
- {
- rtx link;
-
-- fprintf (
-- stderr,
-- ":bbb: opt_strcpy condition met, removing compare and joining insns - omit reg %s\n",
-- reg_names[REGNO(dst)]);
-+ log ("opt_strcpy condition met, removing compare and joining insns - omit reg %s\n",
-+ reg_names[REGNO(dst)]);
-
- SET_SRC(single_set(reg2x)) = SET_SRC(single_set (x2reg));
-
-@@ -1017,7 +1024,7 @@ commute_add_move (void)
-
- if (validate_change (next, &SET_DEST(set2), newmem, 0))
- {
-- fprintf (stderr, ":bbb: commute_add_move found\n");
-+ log ("commute_add_move found\n");
-
- SET_INSN_DELETED(insn);
-
-@@ -1130,7 +1137,7 @@ const_cmp_to_sub (void)
- SET_INSN_DELETED(prev);
- prev = emit_insn_before (neuprev, insn);
-
-- fprintf (stderr, ":bbb: const_cmp_to_sub replaced reg-reg compare with sub\n");
-+ log ("const_cmp_to_sub replaced reg-reg compare with sub\n");
-
- if (dstp != left)
- {
-@@ -1191,7 +1198,7 @@ const_cmp_to_sub (void)
-
- if (code != newcode)
- {
-- fprintf (stderr, ":bbb: patch jcc %d -> %d\n", code, newcode);
-+ log ("patch jcc %d -> %d\n", code, newcode);
- XEXP(jmpsrc, 0) = gen_rtx_fmt_ee(newcode, VOIDmode, XEXP(condition, 0), XEXP(condition, 1));
- }
- }
-@@ -1225,7 +1232,7 @@ elim_dead_assign (void)
-
- if (is_reg_dead (REGNO(dst), index))
- {
-- fprintf (stderr, ":bbb: elim_dead_assign to %s\n", reg_names[REGNO(dst)]);
-+ log ("elim_dead_assign to %s\n", reg_names[REGNO(dst)]);
- SET_INSN_DELETED(insn);
- ++change_count;
- }
-@@ -1291,13 +1298,15 @@ merge_add (void)
- if (REGNO(dst1) != REGNO(dst2) || REGNO(r2) != REGNO(dst3))
- continue;
-
-- fprintf (stderr, ":bbb: merge_add applied\n");
-+ log ("merge_add applied\n");
-+
-+ rtx_insn * newins1 = make_insn_raw(gen_rtx_SET(dst1, l1));
-+ add_insn_after (newins1, ins1, 0);
-+ SET_INSN_DELETED(ins1);
-
-- SET_SRC(set1) = l1;
- rtx_insn * newins2 = make_insn_raw (PATTERN (ins2));
- add_insn_after (newins2, ins3, 0);
- SET_INSN_DELETED(ins2);
-- df_insn_rescan (ins1);
- }
- return change_count;
- }
-@@ -1508,9 +1517,7 @@ shrink_stack_frame (void)
- {
- insn_info & jj = infos[i];
- ii |= jj;
--// fprintf (stderr, "%08lx %08lx\n", jj._use, jj._def);
- }
--// fprintf (stderr, "%08lx %08lx\n", ii._use, ii._def);
- unsigned freemask = ~ii._use;
-
- rtx a7 = gen_raw_REG (SImode, STACK_POINTER_REGNUM);
-@@ -1553,7 +1560,7 @@ shrink_stack_frame (void)
- unsigned regbit = 1 << REGNO(reg);
- if (freemask & regbit)
- {
-- fprintf (stderr, i < prologueend ? ":bbb: remove push for %s\n" : ":bbb: remove pop for %s\n",
-+ log (i < prologueend ? "remove push for %s\n" : "remove pop for %s\n",
- reg_names[REGNO(reg)]);
- if (i < prologueend)
- adjust += 4;
-@@ -1574,7 +1581,7 @@ shrink_stack_frame (void)
- int add1 = i < prologueend || !usea5 ? 1 : 0;
- if ((int) regs.size () + add1 < XVECLEN(pattern, 0) || regs.size () <= 2)
- {
-- fprintf (stderr, ":bbb: shrinking stack frame from %d to %d\n", XVECLEN(pattern, 0) - add1, regs.size ());
-+ log ("shrinking stack frame from %d to %d\n", XVECLEN(pattern, 0) - add1, regs.size ());
- if (regs.size () <= 2)
- {
- for (unsigned k = 0; k < regs.size (); ++k)
-@@ -1667,7 +1674,7 @@ shrink_stack_frame (void)
- if (freemask & regbit)
- {
- adjust += REGNO(src) > STACK_POINTER_REGNUM ? 12 : 4;
-- fprintf (stderr, ":bbb: remove push for %s\n", reg_names[REGNO(src)]);
-+ log ("remove push for %s\n", reg_names[REGNO(src)]);
- SET_INSN_DELETED(insn);
- }
- }
-@@ -1678,7 +1685,7 @@ shrink_stack_frame (void)
- unsigned regbit = 1 << REGNO(dst);
- if (freemask & regbit)
- {
-- fprintf (stderr, ":bbb: remove pop for %s\n", reg_names[REGNO(dst)]);
-+ log ("remove pop for %s\n", reg_names[REGNO(dst)]);
- SET_INSN_DELETED(insn);
- }
- }
-@@ -1726,99 +1733,6 @@ shrink_stack_frame (void)
- return 0;
- }
-
--/*
-- * Always prefer lower register numbers within the class.
-- */
--static unsigned
--bb_reg_rename (void)
--{
-- for (unsigned index = 0; index < insns.size (); ++index)
-- {
-- insn_info & ii = infos[index];
-- const unsigned def = ii._def;
-- unsigned mask = ii.get_def_mask ();
--
-- if (!mask)
-- continue;
--
-- std::vector<unsigned> found;
-- std::vector<unsigned> todo;
-- if (index + 1 < insns.size ())
-- todo.push_back (index + 1);
--
-- found.push_back (index);
-- /* a register was defined, follow all branches. */
-- while (todo.size ())
-- {
-- unsigned pos = todo[todo.size () - 1];
-- todo.pop_back ();
--
-- if (LABEL_P(insns[pos]))
-- {
-- if (pos + 1 < insns.size ())
-- todo.push_back (pos + 1);
-- continue;
-- }
--
-- insn_info & jj = infos[pos];
--
-- /* update free regs. */
-- mask &= ~jj._use;
-- mask &= ~jj._def;
-- if (!mask)
-- break;
--
-- /* defined again. */
-- if (jj._def & def)
-- continue;
--
-- /* not referenced. */
-- if (!(jj._use & def))
-- continue;
--
-- found.push_back (pos);
--
-- /* follow jump and/or next insn. */
-- rtx_insn * insn = insns[pos];
-- if (JUMP_P(insn))
-- {
-- std::map<rtx_insn *, unsigned>::iterator j = insn2index.find ((rtx_insn *) JUMP_LABEL(insn));
-- if (j != insn2index.end ())
-- todo.push_back (j->second);
--
-- rtx jmppattern = PATTERN (insn);
--
-- rtx jmpsrc = XEXP(jmppattern, 1);
-- if (GET_CODE(jmpsrc) == IF_THEN_ELSE)
-- if (pos + 1 < insns.size ())
-- todo.push_back (pos + 1);
-- }
-- else if (pos + 1 < insns.size ())
-- todo.push_back (pos + 1);
-- }
--
-- if (mask)
-- {
-- int oldregno = bit2regno (def);
-- int newregno = bit2regno (mask);
-- fprintf (stderr, ":bbb: bb_reg_rename %s -> %s (%d insns)\n", reg_names[oldregno], reg_names[newregno],
-- found.size ());
--
-- for (std::vector<unsigned>::iterator i = found.begin (); i != found.end (); ++i)
-- {
-- debug_rtx (insns[*i]);
-- do_reg_rename (PATTERN (insns[*i]), oldregno, newregno);
-- }
--
-- cselib_invalidate_rtx (gen_raw_REG (SImode, oldregno));
-- cselib_invalidate_rtx (gen_raw_REG (SImode, newregno));
-- return 1;
-- }
-- }
-- return 0;
--}
--
--extern const char * current_function_func_begin_label;
- extern class opt_pass * global_pass_regrename;
-
- namespace
-@@ -1848,10 +1762,10 @@ namespace
- virtual bool
- gate (function *)
- {
-- if (!flag_bbb_opts)
-- flag_bbb_opts = "*";
-+ if (!string_bbb_opts)
-+ string_bbb_opts = "+";
-
-- return TARGET_AMIGA && optimize > 0 && flag_bbb_opts;
-+ return TARGET_AMIGA && optimize > 0 && string_bbb_opts && !strchr (string_bbb_opts, '-');
- }
-
- virtual unsigned int
-@@ -1883,20 +1797,21 @@ namespace
- df_note_add_problem ();
- df_analyze ();
-
-- update_insns ();
-+ be_verbose = strchr (string_bbb_opts, 'v');
-
-- bool do_opt_strcpy = strchr (flag_bbb_opts, 's') || strchr (flag_bbb_opts, '*');
-- bool do_commute_add_move = strchr (flag_bbb_opts, 'a') || strchr (flag_bbb_opts, '*');
-- bool do_propagate_moves = strchr (flag_bbb_opts, 'p') || strchr (flag_bbb_opts, '*');
-- bool do_const_cmp_to_sub = strchr (flag_bbb_opts, 'c') || strchr (flag_bbb_opts, '*');
-- bool do_merge_add = strchr (flag_bbb_opts, 'm') || strchr (flag_bbb_opts, '*');
-- bool do_elim_dead_assign = strchr (flag_bbb_opts, 'e') || strchr (flag_bbb_opts, '*');
-- bool do_bb_reg_rename = strchr (flag_bbb_opts, 'r') || strchr (flag_bbb_opts, '*');
-- bool do_shrink_stack_frame = strchr (flag_bbb_opts, 'f') || strchr (flag_bbb_opts, '*');
-+ bool do_opt_strcpy = strchr (string_bbb_opts, 's') || strchr (string_bbb_opts, '+');
-+ bool do_commute_add_move = strchr (string_bbb_opts, 'a') || strchr (string_bbb_opts, '+');
-+ bool do_propagate_moves = strchr (string_bbb_opts, 'p') || strchr (string_bbb_opts, '+');
-+ bool do_const_cmp_to_sub = strchr (string_bbb_opts, 'c') || strchr (string_bbb_opts, '+');
-+ bool do_merge_add = strchr (string_bbb_opts, 'm') || strchr (string_bbb_opts, '+');
-+ bool do_elim_dead_assign = strchr (string_bbb_opts, 'e') || strchr (string_bbb_opts, '+');
-+ bool do_bb_reg_rename = strchr (string_bbb_opts, 'r') || strchr (string_bbb_opts, '+');
-+ bool do_shrink_stack_frame = strchr (string_bbb_opts, 'f') || strchr (string_bbb_opts, '+');
-
- for (;;)
- {
- int done = 1;
-+ update_insns ();
- if (do_opt_strcpy && opt_strcpy ())
- done = 0, update_insns ();
-
-@@ -1916,20 +1831,20 @@ namespace
- if (do_elim_dead_assign && elim_dead_assign ())
- done = 0, update_insns ();
-
-- if (done)
-- break;
-- }
-+ if (do_bb_reg_rename && ::global_pass_regrename)
-+ {
-+ class opt_pass * rr = ::global_pass_regrename->clone ();
-+ rr->execute (0);
-
-- if (do_bb_reg_rename && ::global_pass_regrename)
-- {
-- class opt_pass * rr = ::global_pass_regrename->clone ();
-- rr->execute (0);
-+ // update_insns ();
-+ // update_insn_infos ();
-+ // bb_reg_rename ();
-
--// update_insns ();
--// update_insn_infos ();
--// bb_reg_rename ();
-+ update_insns ();
-+ }
-
-- update_insns ();
-+ if (done)
-+ break;
- }
-
- if (do_shrink_stack_frame)
-@@ -1938,8 +1853,8 @@ namespace
- update_insns ();
- }
-
-- if (strchr (flag_bbb_opts, 'X') || strchr (flag_bbb_opts, 'x'))
-- dump_insns ("bbb 1", strchr (flag_bbb_opts, 'X'));
-+ if (strchr (string_bbb_opts, 'X') || strchr (string_bbb_opts, 'x'))
-+ dump_insns ("bbb", strchr (string_bbb_opts, 'X'));
- clear ();
-
- return 0;
-diff --git a/gcc/final.c b/gcc/final.c
-index 9d21ffc1baff..31f9b4815d75 100644
---- gcc/final.c
-+++ gcc/final.c
-@@ -2165,7 +2165,7 @@ final_scan_insn (rtx_insn *insn, FILE *file, int optimize_p ATTRIBUTE_UNUSED,
-
- /* Ignore deleted insns. These can occur when we split insns (due to a
- template of "#") while not optimizing. */
-- if (insn->deleted () || GET_CODE(insn) == VALUE || GET_CODE(insn) == CONST_FIXED)
-+ if (insn->deleted () || GET_CODE(insn) == VALUE || GET_CODE(insn) == CONST_FIXED || GET_CODE(insn) == DEBUG_IMPLICIT_PTR)
- return NEXT_INSN (insn);
-
- switch (GET_CODE (insn))
-diff --git a/gcc/passes.def b/gcc/passes.def
-index 5b78cbd7fb38..f48fd2581cba 100644
---- gcc/passes.def
-+++ gcc/passes.def
-@@ -447,6 +447,9 @@ along with GCC; see the file COPYING3. If not see
- NEXT_PASS (pass_ree);
- NEXT_PASS (pass_compare_elim_after_reload);
- NEXT_PASS (pass_branch_target_load_optimize1);
-+ NEXT_PASS (pass_thread_prologue_and_epilogue);
-+ NEXT_PASS (pass_rtl_dse2);
-+ NEXT_PASS (pass_stack_adjustments);
- NEXT_PASS (pass_jump2);
- NEXT_PASS (pass_duplicate_computed_gotos);
- NEXT_PASS (pass_sched_fusion);
-@@ -454,9 +457,6 @@ along with GCC; see the file COPYING3. If not see
- NEXT_PASS (pass_if_after_reload);
- NEXT_PASS (pass_regrename);
- NEXT_PASS (pass_cprop_hardreg);
-- NEXT_PASS (pass_thread_prologue_and_epilogue);
-- NEXT_PASS (pass_rtl_dse2);
-- NEXT_PASS (pass_stack_adjustments);
- NEXT_PASS (pass_fast_rtl_dce);
- NEXT_PASS (pass_reorder_blocks);
- NEXT_PASS (pass_bbb_optimizations);
-
-From 7c3f103835a555944b28e4e2a0726f33830abc6a Mon Sep 17 00:00:00 2001
-From: bebbo <bebbo(a)bejy.net>
-Date: Fri, 14 Apr 2017 18:35:14 +0200
-Subject: [PATCH 068/303] @N add eclipse project files
-
----
- .cproject | 180 +++++++++++++++++++++++++++++
- .project | 16 +++
- .settings/language.settings.xml | 25 ++++
- .settings/org.eclipse.cdt.codan.core.prefs | 71 ++++++++++++
- .settings/org.eclipse.cdt.core.prefs | 6 +
- .settings/org.eclipse.core.runtime.prefs | 5 +
- 6 files changed, 303 insertions(+)
- create mode 100755 .cproject
- create mode 100755 .settings/language.settings.xml
- create mode 100755 .settings/org.eclipse.cdt.codan.core.prefs
- create mode 100755 .settings/org.eclipse.cdt.core.prefs
- create mode 100755 .settings/org.eclipse.core.runtime.prefs
-
-diff --git a/.cproject b/.cproject
-new file mode 100755
-index 000000000000..62b1c0f38dcb
---- /dev/null
-+++ .cproject
-@@ -0,0 +1,180 @@
-+<?xml version="1.0" encoding="UTF-8" standalone="no"?>
-+<?fileVersion 4.0.0?><cproject storage_type_id="org.eclipse.cdt.core.XmlProjectDescriptionStorage">
-+ <storageModule moduleId="org.eclipse.cdt.core.settings">
-+ <cconfiguration id="cdt.managedbuild.config.gnu.cross.exe.debug.452878522">
-+ <storageModule buildSystemId="org.eclipse.cdt.managedbuilder.core.configurationDataProvider" id="cdt.managedbuild.config.gnu.cross.exe.debug.452878522" moduleId="org.eclipse.cdt.core.settings" name="Debug">
-+ <externalSettings/>
-+ <extensions>
-+ <extension id="org.eclipse.cdt.core.Cygwin_PE" point="org.eclipse.cdt.core.BinaryParser"/>
-+ <extension id="org.eclipse.cdt.core.GASErrorParser" point="org.eclipse.cdt.core.ErrorParser"/>
-+ <extension id="org.eclipse.cdt.core.GmakeErrorParser" point="org.eclipse.cdt.core.ErrorParser"/>
-+ <extension id="org.eclipse.cdt.core.CWDLocator" point="org.eclipse.cdt.core.ErrorParser"/>
-+ <extension id="org.eclipse.cdt.core.GCCErrorParser" point="org.eclipse.cdt.core.ErrorParser"/>
-+ <extension id="org.eclipse.cdt.core.GLDErrorParser" point="org.eclipse.cdt.core.ErrorParser"/>
-+ </extensions>
-+ </storageModule>
-+ <storageModule moduleId="cdtBuildSystem" version="4.0.0">
-+ <configuration artifactName="${ProjName}" buildArtefactType="org.eclipse.cdt.build.core.buildArtefactType.exe" buildProperties="org.eclipse.cdt.build.core.buildArtefactType=org.eclipse.cdt.build.core.buildArtefactType.exe,org.eclipse.cdt.build.core.buildType=org.eclipse.cdt.build.core.buildType.debug" cleanCommand="rm -rf" description="" id="cdt.managedbuild.config.gnu.cross.exe.debug.452878522" name="Debug" parent="cdt.managedbuild.config.gnu.cross.exe.debug">
-+ <folderInfo id="cdt.managedbuild.config.gnu.cross.exe.debug.452878522." name="/" resourcePath="">
-+ <toolChain id="cdt.managedbuild.toolchain.gnu.cygwin.base.2053847551" name="Cygwin GCC" superClass="cdt.managedbuild.toolchain.gnu.cygwin.base">
-+ <targetPlatform archList="all" binaryParser="org.eclipse.cdt.core.Cygwin_PE" id="cdt.managedbuild.target.gnu.platform.cygwin.base.2091243283" name="Debug Platform" osList="win32" superClass="cdt.managedbuild.target.gnu.platform.cygwin.base"/>
-+ <builder buildPath="${workspace_loc:/debugwin}/Debug" id="cdt.managedbuild.target.gnu.builder.cygwin.base.1660320342" keepEnvironmentInBuildfile="false" managedBuildOn="false" name="Gnu Make Builder" superClass="cdt.managedbuild.target.gnu.builder.cygwin.base">
-+ <outputEntries>
-+ <entry flags="VALUE_WORKSPACE_PATH|RESOLVED" kind="outputPath" name=""/>
-+ </outputEntries>
-+ </builder>
-+ <tool id="cdt.managedbuild.tool.gnu.assembler.cygwin.base.607722454" name="GCC Assembler" superClass="cdt.managedbuild.tool.gnu.assembler.cygwin.base">
-+ <option id="gnu.both.asm.option.include.paths.2094451885" name="Include paths (-I)" superClass="gnu.both.asm.option.include.paths" valueType="includePath">
-+ <listOptionValue builtIn="false" value=""${workspace_loc:/amigaos-cross-toolchain/.build-m68k/build/gcc-6/gcc}""/>
-+ <listOptionValue builtIn="false" value=""C:\cygwin\usr\include""/>
-+ </option>
-+ <inputType id="cdt.managedbuild.tool.gnu.assembler.input.1425989952" superClass="cdt.managedbuild.tool.gnu.assembler.input"/>
-+ </tool>
-+ <tool id="cdt.managedbuild.tool.gnu.archiver.cygwin.base.2119049474" name="GCC Archiver" superClass="cdt.managedbuild.tool.gnu.archiver.cygwin.base"/>
-+ <tool id="cdt.managedbuild.tool.gnu.cpp.compiler.cygwin.base.1103847968" name="Cygwin C++ Compiler" superClass="cdt.managedbuild.tool.gnu.cpp.compiler.cygwin.base">
-+ <option id="gnu.cpp.compiler.option.include.paths.466783605" name="Include paths (-I)" superClass="gnu.cpp.compiler.option.include.paths" useByScannerDiscovery="false" valueType="includePath">
-+ <listOptionValue builtIn="false" value=""C:\cygwin\usr\include""/>
-+ <listOptionValue builtIn="false" value=""${workspace_loc:/gcc-6/libcpp/include}""/>
-+ <listOptionValue builtIn="false" value=""D:\develop\workspaces\c1\amigaos-cross-toolchain\.build-m68k\build\gcc-6\gcc""/>
-+ </option>
-+ <option id="gnu.cpp.compiler.option.optimization.level.193715843" name="Optimization Level" superClass="gnu.cpp.compiler.option.optimization.level" useByScannerDiscovery="false" value="gnu.cpp.compiler.optimization.level.none" valueType="enumerated"/>
-+ <option id="gnu.cpp.compiler.option.debugging.level.2136883244" name="Debug Level" superClass="gnu.cpp.compiler.option.debugging.level" useByScannerDiscovery="false" value="gnu.cpp.compiler.debugging.level.max" valueType="enumerated"/>
-+ <option id="gnu.cpp.compiler.option.preprocessor.def.807277038" name="Defined symbols (-D)" superClass="gnu.cpp.compiler.option.preprocessor.def" useByScannerDiscovery="false" valueType="definedSymbols">
-+ <listOptionValue builtIn="false" value="IN_GCC=1"/>
-+ <listOptionValue builtIn="false" value="HAVE_cc0=1"/>
-+ </option>
-+ <inputType id="cdt.managedbuild.tool.gnu.cpp.compiler.input.cygwin.780175803" superClass="cdt.managedbuild.tool.gnu.cpp.compiler.input.cygwin"/>
-+ </tool>
-+ <tool id="cdt.managedbuild.tool.gnu.c.compiler.cygwin.base.1920331604" name="Cygwin C Compiler" superClass="cdt.managedbuild.tool.gnu.c.compiler.cygwin.base">
-+ <option id="gnu.c.compiler.option.include.paths.692774379" name="Include paths (-I)" superClass="gnu.c.compiler.option.include.paths" useByScannerDiscovery="false" valueType="includePath">
-+ <listOptionValue builtIn="false" value=""C:\cygwin\usr\include""/>
-+ <listOptionValue builtIn="false" value=""${workspace_loc:/gcc-6/libcpp/include}""/>
-+ <listOptionValue builtIn="false" value=""D:\develop\workspaces\c1\amigaos-cross-toolchain\.build-m68k\build\gcc-6\gcc""/>
-+ </option>
-+ <option defaultValue="gnu.c.optimization.level.none" id="gnu.c.compiler.option.optimization.level.227992926" name="Optimization Level" superClass="gnu.c.compiler.option.optimization.level" useByScannerDiscovery="false" valueType="enumerated"/>
-+ <option id="gnu.c.compiler.option.debugging.level.748883400" name="Debug Level" superClass="gnu.c.compiler.option.debugging.level" useByScannerDiscovery="false" value="gnu.c.debugging.level.max" valueType="enumerated"/>
-+ <option id="gnu.c.compiler.option.preprocessor.def.symbols.1982594045" name="Defined symbols (-D)" superClass="gnu.c.compiler.option.preprocessor.def.symbols" useByScannerDiscovery="false" valueType="definedSymbols">
-+ <listOptionValue builtIn="false" value="IN_GCC=1"/>
-+ <listOptionValue builtIn="false" value="HAVE_cc0=1"/>
-+ </option>
-+ <inputType id="cdt.managedbuild.tool.gnu.c.compiler.input.cygwin.2078467313" superClass="cdt.managedbuild.tool.gnu.c.compiler.input.cygwin"/>
-+ </tool>
-+ <tool id="cdt.managedbuild.tool.gnu.c.linker.cygwin.base.344641511" name="Cygwin C Linker" superClass="cdt.managedbuild.tool.gnu.c.linker.cygwin.base"/>
-+ <tool id="cdt.managedbuild.tool.gnu.cpp.linker.cygwin.base.968200320" name="Cygwin C++ Linker" superClass="cdt.managedbuild.tool.gnu.cpp.linker.cygwin.base">
-+ <option id="gnu.cpp.link.option.libs.260033787" name="Libraries (-l)" superClass="gnu.cpp.link.option.libs" valueType="libs"/>
-+ <inputType id="cdt.managedbuild.tool.gnu.cpp.linker.input.1537937183" superClass="cdt.managedbuild.tool.gnu.cpp.linker.input">
-+ <additionalInput kind="additionalinputdependency" paths="$(USER_OBJS)"/>
-+ <additionalInput kind="additionalinput" paths="$(LIBS)"/>
-+ </inputType>
-+ </tool>
-+ </toolChain>
-+ </folderInfo>
-+ <sourceEntries>
-+ <entry excluding="ada/|doc/|fortran/|ginclude/|go/|java/|jit/|lto/|objc/|objcp/|po/|testsuite/|config/aarch64/|config/alpha/|config/arc/|config/arm/|config/avr/|config/bfin/|config/c6x/|config/cr16/|config/cris/|config/epiphany/|config/fr30/|config/frv/|config/ft32/|config/h8300/|config/i386/|config/ia64/|config/iq2000/|config/lm32/|config/m32c/|config/m32r/|config/mcore/|config/mep/|config/microblaze/|config/mips/|config/mmix/|config/mn10300/|config/moxie/|config/msp430/|config/nds32/|config/nios2/|config/nvptx/|config/pa/|config/pdp11/|config/rl78/|config/rs6000/|config/rx/|config/s390/|config/sh/|config/sparc/|config/spu/|config/stormy16/|config/tilegx/|config/tilepro/|config/v850/|config/vax/|config/visium/|config/vms/|config/xtensa/" flags="VALUE_WORKSPACE_PATH" kind="sourcePath" name="gcc"/>
-+ </sourceEntries>
-+ </configuration>
-+ </storageModule>
-+ <storageModule moduleId="org.eclipse.cdt.core.externalSettings"/>
-+ </cconfiguration>
-+ <cconfiguration id="cdt.managedbuild.config.gnu.cross.exe.release.811454954">
-+ <storageModule buildSystemId="org.eclipse.cdt.managedbuilder.core.configurationDataProvider" id="cdt.managedbuild.config.gnu.cross.exe.release.811454954" moduleId="org.eclipse.cdt.core.settings" name="Release">
-+ <externalSettings/>
-+ <extensions>
-+ <extension id="org.eclipse.cdt.core.ELF" point="org.eclipse.cdt.core.BinaryParser"/>
-+ <extension id="org.eclipse.cdt.core.GASErrorParser" point="org.eclipse.cdt.core.ErrorParser"/>
-+ <extension id="org.eclipse.cdt.core.GmakeErrorParser" point="org.eclipse.cdt.core.ErrorParser"/>
-+ <extension id="org.eclipse.cdt.core.CWDLocator" point="org.eclipse.cdt.core.ErrorParser"/>
-+ <extension id="org.eclipse.cdt.core.GCCErrorParser" point="org.eclipse.cdt.core.ErrorParser"/>
-+ <extension id="org.eclipse.cdt.core.GLDErrorParser" point="org.eclipse.cdt.core.ErrorParser"/>
-+ </extensions>
-+ </storageModule>
-+ <storageModule moduleId="cdtBuildSystem" version="4.0.0">
-+ <configuration artifactName="${ProjName}" buildArtefactType="org.eclipse.cdt.build.core.buildArtefactType.exe" buildProperties="org.eclipse.cdt.build.core.buildArtefactType=org.eclipse.cdt.build.core.buildArtefactType.exe,org.eclipse.cdt.build.core.buildType=org.eclipse.cdt.build.core.buildType.release" cleanCommand="rm -rf" description="" id="cdt.managedbuild.config.gnu.cross.exe.release.811454954" name="Release" parent="cdt.managedbuild.config.gnu.cross.exe.release">
-+ <folderInfo id="cdt.managedbuild.config.gnu.cross.exe.release.811454954." name="/" resourcePath="">
-+ <toolChain id="cdt.managedbuild.toolchain.gnu.cross.exe.release.101222491" name="Cross GCC" superClass="cdt.managedbuild.toolchain.gnu.cross.exe.release">
-+ <targetPlatform archList="all" binaryParser="org.eclipse.cdt.core.ELF" id="cdt.managedbuild.targetPlatform.gnu.cross.1798723854" isAbstract="false" osList="all" superClass="cdt.managedbuild.targetPlatform.gnu.cross"/>
-+ <builder buildPath="${workspace_loc:/debugwin}/Release" id="cdt.managedbuild.builder.gnu.cross.507087034" keepEnvironmentInBuildfile="false" managedBuildOn="true" name="Gnu Make Builder" superClass="cdt.managedbuild.builder.gnu.cross"/>
-+ <tool id="cdt.managedbuild.tool.gnu.cross.c.compiler.1834281466" name="Cross GCC Compiler" superClass="cdt.managedbuild.tool.gnu.cross.c.compiler">
-+ <option defaultValue="gnu.c.optimization.level.most" id="gnu.c.compiler.option.optimization.level.1686563067" name="Optimization Level" superClass="gnu.c.compiler.option.optimization.level" useByScannerDiscovery="false" valueType="enumerated"/>
-+ <option id="gnu.c.compiler.option.debugging.level.60172226" name="Debug Level" superClass="gnu.c.compiler.option.debugging.level" useByScannerDiscovery="false" value="gnu.c.debugging.level.none" valueType="enumerated"/>
-+ <option id="gnu.c.compiler.option.include.paths.696908692" name="Include paths (-I)" superClass="gnu.c.compiler.option.include.paths" useByScannerDiscovery="false" valueType="includePath">
-+ <listOptionValue builtIn="false" value=""C:\cygwin\usr\include""/>
-+ </option>
-+ <option id="gnu.c.compiler.option.preprocessor.def.symbols.652362073" name="Defined symbols (-D)" superClass="gnu.c.compiler.option.preprocessor.def.symbols" useByScannerDiscovery="false" valueType="definedSymbols">
-+ <listOptionValue builtIn="false" value="IN_GCC=1"/>
-+ <listOptionValue builtIn="false" value="HAVE_cc0=1"/>
-+ </option>
-+ <inputType id="cdt.managedbuild.tool.gnu.c.compiler.input.1150724656" superClass="cdt.managedbuild.tool.gnu.c.compiler.input"/>
-+ </tool>
-+ <tool id="cdt.managedbuild.tool.gnu.cross.cpp.compiler.1042604749" name="Cross G++ Compiler" superClass="cdt.managedbuild.tool.gnu.cross.cpp.compiler">
-+ <option id="gnu.cpp.compiler.option.optimization.level.2088586809" name="Optimization Level" superClass="gnu.cpp.compiler.option.optimization.level" useByScannerDiscovery="false" value="gnu.cpp.compiler.optimization.level.most" valueType="enumerated"/>
-+ <option id="gnu.cpp.compiler.option.debugging.level.1993778911" name="Debug Level" superClass="gnu.cpp.compiler.option.debugging.level" useByScannerDiscovery="false" value="gnu.cpp.compiler.debugging.level.none" valueType="enumerated"/>
-+ <option id="gnu.cpp.compiler.option.include.paths.1936413739" name="Include paths (-I)" superClass="gnu.cpp.compiler.option.include.paths" useByScannerDiscovery="false" valueType="includePath">
-+ <listOptionValue builtIn="false" value=""C:\cygwin\usr\include""/>
-+ </option>
-+ <option id="gnu.cpp.compiler.option.preprocessor.def.625117841" name="Defined symbols (-D)" superClass="gnu.cpp.compiler.option.preprocessor.def" useByScannerDiscovery="false" valueType="definedSymbols">
-+ <listOptionValue builtIn="false" value="IN_GCC=1"/>
-+ <listOptionValue builtIn="false" value="HAVE_cc0=1"/>
-+ </option>
-+ <inputType id="cdt.managedbuild.tool.gnu.cpp.compiler.input.1133865092" superClass="cdt.managedbuild.tool.gnu.cpp.compiler.input"/>
-+ </tool>
-+ <tool id="cdt.managedbuild.tool.gnu.cross.c.linker.946489608" name="Cross GCC Linker" superClass="cdt.managedbuild.tool.gnu.cross.c.linker"/>
-+ <tool id="cdt.managedbuild.tool.gnu.cross.cpp.linker.738916918" name="Cross G++ Linker" superClass="cdt.managedbuild.tool.gnu.cross.cpp.linker">
-+ <inputType id="cdt.managedbuild.tool.gnu.cpp.linker.input.1880308865" superClass="cdt.managedbuild.tool.gnu.cpp.linker.input">
-+ <additionalInput kind="additionalinputdependency" paths="$(USER_OBJS)"/>
-+ <additionalInput kind="additionalinput" paths="$(LIBS)"/>
-+ </inputType>
-+ </tool>
-+ <tool id="cdt.managedbuild.tool.gnu.cross.archiver.1813524686" name="Cross GCC Archiver" superClass="cdt.managedbuild.tool.gnu.cross.archiver"/>
-+ <tool id="cdt.managedbuild.tool.gnu.cross.assembler.1395544547" name="Cross GCC Assembler" superClass="cdt.managedbuild.tool.gnu.cross.assembler">
-+ <option id="gnu.both.asm.option.include.paths.1443815690" name="Include paths (-I)" superClass="gnu.both.asm.option.include.paths" valueType="includePath">
-+ <listOptionValue builtIn="false" value=""C:\cygwin\usr\include""/>
-+ </option>
-+ <inputType id="cdt.managedbuild.tool.gnu.assembler.input.1421786104" superClass="cdt.managedbuild.tool.gnu.assembler.input"/>
-+ </tool>
-+ </toolChain>
-+ </folderInfo>
-+ <sourceEntries>
-+ <entry excluding="src" flags="VALUE_WORKSPACE_PATH|RESOLVED" kind="sourcePath" name=""/>
-+ <entry flags="VALUE_WORKSPACE_PATH|RESOLVED" kind="sourcePath" name="src"/>
-+ </sourceEntries>
-+ </configuration>
-+ </storageModule>
-+ <storageModule moduleId="org.eclipse.cdt.core.externalSettings"/>
-+ </cconfiguration>
-+ </storageModule>
-+ <storageModule moduleId="cdtBuildSystem" version="4.0.0">
-+ <project id="debugwin.cdt.managedbuild.target.gnu.cross.exe.1884740625" name="Executable" projectType="cdt.managedbuild.target.gnu.cross.exe"/>
-+ </storageModule>
-+ <storageModule moduleId="org.eclipse.cdt.core.LanguageSettingsProviders"/>
-+ <storageModule moduleId="refreshScope" versionNumber="2">
-+ <configuration configurationName="Debug">
-+ <resource resourceType="PROJECT" workspacePath="/gcc-6"/>
-+ </configuration>
-+ <configuration configurationName="Release">
-+ <resource resourceType="PROJECT" workspacePath="/gcc-6"/>
-+ </configuration>
-+ </storageModule>
-+ <storageModule moduleId="org.eclipse.cdt.make.core.buildtargets"/>
-+ <storageModule moduleId="scannerConfiguration">
-+ <autodiscovery enabled="true" problemReportingEnabled="true" selectedProfileId=""/>
-+ <scannerConfigBuildInfo instanceId="cdt.managedbuild.config.gnu.cross.exe.release.811454954;cdt.managedbuild.config.gnu.cross.exe.release.811454954.;cdt.managedbuild.tool.gnu.cross.c.compiler.1834281466;cdt.managedbuild.tool.gnu.c.compiler.input.1150724656">
-+ <autodiscovery enabled="true" problemReportingEnabled="true" selectedProfileId=""/>
-+ </scannerConfigBuildInfo>
-+ <scannerConfigBuildInfo instanceId="cdt.managedbuild.config.gnu.cross.exe.debug.452878522;cdt.managedbuild.config.gnu.cross.exe.debug.452878522.;cdt.managedbuild.tool.gnu.cross.c.compiler.502147450;cdt.managedbuild.tool.gnu.c.compiler.input.1173428818">
-+ <autodiscovery enabled="true" problemReportingEnabled="true" selectedProfileId=""/>
-+ </scannerConfigBuildInfo>
-+ <scannerConfigBuildInfo instanceId="cdt.managedbuild.config.gnu.cross.exe.debug.452878522;cdt.managedbuild.config.gnu.cross.exe.debug.452878522.;cdt.managedbuild.tool.gnu.cpp.compiler.cygwin.base.1103847968;cdt.managedbuild.tool.gnu.cpp.compiler.input.cygwin.780175803">
-+ <autodiscovery enabled="true" problemReportingEnabled="true" selectedProfileId=""/>
-+ </scannerConfigBuildInfo>
-+ <scannerConfigBuildInfo instanceId="cdt.managedbuild.config.gnu.cross.exe.debug.452878522;cdt.managedbuild.config.gnu.cross.exe.debug.452878522.;cdt.managedbuild.tool.gnu.c.compiler.cygwin.base.1920331604;cdt.managedbuild.tool.gnu.c.compiler.input.cygwin.2078467313">
-+ <autodiscovery enabled="true" problemReportingEnabled="true" selectedProfileId=""/>
-+ </scannerConfigBuildInfo>
-+ <scannerConfigBuildInfo instanceId="cdt.managedbuild.config.gnu.cross.exe.debug.452878522;cdt.managedbuild.config.gnu.cross.exe.debug.452878522.;cdt.managedbuild.tool.gnu.cross.cpp.compiler.216739552;cdt.managedbuild.tool.gnu.cpp.compiler.input.1269341019">
-+ <autodiscovery enabled="true" problemReportingEnabled="true" selectedProfileId=""/>
-+ </scannerConfigBuildInfo>
-+ <scannerConfigBuildInfo instanceId="cdt.managedbuild.config.gnu.cross.exe.release.811454954;cdt.managedbuild.config.gnu.cross.exe.release.811454954.;cdt.managedbuild.tool.gnu.cross.cpp.compiler.1042604749;cdt.managedbuild.tool.gnu.cpp.compiler.input.1133865092">
-+ <autodiscovery enabled="true" problemReportingEnabled="true" selectedProfileId=""/>
-+ </scannerConfigBuildInfo>
-+ </storageModule>
-+</cproject>
-diff --git a/.project b/.project
-index ab5c4b198d08..22b8c5a11f48 100644
---- .project
-+++ .project
-@@ -5,7 +5,23 @@
- <projects>
- </projects>
- <buildSpec>
-+ <buildCommand>
-+ <name>org.eclipse.cdt.managedbuilder.core.genmakebuilder</name>
-+ <triggers>clean,full,incremental,</triggers>
-+ <arguments>
-+ </arguments>
-+ </buildCommand>
-+ <buildCommand>
-+ <name>org.eclipse.cdt.managedbuilder.core.ScannerConfigBuilder</name>
-+ <triggers>full,incremental,</triggers>
-+ <arguments>
-+ </arguments>
-+ </buildCommand>
- </buildSpec>
- <natures>
-+ <nature>org.eclipse.cdt.core.cnature</nature>
-+ <nature>org.eclipse.cdt.core.ccnature</nature>
-+ <nature>org.eclipse.cdt.managedbuilder.core.managedBuildNature</nature>
-+ <nature>org.eclipse.cdt.managedbuilder.core.ScannerConfigNature</nature>
- </natures>
- </projectDescription>
-diff --git a/.settings/language.settings.xml b/.settings/language.settings.xml
-new file mode 100755
-index 000000000000..c6ac9211311a
---- /dev/null
-+++ .settings/language.settings.xml
-@@ -0,0 +1,25 @@
-+<?xml version="1.0" encoding="UTF-8" standalone="no"?>
-+<project>
-+ <configuration id="cdt.managedbuild.config.gnu.cross.exe.debug.452878522" name="Debug">
-+ <extension point="org.eclipse.cdt.core.LanguageSettingsProvider">
-+ <provider copy-of="extension" id="org.eclipse.cdt.ui.UserLanguageSettingsProvider"/>
-+ <provider-reference id="org.eclipse.cdt.core.ReferencedProjectsLanguageSettingsProvider" ref="shared-provider"/>
-+ <provider-reference id="org.eclipse.cdt.managedbuilder.core.MBSLanguageSettingsProvider" ref="shared-provider"/>
-+ <provider class="org.eclipse.cdt.managedbuilder.internal.language.settings.providers.GCCBuiltinSpecsDetectorCygwin" console="false" env-hash="1253352314297216180" id="org.eclipse.cdt.managedbuilder.core.GCCBuiltinSpecsDetectorCygwin" keep-relative-paths="false" name="CDT GCC Built-in Compiler Settings Cygwin" parameter="${COMMAND} ${FLAGS} -E -P -v -dD "${INPUTS}"" prefer-non-shared="true">
-+ <language-scope id="org.eclipse.cdt.core.gcc"/>
-+ <language-scope id="org.eclipse.cdt.core.g++"/>
-+ </provider>
-+ </extension>
-+ </configuration>
-+ <configuration id="cdt.managedbuild.config.gnu.cross.exe.release.811454954" name="Release">
-+ <extension point="org.eclipse.cdt.core.LanguageSettingsProvider">
-+ <provider copy-of="extension" id="org.eclipse.cdt.ui.UserLanguageSettingsProvider"/>
-+ <provider-reference id="org.eclipse.cdt.core.ReferencedProjectsLanguageSettingsProvider" ref="shared-provider"/>
-+ <provider-reference id="org.eclipse.cdt.managedbuilder.core.MBSLanguageSettingsProvider" ref="shared-provider"/>
-+ <provider class="org.eclipse.cdt.internal.build.crossgcc.CrossGCCBuiltinSpecsDetector" console="false" env-hash="860895942062206931" id="org.eclipse.cdt.build.crossgcc.CrossGCCBuiltinSpecsDetector" keep-relative-paths="false" name="CDT Cross GCC Built-in Compiler Settings" parameter="${COMMAND} ${FLAGS} -E -P -v -dD "${INPUTS}"" prefer-non-shared="true">
-+ <language-scope id="org.eclipse.cdt.core.gcc"/>
-+ <language-scope id="org.eclipse.cdt.core.g++"/>
-+ </provider>
-+ </extension>
-+ </configuration>
-+</project>
-diff --git a/.settings/org.eclipse.cdt.codan.core.prefs b/.settings/org.eclipse.cdt.codan.core.prefs
-new file mode 100755
-index 000000000000..b5248c620107
---- /dev/null
-+++ .settings/org.eclipse.cdt.codan.core.prefs
-@@ -0,0 +1,71 @@
-+eclipse.preferences.version=1
-+org.eclipse.cdt.codan.checkers.errnoreturn=Warning
-+org.eclipse.cdt.codan.checkers.errnoreturn.params={launchModes\=>{RUN_ON_FULL_BUILD\=>true,RUN_ON_INC_BUILD\=>true,RUN_ON_FILE_OPEN\=>false,RUN_ON_FILE_SAVE\=>false,RUN_AS_YOU_TYPE\=>true,RUN_ON_DEMAND\=>true},suppression_comment\=>"@suppress(\\"No return\\")",implicit\=>false}
-+org.eclipse.cdt.codan.checkers.errreturnvalue=Error
-+org.eclipse.cdt.codan.checkers.errreturnvalue.params={launchModes\=>{RUN_ON_FULL_BUILD\=>true,RUN_ON_INC_BUILD\=>true,RUN_ON_FILE_OPEN\=>false,RUN_ON_FILE_SAVE\=>false,RUN_AS_YOU_TYPE\=>true,RUN_ON_DEMAND\=>true},suppression_comment\=>"@suppress(\\"Unused return value\\")"}
-+org.eclipse.cdt.codan.checkers.nocommentinside=-Error
-+org.eclipse.cdt.codan.checkers.nocommentinside.params={launchModes\=>{RUN_ON_FULL_BUILD\=>true,RUN_ON_INC_BUILD\=>true,RUN_ON_FILE_OPEN\=>false,RUN_ON_FILE_SAVE\=>false,RUN_AS_YOU_TYPE\=>true,RUN_ON_DEMAND\=>true},suppression_comment\=>"@suppress(\\"Nesting comments\\")"}
-+org.eclipse.cdt.codan.checkers.nolinecomment=-Error
-+org.eclipse.cdt.codan.checkers.nolinecomment.params={launchModes\=>{RUN_ON_FULL_BUILD\=>true,RUN_ON_INC_BUILD\=>true,RUN_ON_FILE_OPEN\=>false,RUN_ON_FILE_SAVE\=>false,RUN_AS_YOU_TYPE\=>true,RUN_ON_DEMAND\=>true},suppression_comment\=>"@suppress(\\"Line comments\\")"}
-+org.eclipse.cdt.codan.checkers.noreturn=Error
-+org.eclipse.cdt.codan.checkers.noreturn.params={launchModes\=>{RUN_ON_FULL_BUILD\=>true,RUN_ON_INC_BUILD\=>true,RUN_ON_FILE_OPEN\=>false,RUN_ON_FILE_SAVE\=>false,RUN_AS_YOU_TYPE\=>true,RUN_ON_DEMAND\=>true},suppression_comment\=>"@suppress(\\"No return value\\")",implicit\=>false}
-+org.eclipse.cdt.codan.internal.checkers.AbstractClassCreation=Error
-+org.eclipse.cdt.codan.internal.checkers.AbstractClassCreation.params={launchModes\=>{RUN_ON_FULL_BUILD\=>true,RUN_ON_INC_BUILD\=>true,RUN_ON_FILE_OPEN\=>false,RUN_ON_FILE_SAVE\=>false,RUN_AS_YOU_TYPE\=>true,RUN_ON_DEMAND\=>true},suppression_comment\=>"@suppress(\\"Abstract class cannot be instantiated\\")"}
-+org.eclipse.cdt.codan.internal.checkers.AmbiguousProblem=Error
-+org.eclipse.cdt.codan.internal.checkers.AmbiguousProblem.params={launchModes\=>{RUN_ON_FULL_BUILD\=>true,RUN_ON_INC_BUILD\=>true,RUN_ON_FILE_OPEN\=>false,RUN_ON_FILE_SAVE\=>false,RUN_AS_YOU_TYPE\=>true,RUN_ON_DEMAND\=>true},suppression_comment\=>"@suppress(\\"Ambiguous problem\\")"}
-+org.eclipse.cdt.codan.internal.checkers.AssignmentInConditionProblem=Warning
-+org.eclipse.cdt.codan.internal.checkers.AssignmentInConditionProblem.params={launchModes\=>{RUN_ON_FULL_BUILD\=>true,RUN_ON_INC_BUILD\=>true,RUN_ON_FILE_OPEN\=>false,RUN_ON_FILE_SAVE\=>false,RUN_AS_YOU_TYPE\=>true,RUN_ON_DEMAND\=>true},suppression_comment\=>"@suppress(\\"Assignment in condition\\")"}
-+org.eclipse.cdt.codan.internal.checkers.AssignmentToItselfProblem=Error
-+org.eclipse.cdt.codan.internal.checkers.AssignmentToItselfProblem.params={launchModes\=>{RUN_ON_FULL_BUILD\=>true,RUN_ON_INC_BUILD\=>true,RUN_ON_FILE_OPEN\=>false,RUN_ON_FILE_SAVE\=>false,RUN_AS_YOU_TYPE\=>true,RUN_ON_DEMAND\=>true},suppression_comment\=>"@suppress(\\"Assignment to itself\\")"}
-+org.eclipse.cdt.codan.internal.checkers.CaseBreakProblem=Warning
-+org.eclipse.cdt.codan.internal.checkers.CaseBreakProblem.params={launchModes\=>{RUN_ON_FULL_BUILD\=>true,RUN_ON_INC_BUILD\=>true,RUN_ON_FILE_OPEN\=>false,RUN_ON_FILE_SAVE\=>false,RUN_AS_YOU_TYPE\=>true,RUN_ON_DEMAND\=>true},suppression_comment\=>"@suppress(\\"No break at end of case\\")",no_break_comment\=>"no break",last_case_param\=>false,empty_case_param\=>false}
-+org.eclipse.cdt.codan.internal.checkers.CatchByReference=Warning
-+org.eclipse.cdt.codan.internal.checkers.CatchByReference.params={launchModes\=>{RUN_ON_FULL_BUILD\=>true,RUN_ON_INC_BUILD\=>true,RUN_ON_FILE_OPEN\=>false,RUN_ON_FILE_SAVE\=>false,RUN_AS_YOU_TYPE\=>true,RUN_ON_DEMAND\=>true},suppression_comment\=>"@suppress(\\"Catching by reference is recommended\\")",unknown\=>false,exceptions\=>()}
-+org.eclipse.cdt.codan.internal.checkers.CircularReferenceProblem=Error
-+org.eclipse.cdt.codan.internal.checkers.CircularReferenceProblem.params={launchModes\=>{RUN_ON_FULL_BUILD\=>true,RUN_ON_INC_BUILD\=>true,RUN_ON_FILE_OPEN\=>false,RUN_ON_FILE_SAVE\=>false,RUN_AS_YOU_TYPE\=>true,RUN_ON_DEMAND\=>true},suppression_comment\=>"@suppress(\\"Circular inheritance\\")"}
-+org.eclipse.cdt.codan.internal.checkers.ClassMembersInitialization=Warning
-+org.eclipse.cdt.codan.internal.checkers.ClassMembersInitialization.params={launchModes\=>{RUN_ON_FULL_BUILD\=>true,RUN_ON_INC_BUILD\=>true,RUN_ON_FILE_OPEN\=>false,RUN_ON_FILE_SAVE\=>false,RUN_AS_YOU_TYPE\=>true,RUN_ON_DEMAND\=>true},suppression_comment\=>"@suppress(\\"Class members should be properly initialized\\")",skip\=>true}
-+org.eclipse.cdt.codan.internal.checkers.FieldResolutionProblem=Error
-+org.eclipse.cdt.codan.internal.checkers.FieldResolutionProblem.params={launchModes\=>{RUN_ON_FULL_BUILD\=>true,RUN_ON_INC_BUILD\=>true,RUN_ON_FILE_OPEN\=>false,RUN_ON_FILE_SAVE\=>false,RUN_AS_YOU_TYPE\=>true,RUN_ON_DEMAND\=>true},suppression_comment\=>"@suppress(\\"Field cannot be resolved\\")"}
-+org.eclipse.cdt.codan.internal.checkers.FunctionResolutionProblem=Error
-+org.eclipse.cdt.codan.internal.checkers.FunctionResolutionProblem.params={launchModes\=>{RUN_ON_FULL_BUILD\=>true,RUN_ON_INC_BUILD\=>true,RUN_ON_FILE_OPEN\=>false,RUN_ON_FILE_SAVE\=>false,RUN_AS_YOU_TYPE\=>true,RUN_ON_DEMAND\=>true},suppression_comment\=>"@suppress(\\"Function cannot be resolved\\")"}
-+org.eclipse.cdt.codan.internal.checkers.InvalidArguments=Error
-+org.eclipse.cdt.codan.internal.checkers.InvalidArguments.params={launchModes\=>{RUN_ON_FULL_BUILD\=>true,RUN_ON_INC_BUILD\=>true,RUN_ON_FILE_OPEN\=>false,RUN_ON_FILE_SAVE\=>false,RUN_AS_YOU_TYPE\=>true,RUN_ON_DEMAND\=>true},suppression_comment\=>"@suppress(\\"Invalid arguments\\")"}
-+org.eclipse.cdt.codan.internal.checkers.InvalidTemplateArgumentsProblem=Error
-+org.eclipse.cdt.codan.internal.checkers.InvalidTemplateArgumentsProblem.params={launchModes\=>{RUN_ON_FULL_BUILD\=>true,RUN_ON_INC_BUILD\=>true,RUN_ON_FILE_OPEN\=>false,RUN_ON_FILE_SAVE\=>false,RUN_AS_YOU_TYPE\=>true,RUN_ON_DEMAND\=>true},suppression_comment\=>"@suppress(\\"Invalid template argument\\")"}
-+org.eclipse.cdt.codan.internal.checkers.LabelStatementNotFoundProblem=Error
-+org.eclipse.cdt.codan.internal.checkers.LabelStatementNotFoundProblem.params={launchModes\=>{RUN_ON_FULL_BUILD\=>true,RUN_ON_INC_BUILD\=>true,RUN_ON_FILE_OPEN\=>false,RUN_ON_FILE_SAVE\=>false,RUN_AS_YOU_TYPE\=>true,RUN_ON_DEMAND\=>true},suppression_comment\=>"@suppress(\\"Label statement not found\\")"}
-+org.eclipse.cdt.codan.internal.checkers.MemberDeclarationNotFoundProblem=Error
-+org.eclipse.cdt.codan.internal.checkers.MemberDeclarationNotFoundProblem.params={launchModes\=>{RUN_ON_FULL_BUILD\=>true,RUN_ON_INC_BUILD\=>true,RUN_ON_FILE_OPEN\=>false,RUN_ON_FILE_SAVE\=>false,RUN_AS_YOU_TYPE\=>true,RUN_ON_DEMAND\=>true},suppression_comment\=>"@suppress(\\"Member declaration not found\\")"}
-+org.eclipse.cdt.codan.internal.checkers.MethodResolutionProblem=Error
-+org.eclipse.cdt.codan.internal.checkers.MethodResolutionProblem.params={launchModes\=>{RUN_ON_FULL_BUILD\=>true,RUN_ON_INC_BUILD\=>true,RUN_ON_FILE_OPEN\=>false,RUN_ON_FILE_SAVE\=>false,RUN_AS_YOU_TYPE\=>true,RUN_ON_DEMAND\=>true},suppression_comment\=>"@suppress(\\"Method cannot be resolved\\")"}
-+org.eclipse.cdt.codan.internal.checkers.NamingConventionFunctionChecker=-Info
-+org.eclipse.cdt.codan.internal.checkers.NamingConventionFunctionChecker.params={launchModes\=>{RUN_ON_FULL_BUILD\=>true,RUN_ON_INC_BUILD\=>true,RUN_ON_FILE_OPEN\=>false,RUN_ON_FILE_SAVE\=>false,RUN_AS_YOU_TYPE\=>true,RUN_ON_DEMAND\=>true},suppression_comment\=>"@suppress(\\"Name convention for function\\")",pattern\=>"^[a-z]",macro\=>true,exceptions\=>()}
-+org.eclipse.cdt.codan.internal.checkers.NonVirtualDestructorProblem=Warning
-+org.eclipse.cdt.codan.internal.checkers.NonVirtualDestructorProblem.params={launchModes\=>{RUN_ON_FULL_BUILD\=>true,RUN_ON_INC_BUILD\=>true,RUN_ON_FILE_OPEN\=>false,RUN_ON_FILE_SAVE\=>false,RUN_AS_YOU_TYPE\=>true,RUN_ON_DEMAND\=>true},suppression_comment\=>"@suppress(\\"Class has a virtual method and non-virtual destructor\\")"}
-+org.eclipse.cdt.codan.internal.checkers.OverloadProblem=Error
-+org.eclipse.cdt.codan.internal.checkers.OverloadProblem.params={launchModes\=>{RUN_ON_FULL_BUILD\=>true,RUN_ON_INC_BUILD\=>true,RUN_ON_FILE_OPEN\=>false,RUN_ON_FILE_SAVE\=>false,RUN_AS_YOU_TYPE\=>true,RUN_ON_DEMAND\=>true},suppression_comment\=>"@suppress(\\"Invalid overload\\")"}
-+org.eclipse.cdt.codan.internal.checkers.RedeclarationProblem=Error
-+org.eclipse.cdt.codan.internal.checkers.RedeclarationProblem.params={launchModes\=>{RUN_ON_FULL_BUILD\=>true,RUN_ON_INC_BUILD\=>true,RUN_ON_FILE_OPEN\=>false,RUN_ON_FILE_SAVE\=>false,RUN_AS_YOU_TYPE\=>true,RUN_ON_DEMAND\=>true},suppression_comment\=>"@suppress(\\"Invalid redeclaration\\")"}
-+org.eclipse.cdt.codan.internal.checkers.RedefinitionProblem=Error
-+org.eclipse.cdt.codan.internal.checkers.RedefinitionProblem.params={launchModes\=>{RUN_ON_FULL_BUILD\=>true,RUN_ON_INC_BUILD\=>true,RUN_ON_FILE_OPEN\=>false,RUN_ON_FILE_SAVE\=>false,RUN_AS_YOU_TYPE\=>true,RUN_ON_DEMAND\=>true},suppression_comment\=>"@suppress(\\"Invalid redefinition\\")"}
-+org.eclipse.cdt.codan.internal.checkers.ReturnStyleProblem=-Warning
-+org.eclipse.cdt.codan.internal.checkers.ReturnStyleProblem.params={launchModes\=>{RUN_ON_FULL_BUILD\=>true,RUN_ON_INC_BUILD\=>true,RUN_ON_FILE_OPEN\=>false,RUN_ON_FILE_SAVE\=>false,RUN_AS_YOU_TYPE\=>true,RUN_ON_DEMAND\=>true},suppression_comment\=>"@suppress(\\"Return with parenthesis\\")"}
-+org.eclipse.cdt.codan.internal.checkers.ScanfFormatStringSecurityProblem=-Warning
-+org.eclipse.cdt.codan.internal.checkers.ScanfFormatStringSecurityProblem.params={launchModes\=>{RUN_ON_FULL_BUILD\=>true,RUN_ON_INC_BUILD\=>true,RUN_ON_FILE_OPEN\=>false,RUN_ON_FILE_SAVE\=>false,RUN_AS_YOU_TYPE\=>true,RUN_ON_DEMAND\=>true},suppression_comment\=>"@suppress(\\"Format String Vulnerability\\")"}
-+org.eclipse.cdt.codan.internal.checkers.StatementHasNoEffectProblem=Warning
-+org.eclipse.cdt.codan.internal.checkers.StatementHasNoEffectProblem.params={launchModes\=>{RUN_ON_FULL_BUILD\=>true,RUN_ON_INC_BUILD\=>true,RUN_ON_FILE_OPEN\=>false,RUN_ON_FILE_SAVE\=>false,RUN_AS_YOU_TYPE\=>true,RUN_ON_DEMAND\=>true},suppression_comment\=>"@suppress(\\"Statement has no effect\\")",macro\=>true,exceptions\=>()}
-+org.eclipse.cdt.codan.internal.checkers.SuggestedParenthesisProblem=Warning
-+org.eclipse.cdt.codan.internal.checkers.SuggestedParenthesisProblem.params={launchModes\=>{RUN_ON_FULL_BUILD\=>true,RUN_ON_INC_BUILD\=>true,RUN_ON_FILE_OPEN\=>false,RUN_ON_FILE_SAVE\=>false,RUN_AS_YOU_TYPE\=>true,RUN_ON_DEMAND\=>true},suppression_comment\=>"@suppress(\\"Suggested parenthesis around expression\\")",paramNot\=>false}
-+org.eclipse.cdt.codan.internal.checkers.SuspiciousSemicolonProblem=Warning
-+org.eclipse.cdt.codan.internal.checkers.SuspiciousSemicolonProblem.params={launchModes\=>{RUN_ON_FULL_BUILD\=>true,RUN_ON_INC_BUILD\=>true,RUN_ON_FILE_OPEN\=>false,RUN_ON_FILE_SAVE\=>false,RUN_AS_YOU_TYPE\=>true,RUN_ON_DEMAND\=>true},suppression_comment\=>"@suppress(\\"Suspicious semicolon\\")",else\=>false,afterelse\=>false}
-+org.eclipse.cdt.codan.internal.checkers.TypeResolutionProblem=Error
-+org.eclipse.cdt.codan.internal.checkers.TypeResolutionProblem.params={launchModes\=>{RUN_ON_FULL_BUILD\=>true,RUN_ON_INC_BUILD\=>true,RUN_ON_FILE_OPEN\=>false,RUN_ON_FILE_SAVE\=>false,RUN_AS_YOU_TYPE\=>true,RUN_ON_DEMAND\=>true},suppression_comment\=>"@suppress(\\"Type cannot be resolved\\")"}
-+org.eclipse.cdt.codan.internal.checkers.UnusedFunctionDeclarationProblem=Warning
-+org.eclipse.cdt.codan.internal.checkers.UnusedFunctionDeclarationProblem.params={launchModes\=>{RUN_ON_FULL_BUILD\=>true,RUN_ON_INC_BUILD\=>true,RUN_ON_FILE_OPEN\=>false,RUN_ON_FILE_SAVE\=>false,RUN_AS_YOU_TYPE\=>true,RUN_ON_DEMAND\=>true},suppression_comment\=>"@suppress(\\"Unused function declaration\\")",macro\=>true}
-+org.eclipse.cdt.codan.internal.checkers.UnusedStaticFunctionProblem=Warning
-+org.eclipse.cdt.codan.internal.checkers.UnusedStaticFunctionProblem.params={launchModes\=>{RUN_ON_FULL_BUILD\=>true,RUN_ON_INC_BUILD\=>true,RUN_ON_FILE_OPEN\=>false,RUN_ON_FILE_SAVE\=>false,RUN_AS_YOU_TYPE\=>true,RUN_ON_DEMAND\=>true},suppression_comment\=>"@suppress(\\"Unused static function\\")",macro\=>true}
-+org.eclipse.cdt.codan.internal.checkers.UnusedVariableDeclarationProblem=Warning
-+org.eclipse.cdt.codan.internal.checkers.UnusedVariableDeclarationProblem.params={launchModes\=>{RUN_ON_FULL_BUILD\=>true,RUN_ON_INC_BUILD\=>true,RUN_ON_FILE_OPEN\=>false,RUN_ON_FILE_SAVE\=>false,RUN_AS_YOU_TYPE\=>true,RUN_ON_DEMAND\=>true},suppression_comment\=>"@suppress(\\"Unused variable declaration in file scope\\")",macro\=>true,exceptions\=>("@(\#)","$Id")}
-+org.eclipse.cdt.codan.internal.checkers.VariableResolutionProblem=Error
-+org.eclipse.cdt.codan.internal.checkers.VariableResolutionProblem.params={launchModes\=>{RUN_ON_FULL_BUILD\=>true,RUN_ON_INC_BUILD\=>true,RUN_ON_FILE_OPEN\=>false,RUN_ON_FILE_SAVE\=>false,RUN_AS_YOU_TYPE\=>true,RUN_ON_DEMAND\=>true},suppression_comment\=>"@suppress(\\"Symbol is not resolved\\")"}
-diff --git a/.settings/org.eclipse.cdt.core.prefs b/.settings/org.eclipse.cdt.core.prefs
-new file mode 100755
-index 000000000000..8ec9fe72ca59
---- /dev/null
-+++ .settings/org.eclipse.cdt.core.prefs
-@@ -0,0 +1,6 @@
-+eclipse.preferences.version=1
-+environment/project/cdt.managedbuild.config.gnu.cross.exe.debug.452878522/PATH/delimiter=;
-+environment/project/cdt.managedbuild.config.gnu.cross.exe.debug.452878522/PATH/operation=replace
-+environment/project/cdt.managedbuild.config.gnu.cross.exe.debug.452878522/PATH/value=C\:\\WINDOWS\\system32;C\:\\WINDOWS;C\:\\Program Files\\SlikSvn\\bin;C\:\\WINDOWS\\System32\\WindowsPowerShell\\v1.0;c\:\\cygwin\\bin;D\:\\develop\\workspaces\\c1\\amigaos-cross-toolchain\\m68k-amigaos\\bin
-+environment/project/cdt.managedbuild.config.gnu.cross.exe.debug.452878522/append=true
-+environment/project/cdt.managedbuild.config.gnu.cross.exe.debug.452878522/appendContributed=true
-diff --git a/.settings/org.eclipse.core.runtime.prefs b/.settings/org.eclipse.core.runtime.prefs
-new file mode 100755
-index 000000000000..12511e62a174
---- /dev/null
-+++ .settings/org.eclipse.core.runtime.prefs
-@@ -0,0 +1,5 @@
-+content-types/enabled=true
-+content-types/org.eclipse.cdt.core.cHeader/file-extensions=def
-+content-types/org.eclipse.cdt.core.cxxHeader/file-extensions=h
-+content-types/org.eclipse.cdt.core.cxxSource/file-extensions=c
-+eclipse.preferences.version=1
-
-From 4920a3ed01948bcc777d84e3c42f4e92310ee499 Mon Sep 17 00:00:00 2001
-From: bebbo <bebbo(a)bejy.net>
-Date: Wed, 19 Apr 2017 13:38:11 +0200
-Subject: [PATCH 069/303] @R be nice to other windows programs and replace
- /cygdrive/x/ with x:/ -> include/lib path discovery is now working in Eclipse
- running on Windows
-
----
- gcc/gcc.c | 8 ++++----
- libiberty/lrealpath.c | 18 +++++++++++++++++-
- 2 files changed, 21 insertions(+), 5 deletions(-)
-
-diff --git a/gcc/gcc.c b/gcc/gcc.c
-index 33ca41545736..2974b91300ca 100644
---- gcc/gcc.c
-+++ gcc/gcc.c
-@@ -10109,7 +10109,7 @@ const char * amiga_m68k_prefix_func(int argc, const char ** argv) {
- char * p = 0;
- if (standard_libexec_prefix)
- {
-- char * glp = concat(standard_libexec_prefix, "",0);
-+ char * glp = concat(standard_libexec_prefix, "", NULL);
- p = strrchr(glp, '/');
- if (p)
- {
-@@ -10122,17 +10122,17 @@ const char * amiga_m68k_prefix_func(int argc, const char ** argv) {
- if (p)
- {
- p[1] = 0;
-- p = concat(glp, "m68k-amigaos/", 0);
-+ p = concat(glp, "m68k-amigaos/", NULL);
- }
- }
- }
- free(glp);
- }
- if (!p)
-- p = concat("../../../../", "", 0);
-+ p = concat("../../../../", "", NULL);
-
- for (int i = 0; i < argc; ++i) {
-- char * q = concat(p, argv[i], 0);
-+ char * q = concat(p, argv[i], NULL);
- free(p);
- p = q;
- }
-diff --git a/libiberty/lrealpath.c b/libiberty/lrealpath.c
-index b27c8de990e9..78c06e46da58 100644
---- libiberty/lrealpath.c
-+++ libiberty/lrealpath.c
-@@ -73,7 +73,7 @@ extern char *canonicalize_file_name (const char *);
- #endif
-
- char *
--lrealpath (const char *filename)
-+__xlrealpath (const char *filename)
- {
- /* Method 1: The system has a compile time upper bound on a filename
- path. Use that and realpath() to canonicalize the name. This is
-@@ -155,3 +155,19 @@ lrealpath (const char *filename)
- /* This system is a lost cause, just duplicate the filename. */
- return strdup (filename);
- }
-+
-+
-+char *
-+lrealpath (const char *filename)
-+{
-+ char * r = __xlrealpath(filename);
-+#if defined (_WIN32)
-+ if (strncmp(r, "/cygdrive/", 10) == 0)
-+ {
-+ r[9] = r[10];
-+ r[10] = ':';
-+ r = strdup(&r[9]);
-+ }
-+#endif
-+ return r;
-+}
-
-From f6379a10611d6376109a63b65768387905a30490 Mon Sep 17 00:00:00 2001
-From: bebbo <bebbo(a)bejy.net>
-Date: Wed, 19 Apr 2017 13:41:44 +0200
-Subject: [PATCH 070/303] @B fix rename-registers if using register parameters:
- add clobbers for the regs
-
----
- gcc/config/m68k/amigaos.c | 1671 +++++++++++++++++++++++----------------------
- gcc/config/m68k/m68k.c | 6 +
- 2 files changed, 842 insertions(+), 835 deletions(-)
-
-diff --git a/gcc/config/m68k/amigaos.c b/gcc/config/m68k/amigaos.c
-index 88205e25476e..ca8eea305345 100644
---- gcc/config/m68k/amigaos.c
-+++ gcc/config/m68k/amigaos.c
-@@ -1,835 +1,836 @@
--/* Configuration for GNU C-compiler for m68k Amiga, running AmigaOS.
-- Copyright (C) 1992, 1993, 1994, 1995, 1996, 1997, 1998, 2003
-- Free Software Foundation, Inc.
-- Contributed by Markus M. Wild (wild(a)amiga.physik.unizh.ch).
-- Heavily modified by Kamil Iskra (iskra(a)student.uci.agh.edu.pl).
--
--This file is part of GCC.
--
--GCC 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, or (at your option)
--any later version.
--
--GCC 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 GCC; see the file COPYING. If not, write to
--the Free Software Foundation, 59 Temple Place - Suite 330,
--Boston, MA 02111-1307, USA. */
--
--//work without flag_writable_strings which is not in GCC4
--#define REGPARMS_68K 1
--
--#include "config.h"
--#include "system.h"
--#include "coretypes.h"
--#include "tm.h"
--#include "rtl.h"
--#include "output.h"
--#include "tree.h"
--#include "attribs.h"
--#include "flags.h"
--#include "expr.h"
--#include "toplev.h"
--#include "tm_p.h"
--#include "target.h"
--#include "diagnostic-core.h"
--#include "config/m68k/amigaos.h"
--
--//#define MYDEBUG 1
--#ifdef MYDEBUG
--#define DPRINTF(x) printf x; fflush(stdout);
--#else
--#define DPRINTF(x)
--#endif
--
--//int amiga_declare_object;
--
--#if 0
--static int amigaos_put_in_text (tree);
--static rtx gen_stack_management_call (rtx, rtx, const char *);
--
--/* Baserel support. */
--
--/* Does operand (which is a symbolic_operand) live in text space? If
-- so SYMBOL_REF_FLAG, which is set by ENCODE_SECTION_INFO, will be true.
--
-- This function is used in base relative code generation. */
--
--int
--read_only_operand (rtx operand)
--{
-- if (GET_CODE (operand) == CONST)
-- operand = XEXP (XEXP (operand, 0), 0);
-- if (GET_CODE (operand) == SYMBOL_REF)
-- return SYMBOL_REF_FLAG (operand) || CONSTANT_POOL_ADDRESS_P (operand);
-- return 1;
--}
--
--/* Choose the section to use for DECL. RELOC is true if its value contains
-- any relocatable expression. */
--
--void
--amigaos_select_section (tree decl ATTRIBUTE_UNUSED, int reloc ATTRIBUTE_UNUSED,
-- unsigned HOST_WIDE_INT align ATTRIBUTE_UNUSED)
--{
-- // if (TREE_CODE (decl) == STRING_CST)
--// {
--//// flag_writable_strings /data_section not in gcc4,
--////make life easy and put to same section
--//// if (! flag_writable_strings)
--//// readonly_data_section ();
--//// else
--// //data_section ();
--// }
--// else if (TREE_CODE (decl) == VAR_DECL)
--// {
--// if (TREE_READONLY (decl)
--// && ! TREE_THIS_VOLATILE (decl)
--// && DECL_INITIAL (decl)
--// && (DECL_INITIAL (decl) == error_mark_node
--// || TREE_CONSTANT (DECL_INITIAL (decl)))
--// && (!flag_pic || (flag_pic<3 && !reloc)
--// || SYMBOL_REF_FLAG (XEXP (DECL_RTL (decl), 0))))
--// readonly_data_section ();
--// else
--// data_section ();
--// }
--// else if ((!flag_pic || (flag_pic<3 && !reloc)) && DECL_P(decl)
--// && SYMBOL_REF_FLAG (XEXP (DECL_RTL (decl), 0)))
--// readonly_data_section ();
--// else
-- //data_section ();
--}
--
--/* This function is used while generating a base relative code.
-- It returns 1 if a decl is not relocatable, i. e., if it can be put
-- in the text section.
-- Currently, it's very primitive: it just checks if the object size
-- is less than 4 bytes (i. e., if it can hold a pointer). It also
-- supports arrays and floating point types. */
--
--static int
--amigaos_put_in_text (tree decl)
--{
-- tree type = TREE_TYPE (decl);
-- if (TREE_CODE (type) == ARRAY_TYPE)
-- type = TREE_TYPE (type);
-- return (TREE_INT_CST_ELT(TYPE_SIZE (type), 1) == 0
-- && TREE_INT_CST_LOW (TYPE_SIZE (type)) < 32)
-- || FLOAT_TYPE_P (type);
--}
--
--/* Record properties of a DECL into the associated SYMBOL_REF. */
--
--void
--amigaos_encode_section_info (tree decl, rtx rtl, int first)
--{
-- default_encode_section_info (decl, rtl, first);
--
--
-- SYMBOL_REF_FLAG (XEXP (rtl, 0)) = 1;
-- if (TREE_CODE (decl) == FUNCTION_DECL) // huh seem do same. not in gcc4 flag_writable_strings
-- SYMBOL_REF_FLAG (XEXP (rtl, 0)) = 1;
-- else
-- {
-- if ((MEM_READONLY_P (rtl) && !MEM_VOLATILE_P (rtl)
-- && (flag_pic<3 || (TREE_CODE (decl) == STRING_CST
-- )
-- || amigaos_put_in_text (decl)))
-- || (TREE_CODE (decl) == VAR_DECL
-- && DECL_SECTION_NAME (decl) != NULL))
-- SYMBOL_REF_FLAG (XEXP (rtl, 0)) = 1;
-- }
--}
--
--/* Common routine used to check if a4 should be preserved/restored. */
--
--int
--amigaos_restore_a4 (void)
--{
-- return (flag_pic >= 3 &&
-- (TARGET_RESTORE_A4 || TARGET_ALWAYS_RESTORE_A4
-- || lookup_attribute ("saveds",
-- TYPE_ATTRIBUTES (TREE_TYPE (current_function_decl)))));
--}
--
--void
--amigaos_alternate_pic_setup (FILE *stream)
--{
-- if (TARGET_RESTORE_A4 || TARGET_ALWAYS_RESTORE_A4)
-- asm_fprintf (stream, "\tjbsr %U__restore_a4\n");
-- else if (lookup_attribute ("saveds",
-- TYPE_ATTRIBUTES (TREE_TYPE (current_function_decl))))
-- asm_fprintf (stream, "\tlea %U__a4_init,%Ra4\n");
--}
--
--/* Attributes support. */
--
--#define AMIGA_CHIP_SECTION_NAME ".datachip"
--
--/* Handle a "chip" attribute;
-- arguments as in struct attribute_spec.handler. */
--
--tree
--amigaos_handle_decl_attribute (tree *node, tree name,
-- tree args ATTRIBUTE_UNUSED,
-- int flags ATTRIBUTE_UNUSED,
-- bool *no_add_attrs)
--{
-- if (TREE_CODE (*node) == VAR_DECL)
-- {
-- if (is_attribute_p ("chip", name))
--#ifdef TARGET_ASM_NAMED_SECTION
-- {
-- if (! TREE_STATIC (*node) && ! DECL_EXTERNAL (*node))
-- error ("`chip' attribute cannot be specified for local variables");
-- else
-- {
-- /* The decl may have already been given a section attribute from
-- a previous declaration. Ensure they match. */
-- if (DECL_SECTION_NAME (*node) == NULL_TREE)
-- DECL_SECTION_NAME (*node) =
-- build_string (strlen (AMIGA_CHIP_SECTION_NAME) + 1,
-- AMIGA_CHIP_SECTION_NAME);
-- else if (strcmp (TREE_STRING_POINTER (DECL_SECTION_NAME (*node)),
-- AMIGA_CHIP_SECTION_NAME) != 0)
-- {
-- error_with_decl (*node,
-- "`chip' for `%s' conflicts with previous declaration");
-- }
-- }
-- }
--#else
-- error ("`chip' attribute is not supported for this target");
--#endif
-- }
-- else
-- {
-- warning (OPT_Wattributes, "`%s' attribute only applies to variables",
-- IDENTIFIER_POINTER (name));
-- *no_add_attrs = true;
-- }
--
-- return NULL_TREE;
--}
--
--//----- from 68k.c start
--
--
--
--
--
--
--/* Stack checking and automatic extension support. */
--
--void
--amigaos_prologue_begin_hook (FILE *stream, int fsize)
--{
-- if (TARGET_STACKCHECK)
-- {
-- if (fsize < 256)
-- asm_fprintf (stream, "\tcmpl %s,%Rsp\n"
-- "\tjcc 0f\n"
-- "\tjra %U__stkovf\n"
-- "\t0:\n",
-- (flag_pic == 3 ? "a4@(___stk_limit:W)" :
-- (flag_pic == 4 ? "a4@(___stk_limit:L)" :
-- "___stk_limit")));
-- else
-- asm_fprintf (stream, "\tmovel %I%d,%Rd0\n\tjbsr %U__stkchk_d0\n",
-- fsize);
-- }
--}
--
--void
--amigaos_alternate_frame_setup_f (FILE *stream, int fsize)
--{
-- if (fsize < 128)
-- asm_fprintf (stream, "\tcmpl %s,%Rsp\n"
-- "\tjcc 0f\n"
-- "\tmoveq %I%d,%Rd0\n"
-- "\tmoveq %I0,%Rd1\n"
-- "\tjbsr %U__stkext_f\n"
-- "0:\tlink %Ra5,%I%d:W\n",
-- (flag_pic == 3 ? "a4@(___stk_limit:W)" :
-- (flag_pic == 4 ? "a4@(___stk_limit:L)" :
-- "___stk_limit")),
-- fsize, -fsize);
-- else
-- asm_fprintf (stream, "\tmovel %I%d,%Rd0\n\tjbsr %U__link_a5_d0_f\n",
-- fsize);
--}
--
--void
--amigaos_alternate_frame_setup (FILE *stream, int fsize)
--{
-- if (!fsize)
-- asm_fprintf (stream, "\tcmpl %s,%Rsp\n"
-- "\tjcc 0f\n"
-- "\tmoveq %I0,%Rd0\n"
-- "\tmoveq %I0,%Rd1\n"
-- "\tjbsr %U__stkext_f\n"
-- "0:\n",
-- (flag_pic == 3 ? "a4@(___stk_limit:W)" :
-- (flag_pic == 4 ? "a4@(___stk_limit:L)" :
-- "___stk_limit")));
-- else if (fsize < 128)
-- asm_fprintf (stream, "\tcmpl %s,%Rsp\n"
-- "\tjcc 0f\n"
-- "\tmoveq %I%d,%Rd0\n"
-- "\tmoveq %I0,%Rd1\n"
-- "\tjbsr %U__stkext_f\n"
-- "0:\taddw %I%d,%Rsp\n",
-- (flag_pic == 3 ? "a4@(___stk_limit:W)" :
-- (flag_pic == 4 ? "a4@(___stk_limit:L)" :
-- "___stk_limit")),
-- fsize, -fsize);
-- else
-- asm_fprintf (stream, "\tmovel %I%d,%Rd0\n\tjbsr %U__sub_d0_sp_f\n",
-- fsize);
--}
--
--//static rtx
--//gen_stack_management_call (rtx stack_pointer, rtx arg, const char *func)
--//{
--// rtx call_insn, call, seq, name;
--// start_sequence ();
--//
--// /* Move arg to d0. */
--// emit_move_insn (gen_rtx_REG (SImode, 0), arg);
--//
--// /* Generate the function reference. */
--// name = gen_rtx_SYMBOL_REF (Pmode, func);
--// SYMBOL_REF_FLAG (name) = 1;
--// /* If optimizing, put it in a psedo so that several loads can be merged
--// into one. */
--// if (optimize && ! flag_no_function_cse)
--// name = copy_to_reg (name);
--//
--// /* Generate the function call. */
--// call = gen_rtx_CALL (VOIDmode, gen_rtx_MEM (FUNCTION_MODE, name),
--// const0_rtx);
--// /* If we are doing stack extension, notify about the sp change. */
--// if (stack_pointer)
--// call = gen_rtx_SET (VOIDmode, stack_pointer, call);
--//
--// /* Generate the call instruction. */
--// call_insn = emit_call_insn (call);
--// /* Stack extension does not change memory in an unpredictable way. */
--// RTL_CONST_OR_PURE_CALL_P (call_insn) = 1;
--// /* We pass an argument in d0. */
--// CALL_INSN_FUNCTION_USAGE (call_insn) = gen_rtx_EXPR_LIST (VOIDmode,
--// gen_rtx_USE (VOIDmode, gen_rtx_REG (SImode, 0)), 0);
--//
--// seq = get_insns ();
--// end_sequence ();
--// return seq;
--//}
--//
--//rtx
--//gen_stack_cleanup_call (rtx stack_pointer, rtx sa)
--//{
--// return gen_stack_management_call (stack_pointer, sa, "__move_d0_sp");
--//}
--//
--//void
--//amigaos_alternate_allocate_stack (rtx *operands)
--//{
--// if (TARGET_STACKEXTEND)
--// emit_insn (gen_stack_management_call (stack_pointer_rtx, operands[1],
--// "__sub_d0_sp"));
--// else
--// {
--// if (TARGET_STACKCHECK)
--// emit_insn (gen_stack_management_call (0, operands[1], "__stkchk_d0"));
--// anti_adjust_stack (operands[1]);
--// }
--// emit_move_insn (operands[0], virtual_stack_dynamic_rtx);
--//}
--#endif
--
--/*
-- * begin-GG-local: explicit register specification for parameters.
-- *
-- * Reworked and ported to gcc-6.2.0 by Stefan "Bebbo" Franke.
-- */
--
--/**
-- * Define this here and add it to tm_p -> all know the custom type and allocate/use the correct size.
-- */
--struct amigaos_args
--{
-- int num_of_regs;
-- long regs_already_used;
-- int last_arg_reg;
-- int last_arg_len;
-- tree formal_type; /* New field: formal type of the current argument. */
--};
--
--static struct amigaos_args mycum;
--static CUMULATIVE_ARGS * lastcum;
--
--/* Argument-passing support functions. */
--
--/* Initialize a variable CUM of type CUMULATIVE_ARGS
-- for a call to a function whose data type is FNTYPE.
-- For a library call, FNTYPE is 0. */
--
--void
--amigaos_init_cumulative_args (CUMULATIVE_ARGS *cump, tree fntype, tree decl)
--{
-- struct amigaos_args * cum = &mycum;
-- lastcum = cump;
-- cum->num_of_regs = amigaos_regparm > 0 ? amigaos_regparm : 0;
-- DPRINTF(("0amigaos_init_cumulative_args %p -> %d\r\n", cum, cum->num_of_regs));
--
-- /* Initialize a variable CUM of type CUMULATIVE_ARGS
-- for a call to a function whose data type is FNTYPE.
-- For a library call, FNTYPE is 0. */
--
-- cum->last_arg_reg = -1;
-- cum->regs_already_used = 0;
--
-- if (decl)
-- {
-- tree attrs = DECL_ATTRIBUTES(decl);
-- if (lookup_attribute ("stkparm", attrs))
-- cum->num_of_regs = 0;
-- else
-- {
-- tree ratree = lookup_attribute ("regparm", attrs);
-- cum->num_of_regs = amigaos_regparm != 0 ?
-- amigaos_regparm : AMIGAOS_DEFAULT_REGPARM;
-- if (ratree)
-- {
-- tree args = TREE_VALUE(ratree);
--
-- if (args && TREE_CODE (args) == TREE_LIST)
-- {
-- tree val = TREE_VALUE(args);
-- if (TREE_CODE (val) == INTEGER_CST)
-- {
-- int no = TREE_INT_CST_LOW(val);
-- if (no > 0 && no < AMIGAOS_MAX_REGPARM)
-- cum->num_of_regs = no;
-- }
-- }
-- }
-- }
-- }
-- else
-- /* Libcall. */
-- cum->num_of_regs = 0;
--
-- if (cum->num_of_regs)
-- {
-- /* If this is a vararg call, put all arguments on stack. */
-- tree param, next_param;
-- for (param = TYPE_ARG_TYPES(fntype); param; param = next_param)
-- {
-- next_param = TREE_CHAIN(param);
-- if (!next_param && TREE_VALUE (param) != void_type_node)
-- cum->num_of_regs = 0;
-- }
-- }
--
-- //#if ! defined (PCC_STATIC_STRUCT_RETURN) && defined (M68K_STRUCT_VALUE_REGNUM)
-- // /* If return value is a structure, and we pass the buffer address in a
-- // register, we can't use this register for our own purposes.
-- // FIXME: Something similar would be useful for static chain. */
-- // if (fntype && aggregate_value_p (TREE_TYPE (fntype), fntype))
-- // cum->regs_already_used |= (1 << M68K_STRUCT_VALUE_REGNUM);
-- //#endif
--
-- if (fntype)
-- cum->formal_type = TYPE_ARG_TYPES(fntype);
-- else
-- /* Call to compiler-support function. */
-- cum->formal_type = 0;
-- DPRINTF(("1amigaos_init_cumulative_args %p -> %d\r\n", cum, cum->num_of_regs));
--}
--
--/* Update the data in CUM to advance over an argument. */
--
--void
--amigaos_function_arg_advance (cumulative_args_t cum_v, machine_mode, const_tree,
-- bool)
--{
-- struct amigaos_args * cum = &mycum;
-- CUMULATIVE_ARGS *cump = (CUMULATIVE_ARGS *) get_cumulative_args (cum_v);
-- /* Update the data in CUM to advance over an argument. */
--
-- DPRINTF(("amigaos_function_arg_advance1 %p\r\n", cump));
-- if (cump != lastcum)
-- return;
--
-- if (cum->last_arg_reg != -1)
-- {
-- int count;
-- for (count = 0; count < cum->last_arg_len; count++)
-- cum->regs_already_used |= (1 << (cum->last_arg_reg + count));
-- cum->last_arg_reg = -1;
-- }
--
-- if (cum->formal_type)
-- cum->formal_type = TREE_CHAIN(cum->formal_type);
--}
--
--/* Define where to put the arguments to a function.
-- Value is zero to push the argument on the stack,
-- or a hard register in which to store the argument.
--
-- MODE is the argument's machine mode.
-- TYPE is the data type of the argument (as a tree).
-- This is null for libcalls where that information may
-- not be available.
-- CUM is a variable of type CUMULATIVE_ARGS which gives info about
-- the preceding args and about the function being called. */
--
--static struct rtx_def *
--_m68k_function_arg (CUMULATIVE_ARGS *, machine_mode, const_tree);
--
--static struct rtx_def *
--_m68k_function_arg (CUMULATIVE_ARGS *cump, machine_mode mode, const_tree type)
--{
-- struct amigaos_args * cum = &mycum;
-- DPRINTF(("m68k_function_arg numOfRegs=%d\r\n", cum ? cum->num_of_regs : 0));
--
-- if (cump != lastcum)
-- return 0;
--
-- if (cum->num_of_regs)
-- {
-- int regbegin = -1, altregbegin = -1, len;
--
-- /* FIXME: The last condition below is a workaround for a bug. */
-- if (TARGET_68881 && FLOAT_MODE_P(mode) &&
-- GET_MODE_UNIT_SIZE (mode) <= 12
-- && (GET_MODE_CLASS (mode) != MODE_COMPLEX_FLOAT || mode == SCmode))
-- {
-- regbegin = 16; /* FPx */
-- len = GET_MODE_NUNITS(mode);
-- }
-- /* FIXME: Two last conditions below are workarounds for bugs. */
-- else if (INTEGRAL_MODE_P (mode) && mode != CQImode && mode != CHImode)
-- {
-- if (!type || POINTER_TYPE_P(type))
-- regbegin = 8; /* Ax */
-- else
-- regbegin = 0; /* Dx */
-- altregbegin = 8 - regbegin;
-- len = (GET_MODE_SIZE (mode) + (UNITS_PER_WORD - 1)) / UNITS_PER_WORD;
-- }
--
-- if (regbegin != -1)
-- {
-- int reg;
-- long mask;
--
-- look_for_reg: mask = 1 << regbegin;
-- for (reg = 0; reg < cum->num_of_regs; reg++, mask <<= 1)
-- if (!(cum->regs_already_used & mask))
-- {
-- int end;
-- for (end = reg; end < cum->num_of_regs && end < reg + len;
-- end++, mask <<= 1)
-- if (cum->regs_already_used & mask)
-- break;
-- if (end == reg + len)
-- {
-- cum->last_arg_reg = reg + regbegin;
-- cum->last_arg_len = len;
-- break;
-- }
-- }
--
-- if (reg == AMIGAOS_MAX_REGPARM && altregbegin != -1)
-- {
-- DPRINTF(("look for alt reg\n"));
-- regbegin = altregbegin;
-- altregbegin = -1;
-- goto look_for_reg;
-- }
-- }
--
-- if (cum->last_arg_reg != -1)
-- {
-- DPRINTF(("-> gen_rtx_REG %d\r\n", cum->last_arg_reg));
-- return gen_rtx_REG (mode, cum->last_arg_reg);
-- }
-- }
-- return 0;
--}
--
--/* A C expression that controls whether a function argument is passed
-- in a register, and which register. */
--
--struct rtx_def *
--amigaos_function_arg (cumulative_args_t cum_v, machine_mode mode,
-- const_tree type, bool)
--{
-- struct amigaos_args * cum = &mycum;
--
-- DPRINTF(("amigaos_function_arg %p\r\n", cum_v.p));
--
-- CUMULATIVE_ARGS *cump = (CUMULATIVE_ARGS *) get_cumulative_args (cum_v);
--
-- if (cump != lastcum)
-- return 0;
--
-- tree asmtree = type ? TYPE_ATTRIBUTES(type) : NULL_TREE;
-- if (asmtree && 0 == strcmp ("asm", IDENTIFIER_POINTER(TREE_PURPOSE(asmtree))))
-- {
-- int i;
-- cum->last_arg_reg = TREE_FIXED_CST_PTR(TREE_VALUE(asmtree))->data.low;
-- cum->last_arg_len = HARD_REGNO_NREGS(cum->last_arg_reg, mode);
--
-- for (i = 0; i < cum->last_arg_len; i++)
-- if (cum->regs_already_used & (1 << (cum->last_arg_reg + i)))
-- {
-- error ("two parameters allocated for one register");
-- break;
-- }
-- return gen_rtx_REG (mode, cum->last_arg_reg);
-- }
-- return _m68k_function_arg (cump, mode, type);
--}
--
--/* Return zero if the attributes on TYPE1 and TYPE2 are incompatible,
-- one if they are compatible, and two if they are nearly compatible
-- (which causes a warning to be generated). */
--
--int
--amigaos_comp_type_attributes (const_tree type1, const_tree type2)
--{
-- DPRINTF(("amigaos_comp_type_attributes\n"));
-- /* Functions or methods are incompatible if they specify mutually exclusive
-- ways of passing arguments. */
-- if (TREE_CODE(type1) == FUNCTION_TYPE || TREE_CODE(type1) == METHOD_TYPE)
-- {
-- tree arg1, arg2;
-- arg1 = TYPE_ARG_TYPES(type1);
-- arg2 = TYPE_ARG_TYPES(type2);
-- for (; arg1 && arg2; arg1 = TREE_CHAIN(arg1), arg2 = TREE_CHAIN(arg2))
-- {
-- tree attr1 = TYPE_ATTRIBUTES(arg1);
-- tree attr2 = TYPE_ATTRIBUTES(arg2);
-- if (strcmp ("asm", IDENTIFIER_POINTER(TREE_PURPOSE(attr1))))
-- attr1 = NULL_TREE;
-- if (strcmp ("asm", IDENTIFIER_POINTER(TREE_PURPOSE(attr2))))
-- attr2 = NULL_TREE;
-- if (attr1 && attr2)
-- {
-- if (TREE_FIXED_CST_PTR(TREE_VALUE(attr1))->data.low
-- != TREE_FIXED_CST_PTR(TREE_VALUE(attr2))->data.low)
-- return 0;
-- }
-- else if (attr1 || attr2)
-- return 0; /* asm attribute only on one side. */
-- }
-- if (arg1 || arg2)
-- return 0; /* different count of parameters. */
-- }
-- return 1;
--}
--
--/* Return zero if the attributes on TYPE1 and TYPE2 are incompatible,
-- one if they are compatible, and two if they are nearly compatible
-- (which causes a warning to be generated). */
--#if 0
--static int
--m68k_comp_type_attributes (tree type1, tree type2)
--{
--
-- /* Functions or methods are incompatible if they specify mutually
-- exclusive ways of passing arguments. */
-- if (TREE_CODE (type1) == FUNCTION_TYPE || TREE_CODE (type1) == METHOD_TYPE)
-- {
-- tree arg1, arg2;
-- if (!! lookup_attribute ("stkparm", TYPE_ATTRIBUTES (type1)) !=
-- !! lookup_attribute ("stkparm", TYPE_ATTRIBUTES (type2))
-- || !! lookup_attribute ("regparm", TYPE_ATTRIBUTES (type1)) !=
-- !! lookup_attribute ("regparm", TYPE_ATTRIBUTES (type2)))
-- return 0; /* 'regparm' and 'stkparm' are mutually exclusive. */
--
-- arg1 = lookup_attribute ("regparm", TYPE_ATTRIBUTES (type1));
-- arg2 = lookup_attribute ("regparm", TYPE_ATTRIBUTES (type2));
-- if (arg1 && arg2)
-- {
-- int num1 = 0, num2 = 0;
-- if (TREE_VALUE (arg1) && TREE_CODE (TREE_VALUE (arg1)) == TREE_LIST)
-- {
-- tree numofregs = TREE_VALUE (TREE_VALUE (arg1));
-- if (numofregs)
-- num1 = TREE_INT_CST_LOW (numofregs);
-- }
-- if (TREE_VALUE (arg2) && TREE_CODE (TREE_VALUE (arg2)) == TREE_LIST)
-- {
-- tree numofregs = TREE_VALUE (TREE_VALUE (arg2));
-- if (numofregs)
-- num2 = TREE_INT_CST_LOW (numofregs);
-- }
-- if (num1 != num2)
-- return 0; /* Different numbers, or no number in one type. */
-- }
-- }
--#ifdef TARGET_AMIGAOS
-- return amigaos_comp_type_attributes(type1, type2);
--#else
-- return 1;
--#endif
--}
--#endif
--
--/* end-GG-local */
--
--
--/* Handle a "regparm", "stkparm" attribute;
-- arguments as in struct attribute_spec.handler. */
--tree
--amigaos_handle_type_attribute (tree *node, tree name, tree args,
-- int flags ATTRIBUTE_UNUSED, bool *no_add_attrs)
--{
-- tree nnn = *node;
-- do { // while (0);
-- DPRINTF(("%p with treecode %d\n", node, TREE_CODE(nnn)));
-- if (TREE_CODE (nnn) == FUNCTION_DECL || TREE_CODE (nnn) == FUNCTION_TYPE
-- || TREE_CODE (nnn) == METHOD_TYPE)
-- {
-- /* 'regparm' accepts one optional argument - number of registers in
-- single class that should be used to pass arguments. */
-- if (is_attribute_p ("regparm", name))
-- {
-- DPRINTF(("regparm found\n"));
--
-- if (lookup_attribute ("stkparm", TYPE_ATTRIBUTES(nnn)))
-- {
-- error ("`regparm' and `stkparm' are mutually exclusive");
-- break;
-- }
-- if (args && TREE_CODE (args) == TREE_LIST)
-- {
-- tree val = TREE_VALUE(args);
-- DPRINTF(("regparm with val: %d\n", TREE_CODE(val)));
-- if (TREE_CODE (val) == INTEGER_CST)
-- {
-- int no = TREE_INT_CST_LOW(val);
-- if (no < 0 || no > AMIGAOS_MAX_REGPARM)
-- {
-- error ("`regparm' attribute: value %d not in [0 - %d]",
-- no,
-- AMIGAOS_MAX_REGPARM);
-- break;
-- }
-- }
-- else
-- {
-- error ("invalid argument(s) to `regparm' attribute");
-- break;
-- }
-- }
-- }
-- else if (is_attribute_p ("stkparm", name))
-- {
-- if (lookup_attribute ("regparm", TYPE_ATTRIBUTES(nnn)))
-- {
-- error ("`regparm' and `stkparm' are mutually exclusive");
-- break;
-- }
-- }
-- else if (is_attribute_p ("stackext", name))
-- {
-- if (lookup_attribute ("interrupt", TYPE_ATTRIBUTES(nnn)))
-- {
-- error ("`stackext' and `interrupt' are mutually exclusive");
-- break;
-- }
-- }
-- else if (is_attribute_p ("saveds", name))
-- {
-- }
-- }
-- else
-- {
-- warning (OPT_Wattributes, "`%s' attribute only applies to functions",
-- IDENTIFIER_POINTER(name));
-- }
-- return NULL_TREE;
-- } while (0);
-- // error case
-- *no_add_attrs = true;
-- return NULL_TREE;
--}
--
--
--extern bool
--m68k_rtx_costs (rtx, machine_mode, int, int, int *, bool);
--
--bool
--amigaos_rtx_costs (rtx x, machine_mode mode, int outer_code, int opno,
-- int *total, bool speed)
--{
--// DPRINTF(("outer: %d, opno: %d", outer_code, opno));
-- bool r = m68k_rtx_costs (x, mode, outer_code, opno, total, speed);
--// *total *= 4;
--// fprintf(stderr, "costs: %d, mode=%d, outer=%d, opno=%d, speed=%d, ok=%d\n", *total * 4, mode, outer_code, opno, speed, r);
--// debug_rtx(x);
-- return r;
--}
--
--
--/* Output assembly to switch to section NAME with attribute FLAGS. */
--
--extern void
--amiga_named_section (const char *name, unsigned int flags, tree decl ATTRIBUTE_UNUSED)
--{
-- if (0 == strncmp(".text", name, 5))
-- name = ".text";
-- fprintf (asm_out_file, "\t%s\n", name);
--}
--
--/* Baserel support. */
--
--/**
-- * Does x reference the pic_reg and is const or plus?
-- */
--int amiga_is_const_pic_ref(const_rtx x)
--{
-- const_rtx y = x;
-- if (flag_pic < 3)
-- return false;
-- while (GET_CODE(y) == CONST || GET_CODE(y) == PLUS)
-- y = XEXP(y, 0);
-- return (x != y && REG_P(y) && REGNO(y) == PIC_REG);
--}
--
--
--/* Does operand (which is a symbolic_operand) live in text space? If
-- so SYMBOL_REF_FLAG, which is set by ENCODE_SECTION_INFO, will be true.
--
-- This function is used in base relative code generation. */
--
--int
--read_only_operand (rtx operand)
--{
-- if (GET_CODE (operand) == CONST)
-- operand = XEXP (XEXP (operand, 0), 0);
-- if (GET_CODE (operand) == SYMBOL_REF)
-- return SYMBOL_REF_FLAG (operand) || CONSTANT_POOL_ADDRESS_P (operand);
-- return 1;
--}
--
--reg_class_t
--amiga_preferred_rename_class2(reg_class_t rclass ATTRIBUTE_UNUSED, int regno )
--{
-- if (regno == 0)
-- return D0_REGS;
-- if (regno == 8)
-- return A0_REGS;
-- return regno_reg_class[regno];
--}
-+/* Configuration for GNU C-compiler for m68k Amiga, running AmigaOS.
-+ Copyright (C) 1992, 1993, 1994, 1995, 1996, 1997, 1998, 2003
-+ Free Software Foundation, Inc.
-+ Contributed by Markus M. Wild (wild(a)amiga.physik.unizh.ch).
-+ Heavily modified by Kamil Iskra (iskra(a)student.uci.agh.edu.pl).
-+
-+This file is part of GCC.
-+
-+GCC 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, or (at your option)
-+any later version.
-+
-+GCC 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 GCC; see the file COPYING. If not, write to
-+the Free Software Foundation, 59 Temple Place - Suite 330,
-+Boston, MA 02111-1307, USA. */
-+
-+//work without flag_writable_strings which is not in GCC4
-+#define REGPARMS_68K 1
-+
-+#include "config.h"
-+#include "system.h"
-+#include "coretypes.h"
-+#include "tm.h"
-+#include "rtl.h"
-+#include "output.h"
-+#include "tree.h"
-+#include "attribs.h"
-+#include "flags.h"
-+#include "expr.h"
-+#include "toplev.h"
-+#include "tm_p.h"
-+#include "target.h"
-+#include "diagnostic-core.h"
-+#include "config/m68k/amigaos.h"
-+
-+//#define MYDEBUG 1
-+#ifdef MYDEBUG
-+#define DPRINTF(x) printf x; fflush(stdout);
-+#else
-+#define DPRINTF(x)
-+#endif
-+
-+//int amiga_declare_object;
-+
-+#if 0
-+static int amigaos_put_in_text (tree);
-+static rtx gen_stack_management_call (rtx, rtx, const char *);
-+
-+/* Baserel support. */
-+
-+/* Does operand (which is a symbolic_operand) live in text space? If
-+ so SYMBOL_REF_FLAG, which is set by ENCODE_SECTION_INFO, will be true.
-+
-+ This function is used in base relative code generation. */
-+
-+int
-+read_only_operand (rtx operand)
-+{
-+ if (GET_CODE (operand) == CONST)
-+ operand = XEXP (XEXP (operand, 0), 0);
-+ if (GET_CODE (operand) == SYMBOL_REF)
-+ return SYMBOL_REF_FLAG (operand) || CONSTANT_POOL_ADDRESS_P (operand);
-+ return 1;
-+}
-+
-+/* Choose the section to use for DECL. RELOC is true if its value contains
-+ any relocatable expression. */
-+
-+void
-+amigaos_select_section (tree decl ATTRIBUTE_UNUSED, int reloc ATTRIBUTE_UNUSED,
-+ unsigned HOST_WIDE_INT align ATTRIBUTE_UNUSED)
-+{
-+ // if (TREE_CODE (decl) == STRING_CST)
-+// {
-+//// flag_writable_strings /data_section not in gcc4,
-+////make life easy and put to same section
-+//// if (! flag_writable_strings)
-+//// readonly_data_section ();
-+//// else
-+// //data_section ();
-+// }
-+// else if (TREE_CODE (decl) == VAR_DECL)
-+// {
-+// if (TREE_READONLY (decl)
-+// && ! TREE_THIS_VOLATILE (decl)
-+// && DECL_INITIAL (decl)
-+// && (DECL_INITIAL (decl) == error_mark_node
-+// || TREE_CONSTANT (DECL_INITIAL (decl)))
-+// && (!flag_pic || (flag_pic<3 && !reloc)
-+// || SYMBOL_REF_FLAG (XEXP (DECL_RTL (decl), 0))))
-+// readonly_data_section ();
-+// else
-+// data_section ();
-+// }
-+// else if ((!flag_pic || (flag_pic<3 && !reloc)) && DECL_P(decl)
-+// && SYMBOL_REF_FLAG (XEXP (DECL_RTL (decl), 0)))
-+// readonly_data_section ();
-+// else
-+ //data_section ();
-+}
-+
-+/* This function is used while generating a base relative code.
-+ It returns 1 if a decl is not relocatable, i. e., if it can be put
-+ in the text section.
-+ Currently, it's very primitive: it just checks if the object size
-+ is less than 4 bytes (i. e., if it can hold a pointer). It also
-+ supports arrays and floating point types. */
-+
-+static int
-+amigaos_put_in_text (tree decl)
-+{
-+ tree type = TREE_TYPE (decl);
-+ if (TREE_CODE (type) == ARRAY_TYPE)
-+ type = TREE_TYPE (type);
-+ return (TREE_INT_CST_ELT(TYPE_SIZE (type), 1) == 0
-+ && TREE_INT_CST_LOW (TYPE_SIZE (type)) < 32)
-+ || FLOAT_TYPE_P (type);
-+}
-+
-+/* Record properties of a DECL into the associated SYMBOL_REF. */
-+
-+void
-+amigaos_encode_section_info (tree decl, rtx rtl, int first)
-+{
-+ default_encode_section_info (decl, rtl, first);
-+
-+
-+ SYMBOL_REF_FLAG (XEXP (rtl, 0)) = 1;
-+ if (TREE_CODE (decl) == FUNCTION_DECL) // huh seem do same. not in gcc4 flag_writable_strings
-+ SYMBOL_REF_FLAG (XEXP (rtl, 0)) = 1;
-+ else
-+ {
-+ if ((MEM_READONLY_P (rtl) && !MEM_VOLATILE_P (rtl)
-+ && (flag_pic<3 || (TREE_CODE (decl) == STRING_CST
-+ )
-+ || amigaos_put_in_text (decl)))
-+ || (TREE_CODE (decl) == VAR_DECL
-+ && DECL_SECTION_NAME (decl) != NULL))
-+ SYMBOL_REF_FLAG (XEXP (rtl, 0)) = 1;
-+ }
-+}
-+
-+/* Common routine used to check if a4 should be preserved/restored. */
-+
-+int
-+amigaos_restore_a4 (void)
-+{
-+ return (flag_pic >= 3 &&
-+ (TARGET_RESTORE_A4 || TARGET_ALWAYS_RESTORE_A4
-+ || lookup_attribute ("saveds",
-+ TYPE_ATTRIBUTES (TREE_TYPE (current_function_decl)))));
-+}
-+
-+void
-+amigaos_alternate_pic_setup (FILE *stream)
-+{
-+ if (TARGET_RESTORE_A4 || TARGET_ALWAYS_RESTORE_A4)
-+ asm_fprintf (stream, "\tjbsr %U__restore_a4\n");
-+ else if (lookup_attribute ("saveds",
-+ TYPE_ATTRIBUTES (TREE_TYPE (current_function_decl))))
-+ asm_fprintf (stream, "\tlea %U__a4_init,%Ra4\n");
-+}
-+
-+/* Attributes support. */
-+
-+#define AMIGA_CHIP_SECTION_NAME ".datachip"
-+
-+/* Handle a "chip" attribute;
-+ arguments as in struct attribute_spec.handler. */
-+
-+tree
-+amigaos_handle_decl_attribute (tree *node, tree name,
-+ tree args ATTRIBUTE_UNUSED,
-+ int flags ATTRIBUTE_UNUSED,
-+ bool *no_add_attrs)
-+{
-+ if (TREE_CODE (*node) == VAR_DECL)
-+ {
-+ if (is_attribute_p ("chip", name))
-+#ifdef TARGET_ASM_NAMED_SECTION
-+ {
-+ if (! TREE_STATIC (*node) && ! DECL_EXTERNAL (*node))
-+ error ("`chip' attribute cannot be specified for local variables");
-+ else
-+ {
-+ /* The decl may have already been given a section attribute from
-+ a previous declaration. Ensure they match. */
-+ if (DECL_SECTION_NAME (*node) == NULL_TREE)
-+ DECL_SECTION_NAME (*node) =
-+ build_string (strlen (AMIGA_CHIP_SECTION_NAME) + 1,
-+ AMIGA_CHIP_SECTION_NAME);
-+ else if (strcmp (TREE_STRING_POINTER (DECL_SECTION_NAME (*node)),
-+ AMIGA_CHIP_SECTION_NAME) != 0)
-+ {
-+ error_with_decl (*node,
-+ "`chip' for `%s' conflicts with previous declaration");
-+ }
-+ }
-+ }
-+#else
-+ error ("`chip' attribute is not supported for this target");
-+#endif
-+ }
-+ else
-+ {
-+ warning (OPT_Wattributes, "`%s' attribute only applies to variables",
-+ IDENTIFIER_POINTER (name));
-+ *no_add_attrs = true;
-+ }
-+
-+ return NULL_TREE;
-+}
-+
-+//----- from 68k.c start
-+
-+
-+
-+
-+
-+
-+/* Stack checking and automatic extension support. */
-+
-+void
-+amigaos_prologue_begin_hook (FILE *stream, int fsize)
-+{
-+ if (TARGET_STACKCHECK)
-+ {
-+ if (fsize < 256)
-+ asm_fprintf (stream, "\tcmpl %s,%Rsp\n"
-+ "\tjcc 0f\n"
-+ "\tjra %U__stkovf\n"
-+ "\t0:\n",
-+ (flag_pic == 3 ? "a4@(___stk_limit:W)" :
-+ (flag_pic == 4 ? "a4@(___stk_limit:L)" :
-+ "___stk_limit")));
-+ else
-+ asm_fprintf (stream, "\tmovel %I%d,%Rd0\n\tjbsr %U__stkchk_d0\n",
-+ fsize);
-+ }
-+}
-+
-+void
-+amigaos_alternate_frame_setup_f (FILE *stream, int fsize)
-+{
-+ if (fsize < 128)
-+ asm_fprintf (stream, "\tcmpl %s,%Rsp\n"
-+ "\tjcc 0f\n"
-+ "\tmoveq %I%d,%Rd0\n"
-+ "\tmoveq %I0,%Rd1\n"
-+ "\tjbsr %U__stkext_f\n"
-+ "0:\tlink %Ra5,%I%d:W\n",
-+ (flag_pic == 3 ? "a4@(___stk_limit:W)" :
-+ (flag_pic == 4 ? "a4@(___stk_limit:L)" :
-+ "___stk_limit")),
-+ fsize, -fsize);
-+ else
-+ asm_fprintf (stream, "\tmovel %I%d,%Rd0\n\tjbsr %U__link_a5_d0_f\n",
-+ fsize);
-+}
-+
-+void
-+amigaos_alternate_frame_setup (FILE *stream, int fsize)
-+{
-+ if (!fsize)
-+ asm_fprintf (stream, "\tcmpl %s,%Rsp\n"
-+ "\tjcc 0f\n"
-+ "\tmoveq %I0,%Rd0\n"
-+ "\tmoveq %I0,%Rd1\n"
-+ "\tjbsr %U__stkext_f\n"
-+ "0:\n",
-+ (flag_pic == 3 ? "a4@(___stk_limit:W)" :
-+ (flag_pic == 4 ? "a4@(___stk_limit:L)" :
-+ "___stk_limit")));
-+ else if (fsize < 128)
-+ asm_fprintf (stream, "\tcmpl %s,%Rsp\n"
-+ "\tjcc 0f\n"
-+ "\tmoveq %I%d,%Rd0\n"
-+ "\tmoveq %I0,%Rd1\n"
-+ "\tjbsr %U__stkext_f\n"
-+ "0:\taddw %I%d,%Rsp\n",
-+ (flag_pic == 3 ? "a4@(___stk_limit:W)" :
-+ (flag_pic == 4 ? "a4@(___stk_limit:L)" :
-+ "___stk_limit")),
-+ fsize, -fsize);
-+ else
-+ asm_fprintf (stream, "\tmovel %I%d,%Rd0\n\tjbsr %U__sub_d0_sp_f\n",
-+ fsize);
-+}
-+
-+//static rtx
-+//gen_stack_management_call (rtx stack_pointer, rtx arg, const char *func)
-+//{
-+// rtx call_insn, call, seq, name;
-+// start_sequence ();
-+//
-+// /* Move arg to d0. */
-+// emit_move_insn (gen_rtx_REG (SImode, 0), arg);
-+//
-+// /* Generate the function reference. */
-+// name = gen_rtx_SYMBOL_REF (Pmode, func);
-+// SYMBOL_REF_FLAG (name) = 1;
-+// /* If optimizing, put it in a psedo so that several loads can be merged
-+// into one. */
-+// if (optimize && ! flag_no_function_cse)
-+// name = copy_to_reg (name);
-+//
-+// /* Generate the function call. */
-+// call = gen_rtx_CALL (VOIDmode, gen_rtx_MEM (FUNCTION_MODE, name),
-+// const0_rtx);
-+// /* If we are doing stack extension, notify about the sp change. */
-+// if (stack_pointer)
-+// call = gen_rtx_SET (VOIDmode, stack_pointer, call);
-+//
-+// /* Generate the call instruction. */
-+// call_insn = emit_call_insn (call);
-+// /* Stack extension does not change memory in an unpredictable way. */
-+// RTL_CONST_OR_PURE_CALL_P (call_insn) = 1;
-+// /* We pass an argument in d0. */
-+// CALL_INSN_FUNCTION_USAGE (call_insn) = gen_rtx_EXPR_LIST (VOIDmode,
-+// gen_rtx_USE (VOIDmode, gen_rtx_REG (SImode, 0)), 0);
-+//
-+// seq = get_insns ();
-+// end_sequence ();
-+// return seq;
-+//}
-+//
-+//rtx
-+//gen_stack_cleanup_call (rtx stack_pointer, rtx sa)
-+//{
-+// return gen_stack_management_call (stack_pointer, sa, "__move_d0_sp");
-+//}
-+//
-+//void
-+//amigaos_alternate_allocate_stack (rtx *operands)
-+//{
-+// if (TARGET_STACKEXTEND)
-+// emit_insn (gen_stack_management_call (stack_pointer_rtx, operands[1],
-+// "__sub_d0_sp"));
-+// else
-+// {
-+// if (TARGET_STACKCHECK)
-+// emit_insn (gen_stack_management_call (0, operands[1], "__stkchk_d0"));
-+// anti_adjust_stack (operands[1]);
-+// }
-+// emit_move_insn (operands[0], virtual_stack_dynamic_rtx);
-+//}
-+#endif
-+
-+/*
-+ * begin-GG-local: explicit register specification for parameters.
-+ *
-+ * Reworked and ported to gcc-6.2.0 by Stefan "Bebbo" Franke.
-+ */
-+
-+/**
-+ * Define this here and add it to tm_p -> all know the custom type and allocate/use the correct size.
-+ */
-+struct amigaos_args
-+{
-+ int num_of_regs;
-+ long regs_already_used;
-+ int last_arg_reg;
-+ int last_arg_len;
-+ tree formal_type; /* New field: formal type of the current argument. */
-+};
-+
-+static struct amigaos_args mycum, othercum;
-+
-+/* Argument-passing support functions. */
-+
-+/* Initialize a variable CUM of type CUMULATIVE_ARGS
-+ for a call to a function whose data type is FNTYPE.
-+ For a library call, FNTYPE is 0. */
-+
-+void
-+amigaos_init_cumulative_args (CUMULATIVE_ARGS *cump, tree fntype, tree decl)
-+{
-+ struct amigaos_args * cum = decl == current_function_decl ? &mycum : &othercum;
-+ *cump = (int)cum;
-+ cum->num_of_regs = amigaos_regparm > 0 ? amigaos_regparm : 0;
-+ DPRINTF(("0amigaos_init_cumulative_args %p -> %d\r\n", cum, cum->num_of_regs));
-+
-+ /* Initialize a variable CUM of type CUMULATIVE_ARGS
-+ for a call to a function whose data type is FNTYPE.
-+ For a library call, FNTYPE is 0. */
-+
-+ cum->last_arg_reg = -1;
-+ cum->regs_already_used = 0;
-+
-+ if (decl)
-+ {
-+ tree attrs = DECL_ATTRIBUTES(decl);
-+ if (lookup_attribute ("stkparm", attrs))
-+ cum->num_of_regs = 0;
-+ else
-+ {
-+ tree ratree = lookup_attribute ("regparm", attrs);
-+ cum->num_of_regs = amigaos_regparm != 0 ?
-+ amigaos_regparm : AMIGAOS_DEFAULT_REGPARM;
-+ if (ratree)
-+ {
-+ tree args = TREE_VALUE(ratree);
-+
-+ if (args && TREE_CODE (args) == TREE_LIST)
-+ {
-+ tree val = TREE_VALUE(args);
-+ if (TREE_CODE (val) == INTEGER_CST)
-+ {
-+ int no = TREE_INT_CST_LOW(val);
-+ if (no > 0 && no < AMIGAOS_MAX_REGPARM)
-+ cum->num_of_regs = no;
-+ }
-+ }
-+ }
-+ }
-+ }
-+ else
-+ /* Libcall. */
-+ cum->num_of_regs = 0;
-+
-+ if (cum->num_of_regs)
-+ {
-+ /* If this is a vararg call, put all arguments on stack. */
-+ tree param, next_param;
-+ for (param = TYPE_ARG_TYPES(fntype); param; param = next_param)
-+ {
-+ next_param = TREE_CHAIN(param);
-+ if (!next_param && TREE_VALUE (param) != void_type_node)
-+ cum->num_of_regs = 0;
-+ }
-+ }
-+
-+ //#if ! defined (PCC_STATIC_STRUCT_RETURN) && defined (M68K_STRUCT_VALUE_REGNUM)
-+ // /* If return value is a structure, and we pass the buffer address in a
-+ // register, we can't use this register for our own purposes.
-+ // FIXME: Something similar would be useful for static chain. */
-+ // if (fntype && aggregate_value_p (TREE_TYPE (fntype), fntype))
-+ // cum->regs_already_used |= (1 << M68K_STRUCT_VALUE_REGNUM);
-+ //#endif
-+
-+ if (fntype)
-+ cum->formal_type = TYPE_ARG_TYPES(fntype);
-+ else
-+ /* Call to compiler-support function. */
-+ cum->formal_type = 0;
-+ DPRINTF(("1amigaos_init_cumulative_args %p -> %d\r\n", cum, cum->num_of_regs));
-+}
-+
-+/* Update the data in CUM to advance over an argument. */
-+
-+void
-+amigaos_function_arg_advance (cumulative_args_t cum_v, machine_mode, const_tree,
-+ bool)
-+{
-+ struct amigaos_args *cum = *(struct amigaos_args **) get_cumulative_args (cum_v);
-+ /* Update the data in CUM to advance over an argument. */
-+
-+ DPRINTF(("amigaos_function_arg_advance1 %p\r\n", cump));
-+
-+ if (cum->last_arg_reg != -1)
-+ {
-+ int count;
-+ for (count = 0; count < cum->last_arg_len; count++)
-+ cum->regs_already_used |= (1 << (cum->last_arg_reg + count));
-+ cum->last_arg_reg = -1;
-+ }
-+
-+ if (cum->formal_type)
-+ cum->formal_type = TREE_CHAIN(cum->formal_type);
-+}
-+
-+/* Define where to put the arguments to a function.
-+ Value is zero to push the argument on the stack,
-+ or a hard register in which to store the argument.
-+
-+ MODE is the argument's machine mode.
-+ TYPE is the data type of the argument (as a tree).
-+ This is null for libcalls where that information may
-+ not be available.
-+ CUM is a variable of type CUMULATIVE_ARGS which gives info about
-+ the preceding args and about the function being called. */
-+
-+static struct rtx_def *
-+_m68k_function_arg (CUMULATIVE_ARGS *, machine_mode, const_tree);
-+
-+static struct rtx_def *
-+_m68k_function_arg (struct amigaos_args * cum, machine_mode mode, const_tree type)
-+{
-+ DPRINTF(("m68k_function_arg numOfRegs=%d\r\n", cum ? cum->num_of_regs : 0));
-+
-+ if (cum->num_of_regs)
-+ {
-+ int regbegin = -1, altregbegin = -1, len;
-+
-+ /* FIXME: The last condition below is a workaround for a bug. */
-+ if (TARGET_68881 && FLOAT_MODE_P(mode) &&
-+ GET_MODE_UNIT_SIZE (mode) <= 12
-+ && (GET_MODE_CLASS (mode) != MODE_COMPLEX_FLOAT || mode == SCmode))
-+ {
-+ regbegin = 16; /* FPx */
-+ len = GET_MODE_NUNITS(mode);
-+ }
-+ /* FIXME: Two last conditions below are workarounds for bugs. */
-+ else if (INTEGRAL_MODE_P (mode) && mode != CQImode && mode != CHImode)
-+ {
-+ if (!type || POINTER_TYPE_P(type))
-+ regbegin = 8; /* Ax */
-+ else
-+ regbegin = 0; /* Dx */
-+ altregbegin = 8 - regbegin;
-+ len = (GET_MODE_SIZE (mode) + (UNITS_PER_WORD - 1)) / UNITS_PER_WORD;
-+ }
-+
-+ if (regbegin != -1)
-+ {
-+ int reg;
-+ long mask;
-+
-+ look_for_reg: mask = 1 << regbegin;
-+ for (reg = 0; reg < cum->num_of_regs; reg++, mask <<= 1)
-+ if (!(cum->regs_already_used & mask))
-+ {
-+ int end;
-+ for (end = reg; end < cum->num_of_regs && end < reg + len;
-+ end++, mask <<= 1)
-+ if (cum->regs_already_used & mask)
-+ break;
-+ if (end == reg + len)
-+ {
-+ cum->last_arg_reg = reg + regbegin;
-+ cum->last_arg_len = len;
-+ break;
-+ }
-+ }
-+
-+ if (reg == AMIGAOS_MAX_REGPARM && altregbegin != -1)
-+ {
-+ DPRINTF(("look for alt reg\n"));
-+ regbegin = altregbegin;
-+ altregbegin = -1;
-+ goto look_for_reg;
-+ }
-+ }
-+
-+ if (cum->last_arg_reg != -1)
-+ {
-+ DPRINTF(("-> gen_rtx_REG %d\r\n", cum->last_arg_reg));
-+ return gen_rtx_REG (mode, cum->last_arg_reg);
-+ }
-+ }
-+ return 0;
-+}
-+
-+/* A C expression that controls whether a function argument is passed
-+ in a register, and which register. */
-+
-+struct rtx_def *
-+amigaos_function_arg (cumulative_args_t cum_v, machine_mode mode,
-+ const_tree type, bool)
-+{
-+ DPRINTF(("amigaos_function_arg %p\r\n", cum_v.p));
-+
-+ struct amigaos_args *cum = *(struct amigaos_args **) get_cumulative_args (cum_v);
-+
-+ tree asmtree = type ? TYPE_ATTRIBUTES(type) : NULL_TREE;
-+ if (asmtree && 0 == strcmp ("asm", IDENTIFIER_POINTER(TREE_PURPOSE(asmtree))))
-+ {
-+ int i;
-+ cum->last_arg_reg = TREE_FIXED_CST_PTR(TREE_VALUE(asmtree))->data.low;
-+ cum->last_arg_len = HARD_REGNO_NREGS(cum->last_arg_reg, mode);
-+
-+ for (i = 0; i < cum->last_arg_len; i++)
-+ {
-+ if (cum->regs_already_used & (1 << (cum->last_arg_reg + i)))
-+ {
-+ error ("two parameters allocated for one register");
-+ break;
-+ }
-+ cum->regs_already_used |= (1 << (cum->last_arg_reg + i));
-+ }
-+ return gen_rtx_REG (mode, cum->last_arg_reg);
-+ }
-+ return _m68k_function_arg (cum, mode, type);
-+}
-+
-+void amiga_emit_regparm_clobbers(void)
-+{
-+ int x = 0;
-+ for (int i = 0; i < FIRST_PSEUDO_REGISTER; ++i)
-+ {
-+ if (mycum.regs_already_used & (1 << i))
-+ emit_insn(gen_rtx_CLOBBER(Pmode, gen_raw_REG(Pmode, i)));
-+ }
-+}
-+
-+
-+/* Return zero if the attributes on TYPE1 and TYPE2 are incompatible,
-+ one if they are compatible, and two if they are nearly compatible
-+ (which causes a warning to be generated). */
-+
-+int
-+amigaos_comp_type_attributes (const_tree type1, const_tree type2)
-+{
-+ DPRINTF(("amigaos_comp_type_attributes\n"));
-+ /* Functions or methods are incompatible if they specify mutually exclusive
-+ ways of passing arguments. */
-+ if (TREE_CODE(type1) == FUNCTION_TYPE || TREE_CODE(type1) == METHOD_TYPE)
-+ {
-+ tree arg1, arg2;
-+ arg1 = TYPE_ARG_TYPES(type1);
-+ arg2 = TYPE_ARG_TYPES(type2);
-+ for (; arg1 && arg2; arg1 = TREE_CHAIN(arg1), arg2 = TREE_CHAIN(arg2))
-+ {
-+ tree attr1 = TYPE_ATTRIBUTES(arg1);
-+ tree attr2 = TYPE_ATTRIBUTES(arg2);
-+ if (strcmp ("asm", IDENTIFIER_POINTER(TREE_PURPOSE(attr1))))
-+ attr1 = NULL_TREE;
-+ if (strcmp ("asm", IDENTIFIER_POINTER(TREE_PURPOSE(attr2))))
-+ attr2 = NULL_TREE;
-+ if (attr1 && attr2)
-+ {
-+ if (TREE_FIXED_CST_PTR(TREE_VALUE(attr1))->data.low
-+ != TREE_FIXED_CST_PTR(TREE_VALUE(attr2))->data.low)
-+ return 0;
-+ }
-+ else if (attr1 || attr2)
-+ return 0; /* asm attribute only on one side. */
-+ }
-+ if (arg1 || arg2)
-+ return 0; /* different count of parameters. */
-+ }
-+ return 1;
-+}
-+
-+/* Return zero if the attributes on TYPE1 and TYPE2 are incompatible,
-+ one if they are compatible, and two if they are nearly compatible
-+ (which causes a warning to be generated). */
-+#if 0
-+static int
-+m68k_comp_type_attributes (tree type1, tree type2)
-+{
-+
-+ /* Functions or methods are incompatible if they specify mutually
-+ exclusive ways of passing arguments. */
-+ if (TREE_CODE (type1) == FUNCTION_TYPE || TREE_CODE (type1) == METHOD_TYPE)
-+ {
-+ tree arg1, arg2;
-+ if (!! lookup_attribute ("stkparm", TYPE_ATTRIBUTES (type1)) !=
-+ !! lookup_attribute ("stkparm", TYPE_ATTRIBUTES (type2))
-+ || !! lookup_attribute ("regparm", TYPE_ATTRIBUTES (type1)) !=
-+ !! lookup_attribute ("regparm", TYPE_ATTRIBUTES (type2)))
-+ return 0; /* 'regparm' and 'stkparm' are mutually exclusive. */
-+
-+ arg1 = lookup_attribute ("regparm", TYPE_ATTRIBUTES (type1));
-+ arg2 = lookup_attribute ("regparm", TYPE_ATTRIBUTES (type2));
-+ if (arg1 && arg2)
-+ {
-+ int num1 = 0, num2 = 0;
-+ if (TREE_VALUE (arg1) && TREE_CODE (TREE_VALUE (arg1)) == TREE_LIST)
-+ {
-+ tree numofregs = TREE_VALUE (TREE_VALUE (arg1));
-+ if (numofregs)
-+ num1 = TREE_INT_CST_LOW (numofregs);
-+ }
-+ if (TREE_VALUE (arg2) && TREE_CODE (TREE_VALUE (arg2)) == TREE_LIST)
-+ {
-+ tree numofregs = TREE_VALUE (TREE_VALUE (arg2));
-+ if (numofregs)
-+ num2 = TREE_INT_CST_LOW (numofregs);
-+ }
-+ if (num1 != num2)
-+ return 0; /* Different numbers, or no number in one type. */
-+ }
-+ }
-+#ifdef TARGET_AMIGAOS
-+ return amigaos_comp_type_attributes(type1, type2);
-+#else
-+ return 1;
-+#endif
-+}
-+#endif
-+
-+/* end-GG-local */
-+
-+
-+/* Handle a "regparm", "stkparm" attribute;
-+ arguments as in struct attribute_spec.handler. */
-+tree
-+amigaos_handle_type_attribute (tree *node, tree name, tree args,
-+ int flags ATTRIBUTE_UNUSED, bool *no_add_attrs)
-+{
-+ tree nnn = *node;
-+ do { // while (0);
-+ DPRINTF(("%p with treecode %d\n", node, TREE_CODE(nnn)));
-+ if (TREE_CODE (nnn) == FUNCTION_DECL || TREE_CODE (nnn) == FUNCTION_TYPE
-+ || TREE_CODE (nnn) == METHOD_TYPE)
-+ {
-+ /* 'regparm' accepts one optional argument - number of registers in
-+ single class that should be used to pass arguments. */
-+ if (is_attribute_p ("regparm", name))
-+ {
-+ DPRINTF(("regparm found\n"));
-+
-+ if (lookup_attribute ("stkparm", TYPE_ATTRIBUTES(nnn)))
-+ {
-+ error ("`regparm' and `stkparm' are mutually exclusive");
-+ break;
-+ }
-+ if (args && TREE_CODE (args) == TREE_LIST)
-+ {
-+ tree val = TREE_VALUE(args);
-+ DPRINTF(("regparm with val: %d\n", TREE_CODE(val)));
-+ if (TREE_CODE (val) == INTEGER_CST)
-+ {
-+ int no = TREE_INT_CST_LOW(val);
-+ if (no < 0 || no > AMIGAOS_MAX_REGPARM)
-+ {
-+ error ("`regparm' attribute: value %d not in [0 - %d]",
-+ no,
-+ AMIGAOS_MAX_REGPARM);
-+ break;
-+ }
-+ }
-+ else
-+ {
-+ error ("invalid argument(s) to `regparm' attribute");
-+ break;
-+ }
-+ }
-+ }
-+ else if (is_attribute_p ("stkparm", name))
-+ {
-+ if (lookup_attribute ("regparm", TYPE_ATTRIBUTES(nnn)))
-+ {
-+ error ("`regparm' and `stkparm' are mutually exclusive");
-+ break;
-+ }
-+ }
-+ else if (is_attribute_p ("stackext", name))
-+ {
-+ if (lookup_attribute ("interrupt", TYPE_ATTRIBUTES(nnn)))
-+ {
-+ error ("`stackext' and `interrupt' are mutually exclusive");
-+ break;
-+ }
-+ }
-+ else if (is_attribute_p ("saveds", name))
-+ {
-+ }
-+ }
-+ else
-+ {
-+ warning (OPT_Wattributes, "`%s' attribute only applies to functions",
-+ IDENTIFIER_POINTER(name));
-+ }
-+ return NULL_TREE;
-+ } while (0);
-+ // error case
-+ *no_add_attrs = true;
-+ return NULL_TREE;
-+}
-+
-+
-+extern bool
-+m68k_rtx_costs (rtx, machine_mode, int, int, int *, bool);
-+
-+bool
-+amigaos_rtx_costs (rtx x, machine_mode mode, int outer_code, int opno,
-+ int *total, bool speed)
-+{
-+// DPRINTF(("outer: %d, opno: %d", outer_code, opno));
-+ bool r = m68k_rtx_costs (x, mode, outer_code, opno, total, speed);
-+// *total *= 4;
-+// fprintf(stderr, "costs: %d, mode=%d, outer=%d, opno=%d, speed=%d, ok=%d\n", *total * 4, mode, outer_code, opno, speed, r);
-+// debug_rtx(x);
-+ return r;
-+}
-+
-+
-+/* Output assembly to switch to section NAME with attribute FLAGS. */
-+
-+extern void
-+amiga_named_section (const char *name, unsigned int flags, tree decl ATTRIBUTE_UNUSED)
-+{
-+ if (0 == strncmp(".text", name, 5))
-+ name = ".text";
-+ fprintf (asm_out_file, "\t%s\n", name);
-+}
-+
-+/* Baserel support. */
-+
-+/**
-+ * Does x reference the pic_reg and is const or plus?
-+ */
-+int amiga_is_const_pic_ref(const_rtx x)
-+{
-+ const_rtx y = x;
-+ if (flag_pic < 3)
-+ return false;
-+ while (GET_CODE(y) == CONST || GET_CODE(y) == PLUS)
-+ y = XEXP(y, 0);
-+ return (x != y && REG_P(y) && REGNO(y) == PIC_REG);
-+}
-+
-+
-+/* Does operand (which is a symbolic_operand) live in text space? If
-+ so SYMBOL_REF_FLAG, which is set by ENCODE_SECTION_INFO, will be true.
-+
-+ This function is used in base relative code generation. */
-+
-+int
-+read_only_operand (rtx operand)
-+{
-+ if (GET_CODE (operand) == CONST)
-+ operand = XEXP (XEXP (operand, 0), 0);
-+ if (GET_CODE (operand) == SYMBOL_REF)
-+ return SYMBOL_REF_FLAG (operand) || CONSTANT_POOL_ADDRESS_P (operand);
-+ return 1;
-+}
-+
-+reg_class_t
-+amiga_preferred_rename_class2 (reg_class_t rclass ATTRIBUTE_UNUSED, int regno)
-+{
-+ if (regno == 0)
-+ return D0_REGS;
-+ if (regno == 8)
-+ return A0_REGS;
-+ return regno_reg_class[regno];
-+}
-diff --git a/gcc/config/m68k/m68k.c b/gcc/config/m68k/m68k.c
-index 52eabeaafb23..3fabe00a678a 100644
---- gcc/config/m68k/m68k.c
-+++ gcc/config/m68k/m68k.c
-@@ -1004,6 +1004,8 @@ m68k_set_frame_related (rtx_insn *insn)
-
- /* Emit RTL for the "prologue" define_expand. */
-
-+extern void amiga_emit_regparm_clobbers(void);
-+
- void
- m68k_expand_prologue (void)
- {
-@@ -1012,6 +1014,10 @@ m68k_expand_prologue (void)
-
- m68k_compute_frame_layout ();
-
-+#ifdef TARGET_AMIGA
-+ amiga_emit_regparm_clobbers();
-+#endif
-+
- if (flag_stack_usage_info)
- current_function_static_stack_size
- = current_frame.size + current_frame.offset;
-
-From 9aabe6ab20a761ee0311e7f44fe8d32cc51fc5a2 Mon Sep 17 00:00:00 2001
-From: bebbo <bebbo(a)bejy.net>
-Date: Wed, 19 Apr 2017 14:40:38 +0200
-Subject: [PATCH 071/303] @B fix for 64bit builds
-
----
- gcc/config/m68k/amigaos.c | 16 +++++-----------
- 1 file changed, 5 insertions(+), 11 deletions(-)
-
-diff --git a/gcc/config/m68k/amigaos.c b/gcc/config/m68k/amigaos.c
-index ca8eea305345..cf96844ad8cd 100644
---- gcc/config/m68k/amigaos.c
-+++ gcc/config/m68k/amigaos.c
-@@ -383,7 +383,7 @@ void
- amigaos_init_cumulative_args (CUMULATIVE_ARGS *cump, tree fntype, tree decl)
- {
- struct amigaos_args * cum = decl == current_function_decl ? &mycum : &othercum;
-- *cump = (int)cum;
-+ *cump = decl == current_function_decl;
- cum->num_of_regs = amigaos_regparm > 0 ? amigaos_regparm : 0;
- DPRINTF(("0amigaos_init_cumulative_args %p -> %d\r\n", cum, cum->num_of_regs));
-
-@@ -459,7 +459,7 @@ void
- amigaos_function_arg_advance (cumulative_args_t cum_v, machine_mode, const_tree,
- bool)
- {
-- struct amigaos_args *cum = *(struct amigaos_args **) get_cumulative_args (cum_v);
-+ struct amigaos_args *cum = *get_cumulative_args (cum_v) ? &mycum : &othercum;
- /* Update the data in CUM to advance over an argument. */
-
- DPRINTF(("amigaos_function_arg_advance1 %p\r\n", cump));
-@@ -487,9 +487,6 @@ amigaos_function_arg_advance (cumulative_args_t cum_v, machine_mode, const_tree,
- CUM is a variable of type CUMULATIVE_ARGS which gives info about
- the preceding args and about the function being called. */
-
--static struct rtx_def *
--_m68k_function_arg (CUMULATIVE_ARGS *, machine_mode, const_tree);
--
- static struct rtx_def *
- _m68k_function_arg (struct amigaos_args * cum, machine_mode mode, const_tree type)
- {
-@@ -567,7 +564,7 @@ amigaos_function_arg (cumulative_args_t cum_v, machine_mode mode,
- {
- DPRINTF(("amigaos_function_arg %p\r\n", cum_v.p));
-
-- struct amigaos_args *cum = *(struct amigaos_args **) get_cumulative_args (cum_v);
-+ struct amigaos_args *cum = *get_cumulative_args (cum_v) ? &mycum : &othercum;
-
- tree asmtree = type ? TYPE_ATTRIBUTES(type) : NULL_TREE;
- if (asmtree && 0 == strcmp ("asm", IDENTIFIER_POINTER(TREE_PURPOSE(asmtree))))
-@@ -592,12 +589,9 @@ amigaos_function_arg (cumulative_args_t cum_v, machine_mode mode,
-
- void amiga_emit_regparm_clobbers(void)
- {
-- int x = 0;
- for (int i = 0; i < FIRST_PSEUDO_REGISTER; ++i)
-- {
-- if (mycum.regs_already_used & (1 << i))
-- emit_insn(gen_rtx_CLOBBER(Pmode, gen_raw_REG(Pmode, i)));
-- }
-+ if (mycum.regs_already_used & (1 << i))
-+ emit_insn(gen_rtx_CLOBBER(Pmode, gen_raw_REG(Pmode, i)));
- }
-
-
-
-From aad2b7a890503955a2a1aae5ab09f89ed1466769 Mon Sep 17 00:00:00 2001
-From: bebbo <bebbo(a)bejy.net>
-Date: Wed, 19 Apr 2017 18:37:57 +0200
-Subject: [PATCH 072/303] @R mregparm is using old register usage conventions
-
----
- gcc/config/m68k/amigaos.c | 2 +-
- 1 file changed, 1 insertion(+), 1 deletion(-)
-
-diff --git a/gcc/config/m68k/amigaos.c b/gcc/config/m68k/amigaos.c
-index cf96844ad8cd..09934f94c06d 100644
---- gcc/config/m68k/amigaos.c
-+++ gcc/config/m68k/amigaos.c
-@@ -537,7 +537,7 @@ _m68k_function_arg (struct amigaos_args * cum, machine_mode mode, const_tree typ
- }
- }
-
-- if (reg == AMIGAOS_MAX_REGPARM && altregbegin != -1)
-+ if (reg == cum->num_of_regs && altregbegin != -1)
- {
- DPRINTF(("look for alt reg\n"));
- regbegin = altregbegin;
-
-From 554f57921f19cad9583eb4f319e12710ab786ceb Mon Sep 17 00:00:00 2001
-From: bebbo <bebbo(a)bejy.net>
-Date: Wed, 19 Apr 2017 18:40:05 +0200
-Subject: [PATCH 073/303] @B ensure that clobbers for mregparm are not marked
- as REG_DEAD
-
----
- gcc/bbb-opts.c | 43 ++++++++++++++++++++++++++++---------------
- gcc/regrename.c | 28 ++++++++++++++++++++++++++--
- 2 files changed, 54 insertions(+), 17 deletions(-)
-
-diff --git a/gcc/bbb-opts.c b/gcc/bbb-opts.c
-index 1b1863e9ae8f..2c19242512a2 100755
---- gcc/bbb-opts.c
-+++ gcc/bbb-opts.c
-@@ -325,20 +325,24 @@ dump_insns (char const * name, bool all)
- }
- for (unsigned i = 0; i < insns.size (); ++i)
- {
-- insn_info & ii = infos[i];
--
- fprintf (stderr, "%d: ", i);
-
-- for (int j = 0; j < 8; ++j)
-- if (ii.is_use (j))
-- fprintf (stderr, ii.is_def (j) ? "*d%d " : "d%d ", j);
-+ if (i < infos.size ())
-+ {
-+ insn_info & ii = infos[i];
-+
-+ for (int j = 0; j < 8; ++j)
-+ if (ii.is_use (j))
-+ fprintf (stderr, ii.is_def (j) ? "*d%d " : "d%d ", j);
-
-- for (int j = 8; j < 16; ++j)
-- if (ii.is_use (j))
-- fprintf (stderr, ii.is_def (j) ? "*a%d " : "a%d ", j - 8);
-+ for (int j = 8; j < 16; ++j)
-+ if (ii.is_use (j))
-+ fprintf (stderr, ii.is_def (j) ? "*a%d " : "a%d ", j - 8);
-
-- if (ii.is_use (FIRST_PSEUDO_REGISTER))
-- fprintf (stderr, ii.is_def (FIRST_PSEUDO_REGISTER) ? "*cc " : "cc ");
-+ if (ii.is_use (FIRST_PSEUDO_REGISTER))
-+ fprintf (stderr, ii.is_def (FIRST_PSEUDO_REGISTER) ? "*cc " : "cc ");
-+
-+ }
-
- fprintf (stderr, "\t");
- debug_rtx (insns[i]);
-@@ -502,6 +506,14 @@ update_insn_infos (void)
- continue;
- }
-
-+ if (GET_CODE (pattern) == CLOBBER ) {
-+ /* mark regs as use and def */
-+ insn_info ud;
-+ ud.scan(pattern);
-+ ud._def |= ud._use;
-+ infos[pos] |= ud;
-+ continue;
-+ }
- if (GET_CODE (pattern) != PARALLEL && GET_CODE (pattern) != CLOBBER && be_verbose)
- {
- fprintf (stderr, "##### ");
-@@ -882,7 +894,7 @@ opt_strcpy ()
- src = XEXP(src, 1);
-
- // if (CONST_INT_P(src) && INTVAL(src) == 0 && find_reg_note (insn, REG_DEAD, dst))
-- if (REG_P(dst) && CONST_INT_P(src) && INTVAL(src) == 0 && is_reg_dead(REGNO(dst), index))
-+ if (REG_P(dst) && CONST_INT_P(src) && INTVAL(src) == 0 && is_reg_dead (REGNO(dst), index))
- {
- /* now check via NOTICE_UPDATE_CC*/
- NOTICE_UPDATE_CC(PATTERN (reg2x), reg2x);
-@@ -1300,7 +1312,7 @@ merge_add (void)
-
- log ("merge_add applied\n");
-
-- rtx_insn * newins1 = make_insn_raw(gen_rtx_SET(dst1, l1));
-+ rtx_insn * newins1 = make_insn_raw (gen_rtx_SET(dst1, l1));
- add_insn_after (newins1, ins1, 0);
- SET_INSN_DELETED(ins1);
-
-@@ -1836,9 +1848,9 @@ namespace
- class opt_pass * rr = ::global_pass_regrename->clone ();
- rr->execute (0);
-
-- // update_insns ();
-- // update_insn_infos ();
-- // bb_reg_rename ();
-+ // update_insns ();
-+ // update_insn_infos ();
-+ // bb_reg_rename ();
-
- update_insns ();
- }
-@@ -1851,6 +1863,7 @@ namespace
- {
- shrink_stack_frame ();
- update_insns ();
-+ update_insn_infos ();
- }
-
- if (strchr (string_bbb_opts, 'X') || strchr (string_bbb_opts, 'x'))
-diff --git a/gcc/regrename.c b/gcc/regrename.c
-index 696e5557780e..eceb7286e31e 100755
---- gcc/regrename.c
-+++ gcc/regrename.c
-@@ -892,7 +892,7 @@ regrename_analyze (bitmap bb_mask)
- if (!range_overlaps_hard_reg_set_p (live, chain->regno,
- chain->nregs))
- continue;
--
-+
- n_succs_used++;
-
- dest_ri = (struct bb_rename_info *)e->dest->aux;
-@@ -916,7 +916,7 @@ regrename_analyze (bitmap bb_mask)
- printed = true;
- fprintf (dump_file,
- " merging chains %d (->%d) and %d (->%d) [%s]\n",
-- k, incoming_chain->id, j, chain->id,
-+ k, incoming_chain->id, j, chain->id,
- reg_names[incoming_chain->regno]);
- }
-
-@@ -1892,6 +1892,28 @@ regrename_finish (void)
- obstack_free (&rename_obstack, NULL);
- }
-
-+void
-+mark_early_clobbers_alive (void)
-+{
-+ rtx_insn * insn;
-+ for (insn = get_insns (); insn; insn = NEXT_INSN (insn))
-+ {
-+ rtx pattern;
-+ if (NOTE_P(insn) && NOTE_KIND(insn) == NOTE_INSN_PROLOGUE_END)
-+ break;
-+
-+ pattern = PATTERN (insn);
-+ if (pattern && GET_CODE(pattern) == CLOBBER)
-+ {
-+ rtx *loc;
-+
-+ loc = ®_NOTES(insn);
-+ while (*loc)
-+ *loc = XEXP(*loc, 1);
-+ }
-+ }
-+}
-+
- /* Perform register renaming on the current function. */
-
- static unsigned int
-@@ -1902,6 +1924,8 @@ regrename_optimize (void)
- df_analyze ();
- df_set_flags (DF_DEFER_INSN_RESCAN);
-
-+ mark_early_clobbers_alive ();
-+
- regrename_init (false);
-
- regrename_analyze (NULL);
-
-From 23951fbf9ef78f3106624afd857e738ee56d3663 Mon Sep 17 00:00:00 2001
-From: bebbo <bebbo(a)bejy.net>
-Date: Thu, 20 Apr 2017 09:34:00 +0200
-Subject: [PATCH 074/303] @B modified clobber for regrename with regparm
-
----
- gcc/config/m68k/amigaos.c | 5 ++++-
- 1 file changed, 4 insertions(+), 1 deletion(-)
-
-diff --git a/gcc/config/m68k/amigaos.c b/gcc/config/m68k/amigaos.c
-index 09934f94c06d..a598406ca132 100644
---- gcc/config/m68k/amigaos.c
-+++ gcc/config/m68k/amigaos.c
-@@ -591,7 +591,10 @@ void amiga_emit_regparm_clobbers(void)
- {
- for (int i = 0; i < FIRST_PSEUDO_REGISTER; ++i)
- if (mycum.regs_already_used & (1 << i))
-- emit_insn(gen_rtx_CLOBBER(Pmode, gen_raw_REG(Pmode, i)));
-+ {
-+ rtx reg = gen_raw_REG(Pmode, i);
-+ emit_insn(gen_rtx_CLOBBER(Pmode, gen_rtx_SET(reg, reg)));
-+ }
- }
-
-
-
-From 6186c919f785d5f0ed760ac3e164510098e106aa Mon Sep 17 00:00:00 2001
-From: bebbo <bebbo(a)bejy.net>
-Date: Thu, 20 Apr 2017 18:29:48 +0200
-Subject: [PATCH 075/303] @R half way through to own rename
-
----
- gcc/bbb-opts.c | 240 +++++++++++++++++++++++++++++++++++++++-------
- gcc/config/m68k/amigaos.c | 3 +-
- gcc/regrename.c | 26 +----
- 3 files changed, 208 insertions(+), 61 deletions(-)
-
-diff --git a/gcc/bbb-opts.c b/gcc/bbb-opts.c
-index 2c19242512a2..7a3a716193c4 100755
---- gcc/bbb-opts.c
-+++ gcc/bbb-opts.c
-@@ -49,6 +49,7 @@
- #include "cselib.h"
- #include "langhooks.h"
- #include <vector>
-+#include <set>
- #include <map>
-
- static bool be_verbose;
-@@ -94,11 +95,12 @@ log (char const * fmt, ...)
- */
- struct insn_info
- {
-- unsigned _use;
-- unsigned _def;
-+ unsigned _use; // bit set if registers are used
-+ unsigned _def; // bit set if registers are defined
-+ unsigned _hard; // bit set if registers can't be renamed
-
- insn_info () :
-- _use (0), _def (0)
-+ _use (0), _def (0), _hard (0)
- {
- }
-
-@@ -107,6 +109,7 @@ struct insn_info
- {
- _use = 0;
- _def = 0;
-+ _hard = 0;
- }
-
- inline void
-@@ -121,11 +124,18 @@ struct insn_info
- _def |= 1 << regno;
- }
-
-+ inline void
-+ hard (int regno)
-+ {
-+ _hard |= 1 << regno;
-+ }
-+
- inline void
- unset (int regno)
- {
- _use &= ~(1 << regno);
- _def &= ~(1 << regno);
-+ _hard &= ~(1 << regno);
- }
-
- inline bool
-@@ -140,12 +150,19 @@ struct insn_info
- return (_def & (1 << regno)) != 0;
- }
-
-+ inline bool
-+ is_hard (int regno)
-+ {
-+ return (_hard & (1 << regno)) != 0;
-+ }
-+
- inline insn_info
- operator | (insn_info const & o) const
- {
- insn_info t;
- t._use = _use | o._use;
- t._def = _def | o._def;
-+ t._hard = _hard | o._hard;
- return t;
- }
-
-@@ -154,6 +171,7 @@ struct insn_info
- {
- _use |= o._use;
- _def |= o._def;
-+ _hard |= o._hard;
- return *this;
- }
-
-@@ -162,6 +180,7 @@ struct insn_info
- {
- _use &= o._use & o._def;
- _def &= o._def;
-+ _hard &= o._hard & o._def;
- return *this;
- }
-
-@@ -177,6 +196,7 @@ struct insn_info
- insn_info t;
- t._use = ~_use;
- t._def = ~_def;
-+ t._hard = ~_hard;
- return t;
- }
-
-@@ -194,9 +214,12 @@ struct insn_info
- scan (rtx);
-
- unsigned
-- get_def_mask () const
-+ get_free_mask () const
- {
-- if (!_def || _def > 0x7fff)
-+ if (_def & _hard)
-+ return 0;
-+
-+ if (!_def || _def > 0x1000)
- return 0;
-
- unsigned mask = _def - 1;
-@@ -204,11 +227,10 @@ struct insn_info
- if ((mask & ~_def) != mask)
- return 0;
-
-- if (_def > 0x1000)
-- return 0;
- if (_def > 0xff)
- mask &= 0xff00;
-- return mask;
-+
-+ return mask & ~_use;
- }
- };
-
-@@ -271,6 +293,7 @@ do_reg_rename (rtx x, unsigned oldregno, unsigned newregno)
- * Collect some data.
- */
- static std::vector<rtx_insn *> insns;
-+static std::vector<bool> proepilogue;
- static std::vector<rtx_insn *> temp;
- static std::vector<rtx_insn *> jumps;
- static std::map<rtx_insn *, unsigned> insn2index;
-@@ -283,6 +306,7 @@ static void
- clear (void)
- {
- insns.clear ();
-+ proepilogue.clear ();
- jumps.clear ();
- insn2index.clear ();
- infos.clear ();
-@@ -333,11 +357,23 @@ dump_insns (char const * name, bool all)
-
- for (int j = 0; j < 8; ++j)
- if (ii.is_use (j))
-- fprintf (stderr, ii.is_def (j) ? "*d%d " : "d%d ", j);
-+ {
-+ if (ii.is_hard (j))
-+ fprintf (stderr, "!");
-+ if (ii.is_def (j))
-+ fprintf (stderr, "*");
-+ fprintf (stderr, "d%d ", j);
-+ }
-
- for (int j = 8; j < 16; ++j)
- if (ii.is_use (j))
-- fprintf (stderr, ii.is_def (j) ? "*a%d " : "a%d ", j - 8);
-+ {
-+ if (ii.is_hard (j))
-+ fprintf (stderr, "!");
-+ if (ii.is_def (j))
-+ fprintf (stderr, "*");
-+ fprintf (stderr, "a%d ", j - 8);
-+ }
-
- if (ii.is_use (FIRST_PSEUDO_REGISTER))
- fprintf (stderr, ii.is_def (FIRST_PSEUDO_REGISTER) ? "*cc " : "cc ");
-@@ -367,6 +403,7 @@ update_insns ()
-
- df_insn_rescan_all ();
-
-+ bool inproepilogue = true;
- /* create a vector with relevant insn. */
- for (insn = get_insns (); insn; insn = next)
- {
-@@ -379,6 +416,18 @@ update_insns ()
-
- insn2index.insert (std::make_pair (insn, insns.size ()));
- insns.push_back (insn);
-+ proepilogue.push_back (inproepilogue);
-+
-+ if (JUMP_P(insn))
-+ inproepilogue = false;
-+ }
-+
-+ if (NOTE_P(insn))
-+ {
-+ if (NOTE_KIND(insn) == NOTE_INSN_PROLOGUE_END)
-+ inproepilogue = false;
-+ else if (NOTE_KIND(insn) == NOTE_INSN_EPILOGUE_BEG)
-+ inproepilogue = true;
- }
- }
- }
-@@ -447,6 +496,8 @@ update_insn_infos (void)
- for (unsigned r = REGNO(reg); r <= END_REGNO (reg); ++r)
- use.use (r);
- }
-+ /* also mark all registers as not renamable */
-+ use._hard = use._use;
-
- rtx set = single_set (insn);
- if (set)
-@@ -457,15 +508,11 @@ update_insn_infos (void)
- else
- use.scan (pattern);
-
-- /* fix missing defs - a call sets d0 and maybe also d1,a0,a1. */
-- if (ii.is_use (0))
-- def.def (0);
-- if (ii.is_use (1))
-- def.def (1);
-- if (ii.is_use (8))
-- def.def (8);
-- if (ii.is_use (9))
-- def.def (9);
-+ /* mark scratch registers. */
-+ def.def (0);
-+ def.def (1);
-+ def.def (8);
-+ def.def (9);
-
- infos[pos] = def | use | ii;
-
-@@ -501,26 +548,37 @@ update_insn_infos (void)
- {
- rtx x = XEXP(pattern, 0);
- if (REG_P(x))
-- ii.use (REGNO(x));
-+ {
-+ ii.use (REGNO(x));
-+ ii.hard (REGNO(x));
-+ }
- infos[pos] = ii;
- continue;
- }
-
-- if (GET_CODE (pattern) == CLOBBER ) {
-+ if (GET_CODE (pattern) == CLOBBER)
-+ {
- /* mark regs as use and def */
- insn_info ud;
-- ud.scan(pattern);
-+ ud.scan (pattern);
- ud._def |= ud._use;
-+ ud._hard = ud._use; /* don't rename. */
- infos[pos] |= ud;
- continue;
-- }
-- if (GET_CODE (pattern) != PARALLEL && GET_CODE (pattern) != CLOBBER && be_verbose)
-+ }
-+ if (GET_CODE (pattern) != PARALLEL && be_verbose)
- {
- fprintf (stderr, "##### ");
- debug_rtx (insn);
- }
-- ii.scan (pattern);
-- infos[pos] = ii;
-+
-+ insn_info jj;
-+ jj.scan (pattern);
-+
-+ if (proepilogue[pos])
-+ jj._hard = jj._use | jj._def;
-+
-+ infos[pos] = ii | jj;
- continue;
- }
-
-@@ -549,6 +607,9 @@ update_insn_infos (void)
- def.def (FIRST_PSEUDO_REGISTER);
- }
-
-+ if (proepilogue[pos])
-+ ii._hard |= use._use | def._def;
-+
- infos[pos] = def | use | ii;
-
- ii &= ~def;
-@@ -558,6 +619,114 @@ update_insn_infos (void)
- }
- }
-
-+static int
-+bit2regno (unsigned bit)
-+{
-+ if (!bit)
-+ return -1;
-+
-+ unsigned regno = 0;
-+ while (!(bit & 1))
-+ {
-+ ++regno;
-+ bit >>= 1;
-+ }
-+ return regno;
-+}
-+
-+/*
-+ * Always prefer lower register numbers within the class.
-+ */
-+static unsigned
-+bb_reg_rename (void)
-+{
-+// dump_insns ("rename", 1);
-+ for (unsigned index = 0; index < insns.size (); ++index)
-+ {
-+ insn_info & ii = infos[index];
-+ const unsigned def = ii._def & ~ii._hard;
-+ unsigned mask = ii.get_free_mask ();
-+
-+ if (!mask || !def)
-+ continue;
-+
-+ std::set<unsigned> found;
-+ std::vector<unsigned> todo;
-+ if (index + 1 < insns.size ())
-+ todo.push_back (index + 1);
-+
-+ found.insert (index);
-+ /* a register was defined, follow all branches. */
-+ while (todo.size ())
-+ {
-+ unsigned pos = todo[todo.size () - 1];
-+ todo.pop_back ();
-+
-+ if (found.find (pos) != found.end ())
-+ continue;
-+
-+ if (LABEL_P(insns[pos]))
-+ {
-+ if (pos + 1 < insns.size ())
-+ todo.push_back (pos + 1);
-+ continue;
-+ }
-+
-+ insn_info & jj = infos[pos];
-+
-+ /* not used. */
-+ if (!(jj._use & def))
-+ continue;
-+
-+ /* update free regs. */
-+ mask &= ~jj._use;
-+ mask &= ~jj._def;
-+ if (!mask)
-+ break;
-+
-+
-+ found.insert (pos);
-+
-+ /* follow jump and/or next insn. */
-+ rtx_insn * insn = insns[pos];
-+ if (JUMP_P(insn))
-+ {
-+ std::map<rtx_insn *, unsigned>::iterator j = insn2index.find ((rtx_insn *) JUMP_LABEL(insn));
-+ if (j != insn2index.end ())
-+ todo.push_back (j->second);
-+
-+ rtx jmppattern = PATTERN (insn);
-+
-+ rtx jmpsrc = XEXP(jmppattern, 1);
-+ if (GET_CODE(jmpsrc) == IF_THEN_ELSE)
-+ if (pos + 1 < insns.size ())
-+ todo.push_back (pos + 1);
-+ }
-+ else if (pos + 1 < insns.size ())
-+ todo.push_back (pos + 1);
-+ }
-+
-+ if (mask)
-+ {
-+ int oldregno = bit2regno (def);
-+ int newregno = bit2regno (mask);
-+ log ("bb_reg_rename %s -> %s (%d insns)\n", reg_names[oldregno], reg_names[newregno], found.size ());
-+
-+ for (std::set<unsigned>::iterator i = found.begin (); i != found.end (); ++i)
-+ {
-+// if (be_verbose)
-+// debug_rtx (insns[*i]);
-+ do_reg_rename (PATTERN (insns[*i]), oldregno, newregno);
-+ }
-+
-+ cselib_invalidate_rtx (gen_raw_REG (SImode, oldregno));
-+ cselib_invalidate_rtx (gen_raw_REG (SImode, newregno));
-+ return 1;
-+ }
-+ }
-+ return 0;
-+}
-+
- /*
- * #1 propagate a->b->a moves out of a loop.
- *
-@@ -1841,18 +2010,19 @@ namespace
- done = 0, update_insns (), update_insn_infos ();
-
- if (do_elim_dead_assign && elim_dead_assign ())
-- done = 0, update_insns ();
-+ done = 0, update_insns (), update_insn_infos ();
-
- if (do_bb_reg_rename && ::global_pass_regrename)
- {
-- class opt_pass * rr = ::global_pass_regrename->clone ();
-- rr->execute (0);
--
-- // update_insns ();
-- // update_insn_infos ();
-- // bb_reg_rename ();
--
-- update_insns ();
-+// class opt_pass * rr = ::global_pass_regrename->clone ();
-+// rr->execute (0);
-+
-+ while (bb_reg_rename ())
-+ {
-+ update_insns ();
-+ update_insn_infos ();
-+ done = 0;
-+ }
- }
-
- if (done)
-diff --git a/gcc/config/m68k/amigaos.c b/gcc/config/m68k/amigaos.c
-index a598406ca132..dd5707612119 100644
---- gcc/config/m68k/amigaos.c
-+++ gcc/config/m68k/amigaos.c
-@@ -589,11 +589,12 @@ amigaos_function_arg (cumulative_args_t cum_v, machine_mode mode,
-
- void amiga_emit_regparm_clobbers(void)
- {
-+ rtx sp = gen_raw_REG(Pmode, 15);
- for (int i = 0; i < FIRST_PSEUDO_REGISTER; ++i)
- if (mycum.regs_already_used & (1 << i))
- {
- rtx reg = gen_raw_REG(Pmode, i);
-- emit_insn(gen_rtx_CLOBBER(Pmode, gen_rtx_SET(reg, reg)));
-+ emit_insn(gen_rtx_CLOBBER(Pmode, gen_rtx_SET(reg, gen_rtx_MEM(Pmode, reg))));
- }
- }
-
-diff --git a/gcc/regrename.c b/gcc/regrename.c
-index eceb7286e31e..fad839f8f926 100755
---- gcc/regrename.c
-+++ gcc/regrename.c
-@@ -1892,28 +1892,6 @@ regrename_finish (void)
- obstack_free (&rename_obstack, NULL);
- }
-
--void
--mark_early_clobbers_alive (void)
--{
-- rtx_insn * insn;
-- for (insn = get_insns (); insn; insn = NEXT_INSN (insn))
-- {
-- rtx pattern;
-- if (NOTE_P(insn) && NOTE_KIND(insn) == NOTE_INSN_PROLOGUE_END)
-- break;
--
-- pattern = PATTERN (insn);
-- if (pattern && GET_CODE(pattern) == CLOBBER)
-- {
-- rtx *loc;
--
-- loc = ®_NOTES(insn);
-- while (*loc)
-- *loc = XEXP(*loc, 1);
-- }
-- }
--}
--
- /* Perform register renaming on the current function. */
-
- static unsigned int
-@@ -1924,8 +1902,6 @@ regrename_optimize (void)
- df_analyze ();
- df_set_flags (DF_DEFER_INSN_RESCAN);
-
-- mark_early_clobbers_alive ();
--
- regrename_init (false);
-
- regrename_analyze (NULL);
-@@ -1965,7 +1941,7 @@ class pass_regrename : public rtl_opt_pass
- /* opt_pass methods: */
- virtual bool gate (function *)
- {
-- return (optimize > 0 && (flag_rename_registers));
-+ return (optimize > 0 && (flag_rename_registers) && !TARGET_AMIGA);
- }
-
- virtual unsigned int execute (function *) { return regrename_optimize (); }
-
-From bab57d7745f2399e3bf6c23f9803ae188bf576ea Mon Sep 17 00:00:00 2001
-From: bebbo <bebbo(a)bejy.net>
-Date: Sat, 22 Apr 2017 16:23:35 +0200
-Subject: [PATCH 076/303] @R own rename registers seems to work.
-
----
- gcc/bbb-opts.c | 350 ++++++++++++++++++++++++++++++++++++--------------------
- gcc/cfgbuild.c | 1 +
- gcc/regrename.c | 3 -
- 3 files changed, 225 insertions(+), 129 deletions(-)
-
-diff --git a/gcc/bbb-opts.c b/gcc/bbb-opts.c
-index 7a3a716193c4..1f70ffecc2d4 100755
---- gcc/bbb-opts.c
-+++ gcc/bbb-opts.c
-@@ -175,13 +175,20 @@ struct insn_info
- return *this;
- }
-
-- inline insn_info &
-- operator &= (insn_info const & o)
-+ /*
-+ * update for previous insn.
-+ * - remove regs which are defined here
-+ * - add regs which are used here
-+ * - reset _def
-+ * - restrain _hard to used
-+ */
-+ inline void
-+ updateWith (insn_info const & o)
- {
-- _use &= o._use & o._def;
-- _def &= o._def;
-- _hard &= o._hard & o._def;
-- return *this;
-+ _use &= ~o._def;
-+ _use |= o._use;
-+ _def = 0;
-+ _hard &= ~_use;
- }
-
- inline bool
-@@ -252,6 +259,24 @@ insn_info::scan (rtx x)
- }
-
- RTX_CODE code = GET_CODE(x);
-+
-+ /* handle SET and record use and def. */
-+ if (code == SET)
-+ {
-+ unsigned u = _use;
-+ scan (SET_DEST(x));
-+ if (REG_P(SET_DEST(x)))
-+ {
-+ _def = _use;
-+ _use = u;
-+ }
-+ scan (SET_SRC(x));
-+ int code = GET_CODE(SET_SRC(x));
-+ if (code == ASM_OPERANDS)
-+ _hard |= _def | _use;
-+ return;
-+ }
-+
- const char *fmt = GET_RTX_FORMAT(code);
- for (int i = GET_RTX_LENGTH (code) - 1; i >= 0; i--)
- {
-@@ -263,14 +288,63 @@ insn_info::scan (rtx x)
- }
- }
-
-+static rtx
-+copy_reg(rtx reg, int newregno)
-+{
-+ if (newregno < 0)
-+ newregno = REGNO(reg);
-+ rtx x = gen_raw_REG(GET_MODE(reg), newregno);
-+ x->jump = reg->jump;
-+ x->call = reg->call;
-+ x->unchanging = reg->unchanging;
-+ x->volatil = reg->volatil;
-+ x->in_struct = reg->in_struct;
-+ x->used = reg->used;
-+ x->frame_related = reg->frame_related;
-+ x->return_val = reg->return_val;
-+
-+ x->u.reg.attrs = reg->u.reg.attrs;
-+ return x;
-+}
-+
-+static void
-+validate_rename (std::vector<std::pair<rtx *, rtx>> & loc, rtx x, unsigned oldregno, unsigned newregno)
-+{
-+ RTX_CODE code = GET_CODE(x);
-+
-+ const char *fmt = GET_RTX_FORMAT(code);
-+ for (int i = GET_RTX_LENGTH (code) - 1; i >= 0; i--)
-+ {
-+ if (fmt[i] == 'e')
-+ {
-+ rtx y = XEXP(x, i);
-+ if (REG_P(y))
-+ {
-+ if (REGNO(y) == oldregno)
-+ {
-+ rtx z = copy_reg(y, newregno);
-+ loc.push_back (std::make_pair (&XEXP(x, i), y));
-+ XEXP(x, i) = z;
-+ }
-+ }
-+ else
-+ validate_rename (loc, y, oldregno, newregno);
-+ }
-+ else if (fmt[i] == 'E')
-+ for (int j = XVECLEN (x, i) - 1; j >= 0; j--)
-+ validate_rename (loc, XVECEXP(x, i, j), oldregno, newregno);
-+ }
-+}
-+
- /* perform reg renaming. */
- static void
--do_reg_rename (rtx x, unsigned oldregno, unsigned newregno)
-+do_reg_rename (rtx * loc, unsigned oldregno, unsigned newregno)
- {
-+ rtx x = *loc;
- if (REG_P(x))
- {
- if (REGNO(x) == oldregno)
-- df_ref_change_reg_with_loc (x, newregno);
-+ *loc = copy_reg(x, newregno);
- return;
- }
-
-@@ -282,10 +356,10 @@ do_reg_rename (rtx x, unsigned oldregno, unsigned newregno)
- for (int i = GET_RTX_LENGTH (code) - 1; i >= 0; i--)
- {
- if (fmt[i] == 'e')
-- do_reg_rename (XEXP(x, i), oldregno, newregno);
-+ do_reg_rename (&XEXP(x, i), oldregno, newregno);
- else if (fmt[i] == 'E')
- for (int j = XVECLEN (x, i) - 1; j >= 0; j--)
-- do_reg_rename (XVECEXP(x, i, j), oldregno, newregno);
-+ do_reg_rename (&XVECEXP(x, i, j), oldregno, newregno);
- }
- }
-
-@@ -356,7 +430,7 @@ dump_insns (char const * name, bool all)
- insn_info & ii = infos[i];
-
- for (int j = 0; j < 8; ++j)
-- if (ii.is_use (j))
-+ if (ii.is_use (j) || ii.is_def (j))
- {
- if (ii.is_hard (j))
- fprintf (stderr, "!");
-@@ -366,7 +440,7 @@ dump_insns (char const * name, bool all)
- }
-
- for (int j = 8; j < 16; ++j)
-- if (ii.is_use (j))
-+ if (ii.is_use (j) || ii.is_def (j))
- {
- if (ii.is_hard (j))
- fprintf (stderr, "!");
-@@ -436,15 +510,15 @@ static void
- update_insn_infos (void)
- {
- /* prepare insn_info */
-- insn_info ii;
-+ insn_info ii0;
- for (unsigned i = 0; i < insns.size (); ++i)
- {
-- infos.push_back (ii);
-+ infos.push_back (ii0);
- }
-
- /* own analyze reg life */
- std::vector<std::pair<unsigned, insn_info>> todo;
-- todo.push_back (std::make_pair (insns.size () - 1, ii));
-+ todo.push_back (std::make_pair (insns.size () - 1, ii0));
-
- int pass = 0;
- while (!todo.empty ())
-@@ -484,7 +558,6 @@ update_insn_infos (void)
-
- if (CALL_P(insn))
- {
-- insn_info def;
- insn_info use;
-
- /* add mregparm registers. */
-@@ -499,25 +572,16 @@ update_insn_infos (void)
- /* also mark all registers as not renamable */
- use._hard = use._use;
-
-- rtx set = single_set (insn);
-- if (set)
-- {
-- use.scan (SET_SRC(set));
-- def.scan (SET_DEST(set));
-- }
-- else
-- use.scan (pattern);
-+ use.scan (pattern);
-
- /* mark scratch registers. */
-- def.def (0);
-- def.def (1);
-- def.def (8);
-- def.def (9);
--
-- infos[pos] = def | use | ii;
-+ use.def (0);
-+ use.def (1);
-+ use.def (8);
-+ use.def (9);
-
-- ii &= ~def;
-- ii |= use;
-+ infos[pos] = use | ii;
-+ ii.updateWith (use);
-
- continue;
- }
-@@ -525,95 +589,60 @@ update_insn_infos (void)
- if (JUMP_P(insn))
- {
- if (ANY_RETURN_P(pattern))
-- {
-- ii.reset ();
--// ii.use (0);
-- }
-- else
-- {
-- ii |= infos[pos];
-+ ii.reset ();
-
-- // check for reg use
-- ii.scan (PATTERN (insn));
-+ insn_info use;
-+ use.scan (pattern);
-+ infos[pos] = use | ii;
-+ ii.updateWith (use);
-
-- }
-- infos[pos] = ii;
- continue;
- }
-
-- rtx set = single_set (insn);
-- if (set == 0)
-+ if (GET_CODE (pattern) == USE)
- {
-- if (GET_CODE (pattern) == USE)
-- {
-- rtx x = XEXP(pattern, 0);
-- if (REG_P(x))
-- {
-- ii.use (REGNO(x));
-- ii.hard (REGNO(x));
-- }
-- infos[pos] = ii;
-- continue;
-- }
--
-- if (GET_CODE (pattern) == CLOBBER)
-- {
-- /* mark regs as use and def */
-- insn_info ud;
-- ud.scan (pattern);
-- ud._def |= ud._use;
-- ud._hard = ud._use; /* don't rename. */
-- infos[pos] |= ud;
-- continue;
-- }
-- if (GET_CODE (pattern) != PARALLEL && be_verbose)
-+ rtx x = XEXP(pattern, 0);
-+ if (REG_P(x))
- {
-- fprintf (stderr, "##### ");
-- debug_rtx (insn);
-+ ii.use (REGNO(x));
-+ ii.hard (REGNO(x));
- }
-+ infos[pos] = ii;
-+ continue;
-+ }
-
-- insn_info jj;
-- jj.scan (pattern);
--
-- if (proepilogue[pos])
-- jj._hard = jj._use | jj._def;
--
-- infos[pos] = ii | jj;
-+ if (GET_CODE (pattern) == CLOBBER)
-+ {
-+ /* mark regs as use and def */
-+ insn_info use;
-+ use.scan (pattern);
-+ use._hard = use._use = use._def = use._use | use._def;
-+ infos[pos] = use | ii;
-+ ii.updateWith (use);
- continue;
- }
-
-- rtx src = SET_SRC(set);
-- rtx dst = SET_DEST(set);
-- // scan insn for regs
-- // a def stop propagation
-- // a use starts propagation
-- // also add use to current ii
- insn_info use;
-- insn_info def;
--
-- use.scan (src);
-- if (REG_P(dst))
-- def.def (REGNO(dst));
-- else if (dst == cc0_rtx)
-- def.def (FIRST_PSEUDO_REGISTER);
-- else
-- use.scan (dst);
-+ use.scan (pattern);
-+ if (single_set (insn) == 0)
-+ use._hard = use._use | use._def;
-
-- if (dst != cc0_rtx)
-+ /* if not cc0 defined check for mod. */
-+ if (!use.is_def (FIRST_PSEUDO_REGISTER))
- {
- CC_STATUS_INIT;
- NOTICE_UPDATE_CC(PATTERN (insn), insn);
- if (cc_status.value1 || cc_status.value2)
-- def.def (FIRST_PSEUDO_REGISTER);
-+ use.def (FIRST_PSEUDO_REGISTER);
- }
-
-+ /* mark not renameable in prologue/epilogue. */
- if (proepilogue[pos])
-- ii._hard |= use._use | def._def;
--
-- infos[pos] = def | use | ii;
-+ use._hard = use._use | use._def;
-
-- ii &= ~def;
-- ii |= use;
-+ ii._use &= ~use._def;
-+ infos[pos] = use | ii;
-+ ii.updateWith (use);
- }
- ++pass;
- }
-@@ -644,10 +673,15 @@ bb_reg_rename (void)
- for (unsigned index = 0; index < insns.size (); ++index)
- {
- insn_info & ii = infos[index];
-- const unsigned def = ii._def & ~ii._hard;
-- unsigned mask = ii.get_free_mask ();
-
-- if (!mask || !def)
-+ /* do not rename if register is hard or used in same statement. */
-+ const unsigned toRename = ii._def & ~ii._hard & ~ii._use;
-+ if (!toRename)
-+ continue;
-+
-+ /* get the mask for free registers. */
-+ unsigned mask = ii.get_free_mask ();
-+ if (!mask)
- continue;
-
- std::set<unsigned> found;
-@@ -675,16 +709,22 @@ bb_reg_rename (void)
- insn_info & jj = infos[pos];
-
- /* not used. */
-- if (!(jj._use & def))
-+ if (!(jj._use & toRename))
- continue;
-
-+ /* marked as hard reg -> invalid rename */
-+ if (jj._hard & toRename)
-+ {
-+ mask = 0;
-+ break;
-+ }
-+
- /* update free regs. */
- mask &= ~jj._use;
- mask &= ~jj._def;
- if (!mask)
- break;
-
--
- found.insert (pos);
-
- /* follow jump and/or next insn. */
-@@ -696,6 +736,11 @@ bb_reg_rename (void)
- todo.push_back (j->second);
-
- rtx jmppattern = PATTERN (insn);
-+ if (GET_CODE(jmppattern) == PARALLEL)
-+ {
-+ return 0; /* can't handle yet. */
-+// jmppattern = XVECEXP(jmppattern, 0, 0);
-+ }
-
- rtx jmpsrc = XEXP(jmppattern, 1);
- if (GET_CODE(jmpsrc) == IF_THEN_ELSE)
-@@ -708,19 +753,69 @@ bb_reg_rename (void)
-
- if (mask)
- {
-- int oldregno = bit2regno (def);
-+ int oldregno = bit2regno (toRename);
- int newregno = bit2regno (mask);
-- log ("bb_reg_rename %s -> %s (%d insns)\n", reg_names[oldregno], reg_names[newregno], found.size ());
-
-- for (std::set<unsigned>::iterator i = found.begin (); i != found.end (); ++i)
-+ /* check the renamed insns. */
-+ std::vector<std::pair<rtx *, rtx>> locs;
-+ bool ok = true;
-+ std::vector<unsigned> patch;
-+ for (std::set<unsigned>::iterator i = found.begin (); ok && i != found.end (); ++i)
- {
--// if (be_verbose)
--// debug_rtx (insns[*i]);
-- do_reg_rename (PATTERN (insns[*i]), oldregno, newregno);
-+ rtx_insn * insn = insns[*i];
-+ validate_rename (locs, PATTERN (insn), oldregno, newregno);
-+
-+ if (!locs.empty ())
-+ {
-+ int num_clobbers_to_add = 0;
-+ int insn_code_number = recog (PATTERN (insn), insn, &num_clobbers_to_add);
-+ if (insn_code_number < 0 || !check_asm_operands (PATTERN (insn)))
-+ {
-+ fprintf (stderr, "renaming %d -> %d failed: ", oldregno, newregno);
-+ debug_rtx (insn);
-+ for (std::vector<std::pair<rtx *, rtx>>::iterator j = locs.begin (); j != locs.end (); ++j)
-+ {
-+ debug_rtx (*j->first);
-+ debug_rtx (j->second);
-+ }
-+ ok = false;
-+ }
-+
-+ for (std::vector<std::pair<rtx *, rtx>>::iterator j = locs.begin (); j != locs.end (); ++j)
-+ *j->first = j->second;
-+
-+ if (!ok)
-+ {
-+ fprintf (stderr, "restored: ", oldregno, newregno);
-+ debug_rtx (insn);
-+ for (std::vector<std::pair<rtx *, rtx>>::iterator j = locs.begin (); j != locs.end (); ++j)
-+ {
-+ debug_rtx (*j->first);
-+ debug_rtx (j->second);
-+ }
-+ }
-+ locs.clear ();
-+
-+ patch.push_back(*i);
-+ }
- }
-
-- cselib_invalidate_rtx (gen_raw_REG (SImode, oldregno));
-- cselib_invalidate_rtx (gen_raw_REG (SImode, newregno));
-+ if (!ok)
-+ continue;
-+
-+ log ("bb_reg_rename %s -> %s (%d insns)\n", reg_names[oldregno], reg_names[newregno], patch.size ());
-+
-+ for (std::vector<unsigned>::iterator i = patch.begin (); i != patch.end (); ++i)
-+ {
-+ rtx_insn * insn = insns[*i];
-+ rtx pattern = PATTERN (insn);
-+ SET_INSN_DELETED(insn);
-+ do_reg_rename (&pattern, oldregno, newregno);
-+ emit_insn_after(pattern, insn);
-+ }
-+
-+// cselib_invalidate_rtx (gen_raw_REG (SImode, oldregno));
-+// cselib_invalidate_rtx (gen_raw_REG (SImode, newregno));
- return 1;
- }
- }
-@@ -1209,7 +1304,7 @@ commute_add_move (void)
-
- SET_INSN_DELETED(insn);
-
-- insn = emit_insn_before (newinsn, next);
-+ insn = emit_insn_before (PATTERN (newinsn), next);
-
- add_reg_note (next, REG_INC, reg1dst);
-
-@@ -1295,28 +1390,33 @@ const_cmp_to_sub (void)
- continue;
-
- int intval = -INTVAL(srcp);
-- if (intval < -8 || intval > 7)
-+ if (intval < -8 || intval > 7 || intval == 0)
- continue;
-
- enum machine_mode mode = GET_MODE(dstp);
-+ if (GET_MODE_SIZE(mode) > 4)
-+ continue;
-+
-+ // printf("mode size: %d\n", GET_MODE_SIZE(mode));
-+
- rtx reg = dstp == left ? right : left;
-- rtx plus = gen_rtx_PLUS(mode, reg, gen_rtx_CONST_INT (mode, intval));
-+ rtx plus = gen_rtx_PLUS(mode, copy_reg(reg, -1), gen_rtx_CONST_INT (mode, intval));
-
-- rtx_insn * neuprev = make_insn_raw (gen_rtx_SET(reg, plus));
-+ rtx_insn * neuprev = make_insn_raw (gen_rtx_SET(copy_reg(reg, -1), plus));
-
- int num_clobbers_to_add = 0;
- int insn_code_number = recog (PATTERN (neuprev), neuprev, &num_clobbers_to_add);
-- if (insn_code_number >= 0 && !check_asm_operands (PATTERN (neuprev)))
-+ if (insn_code_number < 0 || !check_asm_operands (PATTERN (neuprev)))
- continue;
-
- // also convert current statement to cmp #0, reg
- SET_INSN_DELETED(insn);
-- rtx neu = gen_rtx_SET(cc0_rtx, gen_rtx_COMPARE(mode, reg, gen_rtx_CONST_INT(mode, 0)));
-+ rtx neu = gen_rtx_SET(cc0_rtx, gen_rtx_COMPARE(mode, copy_reg(reg, -1), gen_rtx_CONST_INT(mode, 0)));
- insn = emit_insn_after (neu, prev);
- add_reg_note (insn, REG_DEAD, reg);
-
- SET_INSN_DELETED(prev);
-- prev = emit_insn_before (neuprev, insn);
-+ prev = emit_insn_before (PATTERN (neuprev), insn);
-
- log ("const_cmp_to_sub replaced reg-reg compare with sub\n");
-
-@@ -1537,7 +1637,7 @@ shrink_stack_frame (void)
- return 0;
-
- bool usea5 = false;
-- unsigned paramstart = 4;
-+ int paramstart = 4;
- int a5offset = 0;
-
- /*
-@@ -1696,6 +1796,9 @@ shrink_stack_frame (void)
- insn_info ii;
- for (unsigned i = 0; i < infos.size (); ++i)
- {
-+ if (proepilogue[i])
-+ continue;
-+
- insn_info & jj = infos[i];
- ii |= jj;
- }
-@@ -1914,8 +2017,6 @@ shrink_stack_frame (void)
- return 0;
- }
-
--extern class opt_pass * global_pass_regrename;
--
- namespace
- {
-
-@@ -2012,11 +2113,8 @@ namespace
- if (do_elim_dead_assign && elim_dead_assign ())
- done = 0, update_insns (), update_insn_infos ();
-
-- if (do_bb_reg_rename && ::global_pass_regrename)
-+ if (do_bb_reg_rename)
- {
--// class opt_pass * rr = ::global_pass_regrename->clone ();
--// rr->execute (0);
--
- while (bb_reg_rename ())
- {
- update_insns ();
-diff --git a/gcc/cfgbuild.c b/gcc/cfgbuild.c
-index c1ec46ad8d7f..1f488dc54544 100644
---- gcc/cfgbuild.c
-+++ gcc/cfgbuild.c
-@@ -55,6 +55,7 @@ inside_basic_block_p (const rtx_insn *insn)
- case DEBUG_INSN:
- return true;
-
-+ case DEBUG_IMPLICIT_PTR:
- case JUMP_TABLE_DATA:
- case BARRIER:
- case NOTE:
-diff --git a/gcc/regrename.c b/gcc/regrename.c
-index fad839f8f926..3d1e87af39fc 100755
---- gcc/regrename.c
-+++ gcc/regrename.c
-@@ -1913,8 +1913,6 @@ regrename_optimize (void)
- return 0;
- }
-
--class opt_pass * global_pass_regrename;
--
- namespace {
-
- const pass_data pass_data_regrename =
-@@ -1935,7 +1933,6 @@ class pass_regrename : public rtl_opt_pass
- pass_regrename (gcc::context *ctxt)
- : rtl_opt_pass (pass_data_regrename, ctxt)
- {
-- ::global_pass_regrename = this;
- }
-
- /* opt_pass methods: */
-
-From 7b2b67ccbe0e6ea8a226071a001cdeac5a493a1d Mon Sep 17 00:00:00 2001
-From: bebbo <bebbo(a)bejy.net>
-Date: Sat, 22 Apr 2017 16:31:08 +0200
-Subject: [PATCH 077/303] @R restored original regrename.c, since no longer
- used with TARGET_AMIGA. Only left the fix for df
-
----
- gcc/regrename.c | 34 +++++++++++++++++-----------------
- 1 file changed, 17 insertions(+), 17 deletions(-)
-
-diff --git a/gcc/regrename.c b/gcc/regrename.c
-index 3d1e87af39fc..1ed6557ee713 100755
---- gcc/regrename.c
-+++ gcc/regrename.c
-@@ -356,9 +356,8 @@ find_rename_reg (du_head_p this_head, enum reg_class super_class,
- {
- bool has_preferred_class;
- enum reg_class preferred_class;
-+ int pass;
- int best_new_reg = old_reg;
-- int new_reg;
-- int hit = 0;
-
- /* Further narrow the set of registers we can use for renaming.
- If the chain needs a call-saved register, mark the call-used
-@@ -371,14 +370,14 @@ find_rename_reg (du_head_p this_head, enum reg_class super_class,
-
- /* Compute preferred rename class of super union of all the classes
- in the chain. */
-- preferred_class = (enum reg_class) targetm.preferred_rename_class2 (
-- super_class, old_reg);
-+ preferred_class
-+ = (enum reg_class) targetm.preferred_rename_class (super_class);
-
- /* Pick and check the register from the tied chain iff the tied chain
- is not renamed. */
- if (this_head->tied_chain && !this_head->tied_chain->renamed
-- && check_new_reg_p (old_reg, this_head->tied_chain->regno, this_head,
-- *unavailable))
-+ && check_new_reg_p (old_reg, this_head->tied_chain->regno,
-+ this_head, *unavailable))
- return this_head->tied_chain->regno;
-
- /* If PREFERRED_CLASS is not NO_REGS, we iterate in the first pass
-@@ -388,10 +387,14 @@ find_rename_reg (du_head_p this_head, enum reg_class super_class,
- If PREFERRED_CLASS is NO_REGS, we iterate over all registers in
- ascending order without any preference. */
- has_preferred_class = (preferred_class != NO_REGS);
-+ for (pass = (has_preferred_class ? 0 : 1); pass < 2; pass++)
-+ {
-+ int new_reg;
- for (new_reg = 0; new_reg < FIRST_PSEUDO_REGISTER; new_reg++)
- {
- if (has_preferred_class
-- && !TEST_HARD_REG_BIT(reg_class_contents[preferred_class],
-+ && (pass == 0)
-+ != TEST_HARD_REG_BIT (reg_class_contents[preferred_class],
- new_reg))
- continue;
-
-@@ -405,11 +408,14 @@ find_rename_reg (du_head_p this_head, enum reg_class super_class,
- don't belong to PREFERRED_CLASS to registers that do, even
- though the latters were used not very long ago.
- Also use a register if no best_new_reg was found till now */
-- if (new_reg < old_reg || !hit)
-- {
-- hit = 1;
-+ if (((pass == 0 || !has_preferred_class)
-+ && !TEST_HARD_REG_BIT (reg_class_contents[preferred_class],
-+ best_new_reg))
-+ || tick[best_new_reg] > tick[new_reg])
- best_new_reg = new_reg;
- }
-+ if (pass == 0 && best_new_reg != old_reg)
-+ break;
- }
- return best_new_reg;
- }
-@@ -1932,8 +1938,7 @@ class pass_regrename : public rtl_opt_pass
- public:
- pass_regrename (gcc::context *ctxt)
- : rtl_opt_pass (pass_data_regrename, ctxt)
-- {
-- }
-+ {}
-
- /* opt_pass methods: */
- virtual bool gate (function *)
-@@ -1943,11 +1948,6 @@ class pass_regrename : public rtl_opt_pass
-
- virtual unsigned int execute (function *) { return regrename_optimize (); }
-
-- opt_pass * clone ()
-- {
-- return new pass_regrename(m_ctxt);
-- }
--
- }; // class pass_regrename
-
- } // anon namespace
-
-From 8425bbc011d5d94d7e2270c00b904da4170fc644 Mon Sep 17 00:00:00 2001
-From: bebbo <bebbo(a)bejy.net>
-Date: Sat, 22 Apr 2017 19:54:50 +0200
-Subject: [PATCH 078/303] @B fix hard reg tracking in parallel insns, @I some
- cleanup
-
----
- gcc/bbb-opts.c | 144 ++++++++++++++++++++++++---------------------------------
- 1 file changed, 61 insertions(+), 83 deletions(-)
-
-diff --git a/gcc/bbb-opts.c b/gcc/bbb-opts.c
-index 1f70ffecc2d4..e7de83e59c07 100755
---- gcc/bbb-opts.c
-+++ gcc/bbb-opts.c
-@@ -26,9 +26,30 @@
- * #1 propagate_moves
- * check if a->b->a can be moved out of a loop.
- *
-- * #2 strcpy_opt
-+ * #2 strcpy
- * check if a temp reg can be eliminated.
- *
-+ * #3 const_comp_sub
-+ * convert a compare with int constant into sub statement.
-+ *
-+ * #4 merge_add
-+ * merge adds
-+ *
-+ * #5 elim_dead_assign
-+ * eliminate some dead assignments.
-+ *
-+ * #6 shrink stack frame
-+ * remove push/pop for unused variables
-+ *
-+ * #7 rename register
-+ * rename registers without breaking register parameters, inline asm etc.
-+ *
-+ * Lessons learned:
-+ *
-+ * - do not trust existing code, better delete insns and inster a new one.
-+ * - do not modify insns, create new insns from pattern
-+ * - do not reuse registers, create new reg rtx instances
-+ *
- */
-
- #include "config.h"
-@@ -55,10 +76,12 @@
- static bool be_verbose;
-
- extern struct lang_hooks lang_hooks;
-+
-+/* Lookup of the current function name. */
- extern tree current_function_decl;
- static tree last_function_decl;
- static char const *
--getCurrentFunctionName ()
-+get_current_function_name ()
- {
- static char fxname[512];
- if (current_function_decl == NULL)
-@@ -68,6 +91,7 @@ getCurrentFunctionName ()
- return fxname;
- }
-
-+/* a simple log to stdout. */
- static int
- log (char const * fmt, ...)
- {
-@@ -79,7 +103,7 @@ log (char const * fmt, ...)
- if (last_function_decl != current_function_decl)
- {
- last_function_decl = current_function_decl;
-- printf (":bbb: in '%s'\n", getCurrentFunctionName ());
-+ printf (":bbb: in '%s'\n", get_current_function_name ());
- }
- printf (":bbb: ");
- int retval = vprintf (fmt, args);
-@@ -88,7 +112,7 @@ log (char const * fmt, ...)
- return retval;
- }
-
--/* Enough for m68k.
-+/* Information for each insn to detect alive registers. Enough for m68k.
- * Why a class? Maybe extend it for general usage.
- *
- * Track use & def separate to determine starting points.
-@@ -220,6 +244,7 @@ struct insn_info
- void
- scan (rtx);
-
-+ /* return bits for alternate free registers. */
- unsigned
- get_free_mask () const
- {
-@@ -267,7 +292,7 @@ insn_info::scan (rtx x)
- scan (SET_DEST(x));
- if (REG_P(SET_DEST(x)))
- {
-- _def = _use;
-+ _def |= _use;
- _use = u;
- }
- scan (SET_SRC(x));
-@@ -288,12 +313,13 @@ insn_info::scan (rtx x)
- }
- }
-
-+/* create a copy for a reg. Optional specify a new register number. */
- static rtx
--copy_reg(rtx reg, int newregno)
-+copy_reg (rtx reg, int newregno)
- {
- if (newregno < 0)
- newregno = REGNO(reg);
-- rtx x = gen_raw_REG(GET_MODE(reg), newregno);
-+ rtx x = gen_raw_REG (GET_MODE(reg), newregno);
- x->jump = reg->jump;
- x->call = reg->call;
- x->unchanging = reg->unchanging;
-@@ -307,8 +333,9 @@ copy_reg(rtx reg, int newregno)
- return x;
- }
-
-+/* Rename the register plus track all locs to undo these changes. */
- static void
--validate_rename (std::vector<std::pair<rtx *, rtx>> & loc, rtx x, unsigned oldregno, unsigned newregno)
-+temp_reg_rename (std::vector<std::pair<rtx *, rtx>> & loc, rtx x, unsigned oldregno, unsigned newregno)
- {
- RTX_CODE code = GET_CODE(x);
-
-@@ -322,44 +349,17 @@ validate_rename (std::vector<std::pair<rtx *, rtx>> & loc, rtx x, unsigned oldre
- {
- if (REGNO(y) == oldregno)
- {
-- rtx z = copy_reg(y, newregno);
-+ rtx z = copy_reg (y, newregno);
- loc.push_back (std::make_pair (&XEXP(x, i), y));
- XEXP(x, i) = z;
- }
- }
- else
-- validate_rename (loc, y, oldregno, newregno);
-+ temp_reg_rename (loc, y, oldregno, newregno);
- }
- else if (fmt[i] == 'E')
- for (int j = XVECLEN (x, i) - 1; j >= 0; j--)
-- validate_rename (loc, XVECEXP(x, i, j), oldregno, newregno);
-- }
--}
--
--/* perform reg renaming. */
--static void
--do_reg_rename (rtx * loc, unsigned oldregno, unsigned newregno)
--{
-- rtx x = *loc;
-- if (REG_P(x))
-- {
-- if (REGNO(x) == oldregno)
-- *loc = copy_reg(x, newregno);
-- return;
-- }
--
-- if (x == cc0_rtx)
-- return;
--
-- RTX_CODE code = GET_CODE(x);
-- const char *fmt = GET_RTX_FORMAT(code);
-- for (int i = GET_RTX_LENGTH (code) - 1; i >= 0; i--)
-- {
-- if (fmt[i] == 'e')
-- do_reg_rename (&XEXP(x, i), oldregno, newregno);
-- else if (fmt[i] == 'E')
-- for (int j = XVECLEN (x, i) - 1; j >= 0; j--)
-- do_reg_rename (&XVECEXP(x, i, j), oldregno, newregno);
-+ temp_reg_rename (loc, XVECEXP(x, i, j), oldregno, newregno);
- }
- }
-
-@@ -758,64 +758,42 @@ bb_reg_rename (void)
-
- /* check the renamed insns. */
- std::vector<std::pair<rtx *, rtx>> locs;
-+ std::vector<std::pair<rtx *, rtx>> patch;
- bool ok = true;
-- std::vector<unsigned> patch;
-+
- for (std::set<unsigned>::iterator i = found.begin (); ok && i != found.end (); ++i)
- {
- rtx_insn * insn = insns[*i];
-- validate_rename (locs, PATTERN (insn), oldregno, newregno);
-
-+ /* temp rename. */
-+ temp_reg_rename (locs, PATTERN (insn), oldregno, newregno);
- if (!locs.empty ())
- {
- int num_clobbers_to_add = 0;
- int insn_code_number = recog (PATTERN (insn), insn, &num_clobbers_to_add);
- if (insn_code_number < 0 || !check_asm_operands (PATTERN (insn)))
-- {
-- fprintf (stderr, "renaming %d -> %d failed: ", oldregno, newregno);
-- debug_rtx (insn);
-- for (std::vector<std::pair<rtx *, rtx>>::iterator j = locs.begin (); j != locs.end (); ++j)
-- {
-- debug_rtx (*j->first);
-- debug_rtx (j->second);
-- }
-- ok = false;
-- }
-+ ok = false;
-
-+ /* undo temp change but keep loc and new register. */
- for (std::vector<std::pair<rtx *, rtx>>::iterator j = locs.begin (); j != locs.end (); ++j)
-- *j->first = j->second;
--
-- if (!ok)
- {
-- fprintf (stderr, "restored: ", oldregno, newregno);
-- debug_rtx (insn);
-- for (std::vector<std::pair<rtx *, rtx>>::iterator j = locs.begin (); j != locs.end (); ++j)
-- {
-- debug_rtx (*j->first);
-- debug_rtx (j->second);
-- }
-+ patch.push_back (std::make_pair (j->first, *j->first));
-+ *j->first = j->second;
- }
-- locs.clear ();
-
-- patch.push_back(*i);
-+ locs.clear ();
- }
- }
-
- if (!ok)
- continue;
-
-- log ("bb_reg_rename %s -> %s (%d insns)\n", reg_names[oldregno], reg_names[newregno], patch.size ());
-+ log ("bb_reg_rename %s -> %s (%d locs)\n", reg_names[oldregno], reg_names[newregno], patch.size ());
-
-- for (std::vector<unsigned>::iterator i = patch.begin (); i != patch.end (); ++i)
-- {
-- rtx_insn * insn = insns[*i];
-- rtx pattern = PATTERN (insn);
-- SET_INSN_DELETED(insn);
-- do_reg_rename (&pattern, oldregno, newregno);
-- emit_insn_after(pattern, insn);
-- }
-+ /* apply all changes. */
-+ for (std::vector<std::pair<rtx *, rtx>>::iterator j = patch.begin (); j != patch.end (); ++j)
-+ *j->first = j->second;
-
--// cselib_invalidate_rtx (gen_raw_REG (SImode, oldregno));
--// cselib_invalidate_rtx (gen_raw_REG (SImode, newregno));
- return 1;
- }
- }
-@@ -879,7 +857,7 @@ bb_reg_rename (void)
- * The label must only be reachable by the exit jump.
- */
- static unsigned
--propagate_moves ()
-+opt_propagate_moves ()
- {
- unsigned change_count = 0;
- rtx_insn * current_label = 0;
-@@ -1341,7 +1319,7 @@ commute_add_move (void)
- *
- */
- static unsigned
--const_cmp_to_sub (void)
-+opt_const_cmp_to_sub (void)
- {
- unsigned change_count = 0;
- #if HAVE_cc0
-@@ -1400,9 +1378,9 @@ const_cmp_to_sub (void)
- // printf("mode size: %d\n", GET_MODE_SIZE(mode));
-
- rtx reg = dstp == left ? right : left;
-- rtx plus = gen_rtx_PLUS(mode, copy_reg(reg, -1), gen_rtx_CONST_INT (mode, intval));
-+ rtx plus = gen_rtx_PLUS(mode, copy_reg (reg, -1), gen_rtx_CONST_INT (mode, intval));
-
-- rtx_insn * neuprev = make_insn_raw (gen_rtx_SET(copy_reg(reg, -1), plus));
-+ rtx_insn * neuprev = make_insn_raw (gen_rtx_SET(copy_reg (reg, -1), plus));
-
- int num_clobbers_to_add = 0;
- int insn_code_number = recog (PATTERN (neuprev), neuprev, &num_clobbers_to_add);
-@@ -1532,7 +1510,7 @@ elim_dead_assign (void)
- add.l d1,a1
- */
- static unsigned
--merge_add (void)
-+opt_merge_add (void)
- {
- unsigned change_count = 0;
- for (unsigned index = 0; index + 2 < insns.size (); ++index)
-@@ -1623,7 +1601,7 @@ clear_temp ()
- * newstartvalue = startvalue - omitted pushes
- */
- static unsigned
--shrink_stack_frame (void)
-+opt_shrink_stack_frame (void)
- {
- /* nothing to do. */
- if (!insns.size ())
-@@ -2100,14 +2078,14 @@ namespace
- if (do_commute_add_move && commute_add_move ())
- done = 0, update_insns ();
-
-- if (do_propagate_moves && propagate_moves ())
-+ if (do_propagate_moves && opt_propagate_moves ())
- done = 0, update_insns ();
-
- update_insn_infos ();
-- if (do_const_cmp_to_sub && const_cmp_to_sub ())
-+ if (do_const_cmp_to_sub && opt_const_cmp_to_sub ())
- done = 0, update_insns (), update_insn_infos ();
-
-- if (do_merge_add && merge_add ())
-+ if (do_merge_add && opt_merge_add ())
- done = 0, update_insns (), update_insn_infos ();
-
- if (do_elim_dead_assign && elim_dead_assign ())
-@@ -2129,7 +2107,7 @@ namespace
-
- if (do_shrink_stack_frame)
- {
-- shrink_stack_frame ();
-+ opt_shrink_stack_frame ();
- update_insns ();
- update_insn_infos ();
- }
-
-From cfd147a3142a4e1b6495f4f1c57d2b236c991c95 Mon Sep 17 00:00:00 2001
-From: bebbo <bebbo(a)bejy.net>
-Date: Sun, 23 Apr 2017 00:05:15 +0200
-Subject: [PATCH 079/303] @N shrink-stack-frame is now also dropping unused
- frame pointers. @I more cleanup
-
----
- gcc/bbb-opts.c | 115 +++++++++++++++++++++++++++++++++++----------------------
- 1 file changed, 70 insertions(+), 45 deletions(-)
-
-diff --git a/gcc/bbb-opts.c b/gcc/bbb-opts.c
-index e7de83e59c07..d684e280a17e 100755
---- gcc/bbb-opts.c
-+++ gcc/bbb-opts.c
-@@ -367,7 +367,7 @@ temp_reg_rename (std::vector<std::pair<rtx *, rtx>> & loc, rtx x, unsigned oldre
- * Collect some data.
- */
- static std::vector<rtx_insn *> insns;
--static std::vector<bool> proepilogue;
-+static std::vector<char> proepilogue;
- static std::vector<rtx_insn *> temp;
- static std::vector<rtx_insn *> jumps;
- static std::map<rtx_insn *, unsigned> insn2index;
-@@ -477,7 +477,7 @@ update_insns ()
-
- df_insn_rescan_all ();
-
-- bool inproepilogue = true;
-+ char inproepilogue = 1;
- /* create a vector with relevant insn. */
- for (insn = get_insns (); insn; insn = next)
- {
-@@ -493,32 +493,34 @@ update_insns ()
- proepilogue.push_back (inproepilogue);
-
- if (JUMP_P(insn))
-- inproepilogue = false;
-+ inproepilogue = 0;
- }
-
- if (NOTE_P(insn))
- {
- if (NOTE_KIND(insn) == NOTE_INSN_PROLOGUE_END)
-- inproepilogue = false;
-+ inproepilogue = 0;
- else if (NOTE_KIND(insn) == NOTE_INSN_EPILOGUE_BEG)
-- inproepilogue = true;
-+ inproepilogue = 2;
- }
- }
- }
-
-+/* This is the important function to track register usage plus hard/live state.
-+ *
-+ * Start at bottom and work upwards. On all labels trigger all jumps referring to this label.
-+ * A set destination into a register is a def. All other register references are an use.
-+ * Hard registers cann't be renamed and are mandatory for regparms and asm_operands.
-+ */
- static void
- update_insn_infos (void)
- {
- /* prepare insn_info */
-- insn_info ii0;
-- for (unsigned i = 0; i < insns.size (); ++i)
-- {
-- infos.push_back (ii0);
-- }
-+ infos.resize (insns.size ());
-
- /* own analyze reg life */
- std::vector<std::pair<unsigned, insn_info>> todo;
-- todo.push_back (std::make_pair (insns.size () - 1, ii0));
-+ todo.push_back (std::make_pair (insns.size () - 1, insn_info ()));
-
- int pass = 0;
- while (!todo.empty ())
-@@ -531,9 +533,11 @@ update_insn_infos (void)
- for (int pos = p.first; pos >= 0; --pos)
- {
- rtx_insn * insn = insns[pos];
-- if (!insn) // moved to temp for stack frame cleanup
-+ /* can be NULL as used in opt_shrink_stack_frame(). */
-+ if (!insn)
- continue;
-
-+ /* no new information -> break. */
- if (pass && infos[pos].contains (ii))
- break;
-
-@@ -648,6 +652,7 @@ update_insn_infos (void)
- }
- }
-
-+/* convert the lowest set bit into a register number. */
- static int
- bit2regno (unsigned bit)
- {
-@@ -667,7 +672,7 @@ bit2regno (unsigned bit)
- * Always prefer lower register numbers within the class.
- */
- static unsigned
--bb_reg_rename (void)
-+opt_reg_rename (void)
- {
- // dump_insns ("rename", 1);
- for (unsigned index = 0; index < insns.size (); ++index)
-@@ -738,8 +743,7 @@ bb_reg_rename (void)
- rtx jmppattern = PATTERN (insn);
- if (GET_CODE(jmppattern) == PARALLEL)
- {
-- return 0; /* can't handle yet. */
--// jmppattern = XVECEXP(jmppattern, 0, 0);
-+ return 0; /* can't handle yet. Abort renaming. */
- }
-
- rtx jmpsrc = XEXP(jmppattern, 1);
-@@ -788,7 +792,7 @@ bb_reg_rename (void)
- if (!ok)
- continue;
-
-- log ("bb_reg_rename %s -> %s (%d locs)\n", reg_names[oldregno], reg_names[newregno], patch.size ());
-+ log ("opt_reg_rename %s -> %s (%d locs)\n", reg_names[oldregno], reg_names[newregno], patch.size ());
-
- /* apply all changes. */
- for (std::vector<std::pair<rtx *, rtx>>::iterator j = patch.begin (); j != patch.end (); ++j)
-@@ -1470,6 +1474,10 @@ opt_const_cmp_to_sub (void)
- return change_count;
- }
-
-+/*
-+ * Some optimizations (e.g. propagate_moves) might result into an unuses assignment behind the loop.
-+ * delete those insns.
-+ */
- static unsigned
- elim_dead_assign (void)
- {
-@@ -1570,6 +1578,9 @@ opt_merge_add (void)
- return change_count;
- }
-
-+/*
-+ * Move the insns back from temp to insns.
-+ */
- static void
- clear_temp ()
- {
-@@ -1607,6 +1618,7 @@ opt_shrink_stack_frame (void)
- if (!insns.size ())
- return 0;
-
-+ std::vector<int> a5pos;
- temp.resize (insns.size ());
-
- unsigned pos = 0;
-@@ -1622,16 +1634,11 @@ opt_shrink_stack_frame (void)
- * Move prologue to temp.
- * Only register push and parallel insn unless its a link a5 are moved.
- */
-- rtx_insn * prev = get_insns ();
- for (; pos < insns.size ();)
- {
- insn = insns[pos];
-
-- /* check for prologue end. */
-- for (; prev != insn; prev = NEXT_INSN (prev))
-- if (NOTE_P(prev) && NOTE_KIND(prev) == NOTE_INSN_PROLOGUE_END)
-- break;
-- if (prev != insn)
-+ if (proepilogue[pos] != 1)
- break;
-
- rtx pattern = PATTERN (insn);
-@@ -1642,6 +1649,7 @@ opt_shrink_stack_frame (void)
- /* ignore link a5 */
- if (REG_P(dst) && REGNO(dst) == FRAME_POINTER_REGNUM)
- {
-+ a5pos.push_back (pos);
- usea5 = true;
- set = XVECEXP(pattern, 0, 2);
- a5offset = INTVAL(XEXP(SET_SRC(set), 1));
-@@ -1657,6 +1665,9 @@ opt_shrink_stack_frame (void)
- }
- if (GET_CODE(pattern) != SET)
- {
-+ /* (set (mem:BLK (scratch) [0 A8]) (unspec:BLK [ ...)) */
-+ if (MEM_P(SET_DEST(pattern)) && GET_CODE(SET_SRC(pattern)) == UNSPEC)
-+ a5pos.push_back (pos);
- ++pos;
- continue;
- }
-@@ -1701,21 +1712,13 @@ opt_shrink_stack_frame (void)
-
- unsigned prologueend = pos;
-
-- prev = insn;
--
- /* search epilogues - there can be multiple epilogues. */
- while (pos < insns.size ())
- {
- while (pos < insns.size ())
- {
-- insn = insns[pos];
-- for (; prev != insn; prev = NEXT_INSN (prev))
-- if (NOTE_P(prev) && NOTE_KIND(prev) == NOTE_INSN_EPILOGUE_BEG)
-- break;
--
-- if (prev != insn)
-+ if (proepilogue[pos])
- break;
--
- ++pos;
- }
-
-@@ -1723,13 +1726,10 @@ opt_shrink_stack_frame (void)
- for (; pos < insns.size (); ++pos)
- {
- insn = insns[pos];
-- if (JUMP_P(insn)) /* return */
-- break;
--
-- if (LABEL_P(insn))
-+ if (JUMP_P(insn) || LABEL_P(insn) || !proepilogue[pos])
- break;
-
-- /* omitt the frame pointer a5. */
-+ /* omit the frame pointer a5. */
- rtx pattern = PATTERN (insn);
- if (GET_CODE(pattern) == PARALLEL)
- {
-@@ -1737,7 +1737,10 @@ opt_shrink_stack_frame (void)
- rtx dst = SET_DEST(set);
- /* unlink is last. */
- if (REG_P(dst) && REGNO(dst) == FRAME_POINTER_REGNUM)
-- break;
-+ {
-+ a5pos.push_back (pos);
-+ break;
-+ }
-
- /* movem. */
- temp[pos] = insn;
-@@ -1766,7 +1769,6 @@ opt_shrink_stack_frame (void)
- }
- }
- }
-- prev = insn;
- ++pos;
- }
- /* gather usage stats without prologue/epilogue */
-@@ -1989,6 +1991,33 @@ opt_shrink_stack_frame (void)
- }
- }
-
-+ if (usea5 && a5offset == -4)
-+ {
-+ for (std::vector<int>::iterator i = a5pos.begin (); i != a5pos.end (); ++i)
-+ {
-+ temp[*i] = insns[*i];
-+ insns[*i] = 0;
-+ }
-+ update_insn_infos ();
-+ insn_info ii;
-+ for (unsigned i = 0; i < infos.size (); ++i)
-+ {
-+ if (proepilogue[i])
-+ continue;
-+
-+ insn_info & jj = infos[i];
-+ ii |= jj;
-+ }
-+ unsigned freemask = ~ii._use;
-+
-+ if (freemask & (1 << FRAME_POINTER_REGNUM))
-+ {
-+ log ("dropping unused frame pointer\n");
-+ for (std::vector<int>::iterator i = a5pos.begin (); i != a5pos.end (); ++i)
-+ SET_INSN_DELETED(temp[*i]);
-+ }
-+ }
-+
- /* restore stack insns */
- clear_temp ();
-
-@@ -2000,14 +2029,14 @@ namespace
-
- const pass_data pass_data_bbb_optimizations =
- { RTL_PASS, /* type */
-- "bbb", /* name */
-+ "bebbo's-optimizers", /* name */
- OPTGROUP_NONE, /* optinfo_flags */
- TV_NONE, /* tv_id */
- 0, /* properties_required */
- 0, /* properties_provided */
- 0, /* properties_destroyed */
- 0, /* todo_flags_start */
-- ( TODO_df_finish | TODO_df_verify), /* todo_flags_finish */
-+ 0, /* todo_flags_finish */
- };
-
- class pass_bbb_optimizations : public rtl_opt_pass
-@@ -2053,10 +2082,6 @@ namespace
- unsigned
- pass_bbb_optimizations::execute_bbb_optimizations (void)
- {
-- df_set_flags (DF_LR_RUN_DCE + DF_DEFER_INSN_RESCAN);
-- df_note_add_problem ();
-- df_analyze ();
--
- be_verbose = strchr (string_bbb_opts, 'v');
-
- bool do_opt_strcpy = strchr (string_bbb_opts, 's') || strchr (string_bbb_opts, '+');
-@@ -2093,7 +2118,7 @@ namespace
-
- if (do_bb_reg_rename)
- {
-- while (bb_reg_rename ())
-+ while (opt_reg_rename ())
- {
- update_insns ();
- update_insn_infos ();
-
-From 0461e994f5f13ef6becd36265f33fa8812f25cb3 Mon Sep 17 00:00:00 2001
-From: bebbo <bebbo(a)bejy.net>
-Date: Sun, 23 Apr 2017 00:12:10 +0200
-Subject: [PATCH 080/303] @V bump version
-
----
- gcc/BASE-VER | 2 +-
- gcc/DATESTAMP | 2 +-
- 2 files changed, 2 insertions(+), 2 deletions(-)
-
-diff --git a/gcc/BASE-VER b/gcc/BASE-VER
-index 6352d5267189..91eb9361dcd3 100644
---- gcc/BASE-VER
-+++ gcc/BASE-VER
-@@ -1 +1 @@
--6.3.1b
-+6.3.1c
-diff --git a/gcc/DATESTAMP b/gcc/DATESTAMP
-index e30948e24831..e9793b647365 100644
---- gcc/DATESTAMP
-+++ gcc/DATESTAMP
-@@ -1 +1 @@
--20170320
-+20170423
-
-From 7cf932893a3328d06b1c1eb4c51b9eaf39db8bc1 Mon Sep 17 00:00:00 2001
-From: bebbo <bebbo(a)bejy.net>
-Date: Sun, 23 Apr 2017 10:57:09 +0200
-Subject: [PATCH 081/303] @B some fixes in opt_reg_rename
-
----
- gcc/bbb-opts.c | 23 +++++++++++++----------
- 1 file changed, 13 insertions(+), 10 deletions(-)
-
-diff --git a/gcc/bbb-opts.c b/gcc/bbb-opts.c
-index d684e280a17e..a8122e80998e 100755
---- gcc/bbb-opts.c
-+++ gcc/bbb-opts.c
-@@ -238,6 +238,8 @@ struct insn_info
- return false;
- if (o._use & ~_use)
- return false;
-+ if (o._hard & ~_hard)
-+ return false;
- return true;
- }
-
-@@ -298,7 +300,7 @@ insn_info::scan (rtx x)
- scan (SET_SRC(x));
- int code = GET_CODE(SET_SRC(x));
- if (code == ASM_OPERANDS)
-- _hard |= _def | _use;
-+ _use = _hard |= _def | _use;
- return;
- }
-
-@@ -713,16 +715,13 @@ opt_reg_rename (void)
-
- insn_info & jj = infos[pos];
-
-- /* not used. */
-- if (!(jj._use & toRename))
-- continue;
--
- /* marked as hard reg -> invalid rename */
- if (jj._hard & toRename)
-- {
-- mask = 0;
-- break;
-- }
-+ mask = 0;
-+
-+ /* defined again -> invalid rename */
-+ if (jj._def & toRename)
-+ mask = 0;
-
- /* update free regs. */
- mask &= ~jj._use;
-@@ -730,6 +729,10 @@ opt_reg_rename (void)
- if (!mask)
- break;
-
-+ /* not used. */
-+ if (!(jj._use & toRename))
-+ continue;
-+
- found.insert (pos);
-
- /* follow jump and/or next insn. */
-@@ -1902,7 +1905,7 @@ opt_shrink_stack_frame (void)
- else
- {
- /* pop */
-- if (usea5)
-+ if (usea5 && a5offset != -4)
- {
- x += REGNO(regs[k]) > STACK_POINTER_REGNUM ? 12 : 4;
- plus = gen_rtx_PLUS(SImode, a5, gen_rtx_CONST_INT (SImode, a5offset + x));
-
-From fbc0890125f5455fbd9947d439f0caab8b0a4e12 Mon Sep 17 00:00:00 2001
-From: bebbo <bebbo(a)bejy.net>
-Date: Sun, 23 Apr 2017 10:59:12 +0200
-Subject: [PATCH 082/303] @R change template >> to > > for crappy compilers
-
----
- gcc/bbb-opts.c | 12 ++++++------
- 1 file changed, 6 insertions(+), 6 deletions(-)
-
-diff --git a/gcc/bbb-opts.c b/gcc/bbb-opts.c
-index a8122e80998e..90751c4165d3 100755
---- gcc/bbb-opts.c
-+++ gcc/bbb-opts.c
-@@ -337,7 +337,7 @@ copy_reg (rtx reg, int newregno)
-
- /* Rename the register plus track all locs to undo these changes. */
- static void
--temp_reg_rename (std::vector<std::pair<rtx *, rtx>> & loc, rtx x, unsigned oldregno, unsigned newregno)
-+temp_reg_rename (std::vector<std::pair<rtx *, rtx> > & loc, rtx x, unsigned oldregno, unsigned newregno)
- {
- RTX_CODE code = GET_CODE(x);
-
-@@ -521,7 +521,7 @@ update_insn_infos (void)
- infos.resize (insns.size ());
-
- /* own analyze reg life */
-- std::vector<std::pair<unsigned, insn_info>> todo;
-+ std::vector<std::pair<unsigned, insn_info> > todo;
- todo.push_back (std::make_pair (insns.size () - 1, insn_info ()));
-
- int pass = 0;
-@@ -764,8 +764,8 @@ opt_reg_rename (void)
- int newregno = bit2regno (mask);
-
- /* check the renamed insns. */
-- std::vector<std::pair<rtx *, rtx>> locs;
-- std::vector<std::pair<rtx *, rtx>> patch;
-+ std::vector<std::pair<rtx *, rtx> > locs;
-+ std::vector<std::pair<rtx *, rtx> > patch;
- bool ok = true;
-
- for (std::set<unsigned>::iterator i = found.begin (); ok && i != found.end (); ++i)
-@@ -782,7 +782,7 @@ opt_reg_rename (void)
- ok = false;
-
- /* undo temp change but keep loc and new register. */
-- for (std::vector<std::pair<rtx *, rtx>>::iterator j = locs.begin (); j != locs.end (); ++j)
-+ for (std::vector<std::pair<rtx *, rtx> >::iterator j = locs.begin (); j != locs.end (); ++j)
- {
- patch.push_back (std::make_pair (j->first, *j->first));
- *j->first = j->second;
-@@ -798,7 +798,7 @@ opt_reg_rename (void)
- log ("opt_reg_rename %s -> %s (%d locs)\n", reg_names[oldregno], reg_names[newregno], patch.size ());
-
- /* apply all changes. */
-- for (std::vector<std::pair<rtx *, rtx>>::iterator j = patch.begin (); j != patch.end (); ++j)
-+ for (std::vector<std::pair<rtx *, rtx> >::iterator j = patch.begin (); j != patch.end (); ++j)
- *j->first = j->second;
-
- return 1;
-
-From d98fb77f2e7d620cb8c901f806e8d938b3e7f07f Mon Sep 17 00:00:00 2001
-From: bebbo <bebbo(a)bejy.net>
-Date: Sun, 23 Apr 2017 13:38:06 +0200
-Subject: [PATCH 083/303] @B init insn_infos before running opt_strcpy
-
----
- gcc/bbb-opts.c | 35 +++++++++++++++++++----------------
- 1 file changed, 19 insertions(+), 16 deletions(-)
-
-diff --git a/gcc/bbb-opts.c b/gcc/bbb-opts.c
-index 90751c4165d3..2858daa6c908 100755
---- gcc/bbb-opts.c
-+++ gcc/bbb-opts.c
-@@ -390,24 +390,23 @@ clear (void)
-
- /*
- * return true if the register is DEAD.
-+ * Do not check at jumps.
- */
- static bool
--is_reg_dead (unsigned regno, unsigned pos)
-+is_reg_dead (unsigned regno, unsigned _pos)
- {
-- for (;;)
-+ // skip labels.
-+ for (unsigned pos = _pos + 1; pos < infos.size (); ++pos)
- {
-- if (pos + 1 >= infos.size ())
-- return true;
-+ insn_info & ii0 = infos[pos];
-+ // skip entries without info
-+ if (!ii0._def && !ii0._use && !ii0._hard)
-+ continue;
-
-- rtx_insn * insn = insns[pos + 1];
-- if (!LABEL_P(insn) && GET_CODE(insn) != USE)
-- break;
-- ++pos;
-+ // not dead if usage is reported in the next statement
-+ return !ii0.is_use (regno) && !ii0.is_hard (regno);
- }
--
-- insn_info & ii0 = infos[pos + 1];
-- // not dead if usage is reported in the next statement
-- return !ii0.is_use (regno);
-+ return true;
- }
-
- /*
-@@ -720,12 +719,9 @@ opt_reg_rename (void)
- mask = 0;
-
- /* defined again -> invalid rename */
-- if (jj._def & toRename)
-+ if ((jj._def & toRename) && !(jj._use & toRename))
- mask = 0;
-
-- /* update free regs. */
-- mask &= ~jj._use;
-- mask &= ~jj._def;
- if (!mask)
- break;
-
-@@ -733,6 +729,12 @@ opt_reg_rename (void)
- if (!(jj._use & toRename))
- continue;
-
-+ /* update free regs. */
-+ mask &= ~jj._use;
-+ mask &= ~jj._def;
-+ if (!mask)
-+ break;
-+
- found.insert (pos);
-
- /* follow jump and/or next insn. */
-@@ -2100,6 +2102,7 @@ namespace
- {
- int done = 1;
- update_insns ();
-+ update_insn_infos ();
- if (do_opt_strcpy && opt_strcpy ())
- done = 0, update_insns ();
-
-
-From 78db2bc90ad5701e59107a782343b1d25937102e Mon Sep 17 00:00:00 2001
-From: bebbo <bebbo(a)bejy.net>
-Date: Sun, 23 Apr 2017 23:08:07 +0200
-Subject: [PATCH 084/303] @B fix regparm with return values > 64bit
-
----
- gcc/config/m68k/amigaos.c | 9 +++++++++
- 1 file changed, 9 insertions(+)
-
-diff --git a/gcc/config/m68k/amigaos.c b/gcc/config/m68k/amigaos.c
-index dd5707612119..d385ab1ff108 100644
---- gcc/config/m68k/amigaos.c
-+++ gcc/config/m68k/amigaos.c
-@@ -435,6 +435,15 @@ amigaos_init_cumulative_args (CUMULATIVE_ARGS *cump, tree fntype, tree decl)
- if (!next_param && TREE_VALUE (param) != void_type_node)
- cum->num_of_regs = 0;
- }
-+
-+ /* check for return values passed in a0 */
-+ if (cum->num_of_regs)
-+ {
-+ tree type = TYPE_SIZE(TREE_TYPE (DECL_RESULT (current_function_decl)));
-+ int sz = type ? TREE_INT_CST_LOW(type) : 0;
-+ if (sz > 64) /* mark a0 as already used. */
-+ cum->regs_already_used |= 1<<8;
-+ }
- }
-
- //#if ! defined (PCC_STATIC_STRUCT_RETURN) && defined (M68K_STRUCT_VALUE_REGNUM)
-
-From 5c0207b6ae6544541c786c74d57ddfcbe48b7a48 Mon Sep 17 00:00:00 2001
-From: bebbo <bebbo(a)bejy.net>
-Date: Sun, 23 Apr 2017 23:08:48 +0200
-Subject: [PATCH 085/303] @B fix __regards definition
-
----
- gcc/config/m68k/m68kamigaos.h | 2 +-
- 1 file changed, 1 insertion(+), 1 deletion(-)
-
-diff --git a/gcc/config/m68k/m68kamigaos.h b/gcc/config/m68k/m68kamigaos.h
-index 68f3277bd87c..20e0b66face2 100644
---- gcc/config/m68k/m68kamigaos.h
-+++ gcc/config/m68k/m68kamigaos.h
-@@ -194,7 +194,7 @@ amiga_declare_object = 0
- builtin_define ("__saveds=__attribute__((__saveds__))"); \
- builtin_define ("__interrupt=__attribute__((__interrupt__))"); \
- builtin_define ("__stackext=__attribute__((__stackext__))"); \
-- builtin_define ("__regargs=__attribute__((__regparm__))"); \
-+ builtin_define ("__regargs=__attribute__((__regparm__(2)))"); \
- builtin_define ("__stdargs=__attribute__((__stkparm__))"); \
- builtin_define ("__aligned=__attribute__((__aligned__(4)))"); \
- builtin_define_std ("amiga"); \
-
-From 827a96ae044a2b7925972b04ec8e24c0999daa71 Mon Sep 17 00:00:00 2001
-From: bebbo <bebbo(a)bejy.net>
-Date: Sun, 23 Apr 2017 23:09:27 +0200
-Subject: [PATCH 086/303] @B fix return val sizes and so...
-
----
- gcc/bbb-opts.c | 55 +++++++++++++++++++++++++++++++++++++------------------
- 1 file changed, 37 insertions(+), 18 deletions(-)
-
-diff --git a/gcc/bbb-opts.c b/gcc/bbb-opts.c
-index 2858daa6c908..d0288f254f9c 100755
---- gcc/bbb-opts.c
-+++ gcc/bbb-opts.c
-@@ -476,7 +476,7 @@ update_insns ()
- rtx_insn *insn, *next;
- clear ();
-
-- df_insn_rescan_all ();
-+ // df_insn_rescan_all ();
-
- char inproepilogue = 1;
- /* create a vector with relevant insn. */
-@@ -593,10 +593,25 @@ update_insn_infos (void)
-
- if (JUMP_P(insn))
- {
-+ insn_info use;
- if (ANY_RETURN_P(pattern))
-- ii.reset ();
-+ {
-+ tree type = TYPE_SIZE(TREE_TYPE (DECL_RESULT (current_function_decl)));
-+ int sz = type ? TREE_INT_CST_LOW(type) : 0;
-+ // log ("return size %d\n", sz);
-+ if (sz <= 64)
-+ {
-+ use.hard (0);
-+ use.use (0);
-+ if (sz > 32)
-+ {
-+ use.hard (1);
-+ use.use (1);
-+ }
-+ }
-+ ii.reset ();
-+ }
-
-- insn_info use;
- use.scan (pattern);
- infos[pos] = use | ii;
- ii.updateWith (use);
-@@ -752,7 +767,7 @@ opt_reg_rename (void)
- }
-
- rtx jmpsrc = XEXP(jmppattern, 1);
-- if (GET_CODE(jmpsrc) == IF_THEN_ELSE)
-+ if (jmpsrc && GET_CODE(jmpsrc) == IF_THEN_ELSE)
- if (pos + 1 < insns.size ())
- todo.push_back (pos + 1);
- }
-@@ -1065,8 +1080,8 @@ opt_propagate_moves ()
- j = reg_reg.end ();
- inc = false;
-
-- df_insn_rescan (newii);
-- df_insn_rescan (newjj);
-+ // df_insn_rescan (newii);
-+ // df_insn_rescan (newjj);
-
- /* add fixes if there were jumps out of the loop. */
- if (jump_out.size ())
-@@ -1078,7 +1093,7 @@ opt_propagate_moves ()
- rtx neu = gen_rtx_SET(
- dstj, gen_rtx_PLUS(Pmode, dsti, gen_rtx_CONST_INT(Pmode, fixups[k])));
- rtx_insn * neui = emit_insn_after (neu, jump_out[k]);
-- df_insn_rescan (neui);
-+ // df_insn_rescan (neui);
- }
- }
- ++change_count;
-@@ -1178,7 +1193,7 @@ opt_strcpy ()
- SET_INSN_DELETED(x2reg);
- SET_INSN_DELETED(insn);
-
-- df_insn_rescan (reg2x);
-+ // df_insn_rescan (reg2x);
-
- ++change_count;
- }
-@@ -1238,7 +1253,7 @@ opt_strcpy ()
- (nil)))
- */
- static unsigned
--commute_add_move (void)
-+opt_commute_add_move (void)
- {
- unsigned change_count = 0;
-
-@@ -1295,8 +1310,8 @@ commute_add_move (void)
-
- add_reg_note (next, REG_INC, reg1dst);
-
-- df_insn_rescan (insn);
-- df_insn_rescan (next);
-+ // df_insn_rescan (insn);
-+ // df_insn_rescan (next);
-
- ++change_count;
- }
-@@ -1484,7 +1499,7 @@ opt_const_cmp_to_sub (void)
- * delete those insns.
- */
- static unsigned
--elim_dead_assign (void)
-+opt_elim_dead_assign (void)
- {
- unsigned change_count = 0;
- for (unsigned index = 0; index + 1 < insns.size (); ++index)
-@@ -1835,7 +1850,7 @@ opt_shrink_stack_frame (void)
- adjust += 4;
- }
- else
-- regs.push_back (reg);
-+ regs.push_back (copy_reg (reg, -1));
- }
-
- /* don't touch - clobbers! */
-@@ -1907,7 +1922,7 @@ opt_shrink_stack_frame (void)
- else
- {
- /* pop */
-- if (usea5 && a5offset != -4)
-+ if (usea5)
- {
- x += REGNO(regs[k]) > STACK_POINTER_REGNUM ? 12 : 4;
- plus = gen_rtx_PLUS(SImode, a5, gen_rtx_CONST_INT (SImode, a5offset + x));
-@@ -2041,8 +2056,8 @@ namespace
- 0, /* properties_provided */
- 0, /* properties_destroyed */
- 0, /* todo_flags_start */
-- 0, /* todo_flags_finish */
-- };
-+ 0, //( TODO_df_finish | TODO_df_verify), /* todo_flags_finish */
-+ };
-
- class pass_bbb_optimizations : public rtl_opt_pass
- {
-@@ -2087,6 +2102,10 @@ namespace
- unsigned
- pass_bbb_optimizations::execute_bbb_optimizations (void)
- {
-+ // df_set_flags (df_LR_RUN_DCE + df_DEFER_INSN_RESCAN);
-+ // df_note_add_problem ();
-+ // df_analyze ();
-+
- be_verbose = strchr (string_bbb_opts, 'v');
-
- bool do_opt_strcpy = strchr (string_bbb_opts, 's') || strchr (string_bbb_opts, '+');
-@@ -2106,7 +2125,7 @@ namespace
- if (do_opt_strcpy && opt_strcpy ())
- done = 0, update_insns ();
-
-- if (do_commute_add_move && commute_add_move ())
-+ if (do_commute_add_move && opt_commute_add_move ())
- done = 0, update_insns ();
-
- if (do_propagate_moves && opt_propagate_moves ())
-@@ -2119,7 +2138,7 @@ namespace
- if (do_merge_add && opt_merge_add ())
- done = 0, update_insns (), update_insn_infos ();
-
-- if (do_elim_dead_assign && elim_dead_assign ())
-+ if (do_elim_dead_assign && opt_elim_dead_assign ())
- done = 0, update_insns (), update_insn_infos ();
-
- if (do_bb_reg_rename)
-
-From e0bc074377aadb67fd623bd92a28c6938a53c557 Mon Sep 17 00:00:00 2001
-From: bebbo <bebbo(a)bejy.net>
-Date: Mon, 24 Apr 2017 01:07:46 +0200
-Subject: [PATCH 087/303] @B fix mregparm for function pointer calls
-
----
- gcc/config/m68k/amigaos.c | 569 +++++++++++++++++++++++-----------------------
- 1 file changed, 280 insertions(+), 289 deletions(-)
-
-diff --git a/gcc/config/m68k/amigaos.c b/gcc/config/m68k/amigaos.c
-index d385ab1ff108..c93188a3e90d 100644
---- gcc/config/m68k/amigaos.c
-+++ gcc/config/m68k/amigaos.c
-@@ -1,25 +1,25 @@
- /* Configuration for GNU C-compiler for m68k Amiga, running AmigaOS.
-- Copyright (C) 1992, 1993, 1994, 1995, 1996, 1997, 1998, 2003
-- Free Software Foundation, Inc.
-- Contributed by Markus M. Wild (wild(a)amiga.physik.unizh.ch).
-- Heavily modified by Kamil Iskra (iskra(a)student.uci.agh.edu.pl).
-+ Copyright (C) 1992, 1993, 1994, 1995, 1996, 1997, 1998, 2003
-+ Free Software Foundation, Inc.
-+ Contributed by Markus M. Wild (wild(a)amiga.physik.unizh.ch).
-+ Heavily modified by Kamil Iskra (iskra(a)student.uci.agh.edu.pl).
-
--This file is part of GCC.
-+ This file is part of GCC.
-
--GCC 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, or (at your option)
--any later version.
-+ GCC 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, or (at your option)
-+ any later version.
-
--GCC 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.
-+ GCC 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 GCC; see the file COPYING. If not, write to
--the Free Software Foundation, 59 Temple Place - Suite 330,
--Boston, MA 02111-1307, USA. */
-+ You should have received a copy of the GNU General Public License
-+ along with GCC; see the file COPYING. If not, write to
-+ the Free Software Foundation, 59 Temple Place - Suite 330,
-+ Boston, MA 02111-1307, USA. */
-
- //work without flag_writable_strings which is not in GCC4
- #define REGPARMS_68K 1
-@@ -38,6 +38,7 @@ Boston, MA 02111-1307, USA. */
- #include "tm_p.h"
- #include "target.h"
- #include "diagnostic-core.h"
-+#include "langhooks.h"
- #include "config/m68k/amigaos.h"
-
- //#define MYDEBUG 1
-@@ -56,28 +57,28 @@ static rtx gen_stack_management_call (rtx, rtx, const char *);
- /* Baserel support. */
-
- /* Does operand (which is a symbolic_operand) live in text space? If
-- so SYMBOL_REF_FLAG, which is set by ENCODE_SECTION_INFO, will be true.
-+ so SYMBOL_REF_FLAG, which is set by ENCODE_SECTION_INFO, will be true.
-
-- This function is used in base relative code generation. */
-+ This function is used in base relative code generation. */
-
- int
- read_only_operand (rtx operand)
--{
-- if (GET_CODE (operand) == CONST)
-+ {
-+ if (GET_CODE (operand) == CONST)
- operand = XEXP (XEXP (operand, 0), 0);
-- if (GET_CODE (operand) == SYMBOL_REF)
-+ if (GET_CODE (operand) == SYMBOL_REF)
- return SYMBOL_REF_FLAG (operand) || CONSTANT_POOL_ADDRESS_P (operand);
-- return 1;
--}
-+ return 1;
-+ }
-
- /* Choose the section to use for DECL. RELOC is true if its value contains
-- any relocatable expression. */
-+ any relocatable expression. */
-
- void
- amigaos_select_section (tree decl ATTRIBUTE_UNUSED, int reloc ATTRIBUTE_UNUSED,
-- unsigned HOST_WIDE_INT align ATTRIBUTE_UNUSED)
--{
-- // if (TREE_CODE (decl) == STRING_CST)
-+ unsigned HOST_WIDE_INT align ATTRIBUTE_UNUSED)
-+ {
-+ // if (TREE_CODE (decl) == STRING_CST)
- // {
- //// flag_writable_strings /data_section not in gcc4,
- ////make life easy and put to same section
-@@ -104,195 +105,189 @@ amigaos_select_section (tree decl ATTRIBUTE_UNUSED, int reloc ATTRIBUTE_UNUSED,
- // readonly_data_section ();
- // else
- //data_section ();
--}
-+ }
-
- /* This function is used while generating a base relative code.
-- It returns 1 if a decl is not relocatable, i. e., if it can be put
-- in the text section.
-- Currently, it's very primitive: it just checks if the object size
-- is less than 4 bytes (i. e., if it can hold a pointer). It also
-- supports arrays and floating point types. */
-+ It returns 1 if a decl is not relocatable, i. e., if it can be put
-+ in the text section.
-+ Currently, it's very primitive: it just checks if the object size
-+ is less than 4 bytes (i. e., if it can hold a pointer). It also
-+ supports arrays and floating point types. */
-
- static int
- amigaos_put_in_text (tree decl)
--{
-- tree type = TREE_TYPE (decl);
-- if (TREE_CODE (type) == ARRAY_TYPE)
-+ {
-+ tree type = TREE_TYPE (decl);
-+ if (TREE_CODE (type) == ARRAY_TYPE)
- type = TREE_TYPE (type);
-- return (TREE_INT_CST_ELT(TYPE_SIZE (type), 1) == 0
-- && TREE_INT_CST_LOW (TYPE_SIZE (type)) < 32)
-- || FLOAT_TYPE_P (type);
--}
-+ return (TREE_INT_CST_ELT(TYPE_SIZE (type), 1) == 0
-+ && TREE_INT_CST_LOW (TYPE_SIZE (type)) < 32)
-+ || FLOAT_TYPE_P (type);
-+ }
-
- /* Record properties of a DECL into the associated SYMBOL_REF. */
-
- void
- amigaos_encode_section_info (tree decl, rtx rtl, int first)
--{
-- default_encode_section_info (decl, rtl, first);
-+ {
-+ default_encode_section_info (decl, rtl, first);
-
--
-- SYMBOL_REF_FLAG (XEXP (rtl, 0)) = 1;
-- if (TREE_CODE (decl) == FUNCTION_DECL) // huh seem do same. not in gcc4 flag_writable_strings
- SYMBOL_REF_FLAG (XEXP (rtl, 0)) = 1;
-- else
-- {
-- if ((MEM_READONLY_P (rtl) && !MEM_VOLATILE_P (rtl)
-- && (flag_pic<3 || (TREE_CODE (decl) == STRING_CST
-- )
-- || amigaos_put_in_text (decl)))
-- || (TREE_CODE (decl) == VAR_DECL
-- && DECL_SECTION_NAME (decl) != NULL))
-- SYMBOL_REF_FLAG (XEXP (rtl, 0)) = 1;
-- }
--}
-+ if (TREE_CODE (decl) == FUNCTION_DECL) // huh seem do same. not in gcc4 flag_writable_strings
-+ SYMBOL_REF_FLAG (XEXP (rtl, 0)) = 1;
-+ else
-+ {
-+ if ((MEM_READONLY_P (rtl) && !MEM_VOLATILE_P (rtl)
-+ && (flag_pic<3 || (TREE_CODE (decl) == STRING_CST
-+ )
-+ || amigaos_put_in_text (decl)))
-+ || (TREE_CODE (decl) == VAR_DECL
-+ && DECL_SECTION_NAME (decl) != NULL))
-+ SYMBOL_REF_FLAG (XEXP (rtl, 0)) = 1;
-+ }
-+ }
-
- /* Common routine used to check if a4 should be preserved/restored. */
-
- int
- amigaos_restore_a4 (void)
--{
-- return (flag_pic >= 3 &&
-- (TARGET_RESTORE_A4 || TARGET_ALWAYS_RESTORE_A4
-- || lookup_attribute ("saveds",
-- TYPE_ATTRIBUTES (TREE_TYPE (current_function_decl)))));
--}
-+ {
-+ return (flag_pic >= 3 &&
-+ (TARGET_RESTORE_A4 || TARGET_ALWAYS_RESTORE_A4
-+ || lookup_attribute ("saveds",
-+ TYPE_ATTRIBUTES (TREE_TYPE (current_function_decl)))));
-+ }
-
- void
- amigaos_alternate_pic_setup (FILE *stream)
--{
-- if (TARGET_RESTORE_A4 || TARGET_ALWAYS_RESTORE_A4)
-+ {
-+ if (TARGET_RESTORE_A4 || TARGET_ALWAYS_RESTORE_A4)
- asm_fprintf (stream, "\tjbsr %U__restore_a4\n");
-- else if (lookup_attribute ("saveds",
-- TYPE_ATTRIBUTES (TREE_TYPE (current_function_decl))))
-+ else if (lookup_attribute ("saveds",
-+ TYPE_ATTRIBUTES (TREE_TYPE (current_function_decl))))
- asm_fprintf (stream, "\tlea %U__a4_init,%Ra4\n");
--}
-+ }
-
- /* Attributes support. */
-
- #define AMIGA_CHIP_SECTION_NAME ".datachip"
-
- /* Handle a "chip" attribute;
-- arguments as in struct attribute_spec.handler. */
-+ arguments as in struct attribute_spec.handler. */
-
- tree
- amigaos_handle_decl_attribute (tree *node, tree name,
-- tree args ATTRIBUTE_UNUSED,
-- int flags ATTRIBUTE_UNUSED,
-- bool *no_add_attrs)
--{
-- if (TREE_CODE (*node) == VAR_DECL)
-- {
-- if (is_attribute_p ("chip", name))
-+ tree args ATTRIBUTE_UNUSED,
-+ int flags ATTRIBUTE_UNUSED,
-+ bool *no_add_attrs)
-+ {
-+ if (TREE_CODE (*node) == VAR_DECL)
-+ {
-+ if (is_attribute_p ("chip", name))
- #ifdef TARGET_ASM_NAMED_SECTION
-- {
-- if (! TREE_STATIC (*node) && ! DECL_EXTERNAL (*node))
-+ {
-+ if (! TREE_STATIC (*node) && ! DECL_EXTERNAL (*node))
- error ("`chip' attribute cannot be specified for local variables");
-- else
-- {
-- /* The decl may have already been given a section attribute from
-- a previous declaration. Ensure they match. */
-- if (DECL_SECTION_NAME (*node) == NULL_TREE)
-- DECL_SECTION_NAME (*node) =
-- build_string (strlen (AMIGA_CHIP_SECTION_NAME) + 1,
-- AMIGA_CHIP_SECTION_NAME);
-- else if (strcmp (TREE_STRING_POINTER (DECL_SECTION_NAME (*node)),
-- AMIGA_CHIP_SECTION_NAME) != 0)
-- {
-- error_with_decl (*node,
-- "`chip' for `%s' conflicts with previous declaration");
-- }
-- }
-- }
-+ else
-+ {
-+ /* The decl may have already been given a section attribute from
-+ a previous declaration. Ensure they match. */
-+ if (DECL_SECTION_NAME (*node) == NULL_TREE)
-+ DECL_SECTION_NAME (*node) =
-+ build_string (strlen (AMIGA_CHIP_SECTION_NAME) + 1,
-+ AMIGA_CHIP_SECTION_NAME);
-+ else if (strcmp (TREE_STRING_POINTER (DECL_SECTION_NAME (*node)),
-+ AMIGA_CHIP_SECTION_NAME) != 0)
-+ {
-+ error_with_decl (*node,
-+ "`chip' for `%s' conflicts with previous declaration");
-+ }
-+ }
-+ }
- #else
-- error ("`chip' attribute is not supported for this target");
-+ error ("`chip' attribute is not supported for this target");
- #endif
-- }
-- else
-- {
-- warning (OPT_Wattributes, "`%s' attribute only applies to variables",
-- IDENTIFIER_POINTER (name));
-- *no_add_attrs = true;
-- }
-+ }
-+ else
-+ {
-+ warning (OPT_Wattributes, "`%s' attribute only applies to variables",
-+ IDENTIFIER_POINTER (name));
-+ *no_add_attrs = true;
-+ }
-
-- return NULL_TREE;
--}
-+ return NULL_TREE;
-+ }
-
- //----- from 68k.c start
-
--
--
--
--
--
- /* Stack checking and automatic extension support. */
-
- void
- amigaos_prologue_begin_hook (FILE *stream, int fsize)
--{
-- if (TARGET_STACKCHECK)
-- {
-- if (fsize < 256)
-+ {
-+ if (TARGET_STACKCHECK)
-+ {
-+ if (fsize < 256)
- asm_fprintf (stream, "\tcmpl %s,%Rsp\n"
-- "\tjcc 0f\n"
-- "\tjra %U__stkovf\n"
-- "\t0:\n",
-- (flag_pic == 3 ? "a4@(___stk_limit:W)" :
-- (flag_pic == 4 ? "a4@(___stk_limit:L)" :
-- "___stk_limit")));
-- else
-+ "\tjcc 0f\n"
-+ "\tjra %U__stkovf\n"
-+ "\t0:\n",
-+ (flag_pic == 3 ? "a4@(___stk_limit:W)" :
-+ (flag_pic == 4 ? "a4@(___stk_limit:L)" :
-+ "___stk_limit")));
-+ else
- asm_fprintf (stream, "\tmovel %I%d,%Rd0\n\tjbsr %U__stkchk_d0\n",
-- fsize);
-- }
--}
-+ fsize);
-+ }
-+ }
-
- void
- amigaos_alternate_frame_setup_f (FILE *stream, int fsize)
--{
-- if (fsize < 128)
-+ {
-+ if (fsize < 128)
- asm_fprintf (stream, "\tcmpl %s,%Rsp\n"
-- "\tjcc 0f\n"
-- "\tmoveq %I%d,%Rd0\n"
-- "\tmoveq %I0,%Rd1\n"
-- "\tjbsr %U__stkext_f\n"
-- "0:\tlink %Ra5,%I%d:W\n",
-- (flag_pic == 3 ? "a4@(___stk_limit:W)" :
-- (flag_pic == 4 ? "a4@(___stk_limit:L)" :
-- "___stk_limit")),
-- fsize, -fsize);
-- else
-+ "\tjcc 0f\n"
-+ "\tmoveq %I%d,%Rd0\n"
-+ "\tmoveq %I0,%Rd1\n"
-+ "\tjbsr %U__stkext_f\n"
-+ "0:\tlink %Ra5,%I%d:W\n",
-+ (flag_pic == 3 ? "a4@(___stk_limit:W)" :
-+ (flag_pic == 4 ? "a4@(___stk_limit:L)" :
-+ "___stk_limit")),
-+ fsize, -fsize);
-+ else
- asm_fprintf (stream, "\tmovel %I%d,%Rd0\n\tjbsr %U__link_a5_d0_f\n",
-- fsize);
--}
-+ fsize);
-+ }
-
- void
- amigaos_alternate_frame_setup (FILE *stream, int fsize)
--{
-- if (!fsize)
-+ {
-+ if (!fsize)
- asm_fprintf (stream, "\tcmpl %s,%Rsp\n"
-- "\tjcc 0f\n"
-- "\tmoveq %I0,%Rd0\n"
-- "\tmoveq %I0,%Rd1\n"
-- "\tjbsr %U__stkext_f\n"
-- "0:\n",
-- (flag_pic == 3 ? "a4@(___stk_limit:W)" :
-- (flag_pic == 4 ? "a4@(___stk_limit:L)" :
-- "___stk_limit")));
-- else if (fsize < 128)
-+ "\tjcc 0f\n"
-+ "\tmoveq %I0,%Rd0\n"
-+ "\tmoveq %I0,%Rd1\n"
-+ "\tjbsr %U__stkext_f\n"
-+ "0:\n",
-+ (flag_pic == 3 ? "a4@(___stk_limit:W)" :
-+ (flag_pic == 4 ? "a4@(___stk_limit:L)" :
-+ "___stk_limit")));
-+ else if (fsize < 128)
- asm_fprintf (stream, "\tcmpl %s,%Rsp\n"
-- "\tjcc 0f\n"
-- "\tmoveq %I%d,%Rd0\n"
-- "\tmoveq %I0,%Rd1\n"
-- "\tjbsr %U__stkext_f\n"
-- "0:\taddw %I%d,%Rsp\n",
-- (flag_pic == 3 ? "a4@(___stk_limit:W)" :
-- (flag_pic == 4 ? "a4@(___stk_limit:L)" :
-- "___stk_limit")),
-- fsize, -fsize);
-- else
-+ "\tjcc 0f\n"
-+ "\tmoveq %I%d,%Rd0\n"
-+ "\tmoveq %I0,%Rd1\n"
-+ "\tjbsr %U__stkext_f\n"
-+ "0:\taddw %I%d,%Rsp\n",
-+ (flag_pic == 3 ? "a4@(___stk_limit:W)" :
-+ (flag_pic == 4 ? "a4@(___stk_limit:L)" :
-+ "___stk_limit")),
-+ fsize, -fsize);
-+ else
- asm_fprintf (stream, "\tmovel %I%d,%Rd0\n\tjbsr %U__sub_d0_sp_f\n",
-- fsize);
--}
-+ fsize);
-+ }
-
- //static rtx
- //gen_stack_management_call (rtx stack_pointer, rtx arg, const char *func)
-@@ -385,7 +380,8 @@ amigaos_init_cumulative_args (CUMULATIVE_ARGS *cump, tree fntype, tree decl)
- struct amigaos_args * cum = decl == current_function_decl ? &mycum : &othercum;
- *cump = decl == current_function_decl;
- cum->num_of_regs = amigaos_regparm > 0 ? amigaos_regparm : 0;
-- DPRINTF(("0amigaos_init_cumulative_args %p -> %d\r\n", cum, cum->num_of_regs));
-+ DPRINTF(
-+ ("0amigaos_init_cumulative_args %s %p -> %d\r\n", decl ? lang_hooks.decl_printable_name (decl, 2) : "?", cum, cum->num_of_regs));
-
- /* Initialize a variable CUM of type CUMULATIVE_ARGS
- for a call to a function whose data type is FNTYPE.
-@@ -394,28 +390,32 @@ amigaos_init_cumulative_args (CUMULATIVE_ARGS *cump, tree fntype, tree decl)
- cum->last_arg_reg = -1;
- cum->regs_already_used = 0;
-
-- if (decl)
-+ if (fntype)
- {
-- tree attrs = DECL_ATTRIBUTES(decl);
-- if (lookup_attribute ("stkparm", attrs))
-- cum->num_of_regs = 0;
-- else
-+ tree attrs = decl ? DECL_ATTRIBUTES(decl) : NULL;
-+ if (attrs)
- {
-- tree ratree = lookup_attribute ("regparm", attrs);
-- cum->num_of_regs = amigaos_regparm != 0 ?
-- amigaos_regparm : AMIGAOS_DEFAULT_REGPARM;
-- if (ratree)
-+ if (lookup_attribute ("stkparm", attrs))
-+ cum->num_of_regs = 0;
-+ else
- {
-- tree args = TREE_VALUE(ratree);
--
-- if (args && TREE_CODE (args) == TREE_LIST)
-+ tree ratree = lookup_attribute ("regparm", attrs);
-+ cum->num_of_regs = amigaos_regparm != 0 ?
-+ amigaos_regparm :
-+ AMIGAOS_DEFAULT_REGPARM;
-+ if (ratree)
- {
-- tree val = TREE_VALUE(args);
-- if (TREE_CODE (val) == INTEGER_CST)
-+ tree args = TREE_VALUE(ratree);
-+
-+ if (args && TREE_CODE (args) == TREE_LIST)
- {
-- int no = TREE_INT_CST_LOW(val);
-- if (no > 0 && no < AMIGAOS_MAX_REGPARM)
-- cum->num_of_regs = no;
-+ tree val = TREE_VALUE(args);
-+ if (TREE_CODE (val) == INTEGER_CST)
-+ {
-+ int no = TREE_INT_CST_LOW(val);
-+ if (no > 0 && no < AMIGAOS_MAX_REGPARM)
-+ cum->num_of_regs = no;
-+ }
- }
- }
- }
-@@ -442,7 +442,7 @@ amigaos_init_cumulative_args (CUMULATIVE_ARGS *cump, tree fntype, tree decl)
- tree type = TYPE_SIZE(TREE_TYPE (DECL_RESULT (current_function_decl)));
- int sz = type ? TREE_INT_CST_LOW(type) : 0;
- if (sz > 64) /* mark a0 as already used. */
-- cum->regs_already_used |= 1<<8;
-+ cum->regs_already_used |= 1 << 8;
- }
- }
-
-@@ -465,13 +465,12 @@ amigaos_init_cumulative_args (CUMULATIVE_ARGS *cump, tree fntype, tree decl)
- /* Update the data in CUM to advance over an argument. */
-
- void
--amigaos_function_arg_advance (cumulative_args_t cum_v, machine_mode, const_tree,
-- bool)
-+amigaos_function_arg_advance (cumulative_args_t cum_v, machine_mode, const_tree, bool)
- {
- struct amigaos_args *cum = *get_cumulative_args (cum_v) ? &mycum : &othercum;
- /* Update the data in CUM to advance over an argument. */
-
-- DPRINTF(("amigaos_function_arg_advance1 %p\r\n", cump));
-+ DPRINTF(("amigaos_function_arg_advance1 %p\r\n", cum));
-
- if (cum->last_arg_reg != -1)
- {
-@@ -507,8 +506,7 @@ _m68k_function_arg (struct amigaos_args * cum, machine_mode mode, const_tree typ
-
- /* FIXME: The last condition below is a workaround for a bug. */
- if (TARGET_68881 && FLOAT_MODE_P(mode) &&
-- GET_MODE_UNIT_SIZE (mode) <= 12
-- && (GET_MODE_CLASS (mode) != MODE_COMPLEX_FLOAT || mode == SCmode))
-+ GET_MODE_UNIT_SIZE (mode) <= 12 && (GET_MODE_CLASS (mode) != MODE_COMPLEX_FLOAT || mode == SCmode))
- {
- regbegin = 16; /* FPx */
- len = GET_MODE_NUNITS(mode);
-@@ -534,8 +532,7 @@ _m68k_function_arg (struct amigaos_args * cum, machine_mode mode, const_tree typ
- if (!(cum->regs_already_used & mask))
- {
- int end;
-- for (end = reg; end < cum->num_of_regs && end < reg + len;
-- end++, mask <<= 1)
-+ for (end = reg; end < cum->num_of_regs && end < reg + len; end++, mask <<= 1)
- if (cum->regs_already_used & mask)
- break;
- if (end == reg + len)
-@@ -546,7 +543,7 @@ _m68k_function_arg (struct amigaos_args * cum, machine_mode mode, const_tree typ
- }
- }
-
-- if (reg == cum->num_of_regs && altregbegin != -1)
-+ if (reg == cum->num_of_regs && altregbegin != -1)
- {
- DPRINTF(("look for alt reg\n"));
- regbegin = altregbegin;
-@@ -568,14 +565,15 @@ _m68k_function_arg (struct amigaos_args * cum, machine_mode mode, const_tree typ
- in a register, and which register. */
-
- struct rtx_def *
--amigaos_function_arg (cumulative_args_t cum_v, machine_mode mode,
-- const_tree type, bool)
-+amigaos_function_arg (cumulative_args_t cum_v, machine_mode mode, const_tree type, bool)
- {
- DPRINTF(("amigaos_function_arg %p\r\n", cum_v.p));
-
- struct amigaos_args *cum = *get_cumulative_args (cum_v) ? &mycum : &othercum;
-
-- tree asmtree = type ? TYPE_ATTRIBUTES(type) : NULL_TREE;
-+ tree asmtree = type ? TYPE_ATTRIBUTES(cum->formal_type ? TREE_VALUE(cum->formal_type) : type) : NULL_TREE;
-+ //tree asmtree = type ? TYPE_ATTRIBUTES(type) : NULL_TREE;
-+
- if (asmtree && 0 == strcmp ("asm", IDENTIFIER_POINTER(TREE_PURPOSE(asmtree))))
- {
- int i;
-@@ -596,18 +594,18 @@ amigaos_function_arg (cumulative_args_t cum_v, machine_mode mode,
- return _m68k_function_arg (cum, mode, type);
- }
-
--void amiga_emit_regparm_clobbers(void)
-+void
-+amiga_emit_regparm_clobbers (void)
- {
-- rtx sp = gen_raw_REG(Pmode, 15);
-+ rtx sp = gen_raw_REG (Pmode, 15);
- for (int i = 0; i < FIRST_PSEUDO_REGISTER; ++i)
- if (mycum.regs_already_used & (1 << i))
- {
-- rtx reg = gen_raw_REG(Pmode, i);
-- emit_insn(gen_rtx_CLOBBER(Pmode, gen_rtx_SET(reg, gen_rtx_MEM(Pmode, reg))));
-+ rtx reg = gen_raw_REG (Pmode, i);
-+ emit_insn (gen_rtx_CLOBBER(Pmode, gen_rtx_SET(reg, gen_rtx_MEM(Pmode, reg))));
- }
- }
-
--
- /* Return zero if the attributes on TYPE1 and TYPE2 are incompatible,
- one if they are compatible, and two if they are nearly compatible
- (which causes a warning to be generated). */
-@@ -633,8 +631,7 @@ amigaos_comp_type_attributes (const_tree type1, const_tree type2)
- attr2 = NULL_TREE;
- if (attr1 && attr2)
- {
-- if (TREE_FIXED_CST_PTR(TREE_VALUE(attr1))->data.low
-- != TREE_FIXED_CST_PTR(TREE_VALUE(attr2))->data.low)
-+ if (TREE_FIXED_CST_PTR(TREE_VALUE(attr1))->data.low != TREE_FIXED_CST_PTR(TREE_VALUE(attr2))->data.low)
- return 0;
- }
- else if (attr1 || attr2)
-@@ -647,140 +644,135 @@ amigaos_comp_type_attributes (const_tree type1, const_tree type2)
- }
-
- /* Return zero if the attributes on TYPE1 and TYPE2 are incompatible,
-- one if they are compatible, and two if they are nearly compatible
-- (which causes a warning to be generated). */
-+ one if they are compatible, and two if they are nearly compatible
-+ (which causes a warning to be generated). */
- #if 0
- static int
- m68k_comp_type_attributes (tree type1, tree type2)
--{
-+ {
-
-- /* Functions or methods are incompatible if they specify mutually
-+ /* Functions or methods are incompatible if they specify mutually
- exclusive ways of passing arguments. */
-- if (TREE_CODE (type1) == FUNCTION_TYPE || TREE_CODE (type1) == METHOD_TYPE)
-- {
-- tree arg1, arg2;
-- if (!! lookup_attribute ("stkparm", TYPE_ATTRIBUTES (type1)) !=
-- !! lookup_attribute ("stkparm", TYPE_ATTRIBUTES (type2))
-- || !! lookup_attribute ("regparm", TYPE_ATTRIBUTES (type1)) !=
-- !! lookup_attribute ("regparm", TYPE_ATTRIBUTES (type2)))
-+ if (TREE_CODE (type1) == FUNCTION_TYPE || TREE_CODE (type1) == METHOD_TYPE)
-+ {
-+ tree arg1, arg2;
-+ if (!! lookup_attribute ("stkparm", TYPE_ATTRIBUTES (type1)) !=
-+ !! lookup_attribute ("stkparm", TYPE_ATTRIBUTES (type2))
-+ || !! lookup_attribute ("regparm", TYPE_ATTRIBUTES (type1)) !=
-+ !! lookup_attribute ("regparm", TYPE_ATTRIBUTES (type2)))
- return 0; /* 'regparm' and 'stkparm' are mutually exclusive. */
-
-- arg1 = lookup_attribute ("regparm", TYPE_ATTRIBUTES (type1));
-- arg2 = lookup_attribute ("regparm", TYPE_ATTRIBUTES (type2));
-- if (arg1 && arg2)
-- {
-- int num1 = 0, num2 = 0;
-- if (TREE_VALUE (arg1) && TREE_CODE (TREE_VALUE (arg1)) == TREE_LIST)
-- {
-- tree numofregs = TREE_VALUE (TREE_VALUE (arg1));
-- if (numofregs)
-+ arg1 = lookup_attribute ("regparm", TYPE_ATTRIBUTES (type1));
-+ arg2 = lookup_attribute ("regparm", TYPE_ATTRIBUTES (type2));
-+ if (arg1 && arg2)
-+ {
-+ int num1 = 0, num2 = 0;
-+ if (TREE_VALUE (arg1) && TREE_CODE (TREE_VALUE (arg1)) == TREE_LIST)
-+ {
-+ tree numofregs = TREE_VALUE (TREE_VALUE (arg1));
-+ if (numofregs)
- num1 = TREE_INT_CST_LOW (numofregs);
-- }
-- if (TREE_VALUE (arg2) && TREE_CODE (TREE_VALUE (arg2)) == TREE_LIST)
-- {
-- tree numofregs = TREE_VALUE (TREE_VALUE (arg2));
-- if (numofregs)
-+ }
-+ if (TREE_VALUE (arg2) && TREE_CODE (TREE_VALUE (arg2)) == TREE_LIST)
-+ {
-+ tree numofregs = TREE_VALUE (TREE_VALUE (arg2));
-+ if (numofregs)
- num2 = TREE_INT_CST_LOW (numofregs);
-- }
-- if (num1 != num2)
-+ }
-+ if (num1 != num2)
- return 0; /* Different numbers, or no number in one type. */
-- }
-- }
-+ }
-+ }
- #ifdef TARGET_AMIGAOS
- return amigaos_comp_type_attributes(type1, type2);
- #else
-- return 1;
-+ return 1;
- #endif
--}
-+ }
- #endif
-
- /* end-GG-local */
-
--
- /* Handle a "regparm", "stkparm" attribute;
- arguments as in struct attribute_spec.handler. */
- tree
--amigaos_handle_type_attribute (tree *node, tree name, tree args,
-- int flags ATTRIBUTE_UNUSED, bool *no_add_attrs)
-+amigaos_handle_type_attribute (tree *node, tree name, tree args, int flags ATTRIBUTE_UNUSED, bool *no_add_attrs)
- {
- tree nnn = *node;
-- do { // while (0);
-- DPRINTF(("%p with treecode %d\n", node, TREE_CODE(nnn)));
-- if (TREE_CODE (nnn) == FUNCTION_DECL || TREE_CODE (nnn) == FUNCTION_TYPE
-- || TREE_CODE (nnn) == METHOD_TYPE)
-- {
-- /* 'regparm' accepts one optional argument - number of registers in
-- single class that should be used to pass arguments. */
-- if (is_attribute_p ("regparm", name))
-+ do
-+ { // while (0);
-+ DPRINTF(("%p with treecode %d\n", node, TREE_CODE(nnn)));
-+ if (TREE_CODE (nnn) == FUNCTION_DECL || TREE_CODE (nnn) == FUNCTION_TYPE || TREE_CODE (nnn) == METHOD_TYPE)
- {
-- DPRINTF(("regparm found\n"));
--
-- if (lookup_attribute ("stkparm", TYPE_ATTRIBUTES(nnn)))
-- {
-- error ("`regparm' and `stkparm' are mutually exclusive");
-- break;
-- }
-- if (args && TREE_CODE (args) == TREE_LIST)
-+ /* 'regparm' accepts one optional argument - number of registers in
-+ single class that should be used to pass arguments. */
-+ if (is_attribute_p ("regparm", name))
- {
-- tree val = TREE_VALUE(args);
-- DPRINTF(("regparm with val: %d\n", TREE_CODE(val)));
-- if (TREE_CODE (val) == INTEGER_CST)
-+ DPRINTF(("regparm found\n"));
-+
-+ if (lookup_attribute ("stkparm", TYPE_ATTRIBUTES(nnn)))
-+ {
-+ error ("`regparm' and `stkparm' are mutually exclusive");
-+ break;
-+ }
-+ if (args && TREE_CODE (args) == TREE_LIST)
- {
-- int no = TREE_INT_CST_LOW(val);
-- if (no < 0 || no > AMIGAOS_MAX_REGPARM)
-+ tree val = TREE_VALUE(args);
-+ DPRINTF(("regparm with val: %d\n", TREE_CODE(val)));
-+ if (TREE_CODE (val) == INTEGER_CST)
- {
-- error ("`regparm' attribute: value %d not in [0 - %d]",
-- no,
-- AMIGAOS_MAX_REGPARM);
-+ int no = TREE_INT_CST_LOW(val);
-+ if (no < 0 || no > AMIGAOS_MAX_REGPARM)
-+ {
-+ error ("`regparm' attribute: value %d not in [0 - %d]", no,
-+ AMIGAOS_MAX_REGPARM);
-+ break;
-+ }
-+ }
-+ else
-+ {
-+ error ("invalid argument(s) to `regparm' attribute");
- break;
- }
- }
-- else
-+ }
-+ else if (is_attribute_p ("stkparm", name))
-+ {
-+ if (lookup_attribute ("regparm", TYPE_ATTRIBUTES(nnn)))
- {
-- error ("invalid argument(s) to `regparm' attribute");
-+ error ("`regparm' and `stkparm' are mutually exclusive");
- break;
- }
- }
-- }
-- else if (is_attribute_p ("stkparm", name))
-- {
-- if (lookup_attribute ("regparm", TYPE_ATTRIBUTES(nnn)))
-+ else if (is_attribute_p ("stackext", name))
- {
-- error ("`regparm' and `stkparm' are mutually exclusive");
-- break;
-+ if (lookup_attribute ("interrupt", TYPE_ATTRIBUTES(nnn)))
-+ {
-+ error ("`stackext' and `interrupt' are mutually exclusive");
-+ break;
-+ }
- }
-- }
-- else if (is_attribute_p ("stackext", name))
-- {
-- if (lookup_attribute ("interrupt", TYPE_ATTRIBUTES(nnn)))
-+ else if (is_attribute_p ("saveds", name))
- {
-- error ("`stackext' and `interrupt' are mutually exclusive");
-- break;
- }
- }
-- else if (is_attribute_p ("saveds", name))
-+ else
- {
-+ warning (OPT_Wattributes, "`%s' attribute only applies to functions", IDENTIFIER_POINTER(name));
- }
-+ return NULL_TREE ;
- }
-- else
-- {
-- warning (OPT_Wattributes, "`%s' attribute only applies to functions",
-- IDENTIFIER_POINTER(name));
-- }
-- return NULL_TREE;
-- } while (0);
-+ while (0);
- // error case
- *no_add_attrs = true;
-- return NULL_TREE;
-+ return NULL_TREE ;
- }
-
--
- extern bool
- m68k_rtx_costs (rtx, machine_mode, int, int, int *, bool);
-
- bool
--amigaos_rtx_costs (rtx x, machine_mode mode, int outer_code, int opno,
-- int *total, bool speed)
-+amigaos_rtx_costs (rtx x, machine_mode mode, int outer_code, int opno, int *total, bool speed)
- {
- // DPRINTF(("outer: %d, opno: %d", outer_code, opno));
- bool r = m68k_rtx_costs (x, mode, outer_code, opno, total, speed);
-@@ -790,13 +782,12 @@ amigaos_rtx_costs (rtx x, machine_mode mode, int outer_code, int opno,
- return r;
- }
-
--
- /* Output assembly to switch to section NAME with attribute FLAGS. */
-
- extern void
- amiga_named_section (const char *name, unsigned int flags, tree decl ATTRIBUTE_UNUSED)
- {
-- if (0 == strncmp(".text", name, 5))
-+ if (0 == strncmp (".text", name, 5))
- name = ".text";
- fprintf (asm_out_file, "\t%s\n", name);
- }
-@@ -806,7 +797,8 @@ amiga_named_section (const char *name, unsigned int flags, tree decl ATTRIBUTE_U
- /**
- * Does x reference the pic_reg and is const or plus?
- */
--int amiga_is_const_pic_ref(const_rtx x)
-+int
-+amiga_is_const_pic_ref (const_rtx x)
- {
- const_rtx y = x;
- if (flag_pic < 3)
-@@ -816,19 +808,18 @@ int amiga_is_const_pic_ref(const_rtx x)
- return (x != y && REG_P(y) && REGNO(y) == PIC_REG);
- }
-
--
- /* Does operand (which is a symbolic_operand) live in text space? If
-- so SYMBOL_REF_FLAG, which is set by ENCODE_SECTION_INFO, will be true.
-+ so SYMBOL_REF_FLAG, which is set by ENCODE_SECTION_INFO, will be true.
-
-- This function is used in base relative code generation. */
-+ This function is used in base relative code generation. */
-
- int
- read_only_operand (rtx operand)
- {
- if (GET_CODE (operand) == CONST)
-- operand = XEXP (XEXP (operand, 0), 0);
-+ operand = XEXP(XEXP (operand, 0), 0);
- if (GET_CODE (operand) == SYMBOL_REF)
-- return SYMBOL_REF_FLAG (operand) || CONSTANT_POOL_ADDRESS_P (operand);
-+ return SYMBOL_REF_FLAG (operand) || CONSTANT_POOL_ADDRESS_P(operand);
- return 1;
- }
-
-
-From cbc99060c9a11080a62913d87030ad33ca15ae66 Mon Sep 17 00:00:00 2001
-From: bebbo <bebbo(a)bejy.net>
-Date: Mon, 24 Apr 2017 23:55:30 +0200
-Subject: [PATCH 088/303] @B fix handling of jumps/labels in opt_reg_rename
-
----
- gcc/bbb-opts.c | 111 +++++++++++++++++++++++++++++++++++++++++++++++++--------
- 1 file changed, 97 insertions(+), 14 deletions(-)
-
-diff --git a/gcc/bbb-opts.c b/gcc/bbb-opts.c
-index d0288f254f9c..db99815fee58 100755
---- gcc/bbb-opts.c
-+++ gcc/bbb-opts.c
-@@ -212,7 +212,6 @@ struct insn_info
- _use &= ~o._def;
- _use |= o._use;
- _def = 0;
-- _hard &= ~_use;
- }
-
- inline bool
-@@ -339,6 +338,9 @@ copy_reg (rtx reg, int newregno)
- static void
- temp_reg_rename (std::vector<std::pair<rtx *, rtx> > & loc, rtx x, unsigned oldregno, unsigned newregno)
- {
-+ if (!x)
-+ return;
-+
- RTX_CODE code = GET_CODE(x);
++++ .cproject
+@@ -0,0 +1,188 @@
++<?xml version="1.0" encoding="UTF-8" standalone="no"?>
++<?fileVersion 4.0.0?><cproject storage_type_id="org.eclipse.cdt.core.XmlProjectDescriptionStorage">
++ <storageModule moduleId="org.eclipse.cdt.core.settings">
++ <cconfiguration id="cdt.managedbuild.config.gnu.cross.exe.debug.452878522">
++ <storageModule buildSystemId="org.eclipse.cdt.managedbuilder.core.configurationDataProvider" id="cdt.managedbuild.config.gnu.cross.exe.debug.452878522" moduleId="org.eclipse.cdt.core.settings" name="Debug">
++ <externalSettings/>
++ <extensions>
++ <extension id="org.eclipse.cdt.core.Cygwin_PE" point="org.eclipse.cdt.core.BinaryParser"/>
++ <extension id="org.eclipse.cdt.core.GASErrorParser" point="org.eclipse.cdt.core.ErrorParser"/>
++ <extension id="org.eclipse.cdt.core.GmakeErrorParser" point="org.eclipse.cdt.core.ErrorParser"/>
++ <extension id="org.eclipse.cdt.core.CWDLocator" point="org.eclipse.cdt.core.ErrorParser"/>
++ <extension id="org.eclipse.cdt.core.GCCErrorParser" point="org.eclipse.cdt.core.ErrorParser"/>
++ <extension id="org.eclipse.cdt.core.GLDErrorParser" point="org.eclipse.cdt.core.ErrorParser"/>
++ </extensions>
++ </storageModule>
++ <storageModule moduleId="cdtBuildSystem" version="4.0.0">
++ <configuration artifactName="${ProjName}" buildArtefactType="org.eclipse.cdt.build.core.buildArtefactType.exe" buildProperties="org.eclipse.cdt.build.core.buildArtefactType=org.eclipse.cdt.build.core.buildArtefactType.exe,org.eclipse.cdt.build.core.buildType=org.eclipse.cdt.build.core.buildType.debug" cleanCommand="rm -rf" description="" id="cdt.managedbuild.config.gnu.cross.exe.debug.452878522" name="Debug" parent="cdt.managedbuild.config.gnu.cross.exe.debug">
++ <folderInfo id="cdt.managedbuild.config.gnu.cross.exe.debug.452878522." name="/" resourcePath="">
++ <toolChain id="cdt.managedbuild.toolchain.gnu.cygwin.base.2053847551" name="Cygwin GCC" superClass="cdt.managedbuild.toolchain.gnu.cygwin.base">
++ <targetPlatform archList="all" binaryParser="org.eclipse.cdt.core.Cygwin_PE" id="cdt.managedbuild.target.gnu.platform.cygwin.base.2091243283" name="Debug Platform" osList="win32" superClass="cdt.managedbuild.target.gnu.platform.cygwin.base"/>
++ <builder buildPath="${workspace_loc:/debugwin}/Debug" id="cdt.managedbuild.target.gnu.builder.cygwin.base.1660320342" keepEnvironmentInBuildfile="false" managedBuildOn="false" name="Gnu Make Builder" superClass="cdt.managedbuild.target.gnu.builder.cygwin.base">
++ <outputEntries>
++ <entry flags="VALUE_WORKSPACE_PATH|RESOLVED" kind="outputPath" name=""/>
++ </outputEntries>
++ </builder>
++ <tool id="cdt.managedbuild.tool.gnu.assembler.cygwin.base.607722454" name="GCC Assembler" superClass="cdt.managedbuild.tool.gnu.assembler.cygwin.base">
++ <option id="gnu.both.asm.option.include.paths.2094451885" name="Include paths (-I)" superClass="gnu.both.asm.option.include.paths" valueType="includePath">
++ <listOptionValue builtIn="false" value=""${workspace_loc:/amigaos-cross-toolchain/.build-m68k/build/gcc-6/gcc}""/>
++ <listOptionValue builtIn="false" value=""C:\cygwin\usr\include""/>
++ </option>
++ <inputType id="cdt.managedbuild.tool.gnu.assembler.input.1425989952" superClass="cdt.managedbuild.tool.gnu.assembler.input"/>
++ </tool>
++ <tool id="cdt.managedbuild.tool.gnu.archiver.cygwin.base.2119049474" name="GCC Archiver" superClass="cdt.managedbuild.tool.gnu.archiver.cygwin.base"/>
++ <tool id="cdt.managedbuild.tool.gnu.cpp.compiler.cygwin.base.1103847968" name="Cygwin C++ Compiler" superClass="cdt.managedbuild.tool.gnu.cpp.compiler.cygwin.base">
++ <option id="gnu.cpp.compiler.option.include.paths.466783605" name="Include paths (-I)" superClass="gnu.cpp.compiler.option.include.paths" useByScannerDiscovery="false" valueType="includePath">
++ <listOptionValue builtIn="false" value=""C:\cygwin\usr\include""/>
++ <listOptionValue builtIn="false" value=""${workspace_loc:/gcc-6/libcpp/include}""/>
++ <listOptionValue builtIn="false" value=""D:\develop\workspaces\c1\amigaos-cross-toolchain\.build-m68k\build\gcc-6\gcc""/>
++ </option>
++ <option id="gnu.cpp.compiler.option.optimization.level.193715843" name="Optimization Level" superClass="gnu.cpp.compiler.option.optimization.level" useByScannerDiscovery="false" value="gnu.cpp.compiler.optimization.level.none" valueType="enumerated"/>
++ <option id="gnu.cpp.compiler.option.debugging.level.2136883244" name="Debug Level" superClass="gnu.cpp.compiler.option.debugging.level" useByScannerDiscovery="false" value="gnu.cpp.compiler.debugging.level.max" valueType="enumerated"/>
++ <option id="gnu.cpp.compiler.option.preprocessor.def.807277038" name="Defined symbols (-D)" superClass="gnu.cpp.compiler.option.preprocessor.def" useByScannerDiscovery="false" valueType="definedSymbols">
++ <listOptionValue builtIn="false" value="IN_GCC=1"/>
++ <listOptionValue builtIn="false" value="HAVE_cc0=1"/>
++ <listOptionValue builtIn="false" value="__ECLIPSE__=1"/>
++ <listOptionValue builtIn="false" value="TARGET_AMIGA=1"/>
++ </option>
++ <inputType id="cdt.managedbuild.tool.gnu.cpp.compiler.input.cygwin.780175803" superClass="cdt.managedbuild.tool.gnu.cpp.compiler.input.cygwin"/>
++ </tool>
++ <tool id="cdt.managedbuild.tool.gnu.c.compiler.cygwin.base.1920331604" name="Cygwin C Compiler" superClass="cdt.managedbuild.tool.gnu.c.compiler.cygwin.base">
++ <option id="gnu.c.compiler.option.include.paths.692774379" name="Include paths (-I)" superClass="gnu.c.compiler.option.include.paths" useByScannerDiscovery="false" valueType="includePath">
++ <listOptionValue builtIn="false" value=""C:\cygwin\usr\include""/>
++ <listOptionValue builtIn="false" value=""${workspace_loc:/gcc-6/libcpp/include}""/>
++ <listOptionValue builtIn="false" value=""D:\develop\workspaces\c1\amigaos-cross-toolchain\.build-m68k\build\gcc-6\gcc""/>
++ </option>
++ <option defaultValue="gnu.c.optimization.level.none" id="gnu.c.compiler.option.optimization.level.227992926" name="Optimization Level" superClass="gnu.c.compiler.option.optimization.level" useByScannerDiscovery="false" valueType="enumerated"/>
++ <option id="gnu.c.compiler.option.debugging.level.748883400" name="Debug Level" superClass="gnu.c.compiler.option.debugging.level" useByScannerDiscovery="false" value="gnu.c.debugging.level.max" valueType="enumerated"/>
++ <option id="gnu.c.compiler.option.preprocessor.def.symbols.1982594045" name="Defined symbols (-D)" superClass="gnu.c.compiler.option.preprocessor.def.symbols" useByScannerDiscovery="false" valueType="definedSymbols">
++ <listOptionValue builtIn="false" value="IN_GCC=1"/>
++ <listOptionValue builtIn="false" value="HAVE_cc0=1"/>
++ <listOptionValue builtIn="false" value="__ECLIPSE__=1"/>
++ <listOptionValue builtIn="false" value="TARGET_AMIGA=1"/>
++ </option>
++ <inputType id="cdt.managedbuild.tool.gnu.c.compiler.input.cygwin.2078467313" superClass="cdt.managedbuild.tool.gnu.c.compiler.input.cygwin"/>
++ </tool>
++ <tool id="cdt.managedbuild.tool.gnu.c.linker.cygwin.base.344641511" name="Cygwin C Linker" superClass="cdt.managedbuild.tool.gnu.c.linker.cygwin.base"/>
++ <tool id="cdt.managedbuild.tool.gnu.cpp.linker.cygwin.base.968200320" name="Cygwin C++ Linker" superClass="cdt.managedbuild.tool.gnu.cpp.linker.cygwin.base">
++ <option id="gnu.cpp.link.option.libs.260033787" name="Libraries (-l)" superClass="gnu.cpp.link.option.libs"/>
++ <inputType id="cdt.managedbuild.tool.gnu.cpp.linker.input.1537937183" superClass="cdt.managedbuild.tool.gnu.cpp.linker.input">
++ <additionalInput kind="additionalinputdependency" paths="$(USER_OBJS)"/>
++ <additionalInput kind="additionalinput" paths="$(LIBS)"/>
++ </inputType>
++ </tool>
++ </toolChain>
++ </folderInfo>
++ <sourceEntries>
++ <entry excluding="ada/|doc/|fortran/|ginclude/|go/|java/|jit/|lto/|objc/|objcp/|po/|testsuite/|config/aarch64/|config/alpha/|config/arc/|config/arm/|config/avr/|config/bfin/|config/c6x/|config/cr16/|config/cris/|config/epiphany/|config/fr30/|config/frv/|config/ft32/|config/h8300/|config/i386/|config/ia64/|config/iq2000/|config/lm32/|config/m32c/|config/m32r/|config/mcore/|config/mep/|config/microblaze/|config/mips/|config/mmix/|config/mn10300/|config/moxie/|config/msp430/|config/nds32/|config/nios2/|config/nvptx/|config/pa/|config/pdp11/|config/rl78/|config/rs6000/|config/rx/|config/s390/|config/sh/|config/sparc/|config/spu/|config/stormy16/|config/tilegx/|config/tilepro/|config/v850/|config/vax/|config/visium/|config/vms/|config/xtensa/" flags="VALUE_WORKSPACE_PATH" kind="sourcePath" name="gcc"/>
++ </sourceEntries>
++ </configuration>
++ </storageModule>
++ <storageModule moduleId="org.eclipse.cdt.core.externalSettings"/>
++ </cconfiguration>
++ <cconfiguration id="cdt.managedbuild.config.gnu.cross.exe.release.811454954">
++ <storageModule buildSystemId="org.eclipse.cdt.managedbuilder.core.configurationDataProvider" id="cdt.managedbuild.config.gnu.cross.exe.release.811454954" moduleId="org.eclipse.cdt.core.settings" name="Release">
++ <externalSettings/>
++ <extensions>
++ <extension id="org.eclipse.cdt.core.ELF" point="org.eclipse.cdt.core.BinaryParser"/>
++ <extension id="org.eclipse.cdt.core.GASErrorParser" point="org.eclipse.cdt.core.ErrorParser"/>
++ <extension id="org.eclipse.cdt.core.GmakeErrorParser" point="org.eclipse.cdt.core.ErrorParser"/>
++ <extension id="org.eclipse.cdt.core.CWDLocator" point="org.eclipse.cdt.core.ErrorParser"/>
++ <extension id="org.eclipse.cdt.core.GCCErrorParser" point="org.eclipse.cdt.core.ErrorParser"/>
++ <extension id="org.eclipse.cdt.core.GLDErrorParser" point="org.eclipse.cdt.core.ErrorParser"/>
++ </extensions>
++ </storageModule>
++ <storageModule moduleId="cdtBuildSystem" version="4.0.0">
++ <configuration artifactName="${ProjName}" buildArtefactType="org.eclipse.cdt.build.core.buildArtefactType.exe" buildProperties="org.eclipse.cdt.build.core.buildArtefactType=org.eclipse.cdt.build.core.buildArtefactType.exe,org.eclipse.cdt.build.core.buildType=org.eclipse.cdt.build.core.buildType.release" cleanCommand="rm -rf" description="" id="cdt.managedbuild.config.gnu.cross.exe.release.811454954" name="Release" parent="cdt.managedbuild.config.gnu.cross.exe.release">
++ <folderInfo id="cdt.managedbuild.config.gnu.cross.exe.release.811454954." name="/" resourcePath="">
++ <toolChain id="cdt.managedbuild.toolchain.gnu.cross.exe.release.101222491" name="Cross GCC" superClass="cdt.managedbuild.toolchain.gnu.cross.exe.release">
++ <targetPlatform archList="all" binaryParser="org.eclipse.cdt.core.ELF" id="cdt.managedbuild.targetPlatform.gnu.cross.1798723854" isAbstract="false" osList="all" superClass="cdt.managedbuild.targetPlatform.gnu.cross"/>
++ <builder buildPath="${workspace_loc:/debugwin}/Release" id="cdt.managedbuild.builder.gnu.cross.507087034" keepEnvironmentInBuildfile="false" managedBuildOn="true" name="Gnu Make Builder" superClass="cdt.managedbuild.builder.gnu.cross"/>
++ <tool id="cdt.managedbuild.tool.gnu.cross.c.compiler.1834281466" name="Cross GCC Compiler" superClass="cdt.managedbuild.tool.gnu.cross.c.compiler">
++ <option defaultValue="gnu.c.optimization.level.most" id="gnu.c.compiler.option.optimization.level.1686563067" name="Optimization Level" superClass="gnu.c.compiler.option.optimization.level" useByScannerDiscovery="false" valueType="enumerated"/>
++ <option id="gnu.c.compiler.option.debugging.level.60172226" name="Debug Level" superClass="gnu.c.compiler.option.debugging.level" useByScannerDiscovery="false" value="gnu.c.debugging.level.none" valueType="enumerated"/>
++ <option id="gnu.c.compiler.option.include.paths.696908692" name="Include paths (-I)" superClass="gnu.c.compiler.option.include.paths" useByScannerDiscovery="false" valueType="includePath">
++ <listOptionValue builtIn="false" value=""C:\cygwin\usr\include""/>
++ </option>
++ <option id="gnu.c.compiler.option.preprocessor.def.symbols.652362073" name="Defined symbols (-D)" superClass="gnu.c.compiler.option.preprocessor.def.symbols" useByScannerDiscovery="false" valueType="definedSymbols">
++ <listOptionValue builtIn="false" value="IN_GCC=1"/>
++ <listOptionValue builtIn="false" value="HAVE_cc0=1"/>
++ <listOptionValue builtIn="false" value="__ECLIPSE__=1"/>
++ <listOptionValue builtIn="false" value="TARGET_AMIGA=1"/>
++ </option>
++ <inputType id="cdt.managedbuild.tool.gnu.c.compiler.input.1150724656" superClass="cdt.managedbuild.tool.gnu.c.compiler.input"/>
++ </tool>
++ <tool id="cdt.managedbuild.tool.gnu.cross.cpp.compiler.1042604749" name="Cross G++ Compiler" superClass="cdt.managedbuild.tool.gnu.cross.cpp.compiler">
++ <option id="gnu.cpp.compiler.option.optimization.level.2088586809" name="Optimization Level" superClass="gnu.cpp.compiler.option.optimization.level" useByScannerDiscovery="false" value="gnu.cpp.compiler.optimization.level.most" valueType="enumerated"/>
++ <option id="gnu.cpp.compiler.option.debugging.level.1993778911" name="Debug Level" superClass="gnu.cpp.compiler.option.debugging.level" useByScannerDiscovery="false" value="gnu.cpp.compiler.debugging.level.none" valueType="enumerated"/>
++ <option id="gnu.cpp.compiler.option.include.paths.1936413739" name="Include paths (-I)" superClass="gnu.cpp.compiler.option.include.paths" useByScannerDiscovery="false" valueType="includePath">
++ <listOptionValue builtIn="false" value=""C:\cygwin\usr\include""/>
++ </option>
++ <option id="gnu.cpp.compiler.option.preprocessor.def.625117841" name="Defined symbols (-D)" superClass="gnu.cpp.compiler.option.preprocessor.def" useByScannerDiscovery="false" valueType="definedSymbols">
++ <listOptionValue builtIn="false" value="IN_GCC=1"/>
++ <listOptionValue builtIn="false" value="HAVE_cc0=1"/>
++ <listOptionValue builtIn="false" value="__ECLIPSE__=1"/>
++ <listOptionValue builtIn="false" value="TARGET_AMIGA=1"/>
++ </option>
++ <inputType id="cdt.managedbuild.tool.gnu.cpp.compiler.input.1133865092" superClass="cdt.managedbuild.tool.gnu.cpp.compiler.input"/>
++ </tool>
++ <tool id="cdt.managedbuild.tool.gnu.cross.c.linker.946489608" name="Cross GCC Linker" superClass="cdt.managedbuild.tool.gnu.cross.c.linker"/>
++ <tool id="cdt.managedbuild.tool.gnu.cross.cpp.linker.738916918" name="Cross G++ Linker" superClass="cdt.managedbuild.tool.gnu.cross.cpp.linker">
++ <inputType id="cdt.managedbuild.tool.gnu.cpp.linker.input.1880308865" superClass="cdt.managedbuild.tool.gnu.cpp.linker.input">
++ <additionalInput kind="additionalinputdependency" paths="$(USER_OBJS)"/>
++ <additionalInput kind="additionalinput" paths="$(LIBS)"/>
++ </inputType>
++ </tool>
++ <tool id="cdt.managedbuild.tool.gnu.cross.archiver.1813524686" name="Cross GCC Archiver" superClass="cdt.managedbuild.tool.gnu.cross.archiver"/>
++ <tool id="cdt.managedbuild.tool.gnu.cross.assembler.1395544547" name="Cross GCC Assembler" superClass="cdt.managedbuild.tool.gnu.cross.assembler">
++ <option id="gnu.both.asm.option.include.paths.1443815690" name="Include paths (-I)" superClass="gnu.both.asm.option.include.paths" valueType="includePath">
++ <listOptionValue builtIn="false" value=""C:\cygwin\usr\include""/>
++ </option>
++ <inputType id="cdt.managedbuild.tool.gnu.assembler.input.1421786104" superClass="cdt.managedbuild.tool.gnu.assembler.input"/>
++ </tool>
++ </toolChain>
++ </folderInfo>
++ <sourceEntries>
++ <entry excluding="src" flags="VALUE_WORKSPACE_PATH|RESOLVED" kind="sourcePath" name=""/>
++ <entry flags="VALUE_WORKSPACE_PATH|RESOLVED" kind="sourcePath" name="src"/>
++ </sourceEntries>
++ </configuration>
++ </storageModule>
++ <storageModule moduleId="org.eclipse.cdt.core.externalSettings"/>
++ </cconfiguration>
++ </storageModule>
++ <storageModule moduleId="cdtBuildSystem" version="4.0.0">
++ <project id="debugwin.cdt.managedbuild.target.gnu.cross.exe.1884740625" name="Executable" projectType="cdt.managedbuild.target.gnu.cross.exe"/>
++ </storageModule>
++ <storageModule moduleId="org.eclipse.cdt.core.LanguageSettingsProviders"/>
++ <storageModule moduleId="refreshScope" versionNumber="2">
++ <configuration configurationName="Debug">
++ <resource resourceType="PROJECT" workspacePath="/gcc-6"/>
++ </configuration>
++ <configuration configurationName="Release">
++ <resource resourceType="PROJECT" workspacePath="/gcc-6"/>
++ </configuration>
++ </storageModule>
++ <storageModule moduleId="org.eclipse.cdt.make.core.buildtargets"/>
++ <storageModule moduleId="scannerConfiguration">
++ <autodiscovery enabled="true" problemReportingEnabled="true" selectedProfileId=""/>
++ <scannerConfigBuildInfo instanceId="cdt.managedbuild.config.gnu.cross.exe.release.811454954;cdt.managedbuild.config.gnu.cross.exe.release.811454954.;cdt.managedbuild.tool.gnu.cross.c.compiler.1834281466;cdt.managedbuild.tool.gnu.c.compiler.input.1150724656">
++ <autodiscovery enabled="true" problemReportingEnabled="true" selectedProfileId=""/>
++ </scannerConfigBuildInfo>
++ <scannerConfigBuildInfo instanceId="cdt.managedbuild.config.gnu.cross.exe.debug.452878522;cdt.managedbuild.config.gnu.cross.exe.debug.452878522.;cdt.managedbuild.tool.gnu.cross.c.compiler.502147450;cdt.managedbuild.tool.gnu.c.compiler.input.1173428818">
++ <autodiscovery enabled="true" problemReportingEnabled="true" selectedProfileId=""/>
++ </scannerConfigBuildInfo>
++ <scannerConfigBuildInfo instanceId="cdt.managedbuild.config.gnu.cross.exe.debug.452878522;cdt.managedbuild.config.gnu.cross.exe.debug.452878522.;cdt.managedbuild.tool.gnu.cpp.compiler.cygwin.base.1103847968;cdt.managedbuild.tool.gnu.cpp.compiler.input.cygwin.780175803">
++ <autodiscovery enabled="true" problemReportingEnabled="true" selectedProfileId=""/>
++ </scannerConfigBuildInfo>
++ <scannerConfigBuildInfo instanceId="cdt.managedbuild.config.gnu.cross.exe.debug.452878522;cdt.managedbuild.config.gnu.cross.exe.debug.452878522.;cdt.managedbuild.tool.gnu.c.compiler.cygwin.base.1920331604;cdt.managedbuild.tool.gnu.c.compiler.input.cygwin.2078467313">
++ <autodiscovery enabled="true" problemReportingEnabled="true" selectedProfileId=""/>
++ </scannerConfigBuildInfo>
++ <scannerConfigBuildInfo instanceId="cdt.managedbuild.config.gnu.cross.exe.debug.452878522;cdt.managedbuild.config.gnu.cross.exe.debug.452878522.;cdt.managedbuild.tool.gnu.cross.cpp.compiler.216739552;cdt.managedbuild.tool.gnu.cpp.compiler.input.1269341019">
++ <autodiscovery enabled="true" problemReportingEnabled="true" selectedProfileId=""/>
++ </scannerConfigBuildInfo>
++ <scannerConfigBuildInfo instanceId="cdt.managedbuild.config.gnu.cross.exe.release.811454954;cdt.managedbuild.config.gnu.cross.exe.release.811454954.;cdt.managedbuild.tool.gnu.cross.cpp.compiler.1042604749;cdt.managedbuild.tool.gnu.cpp.compiler.input.1133865092">
++ <autodiscovery enabled="true" problemReportingEnabled="true" selectedProfileId=""/>
++ </scannerConfigBuildInfo>
++ </storageModule>
++</cproject>
+diff --git a/.project b/.project
+new file mode 100644
+index 000000000000..500c9ee08dca
+--- /dev/null
++++ .project
+@@ -0,0 +1,34 @@
++<?xml version="1.0" encoding="UTF-8"?>
++<projectDescription>
++ <name>gcc-6</name>
++ <comment></comment>
++ <projects>
++ </projects>
++ <buildSpec>
++ <buildCommand>
++ <name>org.eclipse.cdt.managedbuilder.core.genmakebuilder</name>
++ <triggers>clean,full,incremental,</triggers>
++ <arguments>
++ </arguments>
++ </buildCommand>
++ <buildCommand>
++ <name>org.eclipse.cdt.managedbuilder.core.ScannerConfigBuilder</name>
++ <triggers>full,incremental,</triggers>
++ <arguments>
++ </arguments>
++ </buildCommand>
++ </buildSpec>
++ <natures>
++ <nature>org.eclipse.cdt.core.cnature</nature>
++ <nature>org.eclipse.cdt.core.ccnature</nature>
++ <nature>org.eclipse.cdt.managedbuilder.core.managedBuildNature</nature>
++ <nature>org.eclipse.cdt.managedbuilder.core.ScannerConfigNature</nature>
++ </natures>
++ <linkedResources>
++ <link>
++ <name>build-gcc</name>
++ <type>2</type>
++ <location>D:/develop/workspaces/c1/amigaos-cross-toolchain/.build-m68k/build/gcc-6</location>
++ </link>
++ </linkedResources>
++</projectDescription>
+diff --git a/.settings/language.settings.xml b/.settings/language.settings.xml
+new file mode 100755
+index 000000000000..caef162d88d1
+--- /dev/null
++++ .settings/language.settings.xml
+@@ -0,0 +1,25 @@
++<?xml version="1.0" encoding="UTF-8" standalone="no"?>
++<project>
++ <configuration id="cdt.managedbuild.config.gnu.cross.exe.debug.452878522" name="Debug">
++ <extension point="org.eclipse.cdt.core.LanguageSettingsProvider">
++ <provider copy-of="extension" id="org.eclipse.cdt.ui.UserLanguageSettingsProvider"/>
++ <provider-reference id="org.eclipse.cdt.core.ReferencedProjectsLanguageSettingsProvider" ref="shared-provider"/>
++ <provider-reference id="org.eclipse.cdt.managedbuilder.core.MBSLanguageSettingsProvider" ref="shared-provider"/>
++ <provider class="org.eclipse.cdt.managedbuilder.internal.language.settings.providers.GCCBuiltinSpecsDetectorCygwin" console="false" env-hash="1253352314297216180" id="org.eclipse.cdt.managedbuilder.core.GCCBuiltinSpecsDetectorCygwin" keep-relative-paths="false" name="CDT GCC Built-in Compiler Settings Cygwin" parameter="${COMMAND} ${FLAGS} -E -P -v -dD "${INPUTS}"" prefer-non-shared="true">
++ <language-scope id="org.eclipse.cdt.core.gcc"/>
++ <language-scope id="org.eclipse.cdt.core.g++"/>
++ </provider>
++ </extension>
++ </configuration>
++ <configuration id="cdt.managedbuild.config.gnu.cross.exe.release.811454954" name="Release">
++ <extension point="org.eclipse.cdt.core.LanguageSettingsProvider">
++ <provider copy-of="extension" id="org.eclipse.cdt.ui.UserLanguageSettingsProvider"/>
++ <provider-reference id="org.eclipse.cdt.core.ReferencedProjectsLanguageSettingsProvider" ref="shared-provider"/>
++ <provider-reference id="org.eclipse.cdt.managedbuilder.core.MBSLanguageSettingsProvider" ref="shared-provider"/>
++ <provider class="org.eclipse.cdt.internal.build.crossgcc.CrossGCCBuiltinSpecsDetector" console="false" env-hash="-910044784883564564" id="org.eclipse.cdt.build.crossgcc.CrossGCCBuiltinSpecsDetector" keep-relative-paths="false" name="CDT Cross GCC Built-in Compiler Settings" parameter="${COMMAND} ${FLAGS} -E -P -v -dD "${INPUTS}"" prefer-non-shared="true">
++ <language-scope id="org.eclipse.cdt.core.gcc"/>
++ <language-scope id="org.eclipse.cdt.core.g++"/>
++ </provider>
++ </extension>
++ </configuration>
++</project>
+diff --git a/.settings/org.eclipse.cdt.codan.core.prefs b/.settings/org.eclipse.cdt.codan.core.prefs
+new file mode 100755
+index 000000000000..b5248c620107
+--- /dev/null
++++ .settings/org.eclipse.cdt.codan.core.prefs
+@@ -0,0 +1,71 @@
++eclipse.preferences.version=1
++org.eclipse.cdt.codan.checkers.errnoreturn=Warning
++org.eclipse.cdt.codan.checkers.errnoreturn.params={launchModes\=>{RUN_ON_FULL_BUILD\=>true,RUN_ON_INC_BUILD\=>true,RUN_ON_FILE_OPEN\=>false,RUN_ON_FILE_SAVE\=>false,RUN_AS_YOU_TYPE\=>true,RUN_ON_DEMAND\=>true},suppression_comment\=>"@suppress(\\"No return\\")",implicit\=>false}
++org.eclipse.cdt.codan.checkers.errreturnvalue=Error
++org.eclipse.cdt.codan.checkers.errreturnvalue.params={launchModes\=>{RUN_ON_FULL_BUILD\=>true,RUN_ON_INC_BUILD\=>true,RUN_ON_FILE_OPEN\=>false,RUN_ON_FILE_SAVE\=>false,RUN_AS_YOU_TYPE\=>true,RUN_ON_DEMAND\=>true},suppression_comment\=>"@suppress(\\"Unused return value\\")"}
++org.eclipse.cdt.codan.checkers.nocommentinside=-Error
++org.eclipse.cdt.codan.checkers.nocommentinside.params={launchModes\=>{RUN_ON_FULL_BUILD\=>true,RUN_ON_INC_BUILD\=>true,RUN_ON_FILE_OPEN\=>false,RUN_ON_FILE_SAVE\=>false,RUN_AS_YOU_TYPE\=>true,RUN_ON_DEMAND\=>true},suppression_comment\=>"@suppress(\\"Nesting comments\\")"}
++org.eclipse.cdt.codan.checkers.nolinecomment=-Error
++org.eclipse.cdt.codan.checkers.nolinecomment.params={launchModes\=>{RUN_ON_FULL_BUILD\=>true,RUN_ON_INC_BUILD\=>true,RUN_ON_FILE_OPEN\=>false,RUN_ON_FILE_SAVE\=>false,RUN_AS_YOU_TYPE\=>true,RUN_ON_DEMAND\=>true},suppression_comment\=>"@suppress(\\"Line comments\\")"}
++org.eclipse.cdt.codan.checkers.noreturn=Error
++org.eclipse.cdt.codan.checkers.noreturn.params={launchModes\=>{RUN_ON_FULL_BUILD\=>true,RUN_ON_INC_BUILD\=>true,RUN_ON_FILE_OPEN\=>false,RUN_ON_FILE_SAVE\=>false,RUN_AS_YOU_TYPE\=>true,RUN_ON_DEMAND\=>true},suppression_comment\=>"@suppress(\\"No return value\\")",implicit\=>false}
++org.eclipse.cdt.codan.internal.checkers.AbstractClassCreation=Error
++org.eclipse.cdt.codan.internal.checkers.AbstractClassCreation.params={launchModes\=>{RUN_ON_FULL_BUILD\=>true,RUN_ON_INC_BUILD\=>true,RUN_ON_FILE_OPEN\=>false,RUN_ON_FILE_SAVE\=>false,RUN_AS_YOU_TYPE\=>true,RUN_ON_DEMAND\=>true},suppression_comment\=>"@suppress(\\"Abstract class cannot be instantiated\\")"}
++org.eclipse.cdt.codan.internal.checkers.AmbiguousProblem=Error
++org.eclipse.cdt.codan.internal.checkers.AmbiguousProblem.params={launchModes\=>{RUN_ON_FULL_BUILD\=>true,RUN_ON_INC_BUILD\=>true,RUN_ON_FILE_OPEN\=>false,RUN_ON_FILE_SAVE\=>false,RUN_AS_YOU_TYPE\=>true,RUN_ON_DEMAND\=>true},suppression_comment\=>"@suppress(\\"Ambiguous problem\\")"}
++org.eclipse.cdt.codan.internal.checkers.AssignmentInConditionProblem=Warning
++org.eclipse.cdt.codan.internal.checkers.AssignmentInConditionProblem.params={launchModes\=>{RUN_ON_FULL_BUILD\=>true,RUN_ON_INC_BUILD\=>true,RUN_ON_FILE_OPEN\=>false,RUN_ON_FILE_SAVE\=>false,RUN_AS_YOU_TYPE\=>true,RUN_ON_DEMAND\=>true},suppression_comment\=>"@suppress(\\"Assignment in condition\\")"}
++org.eclipse.cdt.codan.internal.checkers.AssignmentToItselfProblem=Error
++org.eclipse.cdt.codan.internal.checkers.AssignmentToItselfProblem.params={launchModes\=>{RUN_ON_FULL_BUILD\=>true,RUN_ON_INC_BUILD\=>true,RUN_ON_FILE_OPEN\=>false,RUN_ON_FILE_SAVE\=>false,RUN_AS_YOU_TYPE\=>true,RUN_ON_DEMAND\=>true},suppression_comment\=>"@suppress(\\"Assignment to itself\\")"}
++org.eclipse.cdt.codan.internal.checkers.CaseBreakProblem=Warning
++org.eclipse.cdt.codan.internal.checkers.CaseBreakProblem.params={launchModes\=>{RUN_ON_FULL_BUILD\=>true,RUN_ON_INC_BUILD\=>true,RUN_ON_FILE_OPEN\=>false,RUN_ON_FILE_SAVE\=>false,RUN_AS_YOU_TYPE\=>true,RUN_ON_DEMAND\=>true},suppression_comment\=>"@suppress(\\"No break at end of case\\")",no_break_comment\=>"no break",last_case_param\=>false,empty_case_param\=>false}
++org.eclipse.cdt.codan.internal.checkers.CatchByReference=Warning
++org.eclipse.cdt.codan.internal.checkers.CatchByReference.params={launchModes\=>{RUN_ON_FULL_BUILD\=>true,RUN_ON_INC_BUILD\=>true,RUN_ON_FILE_OPEN\=>false,RUN_ON_FILE_SAVE\=>false,RUN_AS_YOU_TYPE\=>true,RUN_ON_DEMAND\=>true},suppression_comment\=>"@suppress(\\"Catching by reference is recommended\\")",unknown\=>false,exceptions\=>()}
++org.eclipse.cdt.codan.internal.checkers.CircularReferenceProblem=Error
++org.eclipse.cdt.codan.internal.checkers.CircularReferenceProblem.params={launchModes\=>{RUN_ON_FULL_BUILD\=>true,RUN_ON_INC_BUILD\=>true,RUN_ON_FILE_OPEN\=>false,RUN_ON_FILE_SAVE\=>false,RUN_AS_YOU_TYPE\=>true,RUN_ON_DEMAND\=>true},suppression_comment\=>"@suppress(\\"Circular inheritance\\")"}
++org.eclipse.cdt.codan.internal.checkers.ClassMembersInitialization=Warning
++org.eclipse.cdt.codan.internal.checkers.ClassMembersInitialization.params={launchModes\=>{RUN_ON_FULL_BUILD\=>true,RUN_ON_INC_BUILD\=>true,RUN_ON_FILE_OPEN\=>false,RUN_ON_FILE_SAVE\=>false,RUN_AS_YOU_TYPE\=>true,RUN_ON_DEMAND\=>true},suppression_comment\=>"@suppress(\\"Class members should be properly initialized\\")",skip\=>true}
++org.eclipse.cdt.codan.internal.checkers.FieldResolutionProblem=Error
++org.eclipse.cdt.codan.internal.checkers.FieldResolutionProblem.params={launchModes\=>{RUN_ON_FULL_BUILD\=>true,RUN_ON_INC_BUILD\=>true,RUN_ON_FILE_OPEN\=>false,RUN_ON_FILE_SAVE\=>false,RUN_AS_YOU_TYPE\=>true,RUN_ON_DEMAND\=>true},suppression_comment\=>"@suppress(\\"Field cannot be resolved\\")"}
++org.eclipse.cdt.codan.internal.checkers.FunctionResolutionProblem=Error
++org.eclipse.cdt.codan.internal.checkers.FunctionResolutionProblem.params={launchModes\=>{RUN_ON_FULL_BUILD\=>true,RUN_ON_INC_BUILD\=>true,RUN_ON_FILE_OPEN\=>false,RUN_ON_FILE_SAVE\=>false,RUN_AS_YOU_TYPE\=>true,RUN_ON_DEMAND\=>true},suppression_comment\=>"@suppress(\\"Function cannot be resolved\\")"}
++org.eclipse.cdt.codan.internal.checkers.InvalidArguments=Error
++org.eclipse.cdt.codan.internal.checkers.InvalidArguments.params={launchModes\=>{RUN_ON_FULL_BUILD\=>true,RUN_ON_INC_BUILD\=>true,RUN_ON_FILE_OPEN\=>false,RUN_ON_FILE_SAVE\=>false,RUN_AS_YOU_TYPE\=>true,RUN_ON_DEMAND\=>true},suppression_comment\=>"@suppress(\\"Invalid arguments\\")"}
++org.eclipse.cdt.codan.internal.checkers.InvalidTemplateArgumentsProblem=Error
++org.eclipse.cdt.codan.internal.checkers.InvalidTemplateArgumentsProblem.params={launchModes\=>{RUN_ON_FULL_BUILD\=>true,RUN_ON_INC_BUILD\=>true,RUN_ON_FILE_OPEN\=>false,RUN_ON_FILE_SAVE\=>false,RUN_AS_YOU_TYPE\=>true,RUN_ON_DEMAND\=>true},suppression_comment\=>"@suppress(\\"Invalid template argument\\")"}
++org.eclipse.cdt.codan.internal.checkers.LabelStatementNotFoundProblem=Error
++org.eclipse.cdt.codan.internal.checkers.LabelStatementNotFoundProblem.params={launchModes\=>{RUN_ON_FULL_BUILD\=>true,RUN_ON_INC_BUILD\=>true,RUN_ON_FILE_OPEN\=>false,RUN_ON_FILE_SAVE\=>false,RUN_AS_YOU_TYPE\=>true,RUN_ON_DEMAND\=>true},suppression_comment\=>"@suppress(\\"Label statement not found\\")"}
++org.eclipse.cdt.codan.internal.checkers.MemberDeclarationNotFoundProblem=Error
++org.eclipse.cdt.codan.internal.checkers.MemberDeclarationNotFoundProblem.params={launchModes\=>{RUN_ON_FULL_BUILD\=>true,RUN_ON_INC_BUILD\=>true,RUN_ON_FILE_OPEN\=>false,RUN_ON_FILE_SAVE\=>false,RUN_AS_YOU_TYPE\=>true,RUN_ON_DEMAND\=>true},suppression_comment\=>"@suppress(\\"Member declaration not found\\")"}
++org.eclipse.cdt.codan.internal.checkers.MethodResolutionProblem=Error
++org.eclipse.cdt.codan.internal.checkers.MethodResolutionProblem.params={launchModes\=>{RUN_ON_FULL_BUILD\=>true,RUN_ON_INC_BUILD\=>true,RUN_ON_FILE_OPEN\=>false,RUN_ON_FILE_SAVE\=>false,RUN_AS_YOU_TYPE\=>true,RUN_ON_DEMAND\=>true},suppression_comment\=>"@suppress(\\"Method cannot be resolved\\")"}
++org.eclipse.cdt.codan.internal.checkers.NamingConventionFunctionChecker=-Info
++org.eclipse.cdt.codan.internal.checkers.NamingConventionFunctionChecker.params={launchModes\=>{RUN_ON_FULL_BUILD\=>true,RUN_ON_INC_BUILD\=>true,RUN_ON_FILE_OPEN\=>false,RUN_ON_FILE_SAVE\=>false,RUN_AS_YOU_TYPE\=>true,RUN_ON_DEMAND\=>true},suppression_comment\=>"@suppress(\\"Name convention for function\\")",pattern\=>"^[a-z]",macro\=>true,exceptions\=>()}
++org.eclipse.cdt.codan.internal.checkers.NonVirtualDestructorProblem=Warning
++org.eclipse.cdt.codan.internal.checkers.NonVirtualDestructorProblem.params={launchModes\=>{RUN_ON_FULL_BUILD\=>true,RUN_ON_INC_BUILD\=>true,RUN_ON_FILE_OPEN\=>false,RUN_ON_FILE_SAVE\=>false,RUN_AS_YOU_TYPE\=>true,RUN_ON_DEMAND\=>true},suppression_comment\=>"@suppress(\\"Class has a virtual method and non-virtual destructor\\")"}
++org.eclipse.cdt.codan.internal.checkers.OverloadProblem=Error
++org.eclipse.cdt.codan.internal.checkers.OverloadProblem.params={launchModes\=>{RUN_ON_FULL_BUILD\=>true,RUN_ON_INC_BUILD\=>true,RUN_ON_FILE_OPEN\=>false,RUN_ON_FILE_SAVE\=>false,RUN_AS_YOU_TYPE\=>true,RUN_ON_DEMAND\=>true},suppression_comment\=>"@suppress(\\"Invalid overload\\")"}
++org.eclipse.cdt.codan.internal.checkers.RedeclarationProblem=Error
++org.eclipse.cdt.codan.internal.checkers.RedeclarationProblem.params={launchModes\=>{RUN_ON_FULL_BUILD\=>true,RUN_ON_INC_BUILD\=>true,RUN_ON_FILE_OPEN\=>false,RUN_ON_FILE_SAVE\=>false,RUN_AS_YOU_TYPE\=>true,RUN_ON_DEMAND\=>true},suppression_comment\=>"@suppress(\\"Invalid redeclaration\\")"}
++org.eclipse.cdt.codan.internal.checkers.RedefinitionProblem=Error
++org.eclipse.cdt.codan.internal.checkers.RedefinitionProblem.params={launchModes\=>{RUN_ON_FULL_BUILD\=>true,RUN_ON_INC_BUILD\=>true,RUN_ON_FILE_OPEN\=>false,RUN_ON_FILE_SAVE\=>false,RUN_AS_YOU_TYPE\=>true,RUN_ON_DEMAND\=>true},suppression_comment\=>"@suppress(\\"Invalid redefinition\\")"}
++org.eclipse.cdt.codan.internal.checkers.ReturnStyleProblem=-Warning
++org.eclipse.cdt.codan.internal.checkers.ReturnStyleProblem.params={launchModes\=>{RUN_ON_FULL_BUILD\=>true,RUN_ON_INC_BUILD\=>true,RUN_ON_FILE_OPEN\=>false,RUN_ON_FILE_SAVE\=>false,RUN_AS_YOU_TYPE\=>true,RUN_ON_DEMAND\=>true},suppression_comment\=>"@suppress(\\"Return with parenthesis\\")"}
++org.eclipse.cdt.codan.internal.checkers.ScanfFormatStringSecurityProblem=-Warning
++org.eclipse.cdt.codan.internal.checkers.ScanfFormatStringSecurityProblem.params={launchModes\=>{RUN_ON_FULL_BUILD\=>true,RUN_ON_INC_BUILD\=>true,RUN_ON_FILE_OPEN\=>false,RUN_ON_FILE_SAVE\=>false,RUN_AS_YOU_TYPE\=>true,RUN_ON_DEMAND\=>true},suppression_comment\=>"@suppress(\\"Format String Vulnerability\\")"}
++org.eclipse.cdt.codan.internal.checkers.StatementHasNoEffectProblem=Warning
++org.eclipse.cdt.codan.internal.checkers.StatementHasNoEffectProblem.params={launchModes\=>{RUN_ON_FULL_BUILD\=>true,RUN_ON_INC_BUILD\=>true,RUN_ON_FILE_OPEN\=>false,RUN_ON_FILE_SAVE\=>false,RUN_AS_YOU_TYPE\=>true,RUN_ON_DEMAND\=>true},suppression_comment\=>"@suppress(\\"Statement has no effect\\")",macro\=>true,exceptions\=>()}
++org.eclipse.cdt.codan.internal.checkers.SuggestedParenthesisProblem=Warning
++org.eclipse.cdt.codan.internal.checkers.SuggestedParenthesisProblem.params={launchModes\=>{RUN_ON_FULL_BUILD\=>true,RUN_ON_INC_BUILD\=>true,RUN_ON_FILE_OPEN\=>false,RUN_ON_FILE_SAVE\=>false,RUN_AS_YOU_TYPE\=>true,RUN_ON_DEMAND\=>true},suppression_comment\=>"@suppress(\\"Suggested parenthesis around expression\\")",paramNot\=>false}
++org.eclipse.cdt.codan.internal.checkers.SuspiciousSemicolonProblem=Warning
++org.eclipse.cdt.codan.internal.checkers.SuspiciousSemicolonProblem.params={launchModes\=>{RUN_ON_FULL_BUILD\=>true,RUN_ON_INC_BUILD\=>true,RUN_ON_FILE_OPEN\=>false,RUN_ON_FILE_SAVE\=>false,RUN_AS_YOU_TYPE\=>true,RUN_ON_DEMAND\=>true},suppression_comment\=>"@suppress(\\"Suspicious semicolon\\")",else\=>false,afterelse\=>false}
++org.eclipse.cdt.codan.internal.checkers.TypeResolutionProblem=Error
++org.eclipse.cdt.codan.internal.checkers.TypeResolutionProblem.params={launchModes\=>{RUN_ON_FULL_BUILD\=>true,RUN_ON_INC_BUILD\=>true,RUN_ON_FILE_OPEN\=>false,RUN_ON_FILE_SAVE\=>false,RUN_AS_YOU_TYPE\=>true,RUN_ON_DEMAND\=>true},suppression_comment\=>"@suppress(\\"Type cannot be resolved\\")"}
++org.eclipse.cdt.codan.internal.checkers.UnusedFunctionDeclarationProblem=Warning
++org.eclipse.cdt.codan.internal.checkers.UnusedFunctionDeclarationProblem.params={launchModes\=>{RUN_ON_FULL_BUILD\=>true,RUN_ON_INC_BUILD\=>true,RUN_ON_FILE_OPEN\=>false,RUN_ON_FILE_SAVE\=>false,RUN_AS_YOU_TYPE\=>true,RUN_ON_DEMAND\=>true},suppression_comment\=>"@suppress(\\"Unused function declaration\\")",macro\=>true}
++org.eclipse.cdt.codan.internal.checkers.UnusedStaticFunctionProblem=Warning
++org.eclipse.cdt.codan.internal.checkers.UnusedStaticFunctionProblem.params={launchModes\=>{RUN_ON_FULL_BUILD\=>true,RUN_ON_INC_BUILD\=>true,RUN_ON_FILE_OPEN\=>false,RUN_ON_FILE_SAVE\=>false,RUN_AS_YOU_TYPE\=>true,RUN_ON_DEMAND\=>true},suppression_comment\=>"@suppress(\\"Unused static function\\")",macro\=>true}
++org.eclipse.cdt.codan.internal.checkers.UnusedVariableDeclarationProblem=Warning
++org.eclipse.cdt.codan.internal.checkers.UnusedVariableDeclarationProblem.params={launchModes\=>{RUN_ON_FULL_BUILD\=>true,RUN_ON_INC_BUILD\=>true,RUN_ON_FILE_OPEN\=>false,RUN_ON_FILE_SAVE\=>false,RUN_AS_YOU_TYPE\=>true,RUN_ON_DEMAND\=>true},suppression_comment\=>"@suppress(\\"Unused variable declaration in file scope\\")",macro\=>true,exceptions\=>("@(\#)","$Id")}
++org.eclipse.cdt.codan.internal.checkers.VariableResolutionProblem=Error
++org.eclipse.cdt.codan.internal.checkers.VariableResolutionProblem.params={launchModes\=>{RUN_ON_FULL_BUILD\=>true,RUN_ON_INC_BUILD\=>true,RUN_ON_FILE_OPEN\=>false,RUN_ON_FILE_SAVE\=>false,RUN_AS_YOU_TYPE\=>true,RUN_ON_DEMAND\=>true},suppression_comment\=>"@suppress(\\"Symbol is not resolved\\")"}
+diff --git a/.settings/org.eclipse.cdt.core.prefs b/.settings/org.eclipse.cdt.core.prefs
+new file mode 100755
+index 000000000000..8ec9fe72ca59
+--- /dev/null
++++ .settings/org.eclipse.cdt.core.prefs
+@@ -0,0 +1,6 @@
++eclipse.preferences.version=1
++environment/project/cdt.managedbuild.config.gnu.cross.exe.debug.452878522/PATH/delimiter=;
++environment/project/cdt.managedbuild.config.gnu.cross.exe.debug.452878522/PATH/operation=replace
++environment/project/cdt.managedbuild.config.gnu.cross.exe.debug.452878522/PATH/value=C\:\\WINDOWS\\system32;C\:\\WINDOWS;C\:\\Program Files\\SlikSvn\\bin;C\:\\WINDOWS\\System32\\WindowsPowerShell\\v1.0;c\:\\cygwin\\bin;D\:\\develop\\workspaces\\c1\\amigaos-cross-toolchain\\m68k-amigaos\\bin
++environment/project/cdt.managedbuild.config.gnu.cross.exe.debug.452878522/append=true
++environment/project/cdt.managedbuild.config.gnu.cross.exe.debug.452878522/appendContributed=true
+diff --git a/.settings/org.eclipse.core.runtime.prefs b/.settings/org.eclipse.core.runtime.prefs
+new file mode 100755
+index 000000000000..12511e62a174
+--- /dev/null
++++ .settings/org.eclipse.core.runtime.prefs
+@@ -0,0 +1,5 @@
++content-types/enabled=true
++content-types/org.eclipse.cdt.core.cHeader/file-extensions=def
++content-types/org.eclipse.cdt.core.cxxHeader/file-extensions=h
++content-types/org.eclipse.cdt.core.cxxSource/file-extensions=c
++eclipse.preferences.version=1
+diff --git a/config.sub b/config.sub
+index 41146e11c6c9..35247fe0c474 100755
+--- config.sub
++++ config.sub
+@@ -2,7 +2,7 @@
+ # Configuration validation subroutine script.
+ # Copyright 1992-2016 Free Software Foundation, Inc.
- const char *fmt = GET_RTX_FORMAT(code);
-@@ -542,6 +544,7 @@ update_insn_infos (void)
- if (pass && infos[pos].contains (ii))
- break;
+-timestamp='2016-01-01'
++timestamp='2017-04-21'
-+ ii._hard = 0;
- ii |= infos[pos];
+ # This file is free software; you can redistribute it and/or modify it
+ # under the terms of the GNU General Public License as published by
+@@ -500,7 +500,7 @@ case $basic_machine in
+ amiga | amiga-*)
+ basic_machine=m68k-unknown
+ ;;
+- amigaos | amigados)
++ amigaos | amigaosvasm | amigados)
+ basic_machine=m68k-unknown
+ os=-amigaos
+ ;;
+@@ -1380,7 +1380,7 @@ case $os in
+ | -amigaos* | -amigados* | -msdos* | -newsos* | -unicos* | -aof* \
+ | -aos* | -aros* | -cloudabi* | -sortix* \
+ | -nindy* | -vxsim* | -vxworks* | -ebmon* | -hms* | -mvs* \
+- | -clix* | -riscos* | -uniplus* | -iris* | -rtu* | -xenix* \
++ | -clix* | -riscos* | -uniplus* | -iris* | -rt* | -xenix* \
+ | -hiux* | -386bsd* | -knetbsd* | -mirbsd* | -netbsd* \
+ | -bitrig* | -openbsd* | -solidbsd* \
+ | -ekkobsd* | -kfreebsd* | -freebsd* | -riscix* | -lynxos* \
+diff --git a/gcc/Makefile.in b/gcc/Makefile.in
+index 51e2bc86e9a4..4aedf54bab12 100644
+--- gcc/Makefile.in
++++ gcc/Makefile.in
+@@ -1199,6 +1199,7 @@ OBJS = \
+ auto-inc-dec.o \
+ auto-profile.o \
+ bb-reorder.o \
++ bbb-opts.o \
+ bitmap.o \
+ bt-load.o \
+ builtins.o \
+@@ -1986,7 +1987,7 @@ gcc-nm.c: gcc-ar.c
+ cp $^ $@
- if (LABEL_P(insn))
-@@ -646,7 +649,7 @@ update_insn_infos (void)
- use.scan (pattern);
- if (single_set (insn) == 0)
- use._hard = use._use | use._def;
--
-+ else
- /* if not cc0 defined check for mod. */
- if (!use.is_def (FIRST_PSEUDO_REGISTER))
- {
-@@ -684,6 +687,34 @@ bit2regno (unsigned bit)
- return regno;
- }
+ COLLECT2_OBJS = collect2.o collect2-aix.o tlink.o vec.o ggc-none.o \
+- collect-utils.o file-find.o hash-table.o
++ collect-utils.o file-find.o hash-table.o $(EXTRA_COLLECT2_OBJS)
+ COLLECT2_LIBS = @COLLECT2_LIBS@
+ collect2$(exeext): $(COLLECT2_OBJS) $(LIBDEPS)
+ # Don't try modifying collect2 (aka ld) in place--it might be linking this.
+@@ -3270,7 +3271,7 @@ endif
+ install-strip: install
-+static unsigned
-+find_start (std::set<unsigned> & found, unsigned start, unsigned rename_regno)
+ # Handle cpp installation.
+-install-cpp: installdirs cpp$(exeext)
++install-cpp: installdirs cpp$(exeext) all.cross
+ -if test "$(enable_as_accelerator)" != "yes" ; then \
+ rm -f $(DESTDIR)$(bindir)/$(CPP_INSTALL_NAME)$(exeext); \
+ $(INSTALL_PROGRAM) -m 755 cpp$(exeext) $(DESTDIR)$(bindir)/$(CPP_INSTALL_NAME)$(exeext); \
+diff --git a/gcc/amigacollect2.c b/gcc/amigacollect2.c
+new file mode 100755
+index 000000000000..941ea0248fbe
+--- /dev/null
++++ gcc/amigacollect2.c
+@@ -0,0 +1,348 @@
++/* GG-local whole file: dynamic libraries */
++/* Supplimentary functions that get compiled and linked to collect2 for
++ AmigaOS target.
++ Copyright (C) 1996 Free Software Foundation, Inc.
++
++This file is part of GCC.
++
++GCC 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, or (at your option)
++any later version.
++
++GCC 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 GCC; see the file COPYING. If not, write to
++the Free Software Foundation, 59 Temple Place - Suite 330,
++Boston, MA 02111-1307, USA. */
++
++#include "config.h"
++#include "system.h"
++#include "coretypes.h"
++#include "tm.h"
++
++/* From collect2.c: */
++
++void maybe_unlink(const char *);
++void fatal_error(location_t, const char *, ...);
++void fork_execute(const char *, char **, bool);
++
++extern char *c_file_name;
++extern int debug;
++
++/* Local functions. */
++
++static void safename (char *);
++static void add_lib (const char *);
++static void cat (const char *, FILE *);
++
++/* Names of temporary files we create. */
++#define XLIBS_C_NAME "xlibs.c"
++#define XLIBS_O_NAME "xlibs.o"
++#define SHARED_X_NAME "shared.x"
++
++/* Suffix which is prepended to "-l" options for dynamic libraries. */
++#define DYNAMIC_LIB_SUFFIX "_ixlibrary"
++
++/* Structure that holds library names. */
++struct liblist
+{
-+ /* search the start. */
-+ while (start < 0)
-+ {
-+ unsigned startm1 = start - 1;
++ struct liblist *next;
++ char *name;
++ char *cname;
++};
+
-+ /* already searched. */
-+ if (found.find (startm1) != found.end ())
-+ break;
++/* Not zero if "-static" was specified on GCC command line or if all the
++ libraries are static. */
++static int flag_static=0;
+
-+ /* do not run over RETURNS */
-+ rtx_insn * before = insns[startm1];
-+ if (JUMP_P(before) && ANY_RETURN_P(PATTERN (before)))
-+ break;
++/* Not zero if linking a base relative executable. This is recognized by
++ presence of "-m amiga_bss" on the linker's commandline. */
++static int flag_baserel=0;
+
-+ start = startm1;
++/* Not zero if some of the specified libraries are dynamic. */
++static int found_dynamic_libs=0;
+
-+ /* found the definition without use. */
-+ insn_info & jj = infos[start];
-+ if (jj.is_def (rename_regno) && !jj.is_use (rename_regno))
-+ break;
++/* List of linker libraries. */
++struct liblist *head = NULL;
++
++/* Return 1 if collect2 should do something more apart from tlink. We want it
++ to call "postlink" and "strip" if linking with dynamic libraries. */
++
++int
++amigaos_do_collecting (void)
++{
++ return !flag_static;
++}
++
++/* Check for presence of "-static" on the GCC command line. We should not do
++ collecting if this flag was specified. */
++
++void
++amigaos_gccopts_hook (const char *arg)
++{
++ if (strncmp(arg, "-static", strlen("-static"))==0)
++ flag_static=1;
++}
+
++/* Replace unprintable characters with underscores. Used by "add_lib()". */
++
++static void
++safename (char *p)
++{
++ if (!ISALPHA(*p))
++ *p = '_';
++ p++;
++ while (*p)
++ {
++ if (!ISALNUM(*p))
++ *p = '_';
++ p++;
+ }
-+ return start;
+}
+
- /*
- * Always prefer lower register numbers within the class.
- */
-@@ -696,10 +727,12 @@ opt_reg_rename (void)
- insn_info & ii = infos[index];
-
- /* do not rename if register is hard or used in same statement. */
-- const unsigned toRename = ii._def & ~ii._hard & ~ii._use;
-- if (!toRename)
-+ const unsigned rename_regbit = ii._def & ~ii._hard & ~ii._use;
-+ if (!rename_regbit)
- continue;
-
-+ const unsigned rename_regno = bit2regno (rename_regbit);
++/* Add a library to the list of dynamic libraries. First make sure that the
++ library is actually dynamic. Used by "amigaos_libname_hook()". */
+
- /* get the mask for free registers. */
- unsigned mask = ii.get_free_mask ();
- if (!mask)
-@@ -717,11 +750,36 @@ opt_reg_rename (void)
- unsigned pos = todo[todo.size () - 1];
- todo.pop_back ();
-
-+ /* already searched. */
- if (found.find (pos) != found.end ())
- continue;
-
-- if (LABEL_P(insns[pos]))
-+ rtx_insn * insn = insns[pos];
-+ if (LABEL_P(insn))
- {
-+ found.insert (pos);
++static void
++add_lib (const char *name)
++{
++ struct liblist *lib;
++ static char buf[256];
+
-+ /* for each jump to this label:
-+ * check if the reg was used at that jump.
-+ * if used, find def
-+ */
-+ for (std::vector<rtx_insn *>::iterator i = jumps.begin (); i != jumps.end (); ++i)
-+ {
-+ if (JUMP_LABEL(*i) == insn)
-+ {
-+ std::map<rtx_insn *, unsigned>::iterator j = insn2index.find (*i);
-+ if (j == insn2index.end ())
-+ continue;
++ for (lib = head; lib; lib = lib->next)
++ if (!strcmp(lib->name, name))
++ return;
+
-+ unsigned start = j->second;
-+ if (!infos[start].is_use (rename_regno))
-+ continue;
++ /* A2IXDIR_PREFIX is passed by "make". */
++ sprintf(buf, A2IXDIR_PREFIX "/ldscripts/%s.x", name);
++ if (access(buf, R_OK))
++ return;
++
++ lib = (struct liblist*)xmalloc(sizeof(struct liblist));
++ lib->name = xstrdup(name);
++ lib->cname = xstrdup(name);
++ safename(lib->cname);
++ lib->next = head;
++ head = lib;
++
++ if (debug)
++ fprintf(stderr, "found dynamic library, name: %s, cname: %s\n", lib->name,
++ lib->cname);
++
++ found_dynamic_libs=1;
++}
++
++/* Check if the argument is a linker library. Call "add_lib()" if yes. */
++
++void
++amigaos_libname_hook (const char *arg)
++{
++ int len = strlen(arg);
++ if (flag_static)
++ return;
++
++ if (len > 2 && !memcmp(arg, "-l", 2))
++ add_lib(arg + 2);
++ else if (len > 2 && !strcmp(arg + len - 2, ".a"))
++ {
++ const char *lib;
++
++ ((char*)arg)[len - 2] = '\0';
++ lib = strrchr(arg, '/');
++ if (lib == NULL)
++ lib = strrchr(arg, ':');
++ if (lib == NULL)
++ lib = arg - 1;
++ if (!strncmp(lib + 1, "lib", 3))
++ add_lib(lib + 4);
++ ((char *)arg)[len - 2] = '.';
++ }
++}
++
++/* Delete temporary files. */
++
++void
++amigaos_collect2_cleanup (void)
++{
++ if (flag_static)
++ return;
++ maybe_unlink(XLIBS_C_NAME);
++ maybe_unlink(XLIBS_O_NAME);
++ maybe_unlink(SHARED_X_NAME);
++}
++
++/* Copy file named by FNAME to X. */
+
-+ start = find_start (found, start, rename_regno);
-+ todo.push_back (start);
-+ }
-+ }
++static void
++cat (const char *fname, FILE *x)
++{
++#define BUFSIZE 16384
++ FILE *in;
++ static char buf[BUFSIZE];
++ int bytes;
++
++ in = fopen(fname, "r");
++ if (in == NULL)
++ fatal_error (input_location, "%s", fname);
++ while (!feof(in) && (bytes = fread(buf, 1, BUFSIZE, in)))
++ fwrite(buf, 1, bytes, x);
++ fclose(in);
++}
+
- if (pos + 1 < insns.size ())
- todo.push_back (pos + 1);
- continue;
-@@ -730,18 +788,18 @@ opt_reg_rename (void)
- insn_info & jj = infos[pos];
-
- /* marked as hard reg -> invalid rename */
-- if (jj._hard & toRename)
-+ if (jj._hard & rename_regbit)
- mask = 0;
-
- /* defined again -> invalid rename */
-- if ((jj._def & toRename) && !(jj._use & toRename))
-+ if ((jj._def & rename_regbit) && !(jj._use & rename_regbit))
- mask = 0;
-
- if (!mask)
- break;
-
- /* not used. */
-- if (!(jj._use & toRename))
-+ if (!(jj._use & rename_regbit))
- continue;
-
- /* update free regs. */
-@@ -753,17 +811,41 @@ opt_reg_rename (void)
- found.insert (pos);
-
- /* follow jump and/or next insn. */
-- rtx_insn * insn = insns[pos];
- if (JUMP_P(insn))
- {
- std::map<rtx_insn *, unsigned>::iterator j = insn2index.find ((rtx_insn *) JUMP_LABEL(insn));
-- if (j != insn2index.end ())
-- todo.push_back (j->second);
-+ if (j == insn2index.end ())
-+ {
-+ /* whoops - label not found. */
-+ todo.clear ();
-+ mask = 0;
-+ break;
-+ }
-
-+ unsigned label_index = j->second;
-+ if (found.find (label_index) == found.end ())
-+ {
-+ /* if the rename_reg is used in the insn before.
-+ * search the start.
-+ */
-+ if (label_index > 0)
-+ {
-+ insn_info & bb = infos[label_index - 1];
-+ if (bb.is_use (rename_regbit))
-+ {
-+ unsigned start = find_start (found, label_index - 1, rename_regno);
-+ todo.push_back (start);
-+ }
-+ }
-+ todo.push_back (label_index);
-+ }
- rtx jmppattern = PATTERN (insn);
- if (GET_CODE(jmppattern) == PARALLEL)
- {
-- return 0; /* can't handle yet. Abort renaming. */
-+ /* can't handle yet. Abort renaming. */
-+ todo.clear ();
-+ mask = 0;
-+ break;
- }
-
- rtx jmpsrc = XEXP(jmppattern, 1);
-@@ -777,7 +859,7 @@ opt_reg_rename (void)
-
- if (mask)
- {
-- int oldregno = bit2regno (toRename);
-+ int oldregno = bit2regno (rename_regbit);
- int newregno = bit2regno (mask);
-
- /* check the renamed insns. */
-@@ -812,7 +894,8 @@ opt_reg_rename (void)
- if (!ok)
- continue;
-
-- log ("opt_reg_rename %s -> %s (%d locs)\n", reg_names[oldregno], reg_names[newregno], patch.size ());
-+ log ("opt_reg_rename %s -> %s (%d locs, start at %d)\n", reg_names[oldregno], reg_names[newregno],
-+ patch.size (), index);
-
- /* apply all changes. */
- for (std::vector<std::pair<rtx *, rtx> >::iterator j = patch.begin (); j != patch.end (); ++j)
-
-From ee7031d5d1442ca1e933b3cb029f91ba1534354d Mon Sep 17 00:00:00 2001
-From: bebbo <bebbo(a)bejy.net>
-Date: Tue, 25 Apr 2017 11:30:06 +0200
-Subject: [PATCH 089/303] @B fix regrename...
-
----
- gcc/bbb-opts.c | 2 +-
- 1 file changed, 1 insertion(+), 1 deletion(-)
-
-diff --git a/gcc/bbb-opts.c b/gcc/bbb-opts.c
-index db99815fee58..3e6c316149b0 100755
---- gcc/bbb-opts.c
-+++ gcc/bbb-opts.c
-@@ -691,7 +691,7 @@ static unsigned
- find_start (std::set<unsigned> & found, unsigned start, unsigned rename_regno)
- {
- /* search the start. */
-- while (start < 0)
-+ while (start > 0)
- {
- unsigned startm1 = start - 1;
-
-
-From e550db50f02dfa9bcfdf533e664ab032fca2a235 Mon Sep 17 00:00:00 2001
-From: bebbo <bebbo(a)bejy.net>
-Date: Tue, 25 Apr 2017 12:42:11 +0200
-Subject: [PATCH 090/303] @R add target 'amigaosvasm' from
- https://github.com/alpine9000/gcc
-
----
- config.sub | 6 ++--
- gcc/config.gcc | 10 ++++++
- gcc/config/m68k/amigaos.c | 19 ++++++++++-
- gcc/config/m68k/m68k.c | 17 +++++++++-
- gcc/config/m68k/m68k.h | 78 +++++++++++++++++++++++++++++++++++++++++--
- gcc/config/m68k/m68kamigaos.h | 66 ++++++++++++++++++++++++++++++++++--
- 6 files changed, 185 insertions(+), 11 deletions(-)
-
-diff --git a/config.sub b/config.sub
-index 41146e11c6c9..35247fe0c474 100755
---- config.sub
-+++ config.sub
-@@ -2,7 +2,7 @@
- # Configuration validation subroutine script.
- # Copyright 1992-2016 Free Software Foundation, Inc.
-
--timestamp='2016-01-01'
-+timestamp='2017-04-21'
-
- # This file is free software; you can redistribute it and/or modify it
- # under the terms of the GNU General Public License as published by
-@@ -500,7 +500,7 @@ case $basic_machine in
- amiga | amiga-*)
- basic_machine=m68k-unknown
- ;;
-- amigaos | amigados)
-+ amigaos | amigaosvasm | amigados)
- basic_machine=m68k-unknown
- os=-amigaos
- ;;
-@@ -1380,7 +1380,7 @@ case $os in
- | -amigaos* | -amigados* | -msdos* | -newsos* | -unicos* | -aof* \
- | -aos* | -aros* | -cloudabi* | -sortix* \
- | -nindy* | -vxsim* | -vxworks* | -ebmon* | -hms* | -mvs* \
-- | -clix* | -riscos* | -uniplus* | -iris* | -rtu* | -xenix* \
-+ | -clix* | -riscos* | -uniplus* | -iris* | -rt* | -xenix* \
- | -hiux* | -386bsd* | -knetbsd* | -mirbsd* | -netbsd* \
- | -bitrig* | -openbsd* | -solidbsd* \
- | -ekkobsd* | -kfreebsd* | -freebsd* | -riscix* | -lynxos* \
-diff --git a/gcc/config.gcc b/gcc/config.gcc
-index 762594c073ae..0beee32c863c 100644
---- gcc/config.gcc
-+++ gcc/config.gcc
-@@ -1936,6 +1936,16 @@ m68k-*-elf* | fido-*-elf*)
- ;;
- esac
- ;;
-+m68k*-*-amigaosvasm*)
-+ default_m68k_cpu=68000
-+ tm_file="${tm_file} dbx.h newlib-stdint.h m68k/m68kamigaos.h"
-+ tm_defines="${tm_defines} MOTOROLA=1 TARGET_AMIGAOS TARGET_AMIGAOS_VASM TARGET_CPU_DEFAULT=0"
-+ tmake_file="m68k/t-floatlib m68k/t-m68kbare m68k/t-amigaos"
-+ tm_p_file="${tm_p_file} m68k/amigaos-protos.h"
-+ extra_objs=amigaos.o
-+ extra_options="${extra_options} m68k/amigaos.opt"
-+ gnu_ld=yes
-+ ;;
- m68k*-*-amigaos*)
- default_m68k_cpu=68000
- tm_file="${tm_file} dbx.h newlib-stdint.h m68k/m68kamigaos.h"
-diff --git a/gcc/config/m68k/amigaos.c b/gcc/config/m68k/amigaos.c
-index c93188a3e90d..27831df2d543 100644
---- gcc/config/m68k/amigaos.c
-+++ gcc/config/m68k/amigaos.c
-@@ -50,6 +50,7 @@
-
- //int amiga_declare_object;
-
++/* If no dynamic libraries were found, perform like "-static". Otherwise,
++ create "xlibs.c", "shared.x" and invoke "gcc" to create "xlibs.o". We also
++ have to adjust the linker commandline. */
+
- #if 0
- static int amigaos_put_in_text (tree);
- static rtx gen_stack_management_call (rtx, rtx, const char *);
-@@ -783,7 +784,7 @@ amigaos_rtx_costs (rtx x, machine_mode mode, int outer_code, int opno, int *tota
- }
-
- /* Output assembly to switch to section NAME with attribute FLAGS. */
--
-+#ifndef TARGET_AMIGAOS_VASM
- extern void
- amiga_named_section (const char *name, unsigned int flags, tree decl ATTRIBUTE_UNUSED)
- {
-@@ -791,6 +792,22 @@ amiga_named_section (const char *name, unsigned int flags, tree decl ATTRIBUTE_U
- name = ".text";
- fprintf (asm_out_file, "\t%s\n", name);
- }
-+#else
-+extern void
-+amiga_named_section (const char *name, unsigned int flags, tree decl ATTRIBUTE_UNUSED)
++void
++amigaos_prelink_hook (const char **ld1_argv, int *strip_flag)
+{
-+ if (0 == strncmp(".text", name, 5))
-+ name = ".text";
++ if (flag_static)
++ return;
+
-+ if (0 == strncmp("section ", name, 8)) {
-+// fprintf (asm_out_file, "\t.section\t%s\n", name);
-+ fprintf (asm_out_file, "\t%s\n", name);
-+ } else {
-+ fprintf (asm_out_file, "\tsection %s\n", name);
-+ }
-+}
-+#endif
++ if (!found_dynamic_libs)
++ {
++ flag_static=1;
++ /* If the user has not requested "-static", but has requested "-s",
++ collect2 removes "-s" from the "ld1_argv", and calls "strip" after
++ linking. However, this would not be efficient if we linked the
++ executable without any dynamic library. In this case, we put "-s"
++ back. */
++ if (*strip_flag)
++ {
++ /* Add "-s" as the last argument on the command line. */
++ while (*ld1_argv)
++ ld1_argv++;
++ *ld1_argv++="-s";
++ *ld1_argv=0;
++ *strip_flag=0;
++ }
++ }
++ else
++ {
++ FILE *x, *out;
++ struct liblist *lib;
++ static const char* argv[]={0, "-c", XLIBS_C_NAME, 0};
++ const char **ld1_end, **ld1;
+
-
- /* Baserel support. */
-
-diff --git a/gcc/config/m68k/m68k.c b/gcc/config/m68k/m68k.c
-index 3fabe00a678a..8a40cbc2ab1f 100644
---- gcc/config/m68k/m68k.c
-+++ gcc/config/m68k/m68k.c
-@@ -191,7 +191,11 @@ static void m68k_init_sync_libfuncs (void) ATTRIBUTE_UNUSED;
-
- #if INT_OP_GROUP == INT_OP_DOT_WORD
- #undef TARGET_ASM_ALIGNED_HI_OP
-+#ifndef TARGET_AMIGAOS_VASM
- #define TARGET_ASM_ALIGNED_HI_OP "\t.word\t"
-+#else
-+#define TARGET_ASM_ALIGNED_HI_OP "\tdc.w\t"
-+#endif
- #endif
-
- #if INT_OP_GROUP == INT_OP_NO_DOT
-@@ -595,8 +599,11 @@ m68k_option_override (void)
- if (!flag_pic || flag_pic > 2)
- {
- m68k_symbolic_call_var = M68K_SYMBOLIC_CALL_JSR;
--
-+#ifndef TARGET_AMIGAOS_VASM
- m68k_symbolic_jump = "jra %a0";
-+#else
-+ m68k_symbolic_jump = "jmp %a0";
-+#endif
- }
- else if (TARGET_ID_SHARED_LIBRARY)
- /* All addresses must be loaded from the GOT. */
-@@ -1831,13 +1838,21 @@ output_btst (rtx *operands, rtx countop, rtx dataop, rtx_insn *insn, int signpos
- && next_insn_tests_no_inequality (insn))
- {
- cc_status.flags = CC_NOT_NEGATIVE | CC_Z_IN_NOT_N | CC_NO_OVERFLOW;
-+#ifndef TARGET_AMIGAOS_VASM
- return "move%.w %1,%%ccr";
-+#else
-+ return "move%.w %1,ccr";
-+#endif
- }
- if (count == 2 && DATA_REG_P (operands[1])
- && next_insn_tests_no_inequality (insn))
- {
- cc_status.flags = CC_NOT_NEGATIVE | CC_INVERTED | CC_NO_OVERFLOW;
-+#ifndef TARGET_AMIGAOS_VASM
- return "move%.w %1,%%ccr";
-+#else
-+ return "move%.w %1,ccr";
-+#endif
- }
- /* count == 1 followed by bvc/bvs and
- count == 0 followed by bcc/bcs are also possible, but need
-diff --git a/gcc/config/m68k/m68k.h b/gcc/config/m68k/m68k.h
-index 5142adf24e4d..200f07ef63a4 100644
---- gcc/config/m68k/m68k.h
-+++ gcc/config/m68k/m68k.h
-@@ -204,7 +204,11 @@ along with GCC; see the file COPYING3. If not see
- #define INT_OP_DC 3 /* dc.b, dc.w, dc.l */
-
- /* Set the default. */
-+#ifndef TARGET_AMIGAOS_VASM
- #define INT_OP_GROUP INT_OP_DOT_WORD
-+#else
-+#define INT_OP_GROUP INT_OP_DC
-+#endif
-
- /* Bit values used by m68k-devices.def to identify processor capabilities. */
- #define FL_BITFIELD (1 << 0) /* Support bitfield instructions. */
-@@ -729,9 +733,49 @@ do { if (cc_prev_status.flags & CC_IN_68881) \
- if (cc_prev_status.flags & CC_NO_OVERFLOW) \
- return NO_OV; \
- return NORMAL; } while (0)
++ /* Prepend suffixes to dynamic lib names. In addition, check if we are
++ linking a base relative executable. */
++ for (ld1=ld1_argv; *ld1; ld1++)
++ {
++ int len=strlen(*ld1);
++ if (strncmp(*ld1, "-l", strlen("-l"))==0)
++ {
++ for (lib=head; lib; lib=lib->next)
++ if (strcmp(*ld1+strlen("-l"), lib->name)==0)
++ {
++ char *newname=(char*)
++ xmalloc(strlen(*ld1)+strlen(DYNAMIC_LIB_SUFFIX)+1);
++ strcpy(newname, *ld1);
++ strcat(newname, DYNAMIC_LIB_SUFFIX);
++ *ld1=newname;
++ break;
++ }
++ }
++ else if (len > 2 && !strcmp(*ld1 + len - 2, ".a"))
++ {
++ const char *libname;
++ int substituted=0;
++
++ ((char *)(*ld1))[len - 2] = '\0';
++ libname = strrchr(*ld1, '/');
++ if (libname == NULL)
++ libname = strrchr(*ld1, ':');
++ if (libname == NULL)
++ libname = *ld1 - 1;
++ if (!strncmp(libname + 1, "lib", 3))
++ for (lib=head; lib; lib=lib->next)
++ if (strcmp(libname+4, lib->name)==0)
++ {
++ char *newname=(char*)xmalloc(strlen(*ld1)+
++ strlen(DYNAMIC_LIB_SUFFIX)+3);
++ strcpy(newname, *ld1);
++ strcat(newname, DYNAMIC_LIB_SUFFIX);
++ strcat(newname, ".a");
++ *ld1=newname;
++ substituted=1;
++ break;
++ }
++ if (!substituted)
++ ((char *)(*ld1))[len - 2] = '.';
++ }
++ else if (strcmp(ld1[0], "-m")==0 && ld1[1]
++ && strcmp(ld1[1], "amiga_bss")==0)
++ {
++ flag_baserel=1;
++ break;
++ }
++ }
+
-+#ifdef TARGET_AMIGAOS_VASM
-+#define ASM_OUTPUT_ASCII(MYFILE, MYSTRING, MYLENGTH) \
-+ do { \
-+ FILE *_hide_asm_out_file = (MYFILE); \
-+ const unsigned char *_hide_p = (const unsigned char *) (MYSTRING); \
-+ int _hide_thissize = (MYLENGTH); \
-+ { \
-+ FILE *asm_out_file = _hide_asm_out_file; \
-+ const unsigned char *p = _hide_p; \
-+ int thissize = _hide_thissize; \
-+ int i; \
-+ fprintf (asm_out_file, "\tdc.b \""); \
-+ \
-+ for (i = 0; i < thissize; i++) \
-+ { \
-+ int c = p[i]; \
-+ if (c == '\"' || c == '\\') \
-+ putc ('\\', asm_out_file); \
-+ if (ISPRINT (c)) \
-+ putc (c, asm_out_file); \
-+ else \
-+ { \
-+ fprintf (asm_out_file, "\\%o", c); \
-+ /* After an octal-escape, if a digit follows, \
-+ terminate one string constant and start another. \
-+ The VAX assembler fails to stop reading the escape \
-+ after three digits, so this is the only way we \
-+ can get it to parse the data properly. */ \
-+ if (i < thissize - 1 && ISDIGIT (p[i + 1])) \
-+ fprintf (asm_out_file, "\"\n\tdc.b \""); \
-+ } \
-+ } \
-+ fprintf (asm_out_file, "\"\n"); \
-+ } \
-+ } \
-+ while (0)
-+#endif
-
++ out = fopen(XLIBS_C_NAME, "w");
++ if (out == NULL)
++ fatal_error (input_location, "%s", XLIBS_C_NAME);
++ x = fopen(SHARED_X_NAME, "w");
++ if (x == NULL)
++ fatal_error (input_location, "%s", SHARED_X_NAME);
+
- /* Control the assembler format that we output. */
-
-+#ifndef TARGET_AMIGAOS_VASM
- #define ASM_APP_ON "#APP\n"
- #define ASM_APP_OFF "#NO_APP\n"
- #define TEXT_SECTION_ASM_OP "\t.text"
-@@ -741,6 +785,17 @@ do { if (cc_prev_status.flags & CC_IN_68881) \
- #define LOCAL_LABEL_PREFIX ""
- #define USER_LABEL_PREFIX "_"
- #define IMMEDIATE_PREFIX "#"
-+#else
-+#define ASM_APP_ON ""
-+#define ASM_APP_OFF ""
-+#define TEXT_SECTION_ASM_OP "\tsection .text"
-+#define DATA_SECTION_ASM_OP "\tsection .data"
-+#define GLOBAL_ASM_OP "\txdef\t"
-+#define REGISTER_PREFIX ""
-+#define LOCAL_LABEL_PREFIX "_."
-+#define USER_LABEL_PREFIX "_"
-+#define IMMEDIATE_PREFIX "#"
-+#endif
-
- #define REGISTER_NAMES \
- {REGISTER_PREFIX"d0", REGISTER_PREFIX"d1", REGISTER_PREFIX"d2", \
-@@ -860,11 +915,17 @@ do { if (cc_prev_status.flags & CC_IN_68881) \
-
- /* The m68k does not use absolute case-vectors, but we must define this macro
- anyway. */
--#define ASM_OUTPUT_ADDR_VEC_ELT(FILE, VALUE) \
-+#ifndef TARGET_AMIGAOS_VASM
-+#define ASM_OUTPUT_ADDR_VEC_ELT(FILE, VALUE) \
- asm_fprintf (FILE, "\t.long %LL%d\n", VALUE)
--
--#define ASM_OUTPUT_ADDR_DIFF_ELT(FILE, BODY, VALUE, REL) \
-+#define ASM_OUTPUT_ADDR_DIFF_ELT(FILE, BODY, VALUE, REL) \
- asm_fprintf (FILE, "\t.word %LL%d-%LL%d\n", VALUE, REL)
-+#else
-+#define ASM_OUTPUT_ADDR_VEC_ELT(FILE, VALUE) \
-+ asm_fprintf (FILE, "\tdc.l %LL%d\n", VALUE)
-+#define ASM_OUTPUT_ADDR_DIFF_ELT(FILE, BODY, VALUE, REL) \
-+ asm_fprintf (FILE, "\tdc.w %LL%d-%LL%d\n", VALUE, REL)
-+#endif
-
- /* We don't have a way to align to more than a two-byte boundary, so do the
- best we can and don't complain. */
-@@ -874,13 +935,24 @@ do { if (cc_prev_status.flags & CC_IN_68881) \
-
- #ifdef HAVE_GAS_BALIGN_AND_P2ALIGN
- /* Use "move.l %a4,%a4" to advance within code. */
-+#ifndef TARGET_AMIGAOS_VASM
- #define ASM_OUTPUT_ALIGN_WITH_NOP(FILE,LOG) \
- if ((LOG) > 0) \
- fprintf ((FILE), "\t.balignw %u,0x284c\n", 1 << (LOG));
- #endif
-+#else
-+#define ASM_OUTPUT_ALIGN_WITH_NOP(FILE,LOG) \
-+ if ((LOG) > 0) \
-+ fprintf ((FILE), "\tcnop 0,%u\n", 1 << (LOG));
-+#endif
-
-+#ifndef TARGET_AMIGAOS_VASM
- #define ASM_OUTPUT_SKIP(FILE,SIZE) \
- fprintf (FILE, "\t.skip %u\n", (int)(SIZE))
-+#else
-+#define ASM_OUTPUT_SKIP(FILE,SIZE) \
-+ fprintf (FILE, "\tds.b %u\n", (int)(SIZE))
-+#endif
-
- #define ASM_OUTPUT_COMMON(FILE, NAME, SIZE, ROUNDED) \
- ( fputs (".comm ", (FILE)), \
-diff --git a/gcc/config/m68k/m68kamigaos.h b/gcc/config/m68k/m68kamigaos.h
-index 20e0b66face2..3ca2cd666e7c 100644
---- gcc/config/m68k/m68kamigaos.h
-+++ gcc/config/m68k/m68kamigaos.h
-@@ -61,7 +61,11 @@ along with GCC; see the file COPYING3. If not see
- These labels will not appear in the symbol table. */
-
- #undef LOCAL_LABEL_PREFIX
-+#ifndef TARGET_AMIGAOS_VASM
- #define LOCAL_LABEL_PREFIX "."
-+#else
-+#define LOCAL_LABEL_PREFIX "_."
-+#endif
-
- /* The prefix to add to user-visible assembler symbols. */
-
-@@ -71,24 +75,43 @@ along with GCC; see the file COPYING3. If not see
- /* config/m68k.md has an explicit reference to the program counter,
- prefix this by the register prefix. */
-
-+#ifndef TARGET_AMIGAOS_VASM
- #define ASM_RETURN_CASE_JUMP \
- do { \
- return "jmp %%pc@(2,%0:w)"; \
- } while (0)
-+#else
-+#define ASM_RETURN_CASE_JUMP \
-+ do { \
-+ return "jmp (2,pc,%0.w)"; \
-+ } while (0)
-+#endif
-
- /* This is how to output an assembler line that says to advance the
- location counter to a multiple of 2**LOG bytes. */
-
-+#ifndef TARGET_AMIGAOS_VASM
- #ifndef ALIGN_ASM_OP
- #define ALIGN_ASM_OP "\t.align\t"
- #endif
-+#else
-+#define ALIGN_ASM_OP "\talign\t"
-+#endif
-
- #undef ASM_OUTPUT_ALIGN
-+#ifndef TARGET_AMIGAOS_VASM
- #define ASM_OUTPUT_ALIGN(FILE,LOG) \
- do { \
- if ((LOG) > 0) \
- fprintf ((FILE), "%s%u\n", ALIGN_ASM_OP, 1 << (LOG)); \
- } while (0)
-+#else
-+#define ASM_OUTPUT_ALIGN(FILE,LOG) \
-+do { \
-+ if ((LOG) > 0) \
-+ fprintf ((FILE), "%s%u\n", ALIGN_ASM_OP, (LOG)); \
-+} while (0)
-+#endif
-
- #if 0
- extern int amiga_declare_object;
-@@ -126,7 +149,11 @@ amiga_declare_object = 0
- #undef M68K_STATIC_CHAIN_REG_NAME
- #define M68K_STATIC_CHAIN_REG_NAME REGISTER_PREFIX "a1"
-
-+#ifndef TARGET_AMIGAOS_VASM
-+#define ASM_COMMENT_START "|"
-+#else
- #define ASM_COMMENT_START "|"
-+#endif
-
- /* Define how the m68k registers should be numbered for Dwarf output.
- The numbering provided here should be compatible with the native
-@@ -147,15 +174,34 @@ amiga_declare_object = 0
-
- #undef ASM_OUTPUT_COMMON
- #undef ASM_OUTPUT_LOCAL
--#define ASM_OUTPUT_COMMON(FILE, NAME, SIZE, ROUNDED) \
-+#ifndef TARGET_AMIGAOS_VASM
-+#define ASM_OUTPUT_COMMON(FILE, NAME, SIZE, ROUNDED) \
- ( fputs (".comm ", (FILE)), \
- assemble_name ((FILE), (NAME)), \
- fprintf ((FILE), ",%u\n", (int)(SIZE)))
-+#else
-+#define ASM_OUTPUT_COMMON(FILE, NAME, SIZE, ROUNDED) \
-+ ( switch_to_section (bss_section), \
-+ fputs ("|.comm\n\tcnop 0,4\n", (FILE)), \
-+ assemble_name ((FILE), (NAME)), \
-+ fprintf ((FILE), ":\n\tds.b %u\n", (int)(SIZE)), \
-+ fputs ("\txdef ", (FILE)), \
-+ assemble_name ((FILE), (NAME)), \
-+ fprintf ((FILE), "\n"))
-+#endif
-
-+#ifndef TARGET_AMIGAOS_VASM
- #define ASM_OUTPUT_LOCAL(FILE, NAME, SIZE, ROUNDED) \
- ( fputs (".lcomm ", (FILE)), \
- assemble_name ((FILE), (NAME)), \
- fprintf ((FILE), ",%u\n", (int)(SIZE)))
-+#else
-+#define ASM_OUTPUT_LOCAL(FILE, NAME, SIZE, ROUNDED) \
-+( switch_to_section (bss_section), \
-+ fputs ("|.lcomm\n\tcnop 0,4\n", (FILE)), \
-+ assemble_name ((FILE), (NAME)), \
-+ fprintf ((FILE), ":\n\tds.b %u\n", (int)(SIZE)))
-+#endif
-
- /* Currently, JUMP_TABLES_IN_TEXT_SECTION must be defined in order to
- keep switch tables in the text section. */
-@@ -169,9 +215,13 @@ amiga_declare_object = 0
- fprintf ((FILE), "%s&%d\n", SWBEG_ASM_OP, XVECLEN (PATTERN (TABLE), 1));
- /* end of stuff from m68kv4.h */
-
-+#ifndef TARGET_AMIGAOS_VASM
- #ifndef BSS_SECTION_ASM_OP
- #define BSS_SECTION_ASM_OP "\t.bss"
- #endif
-+#else
-+#define BSS_SECTION_ASM_OP "\tsection\tbss"
-+#endif
-
- #ifndef ASM_OUTPUT_ALIGNED_BSS
- #define ASM_OUTPUT_ALIGNED_BSS(FILE, DECL, NAME, SIZE, ALIGN) \
-@@ -294,8 +344,13 @@ if (target_flags & (MASK_RESTORE_A4|MASK_ALWAYS_RESTORE_A4)) \
- /* Various -m flags require special flags to the assembler. */
-
- #undef ASM_SPEC
-+#ifndef TARGET_AMIGAOS_VASM
-+#define ASM_SPEC \
-+ "%(asm_cpu) %(asm_cpu_default) %{msmall-code:-sc}"
-+#else
- #define ASM_SPEC \
-- "%(asm_cpu) %(asm_cpu_default) %{msmall-code:-sc}"
-+ "-gas -esc -ldots -Fhunk -quiet %(asm_cpu) %(asm_cpu_default) %{msmall-code:-sc}"
-+#endif
-
- #undef ASM_CPU_SPEC
- #define ASM_CPU_SPEC \
-@@ -305,8 +360,13 @@ if (target_flags & (MASK_RESTORE_A4|MASK_ALWAYS_RESTORE_A4)) \
- "%{m68040} " \
- "%{m68060}"
-
-+#ifndef TARGET_AMIGAOS_VASM
- #define ASM_CPU_DEFAULT_SPEC \
-- "%{!m680*:%{!mc680*:-m68040}}"
-+ "%{!m680*:%{!mc680*:-m68040}}"
-+#else
-+#define ASM_CPU_DEFAULT_SPEC \
-+ "%{!m680*:%{!mc680*:-m68000}}"
-+#endif
-
- /* Choose the right startup file, depending on whether we use base relative
- code, base relative code with automatic relocation (-resident), their
-
-From c48a0f72eefe8e3a45b24184fc75e5a93eaabfc2 Mon Sep 17 00:00:00 2001
-From: bebbo <bebbo(a)bejy.net>
-Date: Tue, 25 Apr 2017 19:37:45 +0200
-Subject: [PATCH 091/303] @B renaming is better again, test cases stil ok
-
----
- gcc/bbb-opts.c | 163 +++++++++++++++++++++++++++++----------------------------
- 1 file changed, 82 insertions(+), 81 deletions(-)
-
++ cat((flag_baserel ? A2IXDIR_PREFIX "/amiga_exe_baserel_script.x"
++ : A2IXDIR_PREFIX "/amiga_exe_script.x"), x);
++ for (lib = head; lib; lib = lib->next)
++ {
++ static char buf[256];
++ sprintf(buf, A2IXDIR_PREFIX "/ldscripts/%s.x", lib->name);
++ fprintf(out, "extern long %sBase; long *__p%sBase = &%sBase;\n",
++ lib->cname, lib->cname, lib->cname);
++ cat(buf, x);
++ } /* {{ */
++ fprintf(x, "}}\n");
++ fclose(out);
++ fclose(x);
++ argv[0]=c_file_name;
++ fork_execute("gcc", (char **)argv, false);
++
++ /* Unfortunately, unlike "-s", "-T" cannot be specified as the last
++ argument. We put it after "-L" args. */
++ ld1_end=ld1_argv;
++ while (*ld1_end)
++ ld1_end++;
++ ld1_end++;
++ /* "ld1_end" now points after the terminating 0 of "ld1_argv". */
++
++ ld1=ld1_end-2;
++ while (ld1>ld1_argv && strncmp(*ld1, "-L", strlen("-L")))
++ ld1--;
++ if (ld1==ld1_argv)
++ fatal_error (input_location, "no -L arguments");
++ ld1++;
++ /* "ld1" now points after "-L". */
++
++ /* Shift all the arguments after "-L" one position right. */
++ memmove(ld1+1, ld1, (ld1_end-ld1)*sizeof(*ld1));
++ /* Put -Tshared.x in the now empty space. */
++ *ld1="-T" SHARED_X_NAME;
++ }
++}
++
++/* Be lazy and just call "postlink". */
++
++void
++amigaos_postlink_hook (const char *output_file)
++{
++ static const char *argv[]={"postlink", 0, 0, 0};
++ if (flag_static)
++ return;
++
++ if (flag_baserel)
++ {
++ argv[1]="-baserel";
++ argv[2]=output_file;
++ }
++ else
++ argv[1]=output_file;
++ fork_execute("postlink", (char **)argv, false);
++}
diff --git a/gcc/bbb-opts.c b/gcc/bbb-opts.c
-index 3e6c316149b0..407e2f74fd9f 100755
---- gcc/bbb-opts.c
+new file mode 100755
+index 000000000000..9e989e9b1ec0
+--- /dev/null
+++ gcc/bbb-opts.c
-@@ -738,123 +738,124 @@ opt_reg_rename (void)
- if (!mask)
- continue;
-
-- std::set<unsigned> found;
-+ /* first = pos to start, second indicates to treat def as use. */
- std::vector<unsigned> todo;
-+ std::set<unsigned> found;
- if (index + 1 < insns.size ())
- todo.push_back (index + 1);
-
-+// /* trigger jump checking */
-+// if (index > 0 && LABEL_P(insns[index - 1]))
-+// todo.push_back (std::make_pair(index - 1, 0));
-+
- found.insert (index);
- /* a register was defined, follow all branches. */
-- while (todo.size ())
-+ while (mask && todo.size ())
- {
-- unsigned pos = todo[todo.size () - 1];
-+ unsigned runpos = todo[todo.size () - 1];
- todo.pop_back ();
-
-- /* already searched. */
-- if (found.find (pos) != found.end ())
-- continue;
--
-- rtx_insn * insn = insns[pos];
-- if (LABEL_P(insn))
-+ for (unsigned pos = runpos; mask && pos < insns.size (); ++pos)
- {
-- found.insert (pos);
-+ /* already searched. */
-+ if (found.find (pos) != found.end ())
-+ break;
-
-- /* for each jump to this label:
-- * check if the reg was used at that jump.
-- * if used, find def
-- */
-- for (std::vector<rtx_insn *>::iterator i = jumps.begin (); i != jumps.end (); ++i)
-+ rtx_insn * insn = insns[pos];
-+ if (LABEL_P(insn))
- {
-- if (JUMP_LABEL(*i) == insn)
-+ found.insert (pos);
+@@ -0,0 +1,4705 @@
++/* Bebbo's Optimizations.
++ Copyright (C) 2010-2017 Free Software Foundation, Inc.
++ Copyright (C) 2017 Stefan "Bebbo" Franke.
++
++ This file is part of GCC.
++
++ GCC 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 3, or (at your option) any later
++ version.
++
++ GCC 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 GCC; see the file COPYING3. If not see
++ <http://www.gnu.org/licenses/>. */
++
++/**
++ * SBF (Stefan "Bebbo" Franke):
++ *
++ * This pass performs multiple optimizations.
++ *
++ * #1 propagate_moves
++ * check if a->b->a can be moved out of a loop.
++ *
++ * #2 strcpy
++ * check if a temp reg can be eliminated.
++ *
++ * #3 const_comp_sub
++ * convert a compare with int constant into sub statement.
++ *
++ * #4 merge_add
++ * merge adds
++ *
++ * #5 elim_dead_assign
++ * eliminate some dead assignments.
++ *
++ * #6 shrink stack frame
++ * remove push/pop for unused variables
++ *
++ * #7 rename register
++ * rename registers without breaking register parameters, inline asm etc.
++ *
++ * Lessons learned:
++ *
++ * - do not trust existing code, better delete insns and inster a new one.
++ * - do not modify insns, create new insns from pattern
++ * - do not reuse registers, create new reg rtx instances
++ *
++ */
++
++#include "config.h"
++#define INCLUDE_VECTOR
++#define INCLUDE_SET
++#define INCLUDE_MAP
++#include "system.h"
++#include "coretypes.h"
++#include "backend.h"
++#include "target.h"
++#include "rtl.h"
++#include "tm_p.h"
++#include "insn-config.h"
++#include "recog.h"
++#include "cfgrtl.h"
++#include "emit-rtl.h"
++#include "tree.h"
++#include "tree-pass.h"
++#include "conditions.h"
++#include "langhooks.h"
++#include <vector>
++#include <set>
++#include <map>
++
++int be_very_verbose;
++bool be_verbose;
++
++extern struct lang_hooks lang_hooks;
++
++static void
++update_insn_infos (void);
++static unsigned
++track_regs ();
++
++/* Lookup of the current function name. */
++extern tree current_function_decl;
++static tree last_function_decl;
++static char fxname[512];
++static char const *
++get_current_function_name ()
++{
++ if (current_function_decl == NULL)
++ strcpy (fxname, "<toplevel>");
++ else
++ strcpy (fxname, lang_hooks.decl_printable_name (current_function_decl, 2));
++ return fxname;
++}
++
++/* a simple log to stdout. */
++static int
++log (char const * fmt, ...)
++{
++ if (!be_verbose)
++ return 0;
++
++ va_list args;
++ va_start(args, fmt);
++ if (last_function_decl != current_function_decl)
++ {
++ last_function_decl = current_function_decl;
++ printf (":bbb: in '%s'\n", get_current_function_name ());
++ }
++ printf (":bbb: ");
++ int retval = vprintf (fmt, args);
++ va_end(args);
++ fflush (stdout);
++ return retval;
++}
++
++enum proepis
++{
++ IN_CODE, IN_PROLOGUE, IN_EPILOGUE, IN_EPILOGUE_PARALLEL_POP
++};
++
++/**
++ * What's needed to track values?
++ */
++class track_var
++{
++ rtx value[FIRST_PSEUDO_REGISTER];
++ unsigned mask[FIRST_PSEUDO_REGISTER];
++
++ bool
++ extend (rtx * z, unsigned * mask, machine_mode dstMode, rtx x)
++ {
++ switch (GET_CODE(x))
++ {
++ case CONST_INT:
++ case CONST_FIXED:
++ case CONST_DOUBLE:
++ case SYMBOL_REF:
++ case LABEL_REF:
++ /* these can be used directly. */
++ *z = x;
++ return true;
++
++ case REG:
++ {
++ rtx v = value[REGNO(x)];
++ unsigned mr = mask[REGNO(x)];
++ /* try to expand the register. */
++ if (v)
++ {
++ if (dstMode != GET_MODE(v) && (GET_CODE(v) != CONST_INT || mr == (1 << FIRST_PSEUDO_REGISTER)))
++ return false;
++
++ *mask |= mr;
++ *z = v;
++ return true;
++ }
++
++ /* store the reg otherwise. */
++ *mask |= (1 << REGNO(x));
++ if (GET_MODE(x) == dstMode)
++ *z = x;
++ else
++ *z = gen_rtx_REG (dstMode, REGNO(x));
++ return true;
++ }
++ case PLUS:
++ case MINUS:
++ // handle only in combination with const
++ {
++ rtx y = XEXP(x, 0);
++ if (GET_CODE(y) != SYMBOL_REF && GET_CODE(y) == LABEL_REF && amiga_is_const_pic_ref (y))
++ return false;
++
++ if (GET_CODE(x) == PLUS) // create an own plus to be able to modify the constant offset (later).
++ *z = gen_rtx_PLUS(GET_MODE(x), y, XEXP(x, 1));
++ else
++ *z = gen_rtx_MINUS(GET_MODE(x), y, XEXP(x, 1));
++ return true;
++ }
++
++ /* memory reads. */
++ case MEM:
++ {
++ rtx m = XEXP(x, 0);
++ switch (GET_CODE(m))
++ {
++ case SYMBOL_REF:
++ case LABEL_REF:
++ /* these can be used directly. */
++ *z = x;
++ return true;
++
++ case REG:
++ if (!extend (&m, mask, dstMode, m))
++ return false;
++
++ *z = gen_rtx_MEM (GET_MODE(x), m);
++ return true;
++
++ case PLUS:
++ case MINUS:
++ // handle only in combination with const
++ {
++ rtx y = XEXP(m, 0);
++ if (!REG_P(y) && GET_CODE(y) != SYMBOL_REF && GET_CODE(y) == LABEL_REF && amiga_is_const_pic_ref (y))
++ return false;
++
++ if (REG_P(y))
++ if (!extend (&y, mask, dstMode, y))
++ return false;
++
++ if (GET_CODE(x) == PLUS) // create an own plus to be able to modify the constant offset (later).
++ m = gen_rtx_PLUS(GET_MODE(m), y, XEXP(m, 1));
++ else
++ m = gen_rtx_MINUS(GET_MODE(m), y, XEXP(m, 1));
++
++ *z = gen_rtx_MEM (GET_MODE(x), m);
++ return true;
++ }
++ default:
++ return false;
++ }
++ break;
++ }
++ default:
++ return false;
++ }
++ }
+
-+ /* for each jump to this label:
-+ * check if the reg was used at that jump.
-+ * if used, find def
-+ */
-+ for (std::vector<rtx_insn *>::iterator i = jumps.begin (); i != jumps.end (); ++i)
- {
-- std::map<rtx_insn *, unsigned>::iterator j = insn2index.find (*i);
-- if (j == insn2index.end ())
-- continue;
-+ if (JUMP_LABEL(*i) == insn)
-+ {
-+ std::map<rtx_insn *, unsigned>::iterator j = insn2index.find (*i);
-+ if (j == insn2index.end ())
-+ continue;
-
-- unsigned start = j->second;
-- if (!infos[start].is_use (rename_regno))
-- continue;
-+ unsigned start = j->second;
-+ if (!infos[start].is_use (rename_regno))
-+ continue;
-
-- start = find_start (found, start, rename_regno);
-- todo.push_back (start);
-+ start = find_start (found, start, rename_regno);
-+ todo.push_back (start);
-+ }
- }
-+ continue;
- }
-
-- if (pos + 1 < insns.size ())
-- todo.push_back (pos + 1);
-- continue;
-- }
-+ insn_info & jj = infos[pos];
-
-- insn_info & jj = infos[pos];
-+ /* marked as hard reg -> invalid rename */
-+ if (jj._use & jj._hard & rename_regbit)
-+ mask = 0;
-
-- /* marked as hard reg -> invalid rename */
-- if (jj._hard & rename_regbit)
-- mask = 0;
-+// /* defined again -> invalid rename */
-+// if ((jj._def & rename_regbit) && !(jj._use & rename_regbit))
-+// mask = 0;
-
-- /* defined again -> invalid rename */
-- if ((jj._def & rename_regbit) && !(jj._use & rename_regbit))
-- mask = 0;
--
-- if (!mask)
-- break;
-+ if (!mask)
-+ break;
-
-- /* not used. */
-- if (!(jj._use & rename_regbit))
-- continue;
-+ /* not used. and not a def */
-+ if (pos == runpos && (jj._def & rename_regbit))
-+ {
-+ /* continue since this pos was added by start search. */
-+ }
-+ else if (!(jj._use & rename_regbit))
-+ break;
-
-- /* update free regs. */
-- mask &= ~jj._use;
-- mask &= ~jj._def;
-- if (!mask)
-- break;
-+ /* update free regs. */
-+ mask &= ~jj._use;
-+ mask &= ~jj._def;
-+ if (!mask)
-+ break;
-
-- found.insert (pos);
-+ found.insert (pos);
-
-- /* follow jump and/or next insn. */
-- if (JUMP_P(insn))
-- {
-- std::map<rtx_insn *, unsigned>::iterator j = insn2index.find ((rtx_insn *) JUMP_LABEL(insn));
-- if (j == insn2index.end ())
-+ /* follow jump and/or next insn. */
-+ if (JUMP_P(insn))
- {
-- /* whoops - label not found. */
-- todo.clear ();
-- mask = 0;
-- break;
-- }
-+ std::map<rtx_insn *, unsigned>::iterator j = insn2index.find ((rtx_insn *) JUMP_LABEL(insn));
-+ if (j == insn2index.end ())
-+ {
-+ /* whoops - label not found. */
-+ mask = 0;
-+ break;
-+ }
-
-- unsigned label_index = j->second;
-- if (found.find (label_index) == found.end ())
-- {
-- /* if the rename_reg is used in the insn before.
-- * search the start.
-- */
-- if (label_index > 0)
-+ unsigned label_index = j->second;
-+ if (found.find (label_index) == found.end ())
- {
-- insn_info & bb = infos[label_index - 1];
-+ /* if the rename_reg is used in the insn before.
-+ * search the start.
-+ */
-+ insn_info & bb = infos[label_index + 1];
- if (bb.is_use (rename_regbit))
- {
- unsigned start = find_start (found, label_index - 1, rename_regno);
- todo.push_back (start);
- }
-+ todo.push_back (label_index + 1);
-+ }
-+ rtx jmppattern = PATTERN (insn);
-+ if (GET_CODE(jmppattern) == PARALLEL)
-+ {
-+ /* can't handle yet. Abort renaming. */
-+ mask = 0;
-+ break;
- }
-- todo.push_back (label_index);
-- }
-- rtx jmppattern = PATTERN (insn);
-- if (GET_CODE(jmppattern) == PARALLEL)
-- {
-- /* can't handle yet. Abort renaming. */
-- todo.clear ();
-- mask = 0;
-- break;
-- }
-
-- rtx jmpsrc = XEXP(jmppattern, 1);
-- if (jmpsrc && GET_CODE(jmpsrc) == IF_THEN_ELSE)
-- if (pos + 1 < insns.size ())
-- todo.push_back (pos + 1);
-+ rtx jmpsrc = XEXP(jmppattern, 1);
-+ if (!jmpsrc || GET_CODE(jmpsrc) != IF_THEN_ELSE)
-+ break;
-+ }
- }
-- else if (pos + 1 < insns.size ())
-- todo.push_back (pos + 1);
- }
-
- if (mask)
-
-From 50dc4c0949e49397d6c6de28207d34cbf137621c Mon Sep 17 00:00:00 2001
-From: bebbo <bebbo(a)bejy.net>
-Date: Wed, 26 Apr 2017 10:34:16 +0200
-Subject: [PATCH 092/303] @B fix backward search at labels
-
----
- gcc/bbb-opts.c | 2 +-
- 1 file changed, 1 insertion(+), 1 deletion(-)
-
-diff --git a/gcc/bbb-opts.c b/gcc/bbb-opts.c
-index 407e2f74fd9f..78eb0cc32f38 100755
---- gcc/bbb-opts.c
-+++ gcc/bbb-opts.c
-@@ -836,7 +836,7 @@ opt_reg_rename (void)
- * search the start.
- */
- insn_info & bb = infos[label_index + 1];
-- if (bb.is_use (rename_regbit))
-+ if (bb.is_use (rename_regno))
- {
- unsigned start = find_start (found, label_index - 1, rename_regno);
- todo.push_back (start);
-
-From ec53abb40b3066d74243c566ea7528ac1bd0f150 Mon Sep 17 00:00:00 2001
-From: bebbo <bebbo(a)bejy.net>
-Date: Wed, 26 Apr 2017 11:43:37 +0200
-Subject: [PATCH 093/303] @I no longer using df functions to determine reg use.
- @B fixed propagate moves, @B fixed eliminate dead assignments
-
----
- gcc/bbb-opts.c | 278 +++++++++++++++++++++++++++++++--------------------------
- 1 file changed, 149 insertions(+), 129 deletions(-)
-
-diff --git a/gcc/bbb-opts.c b/gcc/bbb-opts.c
-index 78eb0cc32f38..9d138063fb27 100755
---- gcc/bbb-opts.c
-+++ gcc/bbb-opts.c
-@@ -58,7 +58,6 @@
- #include "backend.h"
- #include "target.h"
- #include "rtl.h"
--#include "df.h"
- #include "tm_p.h"
- #include "insn-config.h"
- #include "recog.h"
-@@ -242,6 +241,9 @@ struct insn_info
- return true;
- }
-
++public:
++ track_var (track_var const * o = 0)
++ {
++ if (o)
++ assign (o);
++ else
++ for (unsigned i = 0; i < FIRST_PSEUDO_REGISTER; ++i)
++ {
++ value[i] = 0;
++ mask[i] = 0;
++ }
++ }
++
++ int
++ find_alias (rtx src)
++ {
++ rtx z = 0;
++ unsigned m = 0;
++ if (extend (&z, &m, GET_MODE(src), src))
++ {
++ for (unsigned i = 0; i < FIRST_PSEUDO_REGISTER; ++i)
++ {
++ // do not alias small int value from -128 ... 127
++ if (rtx_equal_p (z, value[i]) && (GET_CODE(z) != CONST_INT || INTVAL(z) > 127 || INTVAL(z) < -128))
++ return i;
++ }
++ }
++ return -1;
++ }
+ void
-+ scan_call (rtx_insn *);
++ invalidate_mem (rtx dst)
++ {
++ rtx z = 0;
++ unsigned m = 0;
++ if (extend (&z, &m, GET_MODE(dst), dst))
++ {
++ for (unsigned i = 0; i < FIRST_PSEUDO_REGISTER; ++i)
++ {
++ if (rtx_equal_p (z, value[i]))
++ {
++ value[i] = 0;
++ mask[i] = 0;
++ }
++ }
++ }
++ }
+
- void
- scan (rtx);
-
-@@ -267,6 +269,31 @@ struct insn_info
- }
- };
-
-+void
-+insn_info::scan_call (rtx_insn * insn)
++ rtx
++ get (unsigned regno)
++ {
++ if (regno >= FIRST_PSEUDO_REGISTER)
++ return 0;
++
++ return value[regno];
++ }
++
++ void
++ set (machine_mode mode, unsigned regno, rtx x, unsigned index)
++ {
++ if (regno >= FIRST_PSEUDO_REGISTER)
++ return;
++
++ if (mode == SFmode && regno < 16)
++ mode = SImode;
++
++ if (!extend (&value[regno], &mask[regno], mode, x))
++ {
++ clear (mode, regno, index);
++ }
++ }
++
++ bool
++ equals (unsigned regno, rtx x)
++ {
++ if (regno >= FIRST_PSEUDO_REGISTER)
++ return false;
++
++ if (x == 0 || value[regno] == 0)
++ return false;
++
++ rtx z = 0;
++ unsigned m = 0;
++ if (!extend (&z, &m, GET_MODE(x), x))
++ return false;
++
++ return rtx_equal_p (z, value[regno]);
++ }
++
++ void
++ clear (machine_mode mode, unsigned regno, unsigned index)
++ {
++ if (regno >= FIRST_PSEUDO_REGISTER)
++ return;
++
++ if (mode == SFmode && regno < 16)
++ mode = SImode;
++ value[regno] = gen_rtx_raw_CONST_INT(mode, 0x100000000000000LL | ((long long int ) (regno) << 32) | index);
++ mask[regno] = 1 << FIRST_PSEUDO_REGISTER;
++ }
++
++ void
++ clear_aftercall (unsigned index)
++ {
++ for (int i = 2; i < FIRST_PSEUDO_REGISTER; ++i)
++ {
++ if (mask[i] && mask[i] < 1 << FIRST_PSEUDO_REGISTER)
++ {
++ value[i] = 0;
++ mask[i] = 0;
++ }
++ }
++ clear (SImode, 0, index);
++ clear (SImode, 1, index);
++ clear (SImode, 8, index);
++ clear (SImode, 9, index);
++ }
++
++ void
++ clear_for_mask (unsigned def, unsigned index)
++ {
++ if (!def)
++ return;
++ for (int regno = 0; regno < FIRST_PSEUDO_REGISTER; ++regno)
++ {
++ // register changed or used somehow
++ if ((1 << regno) & def)
++ clear (SImode, regno, index);
++ }
++ }
++
++ void
++ assign (track_var const * o)
++ {
++ for (int i = 0; i < FIRST_PSEUDO_REGISTER; ++i)
++ {
++ value[i] = o->value[i];
++ mask[i] = o->mask[i];
++ }
++ }
++
++ /* only keep common values in both sides. */
++ void
++ merge (track_var * o, unsigned)
++ {
++ for (unsigned i = 0; i < FIRST_PSEUDO_REGISTER; ++i)
++ {
++ if (!rtx_equal_p (value[i], o->value[i]))
++ {
++ value[i] = o->value[i] = 0;
++ mask[i] = 0;
++ }
++ }
++ }
++
++ /* true if a merge would not change anything. */
++ bool
++ no_merge_needed (track_var const * o) const
++ {
++ for (unsigned i = 0; i < FIRST_PSEUDO_REGISTER; ++i)
++ {
++ if (!rtx_equal_p (value[i], o->value[i]))
++ return false;
++ }
++ return true;
++ }
++};
++
++/* Information for each insn to detect alive registers. Enough for m68k.
++ * Why a class? Maybe extend it for general usage.
++ *
++ * Track use & def separate to determine starting points.
++ */
++class insn_info
+{
-+ /* add mregparm registers. */
-+ for (rtx link = CALL_INSN_FUNCTION_USAGE(insn); link; link = XEXP(link, 1))
-+ {
-+ rtx op, reg;
++ rtx_insn * insn; // the insn
+
-+ if (GET_CODE (op = XEXP (link, 0)) == USE && REG_P(reg = XEXP (op, 0)))
-+ for (unsigned r = REGNO(reg); r <= END_REGNO (reg); ++r)
-+ use (r);
-+ }
-+ /* also mark all registers as not renamable */
-+ _hard = _use;
++// usage flags
++ unsigned myuse; // bit set if registers are used in this statement
++ unsigned hard; // bit set if registers can't be renamed
++ unsigned use; // bit set if registers are used in program flow
++ unsigned def; // bit set if registers are defined here
++
++ enum proepis proepi;
++
++ bool stack; // part of stack frame insns
++
++// stuff to analyze insns
++ bool label;
++ bool jump;
++ bool call;
++ bool compare;
++ bool dst_mem;
++ bool src_mem;
++ bool dst_plus;
++ bool src_plus;
++ rtx_code src_op;
++ bool src_ee;
++ bool src_2nd;
++ bool src_const;
+
-+ scan (PATTERN (insn));
++ machine_mode mode;
+
-+ /* mark scratch registers. */
-+ def (0);
-+ def (1);
-+ def (8);
-+ def (9);
++ rtx dst_reg;
++ rtx dst_mem_reg;
++ rtx dst_symbol;
++ rtx src_reg;
++ rtx src_mem_reg;
++ rtx src_symbol;
++ unsigned dst_mem_addr;
++ int src_intval;
++ unsigned src_mem_addr;
+
-+}
++ bool visited;
+
- /* scan rtx for registers and set the corresponding flags. */
- void
- insn_info::scan (rtx x)
-@@ -478,8 +505,6 @@ update_insns ()
- rtx_insn *insn, *next;
- clear ();
-
-- // df_insn_rescan_all ();
--
- char inproepilogue = 1;
- /* create a vector with relevant insn. */
- for (insn = get_insns (); insn; insn = next)
-@@ -567,26 +592,7 @@ update_insn_infos (void)
- if (CALL_P(insn))
- {
- insn_info use;
--
-- /* add mregparm registers. */
-- for (rtx link = CALL_INSN_FUNCTION_USAGE(insn); link; link = XEXP(link, 1))
-- {
-- rtx op, reg;
--
-- if (GET_CODE (op = XEXP (link, 0)) == USE && REG_P(reg = XEXP (op, 0)))
-- for (unsigned r = REGNO(reg); r <= END_REGNO (reg); ++r)
-- use.use (r);
-- }
-- /* also mark all registers as not renamable */
-- use._hard = use._use;
--
-- use.scan (pattern);
--
-- /* mark scratch registers. */
-- use.def (0);
-- use.def (1);
-- use.def (8);
-- use.def (9);
-+ use.scan_call (insn);
-
- infos[pos] = use | ii;
- ii.updateWith (use);
-@@ -687,6 +693,27 @@ bit2regno (unsigned bit)
- return regno;
- }
-
-+/* check if that register is touched between from and to, excluding from and to .*/
-+static bool
-+is_reg_touched_between (unsigned regno, int from, int to)
-+{
-+ for (int index = from + 1; index < to; ++index)
-+ {
-+ insn_info ii;
-+ rtx_insn * insn = insns[index];
-+ if (CALL_P(insn))
-+ ii.scan_call (insn);
-+ else
-+ ii.scan (PATTERN (insn));
-+ if (ii.is_use (regno) || ii.is_def (regno))
-+ return true;
-+ }
-+ return false;
-+}
++ int sp_offset;
+
-+/*
-+ * search backward and find the initial assignment for that regno.
-+ */
- static unsigned
- find_start (std::set<unsigned> & found, unsigned start, unsigned rename_regno)
- {
-@@ -1045,47 +1072,76 @@ opt_propagate_moves ()
- if (rtx_equal_p (srci, dstj) && rtx_equal_p (srcj, dsti))
- {
- /* Ensure correct usage. */
-- if (!reg_used_between_p (srci, current_label, ii) && !reg_used_between_p (srci, ii, jj)
-- && !reg_used_between_p (srci, jj, insn) && !reg_used_between_p (dsti, current_label, ii)
-- && !reg_used_between_p (dsti, jj, insn))
-+ if (is_reg_touched_between (REGNO(srci), current_label_index, *i) // label ... move src,x
-+ || is_reg_touched_between (REGNO(srci), *i, *j) // move src,x ... move x,src
-+ || is_reg_touched_between (REGNO(srci), *j, index) // move x,src ... jcc
-+ || is_reg_touched_between (REGNO(dsti), *j, index) // label ... move src,x
-+ || is_reg_touched_between (REGNO(dsti), *j, index) // move x,src ... jcc
-+ )
-+ {
-+ ++j;
-+ continue;
-+ }
++ int dst_autoinc;
++ int src_autoinc;
+
-+ std::vector<int> fixups;
++// values for all variables - if used
++ track_var * track;
+
-+ /* if there are jumps out of the loop,
-+ * check if the modification occurs before the jump,
-+ * and if, that it's a plus const.
-+ */
-+ if (jump_out.size ())
- {
-- std::vector<int> fixups;
-+ std::vector<rtx_insn *>::iterator label_iter = jump_out.begin ();
-+ int fixup = 0;
-
-- /* if there are jumps out of the loop,
-- * check if the modification occurs before the jump,
-- * and if, that it's a plus const.
-- */
-- if (jump_out.size ())
-+ for (unsigned k = *i + 1; k != *j; ++k)
- {
-- std::vector<rtx_insn *>::iterator label_iter = jump_out.begin ();
-- int fixup = 0;
-+ rtx_insn * check = insns[k];
-+ if (JUMP_P(check))
-+ {
-+ fixups.push_back (fixup);
-+ if (++label_iter == jump_out.end ())
-+ break;
-+ continue;
-+ }
-
-- for (unsigned k = *i + 1; k != *j; ++k)
-+ if (reg_overlap_mentioned_p (dsti, PATTERN (check)))
- {
-- rtx_insn * check = insns[k];
-- if (JUMP_P(check))
-+ /* right now only support auto_incs. */
-+ rtx set = single_set (check);
-+ rtx src = SET_SRC(set);
-+ rtx dst = SET_DEST(set);
++public:
++ insn_info (rtx_insn * i = 0, enum proepis p = IN_CODE) :
++ insn (i), myuse (0), hard (0), use (0), def (0), proepi (p), stack (false), label (false), jump (false), call (
++ false), compare (false), dst_mem (false), src_mem (false), dst_plus (false), src_plus (false), src_op (
++ (rtx_code) 0), src_ee (false), src_2nd (false), src_const (false), mode (VOIDmode), dst_reg (0), dst_mem_reg (
++ 0), dst_symbol (0), src_reg (0), src_mem_reg (0), src_symbol (0), dst_mem_addr (0), src_intval (0), src_mem_addr (
++ 0), visited (false), sp_offset (0), dst_autoinc (0), src_autoinc (0), track (0)
++ {
++ }
+
-+ if (reg_overlap_mentioned_p (dsti, dst))
- {
-- fixups.push_back (fixup);
-- if (++label_iter == jump_out.end ())
-+ if (REG_P(dst))
-+ break;
-+ if (!MEM_P(dst))
-+ break;
++ track_var *
++ get_track_var ();
+
-+ rtx x = XEXP(dst, 0);
-+ if (GET_CODE(x) == REG)
-+ fixup += 0; // direct use
-+ else if (GET_CODE(x) == PRE_INC ||
-+ GET_CODE(x) == POST_INC)
-+ fixup -= GET_MODE_SIZE(GET_MODE(dst));
-+ else if (GET_CODE(dst) == PRE_DEC ||
-+ GET_CODE(dst) == POST_DEC)
-+ fixup += GET_MODE_SIZE(GET_MODE(dst));
-+ else
- break;
-- continue;
- }
-
-- if (reg_overlap_mentioned_p (dsti, PATTERN (check)))
-+ if (reg_overlap_mentioned_p (dsti, src))
- {
-- /* right now only support auto_incs. */
-- rtx set = single_set (check);
-- rtx src = SET_SRC(set);
-- rtx dst = SET_DEST(set);
--
-- if (reg_overlap_mentioned_p (dsti, dst))
-+ if (REG_P(src))
-+ fixup += 0;
-+ else
- {
-- if (REG_P(dst))
-- break;
-- if (!MEM_P(dst))
-+ if (!MEM_P(src))
- break;
-
-- rtx x = XEXP(dst, 0);
-+ rtx x = XEXP(src, 0);
- if (GET_CODE(x) == REG)
- fixup += 0; // direct use
- else if (GET_CODE(x) == PRE_INC ||
-@@ -1097,91 +1153,64 @@ opt_propagate_moves ()
- else
- break;
- }
--
-- if (reg_overlap_mentioned_p (dsti, src))
-- {
-- if (REG_P(src))
-- fixup += 0;
-- else
-- {
-- if (!MEM_P(src))
-- break;
--
-- rtx x = XEXP(src, 0);
-- if (GET_CODE(x) == REG)
-- fixup += 0; // direct use
-- else if (GET_CODE(x) == PRE_INC ||
-- GET_CODE(x) == POST_INC)
-- fixup -= GET_MODE_SIZE(GET_MODE(dst));
-- else if (GET_CODE(dst) == PRE_DEC ||
-- GET_CODE(dst) == POST_DEC)
-- fixup += GET_MODE_SIZE(GET_MODE(dst));
-- else
-- break;
-- }
-- }
- }
- }
- }
-+ }
-
-- /* got a fixup for all jump_outs? */
-- if (fixups.size () == jump_out.size ())
-- {
-- rtx_insn * before = insns[current_label_index - 1];
-- rtx_insn * after = insns[index + 1];
-- rtx bset = single_set (before);
-+ /* got a fixup for all jump_outs? */
-+ if (fixups.size () == jump_out.size ())
-+ {
-+ rtx_insn * before = insns[current_label_index - 1];
-+ rtx_insn * after = insns[index + 1];
-+ rtx bset = single_set (before);
-
-- log ("propagate_moves condition met, moving regs %s, %s\n",
-- reg_names[REGNO(srci)],
-- reg_names[REGNO(dsti)]);
-+ log ("propagate_moves condition met, moving regs %s, %s\n",
-+ reg_names[REGNO(srci)],
-+ reg_names[REGNO(dsti)]);
-
-- /* Move in front of loop and mark as dead. */
-- rtx_insn * newii = make_insn_raw (PATTERN (ii));
-- SET_INSN_DELETED(ii);
-+ /* Move in front of loop and mark as dead. */
-+ rtx_insn * newii = make_insn_raw (PATTERN (ii));
-+ SET_INSN_DELETED(ii);
-
-- /* Plus check if the reg was just loaded. */
-- if (bset)
-+ /* Plus check if the reg was just loaded. */
-+ if (bset)
-+ {
-+ rtx bdst = SET_DEST(bset);
-+ if (REG_P(bdst) && REGNO(bdst) == REGNO(srci))
- {
-- rtx bdst