This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
#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" |