Price: $49.99 - $39.99
(as of Sep 16, 2025 00:16:00 UTC – Details)
Explore the world of code generation with the LLVM infrastructure, and learn how to extend existing backends or develop your own
Get With Your Book: PDF Copy, AI Assistant, and Next-Gen Reader Free
Key FeaturesUnderstand the steps involved in generating assembly code from LLVM IRLearn the key constructs needed to leverage LLVM for your hardware or backendStrengthen your understanding with targeted exercises and practical examples in every chapterBook 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.
What you will learnUnderstand essential compiler concepts, such as SSA, dominance, and ABIBuild and extend LLVM backends for creating custom compiler featuresOptimize code by manipulating LLVM’s Intermediate RepresentationContribute effectively to LLVM open-source projects and developmentDevelop debugging skills for LLVM optimizations and passesGrasp how encoding and (dis)assembling work in the context of compilersUtilize LLVM’s TableGen DSL for creating custom compiler modelsWho this book is 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.
Table of ContentsBuilding LLVM and Understanding the Directory StructureContributing to LLVMCompiler Basics and How They Map to LLVM APIsWriting Your First OptimizationDealing with Pass ManagersTableGen – LLVM Swiss Army Knife for ModelingUnderstanding LLVM IRSurvey of the Existing PassesIntroducing Target-Specific ConstructsHands-On Debugging LLVM IR PassesLegacy Instruction Selection Framework – SelectionDAGGetting Started with the Machine Code LayerThe Machine Pass PipelineGetting Started with Instruction SelectionInstruction Selection: The IR Building PhaseInstruction Selection: The Legalization PhaseInstruction Selection: The Selection Phase and BeyondInstruction SchedulingRegister AllocationLowering of the Stack LayoutGetting Started with the Assembler
From the brand
See Our Full Range
Packt is a leading publisher of technical learning content with the ability to publish books on emerging tech faster than any other.
Our mission is to increase the shared value of deep tech knowledge by helping tech pros put software to work.
We help the most interesting minds and ground-breaking creators on the planet distill and share the working knowledge of their peers.
Publisher : Packt Publishing
Publication date : May 23, 2025
Language : English
Print length : 620 pages
ISBN-10 : 1837637784
ISBN-13 : 978-1837637782
Item Weight : 2.31 pounds
Dimensions : 7.5 x 1.4 x 9.25 inches
Best Sellers Rank: #214,241 in Books (See Top 100 in Books) #4 in Compiler Design #18 in Software Programming Compilers #23 in C++ Programming Language
Customer Reviews: 4.7 4.7 out of 5 stars 16 ratings var dpAcrHasRegisteredArcLinkClickAction; P.when(‘A’, ‘ready’).execute(function(A) { if (dpAcrHasRegisteredArcLinkClickAction !== true) { dpAcrHasRegisteredArcLinkClickAction = true; A.declarative( ‘acrLink-click-metrics’, ‘click’, { “allowLinkDefault”: true }, function (event) { if (window.ue) { ue.count(“acrLinkClickCount”, (ue.count(“acrLinkClickCount”) || 0) + 1); } } ); } }); P.when(‘A’, ‘cf’).execute(function(A) { A.declarative(‘acrStarsLink-click-metrics’, ‘click’, { “allowLinkDefault” : true }, function(event){ if(window.ue) { ue.count(“acrStarsLinkWithPopoverClickCount”, (ue.count(“acrStarsLinkWithPopoverClickCount”) || 0) + 1); } }); });