[LLVMdev] How to produce a "Intrinsic Function" call instruction?

张超 gausszhch at gmail.com
Thu Jul 30 01:38:11 PDT 2009


Hi, all.
I have noticed that LLVM supports some Intrinsic Functions such as *"**
llvm.sadd.with.overflow"* described in
http://llvm.org/docs/LangRef.html#int_sadd_overflow. We can use these
functions and needn't define the function bodies.

For example, I can manually insert codes:

    * %res = call {i32, i1} @llvm.sadd.with.overflow.i32(i32 %a, i32 %b)
     %sum = extractvalue {i32, i1} %res, 0
     %obit = extractvalue {i32, i1} %res, 1
     br i1 %obit, label %overflow, label %normal*

into an assembly file, and it works OK.

And now, my question is "How to produce such a call instruction using the
LLVM classes?"

I have also noticed that LLVM provides some classes like "*MemCpyInst"* to
wrap the "*llvm.memcpy"* Intrinsic. But other intrinsic functions such as *"
**llvm.sadd.with.overflow"* I've mentioned above don't have the
corresponding classes. How to deal with it?

Anyone could help me? Thank you!
-------------- next part --------------
An HTML attachment was scrubbed...
URL: <http://lists.llvm.org/pipermail/llvm-dev/attachments/20090730/3b6011a4/attachment.html>


More information about the llvm-dev mailing list