smokes: add curated LLVM runner; archive legacy smokes; PHI-off unified across Bridge/Builder; LLVM resolver tracing; minimal Throw lowering; config env getters; dev profile and root cleaner; docs updated; CI workflow runs curated LLVM (PHI-on/off)

This commit is contained in:
Selfhosting Dev
2025-09-16 23:49:36 +09:00
parent 97a76c0571
commit 5c9213cd03
104 changed files with 8094 additions and 2930 deletions

View File

@ -767,6 +767,22 @@ impl LLVMCompiler {
instructions::lower_load(&codegen, &mut cursor, *bid, &mut vmap, &mut allocas, &mut alloca_elem_types, dst, ptr)?;
defined_in_block.insert(*dst);
},
MirInstruction::Copy { dst, src } => {
instructions::lower_copy(
&codegen,
&mut cursor,
&mut resolver,
*bid,
func,
&mut vmap,
dst,
src,
&bb_map,
&preds,
&block_end_values,
)?;
defined_in_block.insert(*dst);
},
MirInstruction::Phi { .. } => {
// Already created in pre-pass; nothing to do here.
}
@ -799,6 +815,23 @@ impl LLVMCompiler {
&block_end_values,
)?;
}
MirInstruction::Throw { .. } => {
// Minimal lowering: call llvm.trap (optional) then unreachable
let use_trap = std::env::var("NYASH_LLVM_TRAP_ON_THROW").ok().as_deref() != Some("0");
if use_trap {
let fn_ty = codegen.context.void_type().fn_type(&[], false);
let trap = codegen
.module
.get_function("llvm.trap")
.unwrap_or_else(|| codegen.module.add_function("llvm.trap", fn_ty, None));
cursor.emit_term(*bid, |b| {
let _ = b.build_call(trap, &[], "trap");
});
}
// Ensure we end the block
cursor.at_end(*bid, bb);
let _ = codegen.builder.build_unreachable();
}
MirInstruction::Jump { target } => {
// LoopForm simple body→dispatch wiring: if this block is a loop body
// and jumps back to its header, redirect to dispatch and add PHI incoming