[m-rev.] for review: remove legacy support for the Alpha architectures

Julien Fischer jfischer at opturion.com
Sat Oct 17 01:22:03 AEDT 2020


Remove legacy support for the Alpha architecture.

README.Linux-Alpha:
runtime/machdeps/ALPHA_REGS:
runtime/machdeps/alpha_regs.h:
runtime/machdeps/alpha_regtest:
     Delete these files.

configure.ac:
runtime/Mmakefile:
runtime/mercury_goto.h:
runtime/mercury_regs.h:
README.md:
README.Linux:
README.Linux-PPC:
     Delete or update references to the Alpha architecture.

NEWS:
     Announce the above.

scripts/mgnuc.in:
     Unrelated: update a comment.

Julien.

diff --git a/NEWS b/NEWS
index 318a5a4..56249ca 100644
--- a/NEWS
+++ b/NEWS
@@ -6,6 +6,8 @@ Changes that may break compatibility

  * We have removed `is` as a synonym for unification.

+* We have removed the legacy support for the Alpha architecture.
+
  Changes to the Mercury standard library
  ---------------------------------------

diff --git a/README.Linux b/README.Linux
index 8ceefad..456350b 100644
--- a/README.Linux
+++ b/README.Linux
@@ -1,6 +1,5 @@
  This file documents the Linux/x86 and Linux/x86_64 ports.
  For the Linux/PowerPC port, see README.Linux-PPC.
-For the Linux/Alpha port, see README.Linux-Alpha.
  (Ports to Linux on other architectures have not yet
  been attempted, but should not be difficult.)

diff --git a/README.Linux-Alpha b/README.Linux-Alpha
deleted file mode 100644
index 3f99fca..0000000
--- a/README.Linux-Alpha
+++ /dev/null
@@ -1,3 +0,0 @@
-
-Linux/Alpha needs no special treatment at present.
-
diff --git a/README.Linux-PPC b/README.Linux-PPC
index 4e2628e..a350087 100644
--- a/README.Linux-PPC
+++ b/README.Linux-PPC
@@ -34,7 +34,7 @@ patching configure to tell it to assume that they work.
  (The way to do this is shown in the patch appended below.)
  But more likely it will also require a little bit
  of ABI-dependent code in runtime/mercury_goto.h, similar to the
-existing stuff there for __alpha or __sparc.
+existing stuff there for or __sparc.

  > checking for sys/siginfo.h... no
  > checking for ucontext.h... no
diff --git a/README.md b/README.md
index 0f7e17d..51df0c3 100644
--- a/README.md
+++ b/README.md
@@ -38,7 +38,6 @@ Specific information is contained in individual README files:

        * [Docker](README.Docker)
        * [Linux](README.Linux)
-        ([Alpha](README.Linux-Alpha),
          [PPC](README.Linux-PPC),
          [m68k](README.Linux-m68k))
        * [MacOS X](README.MacOS)
diff --git a/configure.ac b/configure.ac
index 78f6689..0ada105 100644
--- a/configure.ac
+++ b/configure.ac
@@ -2338,7 +2338,7 @@ AC_SUBST(MR_DARWIN_SETJMP_WORKAROUND)
  # versions), we need -fno-reorder-functions to avoid segmentation faults.
  # We don't yet know exactly which grades are affected.
  #
-# For alpha, mips, and ARM, and probably on other architectures, when using
+# For mips and ARM, and probably on other architectures, when using
  # non-local gotos we need -fomit-frame-pointer, otherwise when compiling
  # with --no-c-optimize we run into a problem similar to the one above:
  # Gcc generates code which initializes the frame pointer in the
@@ -2410,18 +2410,6 @@ case "$ac_cv_prog_gcc" in yes)
              CFLAGS_FOR_GOTOS="$CFLAGS_FOR_GOTOS $CFLAGS_FOR_NO_TREE_DOMINATOR_OPTS"
              CFLAGS_FOR_REGS="-fno-builtin -fno-omit-frame-pointer"
              ;;
-        # We need a special-case hack here, because the auto-config gets it
-        # wrong on the Alpha: the little example program works fine
-        # in fast.gc mode, but big programs don't, due to problems with
-        # the `gp' register. Ideally we ought to write a big enough example
-        # program to trigger the problem, but that would be too much work.
-        alpha*-dec-*)
-            MERCURY_MSG("asm labels work on the Alpha but plain gcc labels do not")
-            mercury_cv_asm_labels=yes
-            mercury_cv_gcc_labels=no
-            CFLAGS_FOR_GOTOS="$CFLAGS_FOR_GOTOS -fomit-frame-pointer"
-            ;;
-        # Similarly for rs6000.
          rs6000-*)
              MERCURY_MSG("gcc labels do not work on the RS/6000")
              mercury_cv_asm_labels=no
@@ -3944,13 +3932,6 @@ case "$host" in
          NUM_REAL_R_TEMPS=0
          HAVE_DELAY_SLOT=
          ;;
-    alpha*-*)
-        # NUM_REAL_REGS=7
-        # but succip, sp, and hp are real regs, so subtract 3
-        NUM_REAL_R_REGS=4
-        NUM_REAL_R_TEMPS=6
-        HAVE_DELAY_SLOT=
-        ;;
      mips-*)
          # NUM_REAL_REGS=8
          # but succip, sp, and hp are real regs, so subtract 3
diff --git a/runtime/Mmakefile b/runtime/Mmakefile
index a9bf385..90e0bc6 100644
--- a/runtime/Mmakefile
+++ b/runtime/Mmakefile
@@ -142,7 +142,6 @@ BODY_HDRS = \

  MACHHDRS = \
  	machdeps/no_regs.h			\
-	machdeps/alpha_regs.h			\
  	machdeps/i386_regs.h			\
  	machdeps/ia64_regs.h			\
  	machdeps/mips_regs.h			\
diff --git a/runtime/machdeps/ALPHA_REGS b/runtime/machdeps/ALPHA_REGS
deleted file mode 100644
index 3ed779a..0000000
--- a/runtime/machdeps/ALPHA_REGS
+++ /dev/null
@@ -1,66 +0,0 @@
-
-This file contains the relevant part of config/alpha/alpha.h from the
-GNU C source code which describes how each register is used.
-
-/* 1 for registers that have pervasive standard uses
-   and are not available for the register allocator.  */
-
-#define FIXED_REGISTERS  \
- {0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, \
-  0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 1, 1, 1, \
-  0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, \
-  0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 1 }
-
-/* 1 for registers not available across function calls.
-   These must include the FIXED_REGISTERS and also any
-   registers that can be used without being saved.
-   The latter must include the registers where values are returned
-   and the register where structure-value addresses are passed.
-   Aside from that, you can include as many other registers as you like.  */
-#define CALL_USED_REGISTERS  \
- {1, 1, 1, 1, 1, 1, 1, 1, 1, 0, 0, 0, 0, 0, 0, 0, \
-  1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 0, 1, 1, 1, 1, 1, \
-  1, 1, 0, 0, 0, 0, 0, 0, 0, 0, 1, 1, 1, 1, 1, 1, \
-  1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1 }
-
-/* List the order in which to allocate registers.  Each register must be
-   listed once, even those in FIXED_REGISTERS.
-
-   We allocate in the following order:
-   $f1			(nonsaved floating-point register)
-   $f10-$f15		(likewise)
-   $f22-$f30		(likewise)
-   $f21-$f16		(likewise, but input args)
-   $f0			(nonsaved, but return value)
-   $f2-$f9		(saved floating-point registers)
-   $1-$8		(nonsaved integer registers)
-   $22-$25		(likewise)
-   $28			(likewise)
-   $0			(likewise, but return value)
-   $21-$16		(likewise, but input args)
-   $27			(procedure value in OSF, nonsaved in NT)
-   $9-$14		(saved integer registers)
-   $26			(return PC)
-   $15			(frame pointer)
-   $29			(global pointer)
-   $30, $31, $f31	(stack pointer and always zero/ap & fp)  */
-
-#define REG_ALLOC_ORDER		\
-  {33,					\
-   42, 43, 44, 45, 46, 47,		\
-   54, 55, 56, 57, 58, 59, 60, 61, 62,	\
-   53, 52, 51, 50, 49, 48,		\
-   32,					\
-   34, 35, 36, 37, 38, 39, 40, 41,	\
-   1, 2, 3, 4, 5, 6, 7, 8,		\
-   22, 23, 24, 25,			\
-   28,					\
-   0,					\
-   21, 20, 19, 18, 17, 16,		\
-   27,					\
-   9, 10, 11, 12, 13, 14,		\
-   26,					\
-   15,					\
-   29,					\
-   30, 31, 63 }
-
diff --git a/runtime/machdeps/alpha_regs.h b/runtime/machdeps/alpha_regs.h
deleted file mode 100644
index add5ed4..0000000
--- a/runtime/machdeps/alpha_regs.h
+++ /dev/null
@@ -1,100 +0,0 @@
-/*
-** Copyright (C) 1994-1998, 2000 The University of Melbourne.
-** Copyright (C) 2018 The Mercury team.
-** This file is distributed under the terms specified in COPYING.LIB.
-*/
-
-#ifndef MR_MACHDEPS_ALPHA_REGS_H
-#define MR_MACHDEPS_ALPHA_REGS_H
-
-/*
-** Machine registers MR_mr0 - MR_mr36 for the Alpha architecture.
-**
-** The first MR_NUM_REAL_REGS of these are real machine registers.
-** The others are just slots in a global array.
-**
-** At the moment we're only using the callee-save registers.
-** We have to use *all* of the callee-save registers if we
-** want non-local gotos to work, because otherwise there are
-** problems where a register such as $15 is saved in the
-** function prologue and restored in the function epilogue,
-** but since we jump into and out of the middle of the function
-** it gets clobbered.
-*/
-
-#define MR_NUM_REAL_REGS 7
-
-register 	MR_Word	MR_mr0 __asm__("$9");	/* register s0 */
-register	MR_Word	MR_mr1 __asm__("$10");	/* register s1 */
-register	MR_Word	MR_mr2 __asm__("$11");	/* register s2 */
-register	MR_Word	MR_mr3 __asm__("$12");	/* register s3 */
-register	MR_Word	MR_mr4 __asm__("$13");	/* register s4 */
-register	MR_Word	MR_mr5 __asm__("$14");	/* register s5 */
-register	MR_Word	MR_mr6 __asm__("$15");	/* the frame pointer (fp) */
-
-#define MR_real_reg_number_mr0	9
-#define MR_real_reg_number_mr1	10
-#define MR_real_reg_number_mr2	11
-#define MR_real_reg_number_mr3	12
-#define MR_real_reg_number_mr4	13
-#define MR_real_reg_number_mr5	14
-#define MR_real_reg_number_mr6	15
-
-#define MR_save_regs_to_mem(save_area)	(	\
-	save_area[0] = MR_mr0,			\
-	save_area[1] = MR_mr1,			\
-	save_area[2] = MR_mr2,			\
-	save_area[3] = MR_mr3,			\
-	save_area[4] = MR_mr4,			\
-	save_area[5] = MR_mr5,			\
-	save_area[6] = MR_mr6,			\
-	(void)0					\
-)
-
-#define MR_restore_regs_from_mem(save_area)	(	\
-	MR_mr0 = save_area[0],			\
-	MR_mr1 = save_area[1],			\
-	MR_mr2 = save_area[2],			\
-	MR_mr3 = save_area[3],			\
-	MR_mr4 = save_area[4],			\
-	MR_mr5 = save_area[5],			\
-	MR_mr6 = save_area[6],			\
-	(void)0					\
-)
-
-#define MR_save_transient_regs_to_mem(save_area)	((void)0)
-#define MR_restore_transient_regs_from_mem(save_area)	((void)0)
-
-#define	MR_mr7	MR_fake_reg[7]
-#define	MR_mr8	MR_fake_reg[8]
-#define	MR_mr9	MR_fake_reg[9]
-#define	MR_mr10	MR_fake_reg[10]
-#define	MR_mr11	MR_fake_reg[11]
-#define	MR_mr12	MR_fake_reg[12]
-#define	MR_mr13	MR_fake_reg[13]
-#define	MR_mr14	MR_fake_reg[14]
-#define	MR_mr15	MR_fake_reg[15]
-#define	MR_mr16	MR_fake_reg[16]
-#define	MR_mr17	MR_fake_reg[17]
-#define	MR_mr18	MR_fake_reg[18]
-#define	MR_mr19	MR_fake_reg[19]
-#define	MR_mr20	MR_fake_reg[20]
-#define	MR_mr21	MR_fake_reg[21]
-#define	MR_mr22	MR_fake_reg[22]
-#define	MR_mr23	MR_fake_reg[23]
-#define	MR_mr24	MR_fake_reg[24]
-#define	MR_mr25	MR_fake_reg[25]
-#define	MR_mr26	MR_fake_reg[26]
-#define	MR_mr27	MR_fake_reg[27]
-#define	MR_mr28	MR_fake_reg[28]
-#define	MR_mr29	MR_fake_reg[29]
-#define	MR_mr30	MR_fake_reg[30]
-#define	MR_mr31	MR_fake_reg[31]
-#define	MR_mr32	MR_fake_reg[32]
-#define	MR_mr33	MR_fake_reg[33]
-#define	MR_mr34	MR_fake_reg[34]
-#define	MR_mr35	MR_fake_reg[35]
-#define	MR_mr36	MR_fake_reg[36]
-#define	MR_mr37	MR_fake_reg[37]
-
-#endif /* not MR_MACHDEPS_ALPHA_REGS_H */
diff --git a/runtime/machdeps/alpha_regtest b/runtime/machdeps/alpha_regtest
deleted file mode 100755
index a13106a..0000000
--- a/runtime/machdeps/alpha_regtest
+++ /dev/null
@@ -1,15 +0,0 @@
-#!/bin/sh
-
-for regname in \
-	 \$0   \$1   \$2   \$3   \$4   \$5   \$6   \$7 		\
-	 \$8   \$9   \$10  \$11  \$12  \$13  \$14      		\
-	 \$16  \$17  \$18  \$19  \$20  \$21  \$22  \$23		\
-	 \$24  \$25              \$28             		\
-	 \$f0  \$f1  \$f2  \$f3  \$f4  \$f5  \$f6  \$f7		\
-	 \$f8  \$f9  \$f10 \$f11 \$f12 \$f13 \$f14 \$f15	\
-	 \$f16 \$f17 \$f18 \$f19 \$f20 \$f21 \$f22 \$f23	\
-	 \$f24 \$f25 \$f26 \$f27 \$f28 \$f29 \$f30
-do
-    ./doregtest "$regname"
-done
-
diff --git a/runtime/mercury_goto.h b/runtime/mercury_goto.h
index 60bfe57..1648d54 100644
--- a/runtime/mercury_goto.h
+++ b/runtime/mercury_goto.h
@@ -312,34 +312,7 @@

  // MACHINE SPECIFIC STUFF REQUIRED FOR NON-LOCAL GOTOS

-#if defined(__alpha__)
-
-  // We need special handling for the "global pointer" (gp) register.
-
-  // When doing a jump, we need to set $27, the "procedure value" register,
-  // to the address we are jumping to, so that we can use an `ldgp'
-  // instruction on entry to the procedure to set up the right gp value.
-
-  #define MR_ASM_JUMP(address)                                           \
-    __asm__("bis %0, %0, $27\n\t"                                        \
-        : : "r"(address) : "$27");                                       \
-    goto *(address)
-    // Explanation:
-    //  Move `address' to register $27,
-    //  jump to `address'.
-
-  // On entry to a procedure, we need to load the $gp register
-  // with the correct value relative to the current address in $27.
-
-  #define MR_INLINE_ASM_FIXUP_REGS                                       \
-    "   ldgp $gp, 0($27)\n" : : : "memory"
-
-  // On fall-thru, we need to skip the ldgp instruction.
-
-  #define MR_ASM_FALLTHROUGH(label)                                      \
-    goto MR_skip(label);
-
-#elif defined(__i386__) || defined(__mc68000__) || defined(__x86_64__)
+#if defined(__i386__) || defined(__mc68000__) || defined(__x86_64__)

    // This hack is to prevent gcc 4.x optimizing away stores to succip before
    // jumping to a label in asm_fast.
diff --git a/runtime/mercury_regs.h b/runtime/mercury_regs.h
index 6a8c448..59baa14 100644
--- a/runtime/mercury_regs.h
+++ b/runtime/mercury_regs.h
@@ -87,8 +87,6 @@
      #include "machdeps/x86_64_regs.h"
    #elif defined(__sparc__)
      #include "machdeps/sparc_regs.h"
-  #elif defined(__alpha__)
-    #include "machdeps/alpha_regs.h"
    #elif defined(__hppa__)
      #include "machdeps/pa_regs.h"
    #elif defined(_POWER) || defined(__powerpc__) || defined(__ppc__)
diff --git a/scripts/mgnuc.in b/scripts/mgnuc.in
index b3bb387..02b857c 100755
--- a/scripts/mgnuc.in
+++ b/scripts/mgnuc.in
@@ -535,7 +535,7 @@ LTO_OPTS="${CFLAGS_FOR_LTO}"

  #
  # Special case hacks for particular architectures
-# Any code here needs to be duplicated in ../configure.in.
+# Any code here needs to be duplicated in ../configure.ac.
  #

  ARCH_OPTS=""


More information about the reviews mailing list