refactor: centralize box type metadata

This commit is contained in:
moe-charm
2025-09-11 04:20:28 +09:00
committed by Selfhosting Dev
parent f124731764
commit c4e1728b8e
9 changed files with 3041 additions and 1515 deletions

View File

@ -1,15 +1,16 @@
/*!
* LLVM Backend Module - Compile MIR to LLVM IR for AOT execution
*
*
* This module provides LLVM-based compilation of Nyash MIR to native code.
* Phase 9.78 PoC implementation focused on minimal "return 42" support.
*/
pub mod context;
pub mod box_types;
pub mod compiler;
pub mod context;
use crate::box_trait::{IntegerBox, NyashBox};
use crate::mir::function::MirModule;
use crate::box_trait::{NyashBox, IntegerBox};
/// Compile MIR module to object file and execute
pub fn compile_and_execute(
@ -21,10 +22,7 @@ pub fn compile_and_execute(
}
/// Compile MIR module to object file only
pub fn compile_to_object(
mir_module: &MirModule,
output_path: &str,
) -> Result<(), String> {
pub fn compile_to_object(mir_module: &MirModule, output_path: &str) -> Result<(), String> {
let compiler = compiler::LLVMCompiler::new()?;
compiler.compile_module(mir_module, output_path)
}
@ -32,11 +30,11 @@ pub fn compile_to_object(
#[cfg(test)]
mod tests {
use super::*;
#[test]
fn test_llvm_module_creation() {
// Basic test to ensure the module can be loaded
// Actual compilation tests require full MIR infrastructure
assert!(true);
}
}
}