Skip to content

Instantly share code, notes, and snippets.

View willtebbutt's full-sized avatar

Will Tebbutt willtebbutt

View GitHub Profile
@oxinabox
oxinabox / example.jl
Last active January 9, 2024 16:02
Running the Julia Compiler pipeline manually
#Helpers:
"Given some IR generates a MethodInstance suitable for passing to infer_ir!, if you don't already have one with the right argument types"
function get_toplevel_mi_from_ir(ir, _module::Module)
mi = ccall(:jl_new_method_instance_uninit, Ref{Core.MethodInstance}, ());
mi.specTypes = Tuple{ir.argtypes...}
mi.def = _module
return mi
end
"run type inference and constant propagation on the ir"