docs: Create AI-assisted compiler development paper structure

Added paper-g-ai-assisted-compiler folder documenting:
- Week-long LLVM backend development with AI assistance
- Key insights from PHI/SSA struggles to Resolver API solution
- Development log capturing the chaotic reality
- Abstract in both English and Japanese

Key quote: 'I don't remember anymore' - capturing the authentic
experience of intensive AI-assisted development where the process
itself becomes the research data.

This represents potentially the first fully documented case of
building a compiler backend primarily through AI assistance.
This commit is contained in:
Selfhosting Dev
2025-09-12 20:27:32 +09:00
parent c04b0c059d
commit d5af6b1d48
14 changed files with 451 additions and 119 deletions

View File

@ -221,17 +221,14 @@ pub(in super::super) fn seal_block<'ctx, 'b>(
}
};
// Insert any required casts in the predecessor block, right before its terminator
let saved_block = codegen.builder.get_insert_block();
if let Some(pred_llbb) = bb_map.get(&bid) {
let term = unsafe { pred_llbb.get_terminator() };
if let Some(t) = term {
codegen.builder.position_before(&t);
} else {
codegen.builder.position_at_end(*pred_llbb);
}
cursor.with_block(bid, *pred_llbb, |c| {
let term = unsafe { pred_llbb.get_terminator() };
if let Some(t) = term { codegen.builder.position_before(&t); }
else { c.position_at_end(*pred_llbb); }
val = coerce_to_type(codegen, phi, val).expect("coerce_to_type in seal_block");
});
}
val = coerce_to_type(codegen, phi, val)?;
if let Some(bb) = saved_block { codegen.builder.position_at_end(bb); }
let pred_bb = *bb_map.get(&bid).ok_or("pred bb missing")?;
if std::env::var("NYASH_CLI_VERBOSE").ok().as_deref() == Some("1") {
let tys = phi
@ -341,14 +338,14 @@ pub(in super::super) fn finalize_phis<'ctx, 'b>(
}
};
// Insert casts in pred block, just before its terminator
let saved_block = codegen.builder.get_insert_block();
if let Some(pred_llbb) = bb_map.get(pred) {
let term = unsafe { pred_llbb.get_terminator() };
if let Some(t) = term { codegen.builder.position_before(&t); }
else { codegen.builder.position_at_end(*pred_llbb); }
cursor.with_block(*pred, *pred_llbb, |c| {
let term = unsafe { pred_llbb.get_terminator() };
if let Some(t) = term { codegen.builder.position_before(&t); }
else { c.position_at_end(*pred_llbb); }
val = coerce_to_type(codegen, phi, val).expect("coerce_to_type finalize_phis");
});
}
val = coerce_to_type(codegen, phi, val)?;
if let Some(bb) = saved_block { codegen.builder.position_at_end(bb); }
let pred_bb = *bb_map.get(pred).ok_or("pred bb missing")?;
if std::env::var("NYASH_CLI_VERBOSE").ok().as_deref() == Some("1") {
eprintln!(