Skip to main content

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 powerpc;
25pub mod riscv;
26pub mod wasm;
27pub mod x86_64;
28
29// Re-exports for convenience
30pub use abi::{Abi, BuiltinLibrary};
31pub use regalloc::{
32    Allocation, GraphColorAllocator, LinearScanAllocator, LiveInterval, LocalRegisterAllocator,
33    LocalRegisterAllocatorDyn, PhysRegConvertible, PhysRegHandle, RegisterAllocator,
34    RegisterAllocatorDyn, intervals_interfere,
35};
36pub use target_support::{
37    is_assembly_supported, os_uses_coff, os_uses_elf, os_uses_macho,
38    supported_assembly_targets_hint,
39};
40
41// Architecture-specific re-exports
42pub use aarch64::{A64RegAlloc, AArch64ABI, FrameMap};
43pub use powerpc::{Ppc64Abi, Ppc64Frame, Ppc64RegAlloc};
44pub use riscv::{RiscVAbi, RiscVFrame, RiscVRegAlloc};
45pub use wasm::{WasmABI, WasmRegAlloc};
46pub use x86_64::{X64RegAlloc, X86ABI, X86Frame};