- Telegram сhat
- Telegram сhannel
- Tasks and results
- Materials
LLLVM is a set of compiler and toolchain technologies that can be used to develop a frontend for any programming language and a backend for any instruction set architecture. LLVM is designed around a language-independent intermediate representation (IR) that serves as a portable, high-level assembly language that can be optimized with a variety of transformations over multiple passes. The name LLVM originally stood for Low Level Virtual Machine, though the project has expanded and the name is no longer officially an initialism.
This repository contains the source code for LLVM, a toolkit for the construction of highly optimized compilers, optimizers, and run-time environments.
The LLVM project has multiple components. The core of the project is itself called "LLVM". This contains all of the tools, libraries, and header files needed to process intermediate representations and convert them into object files. Tools include an assembler, disassembler, bitcode analyzer, and bitcode optimizer.
This course will consist of 4 laboratory work. As part of the laboratory works, you will study all stages of compilation, starting with the generation of the AST tree, ending with code generation.
Recommended OS - Linux (WSL).
- Create fork this repository
- Clone local fork
git clone https://github.com/<your-github-name>/llvm.git
cd llvm/
git checkout -b <name-your-branch>
sudo apt-get update \
&& sudo apt-get install -q -y --no-install-recommends \
git \
cmake \
ccache \
mold \
clang \
build-essential \
ninja-build \
python3 \
python3-pip \
wget \
vim
cmake -G Ninja -S llvm -B build \
-DCMAKE_BUILD_TYPE=Release \
-DCMAKE_CXX_COMPILER=clang++ \
-DCMAKE_C_COMPILER=clang \
-DLLVM_USE_LINKER=mold \
-DLLVM_CCACHE_BUILD=ON \
-DLLVM_ENABLE_ASSERTIONS=ON \
-DLLVM_ENABLE_PROJECTS="clang;mlir" \
-DLLVM_TARGETS_TO_BUILD=X86 # specify your target architecture (X86, Aarch64)
cmake --build build --config Release -j 4
Each directory has an implementation example.
cd clang/compiler-course/ # for labs
cd clang/test/compiler-course/ # for tests
cd llvm/compiler-course/llvm-ir/ # for labs
cd llvm/test/compiler-course/ # for tests
cd llvm/compiler-course/backend/ # for labs
cd llvm/test/compiler-course/ # for tests
cd mlir/compiler-course/ # for labs
cd mlir/test/compiler-course/ # for tests
For all tests
cmake --build build --config Release -t \
check-llvm-compiler-course \
check-clang-compiler-course \
check-mlir-compiler-course -j 4
For one test
./build/bin/llvm-lit -v /path/to/test_file