[LLVMdev] Named register variables GNU-style

Richard Smith richard at metafoo.co.uk
Wed Apr 2 15:35:32 PDT 2014


On Fri, Mar 28, 2014 at 4:50 AM, Renato Golin <renato.golin at linaro.org>wrote:

> On 28 March 2014 11:16, Chandler Carruth <chandlerc at google.com> wrote:
> > Just the reserved part.
>
> Ok, in that case, I share you concerns.
>
> We could easily only implement the reserved ones (stack pointer being
> the case in hand). If there is any mad reason why allocatable ones
> should be used (I heard glibc uses R8 for some special things, haven't
> confirmed myself), we can discuss this topic later.


I'm a bit confused by this. The GCC documentation makes it pretty clear
that *only* the allocatable registers are suitable for use as global
register variables (and that things like the stack pointer make no sense
here). From the doc:

"Defining a global register variable in a certain register reserves that
register entirely for this use, at least within the current compilation.
The register is not allocated for any other purpose in the functions in the
current compilation, and is not saved and restored by these functions.
Stores into this register are never deleted even if they appear to be dead,
but references may be deleted or moved or simplified."

Obviously it's not possible to reserve the stack pointer register entirely
for use as a global register variable, and any attempt to do so would be
abusing the mechanism.

Is there some other specification that you guys are working from, or are
you basing this on observations of GCC's actual behavior?
-------------- next part --------------
An HTML attachment was scrubbed...
URL: <http://lists.llvm.org/pipermail/llvm-dev/attachments/20140402/dff77405/attachment.html>


More information about the llvm-dev mailing list