在好例子网,分享、交流、成长!
您当前所在位置:首页Others 开发实例一般编程问题 → LLVM教程-Min-Yih Hsu - LLVM Techniques, Tips, and Best Practices_ Clang and Middle-End Libraries-Packt Publishing (2021)

LLVM教程-Min-Yih Hsu - LLVM Techniques, Tips, and Best Practices_ Clang and Middle-End Libraries-Packt Publishing (2021)

一般编程问题

下载此实例
  • 开发语言:Others
  • 实例大小:18.44M
  • 下载次数:6
  • 浏览次数:43
  • 发布时间:2022-10-13
  • 实例类别:一般编程问题
  • 发 布 人:会飞的小胖
  • 文件格式:.pdf
  • 所需积分:2
 相关标签: LLVM\

实例介绍

【实例简介】LLVM教程-Min-Yih Hsu - LLVM Techniques, Tips, and Best Practices_ Clang and Middle-End Libraries-Packt Publishing (2021)英文原版

【实例截图】

【核心代码】

Table of Contents
Preface
Section 1:
Build System and LLVM-Specific Tooling
1
Saving Resources When Building LLVM
Technical requirements   4
Cutting down building
resources with
better tooling   5
Replacing GNU Make with Ninja   5
Avoiding the use of the BFD linker   6
Tweaking CMake arguments   7
Choosing the right build type   7
Avoiding building all targets   8
Building as shared libraries   9
Splitting the debug info   9
Building an optimized version of llvm-
tblgen   10
Using the new PassManager and Clang  10
Using GN for a faster
turnaround time   11
Summary   13
Further reading   14
2
Exploring LLVM's Build System Features
Technical requirements   16
Exploring a glossary of LLVM's
important CMake directives   16
Using the CMake function to add new
libraries   16
Using the CMake function to add
executables and tools   20
Using the CMake function to add Pass
plugins   20
Understanding CMake
integration for
out-of-tree projects   21
Summary   24
ii Table of Contents
3
Testing with LLVM LIT
Technical requirements   26
Using LIT in out-of-tree projects  26
Preparing for our example project    27
Writing LIT configurations   29
LIT internals   32
Learning useful FileCheck tricks  34
Preparing for our example project   34
Writing FileCheck directives   36
Exploring the TestSuite
framework   42
Preparing for our example project   42
Importing code into llvm-test-suite   43
Summary   46
Further reading   46
4
TableGen Development
Technical requirements   48
Introduction to TableGen syntax  48
Layout and records   50
Bang operators   51
Multiclass   52
The DAG data type   53
Writing a donut recipe in
TableGen   55
Printing a recipe via the
TableGen backend   60
TableGen's high-level workflow   62
Writing the TableGen backend   63
Integrating the RecipePrinter TableGen
backend   67
Summary   70
Further reading   70
Section 2:
Frontend Development
5
Exploring Clang's Architecture
Technical requirements   74
Learning Clang's subsystems
and their roles   75
Driver   76
LLVM, assemblers, and linkers   80
Exploring Clang's tooling
features and extension options  81
Table of Contents iii
The FrontendAction class   81
Clang plugins   82
LibTooling and Clang Tools   83
Summary   85
Further reading   85
6
Extending the Preprocessor
Technical requirements   88
Working with SourceLocation
and SourceManager   89
Introducing SourceLocation   89
Introducing SourceManager   90
Learning preprocessor and
lexer essentials   91
Understanding the role of the
preprocessor and lexer in Clang   92
Understanding Token   93
Handling macros   97
Developing custom
preprocessor plugins and
callbacks   99
The project goal and preparation   100
Implementing a custom pragma
handler   103
Implementing custom preprocessor
callbacks   105
Summary   108
Exercises   109
7
Handling AST
Technical requirements   112
Learning about AST in Clang   113
In-memory structure of Clang AST   113
Types in Clang AST   116
ASTMatcher   118
Writing AST plugins   125
Project overview   125
Printing diagnostic messages   128
Creating the AST plugin   132
Summary   144
8
Working with Compiler Flags and Toolchains
Technical requirements   146
Understanding drivers and
toolchains in Clang   147
Adding custom driver flags   150
Project overview   150
Declaring custom driver flags   152
Translating custom driver flags   155
Passing flags to the frontend   161
iv Table of Contents
Adding a custom toolchain   163
Project overview   164
Creating the toolchain and adding a
custom
include path   167
Creating a custom assembling stage   170
Creating a custom linking stage   173
Verifying the custom toolchain   177
Summary   178
Exercises   179
Section 3:
"Middle-End" Development
9
Working with PassManager and AnalysisManager
Technical requirements   184
Writing an LLVM Pass for the
new PassManager   185
Project overview   186
Writing the StrictOpt Pass   189
Working with the new
AnalysisManager   196
Overview of the project   196
Writing the HaltAnalyzer Pass   198
Learning instrumentations in
the new PassManager   202
Printing Pass pipeline details   203
Printing changes to the IR after each
Pass   205
Bisecting the Pass pipeline   207
Summary   208
Questions   209
10
Processing LLVM IR
Technical requirements   212
Learning LLVM IR basics   213
Iterating different IR units   216
Iterating instructions   216
Iterating basic blocks   219
Iterating the call graph   224
Learning about GraphTraits   225
Working with values and
instructions   229
Understanding SSA   229
Working with values   232
Working with instructions   235
Working with loops   242
Learning about loop representation in
LLVM   243
Learning about loop infrastructure in
LLVM   247
Summary   254
Table of Contents v
11
Gearing Up with Support Utilities
Technical requirements   256
Printing diagnostic messages  257
Collecting statistics   260
Using the Statistic class   261
Using an optimization remark   264
Adding time measurements   272
Using the Timer class   273
Collecting the time trace   276
Error-handling utilities in LLVM  279
Introducing the Error class   280
Learning about the Expected
and ErrorOr classes   285
The Expected class   285
The ErrorOr class   287
Summary   289
12
Learning LLVM IR Instrumentation
Technical requirements   292
Developing a sanitizer   293
An example of using an address
sanitizer   293
Creating a loop counter sanitizer   296
Working with PGO   316
Introduction to instrumentation-based
PGO   317
Introduction to sampling-based PGO   318
Using profiling data analyses   329
Summary   334
Assessments
Other Books You May Enjoy
Index


标签: LLVM\

网友评论

发表评论

(您的评论需要经过审核才能显示)

查看所有0条评论>>

小贴士

感谢您为本站写下的评论,您的评论对其它用户来说具有重要的参考价值,所以请认真填写。

  • 类似“顶”、“沙发”之类没有营养的文字,对勤劳贡献的楼主来说是令人沮丧的反馈信息。
  • 相信您也不想看到一排文字/表情墙,所以请不要反馈意义不大的重复字符,也请尽量不要纯表情的回复。
  • 提问之前请再仔细看一遍楼主的说明,或许是您遗漏了。
  • 请勿到处挖坑绊人、招贴广告。既占空间让人厌烦,又没人会搭理,于人于己都无利。

关于好例子网

本站旨在为广大IT学习爱好者提供一个非营利性互相学习交流分享平台。本站所有资源都可以被免费获取学习研究。本站资源来自网友分享,对搜索内容的合法性不具有预见性、识别性、控制性,仅供学习研究,请务必在下载后24小时内给予删除,不得用于其他任何用途,否则后果自负。基于互联网的特殊性,平台无法对用户传输的作品、信息、内容的权属或合法性、安全性、合规性、真实性、科学性、完整权、有效性等进行实质审查;无论平台是否已进行审查,用户均应自行承担因其传输的作品、信息、内容而可能或已经产生的侵权或权属纠纷等法律责任。本站所有资源不代表本站的观点或立场,基于网友分享,根据中国法律《信息网络传播权保护条例》第二十二与二十三条之规定,若资源存在侵权或相关问题请联系本站客服人员,点此联系我们。关于更多版权及免责申明参见 版权及免责申明

;
报警