diff options
author | Richard Henderson <rth@redhat.com> | 2009-09-22 08:14:32 -0700 |
---|---|---|
committer | Richard Henderson <rth@gcc.gnu.org> | 2009-09-22 08:14:32 -0700 |
commit | bdeb5f0c355d5f6d0d95798cd8c8de42ef80a853 (patch) | |
tree | 0de8e1f6bd3972146e34dccdc5a97e243f17a26b | |
parent | dbbdb385c4ec0ee9f2500ab53b81ae0e79ad9b5c (diff) | |
download | gcc-bdeb5f0c355d5f6d0d95798cd8c8de42ef80a853.zip gcc-bdeb5f0c355d5f6d0d95798cd8c8de42ef80a853.tar.gz gcc-bdeb5f0c355d5f6d0d95798cd8c8de42ef80a853.tar.bz2 |
mn10300.c (TARGET_ASM_TRAMPOLINE_TEMPLATE, [...]): New.
* config/mn10300/mn10300.c (TARGET_ASM_TRAMPOLINE_TEMPLATE,
mn10300_asm_trampoline_template, TARGET_TRAMPOLINE_INIT,
mn10300_trampoline_init): New.
* config/mn10300/mn10300.h (TRAMPOLINE_TEMPLATE): Move code to
mn10300_asm_trampoline_template.
(INITIALIZE_TRAMPOLINE): Move code to mn10300_trampoline_init.
From-SVN: r152003
-rw-r--r-- | gcc/ChangeLog | 7 | ||||
-rw-r--r-- | gcc/config/mn10300/mn10300.c | 42 | ||||
-rw-r--r-- | gcc/config/mn10300/mn10300.h | 24 |
3 files changed, 48 insertions, 25 deletions
diff --git a/gcc/ChangeLog b/gcc/ChangeLog index efcf989..8a1a13b 100644 --- a/gcc/ChangeLog +++ b/gcc/ChangeLog @@ -176,6 +176,13 @@ (TRAMPOLINE_ALIGNMENT): New. * gcc/config/mmix/mmix-protos.h: Update. + * config/mn10300/mn10300.c (TARGET_ASM_TRAMPOLINE_TEMPLATE, + mn10300_asm_trampoline_template, TARGET_TRAMPOLINE_INIT, + mn10300_trampoline_init): New. + * config/mn10300/mn10300.h (TRAMPOLINE_TEMPLATE): Move code to + mn10300_asm_trampoline_template. + (INITIALIZE_TRAMPOLINE): Move code to mn10300_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/mn10300/mn10300.c b/gcc/config/mn10300/mn10300.c index 608f8a0..1a0eb37 100644 --- a/gcc/config/mn10300/mn10300.c +++ b/gcc/config/mn10300/mn10300.c @@ -83,6 +83,9 @@ static bool mn10300_pass_by_reference (CUMULATIVE_ARGS *, enum machine_mode, static int mn10300_arg_partial_bytes (CUMULATIVE_ARGS *, enum machine_mode, tree, bool); static unsigned int mn10300_case_values_threshold (void); +static void mn10300_encode_section_info (tree, rtx, int); +static void mn10300_asm_trampoline_template (FILE *); +static void mn10300_trampoline_init (rtx, tree, rtx); /* Initialize the GCC target structure. */ #undef TARGET_ASM_ALIGNED_HI_OP @@ -131,7 +134,11 @@ static unsigned int mn10300_case_values_threshold (void); #undef TARGET_LEGITIMATE_ADDRESS_P #define TARGET_LEGITIMATE_ADDRESS_P mn10300_legitimate_address_p -static void mn10300_encode_section_info (tree, rtx, int); +#undef TARGET_ASM_TRAMPOLINE_TEMPLATE +#define TARGET_ASM_TRAMPOLINE_TEMPLATE mn10300_asm_trampoline_template +#undef TARGET_TRAMPOLINE_INIT +#define TARGET_TRAMPOLINE_INIT mn10300_trampoline_init + struct gcc_target targetm = TARGET_INITIALIZER; /* Implement TARGET_HANDLE_OPTION. */ @@ -2165,3 +2172,36 @@ unsigned int mn10300_case_values_threshold (void) { return 6; } + +/* Worker function for TARGET_ASM_TRAMPOLINE_TEMPLATE. */ + +static void +mn10300_asm_trampoline_template (FILE *f) +{ + fprintf (f, "\tadd -4,sp\n"); + fprintf (f, "\t.long 0x0004fffa\n"); + fprintf (f, "\tmov (0,sp),a0\n"); + fprintf (f, "\tadd 4,sp\n"); + fprintf (f, "\tmov (13,a0),a1\n"); + fprintf (f, "\tmov (17,a0),a0\n"); + fprintf (f, "\tjmp (a0)\n"); + fprintf (f, "\t.long 0\n"); + fprintf (f, "\t.long 0\n"); +} + +/* Worker function for TARGET_TRAMPOLINE_INIT. */ + +static void +mn10300_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 (TRAMPOLINE_SIZE), BLOCK_OP_NORMAL); + + mem = adjust_address (m_tramp, SImode, 0x14); + emit_move_insn (mem, chain_value); + mem = adjust_address (m_tramp, SImode, 0x18); + emit_move_insn (mem, fnaddr); +} diff --git a/gcc/config/mn10300/mn10300.h b/gcc/config/mn10300/mn10300.h index 7d15e05..fc2ece3 100644 --- a/gcc/config/mn10300/mn10300.h +++ b/gcc/config/mn10300/mn10300.h @@ -598,36 +598,12 @@ struct cum_arg {int nbytes; }; #define FUNCTION_PROFILER(FILE, LABELNO) ; -#define TRAMPOLINE_TEMPLATE(FILE) \ - do { \ - fprintf (FILE, "\tadd -4,sp\n"); \ - fprintf (FILE, "\t.long 0x0004fffa\n"); \ - fprintf (FILE, "\tmov (0,sp),a0\n"); \ - fprintf (FILE, "\tadd 4,sp\n"); \ - fprintf (FILE, "\tmov (13,a0),a1\n"); \ - fprintf (FILE, "\tmov (17,a0),a0\n"); \ - fprintf (FILE, "\tjmp (a0)\n"); \ - fprintf (FILE, "\t.long 0\n"); \ - fprintf (FILE, "\t.long 0\n"); \ - } while (0) - /* Length in units of the trampoline for entering a nested function. */ #define TRAMPOLINE_SIZE 0x1b #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), 0x14)), \ - (CXT)); \ - emit_move_insn (gen_rtx_MEM (SImode, plus_constant ((TRAMP), 0x18)), \ - (FNADDR)); \ -} /* A C expression whose value is RTL representing the value of the return address for the frame COUNT steps up from the current frame. |