[cfe-dev] A question on register allocation

Daniel Sanders via cfe-dev cfe-dev at lists.llvm.org
Tue Oct 6 03:07:41 PDT 2015


> 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.

It doesn't change your point but just for completeness, some targets do have other useful global registers. For example, Mips uses the otherwise unused 'global pointer' as a cheap global variable. IIRC, it's a pointer to the thread context.


More information about the cfe-dev mailing list