Commit 4601494d by Richard Henderson Committed by Richard Henderson

moxie.c (moxie_static_chain, [...]): New.

        * 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.

From-SVN: r152004
parent bdeb5f0c
......@@ -183,6 +183,15 @@
mn10300_asm_trampoline_template.
(INITIALIZE_TRAMPOLINE): Move code to mn10300_trampoline_init.
* 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.
2009-09-22 Jakub Jelinek <jakub@redhat.com>
* config/rs6000/rs6000.c (bdesc_2arg): Fix CODE_FOR_vector_gt* codes
......
......@@ -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"
......@@ -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 \
......
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment