> On Sep 11, 2020, at 3:05 PM, Segher Boessenkool <seg...@kernel.crashing.org>
> wrote:
>
> On Fri, Sep 11, 2020 at 02:40:06PM -0500, Qing Zhao wrote:
>>> On Sep 11, 2020, at 12:13 PM, Segher Boessenkool
>>> <seg...@kernel.crashing.org> wrote:
>>> On Fri, Sep 11, 2020 at 11:52:29AM -0500, Qing Zhao wrote:
>>>> I don’t understand why it’s not correct if we clearing call-clobbered
>>>> registers
>>>> AFTER restoring call-preserved registers?
>>>
>>> Because the compiler backend (or the linker! Or the dynamic linker!
>>> Etc.) can use volatile registers for their own purposes.
>>
>> For the following sequence at the end of a routine:
>>
>> *...*
>> “restore call-preserved registers”
>> *clear call-clobbered registers"*
>> *ret*
>>
>> “Clear call-clobbered registers” will only clear the call-clobbered
>> registers that are not live at the end of the routine.
>
> And they can be written again right after the routine, by linker-
> generated code for example. This is a waste.
>
>> In the new version of the patch, the implementation of clearing
>> call-clobbered registers is done in backend, middle end only
>> computes a hard register set based on user option, source attribute, data
>> flow information, and function abi information, and
>> Then pass this hard register set to the target hook to generate the clearing
>> sequence. The backend will have all the details
>> on the special situations you mentioned.
>>
>> Let me know any more concerns here.
>
> I cannot find that patch?
Haven’t finished yet. -:).
Qing
>
>
> Segher