SPRUI04F july   2015  – april 2023

 

  1.   Read This First
    1.     About This Manual
    2.     Notational Conventions
    3.     Related Documentation
    4.     Related Documentation From Texas Instruments
    5.     Trademarks
  2. Introduction to the Software Development Tools
    1. 1.1 Software Development Tools Overview
    2. 1.2 Compiler Interface
    3. 1.3 ANSI/ISO Standard
    4. 1.4 Output Files
    5. 1.5 Utilities
  3. Getting Started with the Code Generation Tools
    1. 2.1 How Code Composer Studio Projects Use the Compiler
    2. 2.2 Compiling from the Command Line
  4. Using the C/C++ Compiler
    1. 3.1  About the Compiler
    2. 3.2  Invoking the C/C++ Compiler
    3. 3.3  Changing the Compiler's Behavior with Options
      1. 3.3.1  Linker Options
      2. 3.3.2  Frequently Used Options
      3. 3.3.3  Miscellaneous Useful Options
      4. 3.3.4  Run-Time Model Options
      5. 3.3.5  Selecting Target CPU Version (--silicon_version Option)
      6. 3.3.6  Symbolic Debugging and Profiling Options
      7. 3.3.7  Specifying Filenames
      8. 3.3.8  Changing How the Compiler Interprets Filenames
      9. 3.3.9  Changing How the Compiler Processes C Files
      10. 3.3.10 Changing How the Compiler Interprets and Names Extensions
      11. 3.3.11 Specifying Directories
      12. 3.3.12 Assembler Options
    4. 3.4  Controlling the Compiler Through Environment Variables
      1. 3.4.1 Setting Default Compiler Options (C6X_C_OPTION)
      2. 3.4.2 Naming One or More Alternate Directories (C6X_C_DIR)
    5. 3.5  Controlling the Preprocessor
      1. 3.5.1  Predefined Macro Names
      2. 3.5.2  The Search Path for #include Files
        1. 3.5.2.1 Adding a Directory to the #include File Search Path (--include_path Option)
      3. 3.5.3  Support for the #warning and #warn Directives
      4. 3.5.4  Generating a Preprocessed Listing File (--preproc_only Option)
      5. 3.5.5  Continuing Compilation After Preprocessing (--preproc_with_compile Option)
      6. 3.5.6  Generating a Preprocessed Listing File with Comments (--preproc_with_comment Option)
      7. 3.5.7  Generating Preprocessed Listing with Line-Control Details (--preproc_with_line Option)
      8. 3.5.8  Generating Preprocessed Output for a Make Utility (--preproc_dependency Option)
      9. 3.5.9  Generating a List of Files Included with #include (--preproc_includes Option)
      10. 3.5.10 Generating a List of Macros in a File (--preproc_macros Option)
    6. 3.6  Passing Arguments to main()
    7. 3.7  Understanding Diagnostic Messages
      1. 3.7.1 Controlling Diagnostic Messages
      2. 3.7.2 How You Can Use Diagnostic Suppression Options
    8. 3.8  Other Messages
    9. 3.9  Generating Cross-Reference Listing Information (--gen_cross_reference_listing Option)
    10. 3.10 Generating a Raw Listing File (--gen_preprocessor_listing Option)
    11. 3.11 Using Inline Function Expansion
      1. 3.11.1 Inlining Intrinsic Operators
      2. 3.11.2 Inlining Restrictions
      3. 3.11.3 Unguarded Definition-Controlled Inlining
        1. 3.11.3.1 Using the Inline Keyword
      4. 3.11.4 Guarded Inlining and the _INLINE Preprocessor Symbol
        1. 3.11.4.1 Header File string.h
        2. 3.11.4.2 Library Definition File
    12. 3.12 Interrupt Flexibility Options (--interrupt_threshold Option)
    13. 3.13 Using Interlist
    14. 3.14 Generating and Using Performance Advice
    15. 3.15 About the Application Binary Interface
    16. 3.16 Enabling Entry Hook and Exit Hook Functions
  5. Optimizing Your Code
    1. 4.1  Invoking Optimization
    2. 4.2  Controlling Code Size Versus Speed
    3. 4.3  Performing File-Level Optimization (--opt_level=3 option)
      1. 4.3.1 Creating an Optimization Information File (--gen_opt_info Option)
    4. 4.4  Program-Level Optimization (--program_level_compile and --opt_level=3 options)
      1. 4.4.1 Controlling Program-Level Optimization (--call_assumptions Option)
      2. 4.4.2 Optimization Considerations When Mixing C/C++ and Assembly
    5. 4.5  Automatic Inline Expansion (--auto_inline Option)
    6. 4.6  Optimizing Software Pipelining
      1. 4.6.1 Turn Off Software Pipelining (--disable_software_pipeline Option)
      2. 4.6.2 Software Pipelining Information
        1. 4.6.2.1 Software Pipelining Information
        2. 4.6.2.2 Software Pipelining Information Terms
        3. 4.6.2.3 Loop Disqualified for Software Pipelining Messages
        4. 4.6.2.4 Pipeline Failure Messages
        5. 4.6.2.5 Register Usage Table Generated by the --debug_software_pipeline Option
      3. 4.6.3 Collapsing Prologs and Epilogs for Improved Performance and Code Size
        1. 4.6.3.1 Speculative Execution
        2. 4.6.3.2 Selecting the Best Threshold Value
    7. 4.7  Redundant Loops
    8. 4.8  Utilizing the Loop Buffer Using SPLOOP
    9. 4.9  Reducing Code Size (--opt_for_space (or -ms) Option)
    10. 4.10 Using Feedback Directed Optimization
      1. 4.10.1 Feedback Directed Optimization
        1. 4.10.1.1 Phase 1 -- Collect Program Profile Information
        2. 4.10.1.2 Phase 2 -- Use Application Profile Information for Optimization
        3. 4.10.1.3 Generating and Using Profile Information
        4. 4.10.1.4 Example Use of Feedback Directed Optimization
        5. 4.10.1.5 The .ppdata Section
        6. 4.10.1.6 Feedback Directed Optimization and Code Size Tune
        7. 4.10.1.7 Instrumented Program Execution Overhead
        8. 4.10.1.8 Invalid Profile Data
      2. 4.10.2 Profile Data Decoder
      3. 4.10.3 Feedback Directed Optimization API
      4. 4.10.4 Feedback Directed Optimization Summary
    11. 4.11 Using Profile Information to Get Better Program Cache Layout and Analyze Code Coverage
      1. 4.11.1 Background and Motivation
      2. 4.11.2 Code Coverage
        1. 4.11.2.1 Phase1 -- Collect Program Profile Information
        2. 4.11.2.2 Phase 2 -- Generate Code Coverage Reports
      3. 4.11.3 What Performance Improvements Can You Expect to See?
        1. 4.11.3.1 Evaluating L1P Cache Performance
      4. 4.11.4 Program Cache Layout Related Features and Capabilities
        1. 4.11.4.1 Path Profiler
        2. 4.11.4.2 Analysis Options
        3. 4.11.4.3 Environment Variables
        4. 4.11.4.4 Program Cache Layout Tool, clt6x
        5. 4.11.4.5 Linker
        6. 4.11.4.6 Linker Command File Operator unordered()
      5. 4.11.5 Program Instruction Cache Layout Development Flow
        1. 4.11.5.1 Gather Dynamic Profile Information
        2. 4.11.5.2 Generate Preferred Function Order from Dynamic Profile Information
        3. 4.11.5.3 Utilize Preferred Function Order in Re-Build of Application
      6. 4.11.6 Comma-Separated Values (CSV) Files with Weighted Call Graph (WCG) Information
      7. 4.11.7 Linker Command File Operator - unordered()
        1. 4.11.7.1 Output Section for unordered() Operator
        2.       124
        3. 4.11.7.2 Generated Linker Map File for
        4. 4.11.7.3 About Dot (.) Expressions in the Presence of unordered()
          1. 4.11.7.3.1 Respecting Position of a . Expression
          2.        128
        5. 4.11.7.4 GROUPs and UNIONs
          1. 4.11.7.4.1 Applying unordered() to GROUPs
        6.       131
      8. 4.11.8 Things to be Aware of
    12. 4.12 Indicating Whether Certain Aliasing Techniques Are Used
      1. 4.12.1 Use the --aliased_variables Option When Certain Aliases are Used
      2. 4.12.2 Use the --no_bad_aliases Option to Indicate That These Techniques Are Not Used
      3. 4.12.3 Using the --no_bad_aliases Option With the Assembly Optimizer
    13. 4.13 Prevent Reordering of Associative Floating-Point Operations
    14. 4.14 Use Caution With asm Statements in Optimized Code
    15. 4.15 Using Performance Advice to Optimize Your Code
      1. 4.15.1  Advice #27000
      2. 4.15.2  Advice #27001 Increase Optimization Level
      3. 4.15.3  Advice #27002 Do not turn off software pipelining
      4. 4.15.4  Advice #27003 Avoid compiling with debug options
      5. 4.15.5  Advice #27004 No Performance Advice generated
      6. 4.15.6  Advice #30000 Prevent Loop Disqualification due to call
      7. 4.15.7  Advice #30001 Prevent Loop Disqualification due to rts-call
      8. 4.15.8  Advice #30002 Prevent Loop Disqualification due to asm statement
      9. 4.15.9  Advice #30003 Prevent Loop Disqualification due to complex condition
      10. 4.15.10 Advice #30004 Prevent Loop Disqualification due to switch statement
      11. 4.15.11 Advice #30005 Prevent Loop Disqualification due to arithmetic operation
      12. 4.15.12 Advice #30006 Prevent Loop Disqualification due to call(2)
      13. 4.15.13 Advice #30007 Prevent Loop Disqualification due to rts-call(2)
      14. 4.15.14 Advice #30008 Improve Loop; Qualify with restrict
      15. 4.15.15 Advice #30009 Improve Loop; Add MUST_ITERATE pragma
      16. 4.15.16 Advice #30010 Improve Loop; Add MUST_ITERATE pragma(2)
      17. 4.15.17 Advice #30011 Improve Loop; Add _nasssert()
    16. 4.16 Using the Interlist Feature With Optimization
    17. 4.17 Debugging and Profiling Optimized Code
      1. 4.17.1 Profiling Optimized Code
    18. 4.18 What Kind of Optimization Is Being Performed?
      1. 4.18.1  Cost-Based Register Allocation
      2. 4.18.2  Alias Disambiguation
      3. 4.18.3  Branch Optimizations and Control-Flow Simplification
      4. 4.18.4  Data Flow Optimizations
      5. 4.18.5  Expression Simplification
      6. 4.18.6  Inline Expansion of Functions
      7. 4.18.7  Function Symbol Aliasing
      8. 4.18.8  Induction Variables and Strength Reduction
      9. 4.18.9  Loop-Invariant Code Motion
      10. 4.18.10 Loop Rotation
      11. 4.18.11 Vectorization (SIMD)
      12. 4.18.12 Instruction Scheduling
      13. 4.18.13 Register Variables
      14. 4.18.14 Register Tracking/Targeting
      15. 4.18.15 Software Pipelining
  6. Using the Assembly Optimizer
    1. 5.1 Code Development Flow to Increase Performance
    2. 5.2 About the Assembly Optimizer
    3. 5.3 What You Need to Know to Write Linear Assembly
      1. 5.3.1 Linear Assembly Source Statement Format
      2. 5.3.2 Register Specification for Linear Assembly
        1. 5.3.2.1 Linear Assembly Code for Computing a Dot Product
        2.       183
        3. 5.3.2.2 C Code for Computing a Dot Product
        4.       185
        5. 5.3.2.3 Specifying a Register Pair
        6.       187
        7. 5.3.2.4 Specifying a Register Quad (C6600 Only)
        8.       189
      3. 5.3.3 Functional Unit Specification for Linear Assembly
      4. 5.3.4 Using Linear Assembly Source Comments
        1. 5.3.4.1 Lmac Function Code Showing Comments
      5. 5.3.5 Assembly File Retains Your Symbolic Register Names
    4. 5.4 Assembly Optimizer Directives
      1.      .call
      2.      .circ
      3.      .cproc/.endproc
      4.      .map
      5.      .mdep
      6.      .mptr
      7.      .no_mdep
      8.      .pref
      9.      .proc/.endproc
      10.      .reg
      11.      .rega/.regb
      12.      .reserve
      13.      .return
      14.      .trip
      15.      .volatile
      16. 5.4.1 Instructions That Are Not Allowed in Procedures
    5. 5.5 Avoiding Memory Bank Conflicts With the Assembly Optimizer
      1. 5.5.1 Preventing Memory Bank Conflicts
        1. 5.5.1.1 Load and Store Instructions That Specify Memory Bank Information
      2. 5.5.2 A Dot Product Example That Avoids Memory Bank Conflicts
        1. 5.5.2.1 C Code for Dot Product
        2. 5.5.2.2 Linear Assembly for Dot Product
        3. 5.5.2.3 Dot Product Software-Pipelined Kernel
        4.       218
        5. 5.5.2.4 Dot Product From Unrolled to Prevent Memory Bank Conflicts
        6.       220
        7. 5.5.2.5 Unrolled Dot Product Kernel From
        8.       222
      3. 5.5.3 Memory Bank Conflicts for Indexed Pointers
        1. 5.5.3.1 Using .mptr for Indexed Pointers
      4. 5.5.4 Memory Bank Conflict Algorithm
    6. 5.6 Memory Alias Disambiguation
      1. 5.6.1 How the Assembly Optimizer Handles Memory References (Default)
      2. 5.6.2 Using the --no_bad_aliases Option to Handle Memory References
      3. 5.6.3 Using the .no_mdep Directive
      4. 5.6.4 Using the .mdep Directive to Identify Specific Memory Dependencies
        1. 5.6.4.1 Annotating a Memory Reference
        2.       232
        3. 5.6.4.2 Software Pipeline Using .mdep ld1, st1
        4.       234
        5. 5.6.4.3 Software Pipeline Using .mdep st1, ld1 and .mdep ld1, st1
        6.       236
      5. 5.6.5 Memory Alias Examples
  7. Linking C/C++ Code
    1. 6.1 Invoking the Linker Through the Compiler (-z Option)
      1. 6.1.1 Invoking the Linker Separately
      2. 6.1.2 Invoking the Linker as Part of the Compile Step
      3. 6.1.3 Disabling the Linker (--compile_only Compiler Option)
    2. 6.2 Linker Code Optimizations
      1. 6.2.1 Conditional Linking
      2. 6.2.2 Generating Function Subsections (--gen_func_subsections Compiler Option)
      3. 6.2.3 Generating Aggregate Data Subsections (--gen_data_subsections Compiler Option)
    3. 6.3 Controlling the Linking Process
      1. 6.3.1 Including the Run-Time-Support Library
        1. 6.3.1.1 Automatic Run-Time-Support Library Selection
          1. 6.3.1.1.1 Using the --issue_remarks Option
        2. 6.3.1.2 Manual Run-Time-Support Library Selection
        3. 6.3.1.3 Library Order for Searching for Symbols
      2. 6.3.2 Run-Time Initialization
      3. 6.3.3 Global Object Constructors
      4. 6.3.4 Specifying the Type of Global Variable Initialization
      5. 6.3.5 Specifying Where to Allocate Sections in Memory
      6. 6.3.6 A Sample Linker Command File
  8. C/C++ Language Implementation
    1. 7.1  Characteristics of TMS320C6000 C
      1. 7.1.1 Implementation-Defined Behavior
    2. 7.2  Characteristics of TMS320C6000 C++
    3. 7.3  Data Types
      1. 7.3.1 Size of Enum Types
      2. 7.3.2 Vector Data Types
    4. 7.4  File Encodings and Character Sets
    5. 7.5  Keywords
      1. 7.5.1 The complex Keyword
      2. 7.5.2 The const Keyword
      3. 7.5.3 The __cregister Keyword
        1. 7.5.3.1 Define and Use Control Registers
      4. 7.5.4 The __interrupt Keyword
      5. 7.5.5 The __near and __far Keywords
        1. 7.5.5.1 Near and Far Data Objects
        2. 7.5.5.2 Near and Far Function Calls
      6. 7.5.6 The restrict Keyword
      7. 7.5.7 The volatile Keyword
    6. 7.6  C++ Exception Handling
    7. 7.7  Register Variables and Parameters
    8. 7.8  The __asm Statement
    9. 7.9  Pragma Directives
      1. 7.9.1  The CALLS Pragma
      2. 7.9.2  The CODE_ALIGN Pragma
      3. 7.9.3  The CODE_SECTION Pragma
      4. 7.9.4  The DATA_ALIGN Pragma
      5. 7.9.5  The DATA_MEM_BANK Pragma
        1. 7.9.5.1 Using the DATA_MEM_BANK Pragma
      6. 7.9.6  The DATA_SECTION Pragma
        1. 7.9.6.1 Using the DATA_SECTION Pragma C Source File
        2. 7.9.6.2 Using the DATA_SECTION Pragma C++ Source File
        3. 7.9.6.3 Using the DATA_SECTION Pragma Assembly Source File
      7. 7.9.7  The Diagnostic Message Pragmas
      8. 7.9.8  The FORCEINLINE Pragma
      9. 7.9.9  The FORCEINLINE_RECURSIVE Pragma
      10. 7.9.10 The FUNC_ALWAYS_INLINE Pragma
      11. 7.9.11 The FUNC_CANNOT_INLINE Pragma
      12. 7.9.12 The FUNC_EXT_CALLED Pragma
      13. 7.9.13 The FUNC_INTERRUPT_THRESHOLD Pragma
      14. 7.9.14 The FUNC_IS_PURE Pragma
      15. 7.9.15 The FUNC_IS_SYSTEM Pragma
      16. 7.9.16 The FUNC_NEVER_RETURNS Pragma
      17. 7.9.17 The FUNC_NO_GLOBAL_ASG Pragma
      18. 7.9.18 The FUNC_NO_IND_ASG Pragma
      19. 7.9.19 The FUNCTION_OPTIONS Pragma
      20. 7.9.20 The INTERRUPT Pragma
      21. 7.9.21 The LOCATION Pragma
      22. 7.9.22 The MUST_ITERATE Pragma
        1. 7.9.22.1 The MUST_ITERATE Pragma Syntax
        2. 7.9.22.2 Using MUST_ITERATE to Expand Compiler Knowledge of Loops
      23. 7.9.23 The NMI_INTERRUPT Pragma
      24. 7.9.24 The NOINIT and PERSISTENT Pragmas
      25. 7.9.25 The NOINLINE Pragma
      26. 7.9.26 The NO_HOOKS Pragma
      27. 7.9.27 The once Pragma
      28. 7.9.28 The pack Pragma
      29. 7.9.29 The PROB_ITERATE Pragma
      30. 7.9.30 The RETAIN Pragma
      31. 7.9.31 The SET_CODE_SECTION and SET_DATA_SECTION Pragmas
      32. 7.9.32 The STRUCT_ALIGN Pragma
      33. 7.9.33 The UNROLL Pragma
    10. 7.10 The _Pragma Operator
    11. 7.11 Application Binary Interface
    12. 7.12 Object File Symbol Naming Conventions (Linknames)
    13. 7.13 Changing the ANSI/ISO C/C++ Language Mode
      1. 7.13.1 C99 Support (--c99)
      2. 7.13.2 C11 Support (--c11)
      3. 7.13.3 Strict ANSI Mode and Relaxed ANSI Mode (--strict_ansi and --relaxed_ansi)
    14. 7.14 GNU and Clang Language Extensions
      1. 7.14.1 Extensions
      2. 7.14.2 Function Attributes
      3. 7.14.3 For Loop Attributes
      4. 7.14.4 Variable Attributes
      5. 7.14.5 Type Attributes
      6. 7.14.6 Built-In Functions
    15. 7.15 Operations and Functions for Vector Data Types
      1. 7.15.1 Vector Literals and Concatenation
      2. 7.15.2 Unary and Binary Operators for Vectors
      3. 7.15.3 Swizzle Operators for Vectors
      4. 7.15.4 Conversion Functions for Vectors
      5. 7.15.5 Re-Interpretation Functions for Vectors
      6. 7.15.6 Using printf() with Vectors
      7. 7.15.7 Built-In Vector Functions
  9. Run-Time Environment
    1. 8.1  Memory Model
      1. 8.1.1 Sections
      2. 8.1.2 C/C++ System Stack
      3. 8.1.3 Dynamic Memory Allocation
      4. 8.1.4 Data Memory Models
        1. 8.1.4.1 Determining the Data Address Model
        2. 8.1.4.2 DP-Relative Vs. Absolute Addressing
        3. 8.1.4.3 Const Objects as Far
      5. 8.1.5 Trampoline Generation for Function Calls
      6. 8.1.6 Position Independent Data
    2. 8.2  Object Representation
      1. 8.2.1 Data Type Storage
        1. 8.2.1.1 char and short Data Types (signed and unsigned)
        2. 8.2.1.2 enum, int, and long Data Types (signed and unsigned)
        3. 8.2.1.3 float Data Type
        4. 8.2.1.4 The __int40_t Data Type (signed and unsigned)
        5. 8.2.1.5 long long Data Types (signed and unsigned)
        6. 8.2.1.6 double and long double Data Types
        7. 8.2.1.7 Pointer to Data Member Types
        8. 8.2.1.8 Pointer to Member Function Types
        9. 8.2.1.9 Structures and Arrays
      2. 8.2.2 Bit Fields
      3. 8.2.3 Character String Constants
      4.      366
    3. 8.3  Register Conventions
    4. 8.4  Function Structure and Calling Conventions
      1. 8.4.1 How a Function Makes a Call
      2. 8.4.2 How a Called Function Responds
      3. 8.4.3 Accessing Arguments and Local Variables
    5. 8.5  Accessing Linker Symbols in C and C++
    6. 8.6  Interfacing C and C++ With Assembly Language
      1. 8.6.1  Using Assembly Language Modules With C/C++ Code
      2. 8.6.2  Accessing Assembly Language Functions From C/C++
        1. 8.6.2.1 Calling an Assembly Language Function From a C/C++ Program
        2. 8.6.2.2 Assembly Language Program Called by
        3.       378
      3. 8.6.3  Accessing Assembly Language Variables From C/C++
        1. 8.6.3.1 Accessing Assembly Language Global Variables
          1. 8.6.3.1.1 Assembly Language Variable Program
          2. 8.6.3.1.2 C Program to Access Assembly Language From
        2.       383
        3. 8.6.3.2 Accessing Assembly Language Constants
          1. 8.6.3.2.1 Accessing an Assembly Language Constant From C
          2. 8.6.3.2.2 Assembly Language Program for
          3.        387
      4. 8.6.4  Sharing C/C++ Header Files With Assembly Source
      5. 8.6.5  Using Inline Assembly Language
      6. 8.6.6  Using Intrinsics to Access Assembly Language Statements
      7. 8.6.7  The __x128_t Container Type
        1. 8.6.7.1 The __x128_t Container Type
        2.       393
      8. 8.6.8  The __float2_t Container Type
      9. 8.6.9  Using Intrinsics for Interrupt Control and Atomic Sections
      10. 8.6.10 Using Unaligned Data and 64-Bit Values
        1. 8.6.10.1 Using the _mem8 Intrinsic
      11. 8.6.11 Using MUST_ITERATE and _nassert to Enable SIMD and Expand Compiler Knowledge of Loops
      12. 8.6.12 Methods to Align Data
        1. 8.6.12.1 Base Address of an Array
        2. 8.6.12.2 Offset from the Base of an Array
        3. 8.6.12.3 Dynamic Memory Allocation
        4. 8.6.12.4 Member of a Structure or Class
          1. 8.6.12.4.1 An Array in a Structure
          2. 8.6.12.4.2 An Array in a Class
          3.        406
      13. 8.6.13 SAT Bit Side Effects
      14. 8.6.14 IRP and AMR Conventions
      15. 8.6.15 Floating Point and Saturation Control Register Side Effects
    7. 8.7  Interrupt Handling
      1. 8.7.1 Saving the SGIE Bit
      2. 8.7.2 Saving Registers During Interrupts
      3. 8.7.3 Using C/C++ Interrupt Routines
      4. 8.7.4 Using Assembly Language Interrupt Routines
    8. 8.8  Run-Time-Support Arithmetic Routines
    9. 8.9  System Initialization
      1. 8.9.1 Boot Hook Functions for System Pre-Initialization
      2. 8.9.2 Automatic Initialization of Variables
        1. 8.9.2.1 Zero Initializing Variables
        2. 8.9.2.2 Direct Initialization
        3. 8.9.2.3 Autoinitialization of Variables at Run Time
        4. 8.9.2.4 Autoinitialization Tables
          1. 8.9.2.4.1 Length Followed by Data Format
          2. 8.9.2.4.2 Zero Initialization Format
          3. 8.9.2.4.3 Run Length Encoded (RLE) Format
          4. 8.9.2.4.4 Lempel-Ziv-Storer-Szymanski Compression (LZSS) Format
          5. 8.9.2.4.5 Sample C Code to Process the C Autoinitialization Table
        5. 8.9.2.5 Initialization of Variables at Load Time
        6. 8.9.2.6 Global Constructors
    10. 8.10 Support for Multi-Threaded Applications
      1. 8.10.1 Compiling with OpenMP
      2. 8.10.2 Multi-Threading Runtime Support
        1. 8.10.2.1 Runtime Thread Safety
        2. 8.10.2.2 Thread Creation, Initialization, and Termination
        3. 8.10.2.3 Thread Local Storage (TLS)
        4. 8.10.2.4 Accessing Shared Data
  10. Using Run-Time-Support Functions and Building Libraries
    1. 9.1 C and C++ Run-Time Support Libraries
      1. 9.1.1 Linking Code With the Object Library
      2. 9.1.2 Header Files
      3. 9.1.3 Modifying a Library Function
      4. 9.1.4 Support for String Handling
      5. 9.1.5 Minimal Support for Internationalization
      6. 9.1.6 Support for Time and Clock Functions
      7. 9.1.7 Allowable Number of Open Files
      8. 9.1.8 Library Naming Conventions
    2. 9.2 The C I/O Functions
      1. 9.2.1 High-Level I/O Functions
        1. 9.2.1.1 Formatting and the Format Conversion Buffer
      2. 9.2.2 Overview of Low-Level I/O Implementation
        1.       open
        2.       close
        3.       read
        4.       write
        5.       lseek
        6.       unlink
        7.       rename
      3. 9.2.3 Device-Driver Level I/O Functions
        1.       DEV_open
        2.       DEV_close
        3.       DEV_read
        4.       DEV_write
        5.       DEV_lseek
        6.       DEV_unlink
        7.       DEV_rename
      4. 9.2.4 Adding a User-Defined Device Driver for C I/O
        1. 9.2.4.1 Mapping Default Streams to Device
      5. 9.2.5 The device Prefix
        1.       add_device
        2.       470
        3. 9.2.5.1 Program for C I/O Device
    3. 9.3 Handling Reentrancy (_register_lock() and _register_unlock() Functions)
    4. 9.4 Library-Build Process
      1. 9.4.1 Required Non-Texas Instruments Software
      2. 9.4.2 Using the Library-Build Process
        1. 9.4.2.1 Automatic Standard Library Rebuilding by the Linker
        2. 9.4.2.2 Invoking mklib Manually
          1. 9.4.2.2.1 Building Standard Libraries
          2. 9.4.2.2.2 Shared or Read-Only Library Directory
          3. 9.4.2.2.3 Building Libraries With Custom Options
          4. 9.4.2.2.4 The mklib Program Option Summary
      3. 9.4.3 Extending mklib
        1. 9.4.3.1 Underlying Mechanism
        2. 9.4.3.2 Libraries From Other Vendors
  11. 10C++ Name Demangler
    1. 10.1 Invoking the C++ Name Demangler
    2. 10.2 Sample Usage of the C++ Name Demangler
  12.   A Glossary
    1.     A.1 Terminology
  13.   B Revision History
  14.   491
  15.   492
  16.   B Earlier Revisions

Changing the Compiler's Behavior with Options

Options control the operation of the compiler. This section provides a description of option conventions and an option summary table. It also provides detailed descriptions of the most frequently used options, including options used for type-checking and assembling.

For a help screen summary of the options, enter cl6x with no parameters on the command line.

The following apply to the compiler options:

  • There are typically two ways of specifying a given option. The "long form" uses a two hyphen prefix and is usually a more descriptive name. The "short form" uses a single hyphen prefix and a combination of letters and numbers that are not always intuitive.
  • Options are usually case sensitive.
  • Individual options cannot be combined.
  • An option with a parameter should be specified with an equal sign before the parameter to clearly associate the parameter with the option. For example, the option to undefine a constant can be expressed as --undefine=name. Likewise, the option to specify the maximum amount of optimization can be expressed as -O=3. You can also specify a parameter directly after certain options, for example -O3 is the same as -O=3. No space is allowed between the option and the optional parameter, so -O 3 is not accepted.
  • Files and options except the --run_linker option can occur in any order. The --run_linker option must follow all compiler options and precede any linker options.

You can define default options for the compiler by using the C6X_C_OPTION environment variable. For a detailed description of the environment variable, see Section 3.4.1.

Table 3-1 through Table 3-28 summarize all options (including link options). Use the references in the tables for more complete descriptions of the options.

Table 3-1 Processor Options
Option Alias Effect Section
--silicon_version=id -mv Selects target version. Defaults to 6400+. The other supported options are 6600 and 6740. Section 3.3.5
--big_endian -me Produces object code in big-endian format. Section 3.3.4
Table 3-2 Optimization Options(1)
Option Alias Effect Section
--opt_level=off Disables all optimization (default). Section 4.1
--opt_level=n -On Level 0 (-O0) optimizes register usage only.
Level 1 (-O1) uses Level 0 optimizations and optimizes locally.
Level 2 (-O2) uses Level 1 optimizations and optimizes globally.
Level 3 (-O3) uses Level 2 optimizations and optimizes the file.
Section 4.1, Section 4.3
--opt_for_space=n -ms Controls code size on four levels (0, 1, 2, and 3). Section 4.9
--opt_for_speed[=n] -mf Controls the tradeoff between size and speed (0-5 range). If this option is not specified or is specified without n, the default value is 4. Section 4.2
Note: Machine-specific options (see Table 3-12) can also affect optimization.
Table 3-3 Advanced Optimization Options(1)
Option Alias Effect Section
--auto_inline=[size] -oi Sets automatic inlining size (--opt_level=3 only). If size is not specified, the default is 1. Section 4.5
--call_assumptions=n -opn Level 0 (-op0) specifies that the module contains functions and variables that are called or modified from outside the source code provided to the compiler.
Level 1 (-op1) specifies that the module contains variables modified from outside the source code provided to the compiler but does not use functions called from outside the source code.
Level 2 (-op2) specifies that the module contains no functions or variables that are called or modified from outside the source code provided to the compiler (default).
Level 3 (-op3) specifies that the module contains functions that are called from outside the source code provided to the compiler but does not use variables modified from outside the source code.
Section 4.4.1
--disable_inlining Prevents any inlining from occurring. Section 3.11
--fp_mode={relaxed|strict} Enables or disables relaxed floating-point mode. Section 3.3.3
--fp_reassoc={on|off} Enables or disables the reassociation of floating-point arithmetic. Section 3.3.3
--fp_single_precision_constant Causes all unsuffixed floating-point constants to be treated as single precision values instead of as double-precision constants. Section 3.3.3
--gen_opt_info=n -onn Level 0 (-on0) disables the optimization information file.
Level 1 (-on2) produces an optimization information file.
Level 2 (-on2) produces a verbose optimization information file.
Section 4.3.1
--optimizer_interlist -os Interlists optimizer comments with assembly statements. Section 4.16
--program_level_compile -pm Combines source files to perform program-level optimization. Section 4.4
--sat_reassoc={on|off} Enables or disables the reassociation of saturating arithmetic. Default is --sat_reassoc=off. Section 3.3.3
--aliased_variables -ma Notifies the compiler that addresses passed to functions may be modified by an alias in the called function. Section 4.12.1
Note: Machine-specific options (see Table 3-12) can also affect optimization.
Table 3-4 Debug Options
Option Alias Effect Section
--symdebug:dwarf -g Default behavior. Enables symbolic debugging. The generation of debug information does not impact optimization. Therefore, generating debug information is enabled by default. Section 3.3.6
Section 4.17
--symdebug:dwarf_version=2|3 Specifies the DWARF format version. Section 3.3.6
--symdebug:none Disables all symbolic debugging. Section 3.3.6
Section 4.17
--disable_push_pop Disables the code-size optimization that calls the RTS functions _push_rts() and _pop_rts(). You may want to use this option if you receive warnings about calls to RTS routines that are placed out of range of the calling location. --
--machine_regs Displays reg operands as machine registers in assembly code. Section 3.3.12
Table 3-5 Include Options
Option Alias Effect Section
--include_path=directory -I Adds the specified directory to the #include search path. Section 3.5.2.1
--preinclude=filename Includes filename at the beginning of compilation. Section 3.3.3
Table 3-6 Control Options
Option Alias Effect Section
--compile_only -c Disables linking (negates --run_linker). Section 6.1.3
--help -h Prints (on the standard output device) a description of the options understood by the compiler. Section 3.3.2
--run_linker -z Causes the linker to be invoked from the compiler command line. Section 3.3.2
--skip_assembler -n Compiles C/C++ source file or linear assembly source file, producing an assembly language output file. The assembler is not run and no object file is produced. Section 3.3.2
Table 3-7 Language Options
Option Alias Effect Section
--c89 Processes C files according to the ISO C89 standard. Section 7.13
--c99 Processes C files according to the ISO C99 standard. Section 7.13
--c11 Processes C files according to the ISO C11 standard. Section 7.13
--c++14 Processes C++ files according to the ISO C++14 standard.
The --c++03 option has been deprecated.
Section 7.13
--cpp_default -fg Processes all source files with a C extension as C++ source files. Section 3.3.8
--exceptions Enables C++ exception handling. Section 7.6
--extern_c_can_throw Allow extern C functions to propagate exceptions. --
--float_operations_allowed
={none|all|32|64}
Restricts the types of floating point operations allowed. Section 3.3.3
--gen_cross_reference_listing -px Generates a cross-reference listing file (.crl). Section 3.9
--multithread Inserts a build attribute into the compiler-generated object file that will cause the TI linker to choose a thread-safe version of the RTS library when auto-selecting an RTS library or resolving a reference to libc.a. Alternately, a linker option with the same name (--multithread) can be used to force the linker to choose a thread-safe version of the RTS library, even if none of the object files contain this build attribute. If you use the --openmp option, the --multithread option is enabled automatically. Section 8.10.2
--openmp --omp Enables support for OpenMP. Using this option automatically enables the --multithread option, which causes the TI linker to choose a thread-safe version of the RTS library when auto-selecting an RTS library or resolving a reference to libc.a. Section 8.10.1
--pending_instantiations=# Specify the number of template instantiations that may be in progress at any given time. Use 0 to specify an unlimited number. Section 3.3.4
--printf_support={nofloat|full|
minimal}
Enables support for smaller, limited versions of the printf function family (sprintf, fprintf, etc.) and the scanf function family (sscanf, fscanf, etc.) run-time-support functions. Section 3.3.3
--relaxed_ansi -pr Enables relaxed mode; ignores strict ISO violations. This is on by default. To disable this mode, use the --strict_ansi option. Section 7.13.3
--rtti -rtti Enables C++ run-time type information (RTTI). –-
--strict_ansi -ps Enables strict ANSI/ISO mode (for C/C++, not for K&R C). In this mode, language extensions that conflict with ANSI/ISO C/C++ are disabled. In strict ANSI/ISO mode, most ANSI/ISO violations are reported as errors. Violations that are considered discretionary may be reported as warnings instead. Section 7.13.3
--vectypes={on|off} Enable support for TI vector data types. Section 7.3.2
--wchar_t={32|16} Sets the size of the C/C++ type wchar_t. Default is 16 bits. Section 3.3.4
Table 3-8 Parser Preprocessing Options
Option Alias Effect Section
--preproc_dependency[=filename] -ppd Performs preprocessing only, but instead of writing preprocessed output, writes a list of dependency lines suitable for input to a standard make utility. Section 3.5.8
--preproc_includes[=filename] -ppi Performs preprocessing only, but instead of writing preprocessed output, writes a list of files included with the #include directive. Section 3.5.9
--preproc_macros[=filename] -ppm Performs preprocessing only. Writes list of predefined and user-defined macros to a file with the same name as the input but with a .pp extension. Section 3.5.10
--preproc_only -ppo Performs preprocessing only. Writes preprocessed output to a file with the same name as the input but with a .pp extension. Section 3.5.4
--preproc_with_comment -ppc Performs preprocessing only. Writes preprocessed output, keeping the comments, to a file with the same name as the input but with a .pp extension. Section 3.5.6
--preproc_with_compile -ppa Continues compilation after preprocessing with any of the -pp<x> options that normally disable compilation. Section 3.5.5
--preproc_with_line -ppl Performs preprocessing only. Writes preprocessed output with line-control information (#line directives) to a file with the same name as the input but with a .pp extension. Section 3.5.7
Table 3-9 Predefined Macro Options
Option Alias Effect Section
--define=name[=def] -D Predefines name. Section 3.3.2
--undefine=name -U Undefines name. Section 3.3.2
Table 3-10 Diagnostic Message Options
Option Alias Effect Section
--compiler_revision Prints out the compiler release revision and exits. --
--diag_error=num -pdse Categorizes the diagnostic identified by num as an error. Section 3.7.1
--diag_remark=num -pdsr Categorizes the diagnostic identified by num as a remark. Section 3.7.1
--diag_suppress=num -pds Suppresses the diagnostic identified by num. Section 3.7.1
--diag_warning=num -pdsw Categorizes the diagnostic identified by num as a warning. Section 3.7.1
--diag_wrap={on|off} Wrap diagnostic messages (default is on). Note that this command-line option cannot be used within the Code Composer Studio IDE.
--display_error_number -pden Displays a diagnostic's identifiers along with its text. Note that this command-line option cannot be used within the Code Composer Studio IDE. Section 3.7.1
--emit_warnings_as_errors -pdew Treat warnings as errors. Section 3.7.1
--issue_remarks -pdr Issues remarks (non-serious warnings). Section 3.7.1
--no_warnings -pdw Suppresses diagnostic warnings (errors are still issued). Section 3.7.1
--quiet -q Suppresses progress messages (quiet). --
--set_error_limit=num -pdel Sets the error limit to num. The compiler abandons compiling after this number of errors. (The default is 100.) Section 3.7.1
--super_quiet -qq Super quiet mode. --
--tool_version -version Displays version number for each tool. --
--verbose Display banner and function progress information. --
--verbose_diagnostics -pdv Provides verbose diagnostic messages that display the original source with line-wrap. Note that this command-line option cannot be used within the Code Composer Studio IDE. Section 3.7.1
--write_diagnostics_file -pdf Generates a diagnostic message information file. Compiler only option. Note that this command-line option cannot be used within the Code Composer Studio IDE. Section 3.7.1
Table 3-11 Supplemental Information Options
Option Alias Effect Section
--gen_preprocessor_listing -pl Generates a raw listing file (.rl). Section 3.10
--section_sizes={on|off} Generates section size information, including sizes for sections containing executable code and constants, constant or initialized data (global and static variables), and uninitialized data. (Default is off if this option is not included on the command line. Default is on if this option is used with no value specified.) Section 3.7.1
Table 3-12 Run-Time Model Options
Option Alias Effect Section
--assume_control_regs_read Assume the FP and SAT bits are read. Section 3.3.4
--common={on|off} On by default. When on, uninitialized file scope variables are emitted as common symbols. When off, common symbols are not created. Section 3.3.4
--debug_software_pipeline -mw Produce verbose software pipelining report. Section 4.6.2
--disable_software_pipeline -mu Turns off software pipelining. Section 4.6.1
--fp_not_associative -mc Prevents reordering of associative floating-point operations. Section 4.13
--gen_data_subsections={on|off} Place all aggregate data (arrays, structs, and unions) into subsections. This gives the linker more control over removing unused data during the final link step. See the link to the right for details about the default setting. Section 6.2.3
--gen_func_subsections={on|off} -mo Puts each function in a separate subsection in the object file. If this option is not used, the default is off. See the link to the right for details about the default setting. Section 6.2.2
--interrupt_threshold[=num] -mi Specifies an interrupt threshold value. Section 3.12
--mem_model:const=
    {far_aggregates|far|data}
Allows const objects to be made far independently of the --mem_model:data option. Section 8.1.4.3
--mem_model:data=
    {far_aggregates|near|far}
Determines data access model. Section 8.1.4.1
--no_bad_aliases -mt Allows certain assumptions about aliasing and loops. Section 4.12.2
--no_compress Prevents compression. --
--no_reload_errors Turns off all reload-related loop buffer error messages. --
--profile:breakpt Enables breakpoint-based profiling. Section 3.3.6
Section 4.17.1
--speculate_loads=n -mh Specifies speculative load byte count threshold. Allows speculative execution of loads with bounded address ranges. Section 4.6.3.1
--speculate_unknown_loads Allows speculative execution of loads with unbounded addresses. Section 3.3.4
--use_const_for_alias_analysis -ox Uses const to disambiguate pointers. Section 3.3.4
Table 3-13 Entry/Exit Hook Options
Option Alias Effect Section
--entry_hook[=name] Enables entry hooks. Section 3.16
--entry_parm={none|name|
address}
Specifies the parameters to the function to the --entry_hook option. Section 3.16
--exit_hook[=name] Enables exit hooks. Section 3.16
--exit_parm={none|name|address} Specifies the parameters to the function to the --exit_hook option. Section 3.16
--remove_hooks_when_inlining Removes entry/exit hooks for auto-inlined functions. Section 3.16
Table 3-14 Feedback Options
Option Alias Effect Section
--analyze={codecov|callgraph} Generate analysis info from profile data. Section 4.11.4.2
--analyze_only Only generate analysis. Section 4.11.4.2
--gen_profile_info Generates instrumentation code to collect profile information. Section 4.10.1.3
--use_profile_info=file1[, file2,...] Specifies the profile information file(s). Section 4.10.1.3
Table 3-15 Assembler Options
Option Alias Effect Section
--keep_asm -k Keeps the assembly language (.asm) file. Section 3.3.12
--asm_listing -al Generates an assembly listing file. Section 3.3.12
--c_src_interlist -ss Interlists C source and assembly statements. Section 3.13
Section 4.16
--src_interlist -s Interlists optimizer comments (if available) and assembly source statements; otherwise interlists C and assembly source statements. Section 3.3.2
--asm_cross_reference_listing -ax Generates the cross-reference file. Section 3.3.12
--asm_define=name[=def] -ad Sets the name symbol. Section 3.3.12
--asm_dependency -apd Performs preprocessing; lists only assembly dependencies. Section 3.3.12
--asm_includes -api Performs preprocessing; lists only included #include files. Section 3.3.12
--asm_undefine=name -au Undefines the predefined constant name. Section 3.3.12
--include_file=filename -ahi Includes the specified file for the assembly module. Section 3.3.12
--no_const_clink Stops generation of .clink directives for const global arrays. Section 3.3.3
--strip_coff_underscore Aids in transitioning hand-coded assembly from COFF to EABI. Section 3.3.12
Table 3-16 File Type Specifier Options
Option Alias Effect Section
--ap_file=filename -fl Identifies filename as a linear assembly source file regardless of its extension. By default, the compiler and assembly optimizer treat .sa files as linear assembly source files. Section 3.3.8
--asm_file=filename -fa Identifies filename as an assembly source file regardless of its extension. By default, the compiler and assembler treat .asm files as assembly source files. Section 3.3.8
--c_file=filename -fc Identifies filename as a C source file regardless of its extension. By default, the compiler treats .c files as C source files. Section 3.3.8
--cpp_file=filename -fp Identifies filename as a C++ file, regardless of its extension. By default, the compiler treats .C, .cpp, .cc and .cxx files as a C++ files. Section 3.3.8
--obj_file=filename -fo Identifies filename as an object code file regardless of its extension. By default, the compiler and linker treat .obj files as object code files, including both *.c.obj and *.cpp.obj files. Section 3.3.8
Table 3-17 Directory Specifier Options
Option Alias Effect Section
--asm_directory=directory -fs Specifies an assembly file directory. By default, the compiler uses the current directory. Section 3.3.11
--list_directory=directory -ff Specifies an assembly listing file and cross-reference listing file directory By default, the compiler uses the object file directory. Section 3.3.11
--obj_directory=directory -fr Specifies an object file directory. By default, the compiler uses the current directory. Section 3.3.11
--output_file=filename -fe Specifies a compilation output file name; can override --obj_directory. Section 3.3.11
--pp_directory=dir Specifies a preprocessor file directory. By default, the compiler uses the current directory. Section 3.3.11
--temp_directory=directory -ft Specifies a temporary file directory. By default, the compiler uses the current directory. Section 3.3.11
Table 3-18 Default File Extensions Options
Option Alias Effect Section
--ap_extension=[.]extension -el Sets a default extension for linear assembly source files. Section 3.3.10
--asm_extension=[.]extension -ea Sets a default extension for assembly source files. Section 3.3.10
--c_extension=[.]extension -ec Sets a default extension for C source files. Section 3.3.10
--cpp_extension=[.]extension -ep Sets a default extension for C++ source files. Section 3.3.10
--listing_extension=[.]extension -es Sets a default extension for listing files. Section 3.3.10
--obj_extension=[.]extension -eo Sets a default extension for object files. Section 3.3.10
Table 3-19 Command Files Options
Option Alias Effect Section
--cmd_file=filename -@ Interprets contents of a file as an extension to the command line. Multiple -@ instances can be used. Section 3.3.2
Table 3-20 Performance Advisor Options
Option Alias Effect Section
--advice:performance[={all|none}] Generates compiler optimization advice. Default is all. Section 3.14
--advice:performance_file={stdout|
    stderr|user_specified_filename}
Specifies that advice be written to stdout, stderr, or a file. Section 3.14
--advice:performance_dir=
    {user_specified_directory_name}
Specifies that advice file be created in the named directory. Section 3.14