[LLVMdev] Inserting an Intrinsic in LLVM IR

pratik dand pratikdand143 at gmail.com
Mon Jun 23 21:24:33 PDT 2014


Dear,

I have defined an intrinsic in IntrinsicsX86.td and want to insert this
intrinsic in a basic block of IR.

 Module* mod = new Module("test", getGlobalContext());
 BasicBlock* block = BasicBlock::Create(getGlobalContext(), "entry", temp);
 IRBuilder<> builder(block);
 std::vector<Type *> arg_type;
 arg_type.push_back(IntegerType::get(getGlobalContext(),32));
 arg_type.push_back(IntegerType::get(getGlobalContext(),32));

  Function *fun = Intrinsic::getDeclaration(mod,
Intrinsic::int_x86_addenc_32,arg_type);
  Value *recurCall1 = builder.CreateCall2(fun,arg_type[0],arg_type[1]);


The int_addenc_32 instrinsic takes in 2 i32 and returns 1 i32. There is
some problem in the last two lines of my code and I am able to figure it
out.
Any help would be appreciated.

Thanks!

-- 
Pratik
-------------- next part --------------
An HTML attachment was scrubbed...
URL: <http://lists.llvm.org/pipermail/llvm-dev/attachments/20140624/870fa637/attachment.html>


More information about the llvm-dev mailing list