<html>
  <head>
    <meta content="text/html; charset=ISO-8859-1"
      http-equiv="Content-Type">
  </head>
  <body bgcolor="#FFFFFF" text="#000000">
    <br>
    <div class="moz-cite-prefix">On 06/23/2014 09:24 PM, pratik dand
      wrote:<br>
    </div>
    <blockquote
cite="mid:CAJFa+mSV4wn7PGFkqJx8HSDvBe8NNVp6y4BskVr9+iL7CRj1SA@mail.gmail.com"
      type="cite">
      <div dir="ltr">
        <div>Dear,<br>
          <br>
        </div>
        I have defined an intrinsic in IntrinsicsX86.td and want to
        insert this intrinsic in a basic block of IR.<br>
        <br>
         Module* mod = new Module("test", getGlobalContext());<br>
         BasicBlock* block = BasicBlock::Create(getGlobalContext(),
        "entry", temp);<br>
         IRBuilder<> builder(block);<br clear="all">
        <div>
          <div> std::vector<Type *> arg_type;<br>
 arg_type.push_back(IntegerType::get(getGlobalContext(),32));<br>
 arg_type.push_back(IntegerType::get(getGlobalContext(),32));<br>
              <br>
              Function *fun = Intrinsic::getDeclaration(mod,
            Intrinsic::int_x86_addenc_32,arg_type);<br>
          </div>
        </div>
      </div>
    </blockquote>
    You only need to specify the argument types if your intrinsic uses
    an "any" type in it's definition.  Given what you described, it
    doesn't sound like you need to.  You should drop the last argument.<br>
    <blockquote
cite="mid:CAJFa+mSV4wn7PGFkqJx8HSDvBe8NNVp6y4BskVr9+iL7CRj1SA@mail.gmail.com"
      type="cite">
      <div dir="ltr">
        <div>
          <div>  Value *recurCall1 =
            builder.CreateCall2(fun,arg_type[0],arg_type[1]);<br>
          </div>
        </div>
      </div>
    </blockquote>
    Your argument to CreateCall2 are wrong.  You need to pass the Values
    representing your arguments, not the Types representing the types of
    those arguments.  <br>
    <blockquote
cite="mid:CAJFa+mSV4wn7PGFkqJx8HSDvBe8NNVp6y4BskVr9+iL7CRj1SA@mail.gmail.com"
      type="cite">
      <div dir="ltr">
        <div>
          <div><br>
            <br>
          </div>
          <div>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.<br>
          </div>
          <div>Any help would be appreciated.<br>
          </div>
        </div>
      </div>
    </blockquote>
    In general, providing the stack trace or error messages would help. 
    Didn't need them in this case, but it will help you get better
    responses in the future.  <br>
    <blockquote
cite="mid:CAJFa+mSV4wn7PGFkqJx8HSDvBe8NNVp6y4BskVr9+iL7CRj1SA@mail.gmail.com"
      type="cite">
      <div dir="ltr">
        <div>
          <div><br>
          </div>
          <div>Thanks!<br>
          </div>
          <div><br>
            -- <br>
            Pratik
            <div><br>
            </div>
          </div>
        </div>
      </div>
      <br>
      <fieldset class="mimeAttachmentHeader"></fieldset>
      <br>
      <pre wrap="">_______________________________________________
LLVM Developers mailing list
<a class="moz-txt-link-abbreviated" href="mailto:LLVMdev@cs.uiuc.edu">LLVMdev@cs.uiuc.edu</a>         <a class="moz-txt-link-freetext" href="http://llvm.cs.uiuc.edu">http://llvm.cs.uiuc.edu</a>
<a class="moz-txt-link-freetext" href="http://lists.cs.uiuc.edu/mailman/listinfo/llvmdev">http://lists.cs.uiuc.edu/mailman/listinfo/llvmdev</a>
</pre>
    </blockquote>
    <br>
  </body>
</html>