PRU Optimizing C/C++ Compiler User's Guide

PRU Optimizing C/C++ Compiler User's Guide

PRU Optimizing C/C++ Compiler v2.3 User's Guide Literature Number: SPRUHV7C July 2014–Revised July 2018 Contents Preface ........................................................................................................................................ 8 1 Introduction to the Software Development Tools.................................................................... 11 1.1 Software Development Tools Overview ................................................................................. 12 1.2 Compiler Interface.......................................................................................................... 13 1.3 ANSI/ISO Standard ........................................................................................................ 14 1.4 Output Files ................................................................................................................. 14 1.5 Utilities ....................................................................................................................... 14 2 Using the C/C++ Compiler ................................................................................................... 15 2.1 About the Compiler......................................................................................................... 16 2.2 Invoking the C/C++ Compiler ............................................................................................. 16 2.3 Changing the Compiler's Behavior with Options ....................................................................... 17 2.3.1 Linker Options ..................................................................................................... 23 2.3.2 Frequently Used Options......................................................................................... 25 2.3.3 Miscellaneous Useful Options ................................................................................... 26 2.3.4 Run-Time Model Options......................................................................................... 27 2.3.5 Symbolic Debugging Options .................................................................................... 28 2.3.6 Specifying Filenames ............................................................................................. 28 2.3.7 Changing How the Compiler Interprets Filenames ........................................................... 29 2.3.8 Changing How the Compiler Processes C Files .............................................................. 29 2.3.9 Changing How the Compiler Interprets and Names Extensions ............................................ 29 2.3.10 Specifying Directories............................................................................................ 30 2.3.11 Assembler Options............................................................................................... 30 2.4 Controlling the Compiler Through Environment Variables............................................................ 31 2.4.1 Setting Default Compiler Options (PRU_C_OPTION)........................................................ 31 2.4.2 Naming One or More Alternate Directories (PRU_C_OPTION)............................................. 31 2.5 Controlling the Preprocessor ............................................................................................. 32 2.5.1 Predefined Macro Names ........................................................................................ 32 2.5.2 The Search Path for #include Files ............................................................................. 33 2.5.3 Support for the #warning and #warn Directives ............................................................... 34 2.5.4 Generating a Preprocessed Listing File (--preproc_only Option) ........................................... 34 2.5.5 Continuing Compilation After Preprocessing (--preproc_with_compile Option) ........................... 34 2.5.6 Generating a Preprocessed Listing File with Comments (--preproc_with_comment Option) ........... 35 2.5.7 Generating Preprocessed Listing with Line-Control Details (--preproc_with_line Option) ............... 35 2.5.8 Generating Preprocessed Output for a Make Utility (--preproc_dependency Option) ................... 35 2.5.9 Generating a List of Files Included with #include (--preproc_includes Option) ........................... 35 2.5.10 Generating a List of Macros in a File (--preproc_macros Option) ......................................... 35 2.6 Passing Arguments to main()............................................................................................. 35 2.7 Understanding Diagnostic Messages.................................................................................... 36 2.7.1 Controlling Diagnostic Messages ............................................................................... 37 2.7.2 How You Can Use Diagnostic Suppression Options ......................................................... 38 2.8 Other Messages ............................................................................................................ 39 2.9 Generating Cross-Reference Listing Information (--gen_cross_reference Option)................................ 39 2.10 Generating a Raw Listing File (--gen_preprocessor_listing Option)................................................. 39 2.11 Using Inline Function Expansion ......................................................................................... 41 2.11.1 Inlining Intrinsic Operators ...................................................................................... 42 2 Contents SPRUHV7C–July 2014–Revised July 2018 Submit Documentation Feedback Copyright © 2014–2018, Texas Instruments Incorporated www.ti.com 2.11.2 Inlining Restrictions .............................................................................................. 42 2.12 Using Interlist ............................................................................................................... 43 2.13 Enabling Entry Hook and Exit Hook Functions......................................................................... 44 3 Optimizing Your Code......................................................................................................... 45 3.1 Invoking Optimization ...................................................................................................... 46 3.2 Controlling Code Size Versus Speed ................................................................................... 47 3.3 Performing File-Level Optimization (--opt_level=3 option)............................................................ 47 3.3.1 Creating an Optimization Information File (--gen_opt_info Option)......................................... 47 3.4 Program-Level Optimization (--program_level_compile and --opt_level=3 options)............................... 48 3.4.1 Controlling Program-Level Optimization (--call_assumptions Option)...................................... 49 3.4.2 Optimization Considerations When Mixing C/C++ and Assembly .......................................... 50 3.5 Automatic Inline Expansion (--auto_inline Option) ..................................................................... 51 3.6 Link-Time Optimization (--opt_level=4 Option) ......................................................................... 52 3.6.1 Option Handling ................................................................................................... 52 3.6.2 Incompatible Types ............................................................................................... 52 3.7 Accessing Aliased Variables in Optimized Code....................................................................... 53 3.8 Use Caution With asm Statements in Optimized Code ............................................................... 53 3.9 Using the Interlist Feature With Optimization........................................................................... 53 3.10 Debugging and Profiling Optimized Code............................................................................... 54 3.11 What Kind of Optimization Is Being Performed? ....................................................................... 54 3.11.1 Cost-Based Register Allocation ................................................................................ 55 3.11.2 Alias Disambiguation ............................................................................................ 55 3.11.3 Branch Optimizations and Control-Flow Simplification ...................................................... 55 3.11.4 Data Flow Optimizations ........................................................................................ 55 3.11.5 Expression Simplification........................................................................................ 56 3.11.6 Inline Expansion of Functions .................................................................................. 56 3.11.7 Function Symbol Aliasing ....................................................................................... 56 3.11.8 Induction Variables and Strength Reduction ................................................................. 56 3.11.9 Loop-Invariant Code Motion .................................................................................... 56 3.11.10 Loop Rotation ................................................................................................... 56 3.11.11 Instruction Scheduling.......................................................................................... 56 3.11.12

View Full Text

Details

  • File Type
    pdf
  • Upload Time
    -
  • Content Languages
    English
  • Upload User
    Anonymous/Not logged-in
  • File Pages
    153 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