Commit 2a1211e5 by Richard Henderson Committed by Richard Henderson

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
parent 9f6ef043
...@@ -108,6 +108,12 @@ ...@@ -108,6 +108,12 @@
* config/h8300/h8300.h (INITIALIZE_TRAMPOLINE): Move code * config/h8300/h8300.h (INITIALIZE_TRAMPOLINE): Move code
to h8300_trampoline_init and adjust for hook parameters. 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 <jakub@redhat.com> 2009-09-22 Jakub Jelinek <jakub@redhat.com>
* config/rs6000/rs6000.c (bdesc_2arg): Fix CODE_FOR_vector_gt* codes * config/rs6000/rs6000.c (bdesc_2arg): Fix CODE_FOR_vector_gt* codes
......
...@@ -54,7 +54,6 @@ extern int ia64_direct_return (void); ...@@ -54,7 +54,6 @@ extern int ia64_direct_return (void);
extern bool ia64_expand_load_address (rtx, rtx); extern bool ia64_expand_load_address (rtx, rtx);
extern int ia64_hard_regno_rename_ok (int, int); 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_address (FILE *, rtx);
extern void ia64_print_operand (FILE *, rtx, int); extern void ia64_print_operand (FILE *, rtx, int);
extern enum reg_class ia64_preferred_reload_class (rtx, enum reg_class); extern enum reg_class ia64_preferred_reload_class (rtx, enum reg_class);
......
...@@ -302,6 +302,7 @@ static enum machine_mode ia64_promote_function_mode (const_tree, ...@@ -302,6 +302,7 @@ static enum machine_mode ia64_promote_function_mode (const_tree,
int *, int *,
const_tree, const_tree,
int); int);
static void ia64_trampoline_init (rtx, tree, rtx);
/* Table of valid machine attributes. */ /* Table of valid machine attributes. */
static const struct attribute_spec ia64_attribute_table[] = static const struct attribute_spec ia64_attribute_table[] =
...@@ -532,6 +533,9 @@ static const struct attribute_spec ia64_attribute_table[] = ...@@ -532,6 +533,9 @@ static const struct attribute_spec ia64_attribute_table[] =
#undef TARGET_CAN_ELIMINATE #undef TARGET_CAN_ELIMINATE
#define TARGET_CAN_ELIMINATE ia64_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; struct gcc_target targetm = TARGET_INITIALIZER;
typedef enum typedef enum
...@@ -3945,10 +3949,35 @@ ia64_dbx_register_number (int regno) ...@@ -3945,10 +3949,35 @@ ia64_dbx_register_number (int regno)
return regno; return regno;
} }
void /* Implement TARGET_TRAMPOLINE_INIT.
ia64_initialize_trampoline (rtx addr, rtx fnaddr, rtx static_chain)
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 /* The Intel assembler requires that the global __ia64_trampoline symbol
be declared explicitly */ be declared explicitly */
...@@ -3965,13 +3994,13 @@ ia64_initialize_trampoline (rtx addr, rtx fnaddr, rtx static_chain) ...@@ -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. */ /* 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); fnaddr = convert_memory_address (Pmode, fnaddr);
static_chain = convert_memory_address (Pmode, static_chain); static_chain = convert_memory_address (Pmode, static_chain);
/* Load up our iterator. */ /* Load up our iterator. */
addr_reg = gen_reg_rtx (Pmode); addr_reg = copy_to_reg (addr);
emit_move_insn (addr_reg, addr); m_tramp = adjust_automodify_address (m_tramp, Pmode, addr_reg, 0);
/* The first two words are the fake descriptor: /* The first two words are the fake descriptor:
__ia64_trampoline, ADDR+16. */ __ia64_trampoline, ADDR+16. */
...@@ -3989,19 +4018,21 @@ ia64_initialize_trampoline (rtx addr, rtx fnaddr, rtx static_chain) ...@@ -3989,19 +4018,21 @@ ia64_initialize_trampoline (rtx addr, rtx fnaddr, rtx static_chain)
emit_move_insn (reg, gen_rtx_MEM (Pmode, reg)); emit_move_insn (reg, gen_rtx_MEM (Pmode, reg));
tramp = 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)); 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), emit_move_insn (m_tramp, force_reg (Pmode, plus_constant (addr, 16)));
copy_to_reg (plus_constant (addr, 16)));
emit_insn (gen_adddi3 (addr_reg, addr_reg, eight)); 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. */ /* 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)); 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. */ /* 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 /* Do any needed setup for a variadic function. CUM has not been updated
......
...@@ -1247,31 +1247,6 @@ do { \ ...@@ -1247,31 +1247,6 @@ do { \
#define STACK_SAVEAREA_MODE(LEVEL) \ #define STACK_SAVEAREA_MODE(LEVEL) \
((LEVEL) == SAVE_NONLOCAL ? OImode : Pmode) ((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. */ /* A C expression for the size in bytes of the trampoline, as an integer. */
#define TRAMPOLINE_SIZE 32 #define TRAMPOLINE_SIZE 32
...@@ -1279,11 +1254,6 @@ do { \ ...@@ -1279,11 +1254,6 @@ do { \
/* Alignment required for trampolines, in bits. */ /* Alignment required for trampolines, in bits. */
#define TRAMPOLINE_ALIGNMENT 64 #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 */ /* Addressing Modes */
......
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