[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.
Ken
- Re: stop using P_, __P in header files, (continued)
- Re: stop using P_, __P in header files, Eli Zaretskii, 2010/07/05
- Re: stop using P_, __P in header files, Ken Raeburn, 2010/07/05
- Re: stop using P_, __P in header files, Juanma Barranquero, 2010/07/05
- Re: stop using P_, __P in header files, Eli Zaretskii, 2010/07/05
- Re: stop using P_, __P in header files, Dan Nicolaescu, 2010/07/05
- Re: stop using P_, __P in header files, Dan Nicolaescu, 2010/07/09
- Re: stop using P_, __P in header files, David Kastrup, 2010/07/10
- Re: stop using P_, __P in header files, Juanma Barranquero, 2010/07/10
- Re: stop using P_, __P in header files, Ken Raeburn, 2010/07/04
- Re: stop using P_, __P in header files, Stephen J. Turnbull, 2010/07/06
- Re: stop using P_, __P in header files,
Ken Raeburn <=
- Re: stop using P_, __P in header files, Stephen J. Turnbull, 2010/07/06
- Re: stop using P_, __P in header files, Dan Nicolaescu, 2010/07/05
- Re: stop using P_, __P in header files, Ken Raeburn, 2010/07/05
- Re: stop using P_, __P in header files, Dan Nicolaescu, 2010/07/05
Re: stop using P_, __P in header files, Andreas Schwab, 2010/07/02