<div class="gmail_quote">On Tue, Aug 24, 2010 at 2:27 AM, hamed hamzehi <span dir="ltr"><<a href="mailto:mohammadhamzehi@yahoo.com">mohammadhamzehi@yahoo.com</a>></span> wrote:<br><blockquote class="gmail_quote" style="margin:0 0 0 .8ex;border-left:1px #ccc solid;padding-left:1ex;">
<table cellspacing="0" cellpadding="0" border="0"><tbody><tr><td valign="top" style="font:inherit">Hi<br>I want to use LLVM to <span><span>automatically generate <em>multithreaded code for execution</em> on multicore processors. My problem is  </span></span><span><span>code generation for multicores </span></span><span><span>and concurrency primitives.<br>
Is there any facilities for code generation? How should </span></span><span><span>I </span></span><span><span>start?  </span></span><br>Best Regards.<br><span class="Apple-style-span" style="font-size: small; "></span></td>
</tr></tbody></table></blockquote><div><br></div><div>You'll need a threading library for your platform.  Then create function declarations for the threading functions, call them from your generated code, and off you go.  Be sure to link the threading libraries in to your executable.</div>
<div><br></div><div>LLVM does not have anything threading specific in the IR language definition other than the atomic primitives.  You can create locks and stuff with those, or use the ones provided by your threading library.  LLVM has nothing built in for generating code that knows how to spawn a new thread.</div>
<blockquote class="gmail_quote" style="margin:0 0 0 .8ex;border-left:1px #ccc solid;padding-left:1ex;"><table cellspacing="0" cellpadding="0" border="0"><tbody><tr><td valign="top" style="font:inherit"><span class="Apple-style-span" style="font-size: small; "> </span></td>
</tr></tbody></table></blockquote></div>