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

Create successful ePaper yourself

Turn your PDF publications into a flip-book with our unique Google optimized e-Paper software.

<strong>Compiler</strong>-specific Features<br />

Assembler labels<br />

The __asm keyword can be used to specify an assembler label for a C<br />

symbol. For example:<br />

int count __asm__("count_v1"); // export count_v1, not count<br />

See Assembler labels on page 3-21 for more information.<br />

Named register variables<br />

The __asm keyword can be used to declare a named register variable. For<br />

example:<br />

register int foo __asm("r0");<br />

See Named register variables on page 4-101 for more information.<br />

See also<br />

• asm keyword on page 3-25.<br />

4.1.5 __forceinline<br />

The __forceinline keyword forces the compiler to compile a C or C++ function inline.<br />

The semantics of __forceinline are exactly the same as those of the C++ inline<br />

keyword. The compiler attempts to inline a function qualified as __forceinline,<br />

regardless of its characteristics. However, the compiler does not inline a function if<br />

doing so causes problems. For example, a recursive function is inlined into itself only<br />

once.<br />

__forceinline is a storage class qualifier. It does not affect the type of a function.<br />

Note<br />

This keyword has the function attribute equivalent __attribute__((always_inline)).<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-39<br />

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

4-6 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!