TMS320C6000 Optimizing Compiler V 7.3 User's Guide
Total Page:16
File Type:pdf, Size:1020Kb
TMS320C6000 Optimizing Compiler v 7.3 User's Guide Literature Number: SPRU187T July 2011 2 SPRU187T–July 2011 Submit Documentation Feedback Copyright © 2011, Texas Instruments Incorporated Contents Preface ...................................................................................................................................... 13 1 Introduction to the Software Development Tools ................................................................... 17 1.1 Software Development Tools Overview ................................................................................ 18 1.2 C/C++ Compiler Overview ................................................................................................ 19 1.2.1 ANSI/ISO Standard ............................................................................................... 19 1.2.2 Output Files ....................................................................................................... 20 1.2.3 Compiler Interface ................................................................................................ 20 1.2.4 Utilities ............................................................................................................. 20 2 Using the C/C++ Compiler .................................................................................................. 21 2.1 About the Compiler ........................................................................................................ 22 2.2 Invoking the C/C++ Compiler ............................................................................................ 22 2.3 Changing the Compiler's Behavior With Options ...................................................................... 23 2.3.1 Frequently Used Options ........................................................................................ 34 2.3.2 Miscellaneous Useful Options .................................................................................. 36 2.3.3 Run-Time Model Options ........................................................................................ 37 2.3.4 Selecting Target CPU Version (--silicon_version Option) ................................................... 38 2.3.5 Symbolic Debugging and Profiling Options ................................................................... 38 2.3.6 Specifying Filenames ............................................................................................ 40 2.3.7 Changing How the Compiler Interprets Filenames ........................................................... 40 2.3.8 Changing How the Compiler Processes C Files ............................................................. 41 2.3.9 Changing How the Compiler Interprets and Names Extensions ........................................... 41 2.3.10 Specifying Directories ........................................................................................... 41 2.3.11 Assembler Options .............................................................................................. 42 2.3.12 Dynamic Linking ................................................................................................. 43 2.3.13 Deprecated Options ............................................................................................. 44 2.4 Controlling the Compiler Through Environment Variables ........................................................... 44 2.4.1 Setting Default Compiler Options (C6X_C_OPTION) ....................................................... 44 2.4.2 Naming an Alternate Directory (C6X_C_DIR) ................................................................ 45 2.5 Precompiled Header Support ............................................................................................ 46 2.5.1 Automatic Precompiled Header ................................................................................. 46 2.5.2 Manual Precompiled Header .................................................................................... 46 2.5.3 Additional Precompiled Header Options ....................................................................... 46 2.6 Controlling the Preprocessor ............................................................................................. 47 2.6.1 Predefined Macro Names ....................................................................................... 47 2.6.2 The Search Path for #include Files ............................................................................ 48 2.6.3 Generating a Preprocessed Listing File (--preproc_only Option) .......................................... 49 2.6.4 Continuing Compilation After Preprocessing (--preproc_with_compile Option) .......................... 49 2.6.5 Generating a Preprocessed Listing File With Comments (--preproc_with_comment Option) .......... 49 2.6.6 Generating a Preprocessed Listing File With Line-Control Information (--preproc_with_line Option) ............................................................................................................. 49 2.6.7 Generating Preprocessed Output for a Make Utility (--preproc_dependency Option) ................... 50 2.6.8 Generating a List of Files Included With the #include Directive (--preproc_includes Option) .......... 50 2.6.9 Generating a List of Macros in a File (--preproc_macros Option) .......................................... 50 2.7 Understanding Diagnostic Messages ................................................................................... 50 2.7.1 Controlling Diagnostics .......................................................................................... 51 SPRU187T–July 2011 Contents 3 Submit Documentation Feedback Copyright © 2011, Texas Instruments Incorporated www.ti.com 2.7.2 How You Can Use Diagnostic Suppression Options ........................................................ 52 2.8 Other Messages ........................................................................................................... 53 2.9 Generating Cross-Reference Listing Information (--gen_acp_xref Option) ........................................ 53 2.10 Generating a Raw Listing File (--gen_acp_raw Option) .............................................................. 53 2.11 Using Inline Function Expansion ........................................................................................ 54 2.11.1 Inlining Intrinsic Operators ..................................................................................... 55 2.11.2 Automatic Inlining ................................................................................................ 55 2.11.3 Unguarded Definition-Controlled Inlining ..................................................................... 55 2.11.4 Guarded Inlining and the _INLINE Preprocessor Symbol .................................................. 55 2.11.5 Inlining Restrictions ............................................................................................. 57 2.12 Interrupt Flexibility Options (--interrupt_threshold Option) ........................................................... 57 2.13 Linking C6400 Code With C6200/C6700/Older C6400 Object Code ............................................... 58 2.14 Using Interlist ............................................................................................................... 58 2.15 Controlling Application Binary Interface ................................................................................ 60 2.16 Enabling Entry Hook and Exit Hook Functions ........................................................................ 61 3 Optimizing Your Code ........................................................................................................ 63 3.1 Invoking Optimization ..................................................................................................... 64 3.2 Optimizing Software Pipelining .......................................................................................... 65 3.2.1 Turn Off Software Pipelining (--disable_software_pipelining Option) ...................................... 66 3.2.2 Software Pipelining Information ................................................................................. 66 3.2.3 Collapsing Prologs and Epilogs for Improved Performance and Code Size .............................. 71 3.3 Redundant Loops .......................................................................................................... 74 3.4 Utilizing the Loop Buffer Using SPLOOP on C6400+, C6740, and C6600 ........................................ 75 3.5 Reducing Code Size (--opt_for_space (or -ms) Option) .............................................................. 75 3.6 Performing File-Level Optimization (--opt_level=3 option) ........................................................... 76 3.6.1 Controlling File-Level Optimization (--std_lib_func_def Options) ........................................... 76 3.6.2 Creating an Optimization Information File (--gen_opt_info Option) ........................................ 76 3.7 Performing Program-Level Optimization (--program_level_compile and --opt_level=3 options) ................ 77 3.7.1 Controlling Program-Level Optimization (--call_assumptions Option) ..................................... 77 3.7.2 Optimization Considerations When Mixing C/C++ and Assembly ......................................... 78 3.8 Using Feedback Directed Optimization ................................................................................. 79 3.8.1 Feedback Directed Optimization ..............................................................................