diff options
author | Richard Henderson <rth@redhat.com> | 2009-09-22 08:13:53 -0700 |
---|---|---|
committer | Richard Henderson <rth@gcc.gnu.org> | 2009-09-22 08:13:53 -0700 |
commit | 71e0af3ce5714c6cefa9e160eb37f35bd5fdad72 (patch) | |
tree | 1be097a45373d097fd23e8c96f9fcd03712e9cfd /gcc/config/mcore | |
parent | 0d7e5af167ecba1bee5a74f163e42754de5af980 (diff) | |
download | gcc-71e0af3ce5714c6cefa9e160eb37f35bd5fdad72.zip gcc-71e0af3ce5714c6cefa9e160eb37f35bd5fdad72.tar.gz gcc-71e0af3ce5714c6cefa9e160eb37f35bd5fdad72.tar.bz2 |
mcore.c (TARGET_ASM_TRAMPOLINE_TEMPLATE): New.
* config/mcore/mcore.c (TARGET_ASM_TRAMPOLINE_TEMPLATE): New.
(TARGET_TRAMPOLINE_INIT): New.
(mcore_function_value): Fix typo.
(mcore_asm_trampoline_template, mcore_trampoline_init): New.
* config/mcore/mcore.h (TRAMPOLINE_TEMPLATE): Move code
to mcore_asm_trampoline_template.
(INITIALIZE_TRAMPOLINE): Move code to mcore_trampoline_init.
From-SVN: r151999
Diffstat (limited to 'gcc/config/mcore')
-rw-r--r-- | gcc/config/mcore/mcore.c | 49 | ||||
-rw-r--r-- | gcc/config/mcore/mcore.h | 30 |
2 files changed, 47 insertions, 32 deletions
diff --git a/gcc/config/mcore/mcore.c b/gcc/config/mcore/mcore.c index 170b4b0..de897fd 100644 --- a/gcc/config/mcore/mcore.c +++ b/gcc/config/mcore/mcore.c @@ -144,7 +144,8 @@ static bool mcore_return_in_memory (const_tree, const_tree); static int mcore_arg_partial_bytes (CUMULATIVE_ARGS *, enum machine_mode, tree, bool); - +static void mcore_asm_trampoline_template (FILE *); +static void mcore_trampoline_init (rtx, tree, rtx); /* MCore specific attributes. */ @@ -209,6 +210,11 @@ static const struct attribute_spec mcore_attribute_table[] = #undef TARGET_SETUP_INCOMING_VARARGS #define TARGET_SETUP_INCOMING_VARARGS mcore_setup_incoming_varargs +#undef TARGET_ASM_TRAMPOLINE_TEMPLATE +#define TARGET_ASM_TRAMPOLINE_TEMPLATE mcore_asm_trampoline_template +#undef TARGET_TRAMPOLINE_INIT +#define TARGET_TRAMPOLINE_INIT mcore_trampoline_init + struct gcc_target targetm = TARGET_INITIALIZER; /* Adjust the stack and return the number of bytes taken to do it. */ @@ -2736,7 +2742,7 @@ mcore_function_value (const_tree valtype, const_tree func) mode = TYPE_MODE (valtype); /* Since we promote return types, we must promote the mode here too. */ - mode = promote_function_mode (valtype, mode, &unsignedp, func, 1); + mode = promote_function_mode (valtype, mode, &unsigned_p, func, 1); return handle_structs_in_regs (mode, valtype, FIRST_RET_REG); } @@ -3105,3 +3111,42 @@ mcore_return_in_memory (const_tree type, const_tree fntype ATTRIBUTE_UNUSED) const HOST_WIDE_INT size = int_size_in_bytes (type); return (size == -1 || size > 2 * UNITS_PER_WORD); } + +/* Worker function for TARGET_ASM_TRAMPOLINE_TEMPLATE. + Output assembler code for a block containing the constant parts + of a trampoline, leaving space for the variable parts. + + On the MCore, the trampoline looks like: + lrw r1, function + lrw r13, area + jmp r13 + or r0, r0 + .literals */ + +static void +mcore_asm_trampoline_template (FILE *f) +{ + fprintf (f, "\t.short 0x7102\n"); + fprintf (f, "\t.short 0x7d02\n"); + fprintf (f, "\t.short 0x00cd\n"); + fprintf (f, "\t.short 0x1e00\n"); + fprintf (f, "\t.long 0\n"); + fprintf (f, "\t.long 0\n"); +} + +/* Worker function for TARGET_TRAMPOLINE_INIT. */ + +static void +mcore_trampoline_init (rtx m_tramp, tree fndecl, rtx chain_value) +{ + rtx fnaddr = XEXP (DECL_RTL (fndecl), 0); + rtx mem; + + emit_block_move (m_tramp, assemble_trampoline_template (), + GEN_INT (2*UNITS_PER_WORD), BLOCK_OP_NORMAL); + + mem = adjust_address (m_tramp, SImode, 8); + emit_move_insn (mem, chain_value); + mem = adjust_address (m_tramp, SImode, 12); + emit_move_insn (mem, fnaddr); +} diff --git a/gcc/config/mcore/mcore.h b/gcc/config/mcore/mcore.h index acc5449..630a11f 100644 --- a/gcc/config/mcore/mcore.h +++ b/gcc/config/mcore/mcore.h @@ -631,42 +631,12 @@ extern const enum reg_class reg_class_from_letter[]; No definition is equivalent to always zero. */ #define EXIT_IGNORE_STACK 0 -/* Output assembler code for a block containing the constant parts - of a trampoline, leaving space for the variable parts. - - On the MCore, the trampoline looks like: - lrw r1, function - lrw r13, area - jmp r13 - or r0, r0 - .literals */ -#define TRAMPOLINE_TEMPLATE(FILE) \ -{ \ - fprintf ((FILE), " .short 0x7102\n"); \ - fprintf ((FILE), " .short 0x7d02\n"); \ - fprintf ((FILE), " .short 0x00cd\n"); \ - fprintf ((FILE), " .short 0x1e00\n"); \ - fprintf ((FILE), " .long 0\n"); \ - fprintf ((FILE), " .long 0\n"); \ -} - /* Length in units of the trampoline for entering a nested function. */ #define TRAMPOLINE_SIZE 12 /* Alignment required for a trampoline in bits. */ #define TRAMPOLINE_ALIGNMENT 32 -/* 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) \ -{ \ - emit_move_insn (gen_rtx_MEM (SImode, plus_constant ((TRAMP), 8)), \ - (CXT)); \ - emit_move_insn (gen_rtx_MEM (SImode, plus_constant ((TRAMP), 12)), \ - (FNADDR)); \ -} - /* Macros to check register numbers against specific register classes. */ /* These assume that REGNO is a hard or pseudo reg number. |