darwin-asm.h: New file, 32/64-bit assembly macros formerly in darwin-tramp.asm.
authorStan Shebs <shebs@apple.com>
Thu, 9 Dec 2004 18:25:15 +0000 (18:25 +0000)
committerStan Shebs <shebs@gcc.gnu.org>
Thu, 9 Dec 2004 18:25:15 +0000 (18:25 +0000)
        * config/rs6000/darwin-asm.h: New file, 32/64-bit assembly macros
        formerly in darwin-tramp.asm.
        * config/rs6000/darwin-tramp.asm: Include darwin-asm.h.
        * config/rs6000/darwin-fpsave.asm: Use 32/64-bit macros.
        * config/rs6000/t-darwin: Add dependencies.

From-SVN: r91960

gcc/ChangeLog
gcc/config/rs6000/darwin-asm.h [new file with mode: 0644]
gcc/config/rs6000/darwin-fpsave.asm
gcc/config/rs6000/darwin-tramp.asm
gcc/config/rs6000/t-darwin

index 80b36ab34b06699e5a05c034a5af53151a6ccde8..d82d719cc8854ca0a6424093aeee3be3917f60de 100644 (file)
@@ -1,3 +1,11 @@
+2004-12-09  Stan Shebs  <shebs@apple.com>
+
+       * config/rs6000/darwin-asm.h: New file, 32/64-bit assembly macros
+       formerly in darwin-tramp.asm.
+       * config/rs6000/darwin-tramp.asm: Include darwin-asm.h.
+       * config/rs6000/darwin-fpsave.asm: Use 32/64-bit macros.
+       * config/rs6000/t-darwin: Add dependencies.
+
 2004-12-09  Richard Henderson  <rth@redhat.com>
 
        PR target/17025
diff --git a/gcc/config/rs6000/darwin-asm.h b/gcc/config/rs6000/darwin-asm.h
new file mode 100644 (file)
index 0000000..68b8f18
--- /dev/null
@@ -0,0 +1,61 @@
+/*  Macro definitions to used to support 32/64-bit code in Darwin's
+ *  assembly files.
+ *
+ *   Copyright (C) 2004 Free Software Foundation, Inc.
+ * 
+ * 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 the
+ * Free Software Foundation; either version 2, or (at your option) any
+ * later version.
+ * 
+ * In addition to the permissions in the GNU General Public License, the
+ * Free Software Foundation gives you unlimited permission to link the
+ * compiled version of this file with other programs, and to distribute
+ * those programs without any restriction coming from the use of this
+ * file.  (The General Public License restrictions do apply in other
+ * respects; for example, they cover modification of the file, and
+ * distribution when not linked into another program.)
+ * 
+ * This file is distributed in the hope that it will be useful, but
+ * WITHOUT ANY WARRANTY; without even the implied warranty of
+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the GNU
+ * General Public License for more details.
+ * 
+ * You should have received a copy of the GNU General Public License
+ * along with this program; see the file COPYING.  If not, write to
+ * the Free Software Foundation, 59 Temple Place - Suite 330,
+ * Boston, MA 02111-1307, USA.
+ * 
+ *  As a special exception, if you link this library with files
+ *  compiled with GCC to produce an executable, this does not cause the
+ *  resulting executable to be covered by the GNU General Public License.
+ *  This exception does not however invalidate any other reasons why the
+ *  executable file might be covered by the GNU General Public License.
+ */ 
+
+/* These are donated from /usr/include/architecture/ppc . */
+
+#if defined(__ppc64__)
+#define MODE_CHOICE(x, y) y
+#else
+#define MODE_CHOICE(x, y) x
+#endif
+
+#define cmpg    MODE_CHOICE(cmpw, cmpd)
+#define lg      MODE_CHOICE(lwz, ld)
+#define stg     MODE_CHOICE(stw, std)
+#define lgx     MODE_CHOICE(lwzx, ldx)
+#define stgx    MODE_CHOICE(stwx, stdx)
+#define lgu     MODE_CHOICE(lwzu, ldu)
+#define stgu    MODE_CHOICE(stwu, stdu)
+#define lgux    MODE_CHOICE(lwzux, ldux)
+#define stgux   MODE_CHOICE(stwux, stdux)
+#define lgwa    MODE_CHOICE(lwz, lwa)
+
+#define g_long  MODE_CHOICE(long, quad)         /* usage is ".g_long" */
+
+#define GPR_BYTES       MODE_CHOICE(4,8)        /* size of a GPR in bytes */
+#define LOG2_GPR_BYTES  MODE_CHOICE(2,3)        /* log2(GPR_BYTES) */
+
+#define SAVED_LR_OFFSET MODE_CHOICE(8,16)      /* position of saved
+                                                  LR in frame */
index c8c646b09dba07a576a8a57ecd29d1da3d1c829f..4e6e2fa86d3ed1fb689ae09ede4ebdf54b9d837e 100644 (file)
 
    MORAL: DO NOT MESS AROUND WITH THESE FUNCTIONS!  */
 
+#include "darwin-asm.h"
+
 .text
        .align 2
 
-/* saveFP saves R0 -- assumed to be the callers LR -- to 8(R1).  */
+/* saveFP saves R0 -- assumed to be the callers LR -- to 8/16(R1).  */
 
 .private_extern saveFP
 saveFP:
@@ -65,10 +67,10 @@ saveFP:
        stfd f29,-24(r1)
        stfd f30,-16(r1)
        stfd f31,-8(r1)
-       stw  r0,8(r1)
+       stg  r0,SAVED_LR_OFFSET(r1)
        blr
 
-/* restFP restores the caller`s LR from 8(R1).  Note that the code for
+/* restFP restores the caller`s LR from 8/16(R1).  Note that the code for
    this starts at the offset of F30 restoration, so calling this
    routine in an attempt to restore only F31 WILL NOT WORK (it would
    be a stupid thing to do, anyway.)  */
@@ -92,7 +94,7 @@ restFP:
        lfd f28,-32(r1)
        lfd f29,-24(r1)
                        /* <OFFSET OF F30 RESTORE> restore callers LR  */
-       lwz r0,8(r1)
+       lg r0,SAVED_LR_OFFSET(r1)
        lfd f30,-16(r1)
                        /* and prepare for return to caller  */
        mtlr r0 
index 314a360b7f8e10057be6e864e5928b00f1f566b1..6d0fab223d10284d8a5d425c6b35d6aa33a5574a 100644 (file)
  *  executable file might be covered by the GNU General Public License.
  */ 
 
-/* Some 32/64 macros, donated from /usr/include/architecture/ppc . */
-
-#if defined(__ppc64__)
-#define MODE_CHOICE(x, y) y
-#else
-#define MODE_CHOICE(x, y) x
-#endif
-
-#define cmpg    MODE_CHOICE(cmpw, cmpd)
-#define lg      MODE_CHOICE(lwz, ld)
-#define stg     MODE_CHOICE(stw, std)
-#define lgx     MODE_CHOICE(lwzx, ldx)
-#define stgx    MODE_CHOICE(stwx, stdx)
-#define lgu     MODE_CHOICE(lwzu, ldu)
-#define stgu    MODE_CHOICE(stwu, stdu)
-#define lgux    MODE_CHOICE(lwzux, ldux)
-#define stgux   MODE_CHOICE(stwux, stdux)
-#define lgwa    MODE_CHOICE(lwz, lwa)
-
-#define g_long  MODE_CHOICE(long, quad)         /* usage is ".g_long" */
-
-#define GPR_BYTES       MODE_CHOICE(4,8)        /* size of a GPR in bytes */
-#define LOG2_GPR_BYTES  MODE_CHOICE(2,3)        /* log2(GPR_BYTES) */
+#include "darwin-asm.h"
 
 /* Set up trampolines.  */
 
index 53324ae16d185aaa8ad63f2221ca424cc4ca67d2..467c426f9766766912d8718277690ad82c5f0ec2 100644 (file)
@@ -15,3 +15,6 @@ TARGET_LIBGCC2_CFLAGS = -Wa,-force_cpusubtype_ALL
 SHLIB_MAPFILES += $(srcdir)/config/rs6000/libgcc-ppc64.ver
 
 LIB2ADDEH += $(srcdir)/config/rs6000/darwin-fallback.c
+
+darwin-fpsave.o:       $(srcdir)/config/rs6000/darwin-asm.h
+darwin-tramp.o:                $(srcdir)/config/rs6000/darwin-asm.h