A university student that successfully wrote OpenCL and GLSL back-ends to the Low Level Virtual Machine (LLVM) is arranging to have the code open-sourced if there is interest, which already LLVM developers are requesting.
Simon Moll, a German developer wrote the OpenCL LLVM back-end for his thesis at Saarland University. He also wrote an LLVM back-end for the GL Shading Language.
He mentions these details in this LLVM mailing list message
. His thesis with all of the LLVM engineering details can be found on the university website
(PDF). "We implemented backends for both OpenCL and GLSL programs, that can de-compile LLVM-Bitcode with some constraints (mostly due to unsupported data-types). The final evaluation shows that the performance of decompiled OpenCL matches that of reference OpenCL programs in most cases."
This is actually quite interesting work since the OpenCL program is generated from the LLVM bit-code, which is derived from whatever high-level language was passed to the Low-Level Virtual Machine. From the thesis, "The back-end should be restricted as little as possible to specific high-level languages.
This was realized by separating the recovery of high-level control-flow from the generation of target language code. However, the target languages need to be imperative."
The Open Compute Language back-end targets OpenCL 1.0, but likely could be updated to support the newer OpenCL 1.1 revision.
Within the OpenCL/graphics world, LLVM is already used by AMD for their proprietary OpenCL/Stream implementation, is used by parts of Gallium3D, and is being used for the OpenCL state tracker
Check out the thesis
while this code to these LLVM back-ends will hopefully be open-sourced soon.