[cfe-dev] [LLVMdev] Named register variables GNU-style

Renato Golin renato.golin at linaro.org
Wed Apr 2 15:54:19 PDT 2014


On 2 April 2014 23:35, Richard Smith <richard at metafoo.co.uk> wrote:
> 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:

That document is terribly confusing...


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

Absolutely! We just can't do it.


> Is there some other specification that you guys are working from, or are you
> basing this on observations of GCC's actual behavior?

Observations and discussions in the GCC mailing list, unfortunately.
Most of the GNU extensions are either badly documented or completely
undocumented, and that's yet-another example of both!

About the implementation, I'd like to make clear that the
__builtin_stack_pointer can still exist as aliases to
read_register/write_register. We can even create a special name in the
IR "stack_pointer", so that each back end can do that and not force
the front-end to know what's the stack pointer on each platform. In a
way, I'm implementing both of them at the same time.

So, we'll start with the non-allocatable ones because that's what the
original idea (the builtin) implements, and because that's the problem
we have right now. After this is in, maybe even with an additional
builtin, we can think about the allocatable ones.

cheers,
--renato



More information about the cfe-dev mailing list