LLVM


Online Resources

Documentation, Tutorials

MLIR

Youtube

Applications

Clang Analyzer

Polly

Bindings

Rust


Books

LLVM Essentials

  • Table of Contents
    • 1 Playing with LLVM
      • Modular design and collection of libraries
      • Getting familiar with LLVM IR
      • LLVM tools and using them in the command line
    • 2 Building LLVM IR
      • Creating an LLVM module
      • Emitting a function in a module
      • Adding a block to a function
      • Emitting a global variable
      • Emitting a return statement
      • Emitting function arguments
      • Emitting a simple arithmetic statement in a basic block
      • Emitting if-else condition IR
      • Emitting LLVM IR for loop
    • 3 Advanced LLVM IR
      • Memory access violations
      • Getting the address of an element
      • Reading from the memory
      • Writing into a memory location
      • Inserting a scalar into a vector
      • Extracting a scalar from a vector
    • 4 Basic IR Tranformations
      • Opt tool
      • Pass and Pass Manager
      • Using other pass info in the current pass
      • Instruction simplification example
      • Instruction combining
    • 5 Advanced IR Blokc Transformations
      • Loop processing
      • Scalar evolution
      • LLVM intrinsics
      • Vectorization
    • 6 IR to Selection DAG Phase
      • Converting IR to SelectionDAG
      • Legalizing SelectionDAG
      • Optimizing SelectionDAG
      • Instruction selection
      • Scheduling and emitting machine instructions
      • Register allocation
      • Code emission
    • 7 Generating Code for Target Architecture
      • Sample backend
      • Implementing frame lowering
      • Lowering instructions
      • Printing an instruction

Learn LLVM 12

  • Table of Contents
    • Section 1 The Basic of Compiler Construction with LLVM
      • 1 Installing LLVM
      • 2 Touring the LLVM Source Code
      • 3 The Structure of the Compiler
    • Section 2 From Source Code to Machine Code Construction
      • 4 Turning the Source File into an Abstract Syntax Tree
      • 5 Basic of IR Code Generation
      • 6 IR Generation for High-level Language Constructs
      • 7 Advanced IR Generation
      • 8 Optimizing IR
    • Section 3 Taking LLVM to the Next Level
      • 9 Instruction Selection
      • 10 JIT Compilation
      • 11 Debugging with LLVM Tools
      • 12 Create your own backend

Getting Started with LLVM Core Libraries

  • Table of Contents
    • 1 Build and install LLVM
    • 2 External Projectos
    • 3 Tools and Design
    • 4 The Frontend
    • 5 The LLVM Intermediate Representation
    • 6 The Backend
    • 7 The Just-In-Time Compiler
    • 8 Cross-platform Compilation
    • 9 The Clang Static Analyzer
    • 10 Clang Tools with LibTooling

LLVM Cookbook

  • Table of Contents
    • 1 LLVM Design and Use
      • Introduction
      • Understanding modular design
      • Cross-compiling Clang/LLVM
      • Converting a C source code to LLVM assembly
      • Converting IR to LLVM bitcode
      • Converting LLVM bitcode back to target machine assembly
      • Transforming LLVM IR
      • Linking LLVM bitcode
      • Executing LLVM bitcode
      • Using the C frontend Clang
      • Using the GO frontend
      • Using DragonEgg
    • 2 Steps in Writing a Frontend
      • Introduction
      • Defining a TOY Language
      • Implementing a lexer
      • Defining Abstract Syntax Trees
      • Implementing a parser
      • Parsing simple expressions
      • Parsing binary expressions
      • Invoking a driver for parsing
      • Running lexer and parser on our TOY language
      • Defining IR code generation methods for each AST class
      • Generating IR code for expressions
      • Generating IR code for functions
      • Adding IR optimizations support
    • 3 Extending the Frontend and Adding JIT Support
      • Introduction
      • Handling decision making paradigms - if/then/else constructs
      • Generating code for loops
      • Handling user-defined operators - binary operators
      • Handling user-defined operators - unary operators
      • Adding JIT support
    • 4 Preparing Optimizations
      • Introduction
      • Various levels of optimization
      • Writing your own LLVM pass
      • Running your own pass with the opt tool
      • Using another pass in a new pass
      • Registering a pass with pass manager
      • Writing an analysis pass
      • Writing an alias analysis pass
      • Using other analysis passes
    • 5 Implementing Optimizations
      • Introduction
      • Writing a dead code elimination pass
      • Writing an inlining transformation pass
      • Writing a pass for memory optimization
      • Combining LLVM IR
      • Transforming and optimizing loops
      • Reassociating expressions
      • Vectorizing IR
      • Other optimization passes
    • 6 Target-independent Code Generator
      • Introduction
      • The life of an LLVM IR instruction
      • Machine DAG
      • Visualizing LLVM IR CFG using GraphViz
      • Describing targets using TableGen
      • Defining an instruction set
      • Adding a machine code descriptor
      • Implementing the MachineInstrBuilder class
      • Implementing the MachineBasicBlock class
      • Implementing the MachineFunction class
      • Writing an instruction selector
      • Legalizing SelectionDAG
      • Optimizing SelectionDAG
      • Selecting instruction from the DAG
      • Scheduling instructions in SelectionDAG
    • 7 Optimizing the Machine Code
      • Introduction
      • Eliminating common subexpression from machine code
      • Analyzing live internals
      • Allocating registers
      • Inserting the prologue-epilogue code
      • Code emission
      • Tail call optimization
      • Sibling call optimization
    • 8 Writing an LLVM Backend
      • Introduction
      • Defining registers and registers sets
      • Defining the calling convention
      • Defining the instruction set
      • Implementing frame lowering
      • Printing an instruction
      • Selecting an instruction
      • Adding an instruction encodeing
      • Supporting a subtarget
      • Lowering to multiple instructions
      • Registering a target
    • 9 Using LLVM for Various Useful Projects
      • Introduction
      • Exception handling in LLVM
      • Using sanitizers
      • Writing the garbage collector with LLVM
      • Converting LLVM IR to JavaScript
      • Using the Clang Static Analyzer
      • Using bugpoint
      • Using LLDB
      • Using LLVM utility passes

LLVM Techniques, Tips, and Best Practices Clang and Middle-End Libraries

  • Table of Contents
    • Section 1 Build System and LLVM-specific Tooling
      • 1 Saving resources when building LLVM
      • 2 Exploring LLVM's Build System Features
      • 3 Testing with LLVM LIT
      • 4 TableGen Development
    • Section 2 Frontend Development
      • 5 Exploring Clang's Architecture
      • 6 Extending the Preprocessor
      • 7 Handling AST
      • 8 Working with Compiler Flags and Toolchains
    • Section 3 Middle-End Management
      • 9 Working with PassManager and AnalysisManager
      • 10 Processing LLVM IR
      • 11 Gearing up with Support Utilities
      • 12 Learning LLVM IR Instrumentation