From b81ecf6fd65e63dc568167b3c71eabf53ba5ccca Mon Sep 17 00:00:00 2001 From: Richard Henderson Date: Tue, 22 Sep 2009 08:15:30 -0700 Subject: [PATCH] s390.c (s390_asm_trampoline_template): Rename from s390_trampoline_template; make static. * config/s390/s390.c (s390_asm_trampoline_template): Rename from s390_trampoline_template; make static. (s390_trampoline_init): Rename from s390_initialize_trampoline; make static; adjust for target hook. (TARGET_ASM_TRAMPOLINE_TEMPLATE, TARGET_TRAMPOLINE_INIT): New. * config/s390/s390-protos.h: Remove trampoline decls. * config/s390/s390.h (INITIALIZE_TRAMPOLINE): Remove. (TRAMPOLINE_TEMPLATE): Remove. (TRAMPOLINE_ALIGNMENT): New. From-SVN: r152009 --- gcc/ChangeLog | 10 ++++++++++ gcc/config/s390/s390-protos.h | 2 -- gcc/config/s390/s390.c | 29 +++++++++++++++++++---------- gcc/config/s390/s390.h | 10 ++-------- 4 files changed, 31 insertions(+), 20 deletions(-) diff --git a/gcc/ChangeLog b/gcc/ChangeLog index be030e1a8936..41a70215509f 100644 --- a/gcc/ChangeLog +++ b/gcc/ChangeLog @@ -217,6 +217,16 @@ make static; adjust parameters for the hook. * config/rs6000/rs6000.h (INITIALIZE_TRAMPOLINE): Remove. + * config/s390/s390.c (s390_asm_trampoline_template): Rename from + s390_trampoline_template; make static. + (s390_trampoline_init): Rename from s390_initialize_trampoline; + make static; adjust for target hook. + (TARGET_ASM_TRAMPOLINE_TEMPLATE, TARGET_TRAMPOLINE_INIT): New. + * config/s390/s390-protos.h: Remove trampoline decls. + * config/s390/s390.h (INITIALIZE_TRAMPOLINE): Remove. + (TRAMPOLINE_TEMPLATE): Remove. + (TRAMPOLINE_ALIGNMENT): New. + 2009-09-22 Jakub Jelinek * config/rs6000/rs6000.c (bdesc_2arg): Fix CODE_FOR_vector_gt* codes diff --git a/gcc/config/s390/s390-protos.h b/gcc/config/s390/s390-protos.h index be68bd530c39..8a2f1b7186ed 100644 --- a/gcc/config/s390/s390-protos.h +++ b/gcc/config/s390/s390-protos.h @@ -106,8 +106,6 @@ extern bool s390_output_addr_const_extra (FILE*, rtx); extern void print_operand_address (FILE *, rtx); extern void print_operand (FILE *, rtx, int); extern void s390_output_pool_entry (rtx, enum machine_mode, unsigned int); -extern void s390_trampoline_template (FILE *); -extern void s390_initialize_trampoline (rtx, rtx, rtx); extern int s390_agen_dep_p (rtx, rtx); extern rtx s390_load_got (void); extern rtx s390_get_thread_pointer (void); diff --git a/gcc/config/s390/s390.c b/gcc/config/s390/s390.c index a4ac3a38b6b2..7054e45fc710 100644 --- a/gcc/config/s390/s390.c +++ b/gcc/config/s390/s390.c @@ -8863,8 +8863,8 @@ s390_expand_builtin (tree exp, rtx target, rtx subtarget ATTRIBUTE_UNUSED, On S/390, we use gpr 1 internally in the trampoline code; gpr 0 is used to hold the static chain. */ -void -s390_trampoline_template (FILE *file) +static void +s390_asm_trampoline_template (FILE *file) { rtx op[2]; op[0] = gen_rtx_REG (Pmode, 0); @@ -8890,15 +8890,19 @@ s390_trampoline_template (FILE *file) 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. */ -void -s390_initialize_trampoline (rtx addr, rtx fnaddr, rtx cxt) +static void +s390_trampoline_init (rtx m_tramp, tree fndecl, rtx cxt) { - emit_move_insn (gen_rtx_MEM (Pmode, - memory_address (Pmode, - plus_constant (addr, (TARGET_64BIT ? 16 : 8)))), cxt); - emit_move_insn (gen_rtx_MEM (Pmode, - memory_address (Pmode, - plus_constant (addr, (TARGET_64BIT ? 24 : 12)))), fnaddr); + 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, Pmode, 2*UNITS_PER_WORD); + emit_move_insn (mem, cxt); + mem = adjust_address (m_tramp, Pmode, 3*UNITS_PER_WORD); + emit_move_insn (mem, fnaddr); } /* Output assembler code to FILE to increment profiler label # LABELNO @@ -10152,6 +10156,11 @@ s390_reorg (void) #undef TARGET_CAN_ELIMINATE #define TARGET_CAN_ELIMINATE s390_can_eliminate +#undef TARGET_ASM_TRAMPOLINE_TEMPLATE +#define TARGET_ASM_TRAMPOLINE_TEMPLATE s390_asm_trampoline_template +#undef TARGET_TRAMPOLINE_INIT +#define TARGET_TRAMPOLINE_INIT s390_trampoline_init + struct gcc_target targetm = TARGET_INITIALIZER; #include "gt-s390.h" diff --git a/gcc/config/s390/s390.h b/gcc/config/s390/s390.h index 3c93fb770f61..ffb96cd0f340 100644 --- a/gcc/config/s390/s390.h +++ b/gcc/config/s390/s390.h @@ -712,14 +712,8 @@ CUMULATIVE_ARGS; /* Trampolines for nested functions. */ -#define TRAMPOLINE_SIZE (TARGET_64BIT ? 32 : 16) - -#define INITIALIZE_TRAMPOLINE(ADDR, FNADDR, CXT) \ - s390_initialize_trampoline ((ADDR), (FNADDR), (CXT)) - -#define TRAMPOLINE_TEMPLATE(FILE) \ - s390_trampoline_template (FILE) - +#define TRAMPOLINE_SIZE (TARGET_64BIT ? 32 : 16) +#define TRAMPOLINE_ALIGNMENT BITS_PER_WORD /* Addressing modes, and classification of registers for them. */