MSP430 Optimizing C/C++ Compiler V17.6.0.STS User's Guide

Total Page:16

File Type:pdf, Size:1020Kb

MSP430 Optimizing C/C++ Compiler V17.6.0.STS User's Guide MSP430 Optimizing C/C++ Compiler v17.6.0.STS User's Guide Literature Number: SLAU132P June 2017 Contents Preface ........................................................................................................................................ 9 1 Introduction to the Software Development Tools.................................................................... 12 1.1 Software Development Tools Overview ................................................................................. 13 1.2 Compiler Interface.......................................................................................................... 15 1.3 ANSI/ISO Standard ........................................................................................................ 15 1.4 Output Files ................................................................................................................. 15 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 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............................................................................................... 37 2.3.12 Deprecated Options.............................................................................................. 38 2.4 Controlling the Compiler Through Environment Variables............................................................ 38 2.4.1 Setting Default Compiler Options (MSP430_C_OPTION) ................................................... 38 2.4.2 Naming One or More Alternate Directories (MSP430_C_DIR).............................................. 39 2.5 Controlling the Preprocessor ............................................................................................. 40 2.5.1 Predefined Macro Names ........................................................................................ 40 2.5.2 The Search Path for #include Files ............................................................................. 41 2.5.3 Support for the #warning and #warn Directives ............................................................... 42 2.5.4 Generating a Preprocessed Listing File (--preproc_only Option) ........................................... 42 2.5.5 Continuing Compilation After Preprocessing (--preproc_with_compile Option) ........................... 42 2.5.6 Generating a Preprocessed Listing File with Comments (--preproc_with_comment Option) ........... 42 2.5.7 Generating Preprocessed Listing with Line-Control Details (--preproc_with_line Option) ............... 43 2.5.8 Generating Preprocessed Output for a Make Utility (--preproc_dependency Option) ................... 43 2.5.9 Generating a List of Files Included with #include (--preproc_includes Option) ........................... 43 2.5.10 Generating a List of Macros in a File (--preproc_macros Option) ......................................... 43 2.6 Passing Arguments to main()............................................................................................. 43 2.7 Understanding Diagnostic Messages.................................................................................... 44 2.7.1 Controlling Diagnostic Messages ............................................................................... 45 2.7.2 How You Can Use Diagnostic Suppression Options ......................................................... 46 2.8 Other Messages ............................................................................................................ 47 2.9 Generating Cross-Reference Listing Information (--gen_cross_reference Option)................................ 47 2.10 Generating a Raw Listing File (--gen_preprocessor_listing Option)................................................. 47 2.11 Using Inline Function Expansion ......................................................................................... 49 2 Contents SLAU132P–June 2017 Submit Documentation Feedback Copyright © 2017, Texas Instruments Incorporated www.ti.com 2.11.1 Inlining Intrinsic Operators ...................................................................................... 50 2.11.2 Inlining Restrictions .............................................................................................. 50 2.12 Using Interlist ............................................................................................................... 51 2.13 Controlling Application Binary Interface ................................................................................. 52 2.14 Enabling Entry Hook and Exit Hook Functions......................................................................... 53 3 Optimizing Your Code......................................................................................................... 54 3.1 Invoking Optimization ...................................................................................................... 55 3.2 Performing File-Level Optimization (--opt_level=3 option)............................................................ 56 3.2.1 Creating an Optimization Information File (--gen_opt_info Option)......................................... 56 3.3 Program-Level Optimization (--program_level_compile and --opt_level=3 options)............................... 56 3.3.1 Controlling Program-Level Optimization (--call_assumptions Option)...................................... 57 3.3.2 Optimization Considerations When Mixing C/C++ and Assembly .......................................... 58 3.4 Link-Time Optimization (--opt_level=4 Option) ......................................................................... 59 3.4.1 Option Handling ................................................................................................... 59 3.4.2 Incompatible Types ............................................................................................... 59 3.5 Using Feedback Directed Optimization.................................................................................. 59 3.5.1 Feedback Directed Optimization ................................................................................ 60 3.5.2 Profile Data Decoder.............................................................................................. 62 3.5.3 Feedback Directed Optimization API ........................................................................... 63 3.5.4 Feedback Directed Optimization Summary .................................................................... 63 3.6 Using Profile Information to Analyze Code Coverage ................................................................. 64 3.6.1 Code Coverage.................................................................................................... 64 3.6.2 Related Features and Capabilities .............................................................................. 65 3.7 Accessing Aliased Variables in Optimized Code....................................................................... 66 3.8 Use Caution With asm Statements in Optimized Code ............................................................... 66 3.9 Automatic Inline Expansion (--auto_inline Option) ..................................................................... 67 3.10 Using the Interlist Feature With Optimization........................................................................... 67 3.11 Debugging Optimized Code............................................................................................... 69 3.12 Controlling Code Size Versus Speed ................................................................................... 69 3.13 What Kind of Optimization Is Being Performed? ....................................................................... 70 3.13.1 Cost-Based Register Allocation ................................................................................ 70 3.13.2 Alias Disambiguation
Recommended publications
  • TASKING VX-Toolset for Tricore User Guide
    TASKING VX-toolset for TriCore User Guide MA160-800 (v6.1) September 14, 2016 Copyright © 2016 Altium Limited. All rights reserved.You are permitted to print this document provided that (1) the use of such is for personal use only and will not be copied or posted on any network computer or broadcast in any media, and (2) no modifications of the document is made. Unauthorized duplication, in whole or part, of this document by any means, mechanical or electronic, including translation into another language, except for brief excerpts in published reviews, is prohibited without the express written permission of Altium Limited. Unauthorized duplication of this work may also be prohibited by local statute. Violators may be subject to both criminal and civil penalties, including fines and/or imprisonment. Altium®, TASKING®, and their respective logos are registered trademarks of Altium Limited or its subsidiaries. All other registered or unregistered trademarks referenced herein are the property of their respective owners and no trademark rights to the same are claimed. Table of Contents 1. C Language .................................................................................................................. 1 1.1. Data Types ......................................................................................................... 1 1.1.1. Half Precision Floating-Point ....................................................................... 3 1.1.2. Fractional Types .......................................................................................
    [Show full text]
  • XL C/C++: Language Reference About This Document
    IBM XL C/C++ for Linux, V16.1.1 IBM Language Reference Version 16.1.1 SC27-8045-01 IBM XL C/C++ for Linux, V16.1.1 IBM Language Reference Version 16.1.1 SC27-8045-01 Note Before using this information and the product it supports, read the information in “Notices” on page 63. First edition This edition applies to IBM XL C/C++ for Linux, V16.1.1 (Program 5765-J13, 5725-C73) and to all subsequent releases and modifications until otherwise indicated in new editions. Make sure you are using the correct edition for the level of the product. © Copyright IBM Corporation 1998, 2018. US Government Users Restricted Rights – Use, duplication or disclosure restricted by GSA ADP Schedule Contract with IBM Corp. Contents About this document ......... v Chapter 4. IBM extension features ... 11 Who should read this document........ v IBM extension features for both C and C++.... 11 How to use this document.......... v General IBM extensions ......... 11 How this document is organized ....... v Extensions for GNU C compatibility ..... 15 Conventions .............. v Extensions for vector processing support ... 47 Related information ........... viii IBM extension features for C only ....... 56 Available help information ........ ix Extensions for GNU C compatibility ..... 56 Standards and specifications ........ x Extensions for vector processing support ... 58 Technical support ............ xi IBM extension features for C++ only ...... 59 How to send your comments ........ xi Extensions for C99 compatibility ...... 59 Extensions for C11 compatibility ...... 59 Chapter 1. Standards and specifications 1 Extensions for GNU C++ compatibility .... 60 Chapter 2. Language levels and Notices .............. 63 language extensions ......... 3 Trademarks .............
    [Show full text]
  • CS 110 Discussion 15 Programming with SIMD Intrinsics
    CS 110 Discussion 15 Programming with SIMD Intrinsics Yanjie Song School of Information Science and Technology May 7, 2020 Yanjie Song (S.I.S.T.) CS 110 Discussion 15 2020.05.07 1 / 21 Table of Contents 1 Introduction on Intrinsics 2 Compiler and SIMD Intrinsics 3 Intel(R) SDE 4 Application: Horizontal sum in vector Yanjie Song (S.I.S.T.) CS 110 Discussion 15 2020.05.07 2 / 21 Table of Contents 1 Introduction on Intrinsics 2 Compiler and SIMD Intrinsics 3 Intel(R) SDE 4 Application: Horizontal sum in vector Yanjie Song (S.I.S.T.) CS 110 Discussion 15 2020.05.07 3 / 21 Introduction on Intrinsics Definition In computer software, in compiler theory, an intrinsic function (or builtin function) is a function (subroutine) available for use in a given programming language whose implementation is handled specially by the compiler. Yanjie Song (S.I.S.T.) CS 110 Discussion 15 2020.05.07 4 / 21 Intrinsics in C/C++ Compilers for C and C++, of Microsoft, Intel, and the GNU Compiler Collection (GCC) implement intrinsics that map directly to the x86 single instruction, multiple data (SIMD) instructions (MMX, Streaming SIMD Extensions (SSE), SSE2, SSE3, SSSE3, SSE4). Yanjie Song (S.I.S.T.) CS 110 Discussion 15 2020.05.07 5 / 21 x86 SIMD instruction set extensions MMX (1996, 64 bits) 3DNow! (1998) Streaming SIMD Extensions (SSE, 1999, 128 bits) SSE2 (2001) SSE3 (2004) SSSE3 (2006) SSE4 (2006) Advanced Vector eXtensions (AVX, 2008, 256 bits) AVX2 (2013) F16C (2009) XOP (2009) FMA FMA4 (2011) FMA3 (2012) AVX-512 (2015, 512 bits) Yanjie Song (S.I.S.T.) CS 110 Discussion 15 2020.05.07 6 / 21 SIMD extensions in other ISAs There are SIMD instructions for other ISAs as well, e.g.
    [Show full text]
  • PGI Compilers
    USER'S GUIDE FOR X86-64 CPUS Version 2019 TABLE OF CONTENTS Preface............................................................................................................ xii Audience Description......................................................................................... xii Compatibility and Conformance to Standards............................................................xii Organization................................................................................................... xiii Hardware and Software Constraints.......................................................................xiv Conventions.................................................................................................... xiv Terms............................................................................................................ xv Related Publications.........................................................................................xvii Chapter 1. Getting Started.....................................................................................1 1.1. Overview................................................................................................... 1 1.2. Creating an Example..................................................................................... 2 1.3. Invoking the Command-level PGI Compilers......................................................... 2 1.3.1. Command-line Syntax...............................................................................2 1.3.2. Command-line Options............................................................................
    [Show full text]
  • Intel Hardware Intrinsics in .NET Core
    Han Lee, Intel Corporation [email protected] Notices and Disclaimers No license (express or implied, by estoppel or otherwise) to any intellectual property rights is granted by this document. Intel disclaims all express and implied warranties, including without limitation, the implied warranties of merchantability, fitness for a particular purpose, and non-infringement, as well as any warranty arising from course of performance, course of dealing, or usage in trade. This document contains information on products, services and/or processes in development. All information provided here is subject to change without notice. Contact your Intel representative to obtain the latest forecast, schedule, specifications and roadmaps. Intel technologies’ features and benefits depend on system configuration and may require enabled hardware, software or service activation. Learn more at intel.com, or from the OEM or retailer. The products and services described may contain defects or errors known as errata which may cause deviations from published specifications. Current characterized errata are available on request. No product or component can be absolutely secure. Copies of documents which have an order number and are referenced in this document may be obtained by calling 1-800-548- 4725 or by visiting www.intel.com/design/literature.htm. Intel, the Intel logo, and other Intel product and solution names in this presentation are trademarks of Intel *Other names and brands may be claimed as the property of others © Intel Corporation. 2 What Do These Have in Common? Domain Example Image processing Color extraction High performance computing (HPC) Matrix multiplication Data processing Hamming code Text processing UTF-8 conversion Data structures Bit array Machine learning Classification For performance sensitive code, consider using Intel® hardware intrinsics 3 Objectives .
    [Show full text]
  • Optimizing Subroutines in Assembly Language an Optimization Guide for X86 Platforms
    2. Optimizing subroutines in assembly language An optimization guide for x86 platforms By Agner Fog. Copenhagen University College of Engineering. Copyright © 1996 - 2012. Last updated 2012-02-29. Contents 1 Introduction ....................................................................................................................... 4 1.1 Reasons for using assembly code .............................................................................. 5 1.2 Reasons for not using assembly code ........................................................................ 5 1.3 Microprocessors covered by this manual .................................................................... 6 1.4 Operating systems covered by this manual................................................................. 7 2 Before you start................................................................................................................. 7 2.1 Things to decide before you start programming .......................................................... 7 2.2 Make a test strategy.................................................................................................... 9 2.3 Common coding pitfalls............................................................................................. 10 3 The basics of assembly coding........................................................................................ 12 3.1 Assemblers available ................................................................................................ 12 3.2 Register set
    [Show full text]
  • Automatic SIMD Vectorization of Fast Fourier Transforms for the Larrabee and AVX Instruction Sets
    Automatic SIMD Vectorization of Fast Fourier Transforms for the Larrabee and AVX Instruction Sets Daniel S. McFarlin Volodymyr Arbatov Franz Franchetti Department of Electrical and Department of Electrical and Department of Electrical and Computer Engineering Computer Engineering Computer Engineering Carnegie Mellon University Carnegie Mellon University Carnegie Mellon University Pittsburgh, PA USA 15213 Pittsburgh, PA USA 15213 Pittsburgh, PA USA 15213 [email protected] [email protected] [email protected] Markus Püschel Department of Computer Science ETH Zurich 8092 Zurich, Switzerland [email protected] ABSTRACT General Terms The well-known shift to parallelism in CPUs is often associated Performance with multicores. However another trend is equally salient: the increasing parallelism in per-core single-instruction multiple-date Keywords (SIMD) vector units. Intel’s SSE and IBM’s VMX (compatible to Autovectorization, super-optimization, SIMD, program generation, AltiVec) both offer 4-way (single precision) floating point, but the Fourier transform recent Intel instruction sets AVX and Larrabee (LRB) offer 8-way and 16-way, respectively. Compilation and optimization for vector extensions is hard, and often the achievable speed-up by using vec- 1. Introduction torizing compilers is small compared to hand-optimization using Power and area constraints are increasingly dictating microar- intrinsic function interfaces. Unfortunately, the complexity of these chitectural developments in the commodity and high-performance intrinsics interfaces increases considerably with the vector length, (HPC) CPU space. Consequently, the once dominant approach of making hand-optimization a nightmare. In this paper, we present a dynamically extracting instruction-level parallelism (ILP) through peephole-based vectorization system that takes as input the vector monolithic out-of-order microarchitectures is being supplanted by instruction semantics and outputs a library of basic data reorgani- designs with simpler, replicable architectural features.
    [Show full text]
  • Micro Focus Visual COBOL 6.0 for Visual Studio
    Micro Focus Visual COBOL 6.0 for Visual Studio Release Notes Micro Focus The Lawn 22-30 Old Bath Road Newbury, Berkshire RG14 1QN UK http://www.microfocus.com © Copyright 2020 Micro Focus or one of its affiliates. MICRO FOCUS, the Micro Focus logo and Visual COBOL are trademarks or registered trademarks of Micro Focus or one of its affiliates. All other marks are the property of their respective owners. 2020-06-16 ii Contents Micro Focus Visual COBOL 6.0 for Visual Studio Release Notes ..................5 What's New ......................................................................................................... 6 .NET Core ........................................................................................................................... 6 COBOL Application Console Size .......................................................................................6 COBOL Language Enhancements ......................................................................................6 Code Analysis ..................................................................................................................... 7 Code Analyzer Refactoring ................................................................................................. 7 Compiler Directives ............................................................................................................. 7 Containers ...........................................................................................................................8 Database Access - DB2 ECM ............................................................................................
    [Show full text]
  • Chapter 1 Basic Principles of Programming Languages
    Chapter 1 Basic Principles of Programming Languages Although there exist many programming languages, the differences among them are insignificant compared to the differences among natural languages. In this chapter, we discuss the common aspects shared among different programming languages. These aspects include: programming paradigms that define how computation is expressed; the main features of programming languages and their impact on the performance of programs written in the languages; a brief review of the history and development of programming languages; the lexical, syntactic, and semantic structures of programming languages, data and data types, program processing and preprocessing, and the life cycles of program development. At the end of the chapter, you should have learned: what programming paradigms are; an overview of different programming languages and the background knowledge of these languages; the structures of programming languages and how programming languages are defined at the syntactic level; data types, strong versus weak checking; the relationship between language features and their performances; the processing and preprocessing of programming languages, compilation versus interpretation, and different execution models of macros, procedures, and inline procedures; the steps used for program development: requirement, specification, design, implementation, testing, and the correctness proof of programs. The chapter is organized as follows. Section 1.1 introduces the programming paradigms, performance, features, and the development of programming languages. Section 1.2 outlines the structures and design issues of programming languages. Section 1.3 discusses the typing systems, including types of variables, type equivalence, type conversion, and type checking during the compilation. Section 1.4 presents the preprocessing and processing of programming languages, including macro processing, interpretation, and compilation.
    [Show full text]
  • TASKING VX-Toolset for Tricore User Guide
    TASKING VX-toolset for TriCore User Guide MA160-800 (v3.0) November 29, 2007 TASKING VX-toolset for TriCore User Guide Copyright © 2007 Altium Limited. All rights reserved.You are permitted to print this document provided that (1) the use of such is for personal use only and will not be copied or posted on any network computer or broadcast in any media, and (2) no modifications of the document is made. Unauthorized duplication, in whole or part, of this document by any means, mechanical or electronic, including translation into another language, except for brief excerpts in published reviews, is prohibited without the express written permission of Altium Limited. Unauthorized duplication of this work may also be prohibited by local statute. Violators may be subject to both criminal and civil penalties, including fines and/or imprisonment. Altium, TASKING, and their respective logos are trademarks or registered trademarks of Altium Limited or its subsidiaries. All other registered or unregistered trademarks referenced herein are the property of their respective owners and no trademark rights to the same are claimed. Table of Contents 1. C Language .................................................................................................................. 1 1.1. Data Types ......................................................................................................... 1 1.1.1. Bit Data Type ........................................................................................... 2 1.1.2. Fractional Types .......................................................................................
    [Show full text]
  • C Inline Function Declaration
    C Inline Function Declaration Bifold Wendel commeasuring no obstructionist twills reductively after Filbert swarm starkly, quite hoodless. Is Carter in-flight integrally.when Tobit bows whence? Untreatable Pinchas always derogates his existentialists if Irvine is didactical or enwraps In c function calls to Such an inline functions have? After shaking up more efficient code for in a piece of course. Square with a separate translation unit tests for library routines will be a warning about embedded system will handle makes your feedback! You define it can cause gcc knows this must not allowed as well as error? This can be grouped into single version per our website in that follow my last thing as inline function will know whether a unique address. What should always using msvc does not. New in special considerations are an error at runtime sometimes the body is. Template definition separate inputs are usually look what code in multiple compilation unit or help icon above applies here, i still does not clobber specific or not. No solution is forced inline function in multiple calls in more. Different product topic content on one translation unit shall be remain, but they are. Even if anonymous namespace as a called in macro looks at runtime or static storage for optimization than a new in. Here is only differ from the correct definition? The compiler to store values from somewhere, be very easy to print an error by its class names. It is benign, but this register declaration syntax for this is evaluated until this? If required on this is undefined reference its address explicitly initialize local symbol type, and reference or am wrong? Two numbers or contact your content for decomissioning so why it saves a string concatenation takes a license.
    [Show full text]
  • Aggressive Inlining
    Aggressive Inlining Andrew Ayers Robert Gottlieb Richard Schooler Hewlett-Packard Massachusetts Language Laboratory 300 Apollo Drive Chelmsford, MA 01824 e-mail: {ayers,gottlieb,schooler}@ch.hp.com Abstract by the procedure call boundary can be applied straight- forwardly to the combined code of caller and cake with Existing research understates the benefits that can be little or no loss of precision. As a side benefit, the run obtained from inlining and cloning, especially when time cost of a procedure call is also eliminated. Another guided by profile information. Our implementation of common technique for exploiting interprocedural infor- inlining and cloning yields excellent results on average mation is cloning: the duplication of a &lee so that its and very rarely lowers performance. We believe our body may be specialized for the circumstances existing good results can be explained by a number of factors: at a particular call site or set of call sites. inlining at the intermediate-code level removes most Mining is often considered to be a brute-force ap- technical restrictions on what can be inlined; the ability proach to interprocedural optimization. Since many to inline across files and incorporate profile information global optimizations are not linear time or linear space, enables us to choose better inline candidates; a high- and since instruction caches are of fixed capacity, the quality back end can exploit the scheduling and regis- code expansion caused by inlining is cause for some con- ter allocation opportunities presented by larger subrou- cern. Interprocedural analysis is usually proposed as a tines; an aggressive processor architecture benefits from more tractable alternative to inlining with less drastic more predictable branch behavior; and a large instruc- resource costs.
    [Show full text]