Expand description
Public API for writer.
Bitcode writer: serializes an IR Module to the LRIR binary format.
§Format
The LRIR (“LLVM-in-Rust IR”) binary format is a custom format designed for
compact, faithful round-trip serialization of a (Context, Module) pair.
Layout:
[4B] magic = 0x4C 0x52 0x49 0x52 ("LRIR")
[4B] version (u32 LE) = 1
[4B] type_count (u32 LE)
[...] type_count × TypeRecord
[4B] const_count (u32 LE)
[...] const_count × ConstRecord
[str] module_name (u32 len + bytes)
[4B] func_count (u32 LE)
[...] func_count × FunctionRecordEach string is encoded as u32 length + UTF-8 bytes (no null terminator).
Optional strings use a 0 length to mean “absent”.
Re-exports§
pub use write_bitcode as write;
Functions§
- write_
bitcode - Serialize
(ctx, module)into the LRIR binary format.