Learn LLVM 17 a beginner's guide to learning LLVM compiler tools and core libraries with C++

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, g...

Descripción completa

Detalles Bibliográficos
Otros Autores: Nacke, Kai, author (author), Kwan, Amy, author
Formato: Libro electrónico
Idioma:Inglés
Publicado: Birmingham, UK : Packt Publishing Ltd 2024.
Edición:Second edition
Materias:
Ver en Biblioteca Universitat Ramon Llull:https://discovery.url.edu/permalink/34CSUC_URL/1im36ta/alma991009810934806719
Tabla de Contenidos:
  • Cover
  • Title Page
  • Copyright and Credits
  • Contributors
  • Table of Contents
  • Preface
  • Part 1: The Basics of Compiler Construction with LLVM
  • Chapter 1: 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
  • Chapter 2: The Structure of a Compiler
  • Building blocks of a compiler
  • An arithmetic expression language
  • Formalism for specifying the syntax of a programming language
  • How does grammar help the compiler writer?
  • Lexical analysis
  • A hand-written lexer
  • Syntactical analysis
  • A hand-written parser
  • The abstract syntax tree
  • Semantic analysis
  • Generating code with the LLVM backend
  • Textual representation of LLVM IR
  • Generating the IR from the AST
  • The missing pieces
  • the driver and the runtime library
  • Learning about the load-and-store approach
  • Mapping the control flow to basic blocks
  • Using AST numbering to generate IR code in SSA form
  • Defining the data structure to hold values
  • Reading and writing values local to a basic block
  • Searching the predecessor blocks for a value
  • Optimizing the generated phi instructions
  • Sealing a block
  • Creating the IR code for expressions
  • Emitting the IR code for a function
  • Controlling visibility with linkage and name mangling
  • Converting a type from an AST description into LLVM types
  • Creating the LLVM IR function
  • Emitting the function body
  • Setting up the module and the driver
  • Wrapping all in the code generator
  • Initializing the target machine class
  • Emitting assembler text and object code
  • Summary
  • Chapter 5: IR Generation for High-Level Language Constructs
  • Technical requirements
  • Working with arrays, structs, and pointers
  • Getting the application binary interface right
  • Creating IR code for classes and virtual functions
  • Implementing single inheritance
  • Extending single inheritance with interfaces
  • Adding support for multiple inheritance
  • Summary