<html>
  <head>
    <meta content="text/html; charset=ISO-8859-1"
      http-equiv="Content-Type">
  </head>
  <body text="#000000" bgcolor="#FFFFFF">
    <div class="moz-cite-prefix">Am 21.07.2013 07:24, schrieb Nadav
      Rotem:<br>
    </div>
    <blockquote
      cite="mid:05984B2A-F381-4C4F-B64F-7C05C4EF6831@apple.com"
      type="cite">
      <meta http-equiv="Content-Type" content="text/html;
        charset=ISO-8859-1">
      David, 
      <div><br>
      </div>
      <div>I am really happy to see that you are working on this. As
        part of the discussions on replacing SelectionDAG with something
        new, a few people mentioned that it would be much easier to
        migrate to a new infrastructure if the patterns were written in
        patterns such as the ones that you are proposing.  I like your
        approach. I look forward to seeing the complete patch. </div>
      <div><br>
      </div>
    </blockquote>
    <br>
    Completely agreeing on this, I was already wondering why matching
    SelectionDAG nodes looked so conventional while matching LLVM IR has
    a rather elegant solution.<br>
    <br>
    Please leave me a notice if you have a complete solution,<br>
    Christian.<br>
    <br>
    <blockquote
      cite="mid:05984B2A-F381-4C4F-B64F-7C05C4EF6831@apple.com"
      type="cite">
      <div>
        <div>
          <blockquote type="cite">
            <div style="font-family: Helvetica; font-size: 12px;
              font-style: normal; font-variant: normal; font-weight:
              normal; letter-spacing: normal; line-height: normal;
              orphans: auto; text-align: start; text-indent: 0px;
              text-transform: none; white-space: normal; widows: auto;
              word-spacing: 0px; -webkit-text-stroke-width: 0px;">
              <div dir="ltr">
                <div><br>
                </div>
                <div>I have a simple implementation attached, it matches
                  on SDValue types and provides a convenience overload
                  for SDNodes.</div>
                <div><br>
                </div>
                <div>Currently, it uses similar names to PattternMatch.h
                  (match, m_And, etc.).</div>
                <div>I don't really care about the names but I figured
                  to start with something familiar. They shouldn't
                  conflict because they would both exist in their own
                  namespaces.</div>
                <div><br>
                </div>
                <div>The effect is pretty nice on some DAGCombiner code:</div>
                <div><br>
                </div>
                <div>   // (or (and X, C1), (and Y, C2))  -> (and (or
                  X, Y), C3) if possible.</div>
                <div>   if (N0.getOpcode() == ISD::AND &&</div>
                <div>       N1.getOpcode() == ISD::AND &&</div>
                <div>       N0.getOperand(1).getOpcode() ==
                  ISD::Constant &&</div>
                <div>       N1.getOperand(1).getOpcode() ==
                  ISD::Constant &&</div>
                <div>       // Don't increase # computations.<br>
                </div>
                <div>       (N0.getNode()->hasOneUse() ||
                  N1.getNode()->hasOneUse())) {</div>
                <div>     const APInt &LHSMask =</div>
                <div>     
                   cast<ConstantSDNode>(N0.getOperand(1))->getAPIntValue();</div>
                <div>     const APInt &RHSMask =</div>
                <div>     
                   cast<ConstantSDNode>(N1.getOperand(1))->getAPIntValue();</div>
                <div><br>
                </div>
                <div>becomes:</div>
                <div>   const APInt *LHSMask, *RHSMask;</div>
                <div>   if (match(N0, m_And(m_Value(),
                  m_APInt(LHSMask))) &&<br>
                </div>
                <div>       match(N1, m_And(m_Value(),
                  m_APInt(RHSMask))) &&<br>
                </div>
                <div>       // Don't increase # computations.<br>
                </div>
                <div>       (match(N0, m_OneUse()) || match(N1,
                  m_OneUse()))) {</div>
                <div><br>
                </div>
                <div>Note that the attached implementation is pretty
                  incomplete, I just wanted a proof of concept before I
                  run off and flesh it out further.</div>
                <div><br>
                </div>
                <div>Thanks</div>
                <div><br>
                </div>
                <div>-- </div>
                <div>David Majnemer</div>
              </div>
              <span><ns.h></span>_______________________________________________<br>
              llvm-commits mailing list<br>
              <a moz-do-not-send="true"
                href="mailto:llvm-commits@cs.uiuc.edu">llvm-commits@cs.uiuc.edu</a><br>
              <a moz-do-not-send="true"
                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>
      <br>
      <fieldset class="mimeAttachmentHeader"></fieldset>
      <br>
      <pre wrap="">_______________________________________________
llvm-commits mailing list
<a class="moz-txt-link-abbreviated" href="mailto:llvm-commits@cs.uiuc.edu">llvm-commits@cs.uiuc.edu</a>
<a class="moz-txt-link-freetext" href="http://lists.cs.uiuc.edu/mailman/listinfo/llvm-commits">http://lists.cs.uiuc.edu/mailman/listinfo/llvm-commits</a>
</pre>
    </blockquote>
    <br>
  </body>
</html>