Skip to main content

Crate gruel_codegen_llvm

Crate gruel_codegen_llvm 

Source
Expand description

LLVM-based code generation for the Gruel compiler.

This crate converts CFG (Control Flow Graph) to native object code via LLVM IR, using the inkwell crate as safe Rust bindings to LLVM’s C API.

§Build requirements

LLVM 22 must be installed and LLVM_SYS_221_PREFIX or a system llvm-config must be available.

  • On macOS: brew install llvm
  • On Linux: apt install llvm-22-dev

§Pipeline

CFG → LLVM IR (via inkwell) → [opt passes] → object file bytes

Structs§

CodegenInputs
Inputs to LLVM codegen, bundled to keep function signatures readable.

Enums§

OptLevel
Optimization level, following standard compiler conventions.

Functions§

compile_bitcode_to_object
Compile cached or freshly-emitted LLVM bitcode into a native object file.
generate
Generate a native object file from a collection of function CFGs using LLVM.
generate_bitcode
Generate pre-optimization LLVM bitcode from a collection of function CFGs.
generate_ir
Generate LLVM textual IR from a collection of function CFGs.