Skip to content

Commit

Permalink
Make code_llvm output closer to the actual llvm IR
Browse files Browse the repository at this point in the history
* Finalize GC frames
* Fix function names
  • Loading branch information
yuyichao committed Feb 19, 2016
1 parent 3e7ec53 commit fd636f7
Showing 1 changed file with 6 additions and 0 deletions.
6 changes: 6 additions & 0 deletions src/codegen.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -1371,6 +1371,8 @@ void *jl_get_llvmf(jl_function_t *f, jl_tupletype_t *tt, bool getwrapper, bool g
if (other)
other->eraseFromParent();
#if defined(USE_ORCJIT) || defined(USE_MCJIT)
realize_pending_globals();
finalize_gc_frame(llvmf);
FPM->run(*llvmf);
#endif
llvmf->removeFromParent();
Expand All @@ -1379,11 +1381,15 @@ void *jl_get_llvmf(jl_function_t *f, jl_tupletype_t *tt, bool getwrapper, bool g
}
else {
ValueToValueMapTy VMap;
Function *oldllvmf = llvmf;
llvmf = CloneFunction(llvmf, VMap, false);
#if defined(USE_ORCJIT) || defined(USE_MCJIT)
active_module->getFunctionList().push_back(llvmf);
realize_pending_globals();
finalize_gc_frame(llvmf);
FPM->run(*llvmf);
llvmf->removeFromParent();
llvmf->setName(oldllvmf->getName());
#endif
}
JL_GC_POP();
Expand Down

0 comments on commit fd636f7

Please sign in to comment.