创建睡眠();使用 llvm IRbuilder 调用
Create sleep(); call Using llvm IRbuilder
什么是 LLVM-IR 构建器指令来创建与此类似的指令:
%call4 = call i32 (i32, ...)* bitcast (i32 (...)* @sleep to i32 (i32, ...)*)(i32 3)
有没有办法直接调用@sleep,或者我需要为它创建一个新函数吗?
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);
什么是 LLVM-IR 构建器指令来创建与此类似的指令:
%call4 = call i32 (i32, ...)* bitcast (i32 (...)* @sleep to i32 (i32, ...)*)(i32 3)
有没有办法直接调用@sleep,或者我需要为它创建一个新函数吗?
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);