Optimizations in C++ compilers

被引:0
|
作者
Godbolt M. [1 ]
机构
[1] Aquatic Capital, United States
来源
Queue | 2019年 / 17卷 / 05期
关键词
Codes (symbols) - C++ (programming language);
D O I
10.1145/3371595.3372264
中图分类号
学科分类号
摘要
Compilers are a necessary technology to turn high-level, easier-to-write code into efficient machine code for computers to execute. Their sophistication at doing this is often overlooked. You may spend a lot of time carefully considering algorithms and fighting error messages but perhaps not enough time looking at what compilers are capable of doing. This article introduces some compiler and code generation concepts, and then shines a torch over a few of the very impressive feats of transformation your compilers are doing for you, with some practical demonstrations of my favorite optimizations. I hope you'll gain an appreciation for what kinds of optimizations you can expect your compiler to do for you, and how you might explore the subject further. Most of all, you may learn to love looking at the assembly output and may learn to respect the quality of the engineering in your compilers. The examples shown here are in C or C++, which are the languages I've had the most experience with, but many of these optimizations are also available in other compiled languages. Indeed, the advent of front-end-agnostic compiler toolkits such as LLVM3 means most of these optimizations work in the exact same way in languages such as Rust, Swift, and D. Copyright © 2019 held by owner/author. Publication rights licensed to ACM.
引用
收藏
页码:69 / 100
页数:31
相关论文
共 50 条
  • [1] Loop optimizations in C and C++ compilers: an overview
    Kovacs, Reka
    Porkolab, Zoltan
    [J]. ANNALES MATHEMATICAE ET INFORMATICAE, 2020, 51 : 113 - 121
  • [2] Fuzzing Loop Optimizations in Compilers for C++ and Data-Parallel Languages
    Livinskii, Vsevolod
    Babokin, Dmitry
    Regehr, John
    [J]. PROCEEDINGS OF THE ACM ON PROGRAMMING LANGUAGES-PACMPL, 2023, 7 (PLDI):
  • [3] Examining C/C++ compilers
    Parker, Tim
    [J]. Dr. Dobb's Journal of Software Tools for Professional Programmer, 1995, 20 (09):
  • [4] Comparing C/C++ compilers
    Wilson, M
    [J]. DR DOBBS JOURNAL, 2003, 28 (10): : 16 - +
  • [5] EXAMINING C/C++ COMPILERS
    PARKER, T
    [J]. DR DOBBS JOURNAL, 1995, 20 (09): : 90 - &
  • [6] Optimizations in C plus plus Compilers
    Godbolt, Matt
    [J]. COMMUNICATIONS OF THE ACM, 2020, 63 (02) : 41 - 49
  • [7] C++ compilers & ISO conformance
    Malloy, BA
    Power, JF
    Gibbs, TH
    [J]. DR DOBBS JOURNAL, 2003, 28 (11): : 54 - +
  • [8] Programming guidelines for vectorizing C/C++ compilers
    Bik, Aart
    Girkar, Milind
    Grey, Paul
    Tian, Xinmin
    [J]. C/C++ Users Journal, 2003, 21 (02): : 30 - 31
  • [9] C++ - OF BOOKS, COMPILERS, AND A WINDOW OBJECT
    STEVENS, A
    [J]. DR DOBBS JOURNAL, 1989, 14 (09): : 121 - &
  • [10] Random Testing for C and C++ Compilers with YARPGen
    Livinskii, Vsevolod
    Babokin, Dmitry
    Regehr, John
    [J]. PROCEEDINGS OF THE ACM ON PROGRAMMING LANGUAGES-PACMPL, 2020, 4