当前位置:网站首页>LLVM系列(1)- LLVM简介
LLVM系列(1)- LLVM简介
2022-06-27 10:38:00 【itas109】
LLVM系列(1)- LLVM简介
如需转载请标明出处:http://blog.csdn.net/itas109
QQ技术交流群:129518033
文章目录
1. LLVM概述
LLVM 项目是模块化和可重用的编译器和工具链技术的集合。
LLVM 最初是伊利诺伊大学的一个研究项目,目标是提供一种现代的、基于 SSA 的编译策略,能够支持任意编程语言的静态和动态编译。
LLVM最初以C/C++为实现对象,目前已支持包括ActionScript、Ada、D语言、Fortran、GLSL、Haskell、Java字节码、Objective-C、Swift、Python、Ruby、Crystal、Rust、Scala以及C#等语言。
官网:https://llvm.org/
Github地址:https://github.com/llvm/llvm-project/
开源协议:Apache 2.0 License with LLVM exceptions
2. LLVM子项目简介
2.1 LLVM 核心库和附加内容
LLVM 核心库位于 llvm 目录中。其为主流CPU提供了优化器和代码生成的库,以及一些工具。
LLVM 核心库提供了 C++ 、C 、Go、Ocaml 和Python 等接口。
Polly 项目使用多面体模型实现了一套缓存局部优化以及自动并行和矢量化,如使用缓存局部优化的循环。
MLIR子项目是一种构建可重用和可扩展编译器基础设施的新方法。MLIR 旨在解决软件碎片化问题,改进异构硬件的编译,显着降低构建特定领域编译器的成本,并帮助将现有编译器连接在一起。
2.2 Clang编译器
Clang编译器位于clang目录,是一个LLVM 原生的C/C++/Objective-C编译器。
clang目录还包含一些工具,如clang-format(代码格式化工具)。
clang-tools-extra目录也提供了一些clang的工具,如clang-tidy(静态代码分析)。
2.3 LLD链接器
LLD项目是一个新的链接器。用于将编译器创建的对象文件和运行时库链接在一起,形成可执行文件。LLD链接器支持 ELF、COFF、Mach-O 和WebAssembly 格式。
2.4 LLDB调试器
LLDB调试器基于LLVM 和 Clang ,支持 C、C++ 和 Objective-C的调试,并提供 C++ 、lua和Python 等API接口。
2.5 运行时库
- compiler-rt 提供了独立于编程语言的支持库。为 AddressSanitizer、 ThreadSanitizer、 MemorySanitizer和 DataFlowSanitizer等动态测试工具提供运行时库的实现。
- libunwind 提供了基于 DWARF 标准的堆栈展开帮助函数。主要用于 C++ 等语言的异
常处理。 - libcxx 和libcxxabi 是 C++ 标准库的实现,包括 iostreams 和 STL。,包括对 C++11 和 C++14 的完全支持。
- pstl 提供了并行版本的STL 算法。
- libclc 是 OpenCL 的运行时库。OpenCL 是异构并行计算的标准,有助于将计算任务转移到
GPU 上。 - libc 旨在提供一个完整的 C 库。
- OpenMP 项目提供对 OpenMP API 的支持。OpenMP 可以帮助多线程编程。
3. LLVM架构
源代码 -> 前端(Fontend) -> 优化器(Optimizer) -> 后端(Backend) -> 机器码
前端(Fontend) :解析源代码,错误检查和构建AST抽象语法树(词法分析、语法分析、语义分析)
优化器(Optimizer) : 各种转换以尝试改进代码的运行时间
后端(Backend) :代码映射到目标指令集
+----------------------------+ +----------------------------+
| | | |
| | | |
C +-------> C Frontend +-----+ +----> X86 Backend +-------> X86
| | | | | |
| | | | | |
+----------------------------+ | | +----------------------------+
| |
| |
+----------------------------+ | +----------------------------+ | +----------------------------+
| | | | | | | |
| | | | | | | |
Go +-------> Go Frontend +-----------> Common Optimizer +----------> ARM Backend +-------> ARM
| | | | | | | |
| | | | | | | |
+----------------------------+ | +----------------------------+ | +----------------------------+
| |
| |
| |
+----------------------------+ | | +----------------------------+
| | | | | |
| | | | | |
Rust +-------> Rust Frontend +-----+ +----> Mips Backend +--------> Mips
| | | |
| | | |
+----------------------------+ +----------------------------+
License
License under CC BY-NC-ND 4.0: 署名-非商业使用-禁止演绎
如需转载请标明出处:http://blog.csdn.net/itas109
QQ技术交流群:129518033
Reference:
- https://llvm.org/
- http://www.aosabook.org/en/llvm.html
- https://en.wikipedia.org/wiki/LLVM
边栏推荐
- JS client storage
- [tcapulusdb knowledge base] Introduction to tmonitor stand-alone installation guidelines (II)
- Go zero micro Service Practice Series (VII. How to optimize such a high demand)
- Feedforward feedback control system design (process control course design matlab/simulink)
- C語言學習-Day_04
- 实验笔记之——CARMEN (.log .clf)文件转换为rosbag
- Write it down once Net analysis of a property management background service stuck
- 【Methodot 专题】什么样的低代码平台更适合开发者?
- mysql数据库汉字模糊查询出现异常
- Design and Simulation of direct torque control system for induction motor (motion control matlab/simulink)
猜你喜欢
随机推荐
Uniform Asymptotics by Alexei
迪米特法则
[tcapulusdb knowledge base] tcapulusdb cluster management introduction
用户认证技术
[so official interview] Why do developers using rust love it so much
Win10快捷键整理
[learn FPGA programming from scratch -47]: Vision - current situation and development trend of the third generation semiconductor technology
Ci/cd automatic test_ 16 best practices for CI / CD pipeline to accelerate test automation
flutter 微信分享
Eureka核心源码解析
JS client storage
【TcaplusDB知识库】TcaplusDB机器初始化和上架介绍
2021 CSP J2入门组 CSP-S2提高组 第2轮 视频与题解
Institute of Microbiology, Chinese Academy of Sciences recruited 20 young PI, with a resettlement fee of 2million yuan and a start-up fund of 10million yuan (long-term effective)
ECMAScript 6(es6)
Technology is as important as business. It is wrong to favor either side
Go zero micro Service Practice Series (VII. How to optimize such a high demand)
【TcaplusDB知识库】TcaplusDB新增机型介绍
Multi thread implementation rewrites run (), how to inject and use mapper file to operate database
堆-堆排序-TopK





![[hcie-rs review mind map] - STP](/img/b5/b89e59fe7f23bf23feeadb991acba7.png)



