On Oct 25, 2022, Qing Zhao <qing.z...@oracle.com> wrote:

>> 'all' for leaf functions is likely wasteful.  If no other functions are
>> called, one can determine exactly which registers might carry
>> information out and thus need zeroing, and 'used' is thus likely enough,
>> depending on the purpose of register scrubbing.  (In some scenarios, it
>> might make sense to want scrubbing of all registers, even unused ones
>> that carry incoming values)

> Under what kinds of situations, we should clear the un-used registers
> for leaf functions?

The one (admittedly contrived) scenario that comes to mind is calling an
out-of-line, empty leaf function with 'all' for explicit register
scrubbing at desired points in the program.  I.e., this empty leaf
function would be in charge of scrubbing the caller's registers.  It
could even be tail-called.

I'm sure there are other scenarios in which keeping at least the
possibility of 'all' is useful.

> Now I am wondering whether we should make “leafy” mode by default then?

I'm not sure what you mean by default.  I think "skip" is the right
default for general use, where register scrubbing is not explicitly
requested.  When it is, perhaps -fzero-call-used-regs without
'=<choice>' could be 'leafy' indeed or, even better, the extended form
thereof that is in search of a name and so far unimplemented.

> Another thing is, do you have any information on how much this new mode can 
> save the 
> code size and run-time compared to mode “all”?

I'm afraid I have not performed any measurements.

>> I have not (yet?) implemented this variant; I haven't even found a name
>> I'm happy with for it.  (seal?  plug?  cork?  another leak antonym?)

> For this improvement, I am still thinking no need to add a new mode,
> just add it by default?

Even if it is default, it may still need a name to appear before
e.g. '-gpr'.  'default-gpr' might do, but I'm not happy with it either.


-- 
Alexandre Oliva, happy hacker                https://FSFLA.org/blogs/lxo/
   Free Software Activist                       GNU Toolchain Engineer
Disinformation flourishes because many people care deeply about injustice
but very few check the facts.  Ask me about <https://stallmansupport.org>

Reply via email to