|
所在平台: Udemy |
课程主页: https://www.udemy.com/course/learn-llvm-ir-in-action/
课程评论:没有评论
课程名称:学习LLVM IR的实践应用 课程概述:本课程旨在教授如何通过使用LLVM API将高级编程构造转换为LLVM IR。这是一门关于LLVM编程的实践课程。完成本课程后,学员将能够利用LLVM基础设施编写自己的编译器。本课程有两个先决条件。首先,学员需要具备基本的C/C++编程技能,熟悉变量、函数、指针等基本概念。其次,建议了解基本的编译原理概念,如解析器、基本块和SSA等。所有的源代码将在本课程中讨论并开发,相关代码可以在给定的GitHub链接中找到。在深入LLVM编程之前,我们将回顾编译器架构的核心组件。 一般来说,编译器会将源文件转换为可执行文件,分为三个阶段:第一阶段,编译器前端读取源文件并生成IR文件;第二阶段,编译器中端读取IR并输出优化后的IR;第三阶段,编译器后端读取中端生成的IR并生成可执行文件。通过这个编译器架构图我们可以看出,实现编译器需要处理许多内容。借助LLVM库,这一过程变得简化。 LLVM项目是一系列模块化和可重用的编译器及工具链技术。使用LLVM时,编译器开发者只需修改前端以生成LLVM IR,而可以重用LLVM的中端和后端。最终,我们可以通过LLVM工具生成高质量的可执行文件。
In this course you are going to learn about converting high level programming constructs into LLVM IR by using LLVM APIs. This is a practical class about LLVM programming. After learning this class, you will be able to write your own compiler by using LLVM infrastructure.This course has two prerequisites. Firstly, basic C/C++ programming skills is required. You must be familiar with the follwing knowledge, such as variables, functions, pointers, etc. Secondly, basic compiler principle concepts is recommended. It will be helpull if you know the follwing concepts, such as parser, basic blocks, SSA, etc.All the source code will be discussed and developed in this course is presented in this github url. Before we dive into llvm programming, let's review the core compoents of compiler architecture.In general, compiler will translate source files into an executable file in three phases.On phase one, the compiler frontend reads the soure file and produce ir file.On phase two, the compiler middleend reads the ir and emit the optimized ir.On phase three, the compile reads the ir produced by the middleend and produce an executable file.From this compiler architecture diagram we can see that there are lots of stuff to do to implement a compiler. By using LLVM libraries, things become simplified.The LLVM Project is a collection of modular and reusable compiler and toolchain technologies. By using LLVM, compiler developer only need to modify their frontend to emit llvm ir. We can reuse llvm middleend and llvm backend. Finally we can get a high quality executable file produced by LLVM tools.