diff options
author | Richard Henderson <rth@redhat.com> | 2009-09-22 08:11:37 -0700 |
---|---|---|
committer | Richard Henderson <rth@gcc.gnu.org> | 2009-09-22 08:11:37 -0700 |
commit | 531ca746f972a758565b0623288ea24162442248 (patch) | |
tree | 78521a0ca34823fbb38443911cb1b76f4bd93d6c /gcc/final.c | |
parent | 2df373c2eb9148f995614d5405f0e4b500de4e0d (diff) | |
download | gcc-531ca746f972a758565b0623288ea24162442248.zip gcc-531ca746f972a758565b0623288ea24162442248.tar.gz gcc-531ca746f972a758565b0623288ea24162442248.tar.bz2 |
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
Diffstat (limited to 'gcc/final.c')
-rw-r--r-- | gcc/final.c | 58 |
1 files changed, 18 insertions, 40 deletions
diff --git a/gcc/final.c b/gcc/final.c index cd36860..78a698b 100644 --- a/gcc/final.c +++ b/gcc/final.c @@ -1594,12 +1594,14 @@ profile_function (FILE *file ATTRIBUTE_UNUSED) #ifndef NO_PROFILE_COUNTERS # define NO_PROFILE_COUNTERS 0 #endif -#if defined(ASM_OUTPUT_REG_PUSH) - int sval = cfun->returns_struct; - rtx svrtx = targetm.calls.struct_value_rtx (TREE_TYPE (current_function_decl), 1); -#if defined(STATIC_CHAIN_INCOMING_REGNUM) || defined(STATIC_CHAIN_REGNUM) - int cxt = cfun->static_chain_decl != NULL; -#endif +#ifdef ASM_OUTPUT_REG_PUSH + rtx sval = NULL, chain = NULL; + + if (cfun->returns_struct) + sval = targetm.calls.struct_value_rtx (TREE_TYPE (current_function_decl), + true); + if (cfun->static_chain_decl) + chain = targetm.calls.static_chain (current_function_decl, true); #endif /* ASM_OUTPUT_REG_PUSH */ if (! NO_PROFILE_COUNTERS) @@ -1613,44 +1615,20 @@ profile_function (FILE *file ATTRIBUTE_UNUSED) switch_to_section (current_function_section ()); -#if defined(ASM_OUTPUT_REG_PUSH) - if (sval && svrtx != NULL_RTX && REG_P (svrtx)) - { - ASM_OUTPUT_REG_PUSH (file, REGNO (svrtx)); - } -#endif - -#if defined(STATIC_CHAIN_INCOMING_REGNUM) && defined(ASM_OUTPUT_REG_PUSH) - if (cxt) - ASM_OUTPUT_REG_PUSH (file, STATIC_CHAIN_INCOMING_REGNUM); -#else -#if defined(STATIC_CHAIN_REGNUM) && defined(ASM_OUTPUT_REG_PUSH) - if (cxt) - { - ASM_OUTPUT_REG_PUSH (file, STATIC_CHAIN_REGNUM); - } -#endif +#ifdef ASM_OUTPUT_REG_PUSH + if (sval && REG_P (sval)) + ASM_OUTPUT_REG_PUSH (file, REGNO (sval)); + if (chain && REG_P (chain)) + ASM_OUTPUT_REG_PUSH (file, REGNO (chain)); #endif FUNCTION_PROFILER (file, current_function_funcdef_no); -#if defined(STATIC_CHAIN_INCOMING_REGNUM) && defined(ASM_OUTPUT_REG_PUSH) - if (cxt) - ASM_OUTPUT_REG_POP (file, STATIC_CHAIN_INCOMING_REGNUM); -#else -#if defined(STATIC_CHAIN_REGNUM) && defined(ASM_OUTPUT_REG_PUSH) - if (cxt) - { - ASM_OUTPUT_REG_POP (file, STATIC_CHAIN_REGNUM); - } -#endif -#endif - -#if defined(ASM_OUTPUT_REG_PUSH) - if (sval && svrtx != NULL_RTX && REG_P (svrtx)) - { - ASM_OUTPUT_REG_POP (file, REGNO (svrtx)); - } +#ifdef ASM_OUTPUT_REG_PUSH + if (chain && REG_P (chain)) + ASM_OUTPUT_REG_POP (file, REGNO (chain)); + if (sval && REG_P (sval)) + ASM_OUTPUT_REG_POP (file, REGNO (sval)); #endif } |