[cfe-dev] A question on register allocation

Renato Golin via cfe-dev cfe-dev at lists.llvm.org
Tue Oct 6 14:07:53 PDT 2015


Hi Joerg,

Daniel also pointed out this usage. :-)

My point was: it's a very limited usage.

AFAIK, the only part of the kernel that had it was arch/arm, and that was
removed because of Clang back then.

Embedded or RTOS usage is different. But the tools are usually different,
too.

Cheers,
Renato
On 6 Oct 2015 9:36 pm, "Joerg Sonnenberger via cfe-dev" <
cfe-dev at lists.llvm.org> wrote:

> On Tue, Oct 06, 2015 at 10:07:45AM +0100, Renato Golin via cfe-dev wrote:
> > As David said, the only *real* use for global named registers is for
> > registers that have a specific meaning throughout the program: the
> > stack pointer being the only one that has a useful meaning. You don't
> > want to be changing the PC that easily, but if you really do, doing so
> > in inline asm is perfectly valid.
>
> This is simplifying things too much. The classic use case for a global
> named register is to hold an extremely hot thread local variable. This
> is primarily from a time when (a) thread local variable didn't exist and
> (b) the overhead typically associated with them on some platforms is too
> high. Consider older ARM or MIPS system, where any access to the thread
> register would involve a trap. Things like Lisp engines often have a
> global context pointer which is easily hot enough to justify burning a
> register on it.
>
> Joerg
> _______________________________________________
> cfe-dev mailing list
> cfe-dev at lists.llvm.org
> http://lists.llvm.org/cgi-bin/mailman/listinfo/cfe-dev
>
-------------- next part --------------
An HTML attachment was scrubbed...
URL: <http://lists.llvm.org/pipermail/cfe-dev/attachments/20151006/3124272f/attachment.html>


More information about the cfe-dev mailing list