tinycc-devel
[Top][All Lists]
Advanced

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

Re: [Tinycc-devel] Proposal for a global register feature


From: Paulo Henrique Torrens
Subject: Re: [Tinycc-devel] Proposal for a global register feature
Date: Wed, 14 Dec 2011 01:38:47 +0000

> Subject: Re: [Tinycc-devel] Proposal for a global register feature
> From: address@hidden
> To: address@hidden
> Date: Tue, 13 Dec 2011 19:30:06 -0500
>
> Paulo,
>
> I'm confused. What does {change "register" to "register
> [named-register]" in the syntax} mean?
>
> - Rick


To clarify, C standard, section 6.7.1, states:

storage-class-specifier:
typedef
extern
static
_Thread_local
auto
register

Well, the syntax in the official embedded C standard changes this on section 5.2.2 to, lets say, this:

storage-class-specifier:
typedef
extern
static
_Thread_local
auto
register-specifier

register-specifier:
register
register identifier


So that anywhere in the language where you would use the "register" keyword, you may now use "register", as you did before, which tells the compiler to use a register if it wants to (but it may still be on memory instead), or "register REGISTAR_NAME", to specify which register to use, and thus force the compiler to use it instead of chosing if it should.

register int i; // may be any register, may be on memory
register eax int i; // always on register eax

The register name must follow the keyword "register", which, as specified by the C grammar, may come anywhere in the declaration, so...

volatile int register eax my_reg;

...Is valid too. :)

reply via email to

[Prev in Thread] Current Thread [Next in Thread]