$ show JuliaHubOSS/llvm-cbe
llvm-cbe is a resurrected LLVM C backend that converts LLVM Intermediate Representation (IR) into compilable C code. It operates as both a library (implementing an LLVM target machine) and a command-line tool (llvm-cbe) that reads LLVM bitcode or IR and outputs C source files. The core is the CWriter pass, which handles type lowering, instruction translation, and generation of C-compatible code including structs, arrays, vectors, and intrinsics. It supports a wide range of LLVM features such as atomic operations, vector instructions, and various calling conventions, and includes extensive test suites (C, C++, and LLVM IR tests) to verify correctness across multiple optimization levels and compilers (GCC, Clang, MSVC). The project is actively maintained, targeting LLVM 22, and is used primarily in scenarios where C code generation is needed from LLVM IR, such as cross-compilation or embedding.
The LLM identified 1 files worth highlighting for reuse:
A simple, generic ID map template that wraps LLVM's DenseMap to assign unique sequential IDs to keys. It is self-contained, reusable in any project needing a monotonically increasing ID assignment for arbitrary key types, and demonstrates clean template usage.