简体   繁体   English

llvm jit编译为二进制

[英]llvm jit compile to binary

Is it possible somehow to write a compiler producing LLVM IR code which user will JIT compile and after compiling it in memory it would be written to disk as binary file? 是否可能以某种方式编写一个生成LLVM IR代码的编译器,用户将JIT对其进行编译,并在内存中将其作为二进制文件写入磁盘?

The idea behind this scenario is that I dont want to compile LLVM IR code and let users to execute it immediately (with lower performance due to JIT compiling). 这种情况下的想法是,我不想编译LLVM IR代码,而是让用户立即执行它(由于JIT编译性能较低)。 But I want that when users execute this program second time it would be already compiled? 但是我希望当用户第二次执行该程序时,它已经被编译了吗?

So the question is how to reuse code produced by JIT when generating native binaries? 那么问题是在生成本机二进制文件时如何重用JIT生成的代码? I doubt there is API to do this, but remembering how MC JIT works, it might be relatively easy to implement. 我怀疑是否有API可以做到这一点,但是记住MC JIT的工作原理,它可能相对容易实现。

But from my POV it's better to jsut compile LLVM IR into native code on the second run. 但是从我的POV来看,最好在第二次运行时将LLVM IR编译为本机代码。

声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM