使用LLVM(低级虚拟机)可以为哪个平台编译二进制文件? [英] What platform can I compile binaries for, using LLVM (Low Level Virtual Machine)?

查看:747
本文介绍了使用LLVM(低级虚拟机)可以为哪个平台编译二进制文件?的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

我有兴趣使用LLVM的Clang编译器。 LLVM声称是跨平台,但不清楚哪些平台可以定位。我已经做了相当多的谷歌搜索,但似乎没有很多关于LLVM的支持平台的信息。我唯一发现的是this这是有点令人困惑。我不知道这是否意味着我可以使用LLVM编译这些平台的二进制文件,或者它只是运行在这些平台(或两者)上。有人知道更多关于LLVM / Clang编译器告诉我哪些平台可以使用Clang或任何其他LLVM前端?我需要特定的信息(例如它支持Windows 32位,Windows 64位,Linux 32位,Linux 64位等)。



EDIT:



好吧,我只是困惑于什么LLVM真正是从我刚刚发现LLVM只是一个字节码解释器。由于LLVM解释多少与可执行二进制文件相比,LLVM二进制文件较慢?因此,如果性能很重要,LLVM不是正确的选择?Here我发现它支持的架构,但它没有说它支持什么操作系统。如果我避免平台相关的代码,它运行在所有操作系统?我会寻找更多的文章解释LLVM更详细,如果我可以找到任何。

解决方案

我只是回答编辑的问题(这可能更适合提出一个新问题) p>

是一个很好的建筑概述的LLVM。 此页面还包含大量有关LLVM所有方面的文档。



简短的版本是,LLVM是传统编译器的优化器和后端。它运行在一个字节码,它基本上是代码的中间表示,用于优化和生成最终的二进制。 LLVM前端是独立的,并且使用它们自己的内部AST来最终生成字节码。



当你想生成最终的二进制文件时,LLVM是非常灵活的。您可以立即执行或延迟,直到程序安装。我相信你甚至可以使用它的JIT生成最终的二进制在执行(不是100%确定)。这样延迟的主要优点是它可以应用特定于它正在执行的环境的优化。


I am interested in using the LLVM's Clang compiler. LLVM claims to be cross-platform however it is not clear which platforms can be targeted. I have done quite a lot of Googling on this but there doesn't seem to be much information about LLVM's supported platforms. The only thing I did find was "this" which is kinda confusing. I am not sure if it means I can compile binaries for those platforms using LLVM or if it just runs on those platforms (or both). Could someone who knows more about the LLVM/Clang compiler tell me which platforms I can target using Clang or any other LLVM front ends? I want specific information (like "It supports Windows 32bit, Windows 64bit, Linux 32bit, Linux 64bit, etc). Thanks!

EDIT:

Ok, I think I am just confused about what LLVM really is. From what I just figured out LLVM is simply a byte-code interpreter. Since LLVM is interpreted how much slower is LLVM binaries compared to executable binaries? So if performance is important LLVM is not the right choice? "Here" I found the architectures it supports but it did not say what operating systems it supports. Does it run on all operating systems if I avoid platform dependent code? I will look for more articles that explain LLVM in more detail if I can find any.

解决方案

I'm only answering the edit's question here (it would probably be more appropriate to make a new question).

This is a good architectural overview of LLVM. This page also contains a ton of documentations on all aspects of LLVM.

The short version is that LLVM is the optimizer and backend of a traditionnal compiler. It operates on a bytecode which is essentially it's intermediate representation of the code and is used to optimize and generate the final binary. The LLVM frontends are independent and uses there own internal ASTs to eventually generate bytecode.

LLVM is actually pretty flexible when it comes to when you want to generate the final binary. You can either do it right away or delay it until the program is being installed. I believe you can even use its JIT to generate the final binary during execution (not 100% sure of this). The main advantage of delaying like this is that it can apply optimizations that are specific to the environment it is executing on.

这篇关于使用LLVM(低级虚拟机)可以为哪个平台编译二进制文件?的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

查看全文
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆