[llvm-commits] CVS: llvm/utils/TableGen/DAGISelEmitter.cpp

Evan Cheng evan.cheng at apple.com
Fri Jul 21 15:20:03 PDT 2006



Changes in directory llvm/utils/TableGen:

DAGISelEmitter.cpp updated: 1.224 -> 1.225
---
Log message:

Removed a hack intended to allow (store (op (load))) folding. Will handle this with preprocessing.

---
Diffs of the changes:  (+7 -52)

 DAGISelEmitter.cpp |   59 ++++++-----------------------------------------------
 1 files changed, 7 insertions(+), 52 deletions(-)


Index: llvm/utils/TableGen/DAGISelEmitter.cpp
diff -u llvm/utils/TableGen/DAGISelEmitter.cpp:1.224 llvm/utils/TableGen/DAGISelEmitter.cpp:1.225
--- llvm/utils/TableGen/DAGISelEmitter.cpp:1.224	Thu Jul 20 18:36:20 2006
+++ llvm/utils/TableGen/DAGISelEmitter.cpp	Fri Jul 21 17:19:51 2006
@@ -2123,7 +2123,6 @@
   std::vector<std::string> &TargetVTs;
 
   std::string ChainName;
-  bool NewTF;
   bool DoReplace;
   unsigned TmpNo;
   unsigned OpcNo;
@@ -2159,7 +2158,7 @@
                      bool dorep)
   : ISE(ise), Predicates(preds), Pattern(pattern), Instruction(instr),
     GeneratedCode(gc), GeneratedDecl(gd), TargetOpcodes(to), TargetVTs(tv),
-    NewTF(false), DoReplace(dorep), TmpNo(0), OpcNo(0), VTNo(0) {}
+    DoReplace(dorep), TmpNo(0), OpcNo(0), VTNo(0) {}
 
   /// EmitMatchCode - Emit a matcher for N, going to the label for PatternNo
   /// if the match fails. At this point, we already know that the opcode for N
@@ -2293,19 +2292,14 @@
       }
 
       if (NodeHasChain) {
+        if (FoundChain)
+          emitCheck("Chain.Val == " + RootName + ".Val");
+        else
+          FoundChain = true;
         ChainName = "Chain" + ChainSuffix;
         emitDecl(ChainName);
-        if (FoundChain) {
-         // FIXME: temporary workaround for a common case where chain
-         // is a TokenFactor and the previous "inner" chain is an operand.
-          NewTF = true;
-          emitDecl("OldTF", 1);
-          emitCheck("(" + ChainName + " = UpdateFoldedChain(CurDAG, " +
-                    RootName + ".Val, Chain.Val, OldTF)).Val");
-        } else {
-          FoundChain = true;
-          emitCode(ChainName + " = " + RootName + ".getOperand(0);");
-        }
+        emitCode(ChainName + " = " + RootName +
+                 ".getOperand(0);");
       }
     }
 
@@ -2762,11 +2756,6 @@
         if (!isRoot)
           return std::make_pair(1, ResNo);
 
-        if (NewTF)
-          emitCode("if (OldTF) "
-                   "SelectionDAG::InsertISelMapEntry(CodeGenMap, OldTF, 0, " +
-                   ChainName + ".Val, 0);");
-
         for (unsigned i = 0; i < NumResults; i++)
           emitCode("SelectionDAG::InsertISelMapEntry(CodeGenMap, N.Val, " +
                    utostr(i) + ", ResNode, " + utostr(i) + ");");
@@ -3740,40 +3729,6 @@
   OS << "}\n";
 
   OS << "\n";
-  OS << "// UpdateFoldedChain - return a SDOperand of the new chain created\n";
-  OS << "// if the folding were to happen. This is called when, for example,\n";
-  OS << "// a load is folded into a store. If the store's chain is the load,\n";
-  OS << "// then the resulting node's input chain would be the load's input\n";
-  OS << "// chain. If the store's chain is a TokenFactor and the load's\n";
-  OS << "// output chain feeds into in, then the new chain is a TokenFactor\n";
-  OS << "// with the other operands along with the input chain of the load.\n";
-  OS << "SDOperand UpdateFoldedChain(SelectionDAG *DAG, SDNode *N, "
-     << "SDNode *Chain, SDNode* &OldTF) {\n";
-  OS << "  OldTF = NULL;\n";
-  OS << "  if (N == Chain) {\n";
-  OS << "    return N->getOperand(0);\n";
-  OS << "  } else if (Chain->getOpcode() == ISD::TokenFactor &&\n";
-  OS << "             N->isOperand(Chain)) {\n";
-  OS << "    SDOperand Ch = SDOperand(Chain, 0);\n";
-  OS << "    std::map<SDOperand, SDOperand>::iterator CGMI = "
-     << "CodeGenMap.find(Ch);\n";
-  OS << "    if (CGMI != CodeGenMap.end())\n";
-  OS << "      return SDOperand(0, 0);\n";
-  OS << "    OldTF = Chain;\n";
-  OS << "    std::vector<SDOperand> Ops;\n";
-  OS << "    for (unsigned i = 0; i < Chain->getNumOperands(); ++i) {\n";
-  OS << "      SDOperand Op = Chain->getOperand(i);\n";
-  OS << "      if (Op.Val == N)\n";
-  OS << "        Ops.push_back(N->getOperand(0));\n";
-  OS << "      else\n";
-  OS << "        Ops.push_back(Op);\n";
-  OS << "    }\n";
-  OS << "    return DAG->getNode(ISD::TokenFactor, MVT::Other, Ops);\n";
-  OS << "  }\n";
-  OS << "  return SDOperand(0, 0);\n";
-  OS << "}\n";
-
-  OS << "\n";
   OS << "// SelectRoot - Top level entry to DAG isel.\n";
   OS << "SDOperand SelectRoot(SDOperand N) {\n";
   OS << "  SDOperand ResNode;\n";






More information about the llvm-commits mailing list