From 2a1211e51ba34fb4549c9f718c025474f0ff5ed6 Mon Sep 17 00:00:00 2001 From: Richard Henderson Date: Tue, 22 Sep 2009 08:13:03 -0700 Subject: [PATCH] ia64-protos.h (ia64_initialize_trampoline): Remove. * config/ia64/ia64-protos.h (ia64_initialize_trampoline): Remove. * config/ia64/ia64.c (TARGET_TRAMPOLINE_INIT): New. (ia64_trampoline_init): Rename from ia64_initialize_trampoline; make static; adjust for hook parameters. * config/ia64/ia64.h (INITIALIZE_TRAMPOLINE): Remove. From-SVN: r151994 --- gcc/ChangeLog | 6 ++++ gcc/config/ia64/ia64-protos.h | 1 - gcc/config/ia64/ia64.c | 53 +++++++++++++++++++++++++++-------- gcc/config/ia64/ia64.h | 30 -------------------- 4 files changed, 48 insertions(+), 42 deletions(-) diff --git a/gcc/ChangeLog b/gcc/ChangeLog index 543f881c9836..95bbe79ae665 100644 --- a/gcc/ChangeLog +++ b/gcc/ChangeLog @@ -108,6 +108,12 @@ * config/h8300/h8300.h (INITIALIZE_TRAMPOLINE): Move code to h8300_trampoline_init and adjust for hook parameters. + * config/ia64/ia64-protos.h (ia64_initialize_trampoline): Remove. + * config/ia64/ia64.c (TARGET_TRAMPOLINE_INIT): New. + (ia64_trampoline_init): Rename from ia64_initialize_trampoline; + make static; adjust for hook parameters. + * config/ia64/ia64.h (INITIALIZE_TRAMPOLINE): Remove. + 2009-09-22 Jakub Jelinek * config/rs6000/rs6000.c (bdesc_2arg): Fix CODE_FOR_vector_gt* codes diff --git a/gcc/config/ia64/ia64-protos.h b/gcc/config/ia64/ia64-protos.h index 6d9440ef0d4f..3c6a153498e9 100644 --- a/gcc/config/ia64/ia64-protos.h +++ b/gcc/config/ia64/ia64-protos.h @@ -54,7 +54,6 @@ extern int ia64_direct_return (void); extern bool ia64_expand_load_address (rtx, rtx); extern int ia64_hard_regno_rename_ok (int, int); -extern void ia64_initialize_trampoline (rtx, rtx, rtx); extern void ia64_print_operand_address (FILE *, rtx); extern void ia64_print_operand (FILE *, rtx, int); extern enum reg_class ia64_preferred_reload_class (rtx, enum reg_class); diff --git a/gcc/config/ia64/ia64.c b/gcc/config/ia64/ia64.c index 7e7575233818..75c8f0ee6c46 100644 --- a/gcc/config/ia64/ia64.c +++ b/gcc/config/ia64/ia64.c @@ -302,6 +302,7 @@ static enum machine_mode ia64_promote_function_mode (const_tree, int *, const_tree, int); +static void ia64_trampoline_init (rtx, tree, rtx); /* Table of valid machine attributes. */ static const struct attribute_spec ia64_attribute_table[] = @@ -532,6 +533,9 @@ static const struct attribute_spec ia64_attribute_table[] = #undef TARGET_CAN_ELIMINATE #define TARGET_CAN_ELIMINATE ia64_can_eliminate +#undef TARGET_TRAMPOLINE_INIT +#define TARGET_TRAMPOLINE_INIT ia64_trampoline_init + struct gcc_target targetm = TARGET_INITIALIZER; typedef enum @@ -3945,10 +3949,35 @@ ia64_dbx_register_number (int regno) return regno; } -void -ia64_initialize_trampoline (rtx addr, rtx fnaddr, rtx static_chain) +/* Implement TARGET_TRAMPOLINE_INIT. + + The trampoline should set the static chain pointer to value placed + into the trampoline and should branch to the specified routine. + To make the normal indirect-subroutine calling convention work, + the trampoline must look like a function descriptor; the first + word being the target address and the second being the target's + global pointer. + + We abuse the concept of a global pointer by arranging for it + to point to the data we need to load. The complete trampoline + has the following form: + + +-------------------+ \ + TRAMP: | __ia64_trampoline | | + +-------------------+ > fake function descriptor + | TRAMP+16 | | + +-------------------+ / + | target descriptor | + +-------------------+ + | static link | + +-------------------+ +*/ + +static void +ia64_trampoline_init (rtx m_tramp, tree fndecl, rtx static_chain) { - rtx addr_reg, tramp, eight = GEN_INT (8); + rtx fnaddr = XEXP (DECL_RTL (fndecl), 0); + rtx addr, addr_reg, tramp, eight = GEN_INT (8); /* The Intel assembler requires that the global __ia64_trampoline symbol be declared explicitly */ @@ -3965,13 +3994,13 @@ ia64_initialize_trampoline (rtx addr, rtx fnaddr, rtx static_chain) } /* Make sure addresses are Pmode even if we are in ILP32 mode. */ - addr = convert_memory_address (Pmode, addr); + addr = convert_memory_address (Pmode, XEXP (m_tramp, 0)); fnaddr = convert_memory_address (Pmode, fnaddr); static_chain = convert_memory_address (Pmode, static_chain); /* Load up our iterator. */ - addr_reg = gen_reg_rtx (Pmode); - emit_move_insn (addr_reg, addr); + addr_reg = copy_to_reg (addr); + m_tramp = adjust_automodify_address (m_tramp, Pmode, addr_reg, 0); /* The first two words are the fake descriptor: __ia64_trampoline, ADDR+16. */ @@ -3989,19 +4018,21 @@ ia64_initialize_trampoline (rtx addr, rtx fnaddr, rtx static_chain) emit_move_insn (reg, gen_rtx_MEM (Pmode, reg)); tramp = reg; } - emit_move_insn (gen_rtx_MEM (Pmode, addr_reg), tramp); + emit_move_insn (m_tramp, tramp); emit_insn (gen_adddi3 (addr_reg, addr_reg, eight)); + m_tramp = adjust_automodify_address (m_tramp, VOIDmode, NULL, 8); - emit_move_insn (gen_rtx_MEM (Pmode, addr_reg), - copy_to_reg (plus_constant (addr, 16))); + emit_move_insn (m_tramp, force_reg (Pmode, plus_constant (addr, 16))); emit_insn (gen_adddi3 (addr_reg, addr_reg, eight)); + m_tramp = adjust_automodify_address (m_tramp, VOIDmode, NULL, 8); /* The third word is the target descriptor. */ - emit_move_insn (gen_rtx_MEM (Pmode, addr_reg), fnaddr); + emit_move_insn (m_tramp, force_reg (Pmode, fnaddr)); emit_insn (gen_adddi3 (addr_reg, addr_reg, eight)); + m_tramp = adjust_automodify_address (m_tramp, VOIDmode, NULL, 8); /* The fourth word is the static chain. */ - emit_move_insn (gen_rtx_MEM (Pmode, addr_reg), static_chain); + emit_move_insn (m_tramp, static_chain); } /* Do any needed setup for a variadic function. CUM has not been updated diff --git a/gcc/config/ia64/ia64.h b/gcc/config/ia64/ia64.h index 40c85501cda3..53bbda2b1ede 100644 --- a/gcc/config/ia64/ia64.h +++ b/gcc/config/ia64/ia64.h @@ -1247,31 +1247,6 @@ do { \ #define STACK_SAVEAREA_MODE(LEVEL) \ ((LEVEL) == SAVE_NONLOCAL ? OImode : Pmode) -/* Output assembler code for a block containing the constant parts of - a trampoline, leaving space for the variable parts. - - The trampoline should set the static chain pointer to value placed - into the trampoline and should branch to the specified routine. - To make the normal indirect-subroutine calling convention work, - the trampoline must look like a function descriptor; the first - word being the target address and the second being the target's - global pointer. - - We abuse the concept of a global pointer by arranging for it - to point to the data we need to load. The complete trampoline - has the following form: - - +-------------------+ \ - TRAMP: | __ia64_trampoline | | - +-------------------+ > fake function descriptor - | TRAMP+16 | | - +-------------------+ / - | target descriptor | - +-------------------+ - | static link | - +-------------------+ -*/ - /* A C expression for the size in bytes of the trampoline, as an integer. */ #define TRAMPOLINE_SIZE 32 @@ -1279,11 +1254,6 @@ do { \ /* Alignment required for trampolines, in bits. */ #define TRAMPOLINE_ALIGNMENT 64 - -/* A C statement to initialize the variable parts of a trampoline. */ - -#define INITIALIZE_TRAMPOLINE(ADDR, FNADDR, STATIC_CHAIN) \ - ia64_initialize_trampoline((ADDR), (FNADDR), (STATIC_CHAIN)) /* Addressing Modes */