LLVM 本机代码生成

发布于 2025-01-06 03:49:33 字数 111 浏览 3 评论 0原文

如何使用llvm生成本机代码?

如果可能的话,可以使用 Haskell 绑定来完成吗?

upd:我的意思是生成不在内存中的代码,我的意思是如何生成代码,例如将其保存到文件中。

How is native code generated using llvm?

If it is possible, can it be done using a Haskell binding?

upd: I mean generate code not in memory, I mean how to generate code and for example save it to file.

如果你对这篇内容有疑问,欢迎到本站社区发帖提问 参与讨论,获取更多帮助,或者扫码二维码加入 Web 技术交流群。

扫码二维码加入Web技术交流群

发布评论

需要 登录 才能够评论, 你可以免费 注册 一个本站的账号。

评论(1

可可 2025-01-13 03:49:33

LLVM 是一种编译器基础设施,通过处理其内部语言(由编译器作为文本源或内存中生成)来生成本机代码表示——在将其转换并链接到最终的本机代码之前,通过各种优化和转换。所以,是的,LLVM 可以生成本机代码;事实上,这就是它的主要目的。

Haskell 有一个绑定到 LLVM 库。您可以使用 writeBitcodeToFile< 生成 LLVM 位码文件/代码>;然后,llvm-ld 可以将它们链接到本机代码中。

LLVM is a compiler infrastructure that generates native code by processing its internal language — produced by compilers as textual source or an in-memory representation — through a wide variety of optimisations and transformations before converting and linking it into the final native code. So, yes, LLVM can generate native code; in fact, that's its primary purpose.

There is a binding to the LLVM library for Haskell. You can produce LLVM bitcode files with writeBitcodeToFile; llvm-ld can then link those into native code.

~没有更多了~
我们使用 Cookies 和其他技术来定制您的体验包括您的登录状态等。通过阅读我们的 隐私政策 了解更多相关信息。 单击 接受 或继续使用网站,即表示您同意使用 Cookies 和您的相关数据。
原文