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.