LLVM ARM and AArch64 nest attribute patches accepted

In the process of developing a mechanism for efficient virtual method calls in Loci I came across difficulties related to generating the appropriate assembly via LLVM IR. For more information, read the LLVM mailing list discussion.

Fortunately it turns out LLVM has been adding the required features recently, one of which is the ‘nest’ attribute that’s designed to be used for GCC’s nested functions extension to C (Clang needs to be compatible with GCC). The only issue was that while full support is already present for x86 32-bit and 64-bit, the ‘nest’ attribute wasn’t implemented on the LLVM ARM 32-bit backend or AArch64 backend.

Hence I created patches for ARM and AArch64 and these have now been accepted and both committed to LLVM. Separately support has also been implemented for PowerPC. These will all be going into LLVM 3.7.

llvm-abi announced on LLVM mailing list

I announced llvm-abi, a library I created to generate ABI-compliant LLVM IR, on the LLVM mailing list. It seems like other front-end developers are very happy to see this kind of change and are furthermore interested in changes to Clang to expose its ABI code generation functionality to ensure that everyone is using a single high quality code base rather than duplicating the same functionality over and over again.

The llvm-abi library started as a necessity for the Loci compiler, since it needs to generate C functions and must generate code that integrates very closely with C. Unfortunately I found this was a very involved task and required lots of target-dependent logic so I ended up pushing the functionality out of the compiler into a separate library so that other front-ends could benefit and code could be shared.

In the (admittedly unlikely) event that you’re a developer of an LLVM front-end, I strongly recommend using llvm-abi for your ABI compliance needs, particularly since the longer term plan is to have it share code with Clang. If you have any problems just raise an issue on the llvm-abi GitHub project.

Locic 1.1 released!

So the second version of the Loci Compiler Tools is now available (see Loci Compiler), with the main new features being:

  • Switching from C++-like template expansion to use Template Generators (to allow templated APIs across module boundaries)
  • Module imports and exports
  • scope(success), scope(failure) and scope(exit)
  • noexcept
  • Type-templated functions/methods
  • Type aliases
  • assert and unreachable statements
  • Implicit and explicit casts between types using templated methods
  • Standard library memory allocators and smart pointers
  • Standard library containers
  • Standard library strings
  • Vastly improved performance, particularly for Code Generation.
  • A larger set of examples and updates to examples to demonstrate newly implemented features.
  • Significantly improved documentation in reStructuredText using Sphinx, which can generate multiple output formats including HTML and PDF.
  • A much larger set of integrated tests to check both accept and reject cases, as well as testing the standard library.

The release was delayed slightly from the mid-August estimate in order to add support for LLVM 3.5 (so that LLVM 3.3, 3.4 and 3.5 are all supported as backends for Locic), which was initially scheduled for release on the 25th August 2014.

LLVM 3.5’s release has since been re-scheduled for the start of September, so the Locic 1.1 release was modified and tested for compatibility with LLVM 3.5 RC3 (pulled from SVN), which is expected to be near-identical to the actual LLVM 3.5 release.