mirror of
https://github.com/pjh456/OxideJS.git
synced 2026-10-23 18:21:13 +08:00
feat: 编译管线/类型层 crate 补全多级日志宏 + 关键路径日志
This commit is contained in:
@@ -11,6 +11,7 @@ oxide_ir = { path = "../oxide_ir" }
|
||||
oxide_cfg = { path = "../oxide_cfg" }
|
||||
oxide_bytecode = { path = "../oxide_bytecode" }
|
||||
oxide_liveness = { path = "../oxide_liveness" }
|
||||
oxide_log = { path = "../oxide_log" }
|
||||
|
||||
[dev-dependencies]
|
||||
oxide_parser = { path = "../oxide_parser" }
|
||||
|
||||
@@ -0,0 +1,37 @@
|
||||
//! DCE 日志宏:`dce_error!/warn!/info!/debug!/trace!`,经由 oxide_log 上报。
|
||||
//! 编译管线属 Kernel 子系统,`OXIDE_LOG=oxide::kernel=debug` 控制本 crate 日志。
|
||||
|
||||
#[macro_export]
|
||||
macro_rules! dce_error {
|
||||
($($arg:tt)*) => {
|
||||
oxide_log::__log_event!("oxide::kernel", oxide_log::tracing::Level::ERROR, $($arg)*)
|
||||
};
|
||||
}
|
||||
|
||||
#[macro_export]
|
||||
macro_rules! dce_warn {
|
||||
($($arg:tt)*) => {
|
||||
oxide_log::__log_event!("oxide::kernel", oxide_log::tracing::Level::WARN, $($arg)*)
|
||||
};
|
||||
}
|
||||
|
||||
#[macro_export]
|
||||
macro_rules! dce_info {
|
||||
($($arg:tt)*) => {
|
||||
oxide_log::__log_event!("oxide::kernel", oxide_log::tracing::Level::INFO, $($arg)*)
|
||||
};
|
||||
}
|
||||
|
||||
#[macro_export]
|
||||
macro_rules! dce_debug {
|
||||
($($arg:tt)*) => {
|
||||
oxide_log::__log_event!("oxide::kernel", oxide_log::tracing::Level::DEBUG, $($arg)*)
|
||||
};
|
||||
}
|
||||
|
||||
#[macro_export]
|
||||
macro_rules! dce_trace {
|
||||
($($arg:tt)*) => {
|
||||
oxide_log::__log_event!("oxide::kernel", oxide_log::tracing::Level::TRACE, $($arg)*)
|
||||
};
|
||||
}
|
||||
@@ -13,6 +13,7 @@
|
||||
//! 精确二轮 `dce_precise`:liveness 驱动的死指令 + 局部死 STORE_VAR 删除,
|
||||
//! 消费 `oxide_liveness::LiveInfo`,mark-sweep 重建复用 Pass C。
|
||||
|
||||
mod dce_log;
|
||||
mod iter_sweep;
|
||||
mod precise_sweep;
|
||||
mod reachability;
|
||||
@@ -31,6 +32,8 @@ pub fn dce(f: &mut IRFunction) {
|
||||
let mut keep = reachability::pass_a_reachable(f);
|
||||
// Pass B:可达存活指令上全函数 use 计数迭代删除到不动点(连锁删上游写者)。
|
||||
iter_sweep::pass_b_dead_code(f, &mut keep);
|
||||
let dead = keep.iter().filter(|k| !**k).count();
|
||||
dce_info!("DCE: removing {} dead instructions", dead);
|
||||
// Pass C:mark-sweep 一次性重建 insts + label_pos 重映射。
|
||||
rebuild::pass_c_sweep(f, &keep);
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user