summaryrefslogtreecommitdiff
path: root/gcc/config/moxie
diff options
context:
space:
mode:
authorrth <rth@138bc75d-0d04-0410-961f-82ee72b054a4>2009-09-22 15:14:39 +0000
committerrth <rth@138bc75d-0d04-0410-961f-82ee72b054a4>2009-09-22 15:14:39 +0000
commit7b6fcb6fc46e1d5c780e676a3f36843fe7ce7027 (patch)
treea174aa134bdde941d143b7cccf75e7e59e653d3c /gcc/config/moxie
parent3e16f982667e76dde68205a46b9f9b532d12b3f5 (diff)
downloadgcc-7b6fcb6fc46e1d5c780e676a3f36843fe7ce7027.tar.gz
* config/moxie/moxie.c (moxie_static_chain,
moxie_asm_trampoline_template, moxie_trampoline_init, TARGET_STATIC_CHAIN, TARGET_ASM_TRAMPOLINE_TEMPLATE, TARGET_TRAMPOLINE_INIT): New. * config/moxie/moxie.h (INITIALIZE_TRAMPOLINE): Move code to moxie_trampoline_init. (TRAMPOLINE_TEMPLATE): Move code to moxie_asm_trampoline_template. (STATIC_CHAIN, STATIC_CHAIN_INCOMING): Remove. git-svn-id: svn+ssh://gcc.gnu.org/svn/gcc/trunk@152004 138bc75d-0d04-0410-961f-82ee72b054a4
Diffstat (limited to 'gcc/config/moxie')
-rw-r--r--gcc/config/moxie/moxie.c56
-rw-r--r--gcc/config/moxie/moxie.h36
2 files changed, 56 insertions, 36 deletions
diff --git a/gcc/config/moxie/moxie.c b/gcc/config/moxie/moxie.c
index 8b2d8b23fe3..215bbdf75a3 100644
--- a/gcc/config/moxie/moxie.c
+++ b/gcc/config/moxie/moxie.c
@@ -453,6 +453,55 @@ moxie_arg_partial_bytes (CUMULATIVE_ARGS *cum,
return 0;
}
+/* Worker function for TARGET_STATIC_CHAIN. */
+
+static rtx
+moxie_static_chain (const_tree fndecl, bool incoming_p)
+{
+ rtx addr, mem;
+
+ if (DECL_NO_STATIC_CHAIN (fndecl))
+ return NULL;
+
+ if (incoming_p)
+ addr = plus_constant (arg_pointer_rtx, 2 * UNITS_PER_WORD);
+ else
+ addr = plus_constant (stack_pointer_rtx, -UNITS_PER_WORD);
+
+ mem = gen_rtx_MEM (Pmode, addr);
+ MEM_NOTRAP_P (mem) = 1;
+
+ return mem;
+}
+
+/* Worker function for TARGET_ASM_TRAMPOLINE_TEMPLATE. */
+
+static void
+moxie_asm_trampoline_template (FILE *f)
+{
+ fprintf (f, "\tpush $sp, $r0\n");
+ fprintf (f, "\tldi.l $r0, 0x0\n");
+ fprintf (f, "\tsto.l 0x8($fp), $r0\n");
+ fprintf (f, "\tpop $sp, $r0\n");
+ fprintf (f, "\tjmpa 0x0\n");
+}
+
+/* Worker function for TARGET_TRAMPOLINE_INIT. */
+
+static void
+moxie_trampoline_init (rtx m_tramp, tree fndecl, rtx chain_value)
+{
+ rtx mem, fnaddr = XEXP (DECL_RTL (fndecl), 0);
+
+ emit_block_move (m_tramp, assemble_trampoline_template (),
+ GEN_INT (TRAMPOLINE_SIZE), BLOCK_OP_NORMAL);
+
+ mem = adjust_address (m_tramp, SImode, 4);
+ emit_move_insn (mem, chain_value);
+ mem = adjust_address (m_tramp, SImode, 18);
+ emit_move_insn (mem, fnaddr);
+}
+
/* The Global `targetm' Variable. */
/* Initialize the GCC target structure. */
@@ -485,6 +534,13 @@ moxie_arg_partial_bytes (CUMULATIVE_ARGS *cum,
#undef TARGET_FRAME_POINTER_REQUIRED
#define TARGET_FRAME_POINTER_REQUIRED hook_bool_void_true
+#undef TARGET_STATIC_CHAIN
+#define TARGET_STATIC_CHAIN moxie_static_chain
+#undef TARGET_ASM_TRAMPOLINE_TEMPLATE
+#define TARGET_ASM_TRAMPOLINE_TEMPLATE moxie_asm_trampoline_template
+#undef TARGET_TRAMPOLINE_INIT
+#define TARGET_TRAMPOLINE_INIT moxie_trampoline_init
+
struct gcc_target targetm = TARGET_INITIALIZER;
#include "gt-moxie.h"
diff --git a/gcc/config/moxie/moxie.h b/gcc/config/moxie/moxie.h
index 21792da6527..f1b77eaf0c2 100644
--- a/gcc/config/moxie/moxie.h
+++ b/gcc/config/moxie/moxie.h
@@ -391,31 +391,6 @@ enum reg_class
/* Alignment required for trampolines, in bits. */
#define TRAMPOLINE_ALIGNMENT 16
-/* A C statement to initialize the variable parts of a trampoline. ADDR is an
- RTX for the address of the trampoline; FNADDR is an RTX for the address of
- the nested function; STATIC_CHAIN is an RTX for the static chain value that
- should be passed to the function when it is called. */
-#define INITIALIZE_TRAMPOLINE(ADDR, FNADDR, STATIC_CHAIN) \
-do \
-{ \
- emit_move_insn (gen_rtx_MEM (SImode, \
- plus_constant (ADDR, 4)), STATIC_CHAIN); \
- emit_move_insn (gen_rtx_MEM (SImode, plus_constant (ADDR, 18)), FNADDR); \
-} while (0);
-
-/* A C statement to output, on the stream FILE, assembler code for a
- block of data that contains the constant parts of a trampoline.
- This code should not include a label--the label is taken care of
- automatically. */
-#define TRAMPOLINE_TEMPLATE(FILE) \
-{ \
- fprintf (FILE, "\tpush $sp, $r0\n"); \
- fprintf (FILE, "\tldi.l $r0, 0x0\n"); \
- fprintf (FILE, "\tsto.l 0x8($fp), $r0\n"); \
- fprintf (FILE, "\tpop $sp, $r0\n"); \
- fprintf (FILE, "\tjmpa 0x0\n"); \
-}
-
/* An alias for the machine mode for pointers. */
#define Pmode SImode
@@ -435,17 +410,6 @@ do \
access the function's argument list. */
#define ARG_POINTER_REGNUM MOXIE_QAP
-/* If the static chain is passed in memory, these macros provide rtx
- giving 'mem' expressions that denote where they are stored.
- 'STATIC_CHAIN' and 'STATIC_CHAIN_INCOMING' give the locations as
- seen by the calling and called functions, respectively. */
-
-#define STATIC_CHAIN \
- gen_rtx_MEM (Pmode, plus_constant (stack_pointer_rtx, -UNITS_PER_WORD))
-
-#define STATIC_CHAIN_INCOMING \
- gen_rtx_MEM (Pmode, plus_constant (arg_pointer_rtx, 2 * UNITS_PER_WORD))
-
#define HARD_FRAME_POINTER_REGNUM MOXIE_FP
#define ELIMINABLE_REGS \