This is the mail archive of the gcc@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: RFH: intra-procedure optimizations "CALL_REALLY_USED_REGISTERS"


On Sunday 07 August 2005 09:35, BjÃrn Haase wrote:
> Hello,
>
> The avr port presently misses possible intra-procedure optimizations
> concerning register use.

What you describe is an _inter_procedural optimization.  "Between
procedures".  You want to use the result of some analysis done in one
function to expose extra optimization opportunities in another function.
That is interprocedural.

> Optimizations are missed when 1) calling a leaf 
> function that is 2) defined in the same unit as a the caller and 3)
> clobbers only a subset of the call-clobbered registers. Presently I observe
> that the caller still saves all of the "CALL_REALLY_USED_REGISTERS" whether
> they are *really* used or not.

Look at how CALL_REALLY_USED_REGISTERS is "computed" and used ;-)  It
is not per-function, and not per-callsite.  It is just a pre-computed
register property (ABI property).

> Is there a way to make leaf functions to be compiled first

Leaf functions _are_ compiled first.

> so that when 
> starting with non-leaf functions in the same unit expand could insert
> detailed information on which subset of registers is actually clobbered by
> calls to leaf functions?

Not at the moment.  It is probably not very hard to implement something
like this idea, though.  Note that you can even propagate this detailed
information across the call graph if you could compute it.

> When reading the comments in cgraph.c for the cgraph_optimize function
> "Backend can then use this information to modify calling conventions" it
> seems to me that there is an interface already for modifying the calling
> convention. Is there a port that uses it so that one could find out what
> the interface looks like?

The i386 backend uses it.  Just look for cgraph in i386.c.  Note that
changing the calling conventions does not change the sets of call-used
and call-clobbered registers.

Gr.
Steven


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