29.12.2014 Views

RealView Compilation Tools Compiler Reference Guide - ARM ...

RealView Compilation Tools Compiler Reference Guide - ARM ...

RealView Compilation Tools Compiler Reference Guide - ARM ...

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.

<strong>Compiler</strong>-specific Features<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 />

}<br />

while (n > 0)<br />

f *= n--;<br />

return f;<br />

See also<br />

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

• __pure on page 4-15 in the <strong>Compiler</strong> User <strong>Guide</strong><br />

• Placing <strong>ARM</strong> function qualifiers on page 4-17 in the <strong>Compiler</strong> User <strong>Guide</strong>.<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 />

Note<br />

The SMC instruction replaces the SMI instruction used in previous versions of the <strong>ARM</strong><br />

assembly language.<br />

__smc is a function qualifier. It affects the type of a function.<br />

Syntax<br />

__smc(int smc_num) return-type function-name([argument-list]);<br />

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

Non-Confidential

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

Saved successfully!

Ooh no, something went wrong!