Decompilation of LLVM IR
Saarland University
Saarland University, 2011
Recently, in many important domains, high-level languages have become the code representations with widest platform support surpassing any low-level language in their area with respect to completeness and importance as exchange format (e.g. OpenCL for data-parallel computing, GLSL/HLSL for shader programs, JavaScript for the web). The code representations of many actively-developed compiler frameworks [JVM,LLVM,FIRM] are designed for generating low-level machine code. They do, however, offer a broad range of language front-ends and program optimizations. In the scope of this thesis, we implemented a backend that decompiles the intermediate representation (IR) of the Low-Level Virtual Machine (LLVM) framework into a high-level code representation. The approach taken preserves functional program semantics and uses program transformations such as Controlled Node Splitting to restructure arbitrary Control-Flow Graphs. We implemented backends for both OpenCL and GLSL programs, that can decompile 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.
January 31, 2012 by hgpu