On Thu, Feb 26, 2009 at 5:25 AM, Gil Dogon <gil.dogon at mobileye.com>
wrote:> What I want to know, is how can the llvm.<something> intrinsics be
used
> by the application programmer.
At the IR level, you just call them. There isn't any general way to
write them in C.
> As a simple example take the llvm.ctlz intrinsic. How does one use it
> from C program ??
Use the gcc builtin __builtin_clz.
> I guess there must be a ".h" file somewhere which defines some of
those
> intrinsics for "C" and maybe some modification
> for the llvm-gcc frontend is involved...
If you're using llvm-gcc, you have to use the gcc mechanisms for
defining platform-specific builtins; I'm not really familiar with the
details.
> The question is more general. I guess some of the intrinsics are just
> for internal use by the LLVM passes, but in that case maybe
> it would have been better to have them as LLVM IR instructions
Intrinsics are for "internal use" in the sense that they aren't
real
functions. The reason we have both intrinsics and instructions is
that it's easier to add an intrinsic than an instruction. There
really isn't any substantial difference between intrinsics and
instructions in terms of what you're allowed to do with them.
-Eli