This is the mail archive of the
gcc-patches@gcc.gnu.org
mailing list for the GCC project.
Re: RFA: Add new (ARM) sibcall test case
- From: Richard Earnshaw <rearnsha at arm dot com>
- To: Nick Clifton <nickc at redhat dot com>
- Cc: gcc-patches at gcc dot gnu dot org, Richard dot Earnshaw at arm dot com
- Date: Fri, 17 Jan 2003 17:43:51 +0000
- Subject: Re: RFA: Add new (ARM) sibcall test case
- Organization: ARM Ltd.
- Reply-to: Richard dot Earnshaw at arm dot com
Surely, adding this prologue_use to the sibcall insn will cause the link
register to be "live" during register allocation, which will cause it to
get saved and restored even if its only use is the epilogue; that's what
we used to have happen before this patch was added:
2002-07-29 Richard Earnshaw <rearnsha@arm.com>
* arm.md (sibcall, sibcall_value): Add RETURN as part of the
pattern,
remove clobber of LR.
(sibcall_insn, sibcall_value_insn): Update accordingly.
(sibcall_epilogue): Remove debugging comment from assembler stream.
R.
> The solution I intend to apply is to add an unspec usage of the link
> register, using the UNSPEC_PROLOGUE_USE value, which is specifically
> intended to protect hard registers after reload. Like this:
>
> Index: gcc/config/arm/arm.md
> ===================================================================
> RCS file: /cvs/gcc/gcc/gcc/config/arm/arm.md,v
> retrieving revision 1.115
> diff -c -3 -p -w -r1.115 arm.md
> *** gcc/config/arm/arm.md 8 Jan 2003 11:55:50 -0000 1.115
> --- gcc/config/arm/arm.md 17 Jan 2003 13:45:13 -0000
> ***************
> *** 8430,8437 ****
> "
> )
>
> (define_insn "sibcall_epilogue"
> ! [(unspec_volatile [(const_int 0)] VUNSPEC_EPILOGUE)]
> "TARGET_ARM"
> "*
> if (USE_RETURN_INSN (FALSE))
> --- 8430,8443 ----
> "
> )
>
> + ;; Note - although unspec_volatile's USE all hard registers,
> + ;; USEs are ignored after relaod has completed. Thus we need
> + ;; to add an unspec of the link register to ensure that flow
> + ;; does not think that it is unused by the sibcall branch that
> + ;; will replace the standard function epilogue.
> (define_insn "sibcall_epilogue"
> ! [(parallel [(unspec:SI [(reg:SI LR_REGNUM)] UNSPEC_PROLOGUE_USE)
> ! (unspec_volatile [(const_int 0)] VUNSPEC_EPILOGUE)])]
> "TARGET_ARM"
> "*
> if (USE_RETURN_INSN (FALSE))
>
> So - may I add this test case ?
>
> Cheers
> Nick
>
> PS. Relevent ChangeLog entries:
>
> gcc/testsuite/ChangeLog
> 2003-01-17 Nick Clifton <nickc@redhat.com>
>
> * gcc.c-torture/execute/20030117-1.c: New test case. Exposes
> problem with ARM sibcall code generation.
>
> gcc/ChangeLog
> 2003-01-17 Nick Clifton <nickc@redhat.com>
>
> * config/arm/arm.md (sibcall_epilogue): Add an
> UNSPEC_PROLOGUE_USE to prevent the link register from being
> considered dead.
>
>