This is the mail archive of the gcc-patches@gcc.gnu.org mailing list for the GCC project.


Index Nav: [Date Index] [Subject Index] [Author Index] [Thread Index]
Message Nav: [Date Prev] [Date Next] [Thread Prev] [Thread Next]
Other format: [Raw text]

Re: [patch i386]: Expand sibling-tail-calls via accumulator register


On Thu, May 22, 2014 at 2:33 PM, Kai Tietz <ktietz@redhat.com> wrote:
> Hello,
>
> This patch avoids for sibling-tail-calls the use of pseudo-register.  Instead it uses for load of memory-address the accumulator-register.  By this we avoid that IRA/LRA need to choose a register.  So we reduce register-pressure.
>
> The accumulator-register is always a valid register on tail-call case.  All other registers might be callee-saved, or used for argument-passing.  The only case where we would use the accumulator on call is the variadic-case for x86_64 ABI.  Just that this function never is a candidate for sibling-tail-calls.
>
> ChangeLog
>
> 2014-05-22  Kai Tietz  <ktietz@redhat.com>
>
>         * config/i386/i386.c (ix86_expand_call): Enforce for sibcalls
>         on memory the use of accumulator-register.
>
> Regression tested for x86_64-unknown-linux-gnu, x86_64-w64-mingw32, and i686-pc-cygwin.
> Ok for apply?
>
> Regards,
> Kai
>
> Index: i386.c
> ===================================================================
> --- i386.c      (Revision 210412)
> +++ i386.c      (Arbeitskopie)
> @@ -24898,8 +24898,19 @@ ix86_expand_call (rtx retval, rtx fnaddr, rtx call
>            ? !sibcall_insn_operand (XEXP (fnaddr, 0), word_mode)
>            : !call_insn_operand (XEXP (fnaddr, 0), word_mode))
>      {
> +      rtx r;
>        fnaddr = convert_to_mode (word_mode, XEXP (fnaddr, 0), 1);
> -      fnaddr = gen_rtx_MEM (QImode, copy_to_mode_reg (word_mode, fnaddr));
> +      if (!sibcall)
> +       r = copy_to_mode_reg (word_mode, fnaddr);
> +      else
> +       {
> +         r = gen_rtx_REG (word_mode, AX_REG)

If fnaddr points to a function with variable argument list in
64-bit, AX_REG may be used to store number of FP arguments
passed in registers.

> +         if (! general_operand (fnaddr, VOIDmode))
> +                   fnaddr = force_operand (fnaddr, r);
> +         if (fnaddr != r)
> +           emit_move_insn (r, fnaddr);
> +       }
> +      fnaddr = gen_rtx_MEM (QImode, r);
>      }
>
>    call = gen_rtx_CALL (VOIDmode, fnaddr, callarg1);



-- 
H.J.


Index Nav: [Date Index] [Subject Index] [Author Index] [Thread Index]
Message Nav: [Date Prev] [Date Next] [Thread Prev] [Thread Next]