aboutsummaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorRichard Henderson <rth@redhat.com>2009-09-22 08:14:54 -0700
committerRichard Henderson <rth@gcc.gnu.org>2009-09-22 08:14:54 -0700
commit8dd65c37e580de35338b0f5cd646f3d436e3e3a0 (patch)
tree4be42ebe14e66e5dab4abfc6676cc4be90800b4b
parent859c146ca052061e4aba946a4bf5c292e3983c26 (diff)
downloadgcc-8dd65c37e580de35338b0f5cd646f3d436e3e3a0.zip
gcc-8dd65c37e580de35338b0f5cd646f3d436e3e3a0.tar.gz
gcc-8dd65c37e580de35338b0f5cd646f3d436e3e3a0.tar.bz2
pdp11.c (pdp11_trampoline_init): New.
* config/pdp11/pdp11.c (pdp11_trampoline_init): New. (TARGET_TRAMPOLINE_INIT): New. * config/pdp11/pdp11.h (TRAMPOLINE_TEMPLATE): Remove. (INITIALIZE_TRAMPOLINE): Move code to pdp11_trampoline_init. From-SVN: r152006
-rw-r--r--gcc/ChangeLog5
-rw-r--r--gcc/config/pdp11/pdp11.c32
-rw-r--r--gcc/config/pdp11/pdp11.h33
3 files changed, 37 insertions, 33 deletions
diff --git a/gcc/ChangeLog b/gcc/ChangeLog
index cdb3ec9..1c1b45e 100644
--- a/gcc/ChangeLog
+++ b/gcc/ChangeLog
@@ -204,6 +204,11 @@
adjust for hook parameters.
(TRAMPOLINE_ADJUST_ADDRESS): Move code to pa_trampoline_adjust_address.
+ * config/pdp11/pdp11.c (pdp11_trampoline_init): New.
+ (TARGET_TRAMPOLINE_INIT): New.
+ * config/pdp11/pdp11.h (TRAMPOLINE_TEMPLATE): Remove.
+ (INITIALIZE_TRAMPOLINE): Move code to pdp11_trampoline_init.
+
2009-09-22 Jakub Jelinek <jakub@redhat.com>
* config/rs6000/rs6000.c (bdesc_2arg): Fix CODE_FOR_vector_gt* codes
diff --git a/gcc/config/pdp11/pdp11.c b/gcc/config/pdp11/pdp11.c
index b467608..f95d03c 100644
--- a/gcc/config/pdp11/pdp11.c
+++ b/gcc/config/pdp11/pdp11.c
@@ -152,6 +152,7 @@ static void pdp11_output_function_prologue (FILE *, HOST_WIDE_INT);
static void pdp11_output_function_epilogue (FILE *, HOST_WIDE_INT);
static bool pdp11_rtx_costs (rtx, int, int, int *, bool);
static bool pdp11_return_in_memory (const_tree, const_tree);
+static void pdp11_trampoline_init (rtx, tree, rtx);
/* Initialize the GCC target structure. */
#undef TARGET_ASM_BYTE_OP
@@ -185,6 +186,9 @@ static bool pdp11_return_in_memory (const_tree, const_tree);
#undef TARGET_RETURN_IN_MEMORY
#define TARGET_RETURN_IN_MEMORY pdp11_return_in_memory
+#undef TARGET_TRAMPOLINE_INIT
+#define TARGET_TRAMPOLINE_INIT pdp11_trampoline_init
+
struct gcc_target targetm = TARGET_INITIALIZER;
/* Implement TARGET_HANDLE_OPTION. */
@@ -1740,3 +1744,31 @@ pdp11_return_in_memory (const_tree type, const_tree fntype ATTRIBUTE_UNUSED)
return (TYPE_MODE (type) == DImode
|| (TYPE_MODE (type) == DFmode && ! TARGET_AC0));
}
+
+/* Worker function for TARGET_TRAMPOLINE_INIT.
+
+ trampoline - how should i do it in separate i+d ?
+ have some allocate_trampoline magic???
+
+ the following should work for shared I/D:
+
+ MV #STATIC, $4 0x940Y 0x0000 <- STATIC; Y = STATIC_CHAIN_REGNUM
+ JMP FUNCTION 0x0058 0x0000 <- FUNCTION
+*/
+
+static void
+pdp11_trampoline_init (rtx m_tramp, tree fndecl, rtx chain_value)
+{
+ rtx fnaddr = XEXP (DECL_RTL (fndecl), 0);
+ rtx mem;
+
+ gcc_assert (!TARGET_SPLIT);
+
+ mem = adjust_address (m_tramp, HImode, 0);
+ emit_move_insn (mem, GEN_INT (0x9400+STATIC_CHAIN_REGNUM));
+ mem = adjust_address (m_tramp, HImode, 2);
+ emit_move_insn (mem, chain_value);
+ mem = adjust_address (m_tramp, HImode, 4);
+ emit_move_insn (mem, GEN_INT (0x0058));
+ emit_move_insn (mem, fnaddr);
+}
diff --git a/gcc/config/pdp11/pdp11.h b/gcc/config/pdp11/pdp11.h
index ac678f5..8997612 100644
--- a/gcc/config/pdp11/pdp11.h
+++ b/gcc/config/pdp11/pdp11.h
@@ -983,42 +983,9 @@ extern struct rtx_def *cc0_reg_rtx;
fprintf (FILE, "\tmov (sp)+, %s\n", reg_names[REGNO]) \
)
-/* trampoline - how should i do it in separate i+d ?
- have some allocate_trampoline magic???
-
- the following should work for shared I/D: */
-
-/* lets see whether this works as trampoline:
-MV #STATIC, $4 0x940Y 0x0000 <- STATIC; Y = STATIC_CHAIN_REGNUM
-JMP FUNCTION 0x0058 0x0000 <- FUNCTION
-*/
-
-#define TRAMPOLINE_TEMPLATE(FILE) \
-{ \
- gcc_assert (!TARGET_SPLIT); \
- \
- assemble_aligned_integer (2, GEN_INT (0x9400+STATIC_CHAIN_REGNUM)); \
- assemble_aligned_integer (2, const0_rtx); \
- assemble_aligned_integer (2, GEN_INT(0x0058)); \
- assemble_aligned_integer (2, const0_rtx); \
-}
-
#define TRAMPOLINE_SIZE 8
#define TRAMPOLINE_ALIGNMENT 16
-/* Emit RTL insns to initialize the variable parts of a trampoline.
- FNADDR is an RTX for the address of the function's pure code.
- CXT is an RTX for the static chain value for the function. */
-
-#define INITIALIZE_TRAMPOLINE(TRAMP,FNADDR,CXT) \
-{ \
- gcc_assert (!TARGET_SPLIT); \
- \
- emit_move_insn (gen_rtx_MEM (HImode, plus_constant (TRAMP, 2)), CXT); \
- emit_move_insn (gen_rtx_MEM (HImode, plus_constant (TRAMP, 6)), FNADDR); \
-}
-
-
/* Some machines may desire to change what optimizations are
performed for various optimization levels. This macro, if
defined, is executed once just after the optimization level is