Hi,
I will try to explain by giving an example.
Let's say that I have an intrinsic: int llvm.myintrinsic(int)
I have a function: int myintrinsic_handler(int)
When
%var = call int %llvm.myintrinsic( int %arg )
is met in the code, I want the code generator put in its place: a call
to function
"myintrinsic_handler" (i.e. %var = call int %myintrinsic_handler( int
%arg ) )
or probably in native assembly (i.e. x86) it will look like something this
push %arg
call myintrinsic_handler
pop res
On 3/31/07, Reid Spencer <rspencer at reidspencer.com>
wrote:> On Sat, 2007-03-31 at 12:38 -0800, Chris Lattner wrote:
> > >> 3. Can I introduce an intrinsic that is actually a call to my
function
> > >> that implements the logic? I suppose it is possible but
unfortunately
> > >> I couldn't figure it out. For example, in GCC we can
write an
> > >> intrinsic that translates to a C code.
> > >
> > > As part of PR1297 (http://llvm.org/PR1297) I am about to make
this
> > > happen. There are certain kinds of intrinsics that want to have a
> > > function body generated for them if a target or code generator
cannot
> > > handle the intrinsic natively. For example, the company I work
for has
> >
> > IntrinsicLowering already does this. It lets you lower intrinsics to
> > arbitrary LLVM calls, including calls to external functions.
>
> I think that when Ferad said "in GCC we can write an intrinsic that
> translates to a C code" meant that the intrinsic would be expanded to
> have a body much as I'm planning on doing in the this PR1297. To my
> understanding, IntrinsicLowering doesn't support expansion to a
function
> with a body. Or, am I just missing something on that?
>
> Perhaps Ferad could explain in a little more detail what he meant?
>
> >
> > -Chris
> >
>
> _______________________________________________
> LLVM Developers mailing list
> LLVMdev at cs.uiuc.edu http://llvm.cs.uiuc.edu
> http://lists.cs.uiuc.edu/mailman/listinfo/llvmdev
>
--
Ferad Zyulkyarov
Barcelona Supercomputing Center