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 条
  • [41] C++
    [J]. JOOP J Object Oriented Program, 6 (85):
  • [42] HP C++/SOFTBENCH - A DEVELOPMENT ENVIRONMENT FOR C++
    ARMISTEAD, M
    BURNHAM, J
    [J]. JOURNAL OF OBJECT-ORIENTED PROGRAMMING, 1990, 3 (04): : 82 - &
  • [43] Stepping up to C++: Understanding C++ declarations
    Saks, Dan
    [J]. C/C++ Users Journal, 1995, 13 (12):
  • [44] PAIRING C AND C++
    RANSOM, JF
    [J]. DR DOBBS JOURNAL, 1994, 19 (04): : 10 - 10
  • [45] C/C++ TEST
    王卫东
    [J]. 电子科技, 2001, (19) : 38 - 38
  • [46] C and C++: Siblings
    Stroustrup, Bjarne
    [J]. C/C++ Users Journal, 2002, 20 (07):
  • [47] Reasoning About C Concurrency and Compilers
    Nardelli, Francesco Zappa
    [J]. TESTS AND PROOFS, TAP 2015, 2015, 9154
  • [48] Finding and Understanding Bugs in C Compilers
    Yang, Xuejun
    Chen, Yang
    Eide, Eric
    Regehr, John
    [J]. PLDI 11: PROCEEDINGS OF THE 2011 ACM CONFERENCE ON PROGRAMMING LANGUAGE DESIGN AND IMPLEMENTATION, 2011, : 283 - 294
  • [49] 5 C-COMPILERS FOR THE MAC
    GARDNER, DJ
    [J]. BYTE, 1986, 11 (02): : 287 - 287
  • [50] DEVELOPING C++ NLMS - WALKING THE NDS TREE - IN C++
    CAVE, WD
    [J]. DR DOBBS JOURNAL, 1995, 20 (08): : 90 - &