Tms320c55x Optimizing C/C++ Compiler User's Guide (Rev. G)

Tms320c55x Optimizing C/C++ Compiler User's Guide (Rev. G)

TMS320C55x Optimizing C/C++ Compiler v 4.4 User's Guide Literature Number: SPRU281G December 2011 2 SPRU281G–December 2011 Submit Documentation Feedback Copyright © 2011, Texas Instruments Incorporated Contents Preface ...................................................................................................................................... 11 1 Introduction to the Software Development Tools ................................................................... 15 1.1 Software Development Tools Overview ................................................................................ 16 1.2 C/C++ Compiler Overview ................................................................................................ 17 1.2.1 ANSI/ISO Standard ............................................................................................... 17 1.2.2 Output Files ....................................................................................................... 18 1.2.3 Compiler Interface ................................................................................................ 18 1.2.4 Utilities ............................................................................................................. 18 2 Using the C/C++ Compiler .................................................................................................. 19 2.1 About the Compiler ........................................................................................................ 20 2.2 Invoking the C/C++ Compiler ............................................................................................ 20 2.3 Changing the Compiler's Behavior With Options ...................................................................... 21 2.3.1 Frequently Used Options ........................................................................................ 30 2.3.2 Miscellaneous Useful Options .................................................................................. 31 2.3.3 Run-Time Model Options ........................................................................................ 32 2.3.4 Selecting the Device Version (--silicon_version Option) .................................................... 34 2.3.5 Symbolic Debugging and Profiling Options ................................................................... 35 2.3.6 Specifying Filenames ............................................................................................ 36 2.3.7 Changing How the Compiler Interprets Filenames ........................................................... 36 2.3.8 Changing How the Compiler Processes C Files ............................................................. 36 2.3.9 Changing How the Compiler Interprets and Names Extensions ........................................... 37 2.3.10 Specifying Directories ........................................................................................... 37 2.3.11 Assembler Options .............................................................................................. 38 2.3.12 Deprecated Options ............................................................................................. 39 2.4 Controlling the Compiler Through Environment Variables ........................................................... 40 2.4.1 Setting Default Compiler Options (C55X_C_OPTION) ...................................................... 40 2.4.2 Naming an Alternate Directory (C55X_C_DIR) ............................................................... 41 2.5 Controlling the Preprocessor ............................................................................................. 41 2.5.1 Predefined Macro Names ....................................................................................... 41 2.5.2 The Search Path for #include Files ............................................................................ 42 2.5.3 Generating a Preprocessed Listing File (--preproc_only Option) .......................................... 43 2.5.4 Continuing Compilation After Preprocessing (--preproc_with_compile Option) .......................... 44 2.5.5 Generating a Preprocessed Listing File With Comments (--preproc_with_comment Option) .......... 44 2.5.6 Generating a Preprocessed Listing File With Line-Control Information (--preproc_with_line Option) ............................................................................................................. 44 2.5.7 Generating Preprocessed Output for a Make Utility (--preproc_dependency Option) ................... 44 2.5.8 Generating a List of Files Included With the #include Directive (--preproc_includes Option) .......... 44 2.5.9 Generating a List of Macros in a File (--preproc_macros Option) .......................................... 44 2.6 Understanding Diagnostic Messages ................................................................................... 44 2.6.1 Controlling Diagnostics .......................................................................................... 46 2.6.2 How You Can Use Diagnostic Suppression Options ........................................................ 46 2.7 Other Messages ........................................................................................................... 47 2.8 Generating Cross-Reference Listing Information (--gen_acp_xref Option) ........................................ 47 2.9 Generating a Raw Listing File (--gen_acp_raw Option) .............................................................. 48 2.10 Using Inline Function Expansion ........................................................................................ 49 SPRU281G–December 2011 Contents 3 Submit Documentation Feedback Copyright © 2011, Texas Instruments Incorporated www.ti.com 2.10.1 Inlining Intrinsic Operators ..................................................................................... 49 2.10.2 Unguarded Definition-Controlled Inlining ..................................................................... 49 2.10.3 Guarded Inlining and the _INLINE Preprocessor Symbol .................................................. 50 2.10.4 Inlining Restrictions ............................................................................................. 52 2.11 Using Interlist ............................................................................................................... 53 2.12 Enabling Entry Hook and Exit Hook Functions ........................................................................ 54 3 Optimizing Your Code ........................................................................................................ 55 3.1 Invoking Optimization ..................................................................................................... 56 3.2 Performing File-Level Optimization (--opt_level=3 option) ........................................................... 57 3.2.1 Controlling File-Level Optimization (--std_lib_func_def Options) ........................................... 57 3.2.2 Creating an Optimization Information File (--gen_opt_info Option) ........................................ 57 3.3 Performing Program-Level Optimization (--program_level_compile and --opt_level=3 options) ................ 58 3.3.1 Controlling Program-Level Optimization (--call_assumptions Option) ..................................... 58 3.3.2 Optimization Considerations When Mixing C/C++ and Assembly ......................................... 59 3.4 Indicating Whether Certain Aliasing Techniques Are Used .......................................................... 60 3.4.1 Use the --aliased_variables Option When Certain Aliases are Used ...................................... 60 3.4.2 Use the --no_bad_aliases Option to Indicate That These Techniques Are Not Used ................... 61 3.5 Use Caution With asm Statements in Optimized Code .............................................................. 62 3.6 Automatic Inline Expansion (--auto_inline Option) .................................................................... 62 3.7 Using the Interlist Feature With Optimization .......................................................................... 63 3.8 Debugging and Profiling Optimized Code .............................................................................. 64 3.8.1 Debugging Optimized Code (--symdebug:dwarf, --symdebug:coff, and --opt_level Options) .......... 64 3.8.2 Profiling Optimized Code ........................................................................................ 64 3.9 Controlling Code Size Versus Speed ................................................................................... 65 3.10 What Kind of Optimization Is Being Performed? ...................................................................... 66 3.10.1 Cost-Based Register Allocation ............................................................................... 66 3.10.2 Alias Disambiguation ............................................................................................ 66 3.10.3 Branch Optimizations and Control-Flow Simplification ..................................................... 67 3.10.4 Data Flow Optimizations ........................................................................................ 67 3.10.5 Expression Simplification ....................................................................................... 67 3.10.6 Inline Expansion of Functions ................................................................................. 67 3.10.7 Function Symbol Aliasing .....................................................................................

View Full Text

Details

  • File Type
    pdf
  • Upload Time
    -
  • Content Languages
    English
  • Upload User
    Anonymous/Not logged-in
  • File Pages
    181 Page
  • File Size
    -

Download

Channel Download Status
Express Download Enable

Copyright

We respect the copyrights and intellectual property rights of all users. All uploaded documents are either original works of the uploader or authorized works of the rightful owners.

  • Not to be reproduced or distributed without explicit permission.
  • Not used for commercial purposes outside of approved use cases.
  • Not used to infringe on the rights of the original creators.
  • If you believe any content infringes your copyright, please contact us immediately.

Support

For help with questions, suggestions, or problems, please contact us