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 条
  • [31] OPTIMIZING COMPILERS FOR C.
    Relph, Richard
    [J]. Dr. Dobb's journal of software tools for the professional programmer, 1987, 12 (08): : 42 - 47
  • [32] C++
    Koenig, Andrew
    Moo, Barbara E.
    [J]. JOOP - Journal of Object-Oriented Programming, 1999, 12 (01):
  • [33] C++
    Koenig, Andrew
    [J]. JOOP - Journal of Object-Oriented Programming, 1997, 10 (07):
  • [34] C-COMPILERS FOR MSDOS
    不详
    [J]. DR DOBBS JOURNAL, 1985, 10 (08): : 30 - &
  • [35] C++
    Koenig, Andrew
    [J]. JOOP - Journal of Object-Oriented Programming, 1998, 11 (02):
  • [36] Standard C/C++: Testing C++ library conformance
    Plauger, P.J.
    [J]. C/C++ Users Journal, 2000, 18 (04):
  • [37] C++
    [J]. JOOP - Journal of Object-Oriented Programming, 1998, 10 (09):
  • [38] C++
    Koenig, Andrew
    [J]. 1998, (11):
  • [39] C++ for ...
    Stevens, A
    [J]. DR DOBBS JOURNAL, 1999, 24 (08): : 99 - 101
  • [40] C++
    [J]. JOOP J Object Oriented Program, 3 (71):