(Ebook) Learn LLVM 17: A beginner's guide to learning LLVM compiler tools and core libraries with C++ by Nacke, Kai, Kwan, Amy ISBN 9781837631346, 1837631344 all chapter instant download
(Ebook) Learn LLVM 17: A beginner's guide to learning LLVM compiler tools and core libraries with C++ by Nacke, Kai, Kwan, Amy ISBN 9781837631346, 1837631344 all chapter instant download
com
DOWLOAD EBOOK
https://ebooknice.com/product/learn-llvm-17-55331504
ebooknice.com
(Ebook) Learn LLVM 17, 2nd Edition by Kai Nacke, Amy Kwan
ISBN 274020d4-04f3-4c65-87ea-ce69f777a766,
274020D4-04F3-4C65-87EA-CE69F777A766
https://ebooknice.com/product/learn-llvm-17-2nd-edition-54902326
ebooknice.com
ebooknice.com
ebooknice.com
(Ebook) SAT II Success MATH 1C and 2C 2002 (Peterson's SAT
II Success) by Peterson's ISBN 9780768906677, 0768906679
https://ebooknice.com/product/sat-ii-success-
math-1c-and-2c-2002-peterson-s-sat-ii-success-1722018
ebooknice.com
https://ebooknice.com/product/getting-started-with-llvm-core-
libraries-50300396
ebooknice.com
ebooknice.com
ebooknice.com
ebooknice.com
Learn LLVM 17
Copyright © 2024 Packt Publishing
All rights reserved. No part of this book may be
reproduced, stored in a retrieval system, or
transmitted in any form or by any means, without
the prior written permission of the publisher, except
in the case of brief quotations embedded in critical
articles or reviews.
Every effort has been made in the preparation of this
book to ensure the accuracy of the information
presented. However, the information contained in
this book is sold without warranty, either express or
implied. Neither the authors, nor Packt Publishing or
its dealers and distributors, will be held liable for any
damages caused or alleged to have been caused
directly or indirectly by this book.
Packt Publishing has endeavored to provide
trademark information about all of the companies
and products mentioned in this book by the
appropriate use of capitals. However, Packt
Publishing cannot guarantee the accuracy of this
information.
Group Product Manager: Kunal Sawant
Publishing Product Manager: Teny Thomas
Book Project Manager: Prajakta Naik
Senior Editor: Ruvika Rao and Nithya Sadanandan
Technical Editor: Jubit Pincy
Copy Editor: Safis Editing
Indexer: Pratik Shirodkar
Production Designer: Vijay Kamble
DevRel Marketing Coordinator: Shrinidhi
Manoharan
Business Development Executive: Kriti Sharma
First published: April 2021
Second published: January 2024
Production reference: 1271223
Published by Packt Publishing Ltd.
Grosvenor House
11 St Paul’s Square
Birmingham
B3 1R.
ISBN 978-1-83763-134-6
www.packtpub.com
Writing a book takes time and energy. Without
the support and understanding of my wife, Tanya,
and my daughter Polina, this book would not
have been possible. Thank you both for always
encouraging me!
Because of some personal challenges, this project
was at risk, and I am grateful to Amy for joining
me as an author. Without her, the book would not
be as good as it is now.
Once again, the team at Packt not only provided
guidance on my writing but also showed an
understanding of my slow writing, and always
motivated me to carry on. I owe them a great
thank you.
- Kai Nacke
2023 has been a very transformative year for me,
and contributing my knowledge of LLVM to this
book has been one of the reasons why this year
has been so significant. I never would have
thought that I would be approached by Kai to
embark on this exciting journey to share LLVM 17
with you all! Thank you to Kai, for his technical
mentorship and guidance, the team at Packt,
and, of course, to my family and close loved ones
for providing me with the support and motivation
in writing this book.
- Amy Kwan
Contributors
Preface
Part 1: The Basics of Compiler
Construction with LLVM
Installing LLVM
Compiling LLVM versus installing
binaries
Getting the prerequisites ready
Ubuntu
Fedora and RedHat
FreeBSD
OS X
Windows
Cloning the repository and building from
source
Configuring Git
Cloning the repository
Creating a build directory
Generating the build system files
Compiling and installing LLVM
Customizing the build process
Variables defined by CMake
Using LLVM-defined build configuration
variables
Summary
Advanced IR Generation
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
Creating TBAA metadata in LLVM
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
Optimizing IR
Technical requirements
The LLVM pass manager
Implementing a new pass
Developing the ppprofiler pass as a
plugin
Adding the pass to the LLVM source tree
Using the ppprofiler pass with LLVM
tools
Adding an optimization pipeline to your
compiler
Creating an optimization pipeline
Extending the pass pipeline
Summary
Part 3: Taking LLVM to the Next
Level
JIT Compilation
Technical requirements
LLVM’s overall JIT implementation and
use cases
Using JIT compilation for direct
execution
Exploring the lli tool
Implementing our own JIT compiler with
LLJIT
Integrating the LLJIT engine into the
calculator
Code generation changes to support JIT
compilation via LLJIT
Building an LLJIT-based calculator
Building a JIT compiler class from
scratch
Creating a JIT compiler class
Using our new JIT compiler class
Summary
10
11
Instruction Selection
Defining the rules of the calling
convention
Implementing the rules of the calling
convention
Instruction selection via the selection
DAG
Implementing DAG lowering – handling
legal types and setting operations
Implementing DAG lowering – lowering
formal arguments
Implementing DAG lowering – lowering
return values
Implementing DAG-to-DAG
transformations within instruction
selection
Adding register and instruction
information
Putting an empty frame lowering in
place
Emitting machine instructions
Creating the target machine and the
sub-target
Implementing M88kSubtarget
Implementing M88kTargetMachine –
defining the definitions
Implementing M88kTargetMachine –
adding the implementation
Global instruction selection
Lowering arguments and return values
Legalizing the generic machine
instructions
Selecting a register bank for operands
Translating generic machine instructions
Running an example
How to further evolve the backend
Summary
13
Index
Updated editions will replace the previous one—the old editions will
be renamed.
1.D. The copyright laws of the place where you are located also
govern what you can do with this work. Copyright laws in most
countries are in a constant state of change. If you are outside the
United States, check the laws of your country in addition to the terms
of this agreement before downloading, copying, displaying,
performing, distributing or creating derivative works based on this
work or any other Project Gutenberg™ work. The Foundation makes
no representations concerning the copyright status of any work in
any country other than the United States.
• You pay a royalty fee of 20% of the gross profits you derive from
the use of Project Gutenberg™ works calculated using the
method you already use to calculate your applicable taxes. The
fee is owed to the owner of the Project Gutenberg™ trademark,
but he has agreed to donate royalties under this paragraph to
the Project Gutenberg Literary Archive Foundation. Royalty
payments must be paid within 60 days following each date on
which you prepare (or are legally required to prepare) your
periodic tax returns. Royalty payments should be clearly marked
as such and sent to the Project Gutenberg Literary Archive
Foundation at the address specified in Section 4, “Information
about donations to the Project Gutenberg Literary Archive
Foundation.”
• You comply with all other terms of this agreement for free
distribution of Project Gutenberg™ works.
1.F.
1.F.4. Except for the limited right of replacement or refund set forth in
paragraph 1.F.3, this work is provided to you ‘AS-IS’, WITH NO
OTHER WARRANTIES OF ANY KIND, EXPRESS OR IMPLIED,
INCLUDING BUT NOT LIMITED TO WARRANTIES OF
MERCHANTABILITY OR FITNESS FOR ANY PURPOSE.
Please check the Project Gutenberg web pages for current donation
methods and addresses. Donations are accepted in a number of
other ways including checks, online payments and credit card
donations. To donate, please visit: www.gutenberg.org/donate.
Most people start at our website which has the main PG search
facility: www.gutenberg.org.
Our website is not just a platform for buying books, but a bridge
connecting readers to the timeless values of culture and wisdom. With
an elegant, user-friendly interface and an intelligent search system,
we are committed to providing a quick and convenient shopping
experience. Additionally, our special promotions and home delivery
services ensure that you save time and fully enjoy the joy of reading.
ebooknice.com