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: -fuse-caller-save - Collect register usage information


On 11-10-14 12:46, Eric Botcazou wrote:
So, I hate the name of the option, and the documentation seems wrong to me.
It doesnât use the caller saved registers for allocation, it uses the call
clobbered registers for allocation.  Or, one could say it uses the callee
saved registers for allocation.


Eric,
Mike,

thanks for the comments.

I know the following definition of caller-vs-callee saved registers:
- at function entry, a caller-save register can be used immediately, without
  needing to save it first. However, in order to store a value in it that is
  live across calls, it needs to be saved and restored around each call (hence
  the term caller-save).
- at function entry, a callee-save register first needs to be saved before it
  can be used (hence the name callee-save). However, that means that it can be
  used to store a value that is live across calls, without further need for
  saving/restoring.

So, AFAIU, call clobbered corresponds with caller-save, not with callee saved. So I'd say the documentation is in fact correct.

Having said that, in my mind, what is confusing about the name -fuse-caller-save, is that in fact the caller-save registers are already used in register allocation. It's just that they're used across calls without the need to save them, but -fuse-caller-save-across-calls-without-saving-if-possible is not such a good option name.

Another thing that - in my mind - is confusing is that there's an option fcaller-saves which controls behaviour for caller-save registers:
- for -fno-caller-saves, caller-save registers are not used across calls
- for -fcaller-saves, caller-save registers are used across calls
The name is similar to -fuse-caller-save, and it won't be clear from just the names what the difference is.

Seconded, the description is a bit confusing and "caller saved"/"callee saved"
should be avoided IMO, "call clobbered"/"call saved" is much clearer.


I have no objection to go with another terminology in the documentation. But before going into a patch, let's settle on the option name.

As for the name, I'm not sure just changing terminology will make things clearer, in other words, I'm not sure fuse-call-clobbered is any clearer than fuse-caller-save.

I've pondered the name -fipa-ira, but I rejected that earlier because that might suggest actual register allocation at the interprocedural scope, while this is only register allocation at the scope of a single procedure, taking some interprocedural information into account. Furthermore, it's not only ira that uses the interprocedural information.

So, let's a generate a list of option names.
-fuse-caller-save
-fuse-call-clobbered
-fprecise-call-clobbers
-foptimize-call-clobbers
-fprune-call-clobbers
-freduce-call-clobbers
-fcall-clobbers-ipa

Any preferences, alternatives?

Thanks,
- Tom


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