LLVM Code Generation
eBook - ePub

LLVM Code Generation

A deep dive into compiler backend development

  1. English
  2. ePUB (mobile friendly)
  3. Available on iOS & Android
eBook - ePub

LLVM Code Generation

A deep dive into compiler backend development

About this book

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 Features

  • 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

Book 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 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

Who 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.

]]>

Trusted by 375,005 students

Access to over 1.5 million titles for a fair monthly price.

Study more efficiently using our study tools.

Information

Year
2025
eBook ISBN
9781835462577

Table of contents

  1. Preface
  2. Getting Started with LLVM
  3. Building LLVM and Understanding the Directory Structure
  4. Contributing to LLVM
  5. Compiler Basics and How They Map to LLVM APIs
  6. Writing Your First Optimization
  7. Dealing with Pass Managers
  8. TableGen – LLVM Swiss Army Knife for Modeling
  9. Middle-End: LLVM IR to LLVM IR
  10. Understanding LLVM IR
  11. Survey of the Existing Passes
  12. Introducing Target-Specific Constructs
  13. Hands-On Debugging LLVM IR Passes
  14. Introduction to the Backend
  15. Getting Started with the Backend
  16. Getting Started with the Machine Code Layer
  17. The Machine Pass Pipeline
  18. LLVM IR to Machine IR
  19. Getting Started with Instruction Selection
  20. Instruction Selection: The IR Building Phase
  21. Instruction Selection: The Legalization Phase
  22. Instruction Selection: The Selection Phase and Beyond
  23. Final Lowering and Optimizations
  24. Instruction Scheduling
  25. Register Allocation
  26. Lowering of the Stack Layout
  27. Getting Started with the Assembler
  28. Unlock Your Book’s Exclusive Benefits
  29. Index

Frequently asked questions

Yes, you can cancel anytime from the Subscription tab in your account settings on the Perlego website. Your subscription will stay active until the end of your current billing period. Learn how to cancel your subscription
No, books cannot be downloaded as external files, such as PDFs, for use outside of Perlego. However, you can download books within the Perlego app for offline reading on mobile or tablet. Learn how to download books offline
Perlego offers two plans: Essential and Complete
  • Essential is ideal for learners and professionals who enjoy exploring a wide range of subjects. Access the Essential Library with 800,000+ trusted titles and best-sellers across business, personal growth, and the humanities. Includes unlimited reading time and Standard Read Aloud voice.
  • Complete: Perfect for advanced learners and researchers needing full, unrestricted access. Unlock 1.5M+ books across hundreds of subjects, including academic and specialized titles. The Complete Plan also includes advanced features like Premium Read Aloud and Research Assistant.
Both plans are available with monthly, semester, or annual billing cycles.
We are an online textbook subscription service, where you can get access to an entire online library for less than the price of a single book per month. With over 1.5 million books across 990+ topics, we’ve got you covered! Learn about our mission
Look out for the read-aloud symbol on your next book to see if you can listen to it. The read-aloud tool reads text aloud for you, highlighting the text as it is being read. You can pause it, speed it up and slow it down. Learn more about Read Aloud
Yes! You can use the Perlego app on both iOS and Android devices to read anytime, anywhere — even offline. Perfect for commutes or when you’re on the go.
Please note we cannot support devices running on iOS 13 and Android 7 or earlier. Learn more about using the app
Yes, you can access LLVM Code Generation by Quentin Colombet in PDF and/or ePUB format, as well as other popular books in Computer Science & Compilers. We have over 1.5 million books available in our catalogue for you to explore.