How Compilers Work: Introduction to LLVM Passes - Andrzej Warzynski - C++ on Sea 2022
ฝัง
- เผยแพร่เมื่อ 19 พ.ย. 2024
- C++ on Sea Website: cpponsea.uk/
C++ on Sea Twitter: / cpponsea
---
How Compilers Work: Introduction to LLVM Passes - Andrzej Warzynski - C++ on Sea 2022
Slides: github.com/phi...
LLVM is a compiler infrastructure project most known for Clang - the C and C++ compiler frontend. In this presentation, I will show how to develop an LLVM pass - the key component in any code transformation, optimisation or analysis used by LLVM. The goal of this talk is to present the full workflow - C++ implementation, CMake set-up, execution and testing.
LLVM provides a remarkably powerful and expressive modern C++ API for code analysis and transformation. It is a great environment for learning how compilers work and for experimenting with various ideas around code generation and programming languages. In a few relatively simple steps, LLVM allows one to build a simple code analysis tool. In this talk, I would like to showcase this and provide the required building blocks so that further experimenting becomes easy. I will walk through the infrastructure available in LLVM, present a few interesting example passes and demonstrate how to build and maintain them out-of-tree (i.e. without requiring or making any changes to the LLVM codebase).
I will also demonstrate how to build a standalone LLVM-based analysis tool as well as how to set up LLVM compiler tests to maintain correctness. All examples will be demonstrated live.
This is a tutorial for aspiring LLVM developers as well as those interested in learning more about how modern compilers work. It is a self-contained crash-course that does not require any prior knowledge about compilers or LLVM. Some familiarity with CMake and LLVM IR (or any other assembly language) will be helpful, but is not essential. The presented examples don't require building LLVM from sources and can be tested with the pre-build packages available online. All examples are available on GitHub: github.com/ban...
Content:
Background information and development set-up
Implementing and registering a pass (including CMake set-up)
Examples of analysis and transformation passes
Running and debugging an out-of-tree pass
Integrating a pass into an out-of-tree LLVM-based tool
Integration with clang/opt/bugpoint
Setting up and running LIT tests for out-of-tree passes
---
Andrzej Warzynski
Contributor to LLVM, FOSS enthusiast, author and maintainer of popular LLVM and Clang tutorials. Compiler engineer at Arm. Aspiring highlander.
---
C++ on Sea is an annual C++ and coding conference, in Folkestone, in the UK. The 2022 conference was conducted as a two part, physical and online C++ event.
Annual C++ on Sea, C++ conference: cpponsea.uk/
2022 Program: cpponsea.uk/20...
---
Produced and Edited by Digital Medium Ltd: events.digital...
Enquiries: events@digital-medium.co.uk
#Programming #Cpp #CppOnSea