LLVM insert intrinsic function Cos

后端 未结 1 402
无人共我
无人共我 2021-01-06 07:30

I am trying to insert intrinsic cos() function call to LLVM pass. My code in a FunctionPass:

std::vector arg_type;
arg_type.push_back(Type::get         


        
相关标签:
1条回答
  • 2021-01-06 08:12

    I advice you to use IRBuilder. It simplifies IR generation inside LLVM pass. In your case you can use it like that:

    std::vector<Type *> arg_type;
    arg_type.push_back(Type::getFloatTy(getGlobalContext()));
    Function *fun = Intrinsic::getDeclaration(F.getParent(), Intrinsic::cos, arg_type);
    IRBuilder<> Builder(&I);
    Builder.CreateCall(fun, args);
    
    0 讨论(0)
提交回复
热议问题