[Top][All Lists]

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

Re: stop using P_, __P in header files

From: Ken Raeburn
Subject: Re: stop using P_, __P in header files
Date: Tue, 6 Jul 2010 02:37:12 -0400

On Jul 6, 2010, at 00:32, Stephen J. Turnbull wrote:
> In principle, "register" is still occasionally useful.  If you have a
> large number of variables in a loop which has two long branches, then
> which variables belong in registers depend on which branch is taken
> more often, something that the compiler cannot know.

If the compiler pays attention to them, yes, it could help.  Though for reasons 
other than register allocation it's probably more useful to tell the compiler 
which branches are taken most often, though unfortunately that's still 
compiler-specific (e.g., __builtin_expect, or feedback from profiling runs).

> Also, "large" depends on the number of registers available, of course.
> In the case of x86, "large" is pretty small, about 8-10 IIRC.

Fewer -- x86 has 8 integer registers including stack pointer and frame pointer, 
and some are clobbered in function calls.  Slap too many "register" 
declarations onto variables and the compiler is still going to have to guess 
which of them should actually be heeded.  But if you keep the number small, you 
can't give the compiler much advice on x86-64 or ppc or other platforms with 
many more registers available.

I will (grudgingly :-) admit there's sometimes a need to give the compiler some 
hints that it can't necessarily work out for itself.  But I think the use of 
"register" in Emacs goes well beyond that, as I pointed out regarding some 
functions in data.c.  And I suspect any significant fine-tuning with register 
declarations is likely to be specific to an architecture and/or compiler.


reply via email to

[Prev in Thread] Current Thread [Next in Thread]