Dipanjan Das via llvm-dev
2015-Sep-10 08:20 UTC
[llvm-dev] Rewriting LLVM IR intrinsic functions
Hello, I can see the occurrences of several LLVM intrinsic functions in the LLVM IR generated by llvm-dis disassembler. Is there any means to rewrite these functions reliably using basic LLVM IR statements? -- Thanks & Regards, Dipanjan -------------- next part -------------- An HTML attachment was scrubbed... URL: <http://lists.llvm.org/pipermail/llvm-dev/attachments/20150910/f0bcf7ab/attachment.html>
serge guelton via llvm-dev
2015-Sep-10 09:09 UTC
[llvm-dev] Rewriting LLVM IR intrinsic functions
On Thu, Sep 10, 2015 at 04:20:01PM +0800, Dipanjan Das via llvm-dev wrote:> Hello, > > I can see the occurrences of several LLVM intrinsic functions in the LLVM > IR generated by llvm-dis disassembler. Is there any means to rewrite these > functions reliably using basic LLVM IR statements?You can use `LowerIntrinsicCall` from "llvm/CodeGen/IntrinsicLowering.h" to do so. It doesn't seem to be designed to be called from a pass, but with a few checks it does the job right.
David Chisnall via llvm-dev
2015-Sep-10 09:50 UTC
[llvm-dev] Rewriting LLVM IR intrinsic functions
On 10 Sep 2015, at 10:09, serge guelton via llvm-dev <llvm-dev at lists.llvm.org> wrote:> > On Thu, Sep 10, 2015 at 04:20:01PM +0800, Dipanjan Das via llvm-dev wrote: >> Hello, >> >> I can see the occurrences of several LLVM intrinsic functions in the LLVM >> IR generated by llvm-dis disassembler. Is there any means to rewrite these >> functions reliably using basic LLVM IR statements? > > You can use `LowerIntrinsicCall` from "llvm/CodeGen/IntrinsicLowering.h" > to do so.This will lower intrinsics to (target-specific) function calls that implement the underlying functionality, which is almost certainly not what you want to do. The question doesn’t really make sense. Intrinsics *are* ‘basic LLVM IR statements’. The distinction between things that are intrinsics and things that are instructions is quite fuzzy. Many intrinsics are intended to be operations that map to a single instruction on (at least some) targets and are all things that are not (or, at least, not easily) representable with LLVM IR instructions. To answer your question properly, it would help to understand what you’re actually trying to do. David