gpt4 book ai didi

c++ - 将空指针传递给 LLVM IRBuilder CreateCall

转载 作者:搜寻专家 更新时间:2023-10-31 02:09:36 25 4
gpt4 key购买 nike

我正在创建一个 LLVM 函数调用。如何将 void 指针作为参数传递给该调用。我有“_testFunc”作为我的函数,需要传递 void 指针作为参数。

llvm::Function *testFunc= m_mod->getFunction("_testFunc");

llvm::IRBuilder<> builder(instruction.getNextNode());

llvm::Value *arg = argument is void pointer

builder.CreateCall(testFunc, arg);

所以这个 arg 必须是一个空指针。

最佳答案

LLVM IR 中没有“void*”类型。请改用 i8*。

如果你想指定“void*”的实际值,只需创建一个常量整数并转换为 i8*(这有点复杂它确实可以,但这是唯一的方法)。

否则,如果您只想要 void* 的类型,请使用 i8*

关于c++ - 将空指针传递给 LLVM IRBuilder CreateCall,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/46437409/

25 4 0
Copyright 2021 - 2024 cfsdn All Rights Reserved 蜀ICP备2022000587号
广告合作:1813099741@qq.com 6ren.com