summaryrefslogtreecommitdiff
path: root/gcc/config/m68k
diff options
context:
space:
mode:
authorRichard Henderson <rth@redhat.com>2002-10-20 15:37:14 -0700
committerRichard Henderson <rth@gcc.gnu.org>2002-10-20 15:37:14 -0700
commitc590b62588c84c4f0b7770a9e5c6f3216a87dce7 (patch)
treeabe4a377f5765b9d4daf391afe9b62b6a6f5af4f /gcc/config/m68k
parent16f7d029b9501a8dce95d7a4cc00e54f687ddf59 (diff)
downloadgcc-c590b62588c84c4f0b7770a9e5c6f3216a87dce7.tar.gz
target.h (struct gcc_target): Line wrap.
* target.h (struct gcc_target): Line wrap. * config/alpha/alpha.c (alpha_output_mi_thunk_osf): Static. (TARGET_ASM_OUTPUT_MI_THUNK): Define here... * config/alpha/alpha.h: ... not here. * config/alpha/alpha-protos.h: Update. * config/arm/arm.c, config/arm/arm.h, config/arm/arm-protos.h config/cris/cris-protos.h, config/cris/cris.c, config/cris/cris.h, config/frv/frv-protos.h, config/frv/frv.c, config/frv/frv.h, config/i386/i386-protos.h, config/i386/i386.c, config/i386/openbsd.h, config/i386/unix.h, config/i960/i960-protos.h, config/i960/i960.c, config/i960/i960.h, config/ia64/ia64-protos.h, config/ia64/ia64.c, config/ia64/ia64.h, config/m68k/linux.h, config/m68k/m68k-protos.h, config/m68k/m68k.c, config/m68k/netbsd-elf.h, config/m68k/openbsd.h, config/mmix/mmix-protos.h, config/mmix/mmix.c, config/mmix/mmix.h, config/pa/pa-protos.h, config/pa/pa.c, config/pa/pa.h, config/s390/s390-protos.h, config/s390/s390.c, config/s390/s390.h, config/sparc/openbsd.h, config/sparc/sparc-protos.h, config/sparc/sparc.c, config/sparc/sparc.h, config/stormy16/stormy16-protos.h, config/stormy16/stormy16.c, config/stormy16/stormy16.h: Similarly. * config/m68k/m68k.c (m68k_output_mi_thunk): Replicate mnemonic selection logic from call patterns. From-SVN: r58340
Diffstat (limited to 'gcc/config/m68k')
-rw-r--r--gcc/config/m68k/linux.h4
-rw-r--r--gcc/config/m68k/m68k-protos.h4
-rw-r--r--gcc/config/m68k/m68k.c77
-rw-r--r--gcc/config/m68k/netbsd-elf.h6
-rw-r--r--gcc/config/m68k/openbsd.h35
5 files changed, 57 insertions, 69 deletions
diff --git a/gcc/config/m68k/linux.h b/gcc/config/m68k/linux.h
index ce2fbb089f0..bf80cea9f9c 100644
--- a/gcc/config/m68k/linux.h
+++ b/gcc/config/m68k/linux.h
@@ -354,7 +354,3 @@ do { \
: "d" (_beg), "d" (_len) \
: "%d0", "%d2", "%d3"); \
}
-
-/* Output code to add DELTA to the first argument, and then jump to FUNCTION.
- Used for C++ multiple inheritance. */
-#define TARGET_ASM_OUTPUT_MI_THUNK m68k_output_mi_thunk
diff --git a/gcc/config/m68k/m68k-protos.h b/gcc/config/m68k/m68k-protos.h
index 3beec986ae4..72120ead37f 100644
--- a/gcc/config/m68k/m68k-protos.h
+++ b/gcc/config/m68k/m68k-protos.h
@@ -64,10 +64,6 @@ extern int pcrel_address PARAMS ((rtx, enum machine_mode));
extern rtx legitimize_pic_address PARAMS ((rtx, enum machine_mode, rtx));
#endif /* RTX_CODE */
-#ifdef TREE_CODE
-extern void m68k_output_mi_thunk PARAMS ((FILE *, tree, HOST_WIDE_INT, tree));
-#endif /* TREE_CODE */
-
extern int flags_in_68881 PARAMS ((void));
extern int use_return_insn PARAMS ((void));
extern void override_options PARAMS ((void));
diff --git a/gcc/config/m68k/m68k.c b/gcc/config/m68k/m68k.c
index 66c640cd2f8..9543e98f056 100644
--- a/gcc/config/m68k/m68k.c
+++ b/gcc/config/m68k/m68k.c
@@ -65,6 +65,7 @@ static void m68k_coff_asm_named_section PARAMS ((const char *, unsigned int));
#ifdef CTOR_LIST_BEGIN
static void m68k_svr3_asm_out_constructor PARAMS ((rtx, int));
#endif
+static void m68k_output_mi_thunk PARAMS ((FILE *, tree, HOST_WIDE_INT, tree));
/* Alignment to use for loops and jumps */
@@ -122,6 +123,9 @@ int m68k_last_compare_had_fp_operands;
#undef TARGET_ASM_FUNCTION_EPILOGUE
#define TARGET_ASM_FUNCTION_EPILOGUE m68k_output_function_epilogue
+#undef TARGET_ASM_OUTPUT_MI_THUNK
+#define TARGET_ASM_OUTPUT_MI_THUNK m68k_output_mi_thunk
+
struct gcc_target targetm = TARGET_INITIALIZER;
/* Sometimes certain combinations of command options do not make
@@ -3836,34 +3840,67 @@ m68k_svr3_asm_out_constructor (symbol, priority)
}
#endif
-void
+static void
m68k_output_mi_thunk (file, thunk, delta, function)
FILE *file;
tree thunk ATTRIBUTE_UNUSED;
HOST_WIDE_INT delta;
tree function;
{
- if (delta > 0 && delta <= 8)
+ rtx xops[1];
+ const char *fmt;
+
+ if (delta > 0 && delta <= 8)
asm_fprintf (file, "\taddq.l %I%d,4(%Rsp)\n", (int) delta);
- else if (delta < 0 && delta >= -8)
+ else if (delta < 0 && delta >= -8)
asm_fprintf (file, "\tsubq.l %I%d,4(%Rsp)\n", (int) -delta);
- else
+ else
{
asm_fprintf (file, "\tadd.l %I");
- fprintf (file, HOST_WIDE_INT_PRINT_DEC, delta);
- asm_fprintf (file, ",4(%Rsp)\n", delta);
- }
-
- if (flag_pic)
- {
- fprintf (file, "\tbra.l ");
- assemble_name (file, XSTR (XEXP (DECL_RTL (function), 0), 0));
- fprintf (file, "@PLTPC\n");
- }
- else
- {
- fprintf (file, "\tjmp ");
- assemble_name (file, XSTR (XEXP (DECL_RTL (function), 0), 0));
- fprintf (file, "\n");
- }
+ fprintf (file, HOST_WIDE_INT_PRINT_DEC, delta);
+ asm_fprintf (file, ",4(%Rsp)\n");
+ }
+
+ xops[0] = DECL_RTL (function);
+
+ /* Logic taken from call patterns in m68k.md. */
+ if (flag_pic)
+ {
+ if (TARGET_PCREL)
+ fmt = "bra.l %o0";
+ else
+ {
+#ifdef MOTOROLA
+#ifdef HPUX_ASM
+ fmt = "bra.l %0";
+#else
+#ifdef USE_GAS
+ fmt = "bra.l %0@PLTPC";
+#else
+ fmt = "bra %0@PLTPC";
+#endif
+#endif
+#else
+#ifdef USE_GAS
+ fmt = "bra.l %0";
+#else
+ fmt = "jbra %0,a1";
+#endif
+#endif
+ }
+ }
+ else
+ {
+#if defined (MOTOROLA) && !defined (USE_GAS)
+#ifdef MOTOROLA_BSR
+ fmt = "bra %0";
+#else
+ fmt = "jmp %0";
+#endif
+#else
+ fmt = "jbra %0";
+#endif
+ }
+
+ output_asm_insn (fmt, xops);
}
diff --git a/gcc/config/m68k/netbsd-elf.h b/gcc/config/m68k/netbsd-elf.h
index 107bdeb03df..f9576da2905 100644
--- a/gcc/config/m68k/netbsd-elf.h
+++ b/gcc/config/m68k/netbsd-elf.h
@@ -421,12 +421,6 @@ while (0)
#undef DEFAULT_PCC_STRUCT_RETURN
#define DEFAULT_PCC_STRUCT_RETURN 1
-
-/* Output code to add DELTA to the first argument, and then jump to FUNCTION.
- Used for C++ multiple inheritance. */
-
-#define TARGET_ASM_OUTPUT_MI_THUNK m68k_output_mi_thunk
-
/* Output assembler code for a block containing the constant parts
of a trampoline, leaving space for the variable parts. */
diff --git a/gcc/config/m68k/openbsd.h b/gcc/config/m68k/openbsd.h
index 8d62bdd6fd1..0a5038c4dc7 100644
--- a/gcc/config/m68k/openbsd.h
+++ b/gcc/config/m68k/openbsd.h
@@ -84,38 +84,3 @@ Boston, MA 02111-1307, USA. */
dwarf unwind information. egcs doesn't try too hard to check internal
configuration files... */
#define DWARF2_UNWIND_INFO 0
-
-
-/* TODO: TARGET_ASM_OUTPUT_MI_THUNK is busted. I need to figure out
- what bra func@PLTPC means under linux, and find the corresponding
- construction for our gas/pic setup. */
-#if 0
-/* Taken from linux.h. Processor dependent optimized code to handle C++
- multiple inheritance vtable lookup. */
-
-/* Output code to add DELTA to the first argument, and then jump to FUNCTION.
- Used for C++ multiple inheritance. */
-#define TARGET_ASM_OUTPUT_MI_THUNK(FILE, THUNK_FNDECL, DELTA, FUNCTION) \
-do { \
- if (DELTA > 0 && DELTA <= 8) \
- asm_fprintf (FILE, "\taddq.l %I%d,4(%Rsp)\n", DELTA); \
- else if (DELTA < 0 && DELTA >= -8) \
- asm_fprintf (FILE, "\tsubq.l %I%d,4(%Rsp)\n", -DELTA); \
- else \
- asm_fprintf (FILE, "\tadd.l %I%d,4(%Rsp)\n", DELTA); \
- \
- if (flag_pic) \
- { \
- fprintf (FILE, "\tbra.l "); \
- assemble_name (FILE, XSTR (XEXP (DECL_RTL (FUNCTION), 0), 0)); \
- fprintf (FILE, "@PLTPC\n"); \
- } \
- else \
- { \
- fprintf (FILE, "\tjmp "); \
- assemble_name (FILE, XSTR (XEXP (DECL_RTL (FUNCTION), 0), 0)); \
- fprintf (FILE, "\n"); \
- } \
-} while (0)
-#endif
-