KEMBAR78
LLVM Code Generation | Programming | eBook
Arrow left icon
Explore Products
Best Sellers
New Releases
Books
Videos
Audiobooks
Learning Hub
Newsletter Hub
Free Learning
Arrow right icon
timer SALE ENDS IN
0 Days
:
00 Hours
:
00 Minutes
:
00 Seconds
LLVM Code Generation
LLVM Code Generation

LLVM Code Generation: A deep dive into compiler backend development

eBook
$35.98 $39.99
Paperback
$49.99
Subscription
Free Trial
Renews at $19.99p/m

What do you get with eBook?

Product feature icon Instant access to your Digital eBook purchase
Product feature icon Download this book in EPUB and PDF formats
Product feature icon Access this title in our online reader with advanced features
Product feature icon DRM FREE - Read whenever, wherever and however you want
Product feature icon AI Assistant (beta) to help accelerate your learning
OR
Modal Close icon
Payment Processing...
tick Completed

Billing Address

Table of content icon View table of contents Preview book icon Preview Book

LLVM Code Generation

Getting Started with LLVM

In this part, we start with an introduction to the LLVM ecosystem, its community, and the various parts that make up the LLVM infrastructure.

This part assumes that you have no prior experience with LLVM and little to no experience with compilers.

More specifically, in this part, you will learn the following:

  • How to set up your environment to build and test the different projects that the LLVM infrastructure offers
  • How to interact with the LLVM community and, in particular, how to seek help and contribute
  • About the basic concepts used in compilers and how to manipulate them through the LLVM application programming interfaces (APIs)
  • How to write your first optimization pass and the things to consider while optimizing your program
  • How to build and customize your optimization pipeline
  • How TableGen, LLVM’s domain-specific language (DSL), fits into the LLVM infrastructure

By the end of this part, you will have a complete picture of the overall structure of the LLVM infrastructure and will be ready to dive into its inner workings.

This part of the book includes the following chapters:

  • Chapter 1, Building LLVM and Understanding the Directory Structure
  • Chapter 2, Contributing to LLVM
  • Chapter 3, Compiler Basics and How They Map to the LLVM APIs
  • Chapter 4, Writing Your First Optimization
  • Chapter 5, Dealing with the Pass Managers
  • Chapter 6, TableGen - The LLVM Swiss Army Knife for Modeling
Left arrow icon Right arrow icon
Download code icon Download Code

Key benefits

  • Understand the steps involved in generating assembly code from LLVM IR
  • Learn the key constructs needed to leverage LLVM for your hardware or backend
  • Strengthen your understanding with targeted exercises and practical examples in every chapter

Description

The LLVM infrastructure is a popular compiler ecosystem widely used in the tech industry and academia. This technology is crucial for both experienced and aspiring compiler developers looking to make an impact in the field. Written by Quentin Colombet, a veteran LLVM contributor and architect of the GlobalISel framework, this book provides a primer on the main aspects of LLVM, with an emphasis on its backend infrastructure; that is, everything needed to transform the intermediate representation (IR) produced by frontends like Clang into assembly code and object files. You’ll learn how to write an optimizing code generator for a toy backend in LLVM. The chapters will guide you step by step through building this backend while exploring key concepts, such as the ABI, cost model, and register allocation. You’ll also find out how to express these concepts using LLVM's existing infrastructure and how established backends address these challenges. Furthermore, the book features code snippets that demonstrate the actual APIs. By the end of this book, you’ll have gained a deeper understanding of LLVM. The concepts presented are expected to remain stable across different LLVM versions, making this book a reliable quick reference guide for understanding LLVM.

Who is this book for?

This book is for both beginners to LLVM and experienced LLVM developers. If you’re new to LLVM, it offers a clear, approachable guide to compiler backends, starting with foundational concepts. For seasoned LLVM developers, it dives into less-documented areas such as TableGen, MachineIR, and MC, enabling you to solve complex problems and expand your expertise. Whether you’re starting out or looking to deepen your knowledge, this book has something for you.

What you will learn

  • Understand essential compiler concepts, such as SSA, dominance, and ABI
  • Build and extend LLVM backends for creating custom compiler features
  • Optimize code by manipulating LLVM's Intermediate Representation
  • Contribute effectively to LLVM open-source projects and development
  • Develop debugging skills for LLVM optimizations and passes
  • Grasp how encoding and (dis)assembling work in the context of compilers
  • Utilize LLVM's TableGen DSL for creating custom compiler models

Product Details

Country selected
Publication date, Length, Edition, Language, ISBN-13
Last updated date : Sep 04, 2025
Publication date : May 23, 2025
Length: 620 pages
Edition : 1st
Language : English
ISBN-13 : 9781835462577
Category :
Languages :
Tools :

What do you get with eBook?

Product feature icon Instant access to your Digital eBook purchase
Product feature icon Download this book in EPUB and PDF formats
Product feature icon Access this title in our online reader with advanced features
Product feature icon DRM FREE - Read whenever, wherever and however you want
Product feature icon AI Assistant (beta) to help accelerate your learning
OR
Modal Close icon
Payment Processing...
tick Completed

Billing Address

Product Details

Last updated date : Sep 04, 2025
Publication date : May 23, 2025
Length: 620 pages
Edition : 1st
Language : English
ISBN-13 : 9781835462577
Category :
Languages :
Tools :

Packt Subscriptions

See our plans and pricing
Modal Close icon
$19.99 billed monthly
Feature tick icon Unlimited access to Packt's library of 7,000+ practical books and videos
Feature tick icon Constantly refreshed with 50+ new titles a month
Feature tick icon Exclusive Early access to books as they're written
Feature tick icon Solve problems while you work with advanced search and reference features
Feature tick icon Offline reading on the mobile app
Feature tick icon Simple pricing, no contract
$199.99 billed annually
Feature tick icon Unlimited access to Packt's library of 7,000+ practical books and videos
Feature tick icon Constantly refreshed with 50+ new titles a month
Feature tick icon Exclusive Early access to books as they're written
Feature tick icon Solve problems while you work with advanced search and reference features
Feature tick icon Offline reading on the mobile app
Feature tick icon Choose a DRM-free eBook or Video every month to keep
Feature tick icon PLUS own as many other DRM-free eBooks or Videos as you like for just $5 each
Feature tick icon Exclusive print discounts
$279.99 billed in 18 months
Feature tick icon Unlimited access to Packt's library of 7,000+ practical books and videos
Feature tick icon Constantly refreshed with 50+ new titles a month
Feature tick icon Exclusive Early access to books as they're written
Feature tick icon Solve problems while you work with advanced search and reference features
Feature tick icon Offline reading on the mobile app
Feature tick icon Choose a DRM-free eBook or Video every month to keep
Feature tick icon PLUS own as many other DRM-free eBooks or Videos as you like for just $5 each
Feature tick icon Exclusive print discounts

Table of Contents

29 Chapters
Part 1: Getting Started with LLVM Chevron down icon Chevron up icon
Building LLVM and Understanding the Directory Structure Chevron down icon Chevron up icon
Contributing to LLVM Chevron down icon Chevron up icon
Compiler Basics and How They Map to LLVM APIs Chevron down icon Chevron up icon
Writing Your First Optimization Chevron down icon Chevron up icon
Dealing with Pass Managers Chevron down icon Chevron up icon
TableGen – LLVM Swiss Army Knife for Modeling Chevron down icon Chevron up icon
Part 2: Middle-End: LLVM IR to LLVM IR Chevron down icon Chevron up icon
Understanding LLVM IR Chevron down icon Chevron up icon
Survey of the Existing Passes Chevron down icon Chevron up icon
Introducing Target-Specific Constructs Chevron down icon Chevron up icon
Hands-On Debugging LLVM IR Passes Chevron down icon Chevron up icon
Part 3: Introduction to the Backend Chevron down icon Chevron up icon
Getting Started with the Backend Chevron down icon Chevron up icon
Getting Started with the Machine Code Layer Chevron down icon Chevron up icon
The Machine Pass Pipeline Chevron down icon Chevron up icon
Part 4: LLVM IR to Machine IR Chevron down icon Chevron up icon
Getting Started with Instruction Selection Chevron down icon Chevron up icon
Instruction Selection: The IR Building Phase Chevron down icon Chevron up icon
Instruction Selection: The Legalization Phase Chevron down icon Chevron up icon
Instruction Selection: The Selection Phase and Beyond Chevron down icon Chevron up icon
Part 5: Final Lowering and Optimizations Chevron down icon Chevron up icon
Instruction Scheduling Chevron down icon Chevron up icon
Register Allocation Chevron down icon Chevron up icon
Lowering of the Stack Layout Chevron down icon Chevron up icon
Getting Started with the Assembler Chevron down icon Chevron up icon
Unlock Your Book’s Exclusive Benefits Chevron down icon Chevron up icon
Other Books You May Enjoy Chevron down icon Chevron up icon
Index Chevron down icon Chevron up icon

Customer reviews

Rating distribution
Full star icon Empty star icon Empty star icon Empty star icon Empty star icon 1
(1 Ratings)
5 star 0%
4 star 0%
3 star 0%
2 star 0%
1 star 100%
Tilak Aug 23, 2025
Full star icon Empty star icon Empty star icon Empty star icon Empty star icon 1
AI assistant button does not work. Packt rushes to put 'AI' in their stuff to follow market trend but completely useless. Non responsive button There is no natural voice for the play button which also sucks. All I see around AI AI AI - Give me money..
Subscriber review Packt
Get free access to Packt library with over 7500+ books and video courses for 7 days!
Start Free Trial

FAQs

How do I buy and download an eBook? Chevron down icon Chevron up icon

Where there is an eBook version of a title available, you can buy it from the book details for that title. Add either the standalone eBook or the eBook and print book bundle to your shopping cart. Your eBook will show in your cart as a product on its own. After completing checkout and payment in the normal way, you will receive your receipt on the screen containing a link to a personalised PDF download file. This link will remain active for 30 days. You can download backup copies of the file by logging in to your account at any time.

If you already have Adobe reader installed, then clicking on the link will download and open the PDF file directly. If you don't, then save the PDF file on your machine and download the Reader to view it.

Please Note: Packt eBooks are non-returnable and non-refundable.

Packt eBook and Licensing When you buy an eBook from Packt Publishing, completing your purchase means you accept the terms of our licence agreement. Please read the full text of the agreement. In it we have tried to balance the need for the ebook to be usable for you the reader with our needs to protect the rights of us as Publishers and of our authors. In summary, the agreement says:

  • You may make copies of your eBook for your own use onto any machine
  • You may not pass copies of the eBook on to anyone else
How can I make a purchase on your website? Chevron down icon Chevron up icon

If you want to purchase a video course, eBook or Bundle (Print+eBook) please follow below steps:

  1. Register on our website using your email address and the password.
  2. Search for the title by name or ISBN using the search option.
  3. Select the title you want to purchase.
  4. Choose the format you wish to purchase the title in; if you order the Print Book, you get a free eBook copy of the same title. 
  5. Proceed with the checkout process (payment to be made using Credit Card, Debit Cart, or PayPal)
Where can I access support around an eBook? Chevron down icon Chevron up icon
  • If you experience a problem with using or installing Adobe Reader, the contact Adobe directly.
  • To view the errata for the book, see www.packtpub.com/support and view the pages for the title you have.
  • To view your account details or to download a new copy of the book go to www.packtpub.com/account
  • To contact us directly if a problem is not resolved, use www.packtpub.com/contact-us
What eBook formats do Packt support? Chevron down icon Chevron up icon

Our eBooks are currently available in a variety of formats such as PDF and ePubs. In the future, this may well change with trends and development in technology, but please note that our PDFs are not Adobe eBook Reader format, which has greater restrictions on security.

You will need to use Adobe Reader v9 or later in order to read Packt's PDF eBooks.

What are the benefits of eBooks? Chevron down icon Chevron up icon
  • You can get the information you need immediately
  • You can easily take them with you on a laptop
  • You can download them an unlimited number of times
  • You can print them out
  • They are copy-paste enabled
  • They are searchable
  • There is no password protection
  • They are lower price than print
  • They save resources and space
What is an eBook? Chevron down icon Chevron up icon

Packt eBooks are a complete electronic version of the print edition, available in PDF and ePub formats. Every piece of content down to the page numbering is the same. Because we save the costs of printing and shipping the book to you, we are able to offer eBooks at a lower cost than print editions.

When you have purchased an eBook, simply login to your account and click on the link in Your Download Area. We recommend you saving the file to your hard drive before opening it.

For optimal viewing of our eBooks, we recommend you download and install the free Adobe Reader version 9.

Modal Close icon
Modal Close icon