[LLVMdev] automatically generating intrinsic declarations

Chris Lattner sabre at nondot.org
Mon Feb 5 12:28:56 PST 2007


On Mon, 5 Feb 2007, Dan Gohman wrote:

> LLVM knows what all the types of the intrinsic functions are; I thought, 
> why are users (including llvm-gcc...) required to duplicate all this 
> information in order to use them? I mean in order to call 
> getOrInsertFunction to get declarations for them.

That is an excellent question!  :)  In the bad old days, we used to allow 
intrinsics with slightly different types (e.g. http://llvm.org/PR1093). 
Because of this, we didn't know what type to create them as.

Fortunately however, this misguided past is all behind us now, and there 
is no longer a reason to not have this facility.

> So I wrote this patch, which allows all this code to be generated
> automatically. Is this a good approach?

This looks great, but appears to be missing the API that wraps the 
generated piece of Intrinsics.gen.  If you send it as well, I'd be happy 
to commit it for you.  Is there also a piece that switches llvm-gcc over 
to use this? :)

Thanks!

-Chris

-- 
http://nondot.org/sabre/
http://llvm.org/



More information about the llvm-dev mailing list