LLVM中编译单元的正确抽象是什么? [英] what is the right abstraction for compilation unit in LLVM?

查看:253
本文介绍了LLVM中编译单元的正确抽象是什么?的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

在LLVM中,我们有 LLVMContext ,这是存储的单位,我们有 llvm :: Module ,这是建立新符号(函数和类型)的地方。



我的问题是;什么是正确的llvm抽象用于编译单元?是模块?或者这实际上意味着一个更大的范围,即:共享库目标



在我看来,编译单元必须满足一个全有或无结果;或者它编译其所有内容而没有错误,或者存在错误,并且在CU中的任何符号可用之前需要被修复并再次构建。在我的头,这是一个编译单元应该表示的定义



如果模块是CU的正确抽象,我如何在其他编译)模块对象到一个要构建的新模块,以便能够找到它们?我需要添加声明或有其他一些快速的方式吗?



指向 clang中的相关行会有很大帮助

解决方案

模块是编译单元的正确抽象。您可以将模块链接在一起进行整个程序分析。


in LLVM we have the LLVMContext, which is the unit of storage, and we have the llvm::Module, which is where new symbols (functions and types) are built.

my question is; what is the right llvm abstraction to use for compilation units? is the Module? or is this actually meant for a bigger scope, i.e: a shared library target

It seems to me that a compilation unit must satisfy an all-or-nothing result; either it compiles all its content without errors, or either there are errors and it needs to be fixed and built again before any symbols in the CU are usable. In my head, this is the definition of what a compilation unit should represent

if module is the right abstraction for the CU, how do i present the symbols in other (correctly compiled) Module objects to a new module about to be built, in order that it is able to find those? do i need to add declarations or is there some other expedite way for this?

a point to a relevant line in clang would be of great help

解决方案

The Module is the correct abstraction for a compile unit. You can link together modules to do whole program analysis from there.

这篇关于LLVM中编译单元的正确抽象是什么?的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

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