TMS320C6000 Optimizing Compiler V8.2.X User's Guide (Rev. B)
Total Page:16
File Type:pdf, Size:1020Kb
TMS320C6000 Optimizing Compiler v8.2.x User's Guide Literature Number: SPRUI04B May 2017 Contents Preface....................................................................................................................................... 11 1 Introduction to the Software Development Tools.................................................................... 14 1.1 Software Development Tools Overview ................................................................................. 15 1.2 Compiler Interface.......................................................................................................... 16 1.3 ANSI/ISO Standard ........................................................................................................ 16 1.4 Output Files ................................................................................................................. 17 1.5 Utilities ....................................................................................................................... 17 2 Getting Started with the Code Generation Tools .................................................................... 18 2.1 How Code Composer Studio Projects Use the Compiler ............................................................. 18 2.2 Compiling from the Command Line ..................................................................................... 19 3 Using the C/C++ Compiler ................................................................................................... 20 3.1 About the Compiler......................................................................................................... 21 3.2 Invoking the C/C++ Compiler ............................................................................................. 21 3.3 Changing the Compiler's Behavior with Options ....................................................................... 22 3.3.1 Linker Options ..................................................................................................... 29 3.3.2 Frequently Used Options......................................................................................... 31 3.3.3 Miscellaneous Useful Options ................................................................................... 33 3.3.4 Run-Time Model Options......................................................................................... 35 3.3.5 Selecting Target CPU Version (--silicon_version Option).................................................... 36 3.3.6 Symbolic Debugging and Profiling Options .................................................................... 36 3.3.7 Specifying Filenames ............................................................................................. 37 3.3.8 Changing How the Compiler Interprets Filenames ........................................................... 37 3.3.9 Changing How the Compiler Processes C Files .............................................................. 38 3.3.10 Changing How the Compiler Interprets and Names Extensions ........................................... 38 3.3.11 Specifying Directories............................................................................................ 38 3.3.12 Assembler Options............................................................................................... 39 3.3.13 Dynamic Linking.................................................................................................. 40 3.4 Controlling the Compiler Through Environment Variables............................................................ 41 3.4.1 Setting Default Compiler Options (C6X_C_OPTION) ........................................................ 41 3.4.2 Naming One or More Alternate Directories (C6X_C_DIR)................................................... 42 3.5 Controlling the Preprocessor ............................................................................................. 43 3.5.1 Predefined Macro Names ........................................................................................ 43 3.5.2 The Search Path for #include Files ............................................................................. 44 3.5.3 Support for the #warning and #warn Directives ............................................................... 45 3.5.4 Generating a Preprocessed Listing File (--preproc_only Option) ........................................... 45 3.5.5 Continuing Compilation After Preprocessing (--preproc_with_compile Option) ........................... 45 3.5.6 Generating a Preprocessed Listing File with Comments (--preproc_with_comment Option) ........... 45 3.5.7 Generating Preprocessed Listing with Line-Control Details (--preproc_with_line Option) ............... 46 3.5.8 Generating Preprocessed Output for a Make Utility (--preproc_dependency Option) ................... 46 3.5.9 Generating a List of Files Included with #include (--preproc_includes Option) ........................... 46 3.5.10 Generating a List of Macros in a File (--preproc_macros Option) ......................................... 46 3.6 Passing Arguments to main()............................................................................................. 46 3.7 Understanding Diagnostic Messages.................................................................................... 47 3.7.1 Controlling Diagnostic Messages ............................................................................... 48 3.7.2 How You Can Use Diagnostic Suppression Options ......................................................... 49 2 Contents SPRUI04B–May 2017 Submit Documentation Feedback Copyright © 2017, Texas Instruments Incorporated www.ti.com 3.8 Other Messages ............................................................................................................ 50 3.9 Generating Cross-Reference Listing Information (--gen_cross_reference Option)................................ 50 3.10 Generating a Raw Listing File (--gen_preprocessor_listing Option)................................................. 50 3.11 Using Inline Function Expansion ......................................................................................... 52 3.11.1 Inlining Intrinsic Operators ...................................................................................... 53 3.11.2 Automatic Inlining ................................................................................................ 53 3.11.3 Unguarded Definition-Controlled Inlining...................................................................... 53 3.11.4 Guarded Inlining and the _INLINE Preprocessor Symbol .................................................. 53 3.11.5 Inlining Restrictions .............................................................................................. 55 3.12 Interrupt Flexibility Options (--interrupt_threshold Option) ............................................................ 56 3.13 Using Interlist ............................................................................................................... 57 3.14 Generating and Using Performance Advice ............................................................................ 58 3.15 About the Application Binary Interface .................................................................................. 58 3.16 Enabling Entry Hook and Exit Hook Functions......................................................................... 59 4 Optimizing Your Code......................................................................................................... 60 4.1 Invoking Optimization ...................................................................................................... 61 4.2 Optimizing Software Pipelining ........................................................................................... 62 4.2.1 Turn Off Software Pipelining (--disable_software_pipelining Option)....................................... 63 4.2.2 Software Pipelining Information ................................................................................. 63 4.2.3 Collapsing Prologs and Epilogs for Improved Performance and Code Size .............................. 68 4.3 Redundant Loops .......................................................................................................... 69 4.4 Utilizing the Loop Buffer Using SPLOOP ............................................................................... 70 4.5 Reducing Code Size (--opt_for_space (or -ms) Option) .............................................................. 71 4.6 Performing File-Level Optimization (--opt_level=3 option)............................................................ 71 4.6.1 Creating an Optimization Information File (--gen_opt_info Option)......................................... 71 4.7 Program-Level Optimization (--program_level_compile and --opt_level=3 options)............................... 72 4.7.1 Controlling Program-Level Optimization (--call_assumptions Option)...................................... 72 4.7.2 Optimization Considerations When Mixing C/C++ and Assembly .......................................... 73 4.8 Using Feedback Directed Optimization.................................................................................. 75 4.8.1 Feedback Directed Optimization ................................................................................ 75 4.8.2 Profile Data Decoder.............................................................................................. 77 4.8.3 Feedback Directed Optimization API ..........................................................................