我不知道如何在LLVM中创建ConstantInt-我知道我想要创建的数字,但我不确定如何使ConstantInt表示该数字; 我似乎无法在文档中找到我需要的构造函数.
我认为它必须符合
ConstantInt consVal = new ConstantInt(something here).
Run Code Online (Sandbox Code Playgroud)
我知道我希望它是一个int类型,我知道我的价值......我只想创建一个数字!
我正在写一个LLVM传递(它是一个LoopPass)需要将pthread函数调用(如pthread_create()和pthread_join()插入到IR中.我知道如何创建函数调用并将其插入IR,但是我无法Function*在LLVM中获得pthread表示.
这就是我所拥有的:
Function *pthread_create_func = currentModule->getFunction("pthread_create");
但它返回NULL.
作为比较Function *printf_func = currentModule->getFunction("printf");将返回正确的Function*,允许我将新函数调用printf插入IR.
我有#include "pthread.h"我的传球-pthread之后clang -emit-llvm,但它仍然无法找到pthread_create或其它pthread_*功能莫名其妙.