编译优化工具-QBE
2022-04-26 14:24:04 阿炯

QBE的目标是成为一个纯C嵌入式后端,优化10%的代码同时提升高级编译器70%的性能。在灵活大小、理解程度、改进能力方面达到了某种平衡。采用C语言编写并在MIT协议下授权。


它在64位的Linux, FreeBSD, and OSX上测试通过,它依赖GNU Make与支持C99的编译器环境。

原文特性
Very good compatibility with C code.
IEEE floating points support.
SSA-based intermediate language.
Copy elimination.
Sparse conditional constant propagation.
Dead instructions elimination.
Registerization of small stack slots.
Split spiller and register allocator thanks to SSA form. (Simpler and faster than graph coloring.)
Smart spilling heuristic based on loop analysis.
Linear register allocator with hinting.
Recognizes and uses x64 addressing modes.
Uniform and simple IL syntax.
Gets compiled really quick (2 seconds on my Core 2 Duo with CFLAGS=-O2).

主要特性
完全支持 C ABI
支持 IEEE 32 位和 64 位浮点数
使用统一且简单的基于 SSA 的中间语言 (IL)
在所有编译阶段使用相同的 IL
Copy elimination
编译速度快(在 CFLAGS=-O2 的 Core 2 Duo 上为 2 秒)
……

QBE 目前已经在下列平台上编译和并通过测试:
Linux
FreeBSD
Mac OS X

编译 QBE 需要 GNU Make 和一个 C99 编译器,而 HTML 文档则使用一个 OCaml 程序根据正则文本文件来生成。


Only x64 platforms are currently supported. ARM support is planned.
Computed goto (switch) is not provided. It will be implemented.
Some hardcoded limits might be hit. But they can also be tweaked easily.
Text input only. A C library interface is work in progress.


最新版本:1.0
历经 8 年的开发,QBE 1.0 已于2022年6月下旬正式发布。

项目主页:https://c9x.me/compile/