<div dir="ltr"><br><div class="gmail_extra"><br><div class="gmail_quote">On Fri, Mar 18, 2016 at 12:27 PM, Tim Northover <span dir="ltr"><<a href="mailto:t.p.northover@gmail.com" target="_blank">t.p.northover@gmail.com</a>></span> wrote:<br><blockquote class="gmail_quote" style="margin:0 0 0 .8ex;border-left:1px #ccc solid;padding-left:1ex">On 18 March 2016 at 12:20, Rail Shafigulin via llvm-dev<br>
<span class=""><<a href="mailto:llvm-dev@lists.llvm.org">llvm-dev@lists.llvm.org</a>> wrote:<br>
> Given that the action is "Expand" how does legalizer know which replacement<br>
> to use for a given operation?<br>
<br>
</span>It's pretty random, and the only way to be sure is to read<br>
LegalizeDAG.cpp. The two basic variants are:<br>
<br>
  + Check whether the intended opcode is Legal, use that if possible,<br>
otherwise keep trying until you run out of ideas.<br>
  + Expand it to something, legal or not. Then that node will be<br>
expanded in turn.<br>
<br>
Obviously neither is guaranteed to terminate in a legal node (for<br>
example you could set absolutely everything to Expand in which case<br>
there's no solution).<br>
<br>
These heuristics tend to cover the common cases, but most targets need<br>
to mark at least a few nodes as Custom and handle them manually.<br>
<br>
Cheers.<br>
<span class="HOEnZb"><font color="#888888"><br>
Tim.<br>
</font></span></blockquote></div><br>Thanks!<br clear="all"><div><br></div>-- <br><div class="gmail_signature"><div dir="ltr"><div><div dir="ltr"><div>Rail Shafigulin<br></div>Software Engineer <br>Esencia Technologies<br></div></div></div></div>
</div></div>