feat: 编译管线/类型层 crate 补全多级日志宏 + 关键路径日志

This commit is contained in:
2026-08-10 17:56:28 +08:00
parent 9fa8ae5b5f
commit 8a53bfb584
34 changed files with 421 additions and 1 deletions
+1
View File
@@ -11,6 +11,7 @@ oxide_ir = { path = "../oxide_ir" }
oxide_liveness = { path = "../oxide_liveness" }
oxide_bytecode = { path = "../oxide_bytecode" }
oxide_cfg = { path = "../oxide_cfg" }
oxide_log = { path = "../oxide_log" }
[dev-dependencies]
oxide_parser = { path = "../oxide_parser" }
+2
View File
@@ -10,6 +10,7 @@ mod alloc_map;
mod color;
mod finish;
mod graph;
mod regalloc_log;
mod rewrite;
pub use alloc_map::{Alloc, AllocMap, FreshKind, FreshVreg, SpillPlan};
@@ -50,6 +51,7 @@ pub fn alloc(f: &mut IRFunction, live: &LiveInfo) -> Result<(), String> {
oxide_liveness::liveness(f, &cfg)
};
let map = color(f, &live)?;
regalloc_debug!("alloc: {} vregs -> {} phys", map.map.len(), map.phys_peak);
rewrite::run(f, &map);
finish::run(f, &map);
for child in &mut f.nested {
+37
View File
@@ -0,0 +1,37 @@
//! RegAlloc 日志宏:`regalloc_error!/warn!/info!/debug!/trace!`,经由 oxide_log 上报。
//! 编译管线属 Kernel 子系统,`OXIDE_LOG=oxide::kernel=debug` 控制本 crate 日志。
#[macro_export]
macro_rules! regalloc_error {
($($arg:tt)*) => {
oxide_log::__log_event!("oxide::kernel", oxide_log::tracing::Level::ERROR, $($arg)*)
};
}
#[macro_export]
macro_rules! regalloc_warn {
($($arg:tt)*) => {
oxide_log::__log_event!("oxide::kernel", oxide_log::tracing::Level::WARN, $($arg)*)
};
}
#[macro_export]
macro_rules! regalloc_info {
($($arg:tt)*) => {
oxide_log::__log_event!("oxide::kernel", oxide_log::tracing::Level::INFO, $($arg)*)
};
}
#[macro_export]
macro_rules! regalloc_debug {
($($arg:tt)*) => {
oxide_log::__log_event!("oxide::kernel", oxide_log::tracing::Level::DEBUG, $($arg)*)
};
}
#[macro_export]
macro_rules! regalloc_trace {
($($arg:tt)*) => {
oxide_log::__log_event!("oxide::kernel", oxide_log::tracing::Level::TRACE, $($arg)*)
};
}