> > I have written them by hand in the .s file in the same way of the IR > > reference (http://llvm.org/docs/LangRef.html#named-metadata) : > > > > define i32 @function(i32 %argInt, metadata !3) nounwind { > > This seems wrong. "metadata" is a type (like i32), and the exclamation > mark is only used to refer to metadata nodes, not to declare functions > with them.I'm only interested in attaching a metadata string to a function with wirtten its precondition...Since here in the IR reference (http://llvm.org/docs/LangRef.html#metadata-nodes-and-metadata-strings) there is written: Metadata can be used as function arguments. Here llvm.dbg.value function is using two metadata arguments:call void @llvm.dbg.value(metadata !24, i64 0, metadata !25) I thought that maybe writing them as a function argument and then reading them could work... there is any other way to do that?Thank you :) Niko -------------- next part -------------- An HTML attachment was scrubbed... URL: <http://lists.llvm.org/pipermail/llvm-dev/attachments/20130211/d60b9248/attachment.html>
That's metadata for arguments to calling a function, you tried to attach metadata to the arguments of a declaration of a function. On 11 February 2013 22:58, Niko Zarzani <koni10 at hotmail.it> wrote:> > > I have written them by hand in the .s file in the same way of the IR > > > reference (http://llvm.org/docs/LangRef.html#named-metadata) : > > > > > > define i32 @function(i32 %argInt, metadata !3) nounwind { > > > > This seems wrong. "metadata" is a type (like i32), and the exclamation > > mark is only used to refer to metadata nodes, not to declare functions > > with them. > > I'm only interested in attaching a metadata string to a function with > wirtten its precondition...Since here in the IR reference ( > http://llvm.org/docs/LangRef.html#metadata-nodes-and-metadata-strings) > there is written: > > Metadata can be used as function arguments. Here llvm.dbg.value function > is using two metadata arguments: > > call void @llvm.dbg.value(metadata !24, i64 0, metadata !25) > > > I thought that maybe writing them as a function argument and then reading > them could work... there is any other way to do that? > > Thank you :) > > > Niko > > _______________________________________________ > LLVM Developers mailing list > LLVMdev at cs.uiuc.edu http://llvm.cs.uiuc.edu > http://lists.cs.uiuc.edu/mailman/listinfo/llvmdev > >-------------- next part -------------- An HTML attachment was scrubbed... URL: <http://lists.llvm.org/pipermail/llvm-dev/attachments/20130211/1dfdc633/attachment.html>
>That's metadata for arguments to calling a function, you tried to attach metadata to the arguments of a declaration of a function.I didn't notice that it was a call statement, thank you for the answer!There is another way to attach metadata to a function definition? Or is it better to attach the metadata with the string with the prerequisites to the first instruction of the function? or maybe write it in comments before the function definition and then get them in some other way?Thank you again! Niko -------------- next part -------------- An HTML attachment was scrubbed... URL: <http://lists.llvm.org/pipermail/llvm-dev/attachments/20130212/7a3d9497/attachment.html>