LLVM sees RISCV target maturing

LLVM sees RISCV target maturing

Compiler infrastructure project LLVM is now available in version 9.0. In the last six months, its developers have pushed the RISCV target out of the experimental state, deprecated the ORCv1 JIT API, and added some new features and optimisation measures to the tool.

LLVM now for example includes two new extension points so that plugins can “specialize the legacy pass manager full LTO pipeline”. Devs using COFF object files and executables will find that the most common copying and stripping options are supported by llvm-objcopy and llvm-strip.

With the RISCV target becoming a standard build target, the backend saw the addition of full code generation support for “RV32I and RV64I base RISC-V instruction set variants, with the MAFDC standard extensions”. Meanwhile the SystemZ backend was fitted with everything necessary to make it work with the arch13 architecture and builtins for new vector instructions.

Those working with the PowerPC Target will see scheduling enhancements, an improvement in handling TOC pointer spills for indirect calls, as well as MachinePipeliner support for P9. The MIPS target has been fitted with ways to work with the .cplocal assembler directive, sge, sgeu, sgt, sgtu pseudo instructions and the o inline asm constraint. A list of all the changes the LLVM team made to the project’s targets can be found in the documentation.

LLVM’s intermediate representation now includes an immarg parameter attribute, while byval can now take a type parameter which has to be identical to the argument’s pointee type. Another new IR-addition are target-independent hardware loops, which come with PowerPC and Arm implementations.

Global variables @llvm.global_ctors and @llvm.global_dtors will only work if all three fields of their element type are specified, since the 2-field form has been deleted. Devs who made use of this style will have to migrate their variables accordingly.

The release of course contains a new version of the Clang C/C++/Objective-C frontend. Clang 9 is the first iteration that includes experimental support for C++17 features in OpenCL. The implementation improves address spaces behaviour for features such as reference types, type deduction, and built in operators. It also adds vector types comparable to those in OpenCL, and accepts OpenCL-specific types images, samplers, events, and pipes.

Users should be aware, however, that LLVM 9.0 seems to have introduced a bug which lead to Clang miscompiling when using GCC 9. A patch doesn’t seem to be available at the time of writing. Developers that like to build LLVM with Visual Studio will have to upgrade to version 2017 or higher in order to keep doing so.

If the new release doesn’t have what you were looking for, work on the next version is already in progress. LLVM’s tenth major release will, amongst other things, see unnamed function arguments get printed with their automatically generated name in definitions in the intermediate representation. Apart from that, it’s already clear that MemorySSA will become a loop dependency, and SelectionDAG will loose ISD::FP_ROUND_INREG opcode and related code. The X86 Target is planned to include changes to how 128 vector types, and certain configurations of v32i8 and v64i8 vectors will be handled.