توضیحاتی در مورد کتاب Learn LLVM 12: A beginner's guide to learning LLVM compiler tools and core libraries with C++
نام کتاب : Learn LLVM 12: A beginner's guide to learning LLVM compiler tools and core libraries with C++
ویرایش : 1
عنوان ترجمه شده به فارسی : یادگیری LLVM 12: راهنمای مبتدی برای یادگیری ابزارهای کامپایلر LLVM و کتابخانه های هسته با C
سری :
نویسندگان : Kai Nacke
ناشر : Packt Publishing
سال نشر : 2021
تعداد صفحات : 393
ISBN (شابک) : 1839213507 , 9781839213502
زبان کتاب : English
فرمت کتاب : pdf
حجم کتاب : 3 مگابایت
بعد از تکمیل فرایند پرداخت لینک دانلود کتاب ارائه خواهد شد. درصورت ثبت نام و ورود به حساب کاربری خود قادر خواهید بود لیست کتاب های خریداری شده را مشاهده فرمایید.
فهرست مطالب :
Cover
Title Page
Copyright and Credits
Contributors
Table of Contents
Preface
Section 1 – The Basics of Compiler Construction with LLVM
Chapter 1: Installing LLVM
Getting the prerequisites ready
Ubuntu
Fedora and RedHat
FreeBSD
OS X
Windows
Configuring Git
Building with CMake
Cloning the repository
Creating a build directory
Generating the build system files
Customizing the build process
Variables defined by CMake
Variables defined by LLVM
Summary
Chapter 2: Touring the LLVM Source
Technical requirements
Contents of the LLVM mono repository
LLVM core libraries and additions
Compilers and tools
Runtime libraries
Layout of an LLVM project
Creating your own project using LLVM libraries
Creating the directory structure
Adding the CMake files
Adding the C++ source files
Compiling the tinylang application
Targeting a different CPU architecture
Summary
Chapter 3: Structure of a Compiler
Technical requirements
Building blocks of a compiler
An arithmetic expression language
Formalism for specifying the syntax of a programming language
How grammar helps the compiler writer
Lexical analysis
A handwritten lexer
Syntactical analysis
A handwritten parser
The abstract syntax tree
Semantic analysis
Generating code with the LLVM backend
Textual representation of the LLVM IR
Generating the IR from the AST
The missing pieces – the driver and the runtime library
Summary
Section 2 – From Source to Machine Code Generation
Chapter 4: Turning the Source File into an Abstract Syntax Tree
Technical requirements
Defining a real programming language
Creating the project layout
Managing source files and user messages
Structuring the lexer
Constructing a recursive descent parser
Generating a parser and lexer with bison and flex
Performing semantic analysis
Handling the scope of names
Using LLVM-style RTTI for the AST
Creating the semantic analyzer
Summary
Chapter 5: Basics of IR Code Generation
Technical requirements
Generating IR from the AST
Understanding the IR code
Knowing the load-and-store approach
Mapping the control flow to basic blocks
Using AST numbering to generate IR code in SSA form
Defining the data structure to hold values
Reading and writing values local to a basic block
Searching the predecessor blocks for a value
Optimizing the generated phi instructions
Sealing a block
Creating IR code for expressions
Emitting the IR code for a function
Controlling visibility with linkage and name mangling
Converting types from an AST description to LLVM types
Creating the LLVM IR function
Emitting the function body
Setting up the module and the driver
Wrapping everything in the code generator
Initializing the target machine class
Emitting assembler text and object code
Summary
Chapter 6: IR Generation for High-Level Language Constructs
Technical requirements
Working with arrays, structs, and pointers
Getting the application binary interface right
Creating IR code for classes and virtual functions
Implementing single inheritance
Extending single inheritance with interfaces
Adding support for multiple inheritance
Summary
Chapter 7: Advanced IR Generation
Technical requirements
Throwing and catching exceptions
Raising an exception
Catching an exception
Integrating the exception-handling code into the application
Generating metadata for type-based alias analysis
Understanding the need for additional metadata
Adding TBAA metadata to tinylang
Adding debug metadata
Understanding the general structure of debug metadata
Tracking variables and their values
Adding line numbers
Adding debug support to tinylang
Summary
Chapter 8: Optimizing IR
Technical requirements
Introducing the LLVM Pass manager
Implementing a Pass using the new Pass manager
Adding a Pass to the LLVM source tree
Adding a new Pass as a plugin
Adapting a Pass for use with the old Pass manager
Adding an optimization pipeline to your compiler
Creating an optimization pipeline with the new Pass manager
Extending the Pass pipeline
Summary
Section 3 – Taking LLVM to the Next Level
Chapter 9: Instruction Selection
Technical requirements
Understanding the LLVM target backend structure
Using MIR to test and debug the backend
How instruction selection works
Specifying the target description in the TableGen language
Instruction selection with the selection DAG
Fast instruction selection – FastISel
The new global instruction selection – GlobalISel
Supporting new machine instructions
Adding a new instruction to the assembler and code generation
Testing the new instruction
Summary
Chapter 10: JIT Compilation
Technical requirements
Getting an overview of LLVM\'s JIT implementation and use cases
Using JIT compilation for direct execution
Exploring the lli tool
Implementing our own JIT compiler with LLJIT
Building a JIT compiler class from scratch
Utilizing a JIT compiler for code evaluation
Identifying the language semantics
Summary
Chapter 11: Debugging Using LLVM Tools
Technical requirements
Instrumenting an application with sanitizers
Detecting memory access problems with the address sanitizer
Finding uninitialized memory access with the memory sanitizer
Pointing out data races with the thread sanitizer
Finding bugs with libFuzzer
Limitations and alternatives
Performance profiling with XRay
Checking the source with the Clang Static Analyzer
Adding a new checker to the Clang Static Analyzer
Creating your own Clang-based tool
Summary
Chapter 12: Create Your Own Backend
Technical requirements
Setting the stage for a new backend
Adding the new architecture to the Triple class
Extending the ELF file format definition in LLVM
Creating the target description
Implementing the top-level file of the target description
Adding the register definition
Defining the calling convention
Creating the scheduling model
Defining the instruction formats and the instruction information
Implementing the DAG instruction selection classes
Initializing the target machine
Adding the selection DAG implementation
Supporting target-specific operations
Configuring the target lowering
Generating assembler instructions
Emitting machine code
Adding support for disassembling
Piecing it all together
Summary
Other Books You May Enjoy
Index