summaryrefslogtreecommitdiff
path: root/gcc/config
diff options
context:
space:
mode:
authorStan Shebs <shebs@apple.com>2004-12-09 18:25:15 +0000
committerStan Shebs <shebs@gcc.gnu.org>2004-12-09 18:25:15 +0000
commitdc4d6ffa26ba4902c278fe0e11053ad4813a762c (patch)
tree1f1bc5c17b0dd7a123c0c9718c6193ffd68a420a /gcc/config
parent366e6bd1733bb53b0f555ea4365e9d16f24fa143 (diff)
downloadgcc-dc4d6ffa26ba4902c278fe0e11053ad4813a762c.tar.gz
darwin-asm.h: New file, 32/64-bit assembly macros formerly in darwin-tramp.asm.
* 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
Diffstat (limited to 'gcc/config')
-rw-r--r--gcc/config/rs6000/darwin-asm.h61
-rw-r--r--gcc/config/rs6000/darwin-fpsave.asm10
-rw-r--r--gcc/config/rs6000/darwin-tramp.asm24
-rw-r--r--gcc/config/rs6000/t-darwin3
4 files changed, 71 insertions, 27 deletions
diff --git a/gcc/config/rs6000/darwin-asm.h b/gcc/config/rs6000/darwin-asm.h
new file mode 100644
index 00000000000..68b8f189c2a
--- /dev/null
+++ b/gcc/config/rs6000/darwin-asm.h
@@ -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 */
diff --git a/gcc/config/rs6000/darwin-fpsave.asm b/gcc/config/rs6000/darwin-fpsave.asm
index c8c646b09db..4e6e2fa86d3 100644
--- a/gcc/config/rs6000/darwin-fpsave.asm
+++ b/gcc/config/rs6000/darwin-fpsave.asm
@@ -40,10 +40,12 @@
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
diff --git a/gcc/config/rs6000/darwin-tramp.asm b/gcc/config/rs6000/darwin-tramp.asm
index 314a360b7f8..6d0fab223d1 100644
--- a/gcc/config/rs6000/darwin-tramp.asm
+++ b/gcc/config/rs6000/darwin-tramp.asm
@@ -33,29 +33,7 @@
* 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. */
diff --git a/gcc/config/rs6000/t-darwin b/gcc/config/rs6000/t-darwin
index 53324ae16d1..467c426f976 100644
--- a/gcc/config/rs6000/t-darwin
+++ b/gcc/config/rs6000/t-darwin
@@ -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