llvm2c
llvm2c copied to clipboard
Decompiler of LLVM bitcode to C
llvm2c
Translation of LLVM bitcode to C
Dependencies
The only requirements are CMake in version at least 3.1 and LLVM 5 or newer. The project is not compilable on older LLVM's at the moment. (Patches are welcome :smile:)
Building
git clone https://github.com/staticafi/llvm2c
cd llvm2c
mkdir build
cd build
cmake .. -DCMAKE_INSTALL_PREFIX=installation/path/
make
Testing
Just run make check.
Testing with CSmith
To test llvm2c with csmith:
- compile
csmithandllvm2c - copy
csmith/src/csmithbinary totest/folder - copy
csmith/runtimetotest/folder and rename it tocsmith-runtime cd test/mkdir csmith-tests/./csmith_testing.py
The script generates 1000 testing programs. Each program is translated to LLVM
via clang and then back to C via llvm2c. The only thing that is currently
tested is, that llvm2c binary does not crash.
Unsupported features
- vector instructions
- atomic operations
- some special intrinsics
- the code generation is currently fitted to x86_64 bitcode