<html><head></head><body style="word-wrap: break-word; -webkit-nbsp-mode: space; -webkit-line-break: after-white-space; "><div><div>On 20/08/2010, at 11:29 AM, Alec Benzer wrote:</div><br class="Apple-interchange-newline"><blockquote type="cite">> <span class="Apple-style-span" style="font-family: arial, sans-serif; font-size: 13px; border-collapse: collapse; ">I'm afraid that you might be utterly confused about how to use LLVM.</span><div><font class="Apple-style-span" face="arial, sans-serif"><span class="Apple-style-span" style="border-collapse: collapse;"><br>

</span></font></div><div><font class="Apple-style-span" face="arial, sans-serif"><span class="Apple-style-span" style="border-collapse: collapse;">Er, I don't think so? I think I was mostly just confused about interfacing with external functions, since whoever wrote that blog post (<a href="http://www.gearleaf.com/blog/post/44">http://www.gearleaf.com/blog/post/44</a>) didn't seem to know what he was talking about (or he was doing stuff that once worked but now doesn't? I don't know). If you glance at that post I think you'll understand why I was doing what I was doing.</span></font></div></blockquote><div><br></div><div>The blog appears to leave out a lot of context and as such is confusing. lle_X appears to be a special prefix which is used by the interpreter and not the JIT from what I can gather from a quick look at <a href="https://llvm.org/svn/llvm-project/llvm/tags/RELEASE_27/lib/ExecutionEngine/Interpreter/ExternalFunctions.cpp">https://llvm.org/svn/llvm-project/llvm/tags/RELEASE_27/lib/ExecutionEngine/Interpreter/ExternalFunctions.cpp</a> but I didn't bother to look to much into the detail.</div><br><blockquote type="cite"><div><font class="Apple-style-span" face="arial, sans-serif"><span class="Apple-style-span" style="border-collapse: collapse;">anyway, I think I get it now, what I was trying to do seems to be working how I expect it to.<br>

</span></font><br><div class="gmail_quote">On Thu, Aug 19, 2010 at 8:55 PM, Óscar Fuentes <span dir="ltr"><<a href="mailto:ofv@wanadoo.es">ofv@wanadoo.es</a>></span> wrote:<br><blockquote class="gmail_quote" style="margin:0 0 0 .8ex;border-left:1px #ccc solid;padding-left:1ex;">

The following message is a courtesy copy of an article<br>
that has been posted to gmane.comp.compilers.llvm.devel as well.<br>
<div class="im"><br>
Alec Benzer <<a href="mailto:alecbenzer@gmail.com">alecbenzer@gmail.com</a>> writes:<br>
<br>
> Ok, so calling lle_X_FUNCTIONNAME instead of FUNCTIONNAME works (is there<br>
> any reason the post used the lle_X_ prefix other than convention? was it<br>
> once possible to call external functions as I was originally trying, or, why<br>
> did the blog post think it was possible?)<br>
<br>
</div>AFAIK you can name the function as you please (with some reasonable<br>
restrictions on the character set, etc)<br>
<div class="im"><br>
> I'm now running into trouble when trying to access arguments however.<br>
> printing args.size() from the function yields 12105250188025543488. The<br>
> generated call to it looks like:<br>
><br>
> %object_tmp = call %object_structure* @lle_X_create_number_object(double<br>
> 5.000000e+00) ; <%object_structure*> [#uses=1]<br>
<br>
</div>You are calling a function that takes a single argument of type<br>
`double'. But on a previous post you showed the function with this<br>
signature:<br>
<div class="im"><br>
llvm::GenericValue<br>
lle_X_create_number_object(llvm::FunctionType* ft,<br>
                           const std::vector<llvm::GenericValue>& args)<br>
<br>
</div>so as the execution enters the function above from your call, the stack<br>
can be considered corrupt. Also, the return type of the `call' might not<br>
be right (it depends on the ABI of your platform.)<br>
<br>
It is strange to generate GenericValue's from JITted code. Are you doing<br>
some kind of meta-interpreter? I'm afraid that you might be utterly<br>
confused about how to use LLVM.<br>
</blockquote></div><br></div>
_______________________________________________<br>LLVM Developers mailing list<br><a href="mailto:LLVMdev@cs.uiuc.edu">LLVMdev@cs.uiuc.edu</a>         <a href="http://llvm.cs.uiuc.edu">http://llvm.cs.uiuc.edu</a><br><a href="http://lists.cs.uiuc.edu/mailman/listinfo/llvmdev">http://lists.cs.uiuc.edu/mailman/listinfo/llvmdev</a><br></blockquote></div><br></body></html>