<div dir="ltr">On Wed, Apr 24, 2013 at 11:33 PM, Owen Anderson <span dir="ltr"><<a href="mailto:resistor@mac.com" target="_blank">resistor@mac.com</a>></span> wrote:<br><div class="gmail_extra"><div class="gmail_quote">



<blockquote class="gmail_quote" style="margin:0 0 0 .8ex;border-left:1px #ccc solid;padding-left:1ex">Hi Dan,<br></blockquote><div><br></div><div>Hi Owen,</div><div> </div><blockquote class="gmail_quote" style="margin:0 0 0 .8ex;border-left:1px #ccc solid;padding-left:1ex">


Others have weighed in on the merits of IR vs MI legalization, I thought I'd chip in on a different area:<br>
<br>
+    /// Legal roughly means there's a physical register class on the target<br>
+    /// machine for a type, and there's a reasonable set of instructions<br>
+    /// which operate on registers of this class and interpret their contents<br>
+    /// as instances of the type. For convenience, Legal is also used for<br>
+    /// types which are not legalized by this pass (vectors, floats, etc.)<br>
+    Legal,<br>
<br>
I don't think this is the right definition of a legal type.  I know that that's how SelectionDAG currently defines it, and I think that definition is behind a lot of the difficulty in retargeting LLVM to something that doesn't look like the intersection of X86 and ARM.<br>



</blockquote><div><br></div><div>Do you have a particular target in mind that we could discuss? Not all variances from the intersection of x86 and ARM are of the same nature; it's hard to talk in full generality here.</div>



<div> </div><blockquote class="gmail_quote" style="margin:0 0 0 .8ex;border-left:1px #ccc solid;padding-left:1ex">
I think the correct answer (credit to Chris for this description) is that a legal type is one that (more or less) corresponds to a set of physical registers, and which the target is capable of loading, storing, and copying (possibly also inserting/extracting elements, for vector types).<br>



</blockquote><div><br></div><div>If the target doesn't actually have a copy for a register class which will be register-allocated, it will just need to pretend it has one at this level and lower it later somehow, otherwise a lot of other stuff won't work.</div>


<div><br></div><div>I don't see why load and store are special at this level though. Or insert/extract element?</div>
<div><br></div><div>Dan</div><div><br></div></div></div></div>