在使用xcode时常常会遇到这2个概念,今天总结一下。

wiki中关于llvm的描述:

LLVM提供了完整編譯系統的中間層,它會將中間語言(IF, Intermediate form)從編譯器取出與最佳化,最佳化後的IF接著被轉換及鏈結到目標平台的汇编语言。LLVM可以接受來自GCC工具鏈所編譯的IF,包含它底下現存的編譯器。

请参考以下链接,http://www.weiphone.com/apple/blog/2009-09-27/The_heart_of_Snow_Leopard_LLVM_and_Clang_206356.shtml

Clang 和 LLVM 的更多资料,请参看官方文档,http://llvm.org    http://clang.llvm.org

以下是clang tools的简要介绍

DESCRIPTION
clang is a C, C++, and Objective-C compiler which encompasses preprocessing, parsing, optimization, code
generation, assembly, and linking. Depending on which high-level mode setting is passed, Clang will stop
before doing a full link. While Clang is highly integrated, it is important to understand the stages of
compilation, to understand how to invoke it. These stages are:

Driver
The clang executable is actually a small driver which controls the overall execution of other tools
such as the compiler, assembler and linker. Typically you do not need to interact with the driver, but
you transparently use it to run the other tools.

Preprocessing
This stage handles tokenization of the input source file, macro expansion, #include expansion and
handling of other preprocessor directives. The output of this stage is typically called a ".i" (for
C), ".ii" (for C++), ".mi" (for Objective-C) , or ".mii" (for Objective-C++) file.

Parsing and Semantic Analysis
This stage parses the input file, translating preprocessor tokens into a parse tree. Once in the form
of a parser tree, it applies semantic analysis to compute types for expressions as well and determine
whether the code is well formed. This stage is responsible for generating most of the compiler warnings
as well as parse errors. The output of this stage is an "Abstract Syntax Tree" (AST).

Code Generation and Optimization
This stage translates an AST into low-level intermediate code (known as "LLVM IR") and ultimately to
machine code. This phase is responsible for optimizing the generated code and handling target-specific
code generation. The output of this stage is typically called a ".s" file or "assembly" file.

Clang also supports the use of an integrated assembler, in which the code generator produces object
files directly. This avoids the overhead of generating the ".s" file and of calling the target
assembler.

Assembler
This stage runs the target assembler to translate the output of the compiler into a target object file.
The output of this stage is typically called a ".o" file or "object" file.

Linker
This stage runs the target linker to merge multiple object files into an executable or dynamic library.
The output of this stage is typically called an "a.out", ".dylib" or ".so" file.

The Clang compiler supports a large number of options to control each of these stages. In addition to
compilation of code, Clang also supports other tools:

Clang Static Analyzer

The Clang Static Analyzer is a tool that scans source code to try to find bugs through code analysis. This
tool uses many parts of Clang and is built into the same driver.

LLVM,Clang的更多相关文章

  1. LLVM每日谈21 一些编译器和LLVM/Clang代码

    作者:闪亮宁(snsn1984) 一些自己的收藏LLVM/Clang代码,而他自己写一些一点点LLVM/Clang译器的代码.在这里把这些代码库分享出来,欢迎大家交流探讨. 1.crange http ...

  2. llvm+clang编译安装

    最近一段时间在llvm+clang上做一些东西,所以顺便将自己如何编译安装llvm+clang写了篇文章发在这里,希望能帮助刚接触llvm+clang的童鞋少走一些弯路(我刚接触的时候为了编译安装这个 ...

  3. Sublime Text3 & MinGW & LLVM CLang 安装配置C-C++编译环境

    Sublime Text是一款强大的跨平台代码编辑器,小巧而且丰富实用的功能是Visual Studio不能比拟的,但是编译运行是一个软肋,本文通过在sublime中配置g++编译器实现程序的编译功能 ...

  4. Objective-C中的self与LLVM Clang新引入的instancetype

    我们知道,大部分面向对象语言对于一个类的成员方法都有一个隐含的参数.在C++.Java.C#和JavaScript中是this,而在Objective-C中则是self.当然,由于Objective- ...

  5. Linux c++ vim环境搭建系列(2)——Ubuntu18.04.4编译安装llvm clang

    2. 源码编译安装llvm clang 参考网址: https://llvhttps

  6. 编译llvm+clang

    第一步,下载llvm代码: git clone git@github.com:llvm-mirror/llvm.git 第二步,进入llvm/tools目录并下载clang代码 cd llvm/too ...

  7. Windows 7 X64平台编译LLVM+clang

    1 源码包 去LLVM官方网站下载最新的源码,Windows平台下载三个即可(2019.04.24版本为LLVM 8.0.0): LLVM source code (.sig) Clang sourc ...

  8. LLVM/Clang编译相关研究

    https://blog.csdn.net/guojin08/article/details/54310858 https://juejin.im/entry/5c64da44518825620b45 ...

  9. 在Linux下使用LLVM Clang以及Blocks

    可以从这个链接下载:http://llvm.org/releases/download.html sudo apt-get install llvm sudo apt-get install clan ...

随机推荐

  1. poj2752 KMP

    需要理解next[]的意义.之前看到大牛的博客,next[]讲的非常清楚. 利用next[],当前位子的前面那一段和next[当前位子]的前面那一段是相同的.又next[next[当前位子]]与nex ...

  2. 5.Android之image控件学习

    Android中经常用到图片,比如图片浏览.图标等等,今天学习下image控件,image控件主要有ImageButton和ImageView两种. (1)ImageButton 在布局文件增加: & ...

  3. BZOJ-4010 菜肴制作 贪心+堆+(拓扑图拓扑序)

    无意做到...char哥还中途强势插入干我...然后据他所言,看了一会题,一转头,我爆了正解....可怕 4010: [HNOI2015]菜肴制作 Time Limit: 5 Sec Memory L ...

  4. Spring3.2.2之后不赞成使用queryForInt

    原来: public int getMatchCount(String username,String password){ String sql="select count(*) from ...

  5. CF Gym 100685A Ariel

    传送门 A. Ariel time limit per test 2 seconds memory limit per test 256 megabytes input standard input ...

  6. 【ASP.NET Web API教程】6.1 媒体格式化器

    http://www.cnblogs.com/r01cn/archive/2013/05/17/3083400.html 6.1 Media Formatters6.1 媒体格式化器 本文引自:htt ...

  7. 多线程java代码移植到android&下载文本界面的更新

    1)效果演示:

  8. tcp 重发 应用层重传

    采用TCP时,应用层需要超时重传吗? 需要,原因如下: 1 tcp的超时控制不是你能设置的,所有的tcp超时都是用系统的时间设定,而且这个时间很长,超时的结果就是断开连接.和你应用要达到的目的显然差很 ...

  9. 行为Behavior的使用

    原文地址:http://www.it610.com/article/4918541.htm 行为就是继承yii\base\behavior,可以绑定到任意yii\base\compent实例上,然后这 ...

  10. Log4Net日志记录两种方式

     简介 log4net库是Apache log4j框架在Microsoft .NET平台的实现,是一个帮助程序员将日志信息输出到各种目标(控制台.文件.数据库等)的工具.     log4net是Ap ...