Skip to content

staticafi/llvm2c

 
 

Folders and files

NameName
Last commit message
Last commit date

Latest commit

 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 

Repository files navigation

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 😄)

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:

  1. compile csmith and llvm2c
  2. copy csmith/src/csmith binary to test/ folder
  3. copy csmith/runtime to test/ folder and rename it to csmith-runtime
  4. cd test/
  5. mkdir csmith-tests/
  6. ./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

Authors

Packages

No packages published

Languages

  • C++ 79.0%
  • C 17.9%
  • CMake 1.9%
  • Other 1.2%