用于创建类似于此的指令的LLVM-IR构建器指令是什么:
%call4 = call i32 (i32, ...)* bitcast (i32 (...)* @sleep to i32 (i32, ...)*)(i32 3)
有没有办法直接调用@sleep或者我需要为它创建一个新函数吗?
答案 0 :(得分:0)
ConstantInt * sleepArg = ConstantInt :: get(IntegerType :: get(getGlobalContext(),sizeof(unsigned)* 8),2,true);
std::vector<Value*> args2;
args2.push_back(sleepArg);
Constant *D = M.getOrInsertFunction("sleep",
IntegerType::get(getGlobalContext(), sizeof(unsigned) * 8),
IntegerType::get(getGlobalContext(), sizeof(unsigned) * 8), NULL);