Hello Maintainers:

Is this patch OK? Please help check it when you have time (at least for
me, it passes all related test and comparation).

And I shall continue to find and fix another issues about tilegx.

Thanks.

On 6/4/16 21:25, cheng...@emindsoft.com.cn wrote:
> From: Chen Gang <gang.chen.5...@gmail.com>
> 
> r10 may also be as parameter stack pointer for the nested function, so
> need save it before call mcount.
> 
> Also clean up code: use '!' instead of "== 0" for checking
> static_chain_decl and compute_total_frame_size.
> 
> 2016-06-04  Chen Gang  <gang.chen.5...@gmail.com>
> 
>       gcc/
>       PR target/71331
>       * config/tilegx/tilegx.c (tilegx_function_profiler): Save r10
>       to stack before call mcount.
>       (tilegx_can_use_return_insn_p): Clean up code.
> ---
>  gcc/config/tilegx/tilegx.c | 20 ++++++++++++++++++--
>  1 file changed, 18 insertions(+), 2 deletions(-)
> 
> diff --git a/gcc/config/tilegx/tilegx.c b/gcc/config/tilegx/tilegx.c
> index 06c832c..55161bb 100644
> --- a/gcc/config/tilegx/tilegx.c
> +++ b/gcc/config/tilegx/tilegx.c
> @@ -3880,8 +3880,8 @@ bool
>  tilegx_can_use_return_insn_p (void)
>  {
>    return (reload_completed
> -       && cfun->static_chain_decl == 0
> -       && compute_total_frame_size () == 0
> +       && !cfun->static_chain_decl
> +       && !compute_total_frame_size ()
>         && tilegx_current_function_is_leaf ()
>         && !crtl->profile && !df_regs_ever_live_p (TILEGX_LINK_REGNUM));
>  }
> @@ -5507,6 +5507,15 @@ tilegx_function_profiler (FILE *file, int labelno 
> ATTRIBUTE_UNUSED)
>        fprintf (file, "\t}\n");
>      }
>  
> +  if (cfun->static_chain_decl)
> +    {
> +      fprintf (file,
> +            "\t{\n"
> +            "\taddi\tsp, sp, -8\n"
> +            "\tst\tsp, r10\n"
> +            "\t}\n");
> +    }
> +
>    if (flag_pic)
>      {
>        fprintf (file,
> @@ -5524,6 +5533,13 @@ tilegx_function_profiler (FILE *file, int labelno 
> ATTRIBUTE_UNUSED)
>              "\t}\n", MCOUNT_NAME);
>      }
>  
> +  if (cfun->static_chain_decl)
> +    {
> +      fprintf (file,
> +            "\taddi\tsp, sp, 8\n"
> +            "\tld\tr10, sp\n");
> +    }
> +
>    tilegx_in_bundle = false;
>  }
>  
> 

-- 
Chen Gang (陈刚)

Managing Natural Environments is the Duty of Human Beings.

-- 
Chen Gang (陈刚)

Managing Natural Environments is the Duty of Human Beings.

Reply via email to