【发布时间】:2017-08-21 14:41:12
【问题描述】:
我是 LLVM 的新手,我想通过示例了解 AllocaInst 的正确用法。我尝试在线搜索,甚至 llvm 网页也没有正确的示例。 下面是我正在尝试执行的代码补丁。
string temp =(dyn_cast<ConstantInt>operand0))->getValue()).toString(10,true);
Type* A = IntegerType::getInt32Ty(F.getContext());
string name = "t"+to_string(++counter);
AllocaInst* variable = new AllocaInst(A,NULL,4,name,&*inst);
当我运行这个时,我会得到一个错误:
错误:没有匹配函数调用 'llvm::AllocaInst::AllocaInst(llvm::Type*&, NULL, int, std::string&, llvm::Instruction*)' AllocaInst* 变量 = 新 AllocaInst(A,NULL,4,name,&*inst);
我想知道如何在 AllcaInst 中提供地址位置。任何帮助将不胜感激。
【问题讨论】:
-
您的 LLVM C++ 库版本是否与您使用的 C++ 标头同步?
-
“4”是干什么用的?
-
这是数组大小。 LLVM C++ 和 C++ 标头同步
标签: c++ llvm llvm-clang llvm-ir