Hey everyone, I'm trying to retrieve information about signed-/unsignedness of an llvm::Argument so I can print out it's value to the user properly. llvm itself doesn't distinguish signed and unsigned and so llvm::Type is of no help here. Checking for nsw/usw is only an unreliable approximation and only available for llvm::Instructions anyways. I tried to use debugging information (llvm::DIType) for this, but getMetadata() is not available for llvm::Argument, only for llvm::Instruction. Is there any other way to get at this information? Regards, Florian
I too would have an immediate application if metadata could be attached to arguments. I'm currently working around it by using named metadata in the module (matched by index to the arguments). Andrew On 02/21/2011 11:18 AM, Florian Merz wrote:> Hey everyone, > > I'm trying to retrieve information about signed-/unsignedness of an > llvm::Argument so I can print out it's value to the user properly. llvm itself > doesn't distinguish signed and unsigned and so llvm::Type is of no help here. > Checking for nsw/usw is only an unreliable approximation and only available > for llvm::Instructions anyways. > > I tried to use debugging information (llvm::DIType) for this, but > getMetadata() is not available for llvm::Argument, only for llvm::Instruction. > > Is there any other way to get at this information? > > Regards, > Florian > _______________________________________________ > LLVM Developers mailing list > LLVMdev at cs.uiuc.edu http://llvm.cs.uiuc.edu > http://lists.cs.uiuc.edu/mailman/listinfo/llvmdev
There is no support to have metadata attached with an argument because there was any need so far. If you have really good reason to have it then you'll at least need to - propose llvm IR syntax and update llvm IR spec to attach metadata - update llvm parser and asm writer - update bitcode reader and writer - Devang On Feb 22, 2011, at 9:41 AM, Andrew Clinton wrote:> I too would have an immediate application if metadata could be attached > to arguments. I'm currently working around it by using named metadata > in the module (matched by index to the arguments). > > Andrew > > On 02/21/2011 11:18 AM, Florian Merz wrote: >> Hey everyone, >> >> I'm trying to retrieve information about signed-/unsignedness of an >> llvm::Argument so I can print out it's value to the user properly. llvm itself >> doesn't distinguish signed and unsigned and so llvm::Type is of no help here. >> Checking for nsw/usw is only an unreliable approximation and only available >> for llvm::Instructions anyways. >> >> I tried to use debugging information (llvm::DIType) for this, but >> getMetadata() is not available for llvm::Argument, only for llvm::Instruction. >> >> Is there any other way to get at this information? >> >> Regards, >> Florian >> _______________________________________________ >> LLVM Developers mailing list >> LLVMdev at cs.uiuc.edu http://llvm.cs.uiuc.edu >> http://lists.cs.uiuc.edu/mailman/listinfo/llvmdev > > _______________________________________________ > LLVM Developers mailing list > LLVMdev at cs.uiuc.edu http://llvm.cs.uiuc.edu > http://lists.cs.uiuc.edu/mailman/listinfo/llvmdev
The reason that I need this is that I'm supporting runtime function specialization, where the arguments have known default values. When the function is specialized, I need to replace uses of the argument with the default value. I could not find any other way to store the metadata for the default values other than to use module-level data. Does anyone know a better way to accomplish this in the LLVM IR? On 02/22/2011 12:41 PM, Andrew Clinton wrote:> I too would have an immediate application if metadata could be attached > to arguments. I'm currently working around it by using named metadata > in the module (matched by index to the arguments). > > Andrew > > On 02/21/2011 11:18 AM, Florian Merz wrote: >> Hey everyone, >> >> I'm trying to retrieve information about signed-/unsignedness of an >> llvm::Argument so I can print out it's value to the user properly. llvm itself >> doesn't distinguish signed and unsigned and so llvm::Type is of no help here. >> Checking for nsw/usw is only an unreliable approximation and only available >> for llvm::Instructions anyways. >> >> I tried to use debugging information (llvm::DIType) for this, but >> getMetadata() is not available for llvm::Argument, only for llvm::Instruction. >> >> Is there any other way to get at this information? >> >> Regards, >> Florian >> _______________________________________________ >> LLVM Developers mailing list >> LLVMdev at cs.uiuc.edu http://llvm.cs.uiuc.edu >> http://lists.cs.uiuc.edu/mailman/listinfo/llvmdev > _______________________________________________ > LLVM Developers mailing list > LLVMdev at cs.uiuc.edu http://llvm.cs.uiuc.edu > http://lists.cs.uiuc.edu/mailman/listinfo/llvmdev