获取 LLVM 模块中的所有值
Getting all Values in LLVM Module
我正在处理分析过程,我需要在模块中找到所有InlineAsm值。
我尝试使用Module::getValueSymbolTable()
但它看起来只包含全局和函数符号。
我还尝试为模块中的每个函数调用Function::getValueSymbolTable()
,但文档不清楚它包含哪些符号,并且似乎仍然缺少我正在寻找的InlineAsm
值。
仅供参考,我目前的(非工作(方法是这样的:
llvm::Module M = ...;
auto &MS = M.getValueSymbolTable();
for (auto it = MS.begin(), end = MS.end(); it != end; ++it) {
if (isa<InlineAsm>(it->second)) {
// do something
}
}
for (auto &F : M) {
auto FS = F.getValueSymbolTable();
for (auto it = FS->begin(), end = FS->end(); it != end; ++it) {
if (isa<InlineAsm>(it->second)) {
// do something
}
}
}
如何获取 llvm 模块上的所有值?
我假设您需要收集所有内联指令(而不是模块级内联汇编器节点(。为此,您需要遍历模块的所有函数。在函数中,您需要遍历所有指令,检查所讨论的指令是否代表InlineAsm指令。像 http://llvm.org/docs/ProgrammersManual.html#iterating-over-the-instruction-in-a-function 这样的东西会有所帮助。
相关文章:
- 尝试导入pybind-opencv模块时出现libgtk错误
- 如何将 I->getType() 作为参数传递给 llvm 中的 CreateCall?
- 将尾部调用void(i32,..)位转换为llvm::函数以获取FnAttribute
- 是否可以将llvm::FunctionType转换为C/C++原始函数指针
- llvm构建器向基本块添加终止符
- 为什么当我解模块化时,这个C++代代码"效率较低"?
- 如果C++对象的类在另一个boost模块中声明,如何使用boost将指向该对象的指针返回到python
- 内联如何影响模块接口中的成员函数
- 如何在 LLVM 模块中调整函数位置
- 获取 LLVM 模块中的所有值
- 如何链接两个LLVM位码模块?
- 为什么llvm ::模块存储在unique_ptr中
- 如何在LLVM传递中的模块末尾插入函数调用?
- 如何在LLVM模块中增加全局变量
- 如何从llvm::模块生成可执行文件
- 将 LLVM 位码加载到模块中:无法将"std::unique_ptr<llvm::Module>"转换为"llvm::Module*"
- 将几个LLVM C++模块链接在一起会在lli中产生segfault
- 如何释放llvm::模块
- 如何在LLVM模块中插入函数
- 在 LLVM 模块中使用C++类