lamina_codegen/lib.rs
1//! lamina-codegen - Codegen utilities for Lamina
2//!
3//! This crate provides code generation utilities including register allocation,
4//! ABI handling, and frame management for various target architectures.
5//!
6//! Cross-compilation is supported: pass the desired target (arch, OS) when
7//! creating ABI or regalloc; the generated code will follow that target's ABI.
8//!
9//! ## Usage
10//!
11//! ```rust
12//! use lamina_codegen::x86_64::{X64RegAlloc, X86ABI, X86Frame};
13//! use lamina_platform::TargetOperatingSystem;
14//!
15//! let abi = X86ABI::new(TargetOperatingSystem::Linux);
16//! let regalloc = X64RegAlloc::new(TargetOperatingSystem::Windows);
17//! ```
18
19pub mod abi;
20pub mod regalloc;
21pub mod target_support;
22
23pub mod aarch64;
24pub mod riscv;
25pub mod wasm;
26pub mod x86_64;
27
28// Re-exports for convenience
29pub use abi::Abi;
30pub use regalloc::{
31 Allocation, GraphColorAllocator, LinearScanAllocator, LiveInterval, PhysRegConvertible,
32 PhysRegHandle, RegisterAllocator, intervals_interfere,
33};
34pub use target_support::{
35 is_assembly_supported, os_uses_coff, os_uses_elf, os_uses_macho,
36 supported_assembly_targets_hint,
37};
38
39// Architecture-specific re-exports
40pub use x86_64::{X64RegAlloc, X86ABI, X86Frame};