This silly compiler project has been slowly cranking along... back in 2022 I paused things a bit, deciding I needed to back up and rethink the whole approach to bootstrapping and self hosting... having finally accomplished that to my satisfaction I'm now returning to the SSA IR and other goodies I was playing with when the original iteration reached a level of too-messy-to-want-to-continue-as-is.
The code is looking tidier in the new iteration of things, so yay, progress.
![fn inst_disasm(os OutStream, ins Inst) {
var op u32 = ins.op & INS_OP_MASK;
if op == INS_LABEL {
os.fmt("@:").label(ins.a);
} else if op == INS_MOV {
os.fmt(" mov @, @").reg(ins.a).arg(ins.c,ins.op);
} else if (op == INS_LD) | (op == INS_ST) {
var sz str = isz_name[(ins.op & INF_SZ_MASK) >> INF_SZ_SHIFT];
os.fmt(" @@ @, [@, @]").s(iop_name[op]).s(sz).reg(ins.a).reg(ins.b).arg(ins.c,ins.op);
} else if op <= INS_PHI {
os.fmt(" @ @, @, @").s(iop_name[op]).reg(ins.a).reg(ins.b).arg(ins.c,ins.op);
} else if op == INS_B {
os.fmt(" b @").label(ins.a);
} else if (op >= INS_BEQ) && (op <= INS_BGE) {
os.fmt(" @ @, @, @").s(iop_name[op]).label(ins.a).reg(ins.b).arg(ins.c,ins.op);
} else if op == INS_CALL {
os.fmt(" call @").label(ins.a);
} else if op == INS_RET {
os.fmt(" ret @").reg(ins.a);
} else {
os.fmt(" inval 0x@").x(ins.op);
}
}](https://files.mastodon.social/cache/media_attachments/files/116/185/575/361/911/035/small/2b291a7ba2510dca.png)












