Example: tourism industry

MSP430 Optimizing C/C++ Compiler v18.1.0

MSP430 Optimizing C/C++ Compiler User's Guide Literature Number: SLAU132R. January 2018. Contents Preface .. 9. 1 Introduction to the Software Development Tools .. 12. Software Development Tools Overview .. 13. Compiler Interface .. 15. ANSI/ISO Standard .. 15. Output Files .. 15. Utilities .. 16. 2 Using the C/C++ Compiler .. 17. About the 18. Invoking the C/C++ Compiler .. 18. Changing the Compiler 's Behavior with Options .. 19. Linker Options .. 26. Frequently Used Options .. 28. Miscellaneous Useful Options .. 29. Run-Time Model Options .. 31. Symbolic Debugging Options .. 34. Specifying Filenames .. 35. Changing How the Compiler Interprets Filenames .. 35. Changing How the Compiler Processes C Files .. 35. Changing How the Compiler Interprets and Names Extensions .. 36. Specifying 36. Assembler Options .. 37. Deprecated Options .. 38. Controlling the Compiler Through Environment Variables .. 38. Setting Default Compiler Options (MSP430_C_OPTION) .. 38. Naming One or More Alternate Directories (MSP430_C_DIR).

MSP430 Optimizing C/C++ Compiler v18.1.0.LTS User's Guide Literature Number: SLAU132R January 2018

Tags:

  Compiler

Information

Domain:

Source:

Link to this page:

Please notify us if you found a problem with this document:

Other abuse

Advertisement

Transcription of MSP430 Optimizing C/C++ Compiler v18.1.0

1 MSP430 Optimizing C/C++ Compiler User's Guide Literature Number: SLAU132R. January 2018. Contents Preface .. 9. 1 Introduction to the Software Development Tools .. 12. Software Development Tools Overview .. 13. Compiler Interface .. 15. ANSI/ISO Standard .. 15. Output Files .. 15. Utilities .. 16. 2 Using the C/C++ Compiler .. 17. About the 18. Invoking the C/C++ Compiler .. 18. Changing the Compiler 's Behavior with Options .. 19. Linker Options .. 26. Frequently Used Options .. 28. Miscellaneous Useful Options .. 29. Run-Time Model Options .. 31. Symbolic Debugging Options .. 34. Specifying Filenames .. 35. Changing How the Compiler Interprets Filenames .. 35. Changing How the Compiler Processes C Files .. 35. Changing How the Compiler Interprets and Names Extensions .. 36. Specifying 36. Assembler Options .. 37. Deprecated Options .. 38. Controlling the Compiler Through Environment Variables .. 38. Setting Default Compiler Options (MSP430_C_OPTION) .. 38. Naming One or More Alternate Directories (MSP430_C_DIR).

2 39. Controlling the Preprocessor .. 40. Predefined Macro Names .. 40. The Search Path for #include Files .. 41. Support for the #warning and #warn Directives .. 42. Generating a Preprocessed Listing File (--preproc_only Option) .. 42. Continuing Compilation After Preprocessing (--preproc_with_compile Option) .. 42. Generating a Preprocessed Listing File with Comments (--preproc_with_comment Option) .. 42. Generating Preprocessed Listing with Line-Control Details (--preproc_with_line Option) .. 43. Generating Preprocessed Output for a Make Utility (--preproc_dependency Option) .. 43. Generating a List of Files Included with #include (--preproc_includes Option) .. 43. Generating a List of Macros in a File (--preproc_macros Option) .. 43. Passing Arguments to main() .. 43. Understanding Diagnostic Messages .. 44. Controlling Diagnostic Messages .. 45. How You Can Use Diagnostic Suppression Options .. 46. Other Messages .. 47. Generating Cross-Reference Listing Information (--gen_cross_reference Option).

3 47. Generating a Raw Listing File (--gen_preprocessor_listing Option) .. 47. Using Inline Function Expansion .. 49. 2 Contents SLAU132R January 2018. Submit Documentation Feedback Copyright 2018, Texas Instruments Incorporated Inlining Intrinsic Operators .. 50. Inlining Restrictions .. 50. Using Interlist .. 51. Controlling Application Binary Interface .. 52. Enabling Entry Hook and Exit Hook Functions .. 53. 3 Optimizing Your Code .. 54. Invoking Optimization .. 55. Performing File-Level Optimization (--opt_level=3 option) .. 56. Creating an Optimization Information File (--gen_opt_info Option) .. 56. Program-Level Optimization (--program_level_compile and --opt_level=3 options) .. 56. Controlling Program-Level Optimization (--call_assumptions Option) .. 57. Optimization Considerations When Mixing C/C++ and Assembly .. 58. Link-Time Optimization (--opt_level=4 Option) .. 59. Option Handling .. 59. Incompatible Types .. 59. Using Feedback Directed 59. Feedback Directed Optimization.

4 60. Profile Data Decoder .. 62. Feedback Directed Optimization API .. 63. Feedback Directed Optimization Summary .. 63. Using Profile Information to Analyze Code Coverage .. 64. Code Coverage .. 64. Related Features and Capabilities .. 65. Accessing Aliased Variables in Optimized Code .. 66. Use Caution With asm Statements in Optimized Code .. 66. Automatic Inline Expansion (--auto_inline Option) .. 67. Using the Interlist Feature With Optimization .. 67. Debugging Optimized 69. Controlling Code Size Versus Speed .. 69. What Kind of Optimization Is Being Performed? .. 70. Cost-Based Register Allocation .. 70. Alias Disambiguation .. 70. Branch Optimizations and Control-Flow Simplification .. 71. Data Flow Optimizations .. 71. Expression Simplification .. 71. Inline Expansion of Functions .. 71. Function Symbol Aliasing .. 71. Induction Variables and Strength Reduction .. 72. Loop-Invariant Code Motion .. 72. Loop Rotation .. 72. Instruction Scheduling .. 72.

5 Tail Merging .. 72. Integer Division With Constant Divisor .. 72. 4 Linking C/C++ Code .. 73. Invoking the Linker Through the Compiler (-z Option) .. 74. Invoking the Linker Separately .. 74. Invoking the Linker as Part of the Compile Step .. 75. Disabling the Linker (--compile_only Compiler Option) .. 75. Linker Code Optimizations .. 76. Conditional Linking .. 76. Generating Aggregate Data Subsections (--gen_data_subsections Compiler Option) .. 76. Controlling the Linking Process .. 76. Including the Run-Time-Support Library .. 77. SLAU132R January 2018 Contents 3. Submit Documentation Feedback Copyright 2018, Texas Instruments Incorporated Run-Time Initialization .. 78. Initialization by the Interrupt Vector .. 78. Initialization of the FRAM Memory Protection Unit .. 78. Initialization of Cinit and Watchdog Timer Hold .. 78. Global Object Constructors .. 79. Specifying the Type of Global Variable Initialization .. 79. Specifying Where to Allocate Sections in Memory.

6 80. A Sample Linker Command File .. 81. 5 MSP430 C/C++ Language Implementation .. 82. Characteristics of MSP430 C .. 83. Implementation-Defined Behavior .. 83. Characteristics of MSP430 C++ .. 87. Using MISRA C 2004 .. 88. Using the ULP Advisor .. 89. Advice on Hardware 89. Data Types .. 90. Size of Enum Types .. 91. Keywords .. 91. The const 92. The __interrupt Keyword .. 92. The restrict Keyword .. 93. The volatile Keyword .. 94. C++ Exception 95. Register Variables and Parameters .. 95. The __asm Statement .. 96. Pragma Directives .. 97. The BIS_IE1_INTERRUPT .. 98. The CALLS Pragma .. 98. The CHECK_MISRA Pragma .. 99. The CHECK_ULP Pragma .. 99. The CLINK Pragma .. 99. The CODE_SECTION Pragma .. 100. The DATA_ALIGN Pragma .. 102. The DATA_SECTION Pragma .. 102. The Diagnostic Message Pragmas .. 103. The FUNC_ALWAYS_INLINE 103. The FUNC_CANNOT_INLINE Pragma .. 104. The FUNC_EXT_CALLED Pragma .. 104. The FUNC_IS_PURE Pragma .. 105. The FUNC_NEVER_RETURNS Pragma.

7 105. The FUNC_NO_GLOBAL_ASG Pragma .. 105. The FUNC_NO_IND_ASG Pragma .. 106. The FUNCTION_OPTIONS Pragma .. 106. The INTERRUPT 106. The LOCATION Pragma .. 107. The NOINIT and PERSISTENT Pragmas .. 108. The NO_HOOKS Pragma .. 109. The pack Pragma .. 109. The RESET_MISRA Pragma .. 110. The RESET_ULP Pragma .. 110. The RETAIN Pragma .. 110. The SET_CODE_SECTION and SET_DATA_SECTION Pragmas .. 111. The vector Pragma .. 112. 4 Contents SLAU132R January 2018. Submit Documentation Feedback Copyright 2018, Texas Instruments Incorporated The _Pragma Operator .. 113. Application Binary Interface .. 114. Object File Symbol Naming Conventions (Linknames) .. 114. Changing the ANSI/ISO C/C++ Language Mode .. 115. C99 Support (--c99) .. 115. Strict ANSI Mode and Relaxed ANSI Mode (--strict_ansi and --relaxed_ansi) .. 116. GNU and Clang Language Extensions .. 117. Extensions .. 117. Function Attributes .. 118. Variable Attributes .. 120. Type Attributes .. 120. Built-In Functions.

8 121. Compiler Limits .. 121. 6 Run-Time Environment .. 122. Memory Model .. 123. Code Memory Models .. 123. Data Memory 123. Support for Near Data .. 124. Sections .. 124. C/C++ Software Stack .. 125. Dynamic Memory Allocation .. 126. Object Representation .. 127. Data Type 127. Character String Constants .. 128. Register Conventions .. 129. Function Structure and Calling Conventions .. 130. How a Function Makes a Call .. 131. How a Called Function Responds .. 131. Accessing Arguments and Local 132. Accessing Linker Symbols in C and C++ .. 132. Interfacing C and C++ With Assembly Language .. 132. Using Assembly Language Modules With C/C++ Code .. 132. Accessing Assembly Language Functions From C/C++ .. 133. Accessing Assembly Language Variables From C/C++ .. 134. Sharing C/C++ Header Files With Assembly Source .. 135. Using Inline Assembly Language .. 135. Interrupt Handling .. 135. Saving Registers During Interrupts .. 135. Using C/C++ Interrupt Routines.

9 136. Using Assembly Language Interrupt Routines .. 136. Interrupt Vectors .. 136. Other Interrupt Information .. 136. Using Intrinsics to Access Assembly Language 137. MSP430 Intrinsics .. 137. Deprecated Intrinsics .. 138. The __delay_cycle Intrinsic .. 139. The __never_executed 139. System Initialization .. 141. Boot Hook Functions for System Pre-Initialization .. 141. Run-Time Stack .. 141. Automatic Initialization of Variables .. 142. Initialization Tables .. 146. Compiling for 20-Bit MSP430X Devices .. 148. SLAU132R January 2018 Contents 5. Submit Documentation Feedback Copyright 2018, Texas Instruments Incorporated 7 Using Run-Time-Support Functions and Building Libraries .. 149. C and C++ Run-Time Support Libraries .. 150. Linking Code With the Object Library .. 150. Header Files .. 150. Modifying a Library Function .. 150. Support for String 151. Minimal Support for Internationalization .. 151. Allowable Number of Open Files .. 151. Nonstandard Header Files in the Source Tree.

10 152. Library Naming Conventions .. 152. The C I/O Functions .. 153. High-Level I/O Functions .. 154. Overview of Low-Level I/O Implementation .. 155. Device-Driver Level I/O Functions .. 158. Adding a User-Defined Device Driver for C I/O .. 162. The device Prefix .. 163. Handling Reentrancy (_register_lock() and _register_unlock() Functions) .. 165. Library-Build 166. Required Non-Texas Instruments Software .. 166. Using the Library-Build Process .. 166. Extending mklib .. 169. 8 C++ Name Demangler .. 170. Invoking the C++ Name Demangler .. 171. C++ Name Demangler Options .. 171. Sample Usage of the C++ Name Demangler .. 171. A Glossary .. 173.. 173. Terminology B Revision History .. 178. Recent Revisions .. 178. 6 Contents SLAU132R January 2018. Submit Documentation Feedback Copyright 2018, Texas Instruments Incorporated List of Figures 1-1. MSP430 Software Development Flow .. 13. 6-1. Memory Layout of var .. 128. 6-2. Use of the Stack During a Function Call.


Related search queries