Learn LLVM 17 - Second Edition: A beginner's guide to learning LLVM compiler tools and core libraries with C++

Nacke, Kai, Kwan, Amy

  • 出版商: Packt Publishing
  • 出版日期: 2024-01-12
  • 售價: $1,880
  • 貴賓價: 9.5$1,786
  • 語言: 英文
  • 頁數: 416
  • 裝訂: Quality Paper - also called trade paper
  • ISBN: 1837631344
  • ISBN-13: 9781837631346
  • 相關分類: C++ 程式語言Compiler
  • 立即出貨

買這商品的人也買了...

商品描述

Learn how to build and use the complete spectrum of real-world compilers, including the frontend, optimization pipeline, and a new backend by leveraging the power of LLVM core libraries

Key Features

  • Get to grips with using LLVM libraries step by step
  • Understand the high-level design of LLVM compilers and apply these principles to your own compiler
  • Add a new backend to target an unsupported CPU architecture
  • Purchase of the print or Kindle book includes a free PDF eBook

Book Description

LLVM was built to bridge the gap between the theoretical knowledge found in compiler textbooks and the practical demands of compiler development. With a modular codebase and advanced tools, LLVM empowers developers to build compilers with ease. This book serves as a practical introduction to LLVM, guiding you progressively through complex scenarios and ensuring that you navigate the challenges of building and working with compilers like a pro.

The book starts by showing you how to configure, build, and install LLVM libraries, tools, and external projects. You'll then be introduced to LLVM's design, unraveling its applications in each compiler stage: frontend, optimizer, and backend. Using a real programming language subset, you'll build a frontend, generate LLVM IR, optimize it through the pipeline, and generate machine code. Advanced chapters extend your expertise, covering topics such as extending LLVM with a new pass, using LLVM tools for debugging, and enhancing the quality of your code. You'll also focus on just-in-time compilation issues and the current state of JIT-compilation support with LLVM. Finally, you'll develop a new backend for LLVM, gaining insights into target description and how instruction selection works.

By the end of this book, you'll have hands-on experience with the LLVM compiler development framework through real-world examples and source code snippets.

What you will learn

  • Configure, compile, and install the LLVM framework
  • Understand how the LLVM source is organized
  • Discover what you need to do to use LLVM in your own projects
  • Explore how a compiler is structured, and implement a tiny compiler
  • Generate LLVM IR for common source language constructs
  • Set up an optimization pipeline and tailor it for your own needs
  • Extend LLVM with transformation passes and clang tooling
  • Add new machine instructions and a complete backend

Who this book is for

This book is for compiler developers, enthusiasts, and engineers new to LLVM. C++ software engineers looking to use compiler-based tools for code analysis and improvement, as well as casual users of LLVM libraries who want to gain more knowledge of LLVM essentials will also find this book useful. Intermediate-level experience with C++ programming is necessary to understand the concepts covered in this book.

商品描述(中文翻譯)

學習如何建立和使用完整範譜的實際編譯器,包括前端、優化流程和通過利用LLVM核心庫來建立新的後端。

主要特點:

- 逐步掌握使用LLVM庫的技巧
- 理解LLVM編譯器的高層設計,並將這些原則應用於自己的編譯器
- 添加新的後端以針對不支援的CPU架構
- 購買印刷版或Kindle電子書包括免費的PDF電子書

書籍描述:

LLVM的建立旨在彌合編譯器教科書中的理論知識與編譯器開發的實際需求之間的差距。通過模塊化的代碼庫和先進的工具,LLVM使開發人員能夠輕鬆地建立編譯器。本書作為LLVM的實用介紹,逐步引導您通過複雜的情境,確保您像專業人士一樣應對建立和使用編譯器的挑戰。

本書首先向您展示如何配置、構建和安裝LLVM庫、工具和外部項目。然後,您將介紹LLVM的設計,揭示其在每個編譯器階段(前端、優化器和後端)中的應用。使用一個真實的編程語言子集,您將構建一個前端,生成LLVM IR,通過流程進行優化,並生成機器代碼。高級章節擴展您的專業知識,涵蓋擴展LLVM的新通過、使用LLVM工具進行調試以及提高代碼質量等主題。您還將專注於即時編譯問題和LLVM的即時編譯支持的當前狀態。最後,您將為LLVM開發一個新的後端,深入了解目標描述和指令選擇的工作原理。

通過閱讀本書,您將通過實際示例和源代碼片段獲得對LLVM編譯器開發框架的實踐經驗。

您將學到什麼:

- 配置、編譯和安裝LLVM框架
- 理解LLVM源代碼的組織方式
- 發現在自己的項目中使用LLVM所需的步驟
- 探索編譯器的結構,並實現一個小型編譯器
- 為常見的源語言構造生成LLVM IR
- 設置優化流程並根據自己的需求進行調整
- 通過轉換通過和clang工具擴展LLVM
- 添加新的機器指令和完整的後端

本書適合編譯器開發人員、愛好者和初次接觸LLVM的工程師。希望使用基於編譯器的工具進行代碼分析和改進的C++軟件工程師,以及希望獲得更多LLVM基礎知識的LLVM庫的普通用戶也會發現本書有用。需要具備中級水平的C++編程經驗才能理解本書涵蓋的概念。

目錄大綱

  1. Installing LLVM
  2. The Structure of a Compiler
  3. Turning the Source File into an Abstract Syntax Tree
  4. Basics of IR Code Generation
  5. IR Generation for High-Level Language Constructs
  6. Advanced IR Generation
  7. Optimizing IR
  8. The TableGen Language
  9. JIT Compilation
  10. Debugging Using LLVM Tools
  11. The Target Description
  12. Instruction Selection
  13. Beyond Instruction Selection

目錄大綱(中文翻譯)

安裝LLVM
編譯器的結構
將源文件轉換為抽象語法樹
IR代碼生成的基礎知識
高級語言結構的IR生成
高級IR生成
優化IR
TableGen語言
即時編譯
使用LLVM工具進行調試
目標描述
指令選擇
超越指令選擇

類似商品