<font face="arial,helvetica,sans-serif">Thank you.</font><div><font face="arial,helvetica,sans-serif">Anyway, I have written my own interpreter.</font></div><div><font face="arial,helvetica,sans-serif">It took me 20 minutes when I passed all the day searching for making the LLVM interpreter working...<br>
</font><br><div class="gmail_quote">On Wed, Nov 3, 2010 at 16:28, Duncan Sands <span dir="ltr"><<a href="mailto:baldrick@free.fr">baldrick@free.fr</a>></span> wrote:<br><blockquote class="gmail_quote" style="margin:0 0 0 .8ex;border-left:1px #ccc solid;padding-left:1ex;">
Hi Salomon, please don't forget to reply to the list too (I've CC'd the list).<div class="im"><br>
<br>
<blockquote class="gmail_quote" style="margin:0 0 0 .8ex;border-left:1px #ccc solid;padding-left:1ex">
I don't think my code is doing anything worng...<br>
</blockquote>
<br></div>
No, it looks fine to me, and the interpreter certainly supports this. That<br>
suggests that the value of %str is not being transmitted to the function right.<br>
If it is getting the wrong pointer value, that would explain why it barfs.<br>
<br>
Ciao,<br>
<br>
Duncan.<br>
<br>
<blockquote class="gmail_quote" style="margin:0 0 0 .8ex;border-left:1px #ccc solid;padding-left:1ex"><div class="im">
This segfaults :<br>
define i32 @llvmre_1(i8* %str) {<br>
entry:<br>
%char = load i8* %str<br>
%cond = icmp eq i8 %char, 97<br>
br i1 %cond, label %State1, label %End<br>
<br>
State1: ; preds = %entry<br>
br label %End<br>
<br>
End: ; preds = %State1, %entry<br>
%retPtr.0 = phi i32 [ 1, %State1 ], [ 0, %entry ]<br>
ret i32 %retPtr.0<br>
}<br>
<br>
It just checks if the first character of the string is an a.<br>
The given parameter is "abc"...<br>
<br>
On Wed, Nov 3, 2010 at 16:10, Duncan Sands <<a href="mailto:baldrick@free.fr" target="_blank">baldrick@free.fr</a><br></div><div><div></div><div class="h5">
<mailto:<a href="mailto:baldrick@free.fr" target="_blank">baldrick@free.fr</a>>> wrote:<br>
<br>
Hi,<br>
<br>
> I have build LLVM in debug mode. Here are the informations of the<br>
> segfault : memcpy() at 0x7ffff6f6581e<br>
> LoadIntFromMemory() at ExecutionEngine.cpp:887 0xb3c297<br>
> llvm::ExecutionEngine::LoadValueFromMemory() at ExecutionEngine.cpp:915<br>
> 0xb3c3f9<br>
> llvm::Interpreter::visitLoadInst() at Execution.cpp:812 0xa1f855<br>
> llvm::InstVisitor<llvm::Interpreter, void>::visitLoad() at 0xa28357<br>
> llvm::InstVisitor<llvm::Interpreter, void>::visit() at 0xa26b4e<br>
> llvm::Interpreter::run() at Execution.cpp:1,328 0xa235ff<br>
> llvm::Interpreter::runFunction() at Interpreter.cpp:95 0xa166fa<br>
> ....<br>
> So the segfaults happens because of the memcpy call in the<br>
> LoadIntFromMemory function in ExecutionEngine.cpp on line 887... Any<br>
> clue ?<br>
<br>
usually this kind of thing means that your bitcode is doing something bad, such<br>
as writing to random memory locations, and you just happened to get away with<br>
it when using the JIT. Try running under valgrind (either the interpreter or,<br>
if you can, make a real program out of your bitcode and run that under<br>
valgrind).<br>
<br>
Ciao,<br>
<br>
Duncan.<br>
<br>
><br>
><br>
> Adding .setOptLevel(llvm::CodeGenOpt::None) to the EngineBuilder<br>
> creation reduces the time by 25% but that is still not enough :(<br>
><br>
><br></div></div>
> 2010/11/3 Török Edwin<<a href="mailto:edwintorok@gmail.com" target="_blank">edwintorok@gmail.com</a> <mailto:<a href="mailto:edwintorok@gmail.com" target="_blank">edwintorok@gmail.com</a>>><div><div>
</div><div class="h5"><br>
><br>
>> On Wed, 3 Nov 2010 11:18:34 +0000<br>
>> Salomon Brys<<a href="mailto:salomon.brys@gmail.com" target="_blank">salomon.brys@gmail.com</a> <mailto:<a href="mailto:salomon.brys@gmail.com" target="_blank">salomon.brys@gmail.com</a>>> wrote:<br>
>><br>
>>> Jiting with no optimization does not reduce significantly the<br>
>>> compilation with very small code...<br>
>><br>
>> I mean the parameter to createJIT, OptLevel. Try setting it to None.<br>
>> Or if you use EngineBuilder, setOptLevel(CodeGenOpt::None).<br>
>><br>
>>> What is the local register allocator ???<br>
>><br>
>> -regalloc=fast, or -regalloc=local parameter to llc, or lli.<br>
>> I think there was a programatic way to choose register allocator, but<br>
>> I forgot how.<br>
>><br>
>> Best regards,<br>
>> --Edwin<br>
>><br>
><br>
><br>
><br>
><br>
><br>
> I have build LLVM in debug mode. Here are the informations of the segfault :<br>
> memcpy() at 0x7ffff6f6581e<br>
> LoadIntFromMemory() at ExecutionEngine.cpp:887 0xb3c297<br>
> llvm::ExecutionEngine::LoadValueFromMemory() at ExecutionEngine.cpp:915<br>
0xb3c3f9<br>
> llvm::Interpreter::visitLoadInst() at Execution.cpp:812 0xa1f855<br>
> llvm::InstVisitor<llvm::Interpreter, void>::visitLoad() at 0xa28357<br>
> llvm::InstVisitor<llvm::Interpreter, void>::visit() at 0xa26b4e<br>
> llvm::Interpreter::run() at Execution.cpp:1,328 0xa235ff<br>
> llvm::Interpreter::runFunction() at Interpreter.cpp:95 0xa166fa<br>
> ....<br>
> So the segfaults happens because of the�memcpy call in the�LoadIntFromMemory<br>
> function in�ExecutionEngine.cpp on line 887... Any clue ?<br>
><br>
><br>
> Adding .setOptLevel(llvm::CodeGenOpt::None) to the�EngineBuilder creation<br>
> reduces the time by 25% but that is still not enough :(<br>
><br>
><br>
> 2010/11/3 T�r�k Edwin <<a href="mailto:edwintorok@gmail.com" target="_blank">edwintorok@gmail.com</a> <mailto:<a href="mailto:edwintorok@gmail.com" target="_blank">edwintorok@gmail.com</a>><br></div></div>
<mailto:<a href="mailto:edwintorok@gmail.com" target="_blank">edwintorok@gmail.com</a> <mailto:<a href="mailto:edwintorok@gmail.com" target="_blank">edwintorok@gmail.com</a>>>><div class="im"><br>
><br>
> On Wed, 3 Nov 2010 11:18:34 +0000<br>
> Salomon Brys <<a href="mailto:salomon.brys@gmail.com" target="_blank">salomon.brys@gmail.com</a> <mailto:<a href="mailto:salomon.brys@gmail.com" target="_blank">salomon.brys@gmail.com</a>><br></div>
<div class="im">
<mailto:<a href="mailto:salomon.brys@gmail.com" target="_blank">salomon.brys@gmail.com</a> <mailto:<a href="mailto:salomon.brys@gmail.com" target="_blank">salomon.brys@gmail.com</a>>>> wrote:<br>
><br>
> > Jiting with no optimization does not reduce significantly the<br>
> > compilation with very small code...<br>
><br>
> I mean the parameter to createJIT, OptLevel. Try setting it to None.<br>
> Or if you use EngineBuilder, setOptLevel(CodeGenOpt::None).<br>
><br>
> > What is the local register allocator ???<br>
><br>
> -regalloc=fast, or -regalloc=local parameter to llc, or lli.<br>
> I think there was a programatic way to choose register allocator, but I<br>
> forgot how.<br>
><br>
> Best regards,<br>
> --Edwin<br>
><br>
><br>
><br>
><br>
> --<br>
> ###########################################<br>
> # Salomon BRYS<br>
> # +33 (0) 6 83 54 55 96<br>
> #------------------------------------------<br>
> # > EPITECH "Koala" : C++ assistant : Sbire du C++<br>
> # > Zend Certified Engineer for PHP5<br>
> #------------------------------------------<br>
> # All data in this e-mail is confidential.<br>
> # If you are not, or if you don't believe you are, the recipient of this<br>
e-mail,<br>
> please delete it.<br>
> #------------------------------------------<br>
> # GPG : <a href="http://gpgkey-salomon.antesocial.fr/" target="_blank">http://gpgkey-salomon.antesocial.fr/</a><br>
> ###########################################<br>
><br>
><br>
><br>
> _______________________________________________<br>
> LLVM Developers mailing list<br></div>
> <a href="mailto:LLVMdev@cs.uiuc.edu" target="_blank">LLVMdev@cs.uiuc.edu</a> <mailto:<a href="mailto:LLVMdev@cs.uiuc.edu" target="_blank">LLVMdev@cs.uiuc.edu</a>> <a href="http://llvm.cs.uiuc.edu" target="_blank">http://llvm.cs.uiuc.edu</a><div class="im">
<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>
LLVM Developers mailing list<br></div>
<a href="mailto:LLVMdev@cs.uiuc.edu" target="_blank">LLVMdev@cs.uiuc.edu</a> <mailto:<a href="mailto:LLVMdev@cs.uiuc.edu" target="_blank">LLVMdev@cs.uiuc.edu</a>> <a href="http://llvm.cs.uiuc.edu" target="_blank">http://llvm.cs.uiuc.edu</a><div class="im">
<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>
<br>
--<br>
###########################################<br>
# Salomon BRYS<br>
# +33 (0) 6 83 54 55 96<br>
#------------------------------------------<br>
# > EPITECH "Koala" : C++ assistant : Sbire du C++<br>
# > Zend Certified Engineer for PHP5<br>
#------------------------------------------<br>
# All data in this e-mail is confidential.<br>
# If you are not, or if you don't believe you are, the recipient of this e-mail,<br>
please delete it.<br>
#------------------------------------------<br>
# GPG : <a href="http://gpgkey-salomon.antesocial.fr/" target="_blank">http://gpgkey-salomon.antesocial.fr/</a><br>
###########################################<br>
</div></blockquote>
<br>
</blockquote></div><br><br clear="all"><br>-- <br>###########################################<br># Salomon BRYS<br># +33 (0) 6 83 54 55 96<br>#------------------------------------------<br># > EPITECH "Koala" : C++ assistant : Sbire du C++<br>
# > Zend Certified Engineer for PHP5<br>#------------------------------------------<br># All data in this e-mail is confidential.<br># If you are not, or if you don't believe you are, the recipient of this e-mail, please delete it.<br>
#------------------------------------------<br># GPG : <a href="http://gpgkey-salomon.antesocial.fr/">http://gpgkey-salomon.antesocial.fr/</a><br>###########################################<br>
</div>