Release of the LLVM 9.0 compiler suite

After six months of development submitted project release LLVM 9.0 - GCC-compatible tools (compilers, optimizers and code generators) that compile programs into an intermediate bitcode of RISC-like virtual instructions (a low-level virtual machine with a multi-level optimization system). The generated pseudo-code can be converted by the JIT compiler into machine instructions right at the time of program execution.

New features of LLVM 9.0 include the removal of the experimental design tag from the target RISC-V platform, C++ support for OpenCL, the ability to split a program into dynamically loaded parts in LLD, and the implementation of the “asm goto", used in the Linux kernel code. libc++ added support for WASI (WebAssembly System Interface), and LLD added initial support for WebAssembly dynamic linking.

Improvements in Clang 9.0:

  • Added by implementation of the GCC-specific expression "asm goto“, which allows you to move from an assembler inline block to a label in C code. This feature is required to build the Linux kernel in the “CONFIG_JUMP_LABEL=y” mode using Clang on systems with x86_64 architecture. Taking into account the changes added in previous releases, the Linux kernel can now be built in Clang for the x86_64 architecture (previously only building for the arm, aarch64, ppc32, ppc64le and mips architectures was supported). Moreover, Android and ChromeOS projects have already been converted to use Clang for kernel building, and Google is testing Clang as the main platform for building kernels for its production Linux systems. In the future, other LLVM components can be used in the kernel build process, including LLD, llvm-objcopy, llvm-ar, llvm-nm, and llvm-objdump;
  • Added experimental support for using C++17 in OpenCL. Specific features include support for address space attributes, blocking address space conversion by type casting operators, provision of vector types as in OpenCL for C, the presence of specific OpenCL types for images, events, channels, etc.
  • Added new compiler flags “-ftime-trace” and “-ftime-trace-granularity=N” to generate a report on the execution time of various stages of the frontend (parsing, initialization) and backend (optimization stages). The report is saved in json format, compatible with chrome://tracing and speedscope.app;
  • Added processing of the “__declspec(allocator)” specifier and generation of accompanying debugging information that allows you to monitor memory consumption in the Visual Studio environment;
  • For the C language, support has been added for the “__FILE_NAME__” macro, which resembles the “__FILE__” macro, but includes only the file name without the full path;
  • C++ has expanded support for address space attributes to cover various C++ features, including parameter and argument patterns, reference types, return type inference, objects, auto-generated functions, built-in operators, and more.
  • The capabilities associated with support for OpenCL, OpenMP and CUDA have been expanded. This includes initial support for implicit inclusion of built-in OpenCL functions (the “-fdeclare-opencl-builtins” flag has been added), the cl_arm_integer_dot_product extension has been implemented, and diagnostic tools have been expanded;
  • The work of the static analyzer has been improved and documentation on performing static analysis has been added. Added flags to display available checker modules and supported options (“-analyzer-checker[-option]-help”, “-analyzer-checker[-option]-help-alpha” and “-analyzer-checker[-option]-help” -developer"). Added "-analyzer-werror" flag to treat warnings as errors.
    Added new verification modes:

    • security.insecureAPI.DeprecatedOrUnsafeBufferHandling to identify unsafe practices for working with buffers;
    • osx.MIGChecker to search for violations of MIG (Mach Interface Generator) call rules;
    • optin.osx.OSObjectCStyleCast to find incorrect XNU libkern object conversions;
    • apiModeling.llvm with a set of modeling checking functions to detect errors in the LLVM codebase;
    • Stabilized code for checking uninitialized C++ objects (UninitializedObject in the optin.cplusplus package);
  • The clang-format utility has added support for formatting code in the C# language and provides support for the code formatting style used by Microsoft;
  • clang-cl, an alternative command-line interface that provides option-level compatibility with the cl.exe compiler included in Visual Studio, has added heuristics to treat non-existent files as command-line options and display a corresponding warning (for example, when running "clang-cl /diagnostic :caret /c test.cc");
  • A large portion of new checks has been added to linter clang-tidy, including added checks specific to the OpenMP API;
  • Expanded server capabilities clangd (Clang Server), in which the background index building mode is enabled by default, support for contextual actions with code has been added (variable retrieval, expansion of auto and macro definitions, conversion of escaped strings to unescaped ones), the ability to display warnings from Clang-tidy, expanded diagnostics of errors in header files and added the ability to display information about the type hierarchy;

All innovations LLVM 9.0:

  • An experimental partitioning feature has been added to the LLD linker, which allows you to split one program into several parts, each of which is located in a separate ELF file. This feature allows you to launch the main part of the program, which will load other components as needed during operation (for example, you can separate the built-in PDF viewer into a separate file, which will load only when the user opens the PDF file).

    LLD Linker brought to a state suitable for linking the Linux kernel for arm32_7, arm64, ppc64le and x86_64 architectures.
    New options "-" (output to stdout), "-[no-]allow-shlib-undefined", "-undefined-glob", "-nmagic", "-omagic", "-dependent-library", " -z ifunc-noplt" and "-z common-page-size". For the AArch64 architecture, support for BTI (Branch Target Indicator) and PAC (Pointer Authentication Code) instructions has been added. Support for MIPS, RISC-V and PowerPC platforms has been significantly improved. Added initial support for dynamic linking for WebAssembly;

  • In libc++ implemented functions ssize, std::is_constant_evaluated, std::midpoint and std::lerp, methods “front” and “back” have been added to std::span, attributes of types std::is_unbounded_array and std::is_bounded_array have been added, std capabilities have been expanded: :atomic. Support for GCC 4.9 has been discontinued (can be used with GCC 5.1 and newer releases). Added support WASI (WebAssembly System Interface, an interface for using WebAssembly outside the browser);
  • New optimizations have been added. Enabled conversion of memcmp calls to bcmp in some situations. Implemented omission of range checking for jump tables in which lower switch blocks are unreachable or when instructions are not used, for example, when calling functions with type void;
  • The backend for the RISC-V architecture has been stabilized, which is no longer positioned as experimental and is built by default. Provides full code generation support for RV32I and RV64I instruction set variants with MAFDC extensions;
  • Numerous improvements have been made to backends for X86, AArch64, ARM, SystemZ, MIPS, AMDGPU and PowerPC architectures. For example, for architecture
    AArch64 added support for SVE2 (Scalable Vector Extension 2) and MTE (Memory Tagging Extensions) instructions; in the ARM backend, support for the Armv8.1-M architecture and the MVE (M-Profile Vector Extension) extension was added. Support for the GFX10 (Navi) architecture has been added to the AMDGPU backend, function calling capabilities are enabled by default, and a combined pass is activated DPP (Data-Parallel Primitives).

  • The LLDB debugger now has color highlighting for backtraces and added support for the DWARF4 debug_types and DWARF5 debug_info blocks;
  • Support for object and executable files in COFF format has been added to the llvm-objcopy and llvm-strip utilities.

Source: opennet.ru

Add a comment