What’s new in LLVM

综合技术 2018-03-10 阅读原文

The LLVM compiler framework
has gone from being a technological curiosity to a vital piece of the modern software landscape. It is the engine behind the Clang compiler, as well as the compilers for the Rust and Swift languages, and provides a powerful toolkit for creating new languages.

It is also a fairly fast-moving project, with major point revisions announced every six months or so. Version 6.0, released earlier this month, continues LLVM’s ongoing mission to deepen and broaden support for a variety of compilation targets. The update also adds many timely fixes to guard against recently discovered processor-level system attacks.

LLVM adds partial Spectre protection

The “Spectre” and “Meltdown” CPU exploits
take advantage of speculative execution features in modern processors. Because they must be addressed by a combination of CPU microcode updates and changes to existing software, they are difficult to fix.

To ensure that applications built with LLVM can do their part to guard against such attacks, LLVM now offers support for ”retpolines,”
a software construction that partly alleviates one of the varieties of the Spectre attack.
To make use of it, you’ll need to use LLVM 6.0 to recompile the software in question using the -mretpoline
command line switch.

LLVM CodeView debugging for Windows improved

Microsoft Windows uses debug information stored in a format called the CodeView format, analogous to the DWARF format used in Linux systems.

LLVM previously added support for working with CodeView
, as part of a general push toward making LLVM a better citizen on Windows
, and leveraging the wealth of debugging tools in Windows that use CodeView.

LLVM 6 further improves that support, thanks to some support from Microsoft and some diligent reverse engineering on behalf of the LLVM team. The long-term idea is to improve CodeView support to the point where LLVM-compiled languages other than C/C++ (for instance, by way of the Clang compiler) can make robust use of CodeView and its tools.

LLVM supports WebAssembly as a linking target

WebAssembly, the binary format for applications delivered in a web browser, is starting to evolve from an experiment into a production technology. Key parts of the WebAssembly toolchain, such as Emscripten and PNaCL, use LLVM.

The latest step is support in LLVM’s linker tools for WebAssembly, by way of
the wasm-ld
command-line tool

. This tool ingests assembly created by LLVM when using the wasm32-unknown-unknown-wasm
target, and emits web-ready WebAssembly binaries.

Support for WebAssembly is still necessarily incomplete, as WebAssembly itself is a work in progress, but LLVM is likely to remain a key element in the WebAssembly stack.

LLVM improvements to Intel CPU support

LLVM programs can now take advantage of instruction scheduling on many families of Intel processor: Sandy Bridge, Ivy Bridge, Haswell, Broadwell, and Skylake. The Intel Icelake CPU is now a supported target, too.

LLVM now supports emitting intrinsics that work with Intel processor extensions used for vector processing: VAES, GFNI, VPCLMULQDQ, AVX512VBMI2, AVX512BITALG, and AVX512VNNI.

Code generation has been improved overall for various operations on Intel processors, such as memory comparisons, vector truncations, and vector multiplication with 32-bit integer values.




LLVM学习笔记(14) X86GenRegisterInfo的定义 CodeGen比MC的层次要高,MCRegisterInfo的信息是不足够的,因此从MCRegisterInfo派生了TargetRegisterInfo。目标机...
Improving C++ Builds with Split DWARF Large- and medium-sized C++ projects often suffer from long build times. We can distinguish these two scenarios: ...
一个程序是如何被机器运行起来的? 由于前段时间期末考试,所以一直没有更新博客,最近又来了搜狐实习,一直在赶需求,感觉自己好久没有更新博客了,这几天赶完了需求,还是抽时间来更新一下博客吧。 正文 我们平常写程序的时候,一般都是使用一个好用的IDE,然后写好代码,run...
llvm学习笔记(2) 2. LLVM的后端描述 2.1. 类型描述 为了更好地描述寄存器所能支持的值类型(大小),以及操作数的类型(大小),Tablegen在ValueTypes.td里给出了一系列的类型定义,它们都继承自V...
让我们致力于一个LLVM超级优化器 作者:JohnRegehr, Professor of Computer Science, University of Utah, USA 原文地址: http://blog.regehr.org/archives/1109 编...