pub unsafe fn compile(
    context: LLVMContextRef,
    module: LLVMModuleRef,
    mappings: &[intrinsic::Mapping],
    conf: &ParsedConf,
    stats: &mut CompilationStats,
) -> WeldResult<CompiledModule> {
    init();

    let start = PreciseTime::now();
    verify_module(module)?;
    let end = PreciseTime::now();
    stats
        .llvm_times
        .push(("Module Verification".to_string(), start.to(end)));

    let start = PreciseTime::now();
    optimize_module(module, conf)?;
    let end = PreciseTime::now();
    stats
        .llvm_times
        .push(("Module Optimization".to_string(), start.to(end)));

    let start = PreciseTime::now();
    // Takes ownership of the module.
    let engine = create_exec_engine(module, mappings, conf)?;
    let end = PreciseTime::now();
    stats
        .llvm_times
        .push(("Create Exec Engine".to_string(), start.to(end)));

    let start = PreciseTime::now();
    let run_func = find_function(engine, &conf.llvm.run_func_name)?;
    let end = PreciseTime::now();
    stats
        .llvm_times
        .push(("Find Run Func Address".to_string(), start.to(end)));

    let result = CompiledModule {
        context,
        module,
        engine,
        run_function: run_func,
    };
    Ok(result)
}
Compile a constructed module in the given LLVM context.
weld/src/codegen/llvm2/jit.rs