【问题标题】:getting the error 'no member named 'Int32Ty' while trying to add a new instruction in llvm尝试在 llvm 中添加新指令时出现错误“没有名为“Int32Ty”的成员
【发布时间】:2020-02-01 02:52:29
【问题描述】:

我是 llvm 的新手。我正在尝试添加新指令

namespace{
 struct insert:public FunctionPass{
 static char ID;
 insert():FunctionPass(ID){
 }
 bool runOnFunction(Function &F) override{
 errs()<<"Inserting new instruction\n";
 auto *pa = new AllocaInst(Type::Int32Ty,0,"new_inst");
 //auto *pa = new AllocaInst(llvm::Int32Ty, 0, "indexLoc");
 return false;
 }
 };
 }
 char insert::ID =0;
 static RegisterPass<insert>P("insert","inserting new instruction");

得到错误 /Users/chandanj/llvm/llvm-9.0.0.src/lib/Transforms/Hello/Hello.cpp:89:33:错误:'llvm::Type'中没有名为'Int32Ty'的成员 auto *pa = new AllocaInst(Type::Int32Ty,0,"new_inst"); ~~~~~~^

我使用的是 macbook air。 阅读 llvm 程序员手册

【问题讨论】:

    标签: llvm llvm-clang


    【解决方案1】:

    您正在寻找静态Type::getInt32Ty() 方法。

    【讨论】:

      猜你喜欢
      • 1970-01-01
      • 2019-03-02
      • 2021-07-03
      • 2016-04-13
      • 1970-01-01
      • 1970-01-01
      • 2016-04-16
      • 2020-06-04
      • 2013-10-18
      相关资源
      最近更新 更多