
TMS320C28x Optimizing C/C++ Compiler v18.9.0.STS User's Guide Literature Number: SPRU514Q August 2001–Revised September 2018 Contents Preface....................................................................................................................................... 10 1 Introduction to the Software Development Tools.................................................................... 13 1.1 Software Development Tools Overview ................................................................................. 14 1.2 Compiler Interface.......................................................................................................... 15 1.3 ANSI/ISO Standard ........................................................................................................ 16 1.4 Output Files ................................................................................................................. 16 1.5 Utilities ....................................................................................................................... 16 2 Using the C/C++ Compiler ................................................................................................... 17 2.1 About the Compiler......................................................................................................... 18 2.2 Invoking the C/C++ Compiler ............................................................................................. 18 2.3 Changing the Compiler's Behavior with Options ....................................................................... 19 2.3.1 Linker Options ..................................................................................................... 26 2.3.2 Frequently Used Options......................................................................................... 28 2.3.3 Miscellaneous Useful Options ................................................................................... 29 2.3.4 Run-Time Model Options......................................................................................... 31 2.3.5 Symbolic Debugging and Profiling Options .................................................................... 34 2.3.6 Specifying Filenames ............................................................................................. 35 2.3.7 Changing How the Compiler Interprets Filenames ........................................................... 35 2.3.8 Changing How the Compiler Processes C Files .............................................................. 35 2.3.9 Changing How the Compiler Interprets and Names Extensions ............................................ 36 2.3.10 Specifying Directories............................................................................................ 36 2.3.11 Assembler Options............................................................................................... 36 2.3.12 Dynamic Linking.................................................................................................. 38 2.3.13 Deprecated Options.............................................................................................. 38 2.4 Controlling the Compiler Through Environment Variables............................................................ 39 2.4.1 Setting Default Compiler Options (C2000_C_OPTION) ..................................................... 39 2.4.2 Naming One or More Alternate Directories (C2000_C_DIR) ................................................ 40 2.5 Controlling the Preprocessor ............................................................................................. 40 2.5.1 Predefined Macro Names ........................................................................................ 41 2.5.2 The Search Path for #include Files ............................................................................. 42 2.5.3 Support for the #warning and #warn Directives ............................................................... 43 2.5.4 Generating a Preprocessed Listing File (--preproc_only Option) ........................................... 43 2.5.5 Continuing Compilation After Preprocessing (--preproc_with_compile Option) ........................... 43 2.5.6 Generating a Preprocessed Listing File with Comments (--preproc_with_comment Option) ........... 44 2.5.7 Generating Preprocessed Listing with Line-Control Details (--preproc_with_line Option) ............... 44 2.5.8 Generating Preprocessed Output for a Make Utility (--preproc_dependency Option) ................... 44 2.5.9 Generating a List of Files Included with #include (--preproc_includes Option) ........................... 44 2.5.10 Generating a List of Macros in a File (--preproc_macros Option) ......................................... 44 2.6 Passing Arguments to main()............................................................................................. 44 2.7 Understanding Diagnostic Messages.................................................................................... 45 2.7.1 Controlling Diagnostic Messages ............................................................................... 46 2.7.2 How You Can Use Diagnostic Suppression Options ......................................................... 47 2.8 Other Messages ............................................................................................................ 48 2.9 Generating Cross-Reference Listing Information (--gen_cross_reference Option)................................ 48 2.10 Generating a Raw Listing File (--gen_preprocessor_listing Option)................................................. 49 2 Contents SPRU514Q–August 2001–Revised September 2018 Submit Documentation Feedback Copyright © 2001–2018, Texas Instruments Incorporated www.ti.com 2.11 Using Inline Function Expansion ......................................................................................... 50 2.11.1 Inlining Intrinsic Operators ...................................................................................... 51 2.11.2 Inlining Restrictions .............................................................................................. 51 2.11.3 Unguarded Definition-Controlled Inlining...................................................................... 52 2.11.4 Guarded Inlining and the _INLINE Preprocessor Symbol .................................................. 52 2.12 Using Interlist ............................................................................................................... 54 2.13 About the Application Binary Interface .................................................................................. 55 2.14 Enabling Entry Hook and Exit Hook Functions......................................................................... 56 3 Optimizing Your Code......................................................................................................... 57 3.1 Invoking Optimization ...................................................................................................... 58 3.2 Controlling Code Size Versus Speed ................................................................................... 59 3.3 Performing File-Level Optimization (--opt_level=3 option)............................................................ 59 3.3.1 Creating an Optimization Information File (--gen_opt_info Option)......................................... 60 3.4 Program-Level Optimization (--program_level_compile and --opt_level=3 options)............................... 60 3.4.1 Controlling Program-Level Optimization (--call_assumptions Option)...................................... 61 3.4.2 Optimization Considerations When Mixing C/C++ and Assembly .......................................... 61 3.5 Automatic Inline Expansion (--auto_inline Option) ..................................................................... 62 3.6 Link-Time Optimization (--opt_level=4 Option) ......................................................................... 63 3.6.1 Option Handling ................................................................................................... 63 3.6.2 Incompatible Types ............................................................................................... 64 3.7 Using Feedback Directed Optimization.................................................................................. 64 3.7.1 Feedback Directed Optimization ................................................................................ 64 3.7.2 Profile Data Decoder.............................................................................................. 66 3.7.3 Feedback Directed Optimization API ........................................................................... 67 3.7.4 Feedback Directed Optimization Summary .................................................................... 67 3.8 Using Profile Information to Analyze Code Coverage ................................................................. 68 3.8.1 Code Coverage.................................................................................................... 68 3.8.2 Related Features and Capabilities .............................................................................. 69 3.9 Special Considerations When Using Optimization..................................................................... 70 3.9.1 Use Caution With asm Statements in Optimized Code ...................................................... 70 3.9.2 Use the Volatile Keyword for Necessary Memory Accesses ................................................ 70 3.10 Using
Details
-
File Typepdf
-
Upload Time-
-
Content LanguagesEnglish
-
Upload UserAnonymous/Not logged-in
-
File Pages214 Page
-
File Size-