I'm trying to write a small JIT for a language that is slightly different than the JIT tutorial. I've gotten a good ways through it, but I'm stuck at this point:
Translated:
function u0:0() system_v {
block0:
v0 = iconst.i64 5
v1 = iadd v0, v0
v2 = imul v1, v0
return v2
}
Error: Compilation error: Verifier errors
from these lines in my JIT:
let id = self
.module
.declare_function("main", Linkage::Export, &self.ctx.func.signature)
.map_err(|e| eyre!(e.to_string()))?;
self.module
.define_function(id, &mut self.ctx)
.map_err(|e| eyre!(e.to_string()))?;
So now, I'm done with function building -- and I'm heading towards creating a ptr to the machine code, etc.
Is there any way to figure out what specific part of the IR the verifier is upset by?
Edit: I figured out the error here (an issue with my signature) -- but still curious about info from verifier.
You have to use the cranelift_codegen::pretty_error
function for that. It accepts a CodegenError
and a Function
and then prints something like under the VerifierErrors section at https://github.com/bjorn3/rustc_codegen_cranelift/issues/970 (you need to click on it to expand)
Thank you!
Last updated: Dec 23 2024 at 12:05 UTC