From 531ca746f972a758565b0623288ea24162442248 Mon Sep 17 00:00:00 2001 From: Richard Henderson Date: Tue, 22 Sep 2009 08:11:37 -0700 Subject: re PR target/41246 (should "sorry" when regparm=3 and nested functions are encountered) PR target/41246 * target.h (struct gcc_target): Add asm_out.trampoline_template, calls.static_chain, calls.trampoline_init, calls.trampoline_adjust_address. * target-def.h (TARGET_ASM_TRAMPOLINE_TEMPLATE): New. (TARGET_STATIC_CHAIN, TARGET_TRAMPOLINE_INIT): New. (TARGET_TRAMPOLINE_ADJUST_ADDRESS): New. * builtins.c (expand_builtin_setjmp_receiver): Use targetm.calls.static_chain; only clobber registers. (expand_builtin_init_trampoline): Use targetm.calls.trampoline_init; set up memory attributes properly for the trampoline block. (expand_builtin_adjust_trampoline): Use targetm.calls.trampoline_adjust_address. * calls.c (prepare_call_address): Add fndecl argument. Use targetm.calls.static_chain. * df-scan.c (df_need_static_chain_reg): Remove. (df_get_entry_block_def_set): Use targetm.calls.static_chain; consolodate static chain handling. * doc/tm.texi: Document new hooks. * emit-rtl.c (static_chain_rtx, static_chain_incoming_rtx): Remove. (init_emit_regs): Don't initialize them. * expr.h (prepare_call_address): Update decl. * final.c (profile_function): Use targetm.calls.static_chain. * function.c (expand_function_start): Likewise. * rtl.h (static_chain_rtx, static_chain_incoming_rtx): Remove. * stmt.c (expand_nl_goto_receiver): Use targetm.calls.static_chain; only clobber registers. * targhooks.c (default_static_chain): New. (default_asm_trampoline_template, default_trampoline_init): New. (default_trampoline_adjust_address): New. * targhooks.h: Declare them. * varasm.c (assemble_trampoline_template): Use targetm.asm_out.trampoline_template. Make the memory block const and set its size. From-SVN: r151983 --- gcc/varasm.c | 13 ++++++------- 1 file changed, 6 insertions(+), 7 deletions(-) (limited to 'gcc/varasm.c') diff --git a/gcc/varasm.c b/gcc/varasm.c index 8a61fd2..f4532b8 100644 --- a/gcc/varasm.c +++ b/gcc/varasm.c @@ -2507,7 +2507,6 @@ assemble_static_space (unsigned HOST_WIDE_INT size) static GTY(()) rtx initial_trampoline; -#ifdef TRAMPOLINE_TEMPLATE rtx assemble_trampoline_template (void) { @@ -2516,6 +2515,8 @@ assemble_trampoline_template (void) int align; rtx symbol; + gcc_assert (targetm.asm_out.trampoline_template != NULL); + if (initial_trampoline) return initial_trampoline; @@ -2530,12 +2531,10 @@ assemble_trampoline_template (void) /* Write the assembler code to define one. */ align = floor_log2 (TRAMPOLINE_ALIGNMENT / BITS_PER_UNIT); if (align > 0) - { - ASM_OUTPUT_ALIGN (asm_out_file, align); - } + ASM_OUTPUT_ALIGN (asm_out_file, align); targetm.asm_out.internal_label (asm_out_file, "LTRAMP", 0); - TRAMPOLINE_TEMPLATE (asm_out_file); + targetm.asm_out.trampoline_template (asm_out_file); /* Record the rtl to refer to it. */ ASM_GENERATE_INTERNAL_LABEL (label, "LTRAMP", 0); @@ -2543,12 +2542,12 @@ assemble_trampoline_template (void) symbol = gen_rtx_SYMBOL_REF (Pmode, name); SYMBOL_REF_FLAGS (symbol) = SYMBOL_FLAG_LOCAL; - initial_trampoline = gen_rtx_MEM (BLKmode, symbol); + initial_trampoline = gen_const_mem (BLKmode, symbol); set_mem_align (initial_trampoline, TRAMPOLINE_ALIGNMENT); + set_mem_size (initial_trampoline, GEN_INT (TRAMPOLINE_SIZE)); return initial_trampoline; } -#endif /* A and B are either alignments or offsets. Return the minimum alignment that may be assumed after adding the two together. */ -- cgit v1.1