[LLVMdev] automatically generating intrinsic declarations

Jim Laskey jlaskey at apple.com
Wed Feb 7 11:16:16 PST 2007


Dan,

Not being ignored.  I'm going to rework the gen portion to produce a  
FunctionType instead of function.  This way it will be a little more  
efficient and we can the support var arg and attributes.

Cheers,

-- Jim


On 6-Feb-07, at 10:41 AM, Dan Gohman wrote:

> On Mon, Feb 05, 2007 at 12:28:56PM -0800, Chris Lattner wrote:
>> 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.
>
> It appears there is at least one more. The llvm.gcroot intrinsic is  
> documented
> as having generic argument types.
>
>>> 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? :)
>
> Attached is a patch that includes the API bits.
>
> I also noticed that my earlier patch didn't handle pointer types,  
> so I fixed
> that, and in doing so I noticed that the types for va_start,  
> va_end, va_copy,
> and dbg.declare were apparently wrong, so I fixed those too.
>
> However, gcroot does currently come out as void @llvm.gcroot(i8**,  
> i8*).
>
> Dan
>
> -- 
> Dan Gohman, Cray Inc. <djg at cray.com>
> <patch-int>
> _______________________________________________
> LLVM Developers mailing list
> LLVMdev at cs.uiuc.edu         http://llvm.cs.uiuc.edu
> http://lists.cs.uiuc.edu/mailman/listinfo/llvmdev




More information about the llvm-dev mailing list