minirust
minirust copied to clipboard
Minitest: make writing tests more ergonomic
Currently, the tests in minitest
do all management of local names / basic block IDs / function names "by hand". That's not very ergonomic. We should come up with APIs (somewhat similar to rustc codegen) that let us write tests more ergonomically.
I am imagining something roughly like this:
let mut p = ProgramBuilder::new();
let mut f = p.function();
let var = f.local::<u32>();
f.storage_live(var);
f.atomic_store(addr_of_constptr(var), const_int(1u32));
f.exit();
p.finish_function(f);
For straight-line code (including function pointers), we don't have to talk about basic blocks at all. For if-then-else we need something slightly lower-level, details TBD.