RealView® Compilation Tools Compiler User Guide

Version 3.1

Table of Contents

About this book
Intended audience
Using this book
Typographical conventions
Further reading
Feedback on RealView Compilation Tools
Feedback on this book
1. Introduction
1.1. About the ARM compiler
1.2. Source language modes
1.3. The C and C++ libraries
1.4. New features of C99
1.4.1. Language features
1.4.2. Library features
2. Getting started with the ARM Compiler
2.1. Using command-line options
2.1.1. Invoking the ARM compiler
2.1.2. Ordering command-line options
2.1.3. Specifying command-line options with an environment variable
2.1.4. Autocompleting command-line options
2.1.5. Reading compiler options from a file
2.1.6. Specifying keyboard input
2.2. File naming conventions
2.2.1. Portability
2.2.2. Output files
2.3. Include files
2.3.1. The current place
2.3.2. The RVCT31INC environment variable
2.3.3. The search path
2.3.4. The TMP and TMPDIR environment variables
2.4. Precompiled header files
2.4.1. Automatic PCH processing
2.4.2. Manual PCH processing
2.4.3. Controlling the output of messages during PCH processing
2.4.4. Performance issues
2.5. Specifying the target processor or architecture
2.5.1. NEON technology
2.6. Specifying the procedure call standard (AAPCS)
2.6.1. Interworking qualifiers
2.6.2. Position independence qualifiers
2.7. Using linker feedback
2.8. Adding symbol versions
2.9. Thread-local storage
2.10. Eight‑byte alignment features
3. Compiler Features
3.1. Intrinsics
3.1.1. About intrinsics
3.1.2. Instruction intrinsics
3.1.3. ETSI basic operations
3.1.4. TI C55x intrinsics
3.1.5. Named register variables
3.1.6. NEON Intrinsics
3.2. Pragmas
4. Coding Practices
4.1. Optimizing code
4.1.1. Optimizing for size versus speed
4.1.2. Optimization levels and the debug view
4.1.3. Selecting the target CPU
4.1.4. Optimizing loops
4.1.5. Using volatile
4.2. Code metrics
4.2.1. Measuring code and data sizes
4.2.2. Measuring stack use
4.2.3. Reducing debug information in objects and libraries
4.3. Functions
4.3.1. Minimizing parameter passing overhead
4.3.2. __value_in_regs
4.3.3. __pure
4.3.4. Placing ARM function qualifiers
4.4. Inlining
4.4.1. How the compiler decides to inline
4.4.2. When is it practical for the compiler to inline?
4.4.3. Managing inlining
4.4.4. Inlining functions across multiple files
4.4.5. Debugging data and the --[no]_inline keyword
4.4.6. Marking functions as static
4.4.7. Setting breakpoints on inlined functions in ROM images
4.5. Aligning data
4.5.1. About data alignment
4.5.2. The __packed qualifier and unaligned accesses to data
4.5.3. __packed structures versus individually __packed fields
4.6. Using floating-point arithmetic
4.6.1. Support for floating-point operations
4.6.2. VFP architectures
4.6.3. The --fpu option
4.6.4. Floating-point linkage
4.6.5. The --fpmode option
4.6.6. Using the --fpu option
4.6.7. VFP support
4.7. Trapping and identifying division-by-zero errors
4.7.1. Integer division
4.7.2. (Software) Floating point division
4.8. Support for ARM architecture v6
4.8.1. Instruction generation
4.8.2. Alignment support
4.8.3. Endian support
5. Diagnostic Messages
5.1. Redirecting diagnostics
5.2. Severity of diagnostic messages
5.3. Controlling the output of diagnostic messages
5.4. Changing the severity of diagnostic messages
5.5. Suppressing diagnostic messages
5.6. Prefix letters in diagnostic messages
5.7. Suppressing warning messages with ‑W
5.8. Exit status codes and termination messages
5.8.1. Response to signals
5.8.2. Exit status
5.9. Data flow warnings
6. Using the Inline and Embedded Assemblers
6.1. Inline assembler
6.1.1. Inline assembler syntax
6.1.2. Restrictions on inline assembly operations
6.1.3. Virtual registers
6.1.4. Constants
6.1.5. Instruction expansion
6.1.6. Condition flags
6.1.7. Operands
6.1.8. Function calls and branches
6.1.9. Labels
6.1.10. Differences from previous versions of the ARM C/C++ compilers
6.2. Embedded assembler
6.2.1. Embedded assembler syntax
6.2.2. Restrictions on embedded assembly
6.2.3. Differences between expressions in embedded assembly and C or C++
6.2.4. Generation of embedded assembly functions
6.2.5. The __cpp keyword
6.2.6. Manual overload resolution
6.2.7. Keywords for related base classes
6.2.8. Keywords for member function classes
6.2.9. Calling non‑static member functions
6.2.10. Differences from previous versions of the ARM C/C++ compilers
6.3. Legacy inline assembler that accesses sp, lr, or pc
6.3.1. Accessing sp (r13), lr (r14), and pc (r15) in legacy code
6.4. Differences between inline and embedded assembly code
A. Using Old Command-line Options
A.1. Invoking the ARM compiler using older tool names
A.2. Migrating command‑line options from ADS 1.2
A.2.1. Mapping ADS 1.2 compiler options to the new release
A.2.2. Controlling ADS 1.2 diagnostic messages in the new release
A.3. Migrating command line options from RVCT 2.2 and RVCT 3.0
A.3.1. Mapping RVCT 2.2 compiler options to the new release
A.3.2. Mapping RVCT 3.0 compiler options to the new release
A.4. Warning messages for old options in RVCT
A.5. Getting more information

Proprietary Notice

Words and logos marked with ® or ™ are registered trademarks or trademarks owned by ARM Limited. Other brands and names mentioned herein may be the trademarks of their respective owners.

Neither the whole nor any part of the information contained in, or the product described in, this document may be adapted or reproduced in any material form except with the prior written permission of the copyright holder.

The product described in this document is subject to continuous developments and improvements. All particulars of the product and its use contained in this document are given by ARM in good faith. However, all warranties implied or expressed, including but not limited to implied warranties of merchantability, or fitness for purpose, are excluded.

This document is intended only to assist the reader in the use of the product. ARM Limited shall not be liable for any loss or damage arising from the use of any information in this document, or any error or omission in such information, or any incorrect use of the product.

Where the term ARM is used it means “ARM or any of its subsidiaries as appropriate”.

Confidentiality Status

This document is Non-Confidential. The right to use, copy and disclose this document may be subject to license restrictions in accordance with the terms of the agreement entered into by ARM and the party that ARM delivered this document to.

Product Status

The information in this document is final, that is for a developed product.

Revision History
Revision AAugust 2002Release 1.2
Revision BJanuary 2003Release 2.0
Revision CSeptember 2003Release 2.0.1 for RVDS v2.0
Revision DJanuary 2004Release 2.1 for RVDS v2.1
Revision EDecember 2004Release 2.2 for RVDS v2.2
Revision FMay 2005Release 2.2 for RVDS v2.2 SP1
Revision GMarch 2006Release 3.0 for RVDS v3.0
Revision HMarch 2007Release 3.1 for RVDS v3.1
Copyright © 2002-2007 ARM Limited. All rights reserved.ARM DUI 0205H