RealView® Compilation Tools Compiler User Guide

Version 4.0


Table of Contents

Preface
About this book
Intended audience
Using this book
Typographical conventions
Further reading
Feedback
Feedback on RealView Compilation Tools
Feedback on this book
1. Introduction
1.1. About the ARM compiler
1.2. About the NEON vectorizing compiler
1.3. Source language modes
1.4. The C and C++ libraries
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 stdin input
2.2. File naming conventions
2.2.1. Portability
2.2.2. Output files
2.3. Header files
2.3.1. The current place
2.3.2. The RVCT40INC 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.7.1. Eliminating unused functions
2.7.2. Reduction of compilation required for interworking
2.8. Adding symbol versions
3. Using the NEON Vectorizing Compiler
3.1. The NEON unit
3.2. Writing code for NEON
3.2.1. NEON C extensions
3.2.2. Automatic vectorization
3.2.3. Performance goals
3.3. Working with automatic vectorization
3.3.1. Overview of automatic vectorization
3.3.2. Vectorization concepts
3.3.3. Factors affecting vectorization performance
3.3.4. Improving performance
3.4. Examples
4. Compiler Features
4.1. Intrinsics
4.1.1. About intrinsics
4.1.2. Instruction intrinsics
4.1.3. ETSI basic operations
4.1.4. TI C55x intrinsics
4.1.5. NEON Intrinsics
4.2. Named register variables
4.3. Pragmas
4.4. Bit-banding
4.4.1. Using __attribute__((bitband))
4.4.2. Using --bitband on the command-line
4.4.3. Restrictions
4.5. Thread-local storage
4.6. Eight‑byte alignment features
5. Coding Practices
5.1. Optimizing code
5.1.1. Optimizing for size versus speed
5.1.2. Optimization levels and the debug view
5.1.3. Selecting the target CPU
5.1.4. Optimizing loops
5.1.5. Using volatile
5.2. Code metrics
5.2.1. Measuring code and data sizes
5.2.2. Measuring stack use
5.2.3. Reducing debug information in objects and libraries
5.3. Functions
5.3.1. Minimizing parameter passing overhead
5.3.2. __value_in_regs
5.3.3. __pure
5.3.4. Placing ARM function qualifiers
5.4. Function inlining
5.4.1. How the compiler decides to inline
5.4.2. When is it practical for the compiler to inline?
5.4.3. Managing inlining
5.4.4. Automatic inlining
5.4.5. Differences in behavior between C++, C90, C99, and GNU C90 compiler modes
5.4.6. Linker inlining
5.4.7. Debugging data and the --no_inline and --inline command-line options
5.4.8. Marking functions as static
5.4.9. Setting breakpoints on inline functions in ROM images
5.5. Aligning data
5.5.1. Types of data alignment
5.5.2. Unaligned data access
5.5.3. The __packed qualifier and unaligned data access
5.5.4. __packed structures versus individually __packed fields
5.6. Using floating-point arithmetic
5.6.1. Support for floating-point operations
5.6.2. VFP architectures
5.6.3. VFP support
5.6.4. Half-precision floating-point number support
5.6.5. Floating-point computations and linkage
5.7. Trapping and identifying division-by-zero errors
5.7.1. Integer division
5.7.2. (Software) Floating-point division
5.8. New features of C99
5.8.1. Language features
5.8.2. Library features
6. Diagnostic Messages
6.1. Redirecting diagnostics
6.2. Severity of diagnostic messages
6.3. Controlling the output of diagnostic messages
6.4. Changing the severity of diagnostic messages
6.5. Suppressing diagnostic messages
6.6. Prefix letters in diagnostic messages
6.7. Suppressing warning messages with ‑W
6.8. Exit status codes and termination messages
6.8.1. Response to signals
6.8.2. Exit status
6.9. Data flow warnings
7. Using the Inline and Embedded Assemblers
7.1. Inline assembler
7.1.1. Inline assembler support
7.1.2. Inline assembler syntax
7.1.3. Restrictions on inline assembly operations
7.1.4. Virtual registers
7.1.5. Constants
7.1.6. Instruction expansion
7.1.7. Condition flags
7.1.8. Operands
7.1.9. Function calls and branches
7.1.10. Labels
7.1.11. Differences from previous versions of the ARM C/C++ compilers
7.2. Embedded assembler
7.2.1. Embedded assembler syntax
7.2.2. Restrictions on embedded assembly
7.2.3. Differences between expressions in embedded assembly and C or C++
7.2.4. Generation of embedded assembly functions
7.2.5. The __cpp keyword
7.2.6. Manual overload resolution
7.2.7. Keywords for related base classes
7.2.8. Keywords for member function classes
7.2.9. Calling non‑static member functions
7.3. Legacy inline assembler that accesses sp, lr, or pc
7.3.1. Accessing sp (r13), lr (r14), and pc (r15) in legacy code
7.4. Differences between inline and embedded assembly code

Proprietary Notice

Words and logos marked with ® or ™ are registered trademarks or trademarks of ARM® in the EU and other countries, except as otherwise stated below in this proprietary notice. 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 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.

Unrestricted Access is an ARM internal classification.

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 RealView Developer Suite v2.0
Revision DJanuary 2004Release 2.1 for RealView Developer Suite v2.1
Revision EDecember 2004Release 2.2 for RealView Developer Suite v2.2
Revision FMay 2005Release 2.2 for RealView Developer Suite v2.2 SP1
Revision GMarch 2006Release 3.0 for RealView Development Suite v3.0
Revision HMarch 2007Release 3.1 for RealView Development Suite v3.1
Revision ISeptember 2008Release 4.0 for RealView Development Suite v4.0
Revision IJanuary 2009Update 1 for RealView Development Suite v4.0
Revision I15 April 2010Update 2 for RealView Development Suite v4.0
Revision J10 December 2010Update 3 for RealView Development Suite v4.0
Copyright © 2002-2010 ARM. All rights reserved.ARM DUI 0205J
Non-ConfidentialID101213