[LLVMdev] set of integers to metadata

Alexandru Ionut Diaconescu alexandruionutdiaconescu at gmail.com
Fri May 3 04:18:27 PDT 2013

Hello everyone,

I want to pass a set of integers using metadata but I don't know how. I
have tried:

the integers are in array[]

*1. *
LLVMContext& C = is->getContext();
Value* values[size];
for(int gy=0;gy<size;gy++){

failes when setMetadata(), since

*Hello.cpp:706:56: error: no matching function for call to
‘llvm::MDNode::get(llvm::LLVMContext&, llvm::Value* [(((unsigned
int)(((int)cebagcnt) + -0x00000000000000001)) + 1)])’
Hello.cpp:706:56: note: candidate is:
/home/alex/llvm/include/llvm/Metadata.h:120:18: note: static llvm::MDNode*
llvm::MDNode::get(llvm::LLVMContext&, llvm::ArrayRef<llvm::Value*>)
/home/alex/llvm/include/llvm/Metadata.h:120:18: note:   no known conversion
for argument 2 from ‘llvm::Value* [(((unsigned int)(((int)cebagcnt) +
-0x00000000000000001)) + 1)]’ to ‘llvm::ArrayRef<llvm::Value*>’*

It works manually when I have

Value* values[]{
but I want to add metadata using the array[] elements with integers.

*3.* also, not so appropriate, I tried to convert the concatenated array
elements into a StringRef tsts = llvm::Twine(srsr).str();, but I have
segfault errors. In addition, this method is not exactly what I need.

How should I add all the array elements to metadata one by one, like I am
trying to do using values[] ?

Thank you much !
-------------- next part --------------
An HTML attachment was scrubbed...
URL: <http://lists.llvm.org/pipermail/llvm-dev/attachments/20130503/acab1982/attachment.html>

More information about the llvm-dev mailing list