LLVM编译器和命名 [英] LLVM and compiler nomenclature

查看:185
本文介绍了LLVM编译器和命名的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

我期待到LLVM的系统,我已经通过入门文档的读取。然而,一些术语(和铛例子措辞)仍然是一个有点混乱。下列术语和命令编译过程的一部分,我想知道是否有人也许能好一点解释它们对我来说:

I am looking into the LLVM system and I have read through the Getting Started documentation. However, some of the nomenclature (and the wording in the clang example) is still a little confusing. The following terms and commands are all part of the compilation process, and I was wondering if someone might be able to explain them a little better for me:


  • 铛-S 铛-c (我知道是什么 -c 做,但怎么做的结果有什么不同?)* (编辑)

  • LLVM位code与LLVM IR(有什么区别?)

  • .ll文件与文件.BC(它们是什么,他们是如何不同?)

  • LLVM组装code 的主场迎战的本地组装code 的(是有区别吗?)

  • clang -S vs. clang -c (I know what -c does, but how do the results differ?) * (Edit)
  • LLVM Bitcode vs. LLVM IR (what is the difference?)
  • .ll files vs. .bc files (what are they, how do they differ?)
  • LLVM assembly code vs. native assembly code (is there a difference?)

在一个较高的水平,我了解整个编译过程,并且可以通过跟踪我的方式的非常的很好,我只是陷在一些点在哪里,比如,我期待看到IR ,而是看到位code或LLVM汇编,这使我觉得我不明白他们几乎和我一样应该!

At a higher level, I understand the overall compilation process, and can track my way through fairly well, I just get stuck at some points where, for example, I am expecting to see "IR", but instead see "bitcode" or "LLVM assembly" which leads me to think I don't understand them nearly as well as I should!

推荐答案

在一般情况下,锵接受相同的命令行选项GCC。在 -c 选项(只编译和汇编,不链接)和 -S 选项(只编译,不汇编或链接)意味着同样的事情在这两个。

Clang usage

In general, Clang accepts the same command-line options as GCC. The -c option (only compile and assemble, do not link) and -S option (only compile, do not assemble or link) mean the same thing in both.

要从我的另一个回答在这个网站

LLVM IR通常存储在磁盘上以文本文件, .ll 延长或与 .BC 扩展二进制文件。两者之间的转换是微不足道的,你可以只使用 LLVM-DIS 对于 BC - > LL LLVM,为 LL - > BC 。二进制格式更多的内存效率,而文本格式是人类可读的。

LLVM IR is typically stored on disk in either text files with .ll extension or in binary files with .bc extension. Conversion between the two is trivial, and you can just use llvm-dis for bc -> ll and llvm-as for ll -> bc. The binary format is more memory-efficient, while the textual format is human-readable.

在另外的,也有一些常用的别名:

In additional, there are some commonly-used aliases:


  • 的二进制格式,存储在 .BC 文件,也被称为位code (虽然我偶尔听到的术语位code 适用于一般IR以及)

  • 红外也叫 LLVM组装的LLVM汇编语言

  • The binary format, stored in .bc files, is also called bitcode (though I've occasionally heard the term "bitcode" applied to the general IR as well)
  • The IR also called LLVM assembly or the LLVM assembly language

在任何情况下,这一切都意味着同样的事情,在潜在的不同重新presentations。

In any case, it all means the same thing, under potentially different representations.

本地组装是很多一般认为听到这个词集结号的时候约 - 几乎1低级语言:1映射到你的本机二进制文件,而不像LLVM总成,本土组装是的非常的目标相关的(例子是x86汇编,ARM汇编等)。本机组件通过汇编组装成机二进制 - LLVM不包括一个,但你也可以使用其他汇编以及(如气体

Native assembly is what many typically think about when hearing the term "assembly" - the low-level language with almost 1:1 mapping to your native machine binary, and unlike LLVM assembly, native assembly is very target-dependent (examples are x86 assembly, ARM assembly, etc.). Native assembly is assembled into native binary via an assembler - LLVM does include one, though you can also use other assemblers as well (e.g. gas).

本机二进制 - 装配过程的结果 - 当然是(只)语言的计算机很清楚的说明,以及连接后可以加载到内存中,并在您的硬件直接跑

Native binary - the result of the assembling process - is of course the (only) language the computer really speaks, and after linking it can be loaded into memory and be ran directly on your hardware.

这篇关于LLVM编译器和命名的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

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