Commit 92910d77 by Richard Henderson Committed by Richard Henderson

bfin-protos.h (initialize_trampoline): Remove.

	* config/bfin/bfin-protos.h (initialize_trampoline): Remove.
	* config/bfin/bfin.c (bfin_asm_trampoline_template): New.
	(bfin_trampoline_init): Rename from initialize_trampoline;
	make static; update for target hook parameters.
	(TARGET_ASM_TRAMPOLINE_TEMPLATE, TARGET_TRAMPOLINE_INIT): New.
	* config/bfin/bfin.h (TRAMPOLINE_TEMPLATE): Move code to
	bfin_asm_trampoline_template.
	(INITIALIZE_TRAMPOLINE): Remove.

From-SVN: r151988
parent 6eee506e
...@@ -70,6 +70,15 @@ ...@@ -70,6 +70,15 @@
* config/avr/avr.h (TRAMPOLINE_TEMPLATE, INITIALIZE_TRAMPOLINE): Remove. * config/avr/avr.h (TRAMPOLINE_TEMPLATE, INITIALIZE_TRAMPOLINE): Remove.
* config/bfin/bfin-protos.h (initialize_trampoline): Remove.
* config/bfin/bfin.c (bfin_asm_trampoline_template): New.
(bfin_trampoline_init): Rename from initialize_trampoline;
make static; update for target hook parameters.
(TARGET_ASM_TRAMPOLINE_TEMPLATE, TARGET_TRAMPOLINE_INIT): New.
* config/bfin/bfin.h (TRAMPOLINE_TEMPLATE): Move code to
bfin_asm_trampoline_template.
(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
......
...@@ -110,7 +110,6 @@ extern void asm_conditional_branch (rtx, rtx *, int, int); ...@@ -110,7 +110,6 @@ extern void asm_conditional_branch (rtx, rtx *, int, int);
extern rtx bfin_gen_compare (rtx, Mmode); extern rtx bfin_gen_compare (rtx, Mmode);
extern int bfin_local_alignment (tree, int); extern int bfin_local_alignment (tree, int);
extern void initialize_trampoline (rtx, rtx, rtx);
extern rtx bfin_va_arg (tree, tree); extern rtx bfin_va_arg (tree, tree);
extern void bfin_expand_prologue (void); extern void bfin_expand_prologue (void);
......
...@@ -2094,37 +2094,67 @@ bfin_function_ok_for_sibcall (tree decl ATTRIBUTE_UNUSED, ...@@ -2094,37 +2094,67 @@ bfin_function_ok_for_sibcall (tree decl ATTRIBUTE_UNUSED,
return !called_func->local || this_func->local; return !called_func->local || this_func->local;
} }
/* Write a template for a trampoline to F. */
static void
bfin_asm_trampoline_template (FILE *f)
{
if (TARGET_FDPIC)
{
fprintf (f, "\t.dd\t0x00000000\n"); /* 0 */
fprintf (f, "\t.dd\t0x00000000\n"); /* 0 */
fprintf (f, "\t.dd\t0x0000e109\n"); /* p1.l = fn low */
fprintf (f, "\t.dd\t0x0000e149\n"); /* p1.h = fn high */
fprintf (f, "\t.dd\t0x0000e10a\n"); /* p2.l = sc low */
fprintf (f, "\t.dd\t0x0000e14a\n"); /* p2.h = sc high */
fprintf (f, "\t.dw\t0xac4b\n"); /* p3 = [p1 + 4] */
fprintf (f, "\t.dw\t0x9149\n"); /* p1 = [p1] */
fprintf (f, "\t.dw\t0x0051\n"); /* jump (p1)*/
}
else
{
fprintf (f, "\t.dd\t0x0000e109\n"); /* p1.l = fn low */
fprintf (f, "\t.dd\t0x0000e149\n"); /* p1.h = fn high */
fprintf (f, "\t.dd\t0x0000e10a\n"); /* p2.l = sc low */
fprintf (f, "\t.dd\t0x0000e14a\n"); /* p2.h = sc high */
fprintf (f, "\t.dw\t0x0051\n"); /* jump (p1)*/
}
}
/* Emit RTL insns to initialize the variable parts of a trampoline at /* Emit RTL insns to initialize the variable parts of a trampoline at
TRAMP. FNADDR is an RTX for the address of the function's pure M_TRAMP. FNDECL is the target function. CHAIN_VALUE is an RTX for
code. CXT is an RTX for the static chain value for the function. */ the static chain value for the function. */
void static void
initialize_trampoline (rtx tramp, rtx fnaddr, rtx cxt) bfin_trampoline_init (rtx m_tramp, tree fndecl, rtx chain_value)
{ {
rtx t1 = copy_to_reg (fnaddr); rtx t1 = copy_to_reg (XEXP (DECL_RTL (fndecl), 0));
rtx t2 = copy_to_reg (cxt); rtx t2 = copy_to_reg (chain_value);
rtx addr; rtx mem;
int i = 0; int i = 0;
emit_block_move (m_tramp, assemble_trampoline_template (),
GEN_INT (TRAMPOLINE_SIZE), BLOCK_OP_NORMAL);
if (TARGET_FDPIC) if (TARGET_FDPIC)
{ {
rtx a = memory_address (Pmode, plus_constant (tramp, 8)); rtx a = force_reg (Pmode, plus_constant (XEXP (m_tramp, 0), 8));
addr = memory_address (Pmode, tramp); mem = adjust_address (m_tramp, Pmode, 0);
emit_move_insn (gen_rtx_MEM (SImode, addr), a); emit_move_insn (mem, a);
i = 8; i = 8;
} }
addr = memory_address (Pmode, plus_constant (tramp, i + 2)); mem = adjust_address (m_tramp, HImode, i + 2);
emit_move_insn (gen_rtx_MEM (HImode, addr), gen_lowpart (HImode, t1)); emit_move_insn (mem, gen_lowpart (HImode, t1));
emit_insn (gen_ashrsi3 (t1, t1, GEN_INT (16))); emit_insn (gen_ashrsi3 (t1, t1, GEN_INT (16)));
addr = memory_address (Pmode, plus_constant (tramp, i + 6)); mem = adjust_address (m_tramp, HImode, i + 6);
emit_move_insn (gen_rtx_MEM (HImode, addr), gen_lowpart (HImode, t1)); emit_move_insn (mem, gen_lowpart (HImode, t1));
addr = memory_address (Pmode, plus_constant (tramp, i + 10)); mem = adjust_address (m_tramp, HImode, i + 10);
emit_move_insn (gen_rtx_MEM (HImode, addr), gen_lowpart (HImode, t2)); emit_move_insn (mem, gen_lowpart (HImode, t2));
emit_insn (gen_ashrsi3 (t2, t2, GEN_INT (16))); emit_insn (gen_ashrsi3 (t2, t2, GEN_INT (16)));
addr = memory_address (Pmode, plus_constant (tramp, i + 14)); mem = adjust_address (m_tramp, HImode, i + 14);
emit_move_insn (gen_rtx_MEM (HImode, addr), gen_lowpart (HImode, t2)); emit_move_insn (mem, gen_lowpart (HImode, t2));
} }
/* Emit insns to move operands[1] into operands[0]. */ /* Emit insns to move operands[1] into operands[0]. */
...@@ -6619,4 +6649,9 @@ bfin_expand_builtin (tree exp, rtx target ATTRIBUTE_UNUSED, ...@@ -6619,4 +6649,9 @@ bfin_expand_builtin (tree exp, rtx target ATTRIBUTE_UNUSED,
#undef TARGET_CAN_ELIMINATE #undef TARGET_CAN_ELIMINATE
#define TARGET_CAN_ELIMINATE bfin_can_eliminate #define TARGET_CAN_ELIMINATE bfin_can_eliminate
#undef TARGET_ASM_TRAMPOLINE_TEMPLATE
#define TARGET_ASM_TRAMPOLINE_TEMPLATE bfin_asm_trampoline_template
#undef TARGET_TRAMPOLINE_INIT
#define TARGET_TRAMPOLINE_INIT bfin_trampoline_init
struct gcc_target targetm = TARGET_INITIALIZER; struct gcc_target targetm = TARGET_INITIALIZER;
...@@ -386,30 +386,6 @@ extern const char *bfin_library_id_string; ...@@ -386,30 +386,6 @@ extern const char *bfin_library_id_string;
&& (ALIGN) < BITS_PER_WORD ? BITS_PER_WORD : (ALIGN)) && (ALIGN) < BITS_PER_WORD ? BITS_PER_WORD : (ALIGN))
#define TRAMPOLINE_SIZE (TARGET_FDPIC ? 30 : 18) #define TRAMPOLINE_SIZE (TARGET_FDPIC ? 30 : 18)
#define TRAMPOLINE_TEMPLATE(FILE) \
if (TARGET_FDPIC) \
{ \
fprintf(FILE, "\t.dd\t0x00000000\n"); /* 0 */ \
fprintf(FILE, "\t.dd\t0x00000000\n"); /* 0 */ \
fprintf(FILE, "\t.dd\t0x0000e109\n"); /* p1.l = fn low */ \
fprintf(FILE, "\t.dd\t0x0000e149\n"); /* p1.h = fn high */ \
fprintf(FILE, "\t.dd\t0x0000e10a\n"); /* p2.l = sc low */ \
fprintf(FILE, "\t.dd\t0x0000e14a\n"); /* p2.h = sc high */ \
fprintf(FILE, "\t.dw\t0xac4b\n"); /* p3 = [p1 + 4] */ \
fprintf(FILE, "\t.dw\t0x9149\n"); /* p1 = [p1] */ \
fprintf(FILE, "\t.dw\t0x0051\n"); /* jump (p1)*/ \
} \
else \
{ \
fprintf(FILE, "\t.dd\t0x0000e109\n"); /* p1.l = fn low */ \
fprintf(FILE, "\t.dd\t0x0000e149\n"); /* p1.h = fn high */ \
fprintf(FILE, "\t.dd\t0x0000e10a\n"); /* p2.l = sc low */ \
fprintf(FILE, "\t.dd\t0x0000e14a\n"); /* p2.h = sc high */ \
fprintf(FILE, "\t.dw\t0x0051\n"); /* jump (p1)*/ \
}
#define INITIALIZE_TRAMPOLINE(TRAMP, FNADDR, CXT) \
initialize_trampoline (TRAMP, FNADDR, CXT)
/* Definitions for register eliminations. /* Definitions for register eliminations.
......
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