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

Note<br />

This keyword has the function attribute equivalent __attribute__((const)).<br />

Default<br />

By default, functions are assumed to be impure.<br />

Usage<br />

Pure functions are candidates for common subexpression elimination.<br />

Restrictions<br />

A function that is declared as pure can have no side effects. For example, pure functions:<br />

• cannot call impure functions<br />

• cannot use global variables or dereference pointers, because the compiler<br />

assumes that the function does not access memory, except stack memory<br />

• must return the same value each time when called twice with the same<br />

parameters.<br />

Example<br />

int factr(int n) __pure<br />

{<br />

int f = 1;<br />

while (n > 0)<br />

f *= n--;<br />

return f;}<br />

See also<br />

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

• __pure on page 5-14 in the Compiler User Guide<br />

• Placing <strong>ARM</strong> function qualifiers on page 5-16 in the Compiler User Guide.<br />

4.1.13 __smc<br />

The __smc keyword declares an SMC (Secure Monitor Call) function. A call to the SMC<br />

function inserts an SMC instruction into the instruction stream generated by the compiler<br />

at the point of function invocation.<br />

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

Non-Confidential,<br />

ID101213

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

Saved successfully!

Ooh no, something went wrong!