<html><body style="word-wrap: break-word; -webkit-nbsp-mode: space; -webkit-line-break: after-white-space; "><br><div><blockquote type="cite"><font class="Apple-style-span" color="#000000"><br></font><br><blockquote type="cite">==============================================================================<br></blockquote><blockquote type="cite">--- llvm/trunk/utils/TableGen/DAGISelEmitter.cpp (original)<br></blockquote><blockquote type="cite">+++ llvm/trunk/utils/TableGen/DAGISelEmitter.cpp Wed Feb  6 16:27:42 2008<br></blockquote><blockquote type="cite">@@ -313,6 +313,12 @@<br></blockquote><blockquote type="cite">  std::vector<std::pair<std::string, std::string> > OrigChains;<br></blockquote><blockquote type="cite">  std::set<std::string> Duplicates;<br></blockquote><blockquote type="cite"><br></blockquote><blockquote type="cite">+  /// LSI - Load/Store information.<br></blockquote><blockquote type="cite">+  /// Save loads/stores matched by a pattern, and generate a MemOperandSDNode<br></blockquote><blockquote type="cite">+  /// for each memory access. This facilitates the use of AliasAnalysis in<br></blockquote><blockquote type="cite">+  /// the backend.<br></blockquote><blockquote type="cite">+  std::vector<std::string> LSI;<br></blockquote><blockquote type="cite">+<br></blockquote><blockquote type="cite">  /// GeneratedCode - This is the buffer that we emit code to.  The first int<br></blockquote><blockquote type="cite">  /// indicates whether this is an exit predicate (something that should be<br></blockquote><blockquote type="cite">  /// tested, and if true, the match fails) [when 1], or normal code to emit<br></blockquote><blockquote type="cite">@@ -373,6 +379,16 @@<br></blockquote><blockquote type="cite">  void EmitMatchCode(TreePatternNode *N, TreePatternNode *P,<br></blockquote><blockquote type="cite">                     const std::string &RootName, const std::string &ChainSuffix,<br></blockquote><blockquote type="cite">                     bool &FoundChain) {<br></blockquote><blockquote type="cite">+<br></blockquote><blockquote type="cite">+    // Save loads/stores matched by a pattern.<br></blockquote><blockquote type="cite">+    if (!N->isLeaf() && N->getName().empty()) {<br></blockquote><blockquote type="cite">+      std::string EnumName = N->getOperator()->getValueAsString("Opcode");<br></blockquote><blockquote type="cite">+      if (EnumName == "ISD::LOAD" ||<br></blockquote><blockquote type="cite">+          EnumName == "ISD::STORE") {<br></blockquote><blockquote type="cite">+        LSI.push_back(RootName);<br></blockquote><blockquote type="cite">+      }<br></blockquote><blockquote type="cite">+    }<br></blockquote><blockquote type="cite">+<br></blockquote><blockquote type="cite">    bool isRoot = (P == NULL);<br></blockquote><blockquote type="cite">    // Emit instruction predicates. Each predicate is just a string for now.<br></blockquote><blockquote type="cite">    if (isRoot) {<br></blockquote><blockquote type="cite">@@ -944,6 +960,18 @@<br></blockquote><blockquote type="cite">        }<br></blockquote><blockquote type="cite">      }<br></blockquote><blockquote type="cite"><br></blockquote><blockquote type="cite">+      // Generate MemOperandSDNodes nodes for each memory accesses covered by this<br></blockquote><blockquote type="cite">+      // pattern.<br></blockquote><blockquote type="cite">+      if (isRoot) {<br></blockquote><blockquote type="cite">+        std::vector<std::string>::const_iterator mi, mie;<br></blockquote><blockquote type="cite">+        for (mi = LSI.begin(), mie = LSI.end(); mi != mie; ++mi) {<br></blockquote><blockquote type="cite">+          emitCode("SDOperand LSI_" + *mi + " = "<br></blockquote><blockquote type="cite">+                   "CurDAG->getMemOperand(cast<LSBaseSDNode>(" +<br></blockquote><blockquote type="cite">+                   *mi + ")->getMemOperand());");<br></blockquote><blockquote type="cite">+          AllOps.push_back("LSI_" + *mi);<br></blockquote><blockquote type="cite">+        }<br></blockquote><blockquote type="cite">+      }<br></blockquote><blockquote type="cite">+</blockquote></blockquote><br></div><div>This doesn't seem safe. What if the pattern involves target specific load / store nodes? Perhaps you can add a node property, e.g. SDNPHasMemOp, to tell tblgen which operands would add memory operands to the resulting target node?</div><div><br class="webkit-block-placeholder"></div><div>Thanks,</div><div><br class="webkit-block-placeholder"></div><div>Evan</div></body></html>