检测LLVM中的整数比较条件

问题描述 投票:1回答:1
#include <stdio.h>
#include <string.h>

int main (){
    unsigned short int a = 10;
    if (a == 10){
     //something
    }
}

在LLVM传递中,我如何检测2个操作数整数比较条件语句,如上所示:(a == 10)?请让我知道我应该在LLVM api中寻找什么。

c++ llvm llvm-clang llvm-ir llvm-c++-api
1个回答
0
投票

你在那里有一个ICmpInst,其操作数是整数。由于两个操作数必须具有相同的类型,因此isa<ICmpInst>(foo) && isa<IntegerType>(foo->getOperand(0))足以识别特定指令是否是您要检测的类型。

© www.soinside.com 2019 - 2024. All rights reserved.