如何在LLVM中dyn_cast以识别StoreInst?
How to dyn_cast in LLVM to identify StoreInst?
我正在尝试识别StoreInst
.我阅读了LLVM手册,并尝试使用dyn_cast
来做到这一点。但是下面的程序返回非常奇怪的结果。
bool runOnFunction(Function &F) override{
for (const BasicBlock &BB : F){
for (const Instruction &I : BB){
const char *s = I.getOpcodeName();
std::string str(s);
errs()<<"at the instruction of "<<str<<"n";
if (const StoreInst *SI = dyn_cast<StoreInst>(&I))
errs()<<"FOUND STOREn";
}
}
return true;
}
结果如下。 当指令实际上是 CallInst 时,dyn_cast
以某种方式返回 true。有人知道为什么会这样吗?我该如何解决它?顺便说一句,我已经在同一台机器上安装了一些旧版本的 LLVM,但我认为我在 LLVM-7.0.0 下编译了通行证,并通过clang-7 -O0 -S -emit-llvm HelloWorld.cpp
使用 clang-7.0.0 获取 .ll 文件。以前安装的版本会影响此版本吗?谢谢!!
at the instruction of call
at the instruction of call
at the instruction of ret
at the instruction of alloca
FOUND STORE
at the instruction of alloca
FOUND STORE
at the instruction of alloca
FOUND STORE
at the instruction of store
at the instruction of store
at the instruction of store
at the instruction of call
at the instruction of call
at the instruction of ret
at the instruction of call
at the instruction of ret
我怀疑,由于您的传递是FunctionPass
,它在多个函数上并行运行,因此您的日志消息打印顺序不正确。
相关文章:
- 提升 ASIO 无法识别计时器对象
- 如何理解C++标准N3337中的expr.const.cast子句8
- 从udp接收帧对于人脸识别来说太慢
- 模板类无法识别友元运算符
- C++Cast运算符过载
- std::visit无法识别类型
- 无法识别模板功能
- 我有两个类需要在同一 cpp 文件中相互引用,但第一个类无法识别第二个类类型的对象
- 如何在LLVM中dyn_cast以识别StoreInst?
- 从不同的附加依赖项中识别等同命名的函数
- C++出现控制台错误.我无法识别源代码的问题
- VSCode IntelliSense无法识别SDL框架的SDL_image扩展库
- Qt:"Q3DScatter"即使包含在内也无法识别
- 使用指针的类识别
- 如何静态识别动态堆分配?
- 为什么C++无法识别我的对象实例化?
- C++ 无法识别创建进程'telnet'
- 识别 2D 矢量C++中的位置
- 如何识别项目是 QT 中的文件还是文件夹
- ESP32 无法识别任何设备已连接到其接入点