<HTML><BODY style="word-wrap: break-word; -khtml-nbsp-mode: space; -khtml-line-break: after-white-space; "><BR><DIV><DIV>On Jul 27, 2007, at 12:30 PM, Christopher Lamb wrote:</DIV><BR class="Apple-interchange-newline"><BLOCKQUOTE type="cite"><BR><DIV><DIV>On Jul 27, 2007, at 12:07 PM, Evan Cheng wrote:</DIV><BR class="Apple-interchange-newline"><BLOCKQUOTE type="cite"><BR><DIV><DIV>On Jul 26, 2007, at 11:52 PM, Christopher Lamb wrote:</DIV><BR class="Apple-interchange-newline"><BLOCKQUOTE type="cite"><BR><DIV><DIV>On Jul 26, 2007, at 10:28 PM, Evan Cheng wrote:</DIV><BR class="Apple-interchange-newline"><BLOCKQUOTE type="cite"><DIV>I don't think they are target opcodes. <BR></DIV></BLOCKQUOTE><DIV><BR class="khtml-block-placeholder"></DIV><DIV>Is that a suggestion? In the implementation they are:</DIV><DIV><BR class="khtml-block-placeholder"></DIV><DIV style="margin-top: 0px; margin-right: 0px; margin-bottom: 0px; margin-left: 0px; ">--- llvm/trunk/include/llvm/Target/TargetInstrInfo.h (original)</DIV><DIV style="margin-top: 0px; margin-right: 0px; margin-bottom: 0px; margin-left: 0px; ">+++ llvm/trunk/include/llvm/Target/TargetInstrInfo.h Thu Jul 26 02:48:21 2007</DIV><DIV style="margin-top: 0px; margin-right: 0px; margin-bottom: 0px; margin-left: 0px; ">@@ -177,7 +177,9 @@</DIV><DIV style="margin-top: 0px; margin-right: 0px; margin-bottom: 0px; margin-left: 0px; ">   enum {</DIV><DIV style="margin-top: 0px; margin-right: 0px; margin-bottom: 0px; margin-left: 0px; ">     PHI = 0,</DIV><DIV style="margin-top: 0px; margin-right: 0px; margin-bottom: 0px; margin-left: 0px; ">     INLINEASM = 1,</DIV><DIV style="margin-top: 0px; margin-right: 0px; margin-bottom: 0px; margin-left: 0px; ">-    LABEL = 2</DIV><DIV style="margin-top: 0px; margin-right: 0px; margin-bottom: 0px; margin-left: 0px; ">+    LABEL = 2,</DIV><DIV style="margin-top: 0px; margin-right: 0px; margin-bottom: 0px; margin-left: 0px; ">+    EXTRACT_SUBREG = 3,</DIV><DIV style="margin-top: 0px; margin-right: 0px; margin-bottom: 0px; margin-left: 0px; ">+    INSERT_SUBREG = 4</DIV><DIV style="margin-top: 0px; margin-right: 0px; margin-bottom: 0px; margin-left: 0px; ">   };</DIV><BR></DIV></BLOCKQUOTE><DIV><BR class="khtml-block-placeholder"></DIV>Ah, I see. Although I don't think this is necessary especially since they will be eliminated eventually. Can you treat them the same way as CopyToReg and CopyFromReg? <BR></DIV></BLOCKQUOTE><DIV><BR class="khtml-block-placeholder"></DIV><DIV>Unfortunately not. CopyToReg and CopyFromReg are selected to native target instructions in SelectionDAG. The point of EXTRACT_SUBREG and INSERT_SUBREG is that they exist until (or even through) register allocation. These machine instructions carry information about which subregister and/or superregister is involved in the operation and cannot be eliminated until that information is no longer needed, either in coalescing or in the LowerSubregs pass.</DIV><BR><BLOCKQUOTE type="cite"><DIV>Just add the operands to isel queue and don't select to a new node. If that works, we can remove TargetInstrInfo::EXTRACT_SUBREG, etc.</DIV></BLOCKQUOTE><DIV><BR class="khtml-block-placeholder"></DIV><DIV>This is counter to the approach that we discussed at the meeting at Apple. The decision was to have insert/extract machine instructions to track the information through register allocation. Selecting the operands and not emitting a node would end up with wrong live ranges, as LV/LI have no clue that the vregs involved are aliasing. I've tried an approach that affects something similar to what you describe, it involves using the wrong class for instructions (see <A href="http://llvm.org/bugs/show_bug.cgi?id=1350">http://llvm.org/bugs/show_bug.cgi?id=1350</A> comment #9). This approach depended on the subreg index on all MachineInstrs which we decided to remove, and IIRC it was decided that this was generally "not the way".</DIV></DIV></BLOCKQUOTE><DIV><BR class="khtml-block-placeholder"></DIV>Ok, I'd forgotten each MI does need a TargetInstrDescriptor so it cannot reuse ISD::EXTRACT_SUBREG. Never mind. Sorry about the confusion. :-)</DIV><DIV><BR class="khtml-block-placeholder"></DIV><DIV>Evan</DIV><DIV><BR><BLOCKQUOTE type="cite"><DIV><DIV><BR class="khtml-block-placeholder"></DIV><DIV>--</DIV><DIV>Chris</DIV><BR><BLOCKQUOTE type="cite"><DIV><BLOCKQUOTE type="cite"><DIV><BLOCKQUOTE type="cite"><DIV>These are similar to phi, copyfromreg, etc. <BR></DIV></BLOCKQUOTE><DIV><BR class="khtml-block-placeholder"></DIV><DIV>Not quite. The copyfrom/to reg and inlineasm nodes are ISD DAG nodes and are actually ISel'd in ScheduleDAG to the TargetInstrInfo types.</DIV><BR><BLOCKQUOTE type="cite"><DIV>Target opcodes are those that are target specific, I.e. not shared between targets.</DIV></BLOCKQUOTE><DIV><BR class="khtml-block-placeholder"></DIV><DIV>They're part of the low instruction numbers for all targets.</DIV><DIV>--</DIV><DIV>Chris</DIV><BR><BLOCKQUOTE type="cite"><DIV>On Jul 26, 2007, at 8:36 PM, Christopher Lamb <<A href="mailto:christopher.lamb@gmail.com">christopher.lamb@gmail.com</A>> wrote:<BR><BR></DIV><DIV></DIV><BLOCKQUOTE type="cite"><DIV><BR><DIV><DIV>On Jul 26, 2007, at 6:27 PM, Evan Cheng wrote:</DIV><BR class="Apple-interchange-newline"><BLOCKQUOTE type="cite"><BR><DIV><DIV>On Jul 26, 2007, at 1:12 AM, Christopher Lamb wrote:</DIV><BR class="Apple-interchange-newline"><BLOCKQUOTE type="cite"><DIV style="margin-top: 0px; margin-right: 0px; margin-bottom: 0px; margin-left: 0px; "><FONT face="Helvetica" size="3" style="font: 12.0px Helvetica"><SPAN class="Apple-converted-space"> </SPAN>/// EmitNode - Generate machine code for an node and needed dependencies.</FONT></DIV><DIV style="margin-top: 0px; margin-right: 0px; margin-bottom: 0px; margin-left: 0px; "><FONT face="Helvetica" size="3" style="font: 12.0px Helvetica"><SPAN class="Apple-converted-space"> </SPAN>///</FONT></DIV><DIV style="margin-top: 0px; margin-right: 0px; margin-bottom: 0px; margin-left: 0px; "><FONT face="Helvetica" size="3" style="font: 12.0px Helvetica"><SPAN class="Apple-converted-space"> </SPAN>void ScheduleDAG::EmitNode(SDNode *Node,<SPAN class="Apple-converted-space"> </SPAN></FONT></DIV><DIV style="margin-top: 0px; margin-right: 0px; margin-bottom: 0px; margin-left: 0px; "><FONT face="Helvetica" size="3" style="font: 12.0px Helvetica">@@ -436,6 +578,14 @@</FONT></DIV><DIV style="margin-top: 0px; margin-right: 0px; margin-bottom: 0px; margin-left: 0px; "><FONT face="Helvetica" size="3" style="font: 12.0px Helvetica"><SPAN class="Apple-converted-space">   </SPAN>// If machine instruction</FONT></DIV><DIV style="margin-top: 0px; margin-right: 0px; margin-bottom: 0px; margin-left: 0px; "><FONT face="Helvetica" size="3" style="font: 12.0px Helvetica"><SPAN class="Apple-converted-space">   </SPAN>if (Node->isTargetOpcode()) {</FONT></DIV><DIV style="margin-top: 0px; margin-right: 0px; margin-bottom: 0px; margin-left: 0px; "><FONT face="Helvetica" size="3" style="font: 12.0px Helvetica"><SPAN class="Apple-converted-space">     </SPAN>unsigned Opc = Node->getTargetOpcode();</FONT></DIV><DIV style="margin-top: 0px; margin-right: 0px; margin-bottom: 0px; margin-left: 0px; "><FONT face="Helvetica" size="3" style="font: 12.0px Helvetica">+ <SPAN class="Apple-converted-space">   </SPAN></FONT></DIV><DIV style="margin-top: 0px; margin-right: 0px; margin-bottom: 0px; margin-left: 0px; "><FONT face="Helvetica" size="3" style="font: 12.0px Helvetica">+<SPAN class="Apple-converted-space">    </SPAN>// Handle subreg insert/extract specially</FONT></DIV><DIV style="margin-top: 0px; margin-right: 0px; margin-bottom: 0px; margin-left: 0px; "><FONT face="Helvetica" size="3" style="font: 12.0px Helvetica">+<SPAN class="Apple-converted-space">    </SPAN>if (Opc == TargetInstrInfo::EXTRACT_SUBREG ||<SPAN class="Apple-converted-space"> </SPAN></FONT></DIV><DIV style="margin-top: 0px; margin-right: 0px; margin-bottom: 0px; margin-left: 0px; "><FONT face="Helvetica" size="3" style="font: 12.0px Helvetica">+<SPAN class="Apple-converted-space">        </SPAN>Opc == TargetInstrInfo::INSERT_SUBREG) {</FONT></DIV><DIV style="margin-top: 0px; margin-right: 0px; margin-bottom: 0px; margin-left: 0px; "><FONT face="Helvetica" size="3" style="font: 12.0px Helvetica">+<SPAN class="Apple-converted-space">      </SPAN>EmitSubregNode(Node, VRBaseMap);</FONT></DIV><DIV style="margin-top: 0px; margin-right: 0px; margin-bottom: 0px; margin-left: 0px; "><FONT face="Helvetica" size="3" style="font: 12.0px Helvetica">+<SPAN class="Apple-converted-space">      </SPAN>return;</FONT></DIV><DIV style="margin-top: 0px; margin-right: 0px; margin-bottom: 0px; margin-left: 0px; "><FONT face="Helvetica" size="3" style="font: 12.0px Helvetica">+<SPAN class="Apple-converted-space">    </SPAN>}</FONT></DIV><DIV style="margin-top: 0px; margin-right: 0px; margin-bottom: 0px; margin-left: 0px; "><FONT face="Helvetica" size="3" style="font: 12.0px Helvetica">+ <SPAN class="Apple-converted-space">   </SPAN></FONT></DIV> </BLOCKQUOTE></DIV><BR><DIV>Hi Chris,</DIV><DIV><BR class="khtml-block-placeholder"></DIV><DIV>Is this right? EXTRACT_SUBREG and INSERT_SUBREG are not target opcodes.</DIV></BLOCKQUOTE></DIV><DIV><BR class="khtml-block-placeholder"></DIV><DIV>Actually, they are both DAG nodes and target opcodes. ISel lowers the DAG nodes to target opcodes before schedule DAG sees them.</DIV><DIV> <SPAN class="Apple-style-span" style="border-collapse: separate; border-spacing: 0px 0px; color: rgb(0, 0, 0); font-family: Helvetica; font-size: 12px; font-style: normal; font-variant: normal; font-weight: normal; letter-spacing: normal; line-height: normal; text-align: auto; -khtml-text-decorations-in-effect: none; text-indent: 0px; -apple-text-size-adjust: auto; text-transform: none; orphans: 2; white-space: normal; widows: 2; word-spacing: 0px; "><SPAN class="Apple-style-span" style="border-collapse: separate; border-spacing: 0px 0px; color: rgb(0, 0, 0); font-family: Helvetica; font-size: 12px; font-style: normal; font-variant: normal; font-weight: normal; letter-spacing: normal; line-height: normal; text-align: auto; -khtml-text-decorations-in-effect: none; text-indent: 0px; -apple-text-size-adjust: auto; text-transform: none; orphans: 2; white-space: normal; widows: 2; word-spacing: 0px; "><DIV>--</DIV><DIV>Christopher Lamb</DIV><DIV><BR class="khtml-block-placeholder"></DIV><BR class="Apple-interchange-newline"></SPAN></SPAN> </DIV><BR></DIV></BLOCKQUOTE><BLOCKQUOTE type="cite"><DIV><SPAN>_______________________________________________</SPAN><BR><SPAN>llvm-commits mailing list</SPAN><BR><SPAN><A href="mailto:llvm-commits@cs.uiuc.edu">llvm-commits@cs.uiuc.edu</A></SPAN><BR><SPAN><A href="http://lists.cs.uiuc.edu/mailman/listinfo/llvm-commits">http://lists.cs.uiuc.edu/mailman/listinfo/llvm-commits</A></SPAN><BR></DIV></BLOCKQUOTE><DIV style="margin-top: 0px; margin-right: 0px; margin-bottom: 0px; margin-left: 0px; ">_______________________________________________</DIV><DIV style="margin-top: 0px; margin-right: 0px; margin-bottom: 0px; margin-left: 0px; ">llvm-commits mailing list</DIV><DIV style="margin-top: 0px; margin-right: 0px; margin-bottom: 0px; margin-left: 0px; "><A href="mailto:llvm-commits@cs.uiuc.edu">llvm-commits@cs.uiuc.edu</A></DIV><DIV style="margin-top: 0px; margin-right: 0px; margin-bottom: 0px; margin-left: 0px; "><A href="http://lists.cs.uiuc.edu/mailman/listinfo/llvm-commits">http://lists.cs.uiuc.edu/mailman/listinfo/llvm-commits</A></DIV> </BLOCKQUOTE></DIV><BR><DIV> <SPAN class="Apple-style-span" style="border-collapse: separate; border-spacing: 0px 0px; color: rgb(0, 0, 0); font-family: Helvetica; font-size: 12px; font-style: normal; font-variant: normal; font-weight: normal; letter-spacing: normal; line-height: normal; text-align: auto; -khtml-text-decorations-in-effect: none; text-indent: 0px; -apple-text-size-adjust: auto; text-transform: none; orphans: 2; white-space: normal; widows: 2; word-spacing: 0px; "><SPAN class="Apple-style-span" style="border-collapse: separate; border-spacing: 0px 0px; color: rgb(0, 0, 0); font-family: Helvetica; font-size: 12px; font-style: normal; font-variant: normal; font-weight: normal; letter-spacing: normal; line-height: normal; text-align: auto; -khtml-text-decorations-in-effect: none; text-indent: 0px; -apple-text-size-adjust: auto; text-transform: none; orphans: 2; white-space: normal; widows: 2; word-spacing: 0px; "><DIV>--</DIV><DIV>Christopher Lamb</DIV><DIV><BR class="khtml-block-placeholder"></DIV><BR class="Apple-interchange-newline"></SPAN></SPAN> </DIV><BR><DIV style="margin-top: 0px; margin-right: 0px; margin-bottom: 0px; margin-left: 0px; ">_______________________________________________</DIV><DIV style="margin-top: 0px; margin-right: 0px; margin-bottom: 0px; margin-left: 0px; ">llvm-commits mailing list</DIV><DIV style="margin-top: 0px; margin-right: 0px; margin-bottom: 0px; margin-left: 0px; "><A href="mailto:llvm-commits@cs.uiuc.edu">llvm-commits@cs.uiuc.edu</A></DIV><DIV style="margin-top: 0px; margin-right: 0px; margin-bottom: 0px; margin-left: 0px; "><A href="http://lists.cs.uiuc.edu/mailman/listinfo/llvm-commits">http://lists.cs.uiuc.edu/mailman/listinfo/llvm-commits</A></DIV> </BLOCKQUOTE></DIV><BR><DIV style="margin-top: 0px; margin-right: 0px; margin-bottom: 0px; margin-left: 0px; ">_______________________________________________</DIV><DIV style="margin-top: 0px; margin-right: 0px; margin-bottom: 0px; margin-left: 0px; ">llvm-commits mailing list</DIV><DIV style="margin-top: 0px; margin-right: 0px; margin-bottom: 0px; margin-left: 0px; "><A href="mailto:llvm-commits@cs.uiuc.edu">llvm-commits@cs.uiuc.edu</A></DIV><DIV style="margin-top: 0px; margin-right: 0px; margin-bottom: 0px; margin-left: 0px; "><A href="http://lists.cs.uiuc.edu/mailman/listinfo/llvm-commits">http://lists.cs.uiuc.edu/mailman/listinfo/llvm-commits</A></DIV> </BLOCKQUOTE></DIV><BR><DIV> <SPAN class="Apple-style-span" style="border-collapse: separate; border-spacing: 0px 0px; color: rgb(0, 0, 0); font-family: Helvetica; font-size: 12px; font-style: normal; font-variant: normal; font-weight: normal; letter-spacing: normal; line-height: normal; text-align: auto; -khtml-text-decorations-in-effect: none; text-indent: 0px; -apple-text-size-adjust: auto; text-transform: none; orphans: 2; white-space: normal; widows: 2; word-spacing: 0px; "><SPAN class="Apple-style-span" style="border-collapse: separate; border-spacing: 0px 0px; color: rgb(0, 0, 0); font-family: Helvetica; font-size: 12px; font-style: normal; font-variant: normal; font-weight: normal; letter-spacing: normal; line-height: normal; text-align: auto; -khtml-text-decorations-in-effect: none; text-indent: 0px; -apple-text-size-adjust: auto; text-transform: none; orphans: 2; white-space: normal; widows: 2; word-spacing: 0px; "><DIV>--</DIV><DIV>Christopher Lamb</DIV><DIV><BR class="khtml-block-placeholder"></DIV><BR class="Apple-interchange-newline"></SPAN></SPAN> </DIV><BR><DIV style="margin-top: 0px; margin-right: 0px; margin-bottom: 0px; margin-left: 0px; ">_______________________________________________</DIV><DIV style="margin-top: 0px; margin-right: 0px; margin-bottom: 0px; margin-left: 0px; ">llvm-commits mailing list</DIV><DIV style="margin-top: 0px; margin-right: 0px; margin-bottom: 0px; margin-left: 0px; "><A href="mailto:llvm-commits@cs.uiuc.edu">llvm-commits@cs.uiuc.edu</A></DIV><DIV style="margin-top: 0px; margin-right: 0px; margin-bottom: 0px; margin-left: 0px; "><A href="http://lists.cs.uiuc.edu/mailman/listinfo/llvm-commits">http://lists.cs.uiuc.edu/mailman/listinfo/llvm-commits</A></DIV> </BLOCKQUOTE></DIV><BR></BODY></HTML>