llvm: unify lowering via Resolver and Cursor; remove non-sealed PHI wiring; apply Resolver to extern/call/boxcall/arrays/maps/mem; add llvmlite harness docs; add LLVM layer overview; add LoopForm preheader

This commit is contained in:
Selfhosting Dev
2025-09-12 20:40:48 +09:00
parent d5af6b1d48
commit 38aea59fc1
20 changed files with 986 additions and 79 deletions

View File

@ -222,7 +222,20 @@ impl LLVMCompiler {
for inst in &block.instructions {
match inst {
MirInstruction::NewBox { dst, box_type, args } => {
instructions::lower_newbox(&codegen, &mut cursor, *bid, &mut vmap, *dst, box_type, args, &box_type_ids)?;
instructions::lower_newbox(
&codegen,
&mut cursor,
&mut resolver,
*bid,
&mut vmap,
*dst,
box_type,
args,
&box_type_ids,
&bb_map,
&preds,
&block_end_values,
)?;
defined_in_block.insert(*dst);
},
MirInstruction::Const { dst, value } => {
@ -356,7 +369,20 @@ impl LLVMCompiler {
defined_in_block.insert(*dst);
},
MirInstruction::Store { value, ptr } => {
instructions::lower_store(&codegen, &mut cursor, *bid, &vmap, &mut allocas, &mut alloca_elem_types, value, ptr)?;
instructions::lower_store(
&codegen,
&mut cursor,
&mut resolver,
*bid,
&vmap,
&mut allocas,
&mut alloca_elem_types,
value,
ptr,
&bb_map,
&preds,
&block_end_values,
)?;
},
MirInstruction::Load { dst, ptr } => {
instructions::lower_load(&codegen, &mut cursor, *bid, &mut vmap, &mut allocas, &mut alloca_elem_types, dst, ptr)?;