[LLVMdev] issue writing llvm metadata

Ashwin kumar ashwinkumar18 at gmail.com
Mon Dec 10 00:18:45 PST 2012


Hi,


 I am looking to write customized metadata to a particular load instruction using LLVM transform pass (A function pass to be specific). I have the following code snippet.


			
>  Value *CI = ConstantInt::get(getGlobalContext(), APInt(8,2));
>   ArrayRef<Value*> temp = ArrayRef<Value*>( CI);
>   MDNode *Node = MDNode::get(load->getContext(), temp);			
>  load->setMetadata("mydata",Node);


On running the pass with my input_file, I could not find the new metadata node in the .o file when i run llvm-dis with it . What am I missing ? Please help me out! 

I run the pass as 

opt -load path_to_my_library.so -pass_name < input_file.o > /dev/null

Should I do something different for a transform pass to work? 

Thank you!


regards,
Ashwin

-------------- next part --------------
An HTML attachment was scrubbed...
URL: <http://lists.llvm.org/pipermail/llvm-dev/attachments/20121210/0b39d919/attachment.html>


More information about the llvm-dev mailing list