04.01.2015 Views

RealView Compilation Tools - ARM Information Center

RealView Compilation Tools - ARM Information Center

RealView Compilation Tools - ARM Information Center

SHOW MORE
SHOW LESS

You also want an ePaper? Increase the reach of your titles

YUMPU automatically turns print PDFs into web optimized ePapers that Google loves.

Compiler-specific Features<br />

Example<br />

__forceinline static int max(int x, in y)<br />

{<br />

return x > y x : y; // always inline if possible<br />

}<br />

See also<br />

• --forceinline on page 2-58<br />

• __attribute__((always_inline)) on page 4-33.<br />

4.1.6 __global_reg<br />

The __global_reg storage class specifier allocates the declared variable to a global<br />

variable register.<br />

Syntax<br />

__global_reg(n) type varName<br />

Where:<br />

n<br />

type<br />

varName<br />

Is an integer between one and eight.<br />

Is one of the following types:<br />

• any integer type, except long long<br />

• any char type<br />

• any pointer type.<br />

Is the name of a variable.<br />

Restrictions<br />

If you use this storage class, you cannot use any additional storage class such as extern,<br />

static, or typedef.<br />

In C, global register variables cannot be qualified or initialized at declaration. In C++,<br />

any initialization is treated as a dynamic initialization.<br />

The number of available registers varies depending on the variant of the AAPCS being<br />

used, there are between five and seven registers available for use as global variable<br />

registers.<br />

In practice, it is recommended that you do not use more than:<br />

• three global register variables in <strong>ARM</strong> or Thumb-2<br />

<strong>ARM</strong> DUI 0348C Copyright © 2007-2010 <strong>ARM</strong>. All rights reserved. 4-7<br />

ID101213<br />

Non-Confidential,

Hooray! Your file is uploaded and ready to be published.

Saved successfully!

Ooh no, something went wrong!