f0rki/mapping-high-level-constructs-to-llvm-ir
关于
本指南介绍如何将高级编程语言结构映射到 LLVM 中间语言。
编程语言与运行时实测星标增长
- 24小时
- 0
- 7天
- +1
- 15天
- +1
- 1个月
- 正在收集历史
各周期内的星标净变化,周期相互重叠,并非每日新增。缺失的测量保持空白。星标代表关注度,不代表软件质量。
README.md
原文[!CAUTION] The LLVM code listing in this repository are pretty much out-of-date and do not work with recent LLVM versions (e.g., this was written before opaque pointers became a thing in LLVM). Treat everything with caution. Feel free to fork and send PRs, but do not expect any major updates to this guide.
Mapping High Level Constructs to LLVM IR
About
This is a gitbook dedicated to providing a description on how LLVM based compilers map high-level language constructs into the LLVM intermediate representation (IR).
This document targets people interested in how modern compilers work and want to learn how high-level language constructs can be implemented. Currently the books focuses on C and C++, but contributions about other languages targeting LLVM are highly welcome. This document should help to make the learning curve less steep for aspiring LLVM users.
For the sake of simplicity, we'll be working with a 32-bit target machine so that pointers and word-sized operands are 32-bits. Also, for the sake of readability we do not mangle (encode) names. Rather, they are given simple, easy-to-read names that reflect their purpose. A production compiler for any language that supports overloading would generally need to mangle the names so as to avoid conflicts between symbols.
Reading the Book
Read the book online at ReadTheDocs.
Relevant External Resources on LLVM IR
This section presents various external links of relevance to those studying LLVM IR:
If you have other relevant links, please open an issue or submit a pull request with the link added to the list above.
Contributing
All contributions are welcome!
The repository is on GitHub.
If you find an error, file an issue or create a pull request.
Building
You can build the book in one of two ways: Using Ubuntu Linux or Docker on Linux.
Fetching the Project
- Change to your home directory:
cd ~ - Clone the repository:
git clone https://github.com/f0rki/mapping-high-level-constructs-to-llvm-ir llvm-ir - Enter the project directory:
cd llvm-ir
Setting Up Ubuntu Linux
- Install Make and some friends (~244 MB):
sudo apt install -y build-essential - Install the Python pip tool (~38 MB):
sudo apt install -y python3-pip - Install Sphinx for Python (~15 MB):
sudo apt install -y python3-sphinx - Install ReadTheDocs theme for Sphinx (~15 MB):
sudo apt install -y python3-sphinx-rtd-theme
You can now build the documentation locally:
- Build the documentation locally:
make html. - You can now browse the documentation in the
_build/htmlfolder.
Building using Docker
- Install Docker. DO NOT INSTALL USING THE STANDARD UBUNTU REPOSITORIES. IT WON'T WORK!
- Create the docker image:
sudo make docker-build. - Make the book:
sudo make docker-make O=html. - The book can now be found in the
_build/htmlfolder.
License
UNLESS OTHERWISE NOTED, THE CONTENTS OF THIS REPOSITORY/DOCUMENT ARE LICENSED UNDER THE CREATIVE COMMONS ATTRIBUTION - SHARE ALIKE 4.0 INTERNATIONAL LICENSE
探索相关项目
加载中…