<div dir="ltr">No more comments so far, but I have some questions about passes infrastructure.<div><br></div><div>Can the pass be implemented for the new pass manager? If yes, will it be able to be used by the legacy pass manager?</div><div><br></div><div>I think the simplest starting point is basic block pass. Can a basic block pass add new function declarations and/or definitions to the module it runs on?</div><div><br></div><div>If basic block is not an option should it be a module pass that trivially iterates over all functions and blocks? From my little experience such passes performed quite badly.</div><div><br></div><div>The third option I can think of is some combination of analysis and transform passes.</div><div><br></div><div>- Paweł</div></div><br><div class="gmail_quote"><div dir="ltr">On Tue, Oct 6, 2015 at 12:44 AM Paweł Bylica <<a href="mailto:chfast@gmail.com">chfast@gmail.com</a>> wrote:<br></div><blockquote class="gmail_quote" style="margin:0 0 0 .8ex;border-left:1px #ccc solid;padding-left:1ex"><div dir="ltr"><div class="gmail_quote"><div dir="ltr">On Tue, Oct 6, 2015 at 12:25 AM Tim Northover <<a href="mailto:t.p.northover@gmail.com" target="_blank">t.p.northover@gmail.com</a>> wrote:<br></div><blockquote class="gmail_quote" style="margin:0 0 0 .8ex;border-left:1px #ccc solid;padding-left:1ex">On 5 October 2015 at 15:09, Paweł Bylica <<a href="mailto:llvm-dev@lists.llvm.org" target="_blank">llvm-dev@lists.llvm.org</a>> wrote:<br>
> The pass replaces instructions mul, udiv, urem, sdiv, srem that are know to<br>
> be not supported by target's type legalization with a call to a function<br>
> that implements given arithmetic operation.<br>
<br>
This seems quite sensible, those functions can get bigger than you'd<br>
want to inline.<br>
<br>
> The pass also injects these functions to the module with a weak linkage.<br>
> The pass requires a function generator (interface implementation) for mul<br>
> and udivrem algorithms for integer types of sizes being powers of 2 (i.e.<br>
> i128, i256, ...). Replacements for other instructions are created using<br>
> these 2 algorithms.<br>
<br>
This sounds a bit weird though. It seems more natural to make these<br>
part of a runtime support library for your language (like compiler-rt<br>
is for C).<br></blockquote><div><br></div></div></div><div dir="ltr"><div class="gmail_quote"><div>You are probably right. It makes more sense in general case. I was too focused on mine. However, we can have both easily. The generator can return either function declaration or function definition.</div><div> </div><blockquote class="gmail_quote" style="margin:0 0 0 .8ex;border-left:1px #ccc solid;padding-left:1ex">
<br>
Cheers.<br>
<br>
Tim.<br>
</blockquote></div></div></blockquote></div>