<div dir="rtl"><div dir="ltr">The PassManager+Passes+MC* were apparently designed for reuse without reconstructing them every time. Passes reset their state in doFinalization() and MC* in a reset() function. For instance, MCAssembler::reset():</div><div dir="ltr">...</div><div dir="ltr"><div dir="ltr">  // reset objects owned by us</div><div dir="ltr">  getBackend().reset();</div><div dir="ltr">  getEmitter().reset();</div><div dir="ltr">  getWriter().reset();</div><div dir="ltr">  getLOHContainer().reset();</div><div><br></div></div><div dir="ltr">If all states are reset correctly, it should be possible to feed different modules into the same PassManager.</div><div dir="ltr"><br></div><div dir="ltr">However that is not the way clang or MCJIT work now, they create a PassManager, use it to produce object or assembler file and kills the PassManager. This does not sound very time-efficient but I had not measure the performance impact. I'm trying to keep the PassManager alive for other reasons. </div><div dir="ltr"><br></div><div dir="ltr">I don't know if there are other users of PassManager that keep it alive, so doFinalization() and reset() sufferred code rot with regard to reseting state. Most are OK but pieces are missing here and threre. Keeping this existing structure alive will enable reusing the passManager.</div><div dir="ltr"><br></div><div dir="ltr">Testing could done in a unit test that reuses the PassManager for compiling several files.</div><div dir="ltr"><br></div><div dir="ltr">Yaron</div><div dir="ltr"><br></div><div dir="ltr"><br></div><div dir="ltr"><br></div></div><div class="gmail_extra"><div dir="ltr"><br><div class="gmail_quote">2014-09-15 21:47 GMT+03:00 Reid Kleckner <span dir="ltr"><<a href="mailto:rnk@google.com" target="_blank">rnk@google.com</a>></span>:<br><blockquote class="gmail_quote" style="margin:0 .8ex;border-left:1px #ccc solid;border-right:1px #ccc solid;padding-left:1ex;padding-right:1ex">Seems obviously correct. Is there a way to test this? Do we just leak memory now? If so, why haven't our bots caught it?</blockquote></div><div class="gmail_extra"><br><div class="gmail_quote"><span class="">On Mon, Sep 15, 2014 at 11:29 AM, Yaron Keren <span dir="ltr"><<a href="mailto:yaron.keren@gmail.com" target="_blank">yaron.keren@gmail.com</a>></span> wrote:<br></span><blockquote class="gmail_quote" style="margin:0 0 0 .8ex;border-left:1px #ccc solid;padding-left:1ex"><span class=""><div dir="rtl"><div dir="ltr">This add a reset method for WinCOFFObjectWriter, like other MC* classes.<br><br><a href="http://llvm.org/bugs/show_bug.cgi?id=20926" target="_blank">http://llvm.org/bugs/show_bug.cgi?id=20926</a><br></div><div dir="ltr"><br></div></div>
<br></span>_______________________________________________<br>
llvm-commits mailing list<br>
<a href="mailto:llvm-commits@cs.uiuc.edu" target="_blank">llvm-commits@cs.uiuc.edu</a><br>
<a href="http://lists.cs.uiuc.edu/mailman/listinfo/llvm-commits" target="_blank">http://lists.cs.uiuc.edu/mailman/listinfo/llvm-commits</a><br>
<br></blockquote></div><br></div></div></div>