<html><body style="word-wrap: break-word; -webkit-nbsp-mode: space; -webkit-line-break: after-white-space; ">
<br><div><div>On Nov 9, 2008, at 3:46 AM, Nuno Lopes wrote:</div><br class="Apple-interchange-newline"><blockquote type="cite"><blockquote type="cite"><div style="margin-top: 0px; margin-right: 0px; margin-bottom: 0px; margin-left: 0px; ">I'd like to support users dynamically adding and using functions</div><div style="margin-top: 0px; margin-right: 0px; margin-bottom: 0px; margin-left: 0px; ">(plus structs, globals etc) to a Module, JIT compiling to an</div><div style="margin-top: 0px; margin-right: 0px; margin-bottom: 0px; margin-left: 0px; ">ExecutionEngine, in an interleaved fashion. That is, declare & define</div><div style="margin-top: 0px; margin-right: 0px; margin-bottom: 0px; margin-left: 0px; ">a function, run it through a FunctionPassManager, add it to an</div><div style="margin-top: 0px; margin-right: 0px; margin-bottom: 0px; margin-left: 0px; ">ExecutionEngine, use it, go ahead and repeat for a different function</div><div style="margin-top: 0px; margin-right: 0px; margin-bottom: 0px; margin-left: 0px; ">with the same Module, FunctionPassManager & ExecutionEngine, etc.</div> </blockquote><div style="margin-top: 0px; margin-right: 0px; margin-bottom: 0px; margin-left: 0px; min-height: 14px; "><br></div><div style="margin-top: 0px; margin-right: 0px; margin-bottom: 0px; margin-left: 0px; ">that should work without much trouble. </div></blockquote><div><br></div><div>Great.</div><br><blockquote type="cite"><div style="margin-top: 0px; margin-right: 0px; margin-bottom: 0px; margin-left: 0px; ">You can also redefine a function body<span class="Apple-converted-space"> </span></div><div style="margin-top: 0px; margin-right: 0px; margin-bottom: 0px; margin-left: 0px; ">and recompile it. The only catch is with inling. If you do any inling you'll<span class="Apple-converted-space"> </span></div><div style="margin-top: 0px; margin-right: 0px; margin-bottom: 0px; margin-left: 0px; ">have to recompile the other functions that inlined the redefined function.</div></blockquote><div><br></div>Got it. nice.</div><div><br><blockquote type="cite"><blockquote type="cite"><div style="margin-top: 0px; margin-right: 0px; margin-bottom: 0px; margin-left: 0px; ">Also, does there need to be a 1-1-1 correspondence between Module,</div><div style="margin-top: 0px; margin-right: 0px; margin-bottom: 0px; margin-left: 0px; ">FunctionPassManager and ExecutionEngine, or can it be 1-many(1-1)?</div> </blockquote><div style="margin-top: 0px; margin-right: 0px; margin-bottom: 0px; margin-left: 0px; min-height: 14px; "><br></div><div style="margin-top: 0px; margin-right: 0px; margin-bottom: 0px; margin-left: 0px; ">You can do the combinations you want, although I don't see any point in<span class="Apple-converted-space"> </span></div><div style="margin-top: 0px; margin-right: 0px; margin-bottom: 0px; margin-left: 0px; ">doing such a thing. It's just a waste of memory :)</div></blockquote><div><br></div><div>The reason is that I may have users needing to run very similar code concurrently and somewhat sandboxed. I was thinking to save memory by using the same Module for each concurrent instance.</div><br><blockquote type="cite"><div style="margin-top: 0px; margin-right: 0px; margin-bottom: 0px; margin-left: 0px; min-height: 14px; "><br></div> <blockquote type="cite"><div style="margin-top: 0px; margin-right: 0px; margin-bottom: 0px; margin-left: 0px; ">Thanks again, and once again sorry if this info is available in</div><div style="margin-top: 0px; margin-right: 0px; margin-bottom: 0px; margin-left: 0px; ">existing docs; I haven't been able to find it yet.</div> </blockquote><div style="margin-top: 0px; margin-right: 0px; margin-bottom: 0px; margin-left: 0px; min-height: 14px; "><br></div><div style="margin-top: 0px; margin-right: 0px; margin-bottom: 0px; margin-left: 0px; ">I think you'll find the doxygen docs helpful:<span class="Apple-converted-space"> </span></div><div style="margin-top: 0px; margin-right: 0px; margin-bottom: 0px; margin-left: 0px; "><a href="http://llvm.org/doxygen/classes.html">http://llvm.org/doxygen/classes.html</a></div></blockquote><div><br></div><div>Yes I saw the doxy ... this line put me off: "<span class="Apple-style-span" style="font-family: Verdana; ">This documentation describes the <b>internal</b> software that makes up LLVM, not the <b>external</b> use of LLVM. There are no instructions here on how to use LLVM, only the APIs that make up the software. For usage instructions, please see the programmer's guide or reference manual." (Which I have read.) ;-)</span></div><div><font class="Apple-style-span" face="Verdana"><br></font></div><div><font class="Apple-style-span" face="Verdana">I'm at an early stage with LLVM, trying to put together a design/implementation strategy for some specific use-cases. Having a broad top-level view of LLVM's potentials, limits/points of possible failure, and implementation idioms is essential to getting a good strategy for using it. It's understandably difficult to attain given that LLVM could be used in *so many* different and powerful ways! I think some of this understanding will emerge through practice and test projects, and the various presentations (mov, pdf) on the site have also helped tremendously.</font></div><div><font class="Apple-style-span" face="Verdana"><br></font></div><div><font class="Apple-style-span" face="Verdana">Thanks for all your help.</font></div></div><div> </div><br></body></html>