<html><body><div style="color:#000; background-color:#fff; font-family:times new roman, new york, times, serif;font-size:10pt">Thank you !<br><div><span></span></div><div><br></div>  <div style="font-family: times new roman, new york, times, serif; font-size: 10pt;"> <div style="font-family: times new roman, new york, times, serif; font-size: 12pt;"> <div dir="ltr"> <hr size="1">  <font face="Arial" size="2"> <b><span style="font-weight:bold;">From:</span></b> Nick Lewycky <nicholas@mxc.ca><br> <b><span style="font-weight: bold;">To:</span></b> Alexandru Ionut Diaconescu <cyrusthevirus001x@yahoo.com> <br><b><span style="font-weight: bold;">Cc:</span></b> Cristianno Martins <cristiannomartins@gmail.com>; "llvmdev@cs.uiuc.edu" <llvmdev@cs.uiuc.edu> <br> <b><span style="font-weight: bold;">Sent:</span></b> Wednesday, June 26, 2013 8:54 AM<br> <b><span style="font-weight: bold;">Subject:</span></b> Re: [LLVMdev] get value<br> </font>
 </div> <div class="y_msg_container"><br>
Alexandru Ionut Diaconescu wrote:<br>> Hi Cristianno,<br>><br>> Thank you, it works :)<br>><br>> with an extra cast:<br>> Value *v ......<br>> ConstantInt* RR = (ConstantInt *)v;<br><br>Please use "cast<ConstantInt>(v)" instead. See <br>http://llvm.org/docs/ProgrammersManual.html#the-isa-cast-and-dyn-cast-templates <br>.<br><br>Nick<br><br>> uint64_t VV = (RR->getValue()).getLimitedValue();<br>> errs()<<"\nRR "<<VV<<"\n";<br>><br>><br>> *From:* Cristianno Martins <<a ymailto="mailto:cristiannomartins@gmail.com" href="mailto:cristiannomartins@gmail.com">cristiannomartins@gmail.com</a>><br>> *To:* Alexandru Ionut Diaconescu <<a ymailto="mailto:cyrusthevirus001x@yahoo.com" href="mailto:cyrusthevirus001x@yahoo.com">cyrusthevirus001x@yahoo.com</a>><br>> *Cc:* "<a ymailto="mailto:llvmdev@cs.uiuc.edu" href="mailto:llvmdev@cs.uiuc.edu">llvmdev@cs.uiuc.edu</a>" <<a
 ymailto="mailto:llvmdev@cs.uiuc.edu" href="mailto:llvmdev@cs.uiuc.edu">llvmdev@cs.uiuc.edu</a>><br>> *Sent:* Tuesday, June 25, 2013 12:27 PM<br>> *Subject:* Re: [LLVMdev] get value<br>><br>> Hi Alexandru,<br>><br>> if you have a Value pointer named v, you could use the method<br>> v->getValue().getLimitedValue(), which returns uint64_t, that can be<br>> casted as int.<br>><br>> Hope I could help,<br>><br>><br>> --<br>> Cristianno Martins<br>> PhD Student of Computer Science<br>> University of Campinas<br>> <a ymailto="mailto:cmartins@ic.unicamp.br" href="mailto:cmartins@ic.unicamp.br">cmartins@ic.unicamp.br</a> <mailto:<a ymailto="mailto:cmartins@ic.unicamp.br" href="mailto:cmartins@ic.unicamp.br">cmartins@ic.unicamp.br</a>><br>> <mailto:<a ymailto="mailto:cristiannomartins@hotmail.com"
 href="mailto:cristiannomartins@hotmail.com">cristiannomartins@hotmail.com</a>><br>><br>><br>> On Tue, Jun 25, 2013 at 4:05 AM, Alexandru Ionut Diaconescu<br>> <<a ymailto="mailto:cyrusthevirus001x@yahoo.com" href="mailto:cyrusthevirus001x@yahoo.com">cyrusthevirus001x@yahoo.com</a> <mailto:<a ymailto="mailto:cyrusthevirus001x@yahoo.com" href="mailto:cyrusthevirus001x@yahoo.com">cyrusthevirus001x@yahoo.com</a>>> wrote:<br>><br>>     Hello !<br>><br>>     This may be a trivial question, but I cannot get fields from a Value<br>>     type.<br>><br>>     If my Value is i32 1, how can I store 1 in a different structure (an<br>>     integer) ? For the type, I have getType(). For the value, I see no<br>>     method in Value.h.<br>><br>>     I tried to cast to ConstantExpr and then to get operands, or cast to<br>>    
 ConstantDataArray and then use getAsString(), but is not working.<br>>     How should I get the value?<br>><br>>     Thank you !<br>><br>><br>>     _______________________________________________<br>>     LLVM Developers mailing list<br>>     <a ymailto="mailto:LLVMdev@cs.uiuc.edu" href="mailto:LLVMdev@cs.uiuc.edu">LLVMdev@cs.uiuc.edu</a> <mailto:<a ymailto="mailto:LLVMdev@cs.uiuc.edu" href="mailto:LLVMdev@cs.uiuc.edu">LLVMdev@cs.uiuc.edu</a>><br>>     http://llvm.cs.uiuc.edu <http://llvm.cs.uiuc.edu/><br>>     http://lists.cs.uiuc.edu/mailman/listinfo/llvmdev<br>><br>><br>><br>><br>><br>><br>> _______________________________________________<br>> LLVM Developers mailing list<br>> <a ymailto="mailto:LLVMdev@cs.uiuc.edu" href="mailto:LLVMdev@cs.uiuc.edu">LLVMdev@cs.uiuc.edu</a>         <a
 href="http://llvm.cs.uiuc.edu/" target="_blank">http://llvm.cs.uiuc.edu</a><br>> <a href="http://lists.cs.uiuc.edu/mailman/listinfo/llvmdev" target="_blank">http://lists.cs.uiuc.edu/mailman/listinfo/llvmdev</a><br><br><br><br></div> </div> </div>  </div></body></html>