This is the mail archive of the
gcc-patches@gcc.gnu.org
mailing list for the GCC project.
Re: RFC: [PATCH] x86: Add -mzero-caller-saved-regs=[skip|used|all]
- From: "H.J. Lu" <hjl dot tools at gmail dot com>
- To: Florian Weimer <fweimer at redhat dot com>
- Cc: GCC Patches <gcc-patches at gcc dot gnu dot org>, Uros Bizjak <ubizjak at gmail dot com>
- Date: Thu, 27 Sep 2018 12:47:14 -0700
- Subject: Re: RFC: [PATCH] x86: Add -mzero-caller-saved-regs=[skip|used|all]
- References: <20180926181029.GA20898@intel.com> <87mus2oiae.fsf@oldenburg.str.redhat.com>
On Thu, Sep 27, 2018 at 12:24 PM, Florian Weimer <fweimer@redhat.com> wrote:
> * H. J. Lu:
>
>> +@item zero_caller_saved_regs("@var{choice}")
>> +@cindex @code{zero_caller_saved_regs} function attribute, x86
>> +On x86 targets, the @code{zero_caller_saved_regs} attribute causes the
>> +compiler to zero caller-saved integer registers at function return with
>> +@var{choice}. @samp{skip} doesn't zero caller-saved integer registers.
>> +@samp{used} zeros caller-saved integer registers which are used in
>> +function. @samp{all} zeros all caller-saved integer registers.
>
> Perhaps “according to @var{choice}:”. And say that the default for the
> attribute is controlled by @option{-mzero-caller-saved-regs}?
Sure.
> (Maybe “skip” should be none?)
I have no strong opinion here.
> I assume we can check for this use __has_attribute? We would use this
Yes.
> in the implementation of explicit_bzero in glibc.
Good to know.
>> diff --git a/gcc/doc/invoke.texi b/gcc/doc/invoke.texi
>> index 7ef4e7a449b..796477452d5 100644
>> --- a/gcc/doc/invoke.texi
>> +++ b/gcc/doc/invoke.texi
>
>> @@ -28459,6 +28459,16 @@ not be reachable in the large code model.
>> @opindex -mindirect-branch-register
>> Force indirect call and jump via register.
>
>> +@item -mzero-caller-saved-regs=@var{choice}
>> +@opindex -mzero-caller-saved-regs
>> +Zero caller-saved integer registers at function return with @var{choice}.
>> +The default is @samp{skip}, which doesn't zero caller-saved integer
>> +registers. @samp{used} zeros caller-saved integer registers which are
>> +used in function. @samp{all} zeros all caller-saved integer registers.
>> +You can control this behavior for a specific function by using the
>> +function attribute @code{zero_caller_saved_regs}.
>> +@xref{Function Attributes}.
>
> See above regarding “with @var{choice}”.
I will update it.
Thanks.
--
H.J.